aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/entity/animal/EntityCow.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/og/net/minecraft/world/entity/animal/EntityCow.patch')
-rw-r--r--patch-remap/og/net/minecraft/world/entity/animal/EntityCow.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/entity/animal/EntityCow.patch b/patch-remap/og/net/minecraft/world/entity/animal/EntityCow.patch
new file mode 100644
index 0000000000..c09b33ea87
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/entity/animal/EntityCow.patch
@@ -0,0 +1,33 @@
+--- a/net/minecraft/world/entity/animal/EntityCow.java
++++ b/net/minecraft/world/entity/animal/EntityCow.java
+@@ -33,6 +33,12 @@
+ import net.minecraft.world.level.block.state.IBlockData;
+ import org.joml.Vector3f;
+
++// CraftBukkit start
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++import org.bukkit.craftbukkit.inventory.CraftItemStack;
++import org.bukkit.event.player.PlayerBucketFillEvent;
++// CraftBukkit end
++
+ public class EntityCow extends EntityAnimal {
+
+ public EntityCow(EntityTypes<? extends EntityCow> entitytypes, World world) {
+@@ -85,8 +91,16 @@
+ ItemStack itemstack = entityhuman.getItemInHand(enumhand);
+
+ if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
++ // CraftBukkit start - Got milk?
++ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.level(), entityhuman, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, enumhand);
++
++ if (event.isCancelled()) {
++ return EnumInteractionResult.PASS;
++ }
++ // CraftBukkit end
++
+ entityhuman.playSound(SoundEffects.COW_MILK, 1.0F, 1.0F);
+- ItemStack itemstack1 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, Items.MILK_BUCKET.getDefaultInstance());
++ ItemStack itemstack1 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
+
+ entityhuman.setItemInHand(enumhand, itemstack1);
+ return EnumInteractionResult.sidedSuccess(this.level().isClientSide);