diff options
author | BlackHole <black-hole@live.com> | 2017-03-21 23:03:20 +0100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2017-03-22 15:15:34 +1100 |
commit | cf05cccd1b8b96bd48474cbf6c8ddae3365d00d0 (patch) | |
tree | 752a29611dd2cadd97120311608d49ce86592bdf /nms-patches | |
parent | 257d6cd04f7d669a4000b81ca78624f6501787c1 (diff) | |
download | craftbukkit-cf05cccd1b8b96bd48474cbf6c8ddae3365d00d0.tar craftbukkit-cf05cccd1b8b96bd48474cbf6c8ddae3365d00d0.tar.gz craftbukkit-cf05cccd1b8b96bd48474cbf6c8ddae3365d00d0.tar.lz craftbukkit-cf05cccd1b8b96bd48474cbf6c8ddae3365d00d0.tar.xz craftbukkit-cf05cccd1b8b96bd48474cbf6c8ddae3365d00d0.zip |
SPIGOT-3143: Don't decrease item stack size if VehicleCreateEvent is cancelled
Diffstat (limited to 'nms-patches')
-rw-r--r-- | nms-patches/DispenserRegistry.patch | 3 | ||||
-rw-r--r-- | nms-patches/ItemBoat.patch | 9 | ||||
-rw-r--r-- | nms-patches/ItemMinecart.patch | 12 |
3 files changed, 22 insertions, 2 deletions
diff --git a/nms-patches/DispenserRegistry.patch b/nms-patches/DispenserRegistry.patch index 134423f6..189f1cf5 100644 --- a/nms-patches/DispenserRegistry.patch +++ b/nms-patches/DispenserRegistry.patch @@ -498,8 +498,9 @@ entityboat.setType(this.c); entityboat.yaw = enumdirection.l(); - world.addEntity(entityboat); +- world.addEntity(entityboat); - itemstack.subtract(1); ++ if (!world.addEntity(entityboat)) itemstack.add(1); // CraftBukkit + // itemstack.subtract(1); // CraftBukkit - handled during event processing return itemstack; } diff --git a/nms-patches/ItemBoat.patch b/nms-patches/ItemBoat.patch index abcb54aa..e25ef73f 100644 --- a/nms-patches/ItemBoat.patch +++ b/nms-patches/ItemBoat.patch @@ -14,3 +14,12 @@ Block block = world.getType(movingobjectposition.a()).getBlock(); boolean flag1 = block == Blocks.WATER || block == Blocks.FLOWING_WATER; EntityBoat entityboat = new EntityBoat(world, movingobjectposition.pos.x, flag1 ? movingobjectposition.pos.y - 0.12D : movingobjectposition.pos.y, movingobjectposition.pos.z); +@@ -66,7 +73,7 @@ + return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack); + } else { + if (!world.isClientSide) { +- world.addEntity(entityboat); ++ if (!world.addEntity(entityboat)) return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack); // CraftBukkit + } + + if (!entityhuman.abilities.canInstantlyBuild) { diff --git a/nms-patches/ItemMinecart.patch b/nms-patches/ItemMinecart.patch index 2a92f8c0..60c5b2e5 100644 --- a/nms-patches/ItemMinecart.patch +++ b/nms-patches/ItemMinecart.patch @@ -50,10 +50,20 @@ entityminecartabstract.setCustomName(itemstack.getName()); } - world.addEntity(entityminecartabstract); +- world.addEntity(entityminecartabstract); - itemstack.subtract(1); ++ if (!world.addEntity(entityminecartabstract)) itemstack.add(1); + // itemstack.subtract(1); // CraftBukkit - handled during event processing + // CraftBukkit end return itemstack; } +@@ -83,7 +117,7 @@ + entityminecartabstract.setCustomName(itemstack.getName()); + } + +- world.addEntity(entityminecartabstract); ++ if (!world.addEntity(entityminecartabstract)) return EnumInteractionResult.PASS; // CraftBukkit + } + + itemstack.subtract(1); |