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

AnyHolderSet and NotHolderSet cannot be datagenned #1838

Open
KnightMiner opened this issue Jan 11, 2025 · 0 comments
Open

AnyHolderSet and NotHolderSet cannot be datagenned #1838

KnightMiner opened this issue Jan 11, 2025 · 0 comments
Labels
triage Needs triaging and confirmation

Comments

@KnightMiner
Copy link
Contributor

Minecraft Version: 1.21

NeoForge Version: 21.4.51-beta

Exception:

Caused by: java.lang.ClassCastException: class net.minecraft.core.RegistrySetBuilder$UniversalLookup cannot be cast to class net.minecraft.core.HolderLookup$RegistryLookup (net.minecraft.core.RegistrySetBuilder$UniversalLookup and net.minecraft.core.HolderLookup$RegistryLookup are in module [email protected] of loader 'TRANSFORMER' @989da1)

Description of issue:

Attempting to use either AnyHolderSet or NotHolderSet in datagen leads to a crash. The reason for this is both require a HolderLookup.RegistryLookup to construct, and the Neo provided method to obtain a RegistryLookup does an unchecked cast from a HolderGetter to a HolderLookup.RegistryLookup which fails during datagen (I've not verified if that cast ever works at runtime, but I assume it must otherwise it wouldn't be there).

One commonly attempted fix is simply passing in null to the constructor since we don't need the RegistryLookup information during datagen, but this leads to a crash in Mojang's canSerializeIn which attempts to use the lookup during datagen.

Workarounds:

Related Issues:

@KnightMiner KnightMiner added the triage Needs triaging and confirmation label Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Needs triaging and confirmation
Projects
None yet
Development

No branches or pull requests

1 participant