Jump to content

Recommended Posts

Posted

Hi,

 

I've started working on updating Millénaire to 1.7. Just a question regarding the new system of dropping item and block ids: how does that work for saving and transmitting references to blocks and items? Should I still use ids for that? That's what ItemStack seems to be doing in its readFromNBT method. Is there a guarantee that for the same world ids will be persistent across clients (in MP- and across saves and reloads?

 

Thanks

 

K.

Posted

Serialization to IDs is pretty much garenteed to be consistant with FML's ID management system. When a Client connects to the server it is given the table of names<->ids and syncs it's internal table with that.

And same thing happens when loading a world, the world contains that table, and the client syncs with it.

So yes, serializing to IDs in network communication should be fine.

Serializing to ids on the world save should also be okay as long as the end user doesn't do something to screw up the mapping table that FML adds.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

You interact with other mods by there block name that they use to register there block.

Example: minecraft:dirt minecraft:sandstone

You can query the block registry by name as shown in the net.minecraft.init.Blocks class.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

Well, I guess I'll make my own reference table then.

 

I have an other question regarding the life-cycle of the items and blocks objects - are they stable throughout a Minecraft run? With Minecraft only updating the ids if switching to a world that has a different ID config?

 

I'm asking because I'm in the process of switching the references in my Millénaire objects loaded at startup from using ids to using direct references to the items and blocks. Should that be normally safe across worlds? Or should I avoid doing things like this at startup and instead move it to the world loading events?

Posted

After all mods are loaded and initialized, yes, it should be completely safe across the rest of MC's run.

That is, unless a modder screws it up, in which case we can't do anything.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

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.