mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-28 05:35:38 +00:00
Request Client Packet Fix NPC [Invisibility Patch]
This commit is contained in:
1 parent
0f00bd6ba3
commit
ec60a9bb21
6 files changed
+153
-142
No files matched your search
@@ -10,6 +10,7 @@ import kamkeel.npcs.client.renderer.lightning.LightningBolt;
|
||||
import kamkeel.npcs.controllers.data.energycharge.EnergyChargePreviewManager;
|
||||
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;
|
||||
@@ -61,7 +62,7 @@ public class ClientTickHandler {
|
||||
if (mc.theWorld == null) {
|
||||
ClientCacheHandler.clearCache();
|
||||
ClientAbilityState.reset();
|
||||
// RequestProperSpawnData.clear();
|
||||
RequestProperSpawnData.clear();
|
||||
if (EnergyChargePreviewManager.ClientInstance != null) {
|
||||
EnergyChargePreviewManager.ClientInstance.clear();
|
||||
}
|
||||
@@ -216,8 +217,8 @@ public class ClientTickHandler {
|
||||
return;
|
||||
|
||||
if (mc.theWorld.getTotalWorldTime() % 20 == 0) { // Update every second
|
||||
// if (RequestProperSpawnData.canDoBatchUpdate())
|
||||
// RequestProperSpawnData.handleBacklog();
|
||||
if (RequestProperSpawnData.canDoBatchUpdate())
|
||||
RequestProperSpawnData.handleBacklog();
|
||||
updateCompassMarks();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.enums.EnumSoundOperation;
|
||||
import kamkeel.npcs.network.packets.data.ChatBubblePacket;
|
||||
import kamkeel.npcs.network.packets.data.QuestCompletionPacket;
|
||||
import kamkeel.npcs.network.packets.data.RequestProperSpawnData;
|
||||
import kamkeel.npcs.network.packets.data.SoundManagementPacket;
|
||||
import kamkeel.npcs.network.packets.data.npc.UpdateNpcPacket;
|
||||
import kamkeel.npcs.network.packets.data.npc.WeaponNpcPacket;
|
||||
@@ -230,8 +231,8 @@ 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;
|
||||
// For Client-Side Use Only
|
||||
public int clientFixAttempts = 0;
|
||||
|
||||
public EntityNPCInterface(World world) {
|
||||
super(world);
|
||||
@@ -1836,20 +1837,18 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
try {
|
||||
readSpawnData(ByteBufUtils.readNBT(buf));
|
||||
} catch (IOException e) {
|
||||
// if (this.worldObj != null && this.worldObj.isRemote) {
|
||||
// RequestProperSpawnData.reportMissingData(this);
|
||||
// }
|
||||
if (this.worldObj != null && this.worldObj.isRemote) {
|
||||
RequestProperSpawnData.reportMissingData(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void readSpawnData(NBTTagCompound compound) {
|
||||
// if (this.worldObj != null && this.worldObj.isRemote &&
|
||||
// (compound.hasNoTags() || !compound.hasKey("MaxHealth", Constants.NBT.TAG_DOUBLE))) {
|
||||
// RequestProperSpawnData.reportMissingData(this);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// immediateSpawnDataFixAttempts = 0;
|
||||
if (this.worldObj != null && this.worldObj.isRemote) {
|
||||
if(requestClientFix(compound))
|
||||
return;
|
||||
}
|
||||
|
||||
stats.maxHealth = compound.getDouble("MaxHealth");
|
||||
ais.setWalkingSpeed(compound.getInteger("Speed"));
|
||||
stats.hideKilledBody = compound.getBoolean("DeadBody");
|
||||
@@ -1927,6 +1926,15 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
}
|
||||
}
|
||||
|
||||
public boolean requestClientFix(NBTTagCompound compound){
|
||||
if((compound.hasNoTags() || !compound.hasKey("MaxHealth", Constants.NBT.TAG_DOUBLE))){
|
||||
RequestProperSpawnData.reportMissingData(this);
|
||||
return true;
|
||||
}
|
||||
clientFixAttempts = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canBreatheUnderwater() {
|
||||
return stats.drowningType != 1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user