You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Registry DSL does not properly check the type of registry items on compile time. For example, a Block can be registered to the Item registry without a compile time error, only crashing at runtime with a potentially confusing exception.
Test code:
This code will compile, but on runtime the game will crash with the error java.lang.IllegalStateException: Some intrusive holders were not registered: [Reference{null=Block{minecraft:air}}], which may be confusing and does not reveal the true cause of the issue.
The text was updated successfully, but these errors were encountered:
From a cursory look, the issue seems to be that there's a fallback function that matches withId in this example
Registry.invoke call on line 4 of the example creates a RegistryAction<Item> scope and its withId method (this one) will only accept subtypes of item.
Since it doesn't match though, the compiler finds a function that does: this one, one that doesn't require a RegistryAction scope and just makes an object.
So the error here isn't that it's registered into the wrong registry (which would most assuredly give a ClassCast somewhere), it ends up not being registered anywhere.
Would help to add CheckReturnValue to the loose withId, but ideally it should be renamed or moved to a different context.
The Registry DSL does not properly check the type of registry items on compile time. For example, a Block can be registered to the Item registry without a compile time error, only crashing at runtime with a potentially confusing exception.
Test code:
This code will compile, but on runtime the game will crash with the error
java.lang.IllegalStateException: Some intrusive holders were not registered: [Reference{null=Block{minecraft:air}}]
, which may be confusing and does not reveal the true cause of the issue.The text was updated successfully, but these errors were encountered: