Skip to content

Commit

Permalink
Merge pull request #5 from Oliver-makes-code/1.20.1-fabric
Browse files Browse the repository at this point in the history
Fixup worldgen issues
  • Loading branch information
mrsterner authored Jul 12, 2023
2 parents b303822 + 99296eb commit d3401aa
Showing 1 changed file with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,15 @@

public class GeoclusterWorldgenRegistry {

public static Feature<DefaultFeatureConfig> DEPOSIT_FEATURE = Registry.register(Registries.FEATURE, "deposits", new DepositFeature(DefaultFeatureConfig.CODEC));
public static Feature<DefaultFeatureConfig> DEPOSIT_FEATURE = Registry.register(Registries.FEATURE, Geocluster.id("deposits"), new DepositFeature(DefaultFeatureConfig.CODEC));
public static ConfiguredFeature<DefaultFeatureConfig, Feature<DefaultFeatureConfig>> CONFIGURED_DEPOSIT_FEATURE;
public static RegistryKey<ConfiguredFeature<?, ?>> CONFIGURED_DEPOSIT_FEATURE_KEY;

public static PlacedFeature PLACED_DEPOSIT_FEATURE;
public static RegistryKey<PlacedFeature> PLACED_DEPOSIT_FEATURE_KEY;

public static void init() {

}

public static void init(DynamicRegistryView registryView, Registry<ConfiguredFeature<?, ?>> configuredFeatures) {

CONFIGURED_DEPOSIT_FEATURE = Registry.register(configuredFeatures, "deposits_configured", new ConfiguredFeature<>(DEPOSIT_FEATURE, DefaultFeatureConfig.INSTANCE));
CONFIGURED_DEPOSIT_FEATURE_KEY = ConfiguredFeatures.of("deposits_configured");

registryView.getOptional(RegistryKeys.PLACED_FEATURE).ifPresent(registry -> {
RegistryEntryLookup<ConfiguredFeature<?, ?>> entry = registryView.asDynamicRegistryManager().createRegistryLookup().getOrThrow(RegistryKeys.CONFIGURED_FEATURE);
PLACED_DEPOSIT_FEATURE = new PlacedFeature(entry.getOrThrow(CONFIGURED_DEPOSIT_FEATURE_KEY), Lists.newArrayList(HeightRangePlacementModifier.uniform(YOffset.fixed(-64), YOffset.fixed(320))));
Registry.register(registry, "deposits_placed", PLACED_DEPOSIT_FEATURE);
});
PLACED_DEPOSIT_FEATURE_KEY = PlacedFeatures.of("deposits_placed");
PLACED_DEPOSIT_FEATURE_KEY = PlacedFeatures.of(Geocluster.id("deposits_placed").toString());

BiomeModification modifications = BiomeModifications.create(Geocluster.id("worldgen"));
modifications.add(ModificationPhase.ADDITIONS, BiomeSelectors.all(), ctx -> {
Expand All @@ -55,6 +42,17 @@ public static void init(DynamicRegistryView registryView, Registry<ConfiguredFea
});
}

public static void init(DynamicRegistryView registryView, Registry<ConfiguredFeature<?, ?>> configuredFeatures) {
CONFIGURED_DEPOSIT_FEATURE = Registry.register(configuredFeatures, Geocluster.id("deposits_configured"), new ConfiguredFeature<>(DEPOSIT_FEATURE, DefaultFeatureConfig.INSTANCE));
CONFIGURED_DEPOSIT_FEATURE_KEY = ConfiguredFeatures.of(Geocluster.id("deposits_configured").toString());

registryView.getOptional(RegistryKeys.PLACED_FEATURE).ifPresent(registry -> {
RegistryEntryLookup<ConfiguredFeature<?, ?>> entry = registryView.asDynamicRegistryManager().createRegistryLookup().getOrThrow(RegistryKeys.CONFIGURED_FEATURE);
PLACED_DEPOSIT_FEATURE = new PlacedFeature(entry.getOrThrow(CONFIGURED_DEPOSIT_FEATURE_KEY), Lists.newArrayList(HeightRangePlacementModifier.uniform(YOffset.fixed(-64), YOffset.fixed(320))));
Registry.register(registry, Geocluster.id("deposits_placed"), PLACED_DEPOSIT_FEATURE);
});
}

private static Iterable<RegistryEntry<PlacedFeature>> getPlacedFeaturesByTag(BiomeModificationContext ctx, TagKey<PlacedFeature> placedFeatureTagKey) {
DynamicRegistryManager dynamicRegistryManager = ((BiomeModificationContextImplMixin) ctx).getRegistries();
Registry<PlacedFeature> placedFeatureRegistry = dynamicRegistryManager.get(RegistryKeys.PLACED_FEATURE);
Expand Down

0 comments on commit d3401aa

Please sign in to comment.