mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
SPIGOT-4760: BlockSpreadEvent for Bamboo growth
This commit is contained in:
parent
4b9b0f4d5b
commit
735f4ea33e
39
nms-patches/BlockBamboo.patch
Normal file
39
nms-patches/BlockBamboo.patch
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
--- a/net/minecraft/server/BlockBamboo.java
|
||||||
|
+++ b/net/minecraft/server/BlockBamboo.java
|
||||||
|
@@ -159,14 +159,18 @@
|
||||||
|
BlockPosition blockposition1 = blockposition.down(2);
|
||||||
|
IBlockData iblockdata2 = world.getType(blockposition1);
|
||||||
|
BlockPropertyBambooSize blockpropertybamboosize = BlockPropertyBambooSize.NONE;
|
||||||
|
+ boolean shouldUpdateOthers = false; // CraftBukkit
|
||||||
|
|
||||||
|
if (i >= 1) {
|
||||||
|
if (iblockdata1.getBlock() == Blocks.BAMBOO && iblockdata1.get(BlockBamboo.e) != BlockPropertyBambooSize.NONE) {
|
||||||
|
if (iblockdata1.getBlock() == Blocks.BAMBOO && iblockdata1.get(BlockBamboo.e) != BlockPropertyBambooSize.NONE) {
|
||||||
|
blockpropertybamboosize = BlockPropertyBambooSize.LARGE;
|
||||||
|
if (iblockdata2.getBlock() == Blocks.BAMBOO) {
|
||||||
|
- world.setTypeAndData(blockposition.down(), (IBlockData) iblockdata1.set(BlockBamboo.e, BlockPropertyBambooSize.SMALL), 3);
|
||||||
|
- world.setTypeAndData(blockposition1, (IBlockData) iblockdata2.set(BlockBamboo.e, BlockPropertyBambooSize.NONE), 3);
|
||||||
|
+ // CraftBukkit start - moved down
|
||||||
|
+ // world.setTypeAndData(blockposition.down(), (IBlockData) iblockdata1.set(BlockBamboo.e, BlockPropertyBambooSize.SMALL), 3);
|
||||||
|
+ // world.setTypeAndData(blockposition1, (IBlockData) iblockdata2.set(BlockBamboo.e, BlockPropertyBambooSize.NONE), 3);
|
||||||
|
+ shouldUpdateOthers = true;
|
||||||
|
+ // CraftBukkit end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
@@ -177,7 +181,14 @@
|
||||||
|
int j = (Integer) iblockdata.get(BlockBamboo.d) != 1 && iblockdata2.getBlock() != Blocks.BAMBOO ? 0 : 1;
|
||||||
|
int k = (i < 11 || random.nextFloat() >= 0.25F) && i != 15 ? 0 : 1;
|
||||||
|
|
||||||
|
- world.setTypeAndData(blockposition.up(), (IBlockData) ((IBlockData) ((IBlockData) this.getBlockData().set(BlockBamboo.d, j)).set(BlockBamboo.e, blockpropertybamboosize)).set(BlockBamboo.f, k), 3);
|
||||||
|
+ // CraftBukkit start
|
||||||
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition.up(), (IBlockData) ((IBlockData) ((IBlockData) this.getBlockData().set(BlockBamboo.d, j)).set(BlockBamboo.e, blockpropertybamboosize)).set(BlockBamboo.f, k), 3)) {
|
||||||
|
+ if (shouldUpdateOthers) {
|
||||||
|
+ world.setTypeAndData(blockposition.down(), (IBlockData) iblockdata1.set(BlockBamboo.e, BlockPropertyBambooSize.SMALL), 3);
|
||||||
|
+ world.setTypeAndData(blockposition1, (IBlockData) iblockdata2.set(BlockBamboo.e, BlockPropertyBambooSize.NONE), 3);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ // CraftBukkit end
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int a(IBlockAccess iblockaccess, BlockPosition blockposition) {
|
Loading…
Reference in New Issue
Block a user