mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
222 lines
18 KiB
Diff
222 lines
18 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/BlockBubbleColumn.java b/src/main/java/net/minecraft/world/level/block/BlockBubbleColumn.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockBubbleColumn.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockBubbleColumn.java
|
|
@@ -0,0 +0,0 @@ public class BlockBubbleColumn extends Block implements IFluidSource {
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
IBlockData iblockdata1 = world.getType(blockposition.up());
|
|
|
|
if (iblockdata1.isAir()) {
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockButtonAbstract.java b/src/main/java/net/minecraft/world/level/block/BlockButtonAbstract.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockButtonAbstract.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockButtonAbstract.java
|
|
@@ -0,0 +0,0 @@ public abstract class BlockButtonAbstract extends BlockAttachable {
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
if (!world.isClientSide && this.v && !(Boolean) iblockdata.get(BlockButtonAbstract.POWERED)) {
|
|
this.e(iblockdata, world, blockposition);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockCactus.java b/src/main/java/net/minecraft/world/level/block/BlockCactus.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockCactus.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockCactus.java
|
|
@@ -0,0 +0,0 @@ public class BlockCactus extends Block {
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
CraftEventFactory.blockDamage = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); // CraftBukkit
|
|
entity.damageEntity(DamageSource.CACTUS, 1.0F);
|
|
CraftEventFactory.blockDamage = null; // CraftBukkit
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockCampfire.java b/src/main/java/net/minecraft/world/level/block/BlockCampfire.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockCampfire.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockCampfire.java
|
|
@@ -0,0 +0,0 @@ public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
if (!entity.isFireProof() && (Boolean) iblockdata.get(BlockCampfire.LIT) && entity instanceof EntityLiving && !EnchantmentManager.i((EntityLiving) entity)) {
|
|
entity.damageEntity(DamageSource.FIRE, (float) this.h);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockCauldron.java b/src/main/java/net/minecraft/world/level/block/BlockCauldron.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockCauldron.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockCauldron.java
|
|
@@ -0,0 +0,0 @@ public class BlockCauldron extends Block {
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
int i = (Integer) iblockdata.get(BlockCauldron.LEVEL);
|
|
float f = (float) blockposition.getY() + (6.0F + (float) (3 * i)) / 16.0F;
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockCrops.java b/src/main/java/net/minecraft/world/level/block/BlockCrops.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockCrops.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockCrops.java
|
|
@@ -0,0 +0,0 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
if (entity instanceof EntityRavager && !CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.getBlockData(), !world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)).isCancelled()) { // CraftBukkit
|
|
world.a(blockposition, true, entity);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockEnderPortal.java b/src/main/java/net/minecraft/world/level/block/BlockEnderPortal.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockEnderPortal.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockEnderPortal.java
|
|
@@ -0,0 +0,0 @@ public class BlockEnderPortal extends BlockTileEntity {
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
if (world instanceof WorldServer && !entity.isPassenger() && !entity.isVehicle() && entity.canPortal() && VoxelShapes.c(VoxelShapes.a(entity.getBoundingBox().d((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) {
|
|
ResourceKey<World> resourcekey = world.getTypeKey() == DimensionManager.THE_END ? World.OVERWORLD : World.THE_END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
|
|
WorldServer worldserver = ((WorldServer) world).getMinecraftServer().getWorldServer(resourcekey);
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockFireAbstract.java b/src/main/java/net/minecraft/world/level/block/BlockFireAbstract.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockFireAbstract.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockFireAbstract.java
|
|
@@ -0,0 +0,0 @@ public abstract class BlockFireAbstract extends Block {
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
if (!entity.isFireProof()) {
|
|
entity.setFireTicks(entity.getFireTicks() + 1);
|
|
if (entity.getFireTicks() == 0) {
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockHoney.java b/src/main/java/net/minecraft/world/level/block/BlockHoney.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockHoney.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockHoney.java
|
|
@@ -0,0 +0,0 @@ public class BlockHoney extends BlockHalfTransparent {
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
if (this.a(blockposition, entity)) {
|
|
this.a(entity, blockposition);
|
|
this.d(entity);
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockHopper.java b/src/main/java/net/minecraft/world/level/block/BlockHopper.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockHopper.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockHopper.java
|
|
@@ -0,0 +0,0 @@ public class BlockHopper extends BlockTileEntity {
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
TileEntity tileentity = world.getTileEntity(blockposition);
|
|
|
|
if (tileentity instanceof TileEntityHopper) {
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockMinecartDetector.java b/src/main/java/net/minecraft/world/level/block/BlockMinecartDetector.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockMinecartDetector.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockMinecartDetector.java
|
|
@@ -0,0 +0,0 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
if (!world.isClientSide) {
|
|
if (!(Boolean) iblockdata.get(BlockMinecartDetector.POWERED)) {
|
|
this.a(world, blockposition, iblockdata);
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockPortal.java b/src/main/java/net/minecraft/world/level/block/BlockPortal.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockPortal.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockPortal.java
|
|
@@ -0,0 +0,0 @@ public class BlockPortal extends Block {
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
if (!entity.isPassenger() && !entity.isVehicle() && entity.canPortal()) {
|
|
// CraftBukkit start - Entity in portal
|
|
EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockPressurePlateAbstract.java b/src/main/java/net/minecraft/world/level/block/BlockPressurePlateAbstract.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockPressurePlateAbstract.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockPressurePlateAbstract.java
|
|
@@ -0,0 +0,0 @@ public abstract class BlockPressurePlateAbstract extends Block {
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
if (!world.isClientSide) {
|
|
int i = this.getPower(iblockdata);
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockSweetBerryBush.java b/src/main/java/net/minecraft/world/level/block/BlockSweetBerryBush.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockSweetBerryBush.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockSweetBerryBush.java
|
|
@@ -0,0 +0,0 @@ public class BlockSweetBerryBush extends BlockPlant implements IBlockFragilePlan
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
if (entity instanceof EntityLiving && entity.getEntityType() != EntityTypes.FOX && entity.getEntityType() != EntityTypes.BEE) {
|
|
entity.a(iblockdata, new Vec3D(0.800000011920929D, 0.75D, 0.800000011920929D));
|
|
if (!world.isClientSide && (Integer) iblockdata.get(BlockSweetBerryBush.a) > 0 && (entity.D != entity.locX() || entity.F != entity.locZ())) {
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockTripwire.java b/src/main/java/net/minecraft/world/level/block/BlockTripwire.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockTripwire.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockTripwire.java
|
|
@@ -0,0 +0,0 @@ public class BlockTripwire extends Block {
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
if (!world.isClientSide) {
|
|
if (!(Boolean) iblockdata.get(BlockTripwire.POWERED)) {
|
|
this.a(world, blockposition);
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockWaterLily.java b/src/main/java/net/minecraft/world/level/block/BlockWaterLily.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockWaterLily.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockWaterLily.java
|
|
@@ -0,0 +0,0 @@ public class BlockWaterLily extends BlockPlant {
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
super.a(iblockdata, world, blockposition, entity);
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
if (world instanceof WorldServer && entity instanceof EntityBoat && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { // CraftBukkit
|
|
world.a(new BlockPosition(blockposition), true, entity);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockWeb.java b/src/main/java/net/minecraft/world/level/block/BlockWeb.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockWeb.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockWeb.java
|
|
@@ -0,0 +0,0 @@ public class BlockWeb extends Block {
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
entity.a(iblockdata, new Vec3D(0.25D, 0.05000000074505806D, 0.25D));
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockWitherRose.java b/src/main/java/net/minecraft/world/level/block/BlockWitherRose.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockWitherRose.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockWitherRose.java
|
|
@@ -0,0 +0,0 @@ public class BlockWitherRose extends BlockFlowers {
|
|
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition)).callEvent()) { return; } // Paper
|
|
if (!world.isClientSide && world.getDifficulty() != EnumDifficulty.PEACEFUL) {
|
|
if (entity instanceof EntityLiving) {
|
|
EntityLiving entityliving = (EntityLiving) entity;
|