mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 20:09:49 +00:00
Profile Implementations
This commit is contained in:
1 parent
8ed86f5ec7
commit
2ebe4ed9c5
11 files changed
+769
-114
No files matched your search
@@ -11,17 +11,17 @@ public class Profile {
|
||||
public EntityPlayer player;
|
||||
public int currentID;
|
||||
public HashMap<Integer, Slot> slots = new HashMap<>();
|
||||
public boolean locked = false; // Prevent modifications while saving
|
||||
|
||||
public Profile(EntityPlayer player, NBTTagCompound compound){
|
||||
this.player = player;
|
||||
if(compound.hasKey("CurrentID")){
|
||||
this.currentID = compound.getInteger("CurrentID");
|
||||
} else {
|
||||
this.currentID = 1;
|
||||
this.currentID = 0;
|
||||
}
|
||||
|
||||
if (compound.hasKey("Slots")) {
|
||||
// Load Slots
|
||||
NBTTagCompound slotsCompound = compound.getCompoundTag("Slots");
|
||||
for (String key : (Set<String>) slotsCompound.func_150296_c()) {
|
||||
int slotID = Integer.parseInt(key);
|
||||
@@ -42,14 +42,14 @@ public class Profile {
|
||||
if(!slots.isEmpty()){
|
||||
NBTTagCompound slotsCompound = new NBTTagCompound();
|
||||
for (HashMap.Entry<Integer, Slot> entry : slots.entrySet()) {
|
||||
int id = entry.getKey();
|
||||
Slot slot = entry.getValue();
|
||||
if(slot.isTemporary())
|
||||
continue; // Do not save temporary slots
|
||||
int id = entry.getKey();
|
||||
slot.setId(id);
|
||||
|
||||
NBTTagCompound slotTag = slot.toNBT();
|
||||
slotsCompound.setTag(String.valueOf(id), slotTag);
|
||||
}
|
||||
|
||||
fullCompound.setTag("Slots", slotsCompound);
|
||||
}
|
||||
return fullCompound;
|
||||
|
||||
Reference in new issue
Block a user