mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 06:07:27 +00:00
39 lines
1.0 KiB
Java
39 lines
1.0 KiB
Java
package noppes.npcs.controllers;
|
|||
|
|
|
||
|
|
import java.util.HashSet;
|
||
|
|
|
||
|
|
import net.minecraft.nbt.NBTTagCompound;
|
||
|
|
import net.minecraft.nbt.NBTTagList;
|
||
|
|
|
||
|
|
public class PlayerDialogData{
|
||
|
|
public HashSet<Integer> dialogsRead = new HashSet<Integer>();
|
||
|
|
|
||
|
|
public void loadNBTData(NBTTagCompound compound) {
|
||
|
|
HashSet<Integer> dialogsRead = new HashSet<Integer>();
|
||
|
|
if(compound == null)
|
||
|
|
return;
|
||
|
|
NBTTagList list = compound.getTagList("DialogData", 10);
|
||
|
|
if(list == null){
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
for(int i = 0; i < list.tagCount(); i++)
|
||
|
|
{
|
||
|
|
NBTTagCompound nbttagcompound = list.getCompoundTagAt(i);
|
||
|
|
dialogsRead.add(nbttagcompound.getInteger("Dialog"));
|
||
|
|
}
|
||
|
|
this.dialogsRead = dialogsRead;
|
||
|
|
}
|
||
|
|
|
||
|
|
public void saveNBTData(NBTTagCompound compound) {
|
||
|
|
NBTTagList list = new NBTTagList();
|
||
|
|
for(int dia : dialogsRead){
|
||
|
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||
|
|
nbttagcompound.setInteger("Dialog", dia);
|
||
|
|
list.appendTag(nbttagcompound);
|
||
|
|
}
|
||
|
|
|
||
|
|
compound.setTag("DialogData", list);
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|