mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 09:34:46 +00:00
Implemented sub-GUI for editing NPC tags in the cloner
This commit is contained in:
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){
|
||||
|
||||
Reference in new issue
Block a user