Small fixes to rabid wolves patch

This commit is contained in:
BillyGalbreath
2020-12-09 19:45:36 -06:00
parent 59439785d9
commit b4be9ab44e

View File

@@ -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/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java
index 6c25f667ee..7149b10e4a 100644
index 6c25f667ee..adbc3ec480 100644
--- a/src/main/java/net/minecraft/server/EntityWolf.java
+++ b/src/main/java/net/minecraft/server/EntityWolf.java
@@ -14,11 +14,17 @@ public class EntityWolf extends EntityTameableAnimal implements IEntityAngerable
@@ -22,7 +22,7 @@ index 6c25f667ee..7149b10e4a 100644
};
+ // Purpur start - rabid wolf spawn chance
+ private boolean isRabid = false;
+ private static final Predicate<EntityLiving> RABID_PREDICATE = e -> e instanceof EntityPlayer || e instanceof EntityInsentient;
+ private static final Predicate<EntityLiving> RABID_PREDICATE = e -> e instanceof EntityPlayer || (e instanceof EntityInsentient && e.getEntityType() != EntityTypes.WOLF);
+ private final PathfinderGoal PATHFINDER_VANILLA = new PathfinderGoalRandomTargetNonTamed<>(this, EntityAnimal.class, false, vanillaPredicate());
+ private final PathfinderGoal PATHFINDER_RABID = new PathfinderGoalRandomTargetNonTamed<>(this, EntityLiving.class, false, RABID_PREDICATE);
+ // Purpur end
@@ -80,15 +80,11 @@ index 6c25f667ee..7149b10e4a 100644
this.c(nbttagcompound);
}
@@ -128,6 +162,11 @@ public class EntityWolf extends EntityTameableAnimal implements IEntityAngerable
@@ -128,6 +162,7 @@ public class EntityWolf extends EntityTameableAnimal implements IEntityAngerable
if (nbttagcompound.hasKeyOfType("CollarColor", 99)) {
this.setCollarColor(EnumColor.fromColorIndex(nbttagcompound.getInt("CollarColor")));
}
+ // Purpur start - rabid wolf spawn chance
+ if (nbttagcompound.hasKeyOfType("Purpur.IsRabid", 99)) {
+ setRabid(nbttagcompound.getBoolean("Purpur.IsRabid"));
+ }
+ // Purpur end
+ setRabid(nbttagcompound.getBoolean("Purpur.IsRabid")); // Purpur end
this.a((WorldServer) this.world, nbttagcompound);
}