mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 10:49:47 +00:00
Fix missing spawndata.
This commit is contained in:
1 parent
cb57e26d04
commit
c121d0c4e2
5 files changed
+137
-18
No files matched your search
@@ -9,6 +9,7 @@ import kamkeel.npcs.client.renderer.lightning.LightningBolt;
|
||||
import kamkeel.npcs.controllers.AbilityController;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphManager;
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.data.RequestProperSpawnData;
|
||||
import kamkeel.npcs.network.packets.player.CheckPlayerValue;
|
||||
import kamkeel.npcs.network.packets.player.InputDevicePacket;
|
||||
import kamkeel.npcs.network.packets.player.ScreenSizePacket;
|
||||
@@ -59,6 +60,7 @@ public class ClientTickHandler {
|
||||
if (mc.theWorld == null) {
|
||||
ClientCacheHandler.clearCache();
|
||||
ClientAbilityState.reset();
|
||||
RequestProperSpawnData.clear();
|
||||
}
|
||||
this.prevWorld = mc.theWorld;
|
||||
}
|
||||
@@ -199,6 +201,8 @@ public class ClientTickHandler {
|
||||
return;
|
||||
|
||||
if (mc.theWorld.getTotalWorldTime() % 20 == 0) { // Update every second
|
||||
if (RequestProperSpawnData.canDoBatchUpdate())
|
||||
RequestProperSpawnData.handleBacklog();
|
||||
updateCompassMarks();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user