diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/StemBlock.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/StemBlock.java.patch | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/StemBlock.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/StemBlock.java.patch new file mode 100644 index 0000000000..3664a93515 --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/StemBlock.java.patch @@ -0,0 +1,56 @@ +--- a/net/minecraft/world/level/block/StemBlock.java ++++ b/net/minecraft/world/level/block/StemBlock.java +@@ -26,6 +26,7 @@ + import net.minecraft.world.level.block.state.properties.IntegerProperty; + import net.minecraft.world.phys.shapes.CollisionContext; + import net.minecraft.world.phys.shapes.VoxelShape; ++import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit + + public class StemBlock extends BushBlock implements BonemealableBlock { + public static final MapCodec<StemBlock> CODEC = RecordCodecBuilder.mapCodec( +@@ -84,8 +79,8 @@ + if (random.nextInt((int)(25.0F / growthSpeed) + 1) == 0) { + int i = state.getValue(AGE); + if (i < 7) { +- state = state.setValue(AGE, Integer.valueOf(i + 1)); +- level.setBlock(pos, state, 2); ++ state = (IBlockData) state.setValue(StemBlock.AGE, i + 1); ++ CraftEventFactory.handleBlockGrowEvent(level, pos, state, 2); // CraftBukkit + } else { + Direction randomDirection = Direction.Plane.HORIZONTAL.getRandomDirection(random); + BlockPos blockPos = pos.relative(randomDirection); +@@ -95,8 +92,12 @@ + Optional<Block> optional = registry.getOptional(this.fruit); + Optional<Block> optional1 = registry.getOptional(this.attachedStem); + if (optional.isPresent() && optional1.isPresent()) { +- level.setBlockAndUpdate(blockPos, optional.get().defaultBlockState()); +- level.setBlockAndUpdate(pos, optional1.get().defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, randomDirection)); ++ // CraftBukkit start ++ if (!CraftEventFactory.handleBlockGrowEvent(level, blockposition1, ((Block) optional.get()).defaultBlockState())) { ++ return; ++ } ++ // CraftBukkit end ++ level.setBlockAndUpdate(pos, (IBlockData) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection)); + } + } + } +@@ -120,12 +122,13 @@ + } + + @Override +- public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { +- int min = Math.min(7, state.getValue(AGE) + Mth.nextInt(level.random, 2, 5)); +- BlockState blockState = state.setValue(AGE, Integer.valueOf(min)); +- level.setBlock(pos, blockState, 2); +- if (min == 7) { +- blockState.randomTick(level, pos, level.random); ++ public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, IBlockData state) { ++ int i = Math.min(7, (Integer) state.getValue(StemBlock.AGE) + Mth.nextInt(level.random, 2, 5)); ++ IBlockData iblockdata1 = (IBlockData) state.setValue(StemBlock.AGE, i); ++ ++ CraftEventFactory.handleBlockGrowEvent(level, pos, iblockdata1, 2); // CraftBukkit ++ if (i == 7) { ++ iblockdata1.randomTick(level, pos, level.random); + } + } + |