mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 10:57:43 +01:00
Add config for feeding mushrooms to cows
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
From 617301a9f118aaff29e08b3a0461423bafda464f Mon Sep 17 00:00:00 2001
|
||||
From 9266c5c4a2632b05a03ea9e3e2a5052c1f5dc170 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 4 May 2019 01:10:30 -0500
|
||||
Subject: [PATCH] cows to mooshroom when fed mushrooms
|
||||
|
||||
---
|
||||
.../java/net/minecraft/server/Entity.java | 1 +
|
||||
.../java/net/minecraft/server/EntityCow.java | 75 ++++++++++++++++++-
|
||||
2 files changed, 75 insertions(+), 1 deletion(-)
|
||||
.../java/net/minecraft/server/EntityCow.java | 76 ++++++++++++++++++-
|
||||
.../java/net/pl3x/purpur/PurpurConfig.java | 5 ++
|
||||
3 files changed, 81 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index d02e48a86..ab0995c2c 100644
|
||||
index 3b1555dd2..74f00b376 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -995,6 +995,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
@@ -21,10 +22,14 @@ index d02e48a86..ab0995c2c 100644
|
||||
if (!this.isSilent()) {
|
||||
this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, soundeffect, this.getSoundCategory(), f, f1);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java
|
||||
index d2c2e3cc3..3cb35c422 100644
|
||||
index d2c2e3cc3..f053ff0e5 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityCow.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityCow.java
|
||||
@@ -4,6 +4,10 @@ package net.minecraft.server;
|
||||
@@ -1,9 +1,14 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
+import net.pl3x.purpur.PurpurConfig;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
// CraftBukkit end
|
||||
@@ -35,7 +40,7 @@ index d2c2e3cc3..3cb35c422 100644
|
||||
|
||||
public class EntityCow extends EntityAnimal {
|
||||
|
||||
@@ -16,7 +20,7 @@ public class EntityCow extends EntityAnimal {
|
||||
@@ -16,7 +21,7 @@ public class EntityCow extends EntityAnimal {
|
||||
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
||||
this.goalSelector.a(1, new PathfinderGoalPanic(this, 2.0D));
|
||||
this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D));
|
||||
@@ -44,7 +49,7 @@ index d2c2e3cc3..3cb35c422 100644
|
||||
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 1.25D));
|
||||
this.goalSelector.a(5, new PathfinderGoalRandomStrollLand(this, 1.0D));
|
||||
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
|
||||
@@ -79,11 +83,80 @@ public class EntityCow extends EntityAnimal {
|
||||
@@ -79,11 +84,80 @@ public class EntityCow extends EntityAnimal {
|
||||
// CraftBukkit end
|
||||
|
||||
return true;
|
||||
@@ -76,7 +81,7 @@ index d2c2e3cc3..3cb35c422 100644
|
||||
+ private boolean feedMushroom(EntityHuman entityhuman, ItemStack itemstack) {
|
||||
+ world.broadcastEntityEffect(this, (byte) 18); // hearts
|
||||
+ playSound(SoundEffects.ENTITY_COW_MILK, 1.0F, 1.0F);
|
||||
+ if (incrementFeedCount(itemstack) < 5) {
|
||||
+ if (incrementFeedCount(itemstack) < PurpurConfig.feedMushroomsToCows) {
|
||||
+ if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
+ itemstack.subtract(1);
|
||||
+ }
|
||||
@@ -125,6 +130,20 @@ index d2c2e3cc3..3cb35c422 100644
|
||||
@Override
|
||||
public EntityCow createChild(EntityAgeable entityageable) {
|
||||
return (EntityCow) EntityTypes.COW.a(this.world);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index e91bd0a36..88835089c 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -102,4 +102,9 @@ public class PurpurConfig {
|
||||
config.addDefault(path, def);
|
||||
return config.getString(path, config.getString(path));
|
||||
}
|
||||
+
|
||||
+ public static int feedMushroomsToCows = 5;
|
||||
+ private static void cowsSettings() {
|
||||
+ feedMushroomsToCows = getInt("settings.mobs.cow.feed-mushrooms-for-mooshroom", feedMushroomsToCows);
|
||||
+ }
|
||||
}
|
||||
--
|
||||
2.20.1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user