AnyHolderSet
and NotHolderSet
cannot be datagenned
#1838
Labels
triage
Needs triaging and confirmation
AnyHolderSet
and NotHolderSet
cannot be datagenned
#1838
Minecraft Version: 1.21
NeoForge Version: 21.4.51-beta
Exception:
Description of issue:
Attempting to use either
AnyHolderSet
orNotHolderSet
in datagen leads to a crash. The reason for this is both require aHolderLookup.RegistryLookup
to construct, and the Neo provided method to obtain aRegistryLookup
does an unchecked cast from aHolderGetter
to aHolderLookup.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 theRegistryLookup
information during datagen, but this leads to a crash in Mojang'scanSerializeIn
which attempts to use the lookup during datagen.Workarounds:
RegistryLookup
by either wrapping theHolderLookup
or throwing in most methods, an example is here: https://github.com/SlimeKnights/TinkersConstruct/blob/e335dfb1c81b7698fe534b1b74ddf4ed85692bed/src/main/java/slimeknights/tconstruct/world/data/WorldgenProvider.java#L372NotHolderSet
/AnyHolderSet
for a datagennable version by makingcanSerializeIn
always returntrue
, thus making the constructor able to acceptnull
during datagen, example here: https://github.com/SlimeKnights/TinkersConstruct/blob/85478dc6122864c6ac8d9001cc025882bb506714/src/main/java/slimeknights/tconstruct/world/data/WorldgenProvider.java#L363Related Issues:
NotHolderSet
cannot be serialized durring datagen MinecraftForge/MinecraftForge#9634The text was updated successfully, but these errors were encountered: