[ci skip] inline fqn imports

This commit is contained in:
granny
2024-06-10 01:48:25 -07:00
parent eac419810e
commit 72192634b0
24 changed files with 151 additions and 285 deletions

View File

@@ -7,19 +7,10 @@ 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 2267f8da1c27ff54b2ced59ef15eb45357b7075d..74ed226b5037f3258106f07384e14baf087be1c3 100644
index 2267f8da1c27ff54b2ced59ef15eb45357b7075d..073014d44a3ccfca9bb5a387843e22917de13bb4 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
@@ -30,6 +30,8 @@ import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
+import net.minecraft.world.effect.MobEffectInstance;
+import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.AgeableMob;
import net.minecraft.world.entity.Crackiness;
import net.minecraft.world.entity.Entity;
@@ -104,6 +106,37 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
@@ -104,6 +104,37 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
return entitytypes == EntityType.SHEEP || entitytypes == EntityType.RABBIT || entitytypes == EntityType.FOX;
};
@@ -57,7 +48,7 @@ index 2267f8da1c27ff54b2ced59ef15eb45357b7075d..74ed226b5037f3258106f07384e14baf
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;
@@ -156,6 +189,30 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
@@ -156,6 +187,30 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
return this.level().purpurConfig.wolfBreedingTicks;
}
@@ -77,18 +68,18 @@ index 2267f8da1c27ff54b2ced59ef15eb45357b7075d..74ed226b5037f3258106f07384e14baf
+ setOwnerUUID(null);
+ setTame(false, true);
+ this.targetSelector.addGoal(5, PATHFINDER_RABID);
+ if (modifyEffects) this.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 1200));
+ if (modifyEffects) this.addEffect(new net.minecraft.world.effect.MobEffectInstance(net.minecraft.world.effect.MobEffects.CONFUSION, 1200));
+ } else {
+ this.targetSelector.addGoal(5, PATHFINDER_VANILLA);
+ this.stopBeingAngry();
+ if (modifyEffects) this.removeEffect(MobEffects.CONFUSION);
+ if (modifyEffects) this.removeEffect(net.minecraft.world.effect.MobEffects.CONFUSION);
+ }
+ }
+
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new FloatGoal(this));
@@ -163,6 +220,7 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
@@ -163,6 +218,7 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
this.goalSelector.addGoal(1, new Wolf.WolfPanicGoal(this, 1.5D));
this.goalSelector.addGoal(2, new SitWhenOrderedToGoal(this));
this.goalSelector.addGoal(3, new Wolf.WolfAvoidEntityGoal<>(this, Llama.class, 24.0F, 1.5D, 1.5D));
@@ -96,7 +87,7 @@ index 2267f8da1c27ff54b2ced59ef15eb45357b7075d..74ed226b5037f3258106f07384e14baf
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, false));
@@ -176,7 +234,7 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
@@ -176,7 +232,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));
@@ -105,7 +96,7 @@ index 2267f8da1c27ff54b2ced59ef15eb45357b7075d..74ed226b5037f3258106f07384e14baf
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));
@@ -219,6 +277,7 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
@@ -219,6 +275,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());
@@ -113,7 +104,7 @@ index 2267f8da1c27ff54b2ced59ef15eb45357b7075d..74ed226b5037f3258106f07384e14baf
nbt.putString("variant", ((ResourceKey) this.getVariant().unwrapKey().orElse(WolfVariants.PALE)).location().toString());
this.addPersistentAngerSaveData(nbt);
}
@@ -234,6 +293,10 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
@@ -234,6 +291,10 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
if (nbt.contains("CollarColor", 99)) {
this.setCollarColor(DyeColor.byId(nbt.getInt("CollarColor")));
}
@@ -124,7 +115,7 @@ index 2267f8da1c27ff54b2ced59ef15eb45357b7075d..74ed226b5037f3258106f07384e14baf
this.readPersistentAngerSaveData(this.level(), nbt);
}
@@ -252,6 +315,12 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
@@ -252,6 +313,12 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
}
this.setVariant(holder1);
@@ -137,19 +128,19 @@ index 2267f8da1c27ff54b2ced59ef15eb45357b7075d..74ed226b5037f3258106f07384e14baf
return super.finalizeSpawn(world, difficulty, spawnReason, (SpawnGroupData) entityData);
}
@@ -295,6 +364,11 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
@@ -295,6 +362,11 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
public void tick() {
super.tick();
if (this.isAlive()) {
+ // Purpur start
+ if (this.age % 300 == 0 && this.isRabid()) {
+ this.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 400));
+ this.addEffect(new net.minecraft.world.effect.MobEffectInstance(net.minecraft.world.effect.MobEffects.CONFUSION, 400));
+ }
+ // Purpur end
this.interestedAngleO = this.interestedAngle;
if (this.isInterested()) {
this.interestedAngle += (1.0F - this.interestedAngle) * 0.4F;
@@ -541,6 +615,19 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
@@ -541,6 +613,19 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
itemstack.consume(1, player);
this.tryToTame(player);
return InteractionResult.SUCCESS;
@@ -191,7 +182,7 @@ 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 d621f330f954a12635d8c87c5ff66dae7448a856..fc0a733df7f0e851681bed1b22bfa6836812272a 100644
index 5dfc4f4144feab63ca2244e2e4a20af9fbd8ef02..89cc7b46a2dd15afd7db711f2e01fa8c7035a5bd 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1938,6 +1938,8 @@ public class PurpurWorldConfig {