Implemented sub-GUI for editing NPC tags in the cloner

This commit is contained in:
Luis C.M committed 2023-04-12 14:22:22 -05:00
1 parent 8b0431340c
commit c27cdf7950
4 files changed
+156 -11

No files matched your search

@@ -763,13 +763,7 @@ public class PacketHandlerServer{
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
}
else if(type == EnumPacketServer.TagSet){
npc.advanced.tagUUIDs.removeIf(uuid -> TagController.getInstance().getTagFromUUID(uuid) != null);
NBTTagCompound compound = Server.readNBT(buffer);
NBTTagList list = compound.getTagList("TagNames",8);
for (int i = 0; i < list.tagCount(); i++) {
String tagName = list.getStringTagAt(i);
npc.advanced.tagUUIDs.add(((Tag)TagController.getInstance().getTagFromName(tagName)).uuid);
}
this.setTags(npc,buffer);
}
else if(type == EnumPacketServer.TagSave){
Tag tag = new Tag();
@@ -1095,8 +1089,23 @@ public class PacketHandlerServer{
compound.setTag("AllTags", validTagList);
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
}
else
warn(player,"WE 2 tried todo something with the wrong tool, probably a hacker");
else if (type == EnumPacketServer.TagSet) {
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
this.setTags(npc,buffer);
}
else if (type != EnumPacketServer.NpcTagsGet && type != EnumPacketServer.TagsGet) {
warn(player, "WE 2 tried todo something with the wrong tool, probably a hacker");
}
}
private void setTags(EntityNPCInterface npc, ByteBuf buffer) throws IOException {
npc.advanced.tagUUIDs.removeIf(uuid -> TagController.getInstance().getTagFromUUID(uuid) != null);
NBTTagCompound compound = Server.readNBT(buffer);
NBTTagList list = compound.getTagList("TagNames",8);
for (int i = 0; i < list.tagCount(); i++) {
String tagName = list.getStringTagAt(i);
npc.advanced.tagUUIDs.add(((Tag)TagController.getInstance().getTagFromName(tagName)).uuid);
}
}
private void warn(EntityPlayer player, String warning){