mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 22:45:09 +00:00
Separated data objects and data controller objects in the noppes.npcs.controllers package.
This commit is contained in:
1 parent
d040fa3da7
commit
33bb0307e9
122 files changed
+218
-294
No files matched your search
@@ -0,0 +1,42 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class PlayerMailData{
|
||||
public ArrayList<PlayerMail> playermail = new ArrayList<PlayerMail>();
|
||||
|
||||
public void loadNBTData(NBTTagCompound compound) {
|
||||
ArrayList<PlayerMail> newmail = new ArrayList<PlayerMail>();
|
||||
NBTTagList list = compound.getTagList("MailData", 10);
|
||||
if(list == null)
|
||||
return;
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++){
|
||||
PlayerMail mail = new PlayerMail();
|
||||
mail.readNBT(list.getCompoundTagAt(i));
|
||||
newmail.add(mail);
|
||||
}
|
||||
playermail = newmail;
|
||||
}
|
||||
|
||||
public NBTTagCompound saveNBTData(NBTTagCompound compound) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
for(PlayerMail mail : playermail){
|
||||
list.appendTag(mail.writeNBT());
|
||||
}
|
||||
|
||||
compound.setTag("MailData", list);
|
||||
return compound;
|
||||
}
|
||||
|
||||
public boolean hasMail() {
|
||||
for(PlayerMail mail : playermail)
|
||||
if(!mail.beenRead)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user