diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BambooStalkBlock.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BambooStalkBlock.java.patch | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BambooStalkBlock.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BambooStalkBlock.java.patch new file mode 100644 index 0000000000..15d1b8e885 --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BambooStalkBlock.java.patch @@ -0,0 +1,75 @@ +--- a/net/minecraft/world/level/block/BambooStalkBlock.java ++++ b/net/minecraft/world/level/block/BambooStalkBlock.java +@@ -176,10 +183,11 @@ + int i = heightAboveUpToMax + heightBelowUpToMax + 1; + int i1 = 1 + random.nextInt(2); + +- for (int i2 = 0; i2 < i1; i2++) { +- BlockPos blockPos = pos.above(heightAboveUpToMax); +- BlockState blockState = level.getBlockState(blockPos); +- if (i >= 16 || blockState.getValue(STAGE) == 1 || !level.isEmptyBlock(blockPos.above())) { ++ for (int i1 = 0; i1 < l; ++i1) { ++ BlockPos blockposition1 = pos.above(i); ++ IBlockData iblockdata1 = level.getBlockState(blockposition1); ++ ++ 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; + } + +@@ -194,28 +203,39 @@ + return player.getMainHandItem().getItem() instanceof SwordItem ? 1.0F : super.getDestroyProgress(state, player, level, pos); + } + +- protected void growBamboo(BlockState state, Level level, BlockPos pos, RandomSource random, int age) { +- BlockState blockState = level.getBlockState(pos.below()); +- BlockPos blockPos = pos.below(2); +- BlockState blockState1 = level.getBlockState(blockPos); +- 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 (age >= 1) { +- if (!blockState.is(Blocks.BAMBOO) || blockState.getValue(LEAVES) == BambooLeaves.NONE) { +- bambooLeaves = BambooLeaves.SMALL; +- } else if (blockState.is(Blocks.BAMBOO) && blockState.getValue(LEAVES) != BambooLeaves.NONE) { +- bambooLeaves = BambooLeaves.LARGE; +- if (blockState1.is(Blocks.BAMBOO)) { +- level.setBlock(pos.below(), blockState.setValue(LEAVES, BambooLeaves.SMALL), 3); +- level.setBlock(blockPos, blockState1.setValue(LEAVES, BambooLeaves.NONE), 3); ++ 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 ++ } + } + } + } + +- int i = state.getValue(AGE) != 1 && !blockState1.is(Blocks.BAMBOO) ? 0 : 1; +- int i1 = (age < 11 || !(random.nextFloat() < 0.25F)) && age != 15 ? 0 : 1; +- level.setBlock( +- pos.above(), this.defaultBlockState().setValue(AGE, Integer.valueOf(i)).setValue(LEAVES, bambooLeaves).setValue(STAGE, Integer.valueOf(i1)), 3 +- ); ++ int j = (Integer) state.getValue(BambooStalkBlock.AGE) != 1 && !iblockdata2.is(Blocks.BAMBOO) ? 0 : 1; ++ int k = (age < 11 || random.nextFloat() >= 0.25F) && age != 15 ? 0 : 1; ++ ++ // 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 level, BlockPos pos) { |