mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Add EntityInsideBlockEvent
This commit is contained in:
parent
cc2c25ba55
commit
eb675d9110
25 changed files with 197 additions and 34 deletions
|
@ -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 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<? extends Entity> entityClass) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<AbstractMinecart> 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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
|
@ -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);
|
|
@ -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();
|
||||
}
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
|
@ -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())) {
|
||||
|
|
Loading…
Reference in a new issue