2018-09-13 12:03:28 -04:00
|
|
|
package noppes.npcs.roles;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
|
import noppes.npcs.controllers.BankController;
|
|
|
|
|
import noppes.npcs.controllers.PlayerDataController;
|
2023-01-12 21:33:06 -05:00
|
|
|
import noppes.npcs.controllers.data.Bank;
|
|
|
|
|
import noppes.npcs.controllers.data.BankData;
|
2018-09-13 12:03:28 -04:00
|
|
|
import noppes.npcs.entity.EntityNPCInterface;
|
|
|
|
|
|
|
|
|
|
public class RoleBank extends RoleInterface{
|
|
|
|
|
|
|
|
|
|
public int bankId = -1;
|
|
|
|
|
|
|
|
|
|
public RoleBank(EntityNPCInterface npc) {
|
|
|
|
|
super(npc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
|
|
|
|
|
nbttagcompound.setInteger("RoleBankID", bankId);
|
|
|
|
|
return nbttagcompound;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
|
|
|
|
bankId = nbttagcompound.getInteger("RoleBankID");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void interact(EntityPlayer player) {
|
2023-06-05 19:35:27 -04:00
|
|
|
BankData data = PlayerDataController.Instance.getBankData(player,bankId).getBankOrDefault(bankId);
|
2018-09-13 12:03:28 -04:00
|
|
|
data.openBankGui(player,npc,bankId,0);
|
|
|
|
|
npc.say(player, npc.advanced.getInteractLine());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Bank getBank() {
|
|
|
|
|
Bank bank = BankController.getInstance().banks.get(bankId);
|
|
|
|
|
if(bank != null)
|
|
|
|
|
return bank;
|
|
|
|
|
return BankController.getInstance().banks.values().iterator().next();
|
|
|
|
|
}
|
|
|
|
|
}
|