summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authorMatthew <stteg@hotmail.com>2016-03-12 14:52:07 -0500
committermd_5 <git@md-5.net>2016-03-13 08:25:27 +1100
commitcbebfa439fa1c7a261d19bc60796d62230ebf924 (patch)
treeafd449eafb1e6e69e43e121f9076408bbc9a6f1c /nms-patches
parent6026dad12479bef92ca7a51ca2f9009207843e82 (diff)
downloadcraftbukkit-cbebfa439fa1c7a261d19bc60796d62230ebf924.tar
craftbukkit-cbebfa439fa1c7a261d19bc60796d62230ebf924.tar.gz
craftbukkit-cbebfa439fa1c7a261d19bc60796d62230ebf924.tar.lz
craftbukkit-cbebfa439fa1c7a261d19bc60796d62230ebf924.tar.xz
craftbukkit-cbebfa439fa1c7a261d19bc60796d62230ebf924.zip
SPIGOT-1849: Call EntityBlockFormEvent when an entity forms frosted ice using frost walker
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/EnchantmentFrostWalker.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/nms-patches/EnchantmentFrostWalker.patch b/nms-patches/EnchantmentFrostWalker.patch
new file mode 100644
index 00000000..dafe3811
--- /dev/null
+++ b/nms-patches/EnchantmentFrostWalker.patch
@@ -0,0 +1,32 @@
+--- a/net/minecraft/server/EnchantmentFrostWalker.java
++++ b/net/minecraft/server/EnchantmentFrostWalker.java
+@@ -1,5 +1,8 @@
+ package net.minecraft.server;
+
++import org.bukkit.craftbukkit.util.CraftMagicNumbers;
++import org.bukkit.event.block.EntityBlockFormEvent;
++
+ import java.util.Iterator;
+
+ public class EnchantmentFrostWalker extends Enchantment {
+@@ -42,8 +45,18 @@
+ IBlockData iblockdata1 = world.getType(blockposition_mutableblockposition1);
+
+ if (iblockdata1.getMaterial() == Material.WATER && ((Integer) iblockdata1.get(BlockFluids.LEVEL)).intValue() == 0 && world.a(Blocks.de, blockposition_mutableblockposition1, false, EnumDirection.DOWN, (Entity) null, (ItemStack) null)) {
+- world.setTypeUpdate(blockposition_mutableblockposition1, Blocks.de.getBlockData());
+- world.a(blockposition_mutableblockposition1.h(), Blocks.de, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
++ // CraftBukkit Start - Call EntityBlockFormEvent for Frost Walker
++ org.bukkit.block.BlockState blockState = world.getWorld().getBlockAt(blockposition_mutableblockposition1.getX(), blockposition_mutableblockposition1.getY(), blockposition_mutableblockposition1.getZ()).getState();
++ blockState.setType(CraftMagicNumbers.getMaterial(Blocks.de)); // PAIL - Rename de->FROSTED_ICE
++
++ EntityBlockFormEvent event = new EntityBlockFormEvent(entityliving.bukkitEntity, blockState.getBlock(), blockState);
++ world.getServer().getPluginManager().callEvent(event);
++
++ if (!event.isCancelled()) {
++ blockState.update(true);
++ world.a(blockposition_mutableblockposition1.h(), Blocks.de, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
++ }
++ // CraftBukkit End
+ }
+ }
+ }