diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/BambooStalkBlock.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/BambooStalkBlock.java.patch | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/BambooStalkBlock.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/BambooStalkBlock.java.patch new file mode 100644 index 0000000000..4dcaa89ffe --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/BambooStalkBlock.java.patch @@ -0,0 +1,63 @@ +--- a/net/minecraft/world/level/block/BambooStalkBlock.java ++++ b/net/minecraft/world/level/block/BambooStalkBlock.java +@@ -203,7 +187,7 @@ + BlockPos blockpos1 = blockpos.above(i); + BlockState blockstate1 = serverlevel.getBlockState(blockpos1); + +- if (k >= 16 || (Integer) blockstate1.getValue(BambooStalkBlock.STAGE) == 1 || !serverlevel.isEmptyBlock(blockpos1.above())) { ++ if (k >= 16 || !iblockdata1.is(Blocks.BAMBOO) || (Integer) iblockdata1.getValue(BambooStalkBlock.STAGE) == 1 || !level.isEmptyBlock(blockposition1.above())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here + return; + } + +@@ -220,19 +203,23 @@ + return player.getMainHandItem().getItem() instanceof SwordItem ? 1.0F : super.getDestroyProgress(blockstate, player, blockgetter, blockpos); + } + +- protected void growBamboo(BlockState blockstate, Level level, BlockPos blockpos, RandomSource randomsource, int i) { +- BlockState blockstate1 = level.getBlockState(blockpos.below()); +- BlockPos blockpos1 = blockpos.below(2); +- BlockState blockstate2 = level.getBlockState(blockpos1); +- BambooLeaves bambooleaves = BambooLeaves.NONE; ++ protected void growBamboo(IBlockData state, Level level, BlockPos pos, RandomSource random, int age) { ++ IBlockData iblockdata1 = level.getBlockState(pos.below()); ++ BlockPos blockposition1 = pos.below(2); ++ IBlockData iblockdata2 = level.getBlockState(blockposition1); ++ BambooLeaves blockpropertybamboosize = BambooLeaves.NONE; ++ boolean shouldUpdateOthers = false; // CraftBukkit + +- if (i >= 1) { +- if (blockstate1.is(Blocks.BAMBOO) && blockstate1.getValue(BambooStalkBlock.LEAVES) != BambooLeaves.NONE) { +- if (blockstate1.is(Blocks.BAMBOO) && blockstate1.getValue(BambooStalkBlock.LEAVES) != BambooLeaves.NONE) { +- bambooleaves = BambooLeaves.LARGE; +- if (blockstate2.is(Blocks.BAMBOO)) { +- level.setBlock(blockpos.below(), (BlockState) blockstate1.setValue(BambooStalkBlock.LEAVES, BambooLeaves.SMALL), 3); +- level.setBlock(blockpos1, (BlockState) blockstate2.setValue(BambooStalkBlock.LEAVES, BambooLeaves.NONE), 3); ++ if (age >= 1) { ++ if (iblockdata1.is(Blocks.BAMBOO) && iblockdata1.getValue(BambooStalkBlock.LEAVES) != BambooLeaves.NONE) { ++ if (iblockdata1.is(Blocks.BAMBOO) && iblockdata1.getValue(BambooStalkBlock.LEAVES) != BambooLeaves.NONE) { ++ blockpropertybamboosize = BambooLeaves.LARGE; ++ if (iblockdata2.is(Blocks.BAMBOO)) { ++ // 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 { +@@ -243,7 +230,14 @@ + int j = (Integer) blockstate.getValue(BambooStalkBlock.AGE) != 1 && !blockstate2.is(Blocks.BAMBOO) ? 0 : 1; + int k = (i < 11 || randomsource.nextFloat() >= 0.25F) && i != 15 ? 0 : 1; + +- level.setBlock(blockpos.above(), (BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(BambooStalkBlock.AGE, j)).setValue(BambooStalkBlock.LEAVES, bambooleaves)).setValue(BambooStalkBlock.STAGE, k), 3); ++ // CraftBukkit start ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(level, pos, pos.above(), (IBlockData) ((IBlockData) ((IBlockData) this.defaultBlockState().setValue(BambooStalkBlock.AGE, j)).setValue(BambooStalkBlock.LEAVES, blockpropertybamboosize)).setValue(BambooStalkBlock.STAGE, k), 3)) { ++ if (shouldUpdateOthers) { ++ level.setBlock(pos.below(), (IBlockData) iblockdata1.setValue(BambooStalkBlock.LEAVES, BambooLeaves.SMALL), 3); ++ level.setBlock(blockposition1, (IBlockData) iblockdata2.setValue(BambooStalkBlock.LEAVES, BambooLeaves.NONE), 3); ++ } ++ } ++ // CraftBukkit end + } + + protected int getHeightAboveUpToMax(BlockGetter blockgetter, BlockPos blockpos) { |