diff options
Diffstat (limited to 'patch-remap/og/net/minecraft/world/entity/animal/Bucketable.patch')
-rw-r--r-- | patch-remap/og/net/minecraft/world/entity/animal/Bucketable.patch | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/entity/animal/Bucketable.patch b/patch-remap/og/net/minecraft/world/entity/animal/Bucketable.patch new file mode 100644 index 0000000000..9fd8543e5a --- /dev/null +++ b/patch-remap/og/net/minecraft/world/entity/animal/Bucketable.patch @@ -0,0 +1,41 @@ +--- a/net/minecraft/world/entity/animal/Bucketable.java ++++ b/net/minecraft/world/entity/animal/Bucketable.java +@@ -15,6 +15,14 @@ + import net.minecraft.world.item.Items; + import net.minecraft.world.level.World; + ++// CraftBukkit start ++import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata; ++import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity; ++import org.bukkit.craftbukkit.event.CraftEventFactory; ++import org.bukkit.craftbukkit.inventory.CraftItemStack; ++import org.bukkit.event.player.PlayerBucketEntityEvent; ++// CraftBukkit end ++ + public interface Bucketable { + + boolean fromBucket(); +@@ -94,10 +102,22 @@ + ItemStack itemstack = entityhuman.getItemInHand(enumhand); + + if (itemstack.getItem() == Items.WATER_BUCKET && t0.isAlive()) { +- t0.playSound(((Bucketable) t0).getPickupSound(), 1.0F, 1.0F); ++ // CraftBukkit start ++ // t0.playSound(((Bucketable) t0).getPickupSound(), 1.0F, 1.0F); // CraftBukkit - moved down + ItemStack itemstack1 = ((Bucketable) t0).getBucketItemStack(); + + ((Bucketable) t0).saveToBucketTag(itemstack1); ++ ++ PlayerBucketEntityEvent playerBucketFishEvent = CraftEventFactory.callPlayerFishBucketEvent(t0, entityhuman, itemstack, itemstack1, enumhand); ++ itemstack1 = CraftItemStack.asNMSCopy(playerBucketFishEvent.getEntityBucket()); ++ if (playerBucketFishEvent.isCancelled()) { ++ ((EntityPlayer) entityhuman).containerMenu.sendAllDataToRemote(); // We need to update inventory to resync client's bucket ++ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutSpawnEntity(t0)); // We need to play out these packets as the client assumes the fish is gone ++ t0.getEntityData().refresh((EntityPlayer) entityhuman); // Need to send data such as the display name to client ++ return Optional.of(EnumInteractionResult.FAIL); ++ } ++ t0.playSound(((Bucketable) t0).getPickupSound(), 1.0F, 1.0F); ++ // CraftBukkit end + ItemStack itemstack2 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, itemstack1, false); + + entityhuman.setItemInHand(enumhand, itemstack2); |