mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 11:44:19 +01:00
8398e12b34
By: md_5 <git@md-5.net>
48 lines
3.5 KiB
Diff
48 lines
3.5 KiB
Diff
--- a/net/minecraft/world/level/block/BlockBamboo.java
|
|
+++ b/net/minecraft/world/level/block/BlockBamboo.java
|
|
@@ -187,7 +187,7 @@
|
|
BlockPosition blockposition1 = blockposition.above(i);
|
|
IBlockData iblockdata1 = worldserver.getBlockState(blockposition1);
|
|
|
|
- if (k >= 16 || (Integer) iblockdata1.getValue(BlockBamboo.STAGE) == 1 || !worldserver.isEmptyBlock(blockposition1.above())) {
|
|
+ if (k >= 16 || !iblockdata1.is(Blocks.BAMBOO) || (Integer) iblockdata1.getValue(BlockBamboo.STAGE) == 1 || !worldserver.isEmptyBlock(blockposition1.above())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here
|
|
return;
|
|
}
|
|
|
|
@@ -208,14 +208,18 @@
|
|
BlockPosition blockposition1 = blockposition.below(2);
|
|
IBlockData iblockdata2 = world.getBlockState(blockposition1);
|
|
BlockPropertyBambooSize blockpropertybamboosize = BlockPropertyBambooSize.NONE;
|
|
+ boolean shouldUpdateOthers = false; // CraftBukkit
|
|
|
|
if (i >= 1) {
|
|
if (iblockdata1.is(Blocks.BAMBOO) && iblockdata1.getValue(BlockBamboo.LEAVES) != BlockPropertyBambooSize.NONE) {
|
|
if (iblockdata1.is(Blocks.BAMBOO) && iblockdata1.getValue(BlockBamboo.LEAVES) != BlockPropertyBambooSize.NONE) {
|
|
blockpropertybamboosize = BlockPropertyBambooSize.LARGE;
|
|
if (iblockdata2.is(Blocks.BAMBOO)) {
|
|
- world.setBlock(blockposition.below(), (IBlockData) iblockdata1.setValue(BlockBamboo.LEAVES, BlockPropertyBambooSize.SMALL), 3);
|
|
- world.setBlock(blockposition1, (IBlockData) iblockdata2.setValue(BlockBamboo.LEAVES, BlockPropertyBambooSize.NONE), 3);
|
|
+ // CraftBukkit start - moved down
|
|
+ // world.setBlock(blockposition.below(), (IBlockData) iblockdata1.setValue(BlockBamboo.LEAVES, BlockPropertyBambooSize.SMALL), 3);
|
|
+ // world.setBlock(blockposition1, (IBlockData) iblockdata2.setValue(BlockBamboo.LEAVES, BlockPropertyBambooSize.NONE), 3);
|
|
+ shouldUpdateOthers = true;
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
} else {
|
|
@@ -226,7 +230,14 @@
|
|
int j = (Integer) iblockdata.getValue(BlockBamboo.AGE) != 1 && !iblockdata2.is(Blocks.BAMBOO) ? 0 : 1;
|
|
int k = (i < 11 || randomsource.nextFloat() >= 0.25F) && i != 15 ? 0 : 1;
|
|
|
|
- world.setBlock(blockposition.above(), (IBlockData) ((IBlockData) ((IBlockData) this.defaultBlockState().setValue(BlockBamboo.AGE, j)).setValue(BlockBamboo.LEAVES, blockpropertybamboosize)).setValue(BlockBamboo.STAGE, k), 3);
|
|
+ // CraftBukkit start
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition.above(), (IBlockData) ((IBlockData) ((IBlockData) this.defaultBlockState().setValue(BlockBamboo.AGE, j)).setValue(BlockBamboo.LEAVES, blockpropertybamboosize)).setValue(BlockBamboo.STAGE, k), 3)) {
|
|
+ if (shouldUpdateOthers) {
|
|
+ world.setBlock(blockposition.below(), (IBlockData) iblockdata1.setValue(BlockBamboo.LEAVES, BlockPropertyBambooSize.SMALL), 3);
|
|
+ world.setBlock(blockposition1, (IBlockData) iblockdata2.setValue(BlockBamboo.LEAVES, BlockPropertyBambooSize.NONE), 3);
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
protected int getHeightAboveUpToMax(IBlockAccess iblockaccess, BlockPosition blockposition) {
|