2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/EntityCow.java
|
|
|
|
+++ b/net/minecraft/server/EntityCow.java
|
2019-04-23 04:00:00 +02:00
|
|
|
@@ -1,5 +1,10 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|
|
|
+// CraftBukkit end
|
2019-04-23 04:00:00 +02:00
|
|
|
+
|
2014-11-25 22:32:16 +01:00
|
|
|
public class EntityCow extends EntityAnimal {
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
public EntityCow(EntityTypes<? extends EntityCow> entitytypes, World world) {
|
2020-06-25 02:00:00 +02:00
|
|
|
@@ -52,8 +57,16 @@
|
2016-11-17 02:41:03 +01:00
|
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2020-06-25 02:00:00 +02:00
|
|
|
if (itemstack.getItem() == Items.BUCKET && !this.isBaby()) {
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start - Got milk?
|
2020-06-25 02:00:00 +02:00
|
|
|
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET);
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
|
|
|
+ if (event.isCancelled()) {
|
2020-06-25 02:00:00 +02:00
|
|
|
+ return EnumInteractionResult.PASS;
|
2014-11-25 22:32:16 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2020-06-25 02:00:00 +02:00
|
|
|
+
|
|
|
|
entityhuman.playSound(SoundEffects.ENTITY_COW_MILK, 1.0F, 1.0F);
|
|
|
|
- ItemStack itemstack1 = ItemLiquidUtil.a(itemstack, entityhuman, Items.MILK_BUCKET.r());
|
|
|
|
+ ItemStack itemstack1 = ItemLiquidUtil.a(itemstack, entityhuman, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2020-06-25 02:00:00 +02:00
|
|
|
entityhuman.a(enumhand, itemstack1);
|
|
|
|
return EnumInteractionResult.a(this.world.isClientSide);
|