PaperMC/nms-patches/BlockCactus.patch

34 lines
1.5 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/BlockCactus.java
+++ b/net/minecraft/server/BlockCactus.java
@@ -3,6 +3,8 @@
import java.util.Iterator;
import java.util.Random;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockCactus extends Block {
public static final BlockStateInteger AGE = BlockStateInteger.of("age", 0, 15);
2016-02-29 22:32:46 +01:00
@@ -30,9 +32,10 @@
int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue();
if (j == 15) {
- world.setTypeUpdate(blockposition1, this.getBlockData());
2014-12-11 01:44:30 +01:00
+ // world.setTypeUpdate(blockposition1, this.getBlockData()); // CraftBukkit
IBlockData iblockdata1 = iblockdata.set(BlockCactus.AGE, Integer.valueOf(0));
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition1.getX(), blockposition1.getY(), blockposition1.getZ(), this, 0); // CraftBukkit
2014-12-11 01:44:30 +01:00
world.setTypeAndData(blockposition, iblockdata1, 4);
2016-05-10 13:47:39 +02:00
iblockdata1.doPhysics(world, blockposition1, this);
} else {
@@ -87,7 +90,9 @@
}
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
+ CraftEventFactory.blockDamage = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); // CraftBukkit
entity.damageEntity(DamageSource.CACTUS, 1.0F);
+ CraftEventFactory.blockDamage = null; // CraftBukkit
}
public IBlockData fromLegacyData(int i) {