aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/entity/animal/Cow.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/animal/Cow.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/entity/animal/Cow.java.patch121
1 files changed, 121 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/animal/Cow.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/animal/Cow.java.patch
new file mode 100644
index 0000000000..3e9076107c
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/animal/Cow.java.patch
@@ -0,0 +1,121 @@
+--- a/net/minecraft/world/entity/animal/Cow.java
++++ b/net/minecraft/world/entity/animal/Cow.java
+@@ -5,15 +5,15 @@
+ import net.minecraft.server.level.ServerLevel;
+ import net.minecraft.sounds.SoundEvent;
+ import net.minecraft.sounds.SoundEvents;
+-import net.minecraft.world.InteractionHand;
++import net.minecraft.world.EnumHand;
+ import net.minecraft.world.InteractionResult;
+ import net.minecraft.world.damagesource.DamageSource;
+ import net.minecraft.world.entity.AgeableMob;
+ import net.minecraft.world.entity.Entity;
+ import net.minecraft.world.entity.EntityDimensions;
++import net.minecraft.world.entity.EntityPose;
+ import net.minecraft.world.entity.EntityType;
+ import net.minecraft.world.entity.Mob;
+-import net.minecraft.world.entity.Pose;
+ import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
+ import net.minecraft.world.entity.ai.attributes.Attributes;
+ import net.minecraft.world.entity.ai.goal.BreedGoal;
+@@ -30,10 +30,17 @@
+ import net.minecraft.world.item.Items;
+ import net.minecraft.world.item.crafting.Ingredient;
+ import net.minecraft.world.level.Level;
+-import net.minecraft.world.level.block.state.BlockState;
++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 Cow extends Animal {
++
+ public Cow(EntityType<? extends Cow> entityType, Level level) {
+ super(entityType, level);
+ }
+@@ -41,17 +48,17 @@
+ @Override
+ protected void registerGoals() {
+ this.goalSelector.addGoal(0, new FloatGoal(this));
+- this.goalSelector.addGoal(1, new PanicGoal(this, 2.0));
+- this.goalSelector.addGoal(2, new BreedGoal(this, 1.0));
+- this.goalSelector.addGoal(3, new TemptGoal(this, 1.25, Ingredient.of(Items.WHEAT), false));
+- this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25));
+- this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0));
++ this.goalSelector.addGoal(1, new PanicGoal(this, 2.0D));
++ this.goalSelector.addGoal(2, new BreedGoal(this, 1.0D));
++ this.goalSelector.addGoal(3, new TemptGoal(this, 1.25D, Ingredient.of(Items.WHEAT), false));
++ this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25D));
++ this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0D));
+ this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
+ this.goalSelector.addGoal(7, new RandomLookAroundGoal(this));
+ }
+
+ public static AttributeSupplier.Builder createAttributes() {
+- return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0).add(Attributes.MOVEMENT_SPEED, 0.2F);
++ return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.MOVEMENT_SPEED, 0.20000000298023224D);
+ }
+
+ @Override
+@@ -70,7 +77,7 @@
+ }
+
+ @Override
+- protected void playStepSound(BlockPos pos, BlockState block) {
++ protected void playStepSound(BlockPos pos, IBlockData block) {
+ this.playSound(SoundEvents.COW_STEP, 0.15F, 1.0F);
+ }
+
+@@ -80,12 +87,22 @@
+ }
+
+ @Override
+- public InteractionResult mobInteract(Player player, InteractionHand hand) {
+- ItemStack itemInHand = player.getItemInHand(hand);
+- if (itemInHand.is(Items.BUCKET) && !this.isBaby()) {
++ public InteractionResult mobInteract(Player player, EnumHand hand) {
++ ItemStack itemstack = player.getItemInHand(hand);
++
++ if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
++ // CraftBukkit start - Got milk?
++ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) player.level(), player, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, hand);
++
++ if (event.isCancelled()) {
++ return InteractionResult.PASS;
++ }
++ // CraftBukkit end
++
+ player.playSound(SoundEvents.COW_MILK, 1.0F, 1.0F);
+- ItemStack itemStack = ItemUtils.createFilledResult(itemInHand, player, Items.MILK_BUCKET.getDefaultInstance());
+- player.setItemInHand(hand, itemStack);
++ ItemStack itemstack1 = ItemUtils.createFilledResult(itemstack, player, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
++
++ player.setItemInHand(hand, itemstack1);
+ return InteractionResult.sidedSuccess(this.level().isClientSide);
+ } else {
+ return super.mobInteract(player, hand);
+@@ -95,16 +112,16 @@
+ @Nullable
+ @Override
+ public Cow getBreedOffspring(ServerLevel level, AgeableMob otherParent) {
+- return EntityType.COW.create(level);
++ return (Cow) EntityType.COW.create(level);
+ }
+
+ @Override
+- protected float getStandingEyeHeight(Pose pose, EntityDimensions size) {
++ protected float getStandingEyeHeight(EntityPose pose, EntityDimensions size) {
+ return this.isBaby() ? size.height * 0.95F : 1.3F;
+ }
+
+ @Override
+- protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entityDimensions, float f) {
+- return new Vector3f(0.0F, entityDimensions.height - 0.03125F * f, 0.0F);
++ protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitysize, float f) {
++ return new Vector3f(0.0F, entitysize.height - 0.03125F * f, 0.0F);
+ }
+ }