mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 00:39:40 +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,40 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.roles.JobItemGiver;
|
||||
|
||||
public class PlayerItemGiverData{
|
||||
private HashMap<Integer, Long> itemgivers = new HashMap<Integer,Long>();
|
||||
private HashMap<Integer, Integer> chained = new HashMap<Integer,Integer>();
|
||||
|
||||
public void loadNBTData(NBTTagCompound compound) {
|
||||
chained = NBTTags.getIntegerIntegerMap(compound.getTagList("ItemGiverChained", 10));
|
||||
itemgivers = NBTTags.getIntegerLongMap(compound.getTagList("ItemGiversList", 10));
|
||||
}
|
||||
|
||||
public void saveNBTData(NBTTagCompound compound) {
|
||||
compound.setTag("ItemGiverChained", NBTTags.nbtIntegerIntegerMap(chained));
|
||||
compound.setTag("ItemGiversList", NBTTags.nbtIntegerLongMap(itemgivers));
|
||||
}
|
||||
public boolean hasInteractedBefore(JobItemGiver jobItemGiver) {
|
||||
return itemgivers.containsKey(jobItemGiver.itemGiverId);
|
||||
}
|
||||
|
||||
public long getTime(JobItemGiver jobItemGiver){
|
||||
return itemgivers.get(jobItemGiver.itemGiverId);
|
||||
}
|
||||
public void setTime(JobItemGiver jobItemGiver, long day) {
|
||||
itemgivers.put(jobItemGiver.itemGiverId, day);
|
||||
}
|
||||
public int getItemIndex(JobItemGiver jobItemGiver) {
|
||||
if(chained.containsKey(jobItemGiver.itemGiverId))
|
||||
return chained.get(jobItemGiver.itemGiverId);
|
||||
return 0;
|
||||
}
|
||||
public void setItemIndex(JobItemGiver jobItemGiver, int i) {
|
||||
chained.put(jobItemGiver.itemGiverId, i);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user