mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
c5a10665b8
Spigot still maintains some partial implementation of "tick skipping", a practice in which the MinecraftServer.currentTick field is updated not by an increment of one per actual tick, but instead set to System.currentTimeMillis() / 50. This behaviour means that the tracked tick may "skip" a tick value in case a previous tick took more than the expected 50ms. To compensate for this in important paths, spigot/craftbukkit implements "wall-time". Instead of incrementing/decrementing ticks on block entities/entities by one for each call to their tick() method, they instead increment/decrement important values, like an ItemEntity's age or pickupDelay, by the difference of `currentTick - lastTick`, where `lastTick` is the value of `currentTick` during the last tick() call. These "fixes" however do not play nicely with minecraft's simulation distance as entities/block entities implementing the above behaviour would "catch up" their values when moving from a non-ticking chunk to a ticking one as their `lastTick` value remains stuck on the last tick in a ticking chunk and hence lead to a large "catch up" once ticked again. Paper completely removes the "tick skipping" behaviour (See patch "Further-improve-server-tick-loop"), making the above precautions completely unnecessary, which also rids paper of the previous described incompatibility with non-ticking chunks.
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 779d188bac9744889c1f4f554b300311e0effa29..0c5409af685ef1f251db3d9f9e21295c82a1e02a 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
|
|
@@ -125,6 +125,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()) {
|
|
entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
|
|
if (entity.getRemainingFireTicks() == 0) {
|
|
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 2b6e126f57cf67cd719f67e925fee97b2485f73f..8b33e35c843e5c0b8988a2ef2a38a2673035292f 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 c1f020efdc5a1170fc43b2579531be8bdcacc83b..8240c32d676a88aa23dcd052ee0136767e54fb0d 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
|
|
@@ -178,6 +178,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 7c70c98ee27a6a09e73942ff4dc0f88ceb77936f..4c1f20fafdbd86011959cc2d4983b6c2f8e87a5f 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
|
|
@@ -47,6 +47,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 4a58bf1081e57bd34858481dee824e2a75120281..4c37d9ebd74b32b9ad6dc46d000afc7a7d1bb4a3 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
|
|
@@ -206,6 +206,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 fd344c5cf0d6d523abe34d5e3f8d939106942cbb..ff4dda48116a2969704b355ff96407ba869b466e 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
|
@@ -121,6 +121,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 e81bf62cf9dbc27391deaad46d2098e81f746746..7f6058f4def83867971121751acd51c398583651 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
|
|
@@ -104,6 +104,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 fcaf6b4bb7371ce9f00a7d4306f7b2b6884b7c4c..73595922dcff8e7a8595fcf033ab238bc4096630 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 (entity instanceof Ravager && CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
|
|
world.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 55a97da8786ec0ae98abe56876c00f4678ba0007..9d69e439ff853465303c2abd896e6c5314752e1e 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
|
|
@@ -51,6 +51,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 2ad77d7666cc9a5101b3da58f07f497409676a26..11486419dd98a013c7387d3d73f322a95a18c574 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java
|
|
@@ -90,6 +90,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 a9c7a74b38a57c118c1ad67a77ba6f2e5c05d91e..28fba1448309805fc3d687de6bc8454d2c85fcd3 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
|
@@ -63,6 +63,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) && Shapes.joinIsNotEmpty(Shapes.create(entity.getBoundingBox().move((double) (-pos.getX()), (double) (-pos.getY()), (double) (-pos.getZ()))), state.getShape(world, pos), BooleanOp.AND)) {
|
|
// 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 b968129b9a93fdf771caba5f768456070543ba6a..669234bca9fa50548447f77dc5f314df8d9dd7c9 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
|
@@ -79,6 +79,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 1ed883c62be357d32365ef182e391e96172d2b56..c6f7815b5fad3aad4635208aa2e5c6739e13cb45 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 089ead2d55c4fbe361255391f553822715269c38..86e5617d445ce762aa374e236a0ccdfe5901fce5 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
|
|
@@ -187,6 +187,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 5f778ea22efa76ced1ba4455d50b94b3519113fc..7c67efa6e344870b764eb39d5508190349e2e911 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
|
|
@@ -66,6 +66,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.isClientSide && entity.isOnFire() && this.isEntityInsideContent(state, pos, entity)) {
|
|
// CraftBukkit start
|
|
if (entity.mayInteract(world, pos)) {
|
|
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 a4e1c878dc7677e8ccc7c568ab455e85513d86cb..e2969b49494c55c3705312361ee8083b05ef569e 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
|
@@ -107,6 +107,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 15696602249465fa1d13eaec3b8b06574ec06f07..c9ed129db2cadd0a33d69993961f43088725c3cb 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
|
|
@@ -98,6 +98,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 (entity instanceof Ravager && world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
|
world.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 1f9cab69fb19c96fb01fff0d7a5ecfdfff46a5d4..a6e6545402904141ffc6218a0158b0e9c67217c8 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
|
|
@@ -63,6 +63,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 49fce6000ffafc6f53767c971db951b20261b91d..6008c634c408c4eed563815da4d57b2eef69835c 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
|
|
@@ -85,6 +85,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.isClientSide && (Integer) state.getValue(SweetBerryBushBlock.AGE) > 0 && (entity.xOld != entity.getX() || entity.zOld != entity.getZ())) {
|
|
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 65b30286020b65e23d05307aade344cde827fcf2..e032d8907045c653c3dd449f65e93e40fd0bb6be 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
|
@@ -135,6 +135,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);
|
|
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 7f5e092e400c3a8422b677ca246031a945a0d359..edc20745649b0837f1371c8d29e71fc0c8e5528f 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
|
|
@@ -34,6 +34,7 @@ public class WaterlilyBlock extends BushBlock {
|
|
@Override
|
|
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
|
|
super.entityInside(state, world, pos, 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 && entity instanceof Boat) {
|
|
// CraftBukkit start
|
|
if (!CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState())) {
|
|
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 e861cf48aae27a8299437d76f6a84336cdcaddb7..3445916c2915b42967eb396b50b62d1912e3a49f 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
|
|
@@ -62,6 +62,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.isClientSide && world.getDifficulty() != Difficulty.PEACEFUL) {
|
|
if (entity instanceof LivingEntity) {
|
|
LivingEntity entityliving = (LivingEntity) entity;
|