Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Im not sure if retrogen it the rite word for it but basically i am replacing all of one block in the world (Existing chunks) with another.

 

I have it working when the world loads it finds all of the blocks its looking for and replaces them and everything works fine. The weird part is when i then save and quit and then go back into the world... The code runs again even though it has already replaced all of the blocks it is looking for (i have it print a message to the console for each block it finds and replaces)

 

This is my Forge event handler class that dose all of the work.

 

https://github.com/brandon3055/Draconic-Evolution/blob/master/src/main/java/com/brandon3055/draconicevolution/common/core/handler/MinecraftForgeEventHandler.java

(skip to ChunkEvent)

 

The blocks i am finding and the blocks i am replacing them with are from my mod

 

https://github.com/brandon3055/Draconic-Evolution/blob/master/src/main/java/com/brandon3055/draconicevolution/common/core/utills/Utills.java

 

https://github.com/brandon3055/Draconic-Evolution/blob/master/src/main/java/com/brandon3055/draconicevolution/common/blocks/ModBlocks.java

 

The reason i want to do this is because i made a mistake when registering some of my blocks and used their unlocalized name so they were registered as tile.blockName instead of blockName. So i corrected that error and to prevent those blocks from being deleted from existing worlds i created a block that is registered as the old name (tile.blockName) that will be changed to the correct block (by this code) on world load.   

I am the author of Draconic Evolution

It is possible that the chunk needs to be explicitly saved again after you've replaced the blocks.  There is a public field called isModified which maybe you should set to true.  It seems to be checked by a method called needsSaving() which likely ensures it will be saved.

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

  • Author

Thanks jabelar that seems to have fixed it! 

 

You are searching an area of 16x16x16, when a chunk is 16x256x16

 

for (ExtendedBlockStorage storage : chunk.getBlockStorageArray()) 

 

diesieben07 posted this code in this post http://www.minecraftforge.net/forum/index.php?topic=21625.0 from what i can tell it breaks each chunk into 16x16x16 blocks.

 

 

I am the author of Draconic Evolution

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.