summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2017-06-03 17:39:03 +1000
committermd_5 <git@md-5.net>2017-06-03 17:39:03 +1000
commit701b06494ddf4a807788f159fe5aa7e63dff7a42 (patch)
tree8600577d8bd0d3c96034f8c6846e6579f1c81e0d
parent921ba53556066ee16cb212e564ee9403fb6a73ff (diff)
downloadcraftbukkit-701b06494ddf4a807788f159fe5aa7e63dff7a42.tar
craftbukkit-701b06494ddf4a807788f159fe5aa7e63dff7a42.tar.gz
craftbukkit-701b06494ddf4a807788f159fe5aa7e63dff7a42.tar.lz
craftbukkit-701b06494ddf4a807788f159fe5aa7e63dff7a42.tar.xz
craftbukkit-701b06494ddf4a807788f159fe5aa7e63dff7a42.zip
SPIGOT-3286: Call BlockFormEvent for Concrete Powder -> Concrete
-rw-r--r--nms-patches/BlockConcretePowder.patch22
-rw-r--r--nms-patches/BlockFlowing.patch2
-rw-r--r--nms-patches/BlockFluids.patch4
-rw-r--r--nms-patches/EnchantmentFrostWalker.patch2
-rw-r--r--nms-patches/EntitySnowman.patch2
-rw-r--r--nms-patches/WorldServer.patch4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java5
7 files changed, 32 insertions, 9 deletions
diff --git a/nms-patches/BlockConcretePowder.patch b/nms-patches/BlockConcretePowder.patch
new file mode 100644
index 00000000..dd2708f7
--- /dev/null
+++ b/nms-patches/BlockConcretePowder.patch
@@ -0,0 +1,22 @@
+--- a/net/minecraft/server/BlockConcretePowder.java
++++ b/net/minecraft/server/BlockConcretePowder.java
+@@ -11,8 +11,8 @@
+ }
+
+ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {
+- if (iblockdata1.getMaterial().isLiquid()) {
+- world.setTypeAndData(blockposition, Blocks.dR.getBlockData().set(BlockCloth.COLOR, iblockdata.get(BlockConcretePowder.a)), 3);
++ if (iblockdata1.getMaterial().isLiquid() && world.getType(blockposition).getBlock() != Blocks.dR) { // CraftBukkit - don't double concrete
++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.dR.getBlockData().set(BlockCloth.COLOR, iblockdata.get(BlockConcretePowder.a)), null); // CraftBukkit
+ }
+
+ }
+@@ -36,7 +36,7 @@
+ }
+
+ if (flag) {
+- world.setTypeAndData(blockposition, Blocks.dR.getBlockData().set(BlockCloth.COLOR, iblockdata.get(BlockConcretePowder.a)), 3);
++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.dR.getBlockData().set(BlockCloth.COLOR, iblockdata.get(BlockConcretePowder.a)), null); // CraftBukkit
+ }
+
+ return flag;
diff --git a/nms-patches/BlockFlowing.patch b/nms-patches/BlockFlowing.patch
index d6253aff..55906695 100644
--- a/nms-patches/BlockFlowing.patch
+++ b/nms-patches/BlockFlowing.patch
@@ -33,7 +33,7 @@
- world.setTypeUpdate(blockposition.down(), Blocks.STONE.getBlockData());
- this.fizz(world, blockposition.down());
+ // CraftBukkit start
-+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition.down(), Blocks.STONE, null)) {
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition.down(), Blocks.STONE.getBlockData(), null)) {
+ this.fizz(world, blockposition.down());
+ }
+ // CraftBukkit end
diff --git a/nms-patches/BlockFluids.patch b/nms-patches/BlockFluids.patch
index 8708adc5..cccec394 100644
--- a/nms-patches/BlockFluids.patch
+++ b/nms-patches/BlockFluids.patch
@@ -7,7 +7,7 @@
- world.setTypeUpdate(blockposition, Blocks.OBSIDIAN.getBlockData());
- this.fizz(world, blockposition);
+ // CraftBukkit start
-+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.OBSIDIAN, null)) {
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.OBSIDIAN.getBlockData(), null)) {
+ this.fizz(world, blockposition);
+ }
+ // CraftBukkit end
@@ -18,7 +18,7 @@
- world.setTypeUpdate(blockposition, Blocks.COBBLESTONE.getBlockData());
- this.fizz(world, blockposition);
+ // CraftBukkit start
-+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.COBBLESTONE, null)) {
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.COBBLESTONE.getBlockData(), null)) {
+ this.fizz(world, blockposition);
+ }
+ // CraftBukkit end
diff --git a/nms-patches/EnchantmentFrostWalker.patch b/nms-patches/EnchantmentFrostWalker.patch
index fedf1a39..c4f9f2b8 100644
--- a/nms-patches/EnchantmentFrostWalker.patch
+++ b/nms-patches/EnchantmentFrostWalker.patch
@@ -16,7 +16,7 @@
- world.setTypeUpdate(blockposition_mutableblockposition1, Blocks.FROSTED_ICE.getBlockData());
- world.a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
+ // CraftBukkit Start - Call EntityBlockFormEvent for Frost Walker
-+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition_mutableblockposition1, Blocks.FROSTED_ICE, entityliving)) {
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition_mutableblockposition1, Blocks.FROSTED_ICE.getBlockData(), entityliving)) {
+ world.a(blockposition_mutableblockposition1.h(), Blocks.FROSTED_ICE, MathHelper.nextInt(entityliving.getRandom(), 60, 120));
+ }
+ // CraftBukkit End
diff --git a/nms-patches/EntitySnowman.patch b/nms-patches/EntitySnowman.patch
index 244f48b1..029613e4 100644
--- a/nms-patches/EntitySnowman.patch
+++ b/nms-patches/EntitySnowman.patch
@@ -26,7 +26,7 @@
if (this.world.getType(blockposition).getMaterial() == Material.AIR && this.world.getBiome(blockposition).a(blockposition) < 0.8F && Blocks.SNOW_LAYER.canPlace(this.world, blockposition)) {
- this.world.setTypeUpdate(blockposition, Blocks.SNOW_LAYER.getBlockData());
-+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.world, blockposition, Blocks.SNOW_LAYER, this); // CraftBukkit
++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.world, blockposition, Blocks.SNOW_LAYER.getBlockData(), this); // CraftBukkit
}
}
}
diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch
index 0939b139..a5a556f0 100644
--- a/nms-patches/WorldServer.patch
+++ b/nms-patches/WorldServer.patch
@@ -284,12 +284,12 @@
if (this.v(blockposition1)) {
- this.setTypeUpdate(blockposition1, Blocks.ICE.getBlockData());
-+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, Blocks.ICE, null); // CraftBukkit
++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, Blocks.ICE.getBlockData(), null); // CraftBukkit
}
if (flag && this.f(blockposition, true)) {
- this.setTypeUpdate(blockposition, Blocks.SNOW_LAYER.getBlockData());
-+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW_LAYER, null); // CraftBukkit
++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW_LAYER.getBlockData(), null); // CraftBukkit
}
if (flag && this.getBiome(blockposition1).d()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 1c0dc7d6..be0f46f9 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1041,9 +1041,10 @@ public class CraftEventFactory {
return event;
}
- public static boolean handleBlockFormEvent(World world, BlockPosition pos, net.minecraft.server.Block block, @Nullable Entity entity) {
+ public static boolean handleBlockFormEvent(World world, BlockPosition pos, IBlockData block, @Nullable Entity entity) {
BlockState blockState = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()).getState();
- blockState.setType(CraftMagicNumbers.getMaterial(block));
+ blockState.setType(CraftMagicNumbers.getMaterial(block.getBlock()));
+ blockState.setRawData((byte) block.getBlock().toLegacyData(block));
BlockFormEvent event = (entity == null) ? new BlockFormEvent(blockState.getBlock(), blockState) : new EntityBlockFormEvent(entity.getBukkitEntity(), blockState.getBlock(), blockState);
world.getServer().getPluginManager().callEvent(event);