mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
8c5b837e05
Firstly, the old methods all routed to the CompletableFuture method. However, the CF method could not guarantee that if the caller was off-main that the future would be "completed" on-main. Since the callback methods used the CF one, this meant that the callback methods did not guarantee that the callbacks were to be called on the main thread. Now, all methods route to getChunkAtAsync(x, z, gen, urgent, cb) so that the methods with the callback are guaranteed to invoke the callback on the main thread. The CF behavior remains unchanged; it may still appear to complete on main if invoked off-main. Secondly, remove the scheduleOnMain invocation in the async chunk completion. This unnecessarily delays the callback by 1 tick. Thirdly, add getChunksAtAsync(minX, minZ, maxX, maxZ, ...) which will load chunks within an area. This method is provided as a helper as keeping all chunks loaded within an area can be complicated to implement for plugins (due to the lacking ticket API), and is already implemented internally anyways. Fourthly, remove the ticket addition that occured with getChunkAt and getChunkAtAsync. The ticket addition may delay the unloading of the chunk unnecessarily. It also fixes a very rare timing bug where the future/callback would be completed after the chunk unloads.
294 lines
24 KiB
Diff
294 lines
24 KiB
Diff
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
|
|
index 7f0811bc22d78cdc0aca4c6869c90252d8a59eed..c8ca41cd81a72f9bff40f5c1b3bfc1189bf51f98 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
|
@@ -128,6 +128,7 @@ public abstract class BaseFireBlock extends Block {
|
|
|
|
@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);
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
|
|
index cd3d9e69653afba51a55a3dfc6764b712b8df859..9afa811579ac2e556b5c5c23b3b49587439dfadc 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
|
|
@@ -77,6 +77,7 @@ public abstract class BasePressurePlateBlock extends Block {
|
|
|
|
@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);
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
|
|
index 87083f7de53e32713b54315803ccd414db2debc8..9e3f1441d62128535112621bf259c24f1a90595b 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
|
|
@@ -180,6 +180,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone
|
|
|
|
@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)) {
|
|
// CraftBukkit start - tilt dripleaf
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
|
|
index c2d8caee4acb878aaa43c0cdc6f6a37555b69a12..385da0585f409ee453f10d45f5837cdc09adc21b 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
|
|
@@ -48,6 +48,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup {
|
|
|
|
@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/src/main/java/net/minecraft/world/level/block/ButtonBlock.java b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
|
|
index e210c210b733fc968b9c3816bb1f9755d76660ef..061a8f8b58d9fa7959333e2f59d3b7ee03cbf92d 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
|
|
@@ -208,6 +208,7 @@ public class ButtonBlock extends FaceAttachedHorizontalDirectionalBlock {
|
|
|
|
@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);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
|
index de1b64e0cbe7f2de63f04262428c9e6ec340916e..c045b1cccf0047dbef8c04d5a28d31d53389054f 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
|
@@ -122,6 +122,7 @@ public class CactusBlock extends Block {
|
|
|
|
@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
|
|
entity.hurt(world.damageSources().cactus().directBlock(world, pos), 1.0F); // CraftBukkit
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
|
|
index 1cc807a7a73ea35919259d7d8370fa3bcc44fb2f..18d4020017d76303d3179fad8974574777ea6305 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
|
|
@@ -112,6 +112,7 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB
|
|
|
|
@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().directBlock(world, pos), (float) this.fireDamage); // CraftBukkit
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
|
index 93c9f093eef0568a3816412fa497c12487ff04e3..79ebc37a779bf6cba66a34a7604f819e95fd86a2 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
|
@@ -174,6 +174,7 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
|
|
|
|
@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 && CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
|
|
worldserver.destroyBlock(pos, true, entity);
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
|
|
index 1e2f56b5c40c3dc72bc38354160f8e7de1f4f5cf..fa1c4defd0d4e4cd888eb26eed131539d0ed573f 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
|
|
@@ -52,6 +52,7 @@ public class DetectorRailBlock extends BaseRailBlock {
|
|
|
|
@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);
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java
|
|
index ae32d7819ee45d6d334be19c78f8150d104fb787..bb4800c60ac05f2db8821737b2b884ea99b64799 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java
|
|
@@ -92,6 +92,7 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal {
|
|
|
|
@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);
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
|
index 5744944455b08d45a7c0fe2289414b50b6c0d66a..6ed6c2123ed4c54f191ed8cf6da72109fb95eb69 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
|
@@ -68,6 +68,7 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal {
|
|
|
|
@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()));
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
|
index aee71779f31def5f1ef7438cf06219d1de7092ec..34be6b349722240e99f91d28067578aa0b4bd1fe 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
|
@@ -89,6 +89,7 @@ public class FrogspawnBlock extends Block {
|
|
|
|
@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);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
|
|
index 3ddf43a8afe8f00ca910d7838356dfc6d007a4f9..5c360c6768582c1a35431739613e9b406875cc21 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
|
|
@@ -60,6 +60,7 @@ public class HoneyBlock extends HalfTransparentBlock {
|
|
|
|
@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/src/main/java/net/minecraft/world/level/block/HopperBlock.java b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
|
|
index 19ace6115a80f2696746bd98a5465259e4f1a633..b61324fe162f32817b87e4adb80df57b9433259f 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
|
|
@@ -183,6 +183,7 @@ public class HopperBlock extends BaseEntityBlock {
|
|
|
|
@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/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java
|
|
index 7bf2c33a194517d4e52511fe32a8434cbed0361f..d29a62775913922ffb8e3c58ae0db7e37f77226e 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java
|
|
@@ -32,6 +32,7 @@ public class LavaCauldronBlock extends AbstractCauldronBlock {
|
|
|
|
@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/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
|
|
index c088d713e80f16ead333ea5283f7f95a2de08523..4ab73a083eba2ad3e12526af0a0dbcfba5cf6c14 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
|
|
@@ -67,6 +67,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
|
|
|
|
@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)) {
|
|
// CraftBukkit start - moved down
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
|
index dea13596eb8a3b7bc69c19545b2227b4c45ed241..c00507fa7af579263caed67dafc2ea9eba09512b 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
|
@@ -115,6 +115,7 @@ public class NetherPortalBlock extends Block implements Portal {
|
|
|
|
@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()));
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
|
|
index 3825b25c7417e4c2e5a25154879199b155a4921f..972d8833127090c01d620cab10b3eca3d3601710 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
|
|
@@ -107,6 +107,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl
|
|
|
|
@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/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
|
|
index aaf9350a096022c87ccb788d657c1ae6a7b53a47..53f1a7ed6b4bd6e2d8460531226aabf249994c02 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
|
|
@@ -59,6 +59,7 @@ public class PowderSnowBlock extends Block implements BucketPickup {
|
|
|
|
@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) {
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
|
|
index 3cd04097fc698d29d395c0ee28aadaec7c87b5a2..d61173ae5818fe6b507823fd9ddc0584cd5809b9 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
|
|
@@ -84,6 +84,7 @@ public class SweetBerryBushBlock extends BushBlock implements BonemealableBlock
|
|
|
|
@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) {
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
|
index 93777f83cdd2de30ccf597fadd8418853954d1ce..f079e5a9aa098225acf09ed9b4aa7ddbc2381270 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
|
@@ -141,6 +141,7 @@ public class TripWireBlock extends Block {
|
|
|
|
@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));
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
|
|
index 34599b88011aff718f5a6373229489ea3d947ff7..674d710ff88db5eced9e017284d1b7ec7a4fe7cd 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
|
|
@@ -33,6 +33,7 @@ public class WaterlilyBlock extends BushBlock {
|
|
|
|
@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/src/main/java/net/minecraft/world/level/block/WebBlock.java b/src/main/java/net/minecraft/world/level/block/WebBlock.java
|
|
index 4b621793da3d6fbc44f90df863b099ba992930fb..fc209fab3ed1ccb35706a5529ec23ad8b902e491 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/WebBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/WebBlock.java
|
|
@@ -24,6 +24,7 @@ public class WebBlock extends Block {
|
|
|
|
@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/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
|
|
index 2f67e26b4c030c1747346f6d02076bd21f11d32e..b481d67e3646242b8eb1b9890e09b56b9406fecb 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
|
|
@@ -63,6 +63,7 @@ public class WitherRoseBlock 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 instanceof ServerLevel worldserver) {
|
|
if (world.getDifficulty() != Difficulty.PEACEFUL && entity instanceof LivingEntity entityliving) {
|
|
if (!entityliving.isInvulnerableTo(worldserver, world.damageSources().wither())) {
|