Jump to content

No JavaDocs, leading to other problems.


Keepsedge

Recommended Posts

I have been working on some code for a few days now, and I have been making progress with the readthedocs site. I have run into an issue with Generating Features. 
Since the prefered method of doing things seems to be via the DeferredRegistry I have been using it as much as possible, 

My biggest problem however is that Eclipse complains that there is no source, or javadocs attached to the project. And without them, i'm flying blind. 
If anyone could tell me where i can find the docs to attach them that would be well (Forge 36.0.14).

The other issue I'm running into with ore gen. I have tried several, very different approaches, using examples from GitHub from mods like Mekanisim, Create, ImmersiveEnginering, as well as several youtube videos. I am continually confronted with an error that says that the Registry Object is not present when I Register a new Feature with a reference to the ore block i want to spawn. I have tried creating a static variable and used that as a reference (I know that's  a bad, but i was debugging). I have tried to pull the Block back from the Registry using RegistryObject.of( ResourceLocation, Class). Always the same result.

I have put the code up on GitHub at https://github.com/Keepsedge/ATWorld/blob/main/src/main/java/com/keepsworks/minecraft/atworld/world/generation/OreGenerator.java
Any and all help is very much appreciated. 

Link to comment
Share on other sites

You're calling OreGenerator#register on the constructor of your mod class, that is literally the first thing that runs when your mod is being loaded. by then none of the blocks (or anything else) has been registered yet. so when you try to use a block at that moment, it still doesn't exist.

You want to register the features on common setup

 

and just a few notes:

- you should keep each feature in it's own field, instead of on an ArrayList (Sets are a better implementation than Lists in this case as well)

- your BiomeLoadingEvent Handler has no need to have it's priority set to highest

- you are registering all the nether and end ores in the overworld biomes

- WHY ON EARTH are you using RegistryObject.of() to get your block??? you have a field in your BlockRegistryHandler that stores the RegistryEntry for the block

- using "if (rb.get() != null)" to avoid errors is horrible coding practice. because then you won't get the desired outcome and won't even know why, if the block is null at that point, your code should CRASH, and there's nothing wrong with letting the code crash on development

- what's the point of that try catch block on the register method even?...

- you can automatize the registration of BlockItems, that will really save you some keystrokes

- why did you write your own implementation of block cardinal? vanilla already has a implementation, look at what orientable blocks, such as the furnace extends

 

EDIT: no clue on what's going on with the javadocs, they should be there. but I can't say much because I don't use eclipse

Edited by kiou.23
Link to comment
Share on other sites

I wrote an implementation of block/orientable because I had issues with blockstates a few days ago, and it's something I read was nessicary to do in order to fix it.

 

I realize I have a perfectly good static object to get a copy of my block, however using it throws exactly the same error. As the registry is obviously not build yet - I was just trying a different approach.

 

I used a null check to disable ore gen untill after the registry is created, which should be prior to the gsne finishing loading, just to see if it would help things.... it does not, the game still crashes, with a NullPointerException two calls after my registry code fires. 

 

The try/catch is for the NPE. it also does not function as intended.

 

If I had the source attached to eclipse, I could check out vanilla implementations and likely already have these problem solved.

 

I will automate nearly all registry code once I fully understand what needs to happen in order to do so, presumably with a wrapper of some sort.

Link to comment
Share on other sites

1 hour ago, Keepsedge said:

I wrote an implementation of block/orientable because I had issues with blockstates a few days ago, and it's something I read was nessicary to do in order to fix it.

what were the issues? and what did you read was necessary?

 

1 hour ago, Keepsedge said:

realize I have a perfectly good static object to get a copy of my block, however using it throws exactly the same error. As the registry is obviously not build yet - I was just trying a different approach.

so... you need to only call the object once it has been registered. such as in the common setup event

 

1 hour ago, Keepsedge said:

I used a null check to disable ore gen untill after the registry is created, which should be prior to the gsne finishing loading, just to see if it would help things.... it does not, the game still crashes, with a NullPointerException two calls after my registry code fires.

you're calling the OreGenerator#register at two different moments in the code?

 

1 hour ago, Keepsedge said:

If I had the source attached to eclipse, I could check out vanilla implementations and likely already have these problem solved.

The only thing that I can think is that you could refresh the gradle project... you did run the decompilation right?

 

and here, if it helps, you can check one of my repos, it goes over registering Configured Features and all that: https://github.com/jvcmarcenes/effetewood

 

edit: oh, and check my block registration class to see a possible way of automatizing BlockItem registration ;)

Edited by kiou.23
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.

Announcements



×
×
  • Create New...

Important Information

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