diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Bucketable.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Bucketable.java.patch | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Bucketable.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Bucketable.java.patch new file mode 100644 index 0000000000..7a07f25b49 --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/animal/Bucketable.java.patch @@ -0,0 +1,41 @@ +--- a/net/minecraft/world/entity/animal/Bucketable.java ++++ b/net/minecraft/world/entity/animal/Bucketable.java +@@ -14,6 +15,10 @@ + import net.minecraft.world.item.ItemUtils; + import net.minecraft.world.item.Items; + import net.minecraft.world.level.Level; ++import org.bukkit.craftbukkit.event.CraftEventFactory; ++import org.bukkit.craftbukkit.inventory.CraftItemStack; ++import org.bukkit.event.player.PlayerBucketEntityEvent; ++// CraftBukkit end + + public interface Bucketable { + +@@ -93,11 +98,23 @@ + static <T extends LivingEntity & Bucketable> Optional<InteractionResult> bucketMobPickup(Player player, InteractionHand interactionhand, T t0) { + ItemStack itemstack = player.getItemInHand(interactionhand); + +- if (itemstack.getItem() == Items.WATER_BUCKET && t0.isAlive()) { +- t0.playSound(((Bucketable) t0).getPickupSound(), 1.0F, 1.0F); +- ItemStack itemstack1 = ((Bucketable) t0).getBucketItemStack(); ++ if (itemstack.getItem() == Items.WATER_BUCKET && entity.isAlive()) { ++ // CraftBukkit start ++ // t0.playSound(((Bucketable) t0).getPickupSound(), 1.0F, 1.0F); // CraftBukkit - moved down ++ ItemStack itemstack1 = ((Bucketable) entity).getBucketItemStack(); + +- ((Bucketable) t0).saveToBucketTag(itemstack1); ++ ((Bucketable) entity).saveToBucketTag(itemstack1); ++ ++ PlayerBucketEntityEvent playerBucketFishEvent = CraftEventFactory.callPlayerFishBucketEvent(entity, player, itemstack, itemstack1, hand); ++ itemstack1 = CraftItemStack.asNMSCopy(playerBucketFishEvent.getEntityBucket()); ++ if (playerBucketFishEvent.isCancelled()) { ++ ((ServerPlayer) player).containerMenu.sendAllDataToRemote(); // We need to update inventory to resync client's bucket ++ ((ServerPlayer) player).connection.send(new ClientboundAddEntityPacket(entity)); // We need to play out these packets as the client assumes the fish is gone ++ entity.getEntityData().refresh((ServerPlayer) player); // Need to send data such as the display name to client ++ return Optional.of(InteractionResult.FAIL); ++ } ++ entity.playSound(((Bucketable) entity).getPickupSound(), 1.0F, 1.0F); ++ // CraftBukkit end + ItemStack itemstack2 = ItemUtils.createFilledResult(itemstack, player, itemstack1, false); + + player.setItemInHand(interactionhand, itemstack2); |