Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.12] Overriding items in registry throws NPE as override_owners is empty for vanilla items #4079

Closed
moosegold opened this issue Jun 25, 2017 · 6 comments
Labels
1.12 Bug This request reports or fixes a new or existing bug.

Comments

@moosegold
Copy link

I am currently trying to replace the vanilla horse armor with my own to expand upon it. When joining the world however, an NPE is thrown at net.minecraftforge.registries.ForgeRegistry.getOverrideOwners(ForgeRegistry.java:684)
The debugger shows 'override_owners' to only contain items when it is my class. When the plain vanilla items come through, it is empty and results in 'owner' being null.

Some other notable things

  • I am using the registry name minecraft:[iron | gold | diamond]_horse_armor
  • The above code is only reached while joining the world, not during any init events
  • dangerous prefix warnings are still being given
  • The FMLModIdMappingEvent shows 0 remaps (only looked and printed it)
  • I am using Forge 1.12-14.21.0.2364

Here is the crash report and log
crash-2017-06-25_13.27.46-server.txt
latest.txt

@marvin-roesch
Copy link
Member

I've come across this as well, forgot about reporting it though. Can you verify that this only happens for Vanilla items? As far as I could tell (and I didn't look too deeply into this), this issue appears to be related to the taking of snapshots. On the first pass of gathering override owners, they all appeared to be present, on a second pass the map was empty, though.

In the mod I'm actually requiring overrides in, I wasn't able to join an existing world, it worked for a new world, however. Obtaining any of the overriden items immediately crashed the game, however. Trying to reproduce this with a minimal test case (simply overriding any Vanilla item or block and doing nothing else), I wasn't even able to join new worlds anymore.

@mezz mezz added 1.12 Bug This request reports or fixes a new or existing bug. labels Jun 25, 2017
@moosegold
Copy link
Author

moosegold commented Jun 25, 2017

Just tried with two items on my resource domain. It gave the error 'One of more entry values did not copy to the correct id. Check log for details!'
There was also this message:
Registered override did not have an associated owner object. Name: petarmormod:testing Type: net.minecraft.item.Item Value: com.moosegold.petarmormod.Item.Test2@14eaec27
I don't see anything in the log, but here it is
latest (2).txt

Edit: I forgot to mention it isn't loading to the start screen anymore, it's crashing after the Init event now

@LexManos
Copy link
Member

If you would a small test mod would be nice.
I've tested and if done correctly it works.
https://github.com/MinecraftForge/MinecraftForge/blob/1.12.x/src/main/java/net/minecraftforge/registries/ForgeRegistry.java#L273
That line there should make the owners non-null for the original items.
So ya.. need a SMALL test mod.

@marvin-roesch
Copy link
Member

https://pastebin.com/Ngr28hSn This is a minimal test case for the override owner list being empty. It'll crash the game upon joining a world. Tested with latest Forge. I can't speak for the "Registered override not have an associated owner object." error, though.

@moosegold
Copy link
Author

Here is essentially what I was doing before. The three situations each give a different error, one of which is new - java.lang.NullPointerException: Can't use a null-name for the registry, object com.example.examplemod.FakeLeather@c98dc7c..
Both result in a crash before the title screen comes up. (It is possible that I am just registering them incorrectly)

I am also aware of the annoyance of opening these as attachments. If I need to send something else I'll make a pastebin to put it in.

Mod used (Won't let me upload with .java extension):
ExampleMod.txt

crash report for vanilla part:
fml-client-latest(vanilla_override).txt

Log for same domain part:
This one is different because it has the 'no owner' message unlike the vanilla one.
fml-client-latest(Same_Domain).txt

@LexManos
Copy link
Member

Alright tested with a modified version of Paleo's test mod.
Things load and no NPEs anywhere.
Also ItemBlock injection works fully for model registration.
Main issue tho.. is I think we need to inject models for the overridden items...
Need to talk to @RainWarrior about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.12 Bug This request reports or fixes a new or existing bug.
Projects
None yet
Development

No branches or pull requests

4 participants