Jump to content

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


Recommended Posts

Posted

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 ?

 

Posted

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

 

The problem will then happen when I add new wood types, the very same way.

Posted

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/

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.