Jump to content

[1.15.2] Custom Feature Register


Recommended Posts

Posted (edited)

Hi guys I was trying to register a custom feature and I created a "FeatureInit" class with:

  Reveal hidden contents


Also my "Main" class:

  Reveal hidden contents


But when I build the game using that feature in a custom biome, it returns this error when the custom biome is registered:

  Reveal hidden contents

Looks like it can't find the custom Feature, even tho I register it before I register the biomes

 

Edited by Axspeo
Moved error to spoiler tag
Posted

There is no guarantee to registration order, except Blocks are first, Items second.

 

Add the feature to your biome in the FMLCommonSetupEvent and not in your biomes constructor. I am just guessing at this, since you only shared bits and pieces of code. :)

Posted (edited)
  On 5/21/2020 at 10:09 PM, Ugdhar said:

There is no guarantee to registration order, except Blocks are first, Items second.

 

Add the feature to your biome in the FMLCommonSetupEvent and not in your biomes constructor. I am just guessing at this, since you only shared bits and pieces of code. :)

Expand  

My Biome isn't a static class tho, how am I supposed to get the Biome instance inside FMLCommonSetupEvent?

 

EDIT: Isn't it possible to force biomes to be the last being registered?

Edited by Axspeo
Posted
  On 5/21/2020 at 10:24 PM, Axspeo said:

My Biome isn't a static class tho, how am I supposed to get the Biome instance inside FMLCommonSetupEvent?

 

EDIT: Isn't it possible to force biomes to be the last being registered?

Expand  

As far as I know, nope.

 

And if you are registering your biome, you should have an instance of it somewhere, if not, make one.

Posted
  On 5/21/2020 at 10:37 PM, Ugdhar said:

As far as I know, nope.

 

And if you are registering your biome, you should have an instance of it somewhere, if not, make one.

Expand  

Lol my bad, ofc I have an instance of it... Thanks man you solved my problem! ?

  • 2 weeks later...
Posted
  On 5/22/2020 at 8:58 AM, diesieben07 said:

You will need to use DeferredWorkQueue in FMLCommonSetupEvent, biome features are not threadsafe.

Expand  

Hey man sorry for taking so long to reply but I only saw your reply now.

I've been actually doing this without DeferredWorkQueue and I didn't see any problems, I decided to use it anyway like you told me to but I don't see any difference, can you please explain what does "not thread safe" means in this case? Thanks in advance :)

Posted
  On 6/4/2020 at 6:20 AM, diesieben07 said:

You won't see any problems until you run in a bigger modpack, where multiple mods will do this same thing. And even then it might sometimes work fine. Other times you might see random UnexpectedModificationExceptions show up from your or other (!!!) mods, even if those mods do it correctly. Other times you might see random structures just not being registered.

 

FMLCommonSetupEvent is fired on a threadpool, so your code runns concurrently with the other mods.

 

DeferredWorkQueue schedules something to run afterwards, on the main thread only.

Expand  

Perfect explanation! Thanks :)

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.