Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
SPIGOT-5936: BlockPlaceEvent does not fire for lily_pad
Dieser Commit ist enthalten in:
Ursprung
145921e2a6
Commit
b6a876bc34
@ -12,7 +12,36 @@
|
|||||||
|
|
||||||
public class ItemBlock extends Item {
|
public class ItemBlock extends Item {
|
||||||
|
|
||||||
@@ -55,7 +60,7 @@
|
@@ -31,6 +36,12 @@
|
||||||
|
return EnumInteractionResult.FAIL;
|
||||||
|
} else {
|
||||||
|
IBlockData iblockdata = this.c(blockactioncontext1);
|
||||||
|
+ // CraftBukkit start - special case for handling block placement with water lilies
|
||||||
|
+ org.bukkit.block.BlockState blockstate = null;
|
||||||
|
+ if (this instanceof ItemWaterLily) {
|
||||||
|
+ blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(blockactioncontext1.getWorld(), blockactioncontext1.getClickPosition());
|
||||||
|
+ }
|
||||||
|
+ // CraftBukkit end
|
||||||
|
|
||||||
|
if (iblockdata == null) {
|
||||||
|
return EnumInteractionResult.FAIL;
|
||||||
|
@@ -48,6 +59,15 @@
|
||||||
|
iblockdata1 = this.a(blockposition, world, itemstack, iblockdata1);
|
||||||
|
this.a(blockposition, world, entityhuman, itemstack, iblockdata1);
|
||||||
|
block.postPlace(world, blockposition, iblockdata1, entityhuman, itemstack);
|
||||||
|
+ // CraftBukkit start
|
||||||
|
+ if (blockstate != null) {
|
||||||
|
+ org.bukkit.event.block.BlockPlaceEvent placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent((WorldServer) world, entityhuman, blockactioncontext1.getHand(), blockstate, blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||||
|
+ if (placeEvent != null && (placeEvent.isCancelled() || !placeEvent.canBuild())) {
|
||||||
|
+ blockstate.update(true, false);
|
||||||
|
+ return EnumInteractionResult.FAIL;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ // CraftBukkit end
|
||||||
|
if (entityhuman instanceof EntityPlayer) {
|
||||||
|
CriterionTriggers.y.a((EntityPlayer) entityhuman, blockposition, itemstack);
|
||||||
|
}
|
||||||
|
@@ -55,7 +75,7 @@
|
||||||
|
|
||||||
SoundEffectType soundeffecttype = iblockdata1.getStepSound();
|
SoundEffectType soundeffecttype = iblockdata1.getStepSound();
|
||||||
|
|
||||||
@ -21,7 +50,7 @@
|
|||||||
if (entityhuman == null || !entityhuman.abilities.canInstantlyBuild) {
|
if (entityhuman == null || !entityhuman.abilities.canInstantlyBuild) {
|
||||||
itemstack.subtract(1);
|
itemstack.subtract(1);
|
||||||
}
|
}
|
||||||
@@ -92,6 +97,21 @@
|
@@ -92,6 +112,21 @@
|
||||||
|
|
||||||
if (nbttagcompound != null) {
|
if (nbttagcompound != null) {
|
||||||
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("BlockStateTag");
|
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("BlockStateTag");
|
||||||
@ -43,7 +72,7 @@
|
|||||||
BlockStateList<Block, IBlockData> blockstatelist = iblockdata.getBlock().getStates();
|
BlockStateList<Block, IBlockData> blockstatelist = iblockdata.getBlock().getStates();
|
||||||
Iterator iterator = nbttagcompound1.getKeys().iterator();
|
Iterator iterator = nbttagcompound1.getKeys().iterator();
|
||||||
|
|
||||||
@@ -106,11 +126,6 @@
|
@@ -106,11 +141,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,7 +84,7 @@
|
|||||||
return iblockdata1;
|
return iblockdata1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,8 +138,15 @@
|
@@ -123,8 +153,15 @@
|
||||||
protected boolean b(BlockActionContext blockactioncontext, IBlockData iblockdata) {
|
protected boolean b(BlockActionContext blockactioncontext, IBlockData iblockdata) {
|
||||||
EntityHuman entityhuman = blockactioncontext.getEntity();
|
EntityHuman entityhuman = blockactioncontext.getEntity();
|
||||||
VoxelShapeCollision voxelshapecollision = entityhuman == null ? VoxelShapeCollision.a() : VoxelShapeCollision.a((Entity) entityhuman);
|
VoxelShapeCollision voxelshapecollision = entityhuman == null ? VoxelShapeCollision.a() : VoxelShapeCollision.a((Entity) entityhuman);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren