Jump to content

Convert one block/item in to another on world load


The_Fireplace

Recommended Posts

Quite, yes.

 

Two ways - load world data files and edit them on your own with NBT-reading (not necessarily Minecraft).

OR much simplier:

You would have to do ton of stuff in events.

1. EntityJoinedWorld - for world items

if(event.entity instanceof someItem)

change it another

2. For inventory items.

Use item's onUpdate() or PlayerTickEvent (or even other event, depending on if item is custom or vanilla) to get item, if(item instanceof someItem) change it to other.

3. To manipulate any ItemStack you need it to be loaded by world, so in case item is in chest it will stay normal (old) until you pick it up, then it'll convert).

 

There are few ways to do it, some more optimal, some faster, but probably all will require you to actually see/drop (load) itemStack to world.

 

As to blocks - that one would be quite expensive. You would need to use ChunkEvent of some kind scan storage and replace blocks. That again - will only replace blocks that are loaded by world (player walks around). And also - VERY DAMN resource-eating.

 

Unless ofc this is your custom block - then you could somehow use the id's in world to load other block. Probably possible. (I don't know much about ID/name relations when world saves to .dat)

1.7.10 is no longer supported by forge, you are on your own.

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.