diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/level/block/ChangeOverTimeBlock.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/level/block/ChangeOverTimeBlock.java.patch | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/block/ChangeOverTimeBlock.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/ChangeOverTimeBlock.java.patch new file mode 100644 index 0000000000..7d8bf33b51 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/ChangeOverTimeBlock.java.patch @@ -0,0 +1,67 @@ +--- a/net/minecraft/world/level/block/ChangeOverTimeBlock.java ++++ b/net/minecraft/world/level/block/ChangeOverTimeBlock.java +@@ -5,22 +5,22 @@ + import net.minecraft.core.BlockPos; + import net.minecraft.server.level.ServerLevel; + import net.minecraft.util.RandomSource; +-import net.minecraft.world.level.block.state.BlockState; ++import net.minecraft.world.level.block.state.IBlockData; + + public interface ChangeOverTimeBlock<T extends Enum<T>> { + + int SCAN_DISTANCE = 4; + +- Optional<BlockState> getNext(BlockState state); ++ Optional<IBlockData> getNext(IBlockData state); + + float getChanceModifier(); + +- default void changeOverTime(BlockState blockstate, ServerLevel serverlevel, BlockPos blockpos, RandomSource randomsource) { ++ default void changeOverTime(IBlockData iblockdata, ServerLevel worldserver, BlockPos blockposition, RandomSource randomsource) { + float f = 0.05688889F; + + if (randomsource.nextFloat() < 0.05688889F) { +- this.getNextState(blockstate, serverlevel, blockpos, randomsource).ifPresent((blockstate1) -> { +- serverlevel.setBlockAndUpdate(blockpos, blockstate1); ++ this.getNextState(iblockdata, worldserver, blockposition, randomsource).ifPresent((iblockdata1) -> { ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(worldserver, blockposition, iblockdata1); // CraftBukkit + }); + } + +@@ -28,22 +28,22 @@ + + T getAge(); + +- default Optional<BlockState> getNextState(BlockState blockstate, ServerLevel serverlevel, BlockPos blockpos, RandomSource randomsource) { ++ default Optional<IBlockData> getNextState(IBlockData iblockdata, ServerLevel worldserver, BlockPos blockposition, RandomSource randomsource) { + int i = this.getAge().ordinal(); + int j = 0; + int k = 0; +- Iterator iterator = BlockPos.withinManhattan(blockpos, 4, 4, 4).iterator(); ++ Iterator iterator = BlockPos.withinManhattan(blockposition, 4, 4, 4).iterator(); + + while (iterator.hasNext()) { +- BlockPos blockpos1 = (BlockPos) iterator.next(); +- int l = blockpos1.distManhattan(blockpos); ++ BlockPos blockposition1 = (BlockPos) iterator.next(); ++ int l = blockposition1.distManhattan(blockposition); + + if (l > 4) { + break; + } + +- if (!blockpos1.equals(blockpos)) { +- Block block = serverlevel.getBlockState(blockpos1).getBlock(); ++ if (!blockposition1.equals(blockposition)) { ++ Block block = worldserver.getBlockState(blockposition1).getBlock(); + + if (block instanceof ChangeOverTimeBlock) { + ChangeOverTimeBlock<?> changeovertimeblock = (ChangeOverTimeBlock) block; +@@ -69,6 +69,6 @@ + float f = (float) (k + 1) / (float) (k + j + 1); + float f1 = f * f * this.getChanceModifier(); + +- return randomsource.nextFloat() < f1 ? this.getNext(blockstate) : Optional.empty(); ++ return randomsource.nextFloat() < f1 ? this.getNext(iblockdata) : Optional.empty(); + } + } |