2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 8 May 2021 18:02:36 -0700
Subject: [PATCH] Add EntityInsideBlockEvent
diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
2024-10-23 20:15:25 +02:00
index 7f0811bc22d78cdc0aca4c6869c90252d8a59eed..c8ca41cd81a72f9bff40f5c1b3bfc1189bf51f98 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
2024-10-23 20:15:25 +02:00
@@ -128,6 +128,7 @@ public abstract class BaseFireBlock extends Block {
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2021-06-11 14:02:28 +02:00
if (!entity.fireImmune()) {
2024-10-23 20:15:25 +02:00
if (entity.getRemainingFireTicks() < 0) {
entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
2024-10-23 20:15:25 +02:00
index cd3d9e69653afba51a55a3dfc6764b712b8df859..9afa811579ac2e556b5c5c23b3b49587439dfadc 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
2024-04-24 16:29:12 +02:00
@@ -77,6 +77,7 @@ public abstract class BasePressurePlateBlock extends Block {
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2021-06-11 14:02:28 +02:00
if (!world.isClientSide) {
int i = this.getSignalForState(state);
2021-11-24 22:30:53 +01:00
diff --git a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
2024-10-23 20:15:25 +02:00
index 87083f7de53e32713b54315803ccd414db2debc8..9e3f1441d62128535112621bf259c24f1a90595b 100644
2021-11-24 22:30:53 +01:00
--- a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
2024-10-23 20:15:25 +02:00
@@ -180,6 +180,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone
2021-11-24 22:30:53 +01:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2021-11-24 22:30:53 +01:00
if (!world.isClientSide) {
if (state.getValue(BigDripleafBlock.TILT) == Tilt.NONE && BigDripleafBlock.canEntityTilt(pos, entity) && !world.hasNeighborSignal(pos)) {
// CraftBukkit start - tilt dripleaf
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
2024-10-23 20:15:25 +02:00
index c2d8caee4acb878aaa43c0cdc6f6a37555b69a12..385da0585f409ee453f10d45f5837cdc09adc21b 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
2024-10-23 20:15:25 +02:00
@@ -48,6 +48,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup {
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2021-06-15 04:59:31 +02:00
BlockState blockState = world.getBlockState(pos.above());
if (blockState.isAir()) {
entity.onAboveBubbleCol(state.getValue(DRAG_DOWN));
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
2024-10-23 20:15:25 +02:00
index e210c210b733fc968b9c3816bb1f9755d76660ef..061a8f8b58d9fa7959333e2f59d3b7ee03cbf92d 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
2024-10-23 20:15:25 +02:00
@@ -208,6 +208,7 @@ public class ButtonBlock extends FaceAttachedHorizontalDirectionalBlock {
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2023-12-06 04:57:46 +01:00
if (!world.isClientSide && this.type.canButtonBeActivatedByArrows() && !(Boolean) state.getValue(ButtonBlock.POWERED)) {
2021-06-11 14:02:28 +02:00
this.checkPressed(state, world, pos);
}
diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
2024-10-23 20:15:25 +02:00
index de1b64e0cbe7f2de63f04262428c9e6ec340916e..c045b1cccf0047dbef8c04d5a28d31d53389054f 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
2024-10-23 20:15:25 +02:00
@@ -122,6 +122,7 @@ public class CactusBlock extends Block {
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
Updated Upstream (Bukkit/CraftBukkit) (#10242)
* Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
a6a9d2a4 Remove some old ApiStatus.Experimental annotations
be72314c SPIGOT-7300, PR-829: Add new DamageSource API providing enhanced information about entity damage
b252cf05 SPIGOT-7576, PR-970: Add methods in MushroomCow to change stew effects
b1c689bd PR-902: Add Server#isLoggingIPs to get log-ips configuration
08f86d1c PR-971: Add Player methods for client-side potion effects
2e3024a9 PR-963: Add API for in-world structures
a23292a7 SPIGOT-7530, PR-948: Improve Resource Pack API with new 1.20.3 functionality
1851857b SPIGOT-3071, PR-969: Add entity spawn method with spawn reason
cde4c52a SPIGOT-5553, PR-964: Add EntityKnockbackEvent
CraftBukkit Changes:
38fd4bd50 Fix accidentally renamed internal damage method
80f0ce4be SPIGOT-7300, PR-1180: Add new DamageSource API providing enhanced information about entity damage
7e43f3b16 SPIGOT-7581: Fix typo in BlockMushroom
ea14b7d90 SPIGOT-7576, PR-1347: Add methods in MushroomCow to change stew effects
4c687f243 PR-1259: Add Server#isLoggingIPs to get log-ips configuration
22a541a29 Improve support for per-world game rules
cb7dccce2 PR-1348: Add Player methods for client-side potion effects
b8d6109f0 PR-1335: Add API for in-world structures
4398a1b5b SPIGOT-7577: Make CraftWindCharge#explode discard the entity
e74107678 Fix Crafter maximum stack size
0bb0f4f6a SPIGOT-7530, PR-1314: Improve Resource Pack API with new 1.20.3 functionality
4949f556d SPIGOT-3071, PR-1345: Add entity spawn method with spawn reason
20ac73ca2 PR-1353: Fix Structure#place not working as documented with 0 palette
3c1b77871 SPIGOT-6911, PR-1349: Change max book length in CraftMetaBook
333701839 SPIGOT-7572: Bee nests generated without bees
f48f4174c SPIGOT-5553, PR-1336: Add EntityKnockbackEvent
2024-02-11 22:28:00 +01:00
entity.hurt(world.damageSources().cactus().directBlock(world, pos), 1.0F); // CraftBukkit
}
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
2024-12-03 19:54:10 +01:00
index e03e2f1d84b4f12d78974b90eb4b741818cdac17..1b94f26e78db062f80d806b82f714a815b4710ff 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
2024-10-23 20:15:25 +02:00
@@ -112,6 +112,7 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2024-06-14 01:32:45 +02:00
if ((Boolean) state.getValue(CampfireBlock.LIT) && entity instanceof LivingEntity) {
entity.hurt(world.damageSources().campfire().directBlock(world, pos), (float) this.fireDamage); // CraftBukkit
Updated Upstream (Bukkit/CraftBukkit) (#10242)
* Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
a6a9d2a4 Remove some old ApiStatus.Experimental annotations
be72314c SPIGOT-7300, PR-829: Add new DamageSource API providing enhanced information about entity damage
b252cf05 SPIGOT-7576, PR-970: Add methods in MushroomCow to change stew effects
b1c689bd PR-902: Add Server#isLoggingIPs to get log-ips configuration
08f86d1c PR-971: Add Player methods for client-side potion effects
2e3024a9 PR-963: Add API for in-world structures
a23292a7 SPIGOT-7530, PR-948: Improve Resource Pack API with new 1.20.3 functionality
1851857b SPIGOT-3071, PR-969: Add entity spawn method with spawn reason
cde4c52a SPIGOT-5553, PR-964: Add EntityKnockbackEvent
CraftBukkit Changes:
38fd4bd50 Fix accidentally renamed internal damage method
80f0ce4be SPIGOT-7300, PR-1180: Add new DamageSource API providing enhanced information about entity damage
7e43f3b16 SPIGOT-7581: Fix typo in BlockMushroom
ea14b7d90 SPIGOT-7576, PR-1347: Add methods in MushroomCow to change stew effects
4c687f243 PR-1259: Add Server#isLoggingIPs to get log-ips configuration
22a541a29 Improve support for per-world game rules
cb7dccce2 PR-1348: Add Player methods for client-side potion effects
b8d6109f0 PR-1335: Add API for in-world structures
4398a1b5b SPIGOT-7577: Make CraftWindCharge#explode discard the entity
e74107678 Fix Crafter maximum stack size
0bb0f4f6a SPIGOT-7530, PR-1314: Improve Resource Pack API with new 1.20.3 functionality
4949f556d SPIGOT-3071, PR-1345: Add entity spawn method with spawn reason
20ac73ca2 PR-1353: Fix Structure#place not working as documented with 0 palette
3c1b77871 SPIGOT-6911, PR-1349: Change max book length in CraftMetaBook
333701839 SPIGOT-7572: Bee nests generated without bees
f48f4174c SPIGOT-5553, PR-1336: Add EntityKnockbackEvent
2024-02-11 22:28:00 +01:00
}
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
2024-12-03 19:54:10 +01:00
index 91dd550de860fd16585218814eae0b9dc877c77d..6fe896079c0ae622976c2055f8d13cda5ed3ea3d 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
2023-12-06 04:57:46 +01:00
@@ -174,6 +174,7 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2024-10-23 20:15:25 +02:00
if (world instanceof ServerLevel worldserver) {
if (entity instanceof Ravager && CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
worldserver.destroyBlock(pos, true, entity);
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
2024-10-23 20:15:25 +02:00
index 1e2f56b5c40c3dc72bc38354160f8e7de1f4f5cf..fa1c4defd0d4e4cd888eb26eed131539d0ed573f 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
2024-10-23 20:15:25 +02:00
@@ -52,6 +52,7 @@ public class DetectorRailBlock extends BaseRailBlock {
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2021-06-11 14:02:28 +02:00
if (!world.isClientSide) {
if (!(Boolean) state.getValue(DetectorRailBlock.POWERED)) {
this.checkPressed(world, pos, state);
2024-06-14 01:32:45 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java
2024-12-03 19:54:10 +01:00
index b27b09fcb895b72c51335bdcb095f0f3bd3a190b..58b2454ac5bd3400559aba3c64f228f41f6218ae 100644
2024-06-14 01:32:45 +02:00
--- a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java
2024-10-23 20:15:25 +02:00
@@ -92,6 +92,7 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal {
2024-06-14 01:32:45 +02:00
@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);
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
2024-12-03 19:54:10 +01:00
index 8887d35d188510cf10da3dc46b0b56373ac346bd..8ca226641588a88c8b068a7acac9d7e92b077144 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
2024-10-23 20:15:25 +02:00
@@ -68,6 +68,7 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal {
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2024-10-23 20:15:25 +02:00
if (entity.canUsePortal(false)) {
2024-06-14 01:32:45 +02:00
// CraftBukkit start - Entity in portal
EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
2024-12-04 21:49:46 +01:00
diff --git a/src/main/java/net/minecraft/world/level/block/EyeblossomBlock.java b/src/main/java/net/minecraft/world/level/block/EyeblossomBlock.java
index be3ddd70a68c43cd8db5d8a25e7d5d7e7b91751d..efe3f34a32fd01c9edba937b4b8ea25f51d86ba0 100644
--- a/src/main/java/net/minecraft/world/level/block/EyeblossomBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EyeblossomBlock.java
@@ -100,6 +100,7 @@ public class EyeblossomBlock extends FlowerBlock {
@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
2022-12-09 11:46:47 +01:00
diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
2024-10-23 20:15:25 +02:00
index aee71779f31def5f1ef7438cf06219d1de7092ec..34be6b349722240e99f91d28067578aa0b4bd1fe 100644
2022-12-09 11:46:47 +01:00
--- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
2024-10-23 20:15:25 +02:00
@@ -89,6 +89,7 @@ public class FrogspawnBlock extends Block {
2022-12-09 11:46:47 +01:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2022-12-09 11:46:47 +01:00
if (entity.getType().equals(EntityType.FALLING_BLOCK)) {
this.destroyBlock(world, pos);
}
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
2024-10-23 20:15:25 +02:00
index 3ddf43a8afe8f00ca910d7838356dfc6d007a4f9..5c360c6768582c1a35431739613e9b406875cc21 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
2024-04-12 21:14:06 +02:00
@@ -60,6 +60,7 @@ public class HoneyBlock extends HalfTransparentBlock {
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2021-06-11 14:02:28 +02:00
if (this.isSlidingDown(pos, entity)) {
this.maybeDoSlideAchievement(entity, pos);
this.doSlideMovement(entity);
diff --git a/src/main/java/net/minecraft/world/level/block/HopperBlock.java b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
2024-12-03 19:54:10 +01:00
index 882e7e6c7fa77eef109f8203f22edfa9536a96f8..9da02e643948aaea91307e28eb83177aa5d0ecec 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
2024-12-03 19:54:10 +01:00
@@ -178,6 +178,7 @@ public class HopperBlock extends BaseEntityBlock {
2021-06-15 04:59:31 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2021-06-15 04:59:31 +02:00
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof HopperBlockEntity) {
HopperBlockEntity.entityInside(world, pos, state, entity, (HopperBlockEntity)blockEntity);
diff --git a/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java
2024-04-24 16:29:12 +02:00
index 7bf2c33a194517d4e52511fe32a8434cbed0361f..d29a62775913922ffb8e3c58ae0db7e37f77226e 100644
2021-06-15 04:59:31 +02:00
--- a/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java
2023-12-06 04:57:46 +01:00
@@ -32,6 +32,7 @@ public class LavaCauldronBlock extends AbstractCauldronBlock {
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2021-06-15 04:59:31 +02:00
if (this.isEntityInsideContent(state, pos, entity)) {
entity.lavaHurt();
}
diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
2024-10-23 20:15:25 +02:00
index c088d713e80f16ead333ea5283f7f95a2de08523..4ab73a083eba2ad3e12526af0a0dbcfba5cf6c14 100644
2021-06-15 04:59:31 +02:00
--- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
2024-10-23 20:15:25 +02:00
@@ -67,6 +67,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
2021-06-11 14:02:28 +02:00
2021-06-15 04:59:31 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2024-10-23 20:15:25 +02:00
if (world instanceof ServerLevel worldserver) {
if (entity.isOnFire() && this.isEntityInsideContent(state, pos, entity)) {
// CraftBukkit start - moved down
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
2024-12-03 19:54:10 +01:00
index e404722c119631e31c0519111ccd5f1682c2638d..151025a407a07271bc205955f0ce06f84231563b 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
2024-10-23 20:15:25 +02:00
@@ -115,6 +115,7 @@ public class NetherPortalBlock extends Block implements Portal {
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2024-06-14 01:32:45 +02:00
if (entity.canUsePortal(false)) {
2021-06-11 14:02:28 +02:00
// CraftBukkit start - Entity in portal
EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
2023-06-09 02:34:35 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
2024-10-23 20:15:25 +02:00
index 3825b25c7417e4c2e5a25154879199b155a4921f..972d8833127090c01d620cab10b3eca3d3601710 100644
2023-06-09 02:34:35 +02:00
--- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
2024-10-23 20:15:25 +02:00
@@ -107,6 +107,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl
2023-06-09 02:34:35 +02:00
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2024-10-23 20:15:25 +02:00
if (world instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
serverLevel.destroyBlock(pos, true, entity);
2023-06-09 02:34:35 +02:00
}
2021-06-15 04:59:31 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
2024-10-23 20:15:25 +02:00
index aaf9350a096022c87ccb788d657c1ae6a7b53a47..53f1a7ed6b4bd6e2d8460531226aabf249994c02 100644
2021-06-15 04:59:31 +02:00
--- a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
2024-10-23 20:15:25 +02:00
@@ -59,6 +59,7 @@ public class PowderSnowBlock extends Block implements BucketPickup {
2021-06-15 04:59:31 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2024-04-24 16:29:12 +02:00
if (!(entity instanceof LivingEntity) || entity.getInBlockState().is((Block) this)) {
2021-06-15 04:59:31 +02:00
entity.makeStuckInBlock(state, new Vec3(0.8999999761581421D, 1.5D, 0.8999999761581421D));
if (world.isClientSide) {
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
2024-12-03 19:54:10 +01:00
index a044a2d7e5cb7027394c95c495c59530bc5e18ce..265c85413da04dbc7292a0af934a8b665b2fced5 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
2024-10-23 20:15:25 +02:00
@@ -84,6 +84,7 @@ public class SweetBerryBushBlock extends BushBlock implements BonemealableBlock
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2021-06-11 14:02:28 +02:00
if (entity instanceof LivingEntity && entity.getType() != EntityType.FOX && entity.getType() != EntityType.BEE) {
entity.makeStuckInBlock(state, new Vec3(0.800000011920929D, 0.75D, 0.800000011920929D));
2024-10-23 20:15:25 +02:00
if (world instanceof ServerLevel) {
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
2024-10-23 20:15:25 +02:00
index 93777f83cdd2de30ccf597fadd8418853954d1ce..f079e5a9aa098225acf09ed9b4aa7ddbc2381270 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
2024-10-23 20:15:25 +02:00
@@ -141,6 +141,7 @@ public class TripWireBlock extends Block {
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2021-06-11 14:02:28 +02:00
if (!world.isClientSide) {
if (!(Boolean) state.getValue(TripWireBlock.POWERED)) {
2024-10-23 20:15:25 +02:00
this.checkPressed(world, pos, List.of(entity));
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
2024-10-23 20:15:25 +02:00
index 34599b88011aff718f5a6373229489ea3d947ff7..674d710ff88db5eced9e017284d1b7ec7a4fe7cd 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
2024-10-23 20:15:25 +02:00
@@ -33,6 +33,7 @@ public class WaterlilyBlock extends BushBlock {
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2024-10-23 20:15:25 +02:00
super.entityInside(state, world, pos, entity);
if (world instanceof ServerLevel && entity instanceof AbstractBoat) {
2023-07-04 10:22:56 +02:00
// CraftBukkit start
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/WebBlock.java b/src/main/java/net/minecraft/world/level/block/WebBlock.java
2024-04-24 16:29:12 +02:00
index 4b621793da3d6fbc44f90df863b099ba992930fb..fc209fab3ed1ccb35706a5529ec23ad8b902e491 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/WebBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WebBlock.java
2024-04-24 16:29:12 +02:00
@@ -24,6 +24,7 @@ public class WebBlock extends Block {
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2024-04-24 16:29:12 +02:00
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);
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
2024-12-03 19:54:10 +01:00
index b42924ebdd0f5369151b8a37f0070dec7f402073..8b79b2b7766d873b7e689309d936982fc1724686 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
2024-10-23 20:15:25 +02:00
@@ -63,6 +63,7 @@ public class WitherRoseBlock extends FlowerBlock {
2021-06-11 14:02:28 +02:00
@Override
2024-04-24 16:29:12 +02:00
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
2024-01-19 13:22:30 +01:00
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
2024-10-23 20:15:25 +02:00
if (world instanceof ServerLevel worldserver) {
if (world.getDifficulty() != Difficulty.PEACEFUL && entity instanceof LivingEntity entityliving) {
if (!entityliving.isInvulnerableTo(worldserver, world.damageSources().wither())) {