mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2025-04-09 05:14:34 +00:00
nms-patches
net
minecraft
advancements
commands
core
nbt
network
server
stats
util
world
damagesource
effect
entity
ai
ambient
animal
allay
armadillo
axolotl
camel
frog
goat
horse
sheep
sniffer
wolf
AbstractCow.patch
Bucketable.patch
EntityAnimal.patch
EntityBee.patch
EntityCat.patch
EntityChicken.patch
EntityDolphin.patch
EntityFox.patch
EntityIronGolem.patch
EntityMushroomCow.patch
EntityOcelot.patch
EntityPanda.patch
EntityParrot.patch
EntityPerchable.patch
EntityPig.patch
EntityPufferFish.patch
EntityRabbit.patch
EntitySnowman.patch
EntityTurtle.patch
boss
decoration
item
monster
npc
player
projectile
raid
vehicle
ConversionType.patch
Entity.patch
EntityAgeable.patch
EntityAreaEffectCloud.patch
EntityCreature.patch
EntityExperienceOrb.patch
EntityInsentient.patch
EntityLightning.patch
EntityLiving.patch
EntityTameableAnimal.patch
EntityTypes.patch
IEntityAngerable.patch
IEntitySelector.patch
Interaction.patch
Leashable.patch
SaddleStorage.patch
food
inventory
item
level
IInventory.patch
InventoryLargeChest.patch
InventorySubcontainer.patch
CrashReport.patch
src
.gitignore
CONTRIBUTING.md
LGPL.txt
LICENCE.txt
README.md
applyPatches.sh
checkstyle.xml
makePatches.sh
pom.xml
34 lines
1.6 KiB
Diff
34 lines
1.6 KiB
Diff
--- a/net/minecraft/world/entity/animal/AbstractCow.java
|
|
+++ b/net/minecraft/world/entity/animal/AbstractCow.java
|
|
@@ -27,6 +27,12 @@
|
|
import net.minecraft.world.level.World;
|
|
import net.minecraft.world.level.block.state.IBlockData;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|
+import org.bukkit.event.player.PlayerBucketFillEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public abstract class AbstractCow extends EntityAnimal {
|
|
|
|
private static final EntitySize BABY_DIMENSIONS = EntityTypes.COW.getDimensions().scale(0.5F).withEyeHeight(0.665F);
|
|
@@ -88,8 +94,16 @@
|
|
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
|
|
|
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
|
|
+ // CraftBukkit start - Got milk?
|
|
+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(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.SUCCESS;
|