Jump to content

[1.7.10] Keeping RF energy in a machine after relog


onVoid

Recommended Posts

I would assume this would be done with NBT in my tile entity, and I know there are readFromNBT() and writeToNBT() methods in my tile entity, but I am unsure how to go about using them to store my RF values. Can anyone help me please?

Link to comment
Share on other sites

Assuming you have an

EnergyStorage

field in your

TileEntity

, call its

readFromNBT

and

writeToNBT

methods in your overrides of the corresponding

TileEntity

methods. You can also extend

[url=https://github.com/CoFH/RedstoneFlux-API/blob/10e10af21489e351624813120ed6474c44b09ff6/src/main/java/cofh/api/energy/TileEnergyHandler.java]TileEnergyHandler[/url]

and let it handle the NBT reading/writing for you.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Assuming you have an

EnergyStorage

field in your

TileEntity

, call its

readFromNBT

and

writeToNBT

methods in your overrides of the corresponding

TileEntity

methods. You can also extend

[url=https://github.com/CoFH/RedstoneFlux-API/blob/10e10af21489e351624813120ed6474c44b09ff6/src/main/java/cofh/api/energy/TileEnergyHandler.java]TileEnergyHandler[/url]

and let it handle the NBT reading/writing for you.

I have this

    @Override
    public void readFromNBT(NBTTagCompound nbt) {
        super.readFromNBT(nbt);
        storage.readFromNBT(nbt);
    }

    @Override
    public void writeToNBT(NBTTagCompound nbt) {
        super.writeToNBT(nbt);
        storage.writeToNBT(nbt);
    }

and it isn't saving. I also attempted making it a TileEnergyHandler, also nothing. What am I missing?

Link to comment
Share on other sites

Are there any errors in the log? Have you registered your

TileEntity

class?

I can't see the log since I am testing the mod outside of the modding environment (if anyone wants to help me get mods working in the environment that would be great), and my TileEntity is registered in initialization

		GameRegistry.registerTileEntity(ChargerTileEntity.class, "Charger");

. It also has working features.

Link to comment
Share on other sites

There's always a log, regardless of whether you're in the development or release environment. It's written to logs/fml-client-latest.log in the game directory.

 

Mods will work in the development environment if you're using development/deobfuscated versions.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

There's always a log, regardless of whether you're in the development or release environment. It's written to logs/fml-client-latest.log in the game directory.

 

Mods will work in the development environment if you're using development/deobfuscated versions.

Checked logs, no errors.

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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