mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 01:45:07 +00:00
Magic GUI WIP Push
This commit is contained in:
1 parent
758485b4d0
commit
58ff772e3c
18 files changed
+1002
-81
No files matched your search
@@ -0,0 +1,46 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Holds category information for magic.
|
||||
* Each category can have many magic associations.
|
||||
*/
|
||||
public class MagicCycle {
|
||||
public int id = -1;
|
||||
public String title = "";
|
||||
public HashMap<Integer, MagicAssociation> associations = new HashMap<>();
|
||||
|
||||
public MagicCycle() {}
|
||||
|
||||
public void readNBT(NBTTagCompound compound) {
|
||||
id = compound.getInteger("CategoryID");
|
||||
title = compound.getString("Title");
|
||||
associations.clear();
|
||||
NBTTagList list = compound.getTagList("Associations", 10); // compound tags
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound assocTag = list.getCompoundTagAt(i);
|
||||
MagicAssociation assoc = new MagicAssociation();
|
||||
assoc.magicId = assocTag.getInteger("MagicID");
|
||||
assoc.index = assocTag.getInteger("Index");
|
||||
assoc.priority = assocTag.getInteger("Priority");
|
||||
associations.put(assoc.magicId, assoc);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeNBT(NBTTagCompound compound) {
|
||||
compound.setInteger("CategoryID", id);
|
||||
compound.setString("Title", title);
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (MagicAssociation assoc : associations.values()) {
|
||||
NBTTagCompound assocTag = new NBTTagCompound();
|
||||
assocTag.setInteger("MagicID", assoc.magicId);
|
||||
assocTag.setInteger("Index", assoc.index);
|
||||
assocTag.setInteger("Priority", assoc.priority);
|
||||
list.appendTag(assocTag);
|
||||
}
|
||||
compound.setTag("Associations", list);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user