aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BigDripleafBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BigDripleafBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BigDripleafBlock.java.patch113
1 files changed, 113 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BigDripleafBlock.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BigDripleafBlock.java.patch
new file mode 100644
index 0000000000..ede16ddc3f
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BigDripleafBlock.java.patch
@@ -0,0 +1,113 @@
+--- a/net/minecraft/world/level/block/BigDripleafBlock.java
++++ b/net/minecraft/world/level/block/BigDripleafBlock.java
+@@ -39,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 {
+ public static final MapCodec<BigDripleafBlock> CODEC = simpleCodec(BigDripleafBlock::new);
+@@ -133,8 +119,8 @@
+ }
+
+ @Override
+- public void onProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile) {
+- this.setTiltAndScheduleTick(state, level, hit.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
+@@ -189,8 +178,21 @@
+ @Override
+ public void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) {
+ if (!level.isClientSide) {
+- if (state.getValue(TILT) == Tilt.NONE && canEntityTilt(pos, entity) && !level.hasNeighborSignal(pos)) {
+- this.setTiltAndScheduleTick(state, level, pos, Tilt.UNSTABLE, 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
+ }
+ }
+ }
+@@ -202,9 +206,9 @@
+ } else {
+ Tilt tilt = state.getValue(TILT);
+ if (tilt == Tilt.UNSTABLE) {
+- this.setTiltAndScheduleTick(state, level, pos, 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(state, level, pos, 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(state, level, pos);
+ }
+@@ -227,10 +234,12 @@
+ return entity.onGround() && entity.position().y > (double)((float)pos.getY() + 0.6875F);
+ }
+
+- private void setTiltAndScheduleTick(BlockState state, Level level, BlockPos pos, Tilt tilt, @Nullable SoundEvent sound) {
+- setTilt(state, level, pos, tilt);
+- if (sound != null) {
+- playTiltSound(level, pos, sound);
++ // 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 _int = DELAY_UNTIL_NEXT_TILT_STATE.getInt(tilt);
+@@ -239,19 +250,29 @@
+ }
+ }
+
+- private static void resetTilt(BlockState state, Level level, BlockPos pos) {
+- setTilt(state, level, pos, Tilt.NONE);
+- if (state.getValue(TILT) != Tilt.NONE) {
++ 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 state, Level level, BlockPos pos, Tilt tilt) {
+- Tilt tilt1 = state.getValue(TILT);
+- level.setBlock(pos, state.setValue(TILT, tilt), 2);
++ // 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);
++
++ world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BigDripleafBlock.TILT, tilt), 2);
+ if (tilt.causesVibration() && tilt != tilt1) {
+ level.gameEvent(null, GameEvent.BLOCK_CHANGE, pos);
+ }
++
++ return true; // CraftBukkit
+ }
+
+ @Override