Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static BankAccount fromNBT(NBTTagCompound tag, TEBank bank){
- //TEBank bank;
- EntityPlayer player = null;
- float credit;
- boolean forCard = false;
- if (bank == null) {
- int[] XYZ = tag.getIntArray(NBTTags.Bank.COORDS);
- if (XYZ == null) {
- LogHelper.warn("Bank Coord is null.");
- }
- assert XYZ != null;
- Minecraft mc = Minecraft.getMinecraft();
- WorldClient world = mc.theWorld;
- TileEntity te = world.getTileEntity(XYZ[0], XYZ[1], XYZ[2]);
- bank = (TEBank) te;
- forCard = true;
- }
- long ownerIDLeast, ownerIDMost;
- NBTTagCompound ownerTag = tag.getCompoundTag(NBTTags.Card.UUID_OWNER_TAG);
- ownerIDLeast = ownerTag.getLong(NBTTags.Card.UUID_LEAST_TAG);
- ownerIDMost = ownerTag.getLong(NBTTags.Card.UUID_MOST_TAG);
- UUID id = new UUID(ownerIDMost,ownerIDLeast);
- BankAccount account = bank.getAccount(id);
- if (account!=null){
- return account;
- }
- if (Minecraft.getMinecraft().theWorld!=null)
- player = Minecraft.getMinecraft().theWorld.func_152378_a(id);
- if (player == null){
- LogHelper.warn("Player with UUID (" + id + ") not found.");
- }// else LogHelper.info("Player with UUID (" + id + ") found.");
- if (forCard){
- if (bank!=null)return bank.getAccount(player); //Compiler says this is always true.
- else if (player!=null)return new BankAccount(null,player);
- else return new BankAccount(null,id);
- } else {
- credit = tag.getFloat(NBTTags.Bank.CREDIT);
- if (player!=null) return new BankAccount(bank, player, credit);
- else{
- LogHelper.warn("Will find player later.");
- return new BankAccount(bank,id,credit);
- }
- }
- }
Add Comment
Please, Sign In to add comment