diff options
Diffstat (limited to 'patch-remap/og/net/minecraft/world/level/block/BigDripleafBlock.patch')
-rw-r--r-- | patch-remap/og/net/minecraft/world/level/block/BigDripleafBlock.patch | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/level/block/BigDripleafBlock.patch b/patch-remap/og/net/minecraft/world/level/block/BigDripleafBlock.patch new file mode 100644 index 0000000000..17afb0f509 --- /dev/null +++ b/patch-remap/og/net/minecraft/world/level/block/BigDripleafBlock.patch @@ -0,0 +1,102 @@ +--- a/net/minecraft/world/level/block/BigDripleafBlock.java ++++ b/net/minecraft/world/level/block/BigDripleafBlock.java +@@ -42,6 +42,11 @@ + import net.minecraft.world.phys.shapes.VoxelShapeCollision; + import net.minecraft.world.phys.shapes.VoxelShapes; + ++// CraftBukkit start ++import org.bukkit.craftbukkit.event.CraftEventFactory; ++import org.bukkit.event.entity.EntityInteractEvent; ++// CraftBukkit end ++ + public class BigDripleafBlock extends BlockFacingHorizontal implements IBlockFragilePlantElement, IBlockWaterlogged { + + public static final MapCodec<BigDripleafBlock> CODEC = simpleCodec(BigDripleafBlock::new); +@@ -116,7 +121,7 @@ + + @Override + public void onProjectileHit(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) { +- this.setTiltAndScheduleTick(iblockdata, world, movingobjectpositionblock.getBlockPos(), Tilt.FULL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN); ++ this.setTiltAndScheduleTick(iblockdata, world, movingobjectpositionblock.getBlockPos(), Tilt.FULL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN, iprojectile); // CraftBukkit + } + + @Override +@@ -175,7 +180,20 @@ + public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) { + if (!world.isClientSide) { + if (iblockdata.getValue(BigDripleafBlock.TILT) == Tilt.NONE && canEntityTilt(blockposition, entity) && !world.hasNeighborSignal(blockposition)) { +- this.setTiltAndScheduleTick(iblockdata, world, blockposition, Tilt.UNSTABLE, (SoundEffect) null); ++ // CraftBukkit start - tilt dripleaf ++ org.bukkit.event.Cancellable cancellable; ++ if (entity instanceof EntityHuman) { ++ cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null); ++ } else { ++ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ())); ++ world.getCraftServer().getPluginManager().callEvent((EntityInteractEvent) cancellable); ++ } ++ ++ if (cancellable.isCancelled()) { ++ return; ++ } ++ this.setTiltAndScheduleTick(iblockdata, world, blockposition, Tilt.UNSTABLE, (SoundEffect) null, entity); ++ // CraftBukkit end + } + + } +@@ -189,9 +207,9 @@ + Tilt tilt = (Tilt) iblockdata.getValue(BigDripleafBlock.TILT); + + if (tilt == Tilt.UNSTABLE) { +- this.setTiltAndScheduleTick(iblockdata, worldserver, blockposition, Tilt.PARTIAL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN); ++ this.setTiltAndScheduleTick(iblockdata, worldserver, blockposition, Tilt.PARTIAL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN, null); // CraftBukkit + } else if (tilt == Tilt.PARTIAL) { +- this.setTiltAndScheduleTick(iblockdata, worldserver, blockposition, Tilt.FULL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN); ++ this.setTiltAndScheduleTick(iblockdata, worldserver, blockposition, Tilt.FULL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN, null); // CraftBukkit + } else if (tilt == Tilt.FULL) { + resetTilt(iblockdata, worldserver, blockposition); + } +@@ -217,8 +235,10 @@ + return entity.onGround() && entity.position().y > (double) ((float) blockposition.getY() + 0.6875F); + } + +- private void setTiltAndScheduleTick(IBlockData iblockdata, World world, BlockPosition blockposition, Tilt tilt, @Nullable SoundEffect soundeffect) { +- setTilt(iblockdata, world, blockposition, tilt); ++ // CraftBukkit start ++ private void setTiltAndScheduleTick(IBlockData iblockdata, World world, BlockPosition blockposition, Tilt tilt, @Nullable SoundEffect soundeffect, @Nullable Entity entity) { ++ if (!setTilt(iblockdata, world, blockposition, tilt, entity)) return; ++ // CraftBukkit end + if (soundeffect != null) { + playTiltSound(world, blockposition, soundeffect); + } +@@ -232,14 +252,21 @@ + } + + private static void resetTilt(IBlockData iblockdata, World world, BlockPosition blockposition) { +- setTilt(iblockdata, world, blockposition, Tilt.NONE); ++ setTilt(iblockdata, world, blockposition, Tilt.NONE, null); // CraftBukkit + if (iblockdata.getValue(BigDripleafBlock.TILT) != Tilt.NONE) { + playTiltSound(world, blockposition, SoundEffects.BIG_DRIPLEAF_TILT_UP); + } + + } + +- private static void setTilt(IBlockData iblockdata, World world, BlockPosition blockposition, Tilt tilt) { ++ // CraftBukkit start ++ private static boolean setTilt(IBlockData iblockdata, World world, BlockPosition 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); + + world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BigDripleafBlock.TILT, tilt), 2); +@@ -247,6 +274,7 @@ + world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, blockposition); + } + ++ return true; // CraftBukkit + } + + @Override |