SPIGOT-5282: Improve bucket event API

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2019-08-23 20:30:16 +10:00
parent b0f23cdec1
commit 7b8436f8e2
3 changed files with 22 additions and 24 deletions

View File

@@ -11,13 +11,12 @@
public class EntityCow extends EntityAnimal {
public EntityCow(EntityTypes<? extends EntityCow> entitytypes, World world) {
@@ -55,13 +60,23 @@
@@ -55,13 +60,22 @@
ItemStack itemstack = entityhuman.b(enumhand);
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
+ // CraftBukkit start - Got milk?
+ org.bukkit.Location loc = this.getBukkitEntity().getLocation();
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), null, itemstack, Items.MILK_BUCKET);
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET);
+
+ if (event.isCancelled()) {
+ return false;