geforkt von Mirrors/Paper
SPIGOT-5163: Cancelling PlayerBucketFillEvent visually removes the targeted block
Dieser Commit ist enthalten in:
Ursprung
5f88938850
Commit
2349feb849
@ -14,7 +14,7 @@
|
||||
|
||||
public class ItemBucket extends Item {
|
||||
|
||||
@@ -30,12 +37,21 @@
|
||||
@@ -30,12 +37,22 @@
|
||||
if (this.fluidType == FluidTypes.EMPTY) {
|
||||
iblockdata = world.getType(blockposition);
|
||||
if (iblockdata.getBlock() instanceof IFluidSource) {
|
||||
@ -23,6 +23,7 @@
|
||||
+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, blockposition.getX(), blockposition.getY(), blockposition.getZ(), null, itemstack, dummyFluid.b());
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager)
|
||||
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
|
||||
+ return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack);
|
||||
+ }
|
||||
@ -37,7 +38,7 @@
|
||||
|
||||
if (!world.isClientSide) {
|
||||
CriterionTriggers.j.a((EntityPlayer) entityhuman, new ItemStack(fluidtype.b()));
|
||||
@@ -50,7 +66,7 @@
|
||||
@@ -50,7 +67,7 @@
|
||||
iblockdata = world.getType(blockposition);
|
||||
BlockPosition blockposition1 = iblockdata.getBlock() instanceof IFluidContainer && this.fluidType == FluidTypes.WATER ? blockposition : movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection());
|
||||
|
||||
@ -46,7 +47,7 @@
|
||||
this.a(world, itemstack, blockposition1);
|
||||
if (entityhuman instanceof EntityPlayer) {
|
||||
CriterionTriggers.y.a((EntityPlayer) entityhuman, blockposition1, itemstack);
|
||||
@@ -74,16 +90,19 @@
|
||||
@@ -74,16 +91,19 @@
|
||||
|
||||
public void a(World world, ItemStack itemstack, BlockPosition blockposition) {}
|
||||
|
||||
@ -70,7 +71,7 @@
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
@@ -91,7 +110,13 @@
|
||||
@@ -91,7 +111,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,7 +85,7 @@
|
||||
if (!(this.fluidType instanceof FluidTypeFlowing)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -101,8 +126,18 @@
|
||||
@@ -101,8 +127,18 @@
|
||||
boolean flag1 = material.isReplaceable();
|
||||
|
||||
if (!world.isEmpty(blockposition) && !flag && !flag1 && (!(iblockdata.getBlock() instanceof IFluidContainer) || !((IFluidContainer) iblockdata.getBlock()).canPlace(world, blockposition, iblockdata, this.fluidType))) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren