Posted September 1, 201411 yr I have 2 Problems: 1) I've got two methods to interact with the slots in my TileEntity: public void importMoneyFromInput(EntityPlayer player) { double val = 0; ItemStack input = atmSlots[0]; if ( input != null ) { if ( input.getItem() instanceof ItemNote ) { val = ((ItemNote) input.getItem()).getValue()*input.stackSize; } else if ( input.getItem() instanceof ItemCoin ) { val = ((ItemCoin) input.getItem()).getValue()*input.stackSize; } } double lastVal = player.getEntityData().getDouble("bankBalance"); player.getEntityData().setDouble("bankBalance", val + lastVal); atmSlots[0] = null; this.onInventoryChanged = true; } public void exportMoneyFromBuffer (ATMHelper helper, EntityPlayer player) { helper.updateOutput(); atmSlots[2] = (ModMoneyHelper.createFullBriefcase(toPutOut_is)).copy(); double oldVal = player.getEntityData().getDouble("bankBalance"); double remove = helper.getValueOutput(); player.getEntityData().setDouble("bankBalance", oldVal-remove); helper.reset(); this.onInventoryChanged = true; } ( this.onInventoryChnaged = true causes this.markDirty() ) The Methods work, but the items in the input-slot don't disappear correctly & the items in the output-slot don't appear correctly. What did i forgot? 2) I am using the EntityPlayer.getEntityData() to get an double: this.bankBalance = player.getEntityData().getDouble("bankBalance"); & later to set it: this.player.getEntityData().setDouble("bankBalance", this.bankBalance); It works as long as i don't reload the world. On re-log the var "bankBalance" is 0. is this because of the development environment (like i can't take screenshots) or did i miss something? The TileEntitys are Going to kill us all and take over the entire (Minecraft) world!
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.