Fixed NBT issue with player overlays.

This commit is contained in:
Luis C.M committed 2022-05-24 00:11:34 -05:00
1 parent b6c62332ed
commit 82938fe5cd
4 files changed
+7 -12

No files matched your search

@@ -148,7 +148,7 @@ public class PacketHandlerServer{
public void updateSkinOverlays(EntityPlayerMP player) {
NBTTagCompound data = new NBTTagCompound();
data.setTag("SkinOverlayData",player.getEntityData().getTagList("SkinOverlayData",10));
Server.sendData(player, EnumPacketClient.PLAYER_UPDATE_SKIN_OVERLAYS, data);
Server.sendToAll(EnumPacketClient.PLAYER_UPDATE_SKIN_OVERLAYS, player.getEntityId(), data);
}
private void getScriptsEnabled(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException {
@@ -432,16 +432,6 @@ public class ScriptPlayerEventHandler {
PlayerDataScript handler = ScriptController.Instance.playerScripts;
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(event.player);
EventHooks.onPlayerLogin(handler, scriptPlayer);
//Loads other players' and own player's skin overlays if they have them
/*
List<EntityPlayerMP> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
for (EntityPlayerMP playerMP : list) {
if (playerMP.getEntityData().hasKey("SkinOverlayData")) {
NBTTagCompound data = new NBTTagCompound();
data.setTag("SkinOverlayData",playerMP.getEntityData().getTagList("SkinOverlayData",10));
}
}*/
}
}
@@ -274,7 +274,9 @@ public class PacketHandlerClient extends PacketHandlerServer{
Minecraft.getMinecraft().thePlayer.swingItem();
}
else if(type == EnumPacketClient.PLAYER_UPDATE_SKIN_OVERLAYS) {
NoppesUtil.updateSkinOverlayData(player, Server.readNBT(buffer));
EntityPlayer sendingPlayer = (EntityPlayer) Minecraft.getMinecraft().theWorld.getEntityByID(buffer.readInt());
NBTTagCompound compound = Server.readNBT(buffer);
NoppesUtil.updateSkinOverlayData(sendingPlayer, compound);
}
}
}
@@ -2,6 +2,8 @@ package noppes.npcs.entity.data;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.Server;
import noppes.npcs.constants.EnumPacketClient;
import noppes.npcs.controllers.PlayerData;
import noppes.npcs.controllers.data.SkinOverlay;
import noppes.npcs.entity.EntityNPCInterface;
@@ -49,6 +51,7 @@ public class DataSkinOverlays implements IOverlayHandler {
if (parent instanceof PlayerData) {
NBTTagCompound compound = this.writeToNBT(new NBTTagCompound());
((PlayerData) parent).player.getEntityData().setTag("SkinOverlayData", compound.getTagList("SkinOverlayData",10));
Server.sendToAll(EnumPacketClient.PLAYER_UPDATE_SKIN_OVERLAYS, ((PlayerData) parent).player.getEntityId(), compound);
} else if (parent instanceof EntityNPCInterface) {
((EntityNPCInterface) parent).updateClient = true;
}