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

Hi,

I working on making my Tile Entity store data, but when I tried to override the read function, there was no such thing. Here is my code:

public class CopperCoreTileEntity extends TileEntity implements ITickableTileEntity {
    public int x, y, z;
    private int power = 0;
    private int tick;
    private boolean inited;

    public CopperCoreTileEntity(TileEntityType<?> tileEntityTypeIn) {
        super(tileEntityTypeIn);
    }
    public CopperCoreTileEntity() {
        this(ModTileEntityTypes.COPPER_CORE.get());
    }

    public void tick() {
        if(!inited) init();
        tick++;
        if(tick==6000 && power > 0) {
            power--;
        }
    }

    private void init() {
        inited  = true;
        x = this.pos.getX() - 1;
        y = this.pos.getY() - 1;
        z = this.pos.getZ() - 1;
        tick = 0;
    }

    @Override
    public CompoundNBT write(CompoundNBT compound) {
        compound.put("initvalue", NBTHelper.toNBT(this));
        return  super.write(compound);
    }

}

How do I override the read function?

Thanks in advance,

Kid Koder

There is actually a read function it just isn't named. 

read(@Nonnull CompoundNBT nbt) → func_230337_a_(BlockState p_230337_1_, CompoundNBT nbt)

 

When you override the function let your IDE complete it for you. It will define the BlockState is an input that you will have to use.

I was able to find this list of functions through this website. You will need to know what they

are named when you start creating your GUIs.

[removed link to website with illegal forge rehosting - diesieben07]

Edited by diesieben07

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.