diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch new file mode 100644 index 0000000000..419d583826 --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch @@ -0,0 +1,92 @@ +--- a/net/minecraft/world/level/block/PointedDripstoneBlock.java ++++ b/net/minecraft/world/level/block/PointedDripstoneBlock.java +@@ -42,6 +42,10 @@ + import net.minecraft.world.phys.shapes.CollisionContext; + import net.minecraft.world.phys.shapes.Shapes; + import net.minecraft.world.phys.shapes.VoxelShape; ++// CraftBukkit start ++import org.bukkit.craftbukkit.block.CraftBlock; ++import org.bukkit.craftbukkit.event.CraftEventFactory; ++// CraftBukkit end + + public class PointedDripstoneBlock extends Block implements Fallable, SimpleWaterloggedBlock { + public static final MapCodec<PointedDripstoneBlock> CODEC = simpleCodec(PointedDripstoneBlock::new); +@@ -132,20 +133,25 @@ + @Override + public void onProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!level.isClientSide) { +- BlockPos blockPos = hit.getBlockPos(); +- if (projectile.mayInteract(level, blockPos) +- && projectile.mayBreak(level) +- && projectile instanceof ThrownTrident +- && projectile.getDeltaMovement().length() > 0.6) { +- level.destroyBlock(blockPos, true); ++ BlockPos blockposition = hit.getBlockPos(); ++ ++ if (projectile.mayInteract(level, blockposition) && projectile.mayBreak(level) && projectile instanceof ThrownTrident && projectile.getDeltaMovement().length() > 0.6D) { ++ // CraftBukkit start ++ if (!CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, Blocks.AIR.defaultBlockState())) { ++ return; ++ } ++ // CraftBukkit end ++ level.destroyBlock(blockposition, true); + } + } + } + + @Override +- public void fallOn(Level level, BlockState state, BlockPos pos, Entity entity, float fallDistance) { +- if (state.getValue(TIP_DIRECTION) == Direction.UP && state.getValue(THICKNESS) == DripstoneThickness.TIP) { ++ public void fallOn(Level level, IBlockData state, BlockPos pos, Entity entity, float fallDistance) { ++ if (state.getValue(PointedDripstoneBlock.TIP_DIRECTION) == Direction.UP && state.getValue(PointedDripstoneBlock.THICKNESS) == DripstoneThickness.TIP) { ++ CraftEventFactory.blockDamage = CraftBlock.at(level, pos); // CraftBukkit + entity.causeFallDamage(fallDistance + 2.0F, 2.0F, level.damageSources().stalagmite()); ++ CraftEventFactory.blockDamage = null; // CraftBukkit + } else { + super.fallOn(level, state, pos, entity, fallDistance); + } +@@ -365,22 +391,20 @@ + } + + private static void grow(ServerLevel server, BlockPos pos, Direction direction) { +- BlockPos blockPos = pos.relative(direction); +- BlockState blockState = server.getBlockState(blockPos); +- if (isUnmergedTipWithDirection(blockState, direction.getOpposite())) { +- createMergedTips(blockState, server, blockPos); +- } else if (blockState.isAir() || blockState.is(Blocks.WATER)) { +- createDripstone(server, blockPos, direction, DripstoneThickness.TIP); ++ BlockPos blockposition1 = pos.relative(direction); ++ IBlockData iblockdata = server.getBlockState(blockposition1); ++ ++ if (isUnmergedTipWithDirection(iblockdata, direction.getOpposite())) { ++ createMergedTips(iblockdata, server, blockposition1); ++ } else if (iblockdata.isAir() || iblockdata.is(Blocks.WATER)) { ++ createDripstone(server, blockposition1, direction, DripstoneThickness.TIP, pos); // CraftBukkit + } + } + +- private static void createDripstone(LevelAccessor level, BlockPos pos, Direction direction, DripstoneThickness thickness) { +- BlockState blockState = Blocks.POINTED_DRIPSTONE +- .defaultBlockState() +- .setValue(TIP_DIRECTION, direction) +- .setValue(THICKNESS, thickness) +- .setValue(WATERLOGGED, Boolean.valueOf(level.getFluidState(pos).getType() == Fluids.WATER)); +- level.setBlock(pos, blockState, 3); ++ private static void createDripstone(LevelAccessor generatoraccess, BlockPos blockposition, Direction enumdirection, DripstoneThickness dripstonethickness, BlockPos source) { // CraftBukkit ++ IBlockData iblockdata = (IBlockData) ((IBlockData) ((IBlockData) Blocks.POINTED_DRIPSTONE.defaultBlockState().setValue(PointedDripstoneBlock.TIP_DIRECTION, enumdirection)).setValue(PointedDripstoneBlock.THICKNESS, dripstonethickness)).setValue(PointedDripstoneBlock.WATERLOGGED, generatoraccess.getFluidState(blockposition).getType() == Fluids.WATER); ++ ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(generatoraccess, source, blockposition, iblockdata, 3); // CraftBukkit + } + + private static void createMergedTips(BlockState state, LevelAccessor level, BlockPos pos) { +@@ -394,8 +420,8 @@ + blockPos = pos.below(); + } + +- createDripstone(level, blockPos1, Direction.DOWN, DripstoneThickness.TIP_MERGE); +- createDripstone(level, blockPos, Direction.UP, DripstoneThickness.TIP_MERGE); ++ createDripstone(level, blockposition2, Direction.DOWN, DripstoneThickness.TIP_MERGE, pos); // CraftBukkit ++ createDripstone(level, blockposition1, Direction.UP, DripstoneThickness.TIP_MERGE, pos); // CraftBukkit + } + + public static void spawnDripParticle(Level level, BlockPos pos, BlockState state) { |