SPIGOT-4042: Fix emptying buckets onto slabs

This commit is contained in:
md_5 2018-07-18 17:48:17 +10:00
parent 65bc676ed0
commit 3e5fe3e40d

View File

@ -41,7 +41,7 @@
BlockPosition blockposition1 = this.a(iblockdata, blockposition, movingobjectposition);
- if (this.a(entityhuman, world, blockposition1, movingobjectposition)) {
+ if (this.a(entityhuman, world, blockposition1, movingobjectposition, blockposition, itemstack)) { // CraftBukkit
+ if (this.a(entityhuman, world, blockposition1, movingobjectposition, movingobjectposition.direction, blockposition, itemstack)) { // CraftBukkit
this.a(world, itemstack, blockposition1);
if (entityhuman instanceof EntityPlayer) {
CriterionTriggers.y.a((EntityPlayer) entityhuman, blockposition1, itemstack);
@ -75,21 +75,24 @@
+ // CraftBukkit start
public boolean a(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPosition movingobjectposition) {
+ return a(entityhuman, world, blockposition, movingobjectposition, null, null);
+ return a(entityhuman, world, blockposition, movingobjectposition, null, null, null);
+ }
+
+ public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPosition movingobjectposition, BlockPosition clicked, ItemStack itemstack) {
+ public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPosition movingobjectposition, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack) {
+ // CraftBukkit end
if (!(this.a instanceof FluidTypeFlowing)) {
return false;
} else {
@@ -105,6 +129,15 @@
@@ -103,8 +127,17 @@
boolean flag1 = material.isReplaceable();
if (!world.isEmpty(blockposition) && !flag && !flag1 && (!(iblockdata.getBlock() instanceof IFluidContainer) || !((IFluidContainer) iblockdata.getBlock()).a((IBlockAccess) world, blockposition, iblockdata, this.a))) {
return movingobjectposition == null ? false : this.a(entityhuman, world, movingobjectposition.a().shift(movingobjectposition.direction), (MovingObjectPosition) null);
- return movingobjectposition == null ? false : this.a(entityhuman, world, movingobjectposition.a().shift(movingobjectposition.direction), (MovingObjectPosition) null);
+ return movingobjectposition == null ? false : this.a(entityhuman, world, movingobjectposition.a().shift(movingobjectposition.direction), (MovingObjectPosition) null, enumdirection, clicked, itemstack); // CraftBukkit
} else {
+ // CraftBukkit start
+ if (entityhuman != null) {
+ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(entityhuman, clicked.getX(), clicked.getY(), clicked.getZ(), movingobjectposition.direction, itemstack);
+ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(entityhuman, clicked.getX(), clicked.getY(), clicked.getZ(), enumdirection, itemstack);
+ if (event.isCancelled()) {
+ // TODO: inventory not updated
+ return false;