Jump to content

A way to add Mojang's new variants in the future, along with ours ?


Koward

Recommended Posts

Hello.

 

I have multiple blocks that currently use Mojang's BlockPlanks.EnumType.

If Mojang ever add a new type of wood, new matching blocks will be created. So far so good.

I may also like to add new wood types myself, and would want the same behavior.

I can add new stacks to getSubBlocks() and change other methods that handles states and meta.

It works, but is it safe for worlds in the future ? I'm not so sure.

 

Current metadata values (with 6 Mojang types and 3 mod types) :

012345 678

 

If Mojang adds a new wood type :

0123456 789 <= Shifted, wood types of blocks in the world will change at login with new version !

 

Is there an elegant solution to solve this or do we have to manually add all woods to our own custom enum ?

 

Link to comment
Share on other sites

I would say put your "Enums" first then Minecrafts, and hopefully MInecraft won't change the order.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Another approach for any case where you're worried about world saves staying up to date is to do an explicit conversion -- basically check versions and if you detect an upgrade that you know requires conversion process the world save data (or replace directly in the world as it is loaded) accordingly. This can even be done for major Minecraft upgrades and such.

 

it's a bit of work but is a fully managed way to accommodate upgrades while retaining your favorite world saves. If you're really ambitious you can also handle downgrades as well.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.



×
×
  • Create New...

Important Information

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