Custom registries in DataGeneratorEntrypoint#buildRegistry not functioning
marlester-dev opened this issue ยท 2 comments
using registry builder, custom registries are not working:
@Override
public void buildRegistry(RegistrySetBuilder registryBuilder) {
registryBuilder
.add(Registries.CONFIGURED_FEATURE, TFConfiguredFeatures::bootstrap)
.add(Registries.PLACED_FEATURE, TFPlacedFeatures::bootstrap)
.add(Registries.STRUCTURE, TFStructures::bootstrap)
.add(Registries.STRUCTURE_SET, TFStructureSets::bootstrap)
.add(Registries.CONFIGURED_CARVER, TFCaveCarvers::bootstrap)
.add(Registries.NOISE_SETTINGS, TFDimensionSettings::bootstrapNoise)
.add(BiomeLayerStack.BIOME_STACK_KEY, BiomeLayerStack::bootstrap)
.add(Registries.DIMENSION_TYPE, TFDimensionSettings::bootstrapType)
.add(Registries.LEVEL_STEM, TFDimensionSettings::bootstrapStem)
.add(Registries.BIOME, TFBiomes::bootstrap)
.add(WoodPalettes.WOOD_PALETTE_TYPE_KEY, WoodPalettes::bootstrap)
.add(Registries.DAMAGE_TYPE, TFDamageTypes::bootstrap)
.add(Registries.TRIM_MATERIAL, TFTrimMaterials::bootstrap)
.add(Restrictions.RESTRICTION_KEY, Restrictions::bootstrap)
.add(MagicPaintingVariants.REGISTRY_KEY, MagicPaintingVariants::bootstrap);
}
Error:
java.lang.IllegalArgumentException: Multiple entries with same key: twilight:biome_layer_stack=net.minecraft.core.RegistrySetBuilder$UniversalLookup@40f911e4 and twilight:biome_layer_stack=net.minecraft.core.RegistrySetBuilder$1@3f3ea394
I'm creating registry keys with ResourceKey.createRegistryKey(ResourceLocation)
Seems like the error is coming from immutable builder
map here in RegistrySetBuilder$BuildState:
public static BuildState create(RegistryAccess registryAccess, Stream<ResourceKey<? extends Registry<?>>> registries) {
CompositeOwner compositeOwner = new CompositeOwner();
List<RuntimeException> list = new ArrayList();
UniversalLookup universalLookup = new UniversalLookup(compositeOwner);
ImmutableMap.Builder<ResourceLocation, HolderGetter<?>>/*the map ->*/ builder = ImmutableMap.builder();
registryAccess.registries().forEach((registryEntry) -> {
builder.put(registryEntry.key().location(), RegistrySetBuilder.wrapContextLookup(registryEntry.value().asLookup()));
});
registries.forEach((registryKey) -> {
builder.put(registryKey.location(), universalLookup);
});
return new BuildState(compositeOwner, universalLookup, builder.build(), new HashMap(), list);
}