From eb675d91109a0c442605b31b1438c2c3efa457da Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sat, 8 May 2021 18:02:36 -0700 Subject: [PATCH] Add EntityInsideBlockEvent --- .../world/level/block/BaseFireBlock.java.patch | 14 +++++++++++--- .../block/BasePressurePlateBlock.java.patch | 12 ++++++++++-- .../level/block/BigDripleafBlock.java.patch | 9 ++++++--- .../level/block/BubbleColumnBlock.java.patch | 10 ++++++++++ .../world/level/block/ButtonBlock.java.patch | 9 ++++++++- .../world/level/block/CactusBlock.java.patch | 3 ++- .../world/level/block/CampfireBlock.java.patch | 6 ++++-- .../world/level/block/CropBlock.java.patch | 4 +++- .../level/block/DetectorRailBlock.java.patch | 16 ++++++++++++---- .../world/level/block/EndGatewayBlock.java.patch | 10 +++++++++- .../world/level/block/EndPortalBlock.java.patch | 10 ++++++---- .../world/level/block/EyeblossomBlock.java.patch | 10 ++++++++++ .../world/level/block/FrogspawnBlock.java.patch | 10 +++++++++- .../world/level/block/HoneyBlock.java.patch | 10 ++++++++++ .../world/level/block/HopperBlock.java.patch | 10 ++++++++++ .../level/block/LavaCauldronBlock.java.patch | 10 ++++++++++ .../level/block/LayeredCauldronBlock.java.patch | 7 +++++-- .../level/block/NetherPortalBlock.java.patch | 8 +++++--- .../level/block/PitcherCropBlock.java.patch | 10 ++++++++++ .../world/level/block/PowderSnowBlock.java.patch | 10 +++++++++- .../level/block/SweetBerryBushBlock.java.patch | 12 ++++++++++-- .../world/level/block/TripWireBlock.java.patch | 10 +++++++++- .../world/level/block/WaterlilyBlock.java.patch | 5 ++++- .../world/level/block/WebBlock.java.patch | 10 ++++++++++ .../world/level/block/WitherRoseBlock.java.patch | 6 +++++- 25 files changed, 197 insertions(+), 34 deletions(-) create mode 100644 paper-server/patches/sources/net/minecraft/world/level/block/BubbleColumnBlock.java.patch create mode 100644 paper-server/patches/sources/net/minecraft/world/level/block/EyeblossomBlock.java.patch create mode 100644 paper-server/patches/sources/net/minecraft/world/level/block/HoneyBlock.java.patch create mode 100644 paper-server/patches/sources/net/minecraft/world/level/block/HopperBlock.java.patch create mode 100644 paper-server/patches/sources/net/minecraft/world/level/block/LavaCauldronBlock.java.patch create mode 100644 paper-server/patches/sources/net/minecraft/world/level/block/PitcherCropBlock.java.patch create mode 100644 paper-server/patches/sources/net/minecraft/world/level/block/WebBlock.java.patch diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/BaseFireBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/BaseFireBlock.java.patch index 3d8c047d5d..f8560e4b5f 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/BaseFireBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/BaseFireBlock.java.patch @@ -8,7 +8,15 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockBehaviour; -@@ -137,7 +138,14 @@ +@@ -127,6 +128,7 @@ + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + if (!entity.fireImmune()) { + if (entity.getRemainingFireTicks() < 0) { + entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1); +@@ -137,7 +139,14 @@ } if (entity.getRemainingFireTicks() >= 0) { @@ -24,7 +32,7 @@ } } -@@ -146,26 +154,26 @@ +@@ -146,26 +155,26 @@ } @Override @@ -58,7 +66,7 @@ } @Override -@@ -213,4 +221,12 @@ +@@ -213,4 +222,12 @@ } } } diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/BasePressurePlateBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/BasePressurePlateBlock.java.patch index 0a52ac3818..65470ccca0 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/BasePressurePlateBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/BasePressurePlateBlock.java.patch @@ -8,7 +8,15 @@ public abstract class BasePressurePlateBlock extends Block { -@@ -91,6 +92,19 @@ +@@ -76,6 +77,7 @@ + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + if (!world.isClientSide) { + int i = this.getSignalForState(state); + +@@ -91,6 +93,19 @@ boolean flag = output > 0; boolean flag1 = j > 0; @@ -28,7 +36,7 @@ if (output != j) { BlockState iblockdata1 = this.setSignalForState(state, j); -@@ -145,9 +159,15 @@ +@@ -145,9 +160,15 @@ } protected static int getEntityCount(Level world, AABB box, Class entityClass) { diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/BigDripleafBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/BigDripleafBlock.java.patch index f1e4f569d3..c0eab8e717 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/BigDripleafBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/BigDripleafBlock.java.patch @@ -20,8 +20,11 @@ } @Override -@@ -178,7 +182,20 @@ +@@ -176,9 +180,23 @@ + + @Override protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (!world.isClientSide) { if (state.getValue(BigDripleafBlock.TILT) == Tilt.NONE && BigDripleafBlock.canEntityTilt(pos, entity) && !world.hasNeighborSignal(pos)) { - this.setTiltAndScheduleTick(state, world, pos, Tilt.UNSTABLE, (SoundEvent) null); @@ -42,7 +45,7 @@ } } -@@ -192,9 +209,9 @@ +@@ -192,9 +210,9 @@ Tilt tilt = (Tilt) state.getValue(BigDripleafBlock.TILT); if (tilt == Tilt.UNSTABLE) { @@ -54,7 +57,7 @@ } else if (tilt == Tilt.FULL) { BigDripleafBlock.resetTilt(state, world, pos); } -@@ -220,36 +237,46 @@ +@@ -220,36 +238,46 @@ return entity.onGround() && entity.position().y > (double) ((float) pos.getY() + 0.6875F); } diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/BubbleColumnBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/BubbleColumnBlock.java.patch new file mode 100644 index 0000000000..aa97c1238d --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/block/BubbleColumnBlock.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/level/block/BubbleColumnBlock.java ++++ b/net/minecraft/world/level/block/BubbleColumnBlock.java +@@ -48,6 +48,7 @@ + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + BlockState blockState = world.getBlockState(pos.above()); + if (blockState.isAir()) { + entity.onAboveBubbleCol(state.getValue(DRAG_DOWN)); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/ButtonBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/ButtonBlock.java.patch index b2f46f7ac3..8311b29036 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/ButtonBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/ButtonBlock.java.patch @@ -31,7 +31,14 @@ this.press(state, world, pos, player); return InteractionResult.SUCCESS; } -@@ -197,11 +214,36 @@ +@@ -191,17 +208,43 @@ + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + if (!world.isClientSide && this.type.canButtonBeActivatedByArrows() && !(Boolean) state.getValue(ButtonBlock.POWERED)) { + this.checkPressed(state, world, pos); + } } protected void checkPressed(BlockState state, Level world, BlockPos pos) { diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/CactusBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/CactusBlock.java.patch index 2b35adad86..c7084f8b41 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/CactusBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/CactusBlock.java.patch @@ -30,11 +30,12 @@ world.setBlock(pos, (BlockState) state.setValue(CactusBlock.AGE, j + 1), 4); } -@@ -120,7 +122,7 @@ +@@ -120,7 +122,8 @@ @Override protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { - entity.hurt(world.damageSources().cactus(), 1.0F); ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + entity.hurt(world.damageSources().cactus().directBlock(world, pos), 1.0F); // CraftBukkit } diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/CampfireBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/CampfireBlock.java.patch index 5809b6e5e5..133764e05b 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/CampfireBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/CampfireBlock.java.patch @@ -1,15 +1,17 @@ --- a/net/minecraft/world/level/block/CampfireBlock.java +++ b/net/minecraft/world/level/block/CampfireBlock.java -@@ -113,7 +113,7 @@ +@@ -112,8 +112,9 @@ + @Override protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if ((Boolean) state.getValue(CampfireBlock.LIT) && entity instanceof LivingEntity) { - entity.hurt(world.damageSources().campfire(), (float) this.fireDamage); + entity.hurt(world.damageSources().campfire().directBlock(world, pos), (float) this.fireDamage); // CraftBukkit } super.entityInside(state, world, pos, entity); -@@ -219,6 +219,11 @@ +@@ -219,6 +220,11 @@ if (world instanceof ServerLevel worldserver) { if (projectile.isOnFire() && projectile.mayInteract(worldserver, blockposition) && !(Boolean) state.getValue(CampfireBlock.LIT) && !(Boolean) state.getValue(CampfireBlock.WATERLOGGED)) { diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/CropBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/CropBlock.java.patch index cfbc7970f6..71ebb9a1f9 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/CropBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/CropBlock.java.patch @@ -42,9 +42,11 @@ } protected int getBonemealAgeIncrease(Level world) { -@@ -161,7 +175,7 @@ +@@ -160,8 +174,9 @@ + @Override protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (world instanceof ServerLevel worldserver) { - if (entity instanceof Ravager && worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (entity instanceof Ravager && CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/DetectorRailBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/DetectorRailBlock.java.patch index 625192a8e8..de7bae1c90 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/DetectorRailBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/DetectorRailBlock.java.patch @@ -8,7 +8,15 @@ public class DetectorRailBlock extends BaseRailBlock { -@@ -77,6 +78,7 @@ +@@ -51,6 +52,7 @@ + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + if (!world.isClientSide) { + if (!(Boolean) state.getValue(DetectorRailBlock.POWERED)) { + this.checkPressed(world, pos, state); +@@ -77,6 +79,7 @@ private void checkPressed(Level world, BlockPos pos, BlockState state) { if (this.canSurvive(state, world, pos)) { @@ -16,17 +24,17 @@ boolean flag = (Boolean) state.getValue(DetectorRailBlock.POWERED); boolean flag1 = false; List list = this.getInteractingMinecartOfType(world, pos, AbstractMinecart.class, (entity) -> { -@@ -88,7 +90,17 @@ +@@ -88,7 +91,17 @@ } BlockState iblockdata1; + // CraftBukkit start + if (flag != flag1) { + org.bukkit.block.Block block = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()); -+ + + BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 15 : 0, flag1 ? 15 : 0); + world.getCraftServer().getPluginManager().callEvent(eventRedstone); - ++ + flag1 = eventRedstone.getNewCurrent() > 0; + } + // CraftBukkit end diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/EndGatewayBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/EndGatewayBlock.java.patch index 23e11ecf95..00cc7de975 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/EndGatewayBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/EndGatewayBlock.java.patch @@ -10,7 +10,15 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal { -@@ -112,7 +115,7 @@ +@@ -89,6 +92,7 @@ + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + if (entity.canUsePortal(false)) { + BlockEntity tileentity = world.getBlockEntity(pos); + +@@ -112,7 +116,7 @@ if (tileentity instanceof TheEndGatewayBlockEntity tileentityendgateway) { Vec3 vec3d = tileentityendgateway.getPortalPosition(world, pos); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/EndPortalBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/EndPortalBlock.java.patch index 675bf3de69..020890bbf9 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/EndPortalBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/EndPortalBlock.java.patch @@ -24,9 +24,11 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal { -@@ -58,9 +69,14 @@ +@@ -57,10 +68,16 @@ + @Override protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (entity.canUsePortal(false)) { + // CraftBukkit start - Entity in portal + EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ())); @@ -39,7 +41,7 @@ if (!entityplayer.seenCredits) { entityplayer.showEndCredits(); return; -@@ -74,11 +90,11 @@ +@@ -74,11 +91,11 @@ @Override public TeleportTransition getPortalDestination(ServerLevel world, Entity entity, BlockPos pos) { @@ -53,7 +55,7 @@ } else { boolean flag = resourcekey == Level.END; BlockPos blockposition1 = flag ? ServerLevel.END_SPAWN_POINT : worldserver1.getSharedSpawnPos(); -@@ -87,7 +103,7 @@ +@@ -87,7 +104,7 @@ Set set; if (flag) { @@ -62,7 +64,7 @@ f = Direction.WEST.toYRot(); set = Relative.union(Relative.DELTA, Set.of(Relative.X_ROT)); if (entity instanceof ServerPlayer) { -@@ -99,13 +115,21 @@ +@@ -99,13 +116,21 @@ if (entity instanceof ServerPlayer) { ServerPlayer entityplayer = (ServerPlayer) entity; diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/EyeblossomBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/EyeblossomBlock.java.patch new file mode 100644 index 0000000000..0f677874ee --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/block/EyeblossomBlock.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/level/block/EyeblossomBlock.java ++++ b/net/minecraft/world/level/block/EyeblossomBlock.java +@@ -100,6 +100,7 @@ + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + if (!world.isClientSide() + && world.getDifficulty() != Difficulty.PEACEFUL + && entity instanceof Bee bee diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/FrogspawnBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/FrogspawnBlock.java.patch index 949818c5df..a6ded0d4cf 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/FrogspawnBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/FrogspawnBlock.java.patch @@ -1,6 +1,14 @@ --- a/net/minecraft/world/level/block/FrogspawnBlock.java +++ b/net/minecraft/world/level/block/FrogspawnBlock.java -@@ -121,7 +121,7 @@ +@@ -89,6 +89,7 @@ + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + if (entity.getType().equals(EntityType.FALLING_BLOCK)) { + this.destroyBlock(world, pos); + } +@@ -121,7 +122,7 @@ int k = random.nextInt(1, 361); tadpole.moveTo(d, (double)pos.getY() - 0.5, e, (float)k, 0.0F); tadpole.setPersistenceRequired(); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/HoneyBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/HoneyBlock.java.patch new file mode 100644 index 0000000000..4609ae3eee --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/block/HoneyBlock.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/level/block/HoneyBlock.java ++++ b/net/minecraft/world/level/block/HoneyBlock.java +@@ -60,6 +60,7 @@ + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + if (this.isSlidingDown(pos, entity)) { + this.maybeDoSlideAchievement(entity, pos); + this.doSlideMovement(entity); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/HopperBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/HopperBlock.java.patch new file mode 100644 index 0000000000..910d294b78 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/block/HopperBlock.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/level/block/HopperBlock.java ++++ b/net/minecraft/world/level/block/HopperBlock.java +@@ -178,6 +178,7 @@ + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity instanceof HopperBlockEntity) { + HopperBlockEntity.entityInside(world, pos, state, entity, (HopperBlockEntity)blockEntity); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/LavaCauldronBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/LavaCauldronBlock.java.patch new file mode 100644 index 0000000000..b8db542f5e --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/block/LavaCauldronBlock.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/level/block/LavaCauldronBlock.java ++++ b/net/minecraft/world/level/block/LavaCauldronBlock.java +@@ -32,6 +32,7 @@ + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + if (this.isEntityInsideContent(state, pos, entity)) { + entity.lavaHurt(); + } diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/LayeredCauldronBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/LayeredCauldronBlock.java.patch index b90dea5eb0..fb08b3638d 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/LayeredCauldronBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/LayeredCauldronBlock.java.patch @@ -12,8 +12,11 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock { -@@ -64,39 +69,67 @@ +@@ -62,41 +67,70 @@ + + @Override protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (world instanceof ServerLevel worldserver) { if (entity.isOnFire() && this.isEntityInsideContent(state, pos, entity)) { - entity.clearFire(); @@ -91,7 +94,7 @@ } } -@@ -115,8 +148,11 @@ +@@ -115,8 +149,11 @@ if (!this.isFull(state)) { BlockState iblockdata1 = (BlockState) state.setValue(LayeredCauldronBlock.LEVEL, (Integer) state.getValue(LayeredCauldronBlock.LEVEL) + 1); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch index ead3c90aa1..e710ae83ab 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch @@ -44,9 +44,11 @@ Entity entity1 = entity.getVehicle(); if (entity1 != null) { -@@ -104,6 +116,10 @@ +@@ -103,7 +115,12 @@ + @Override protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (entity.canUsePortal(false)) { + // CraftBukkit start - Entity in portal + EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ())); @@ -55,7 +57,7 @@ entity.setAsInsidePortal(this, pos); } -@@ -121,51 +137,72 @@ +@@ -121,51 +138,72 @@ @Nullable @Override public TeleportTransition getPortalDestination(ServerLevel world, Entity entity, BlockPos pos) { @@ -141,7 +143,7 @@ } private static TeleportTransition getDimensionTransitionFromExit(Entity entity, BlockPos pos, BlockUtil.FoundRectangle exitPortalRectangle, ServerLevel world, TeleportTransition.PostTeleportTransition postDimensionTransition) { -@@ -203,7 +240,7 @@ +@@ -203,7 +241,7 @@ Vec3 vec3d1 = new Vec3((double) blockposition.getX() + (flag ? d2 : d4), (double) blockposition.getY() + d3, (double) blockposition.getZ() + (flag ? d4 : d2)); Vec3 vec3d2 = PortalShape.findCollisionFreePosition(vec3d1, world, entity, entitysize); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/PitcherCropBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/PitcherCropBlock.java.patch new file mode 100644 index 0000000000..5ff278b072 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/block/PitcherCropBlock.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/level/block/PitcherCropBlock.java ++++ b/net/minecraft/world/level/block/PitcherCropBlock.java +@@ -107,6 +107,7 @@ + + @Override + public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + if (world instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + serverLevel.destroyBlock(pos, true, entity); + } diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/PowderSnowBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/PowderSnowBlock.java.patch index 9fea7666eb..0f012c2b02 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/PowderSnowBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/PowderSnowBlock.java.patch @@ -1,6 +1,14 @@ --- a/net/minecraft/world/level/block/PowderSnowBlock.java +++ b/net/minecraft/world/level/block/PowderSnowBlock.java -@@ -73,7 +73,12 @@ +@@ -59,6 +59,7 @@ + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + if (!(entity instanceof LivingEntity) || entity.getInBlockState().is((Block) this)) { + entity.makeStuckInBlock(state, new Vec3(0.8999999761581421D, 1.5D, 0.8999999761581421D)); + if (world.isClientSide) { +@@ -73,7 +74,12 @@ entity.setIsInPowderSnow(true); if (world instanceof ServerLevel worldserver) { diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch index 706470d9ec..c0fadbe893 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch @@ -26,7 +26,15 @@ world.gameEvent((Holder) GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(iblockdata1)); } -@@ -91,7 +97,7 @@ +@@ -78,6 +84,7 @@ + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + if (entity instanceof LivingEntity && entity.getType() != EntityType.FOX && entity.getType() != EntityType.BEE) { + entity.makeStuckInBlock(state, new Vec3(0.800000011920929D, 0.75D, 0.800000011920929D)); + if (world instanceof ServerLevel) { +@@ -91,7 +98,7 @@ double d1 = Math.abs(vec3d.z()); if (d0 >= 0.003000000026077032D || d1 >= 0.003000000026077032D) { @@ -35,7 +43,7 @@ } } -@@ -118,7 +124,15 @@ +@@ -118,7 +125,15 @@ if (i > 1) { int j = 1 + world.random.nextInt(2); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/TripWireBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/TripWireBlock.java.patch index e217d61922..24da2138ec 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/TripWireBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/TripWireBlock.java.patch @@ -8,7 +8,15 @@ public class TripWireBlock extends Block { -@@ -179,6 +180,40 @@ +@@ -140,6 +141,7 @@ + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + if (!world.isClientSide) { + if (!(Boolean) state.getValue(TripWireBlock.POWERED)) { + this.checkPressed(world, pos, List.of(entity)); +@@ -179,6 +181,40 @@ } } diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/WaterlilyBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/WaterlilyBlock.java.patch index e4dba66625..75c6ca22ea 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/WaterlilyBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/WaterlilyBlock.java.patch @@ -10,8 +10,11 @@ public class WaterlilyBlock extends BushBlock { -@@ -32,6 +35,11 @@ +@@ -30,8 +33,14 @@ + + @Override protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent super.entityInside(state, world, pos, entity); if (world instanceof ServerLevel && entity instanceof AbstractBoat) { + // CraftBukkit start diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/WebBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/WebBlock.java.patch new file mode 100644 index 0000000000..1204a1e128 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/block/WebBlock.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/level/block/WebBlock.java ++++ b/net/minecraft/world/level/block/WebBlock.java +@@ -24,6 +24,7 @@ + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + Vec3 vec3 = new Vec3(0.25, 0.05F, 0.25); + if (entity instanceof LivingEntity livingEntity && livingEntity.hasEffect(MobEffects.WEAVING)) { + vec3 = new Vec3(0.5, 0.25, 0.5); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/WitherRoseBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/WitherRoseBlock.java.patch index 4883907d23..c456abf513 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/WitherRoseBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/WitherRoseBlock.java.patch @@ -1,6 +1,10 @@ --- a/net/minecraft/world/level/block/WitherRoseBlock.java +++ b/net/minecraft/world/level/block/WitherRoseBlock.java -@@ -66,7 +66,7 @@ +@@ -63,10 +63,11 @@ + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (world instanceof ServerLevel worldserver) { if (world.getDifficulty() != Difficulty.PEACEFUL && entity instanceof LivingEntity entityliving) { if (!entityliving.isInvulnerableTo(worldserver, world.damageSources().wither())) {