configurable damage for aggressive cows (#643)

Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
This commit is contained in:
Oharass
2021-09-04 21:09:29 -05:00
committed by GitHub
parent 4e400de498
commit b6d1b6af37
2 changed files with 17 additions and 9 deletions

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Cows naturally aggressive to players chance
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cow.java b/src/main/java/net/minecraft/world/entity/animal/Cow.java
index c718697a9511ccf761467644967397b777446db9..6855c409f1c793ec436f447838008853b9b249d2 100644
index c718697a9511ccf761467644967397b777446db9..66ecd29cc52483e0a79ec6c9c5dbf071501825d5 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Cow.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Cow.java
@@ -37,6 +37,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
@@ -20,7 +20,7 @@ index c718697a9511ccf761467644967397b777446db9..6855c409f1c793ec436f447838008853
@Override
public void initAttributes() {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.cowMaxHealth);
+ this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(2.0D); // Purpur
+ this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(this.level.purpurConfig.cowNaturallyAggressiveToPlayersDamage); // Purpur
}
@Override
@@ -58,22 +58,30 @@ index c718697a9511ccf761467644967397b777446db9..6855c409f1c793ec436f447838008853
@Override
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index ed03ed6a594c2b06f1f5db7cc0c2b537e7aece76..99304124b8055a6d15375922b2b47c2bfd45383c 100644
index ed03ed6a594c2b06f1f5db7cc0c2b537e7aece76..467cc1e7166875c929b4d39f7ed3d7c2f12991e6 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -1151,6 +1151,7 @@ public class PurpurWorldConfig {
@@ -1151,7 +1151,14 @@ public class PurpurWorldConfig {
public double cowMaxHealth = 10.0D;
public int cowFeedMushrooms = 0;
public int cowBreedingTicks = 6000;
+ public double cowNaturallyAggressiveToPlayersChance = 0.0D;
+ public double cowNaturallyAggressiveToPlayersDamage = 2.0D;
private void cowSettings() {
+ if (PurpurConfig.version < 22) {
+ double oldValue = getDouble("mobs.cow.naturally-aggressive-to-players-chance", cowNaturallyAggressiveToPlayersChance);
+ set("mobs.cow.naturally-aggressive-to-players-chance", null);
+ set("mobs.cow.naturally-aggressive-to-players.chance", oldValue);
+ }
cowRidable = getBoolean("mobs.cow.ridable", cowRidable);
cowRidableInWater = getBoolean("mobs.cow.ridable-in-water", cowRidableInWater);
@@ -1162,6 +1163,7 @@ public class PurpurWorldConfig {
if (PurpurConfig.version < 10) {
@@ -1162,6 +1169,8 @@ public class PurpurWorldConfig {
cowMaxHealth = getDouble("mobs.cow.attributes.max_health", cowMaxHealth);
cowFeedMushrooms = getInt("mobs.cow.feed-mushrooms-for-mooshroom", cowFeedMushrooms);
cowBreedingTicks = getInt("mobs.cow.breeding-delay-ticks", cowBreedingTicks);
+ cowNaturallyAggressiveToPlayersChance = getDouble("mobs.cow.naturally-aggressive-to-players-chance", cowNaturallyAggressiveToPlayersChance);
+ cowNaturallyAggressiveToPlayersChance = getDouble("mobs.cow.naturally-aggressive-to-players.chance", cowNaturallyAggressiveToPlayersChance);
+ cowNaturallyAggressiveToPlayersDamage = getDouble("mobs.cow.naturally-aggressive-to-players.damage", cowNaturallyAggressiveToPlayersDamage);
}
public boolean creeperRidable = false;