mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 18:37:42 +01:00
configurable mob size attribute (#1538)
This commit is contained in:
@@ -7,7 +7,7 @@ Configurable chance to spawn a wolf that is rabid.
|
||||
Rabid wolves attack all players, mobs, and animals.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
index e3c0163a4b00dca01b97c41aa57aa998063ec491..04d7e4bc6cc1deda5f53f6ae5f46d2402e0d0c10 100644
|
||||
index da375fb6907e0c46ed176bc76a84f2666227547c..0a3b883ffe3627c5ab7c763f4ecaef4f70e1e144 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
@@ -106,6 +106,37 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
@@ -48,7 +48,7 @@ index e3c0163a4b00dca01b97c41aa57aa998063ec491..04d7e4bc6cc1deda5f53f6ae5f46d240
|
||||
private static final float START_HEALTH = 8.0F;
|
||||
private static final float TAME_HEALTH = 40.0F;
|
||||
private static final float ARMOR_REPAIR_UNIT = 0.125F;
|
||||
@@ -158,6 +189,30 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
@@ -159,6 +190,30 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
return this.level().purpurConfig.wolfBreedingTicks;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ index e3c0163a4b00dca01b97c41aa57aa998063ec491..04d7e4bc6cc1deda5f53f6ae5f46d240
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(1, new FloatGoal(this));
|
||||
@@ -165,6 +220,7 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
@@ -166,6 +221,7 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
this.goalSelector.addGoal(1, new TamableAnimal.TamableAnimalPanicGoal(1.5D, DamageTypeTags.PANIC_ENVIRONMENTAL_CAUSES));
|
||||
this.goalSelector.addGoal(2, new SitWhenOrderedToGoal(this));
|
||||
this.goalSelector.addGoal(3, new Wolf.WolfAvoidEntityGoal<>(this, Llama.class, 24.0F, 1.5D, 1.5D));
|
||||
@@ -87,7 +87,7 @@ index e3c0163a4b00dca01b97c41aa57aa998063ec491..04d7e4bc6cc1deda5f53f6ae5f46d240
|
||||
this.goalSelector.addGoal(4, new LeapAtTargetGoal(this, 0.4F));
|
||||
this.goalSelector.addGoal(5, new MeleeAttackGoal(this, 1.0D, true));
|
||||
this.goalSelector.addGoal(6, new FollowOwnerGoal(this, 1.0D, 10.0F, 2.0F));
|
||||
@@ -178,7 +234,7 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
@@ -179,7 +235,7 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
this.targetSelector.addGoal(2, new OwnerHurtTargetGoal(this));
|
||||
this.targetSelector.addGoal(3, (new HurtByTargetGoal(this, new Class[0])).setAlertOthers());
|
||||
this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt));
|
||||
@@ -96,7 +96,7 @@ index e3c0163a4b00dca01b97c41aa57aa998063ec491..04d7e4bc6cc1deda5f53f6ae5f46d240
|
||||
this.targetSelector.addGoal(6, new NonTameRandomTargetGoal<>(this, Turtle.class, false, Turtle.BABY_ON_LAND_SELECTOR));
|
||||
this.targetSelector.addGoal(7, new NearestAttackableTargetGoal<>(this, AbstractSkeleton.class, false));
|
||||
this.targetSelector.addGoal(8, new ResetUniversalAngerTargetGoal<>(this, true));
|
||||
@@ -227,6 +283,7 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
@@ -228,6 +284,7 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
public void addAdditionalSaveData(CompoundTag nbt) {
|
||||
super.addAdditionalSaveData(nbt);
|
||||
nbt.putByte("CollarColor", (byte) this.getCollarColor().getId());
|
||||
@@ -104,7 +104,7 @@ index e3c0163a4b00dca01b97c41aa57aa998063ec491..04d7e4bc6cc1deda5f53f6ae5f46d240
|
||||
this.getVariant().unwrapKey().ifPresent((resourcekey) -> {
|
||||
nbt.putString("variant", resourcekey.location().toString());
|
||||
});
|
||||
@@ -244,6 +301,10 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
@@ -245,6 +302,10 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
if (nbt.contains("CollarColor", 99)) {
|
||||
this.setCollarColor(DyeColor.byId(nbt.getInt("CollarColor")));
|
||||
}
|
||||
@@ -115,7 +115,7 @@ index e3c0163a4b00dca01b97c41aa57aa998063ec491..04d7e4bc6cc1deda5f53f6ae5f46d240
|
||||
|
||||
this.readPersistentAngerSaveData(this.level(), nbt);
|
||||
}
|
||||
@@ -262,6 +323,12 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
@@ -263,6 +324,12 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
}
|
||||
|
||||
this.setVariant(holder1);
|
||||
@@ -128,7 +128,7 @@ index e3c0163a4b00dca01b97c41aa57aa998063ec491..04d7e4bc6cc1deda5f53f6ae5f46d240
|
||||
return super.finalizeSpawn(world, difficulty, spawnReason, (SpawnGroupData) entityData);
|
||||
}
|
||||
|
||||
@@ -305,6 +372,11 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
@@ -306,6 +373,11 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (this.isAlive()) {
|
||||
@@ -140,7 +140,7 @@ index e3c0163a4b00dca01b97c41aa57aa998063ec491..04d7e4bc6cc1deda5f53f6ae5f46d240
|
||||
this.interestedAngleO = this.interestedAngle;
|
||||
if (this.isInterested()) {
|
||||
this.interestedAngle += (1.0F - this.interestedAngle) * 0.4F;
|
||||
@@ -545,6 +617,19 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
@@ -546,6 +618,19 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
itemstack.consume(1, player);
|
||||
this.tryToTame(player);
|
||||
return InteractionResult.SUCCESS;
|
||||
@@ -182,22 +182,22 @@ index 86574da257731de7646a712ed73384955fe35aa3..e223234dd64b0e41441c3b9f649f0b64
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index c9d6c2cdc603c2b24c5afb9fbf741c35cf72a175..209201b2789af1326616b52ffb14d64b253ebac9 100644
|
||||
index c2a42bd6b2347c559048cb0f718920c9ff0ea142..1d64122cda959967d60294cb69be2854f7f9d5bd 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1956,6 +1956,8 @@ public class PurpurWorldConfig {
|
||||
public boolean wolfRidableInWater = true;
|
||||
@@ -2082,6 +2082,8 @@ public class PurpurWorldConfig {
|
||||
public boolean wolfControllable = true;
|
||||
public double wolfMaxHealth = 8.0D;
|
||||
public double wolfScale = 1.0D;
|
||||
+ public boolean wolfMilkCuresRabies = true;
|
||||
+ public double wolfNaturalRabid = 0.0D;
|
||||
public int wolfBreedingTicks = 6000;
|
||||
private void wolfSettings() {
|
||||
wolfRidable = getBoolean("mobs.wolf.ridable", wolfRidable);
|
||||
@@ -1967,6 +1969,8 @@ public class PurpurWorldConfig {
|
||||
set("mobs.wolf.attributes.max_health", oldValue);
|
||||
@@ -2094,6 +2096,8 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
wolfMaxHealth = getDouble("mobs.wolf.attributes.max_health", wolfMaxHealth);
|
||||
wolfScale = Mth.clamp(getDouble("mobs.wolf.attributes.scale", wolfScale), 0.0625D, 16.0D);
|
||||
+ wolfMilkCuresRabies = getBoolean("mobs.wolf.milk-cures-rabid-wolves", wolfMilkCuresRabies);
|
||||
+ wolfNaturalRabid = getDouble("mobs.wolf.spawn-rabid-chance", wolfNaturalRabid);
|
||||
wolfBreedingTicks = getInt("mobs.wolf.breeding-delay-ticks", wolfBreedingTicks);
|
||||
|
||||
Reference in New Issue
Block a user