2025-01-29 13:20:04 -05:00
|
|
|
package kamkeel.npcs.controllers.data;
|
2025-01-23 16:10:01 -05:00
|
|
|
|
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
|
|
|
|
|
|
public class Slot {
|
|
|
|
|
|
|
|
|
|
private int id;
|
|
|
|
|
private String name;
|
|
|
|
|
private long lastLoaded;
|
|
|
|
|
private NBTTagCompound compound;
|
2025-02-18 06:25:09 -05:00
|
|
|
private boolean temporary = false;
|
2025-01-23 16:10:01 -05:00
|
|
|
|
|
|
|
|
public Slot(int id, String name) {
|
|
|
|
|
this.id = id;
|
|
|
|
|
this.name = name;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-18 06:25:09 -05:00
|
|
|
public Slot(int id, String name, NBTTagCompound compound, long last, boolean temporary) {
|
2025-01-23 16:10:01 -05:00
|
|
|
this.id = id;
|
|
|
|
|
this.name = name;
|
|
|
|
|
this.compound = compound;
|
|
|
|
|
this.lastLoaded = last;
|
2025-02-18 06:25:09 -05:00
|
|
|
this.temporary = temporary;
|
2025-01-23 16:10:01 -05:00
|
|
|
}
|
|
|
|
|
|
2025-02-18 06:25:09 -05:00
|
|
|
// Getters and setters
|
2025-01-23 16:10:01 -05:00
|
|
|
public int getId() {
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
public void setId(int id) {
|
|
|
|
|
this.id = id;
|
|
|
|
|
}
|
|
|
|
|
public String getName() {
|
|
|
|
|
return name;
|
|
|
|
|
}
|
|
|
|
|
public void setName(String name) {
|
|
|
|
|
this.name = name;
|
|
|
|
|
}
|
|
|
|
|
public long getLastLoaded() {
|
|
|
|
|
return lastLoaded;
|
|
|
|
|
}
|
|
|
|
|
public void setLastLoaded(long lastLoaded) {
|
|
|
|
|
this.lastLoaded = lastLoaded;
|
|
|
|
|
}
|
|
|
|
|
public NBTTagCompound getCompound() {
|
|
|
|
|
return compound;
|
|
|
|
|
}
|
|
|
|
|
public void setCompound(NBTTagCompound compound) {
|
|
|
|
|
this.compound = compound;
|
|
|
|
|
}
|
2025-02-18 06:25:09 -05:00
|
|
|
public boolean isTemporary() {
|
|
|
|
|
return temporary;
|
|
|
|
|
}
|
|
|
|
|
public void setTemporary(boolean temporary) {
|
|
|
|
|
this.temporary = temporary;
|
|
|
|
|
}
|
2025-01-23 16:10:01 -05:00
|
|
|
|
|
|
|
|
public NBTTagCompound toNBT() {
|
|
|
|
|
NBTTagCompound slotNBT = new NBTTagCompound();
|
|
|
|
|
slotNBT.setString("Name", name);
|
|
|
|
|
slotNBT.setLong("LastLoaded", lastLoaded);
|
|
|
|
|
slotNBT.setTag("Data", compound);
|
2025-02-18 06:25:09 -05:00
|
|
|
slotNBT.setBoolean("Temporary", temporary);
|
2025-01-23 16:10:01 -05:00
|
|
|
return slotNBT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Slot fromNBT(int id, NBTTagCompound slotNBT) {
|
|
|
|
|
String name = slotNBT.getString("Name");
|
|
|
|
|
long lastLoaded = slotNBT.getLong("LastLoaded");
|
|
|
|
|
NBTTagCompound compound = slotNBT.getCompoundTag("Data");
|
2025-02-18 06:25:09 -05:00
|
|
|
boolean temporary = slotNBT.hasKey("Temporary") && slotNBT.getBoolean("Temporary");
|
|
|
|
|
return new Slot(id, name, compound, lastLoaded, temporary);
|
2025-01-23 16:10:01 -05:00
|
|
|
}
|
|
|
|
|
}
|