mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 13:09:11 +00:00
Full Imports and Code Format Optimization
This commit is contained in:
1 parent
250edf099c
commit
6815f579a7
1192 files changed
+60344
-62167
No files matched your search
@@ -8,56 +8,57 @@ import java.util.HashMap;
|
||||
|
||||
|
||||
public class Bank {
|
||||
public int id = -1;
|
||||
public String name = "";
|
||||
public HashMap<Integer,Integer> slotTypes;
|
||||
public int startSlots = 1;
|
||||
public int maxSlots = 6;
|
||||
public NpcMiscInventory currencyInventory;
|
||||
public NpcMiscInventory upgradeInventory;
|
||||
public Bank(){
|
||||
slotTypes = new HashMap<Integer, Integer>();
|
||||
currencyInventory = new NpcMiscInventory(6);
|
||||
upgradeInventory = new NpcMiscInventory(6);
|
||||
for(int i = 0; i < 6; i++)
|
||||
slotTypes.put(i, 0);
|
||||
}
|
||||
|
||||
public void writeEntityToNBT(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setInteger("BankID", id);
|
||||
nbttagcompound.setTag("BankCurrency", currencyInventory.getToNBT());
|
||||
nbttagcompound.setTag("BankUpgrade", upgradeInventory.getToNBT());
|
||||
nbttagcompound.setString("Username", name);
|
||||
nbttagcompound.setInteger("MaxSlots", maxSlots);
|
||||
nbttagcompound.setInteger("StartSlots", startSlots);
|
||||
nbttagcompound.setTag("BankTypes", NBTTags.nbtIntegerIntegerMap(slotTypes));
|
||||
}
|
||||
public int id = -1;
|
||||
public String name = "";
|
||||
public HashMap<Integer, Integer> slotTypes;
|
||||
public int startSlots = 1;
|
||||
public int maxSlots = 6;
|
||||
public NpcMiscInventory currencyInventory;
|
||||
public NpcMiscInventory upgradeInventory;
|
||||
|
||||
public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
|
||||
id = nbttagcompound.getInteger("BankID");
|
||||
public Bank() {
|
||||
slotTypes = new HashMap<Integer, Integer>();
|
||||
currencyInventory = new NpcMiscInventory(6);
|
||||
upgradeInventory = new NpcMiscInventory(6);
|
||||
for (int i = 0; i < 6; i++)
|
||||
slotTypes.put(i, 0);
|
||||
}
|
||||
|
||||
public void writeEntityToNBT(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setInteger("BankID", id);
|
||||
nbttagcompound.setTag("BankCurrency", currencyInventory.getToNBT());
|
||||
nbttagcompound.setTag("BankUpgrade", upgradeInventory.getToNBT());
|
||||
nbttagcompound.setString("Username", name);
|
||||
nbttagcompound.setInteger("MaxSlots", maxSlots);
|
||||
nbttagcompound.setInteger("StartSlots", startSlots);
|
||||
nbttagcompound.setTag("BankTypes", NBTTags.nbtIntegerIntegerMap(slotTypes));
|
||||
}
|
||||
|
||||
public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
|
||||
id = nbttagcompound.getInteger("BankID");
|
||||
name = nbttagcompound.getString("Username");
|
||||
startSlots = nbttagcompound.getInteger("StartSlots");
|
||||
maxSlots = nbttagcompound.getInteger("MaxSlots");
|
||||
slotTypes = NBTTags.getIntegerIntegerMap(nbttagcompound.getTagList("BankTypes", 10));
|
||||
currencyInventory.setFromNBT(nbttagcompound.getCompoundTag("BankCurrency"));
|
||||
upgradeInventory.setFromNBT(nbttagcompound.getCompoundTag("BankUpgrade"));
|
||||
}
|
||||
|
||||
public boolean isUpgraded(int slot){
|
||||
return slotTypes.get(slot) != null && slotTypes.get(slot) == 2;
|
||||
}
|
||||
currencyInventory.setFromNBT(nbttagcompound.getCompoundTag("BankCurrency"));
|
||||
upgradeInventory.setFromNBT(nbttagcompound.getCompoundTag("BankUpgrade"));
|
||||
}
|
||||
|
||||
public boolean canBeUpgraded(int slot) {
|
||||
if(upgradeInventory.getStackInSlot(slot) == null)
|
||||
return false;
|
||||
return slotTypes.get(slot) == null || slotTypes.get(slot) == 0;
|
||||
}
|
||||
public boolean isUpgraded(int slot) {
|
||||
return slotTypes.get(slot) != null && slotTypes.get(slot) == 2;
|
||||
}
|
||||
|
||||
public int getMaxSlots() {
|
||||
for(int i = 0; i < maxSlots; i++){
|
||||
if(currencyInventory.getStackInSlot(i) == null && i > startSlots-1)
|
||||
return i;
|
||||
}
|
||||
return maxSlots;
|
||||
}
|
||||
public boolean canBeUpgraded(int slot) {
|
||||
if (upgradeInventory.getStackInSlot(slot) == null)
|
||||
return false;
|
||||
return slotTypes.get(slot) == null || slotTypes.get(slot) == 0;
|
||||
}
|
||||
|
||||
public int getMaxSlots() {
|
||||
for (int i = 0; i < maxSlots; i++) {
|
||||
if (currencyInventory.getStackInSlot(i) == null && i > startSlots - 1)
|
||||
return i;
|
||||
}
|
||||
return maxSlots;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user