diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/BigDripleafBlock.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/BigDripleafBlock.java.patch | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/BigDripleafBlock.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/BigDripleafBlock.java.patch new file mode 100644 index 0000000000..885aef8a5f --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/BigDripleafBlock.java.patch @@ -0,0 +1,115 @@ +--- a/net/minecraft/world/level/block/BigDripleafBlock.java ++++ b/net/minecraft/world/level/block/BigDripleafBlock.java +@@ -41,6 +41,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.event.CraftEventFactory; ++import org.bukkit.event.entity.EntityInteractEvent; ++// CraftBukkit end + + public class BigDripleafBlock extends HorizontalDirectionalBlock implements BonemealableBlock, SimpleWaterloggedBlock { + +@@ -116,9 +119,8 @@ + } + + @Override +- @Override +- public void onProjectileHit(Level level, BlockState blockstate, BlockHitResult blockhitresult, Projectile projectile) { +- this.setTiltAndScheduleTick(blockstate, level, blockhitresult.getBlockPos(), Tilt.FULL, SoundEvents.BIG_DRIPLEAF_TILT_DOWN); ++ public void onProjectileHit(Level level, IBlockData state, BlockHitResult hit, Projectile projectile) { ++ this.setTiltAndScheduleTick(state, level, hit.getBlockPos(), Tilt.FULL, SoundEvents.BIG_DRIPLEAF_TILT_DOWN, projectile); // CraftBukkit + } + + @Override +@@ -183,8 +178,21 @@ + @Override + public void entityInside(BlockState blockstate, Level level, BlockPos blockpos, Entity entity) { + if (!level.isClientSide) { +- if (blockstate.getValue(BigDripleafBlock.TILT) == Tilt.NONE && canEntityTilt(blockpos, entity) && !level.hasNeighborSignal(blockpos)) { +- this.setTiltAndScheduleTick(blockstate, level, blockpos, Tilt.UNSTABLE, (SoundEvent) null); ++ if (state.getValue(BigDripleafBlock.TILT) == Tilt.NONE && canEntityTilt(pos, entity) && !level.hasNeighborSignal(pos)) { ++ // CraftBukkit start - tilt dripleaf ++ org.bukkit.event.Cancellable cancellable; ++ if (entity instanceof Player) { ++ cancellable = CraftEventFactory.callPlayerInteractEvent((Player) entity, org.bukkit.event.block.Action.PHYSICAL, pos, null, null, null); ++ } else { ++ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), level.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ())); ++ level.getCraftServer().getPluginManager().callEvent((EntityInteractEvent) cancellable); ++ } ++ ++ if (cancellable.isCancelled()) { ++ return; ++ } ++ this.setTiltAndScheduleTick(state, level, pos, Tilt.UNSTABLE, (SoundEvent) null, entity); ++ // CraftBukkit end + } + + } +@@ -199,9 +206,9 @@ + Tilt tilt = (Tilt) blockstate.getValue(BigDripleafBlock.TILT); + + if (tilt == Tilt.UNSTABLE) { +- this.setTiltAndScheduleTick(blockstate, serverlevel, blockpos, Tilt.PARTIAL, SoundEvents.BIG_DRIPLEAF_TILT_DOWN); ++ this.setTiltAndScheduleTick(state, level, pos, Tilt.PARTIAL, SoundEvents.BIG_DRIPLEAF_TILT_DOWN, null); // CraftBukkit + } else if (tilt == Tilt.PARTIAL) { +- this.setTiltAndScheduleTick(blockstate, serverlevel, blockpos, Tilt.FULL, SoundEvents.BIG_DRIPLEAF_TILT_DOWN); ++ this.setTiltAndScheduleTick(state, level, pos, Tilt.FULL, SoundEvents.BIG_DRIPLEAF_TILT_DOWN, null); // CraftBukkit + } else if (tilt == Tilt.FULL) { + resetTilt(blockstate, serverlevel, blockpos); + } +@@ -228,10 +234,12 @@ + return entity.onGround() && entity.position().y > (double) ((float) blockpos.getY() + 0.6875F); + } + +- private void setTiltAndScheduleTick(BlockState blockstate, Level level, BlockPos blockpos, Tilt tilt, @Nullable SoundEvent soundevent) { +- setTilt(blockstate, level, blockpos, tilt); +- if (soundevent != null) { +- playTiltSound(level, blockpos, soundevent); ++ // CraftBukkit start ++ private void setTiltAndScheduleTick(IBlockData iblockdata, Level world, BlockPos blockposition, Tilt tilt, @Nullable SoundEvent soundeffect, @Nullable Entity entity) { ++ if (!setTilt(iblockdata, world, blockposition, tilt, entity)) return; ++ // CraftBukkit end ++ if (soundeffect != null) { ++ playTiltSound(world, blockposition, soundeffect); + } + + int i = BigDripleafBlock.DELAY_UNTIL_NEXT_TILT_STATE.getInt(tilt); +@@ -242,22 +250,30 @@ + + } + +- private static void resetTilt(BlockState blockstate, Level level, BlockPos blockpos) { +- setTilt(blockstate, level, blockpos, Tilt.NONE); +- if (blockstate.getValue(BigDripleafBlock.TILT) != Tilt.NONE) { +- playTiltSound(level, blockpos, SoundEvents.BIG_DRIPLEAF_TILT_UP); ++ private static void resetTilt(IBlockData state, Level level, BlockPos pos) { ++ setTilt(state, level, pos, Tilt.NONE, null); // CraftBukkit ++ if (state.getValue(BigDripleafBlock.TILT) != Tilt.NONE) { ++ playTiltSound(level, pos, SoundEvents.BIG_DRIPLEAF_TILT_UP); + } + + } + +- private static void setTilt(BlockState blockstate, Level level, BlockPos blockpos, Tilt tilt) { +- Tilt tilt1 = (Tilt) blockstate.getValue(BigDripleafBlock.TILT); ++ // CraftBukkit start ++ private static boolean setTilt(IBlockData iblockdata, Level world, BlockPos blockposition, Tilt tilt, @Nullable Entity entity) { ++ if (entity != null) { ++ if (!CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata.setValue(BigDripleafBlock.TILT, tilt))) { ++ return false; ++ } ++ } ++ // CraftBukkit end ++ Tilt tilt1 = (Tilt) iblockdata.getValue(BigDripleafBlock.TILT); + + level.setBlock(blockpos, (BlockState) blockstate.setValue(BigDripleafBlock.TILT, tilt), 2); + if (tilt.causesVibration() && tilt != tilt1) { + level.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, blockpos); + } + ++ return true; // CraftBukkit + } + + @Override |