Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.