Fix missing spawndata.

This commit is contained in:
somehussar committed 2026-02-21 00:03:48 +01:00
1 parent cb57e26d04
commit c121d0c4e2
5 files changed
+137 -18

No files matched your search

@@ -68,6 +68,7 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.event.ServerChatEvent;
import noppes.npcs.CustomItems;
@@ -229,6 +230,9 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
public FlyingMoveHelper flyMoveHelper = new FlyingMoveHelper(this);
public PathNavigate flyNavigator = new PathNavigateFlying(this, worldObj);
@SideOnly(Side.CLIENT)
public int immediateSpawnDataFixAttempts = 0;
public EntityNPCInterface(World world) {
super(world);
try {
@@ -1829,10 +1833,17 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
try {
readSpawnData(ByteBufUtils.readNBT(buf));
} catch (IOException e) {
RequestProperSpawnData.reportMissingData(this);
}
}
public void readSpawnData(NBTTagCompound compound) {
if ((compound.hasNoTags() || !compound.hasKey("MaxHealth", Constants.NBT.TAG_DOUBLE))) {
RequestProperSpawnData.reportMissingData(this);
return;
}
immediateSpawnDataFixAttempts = 0;
stats.maxHealth = compound.getDouble("MaxHealth");
ais.setWalkingSpeed(compound.getInteger("Speed"));
stats.hideKilledBody = compound.getBoolean("DeadBody");