Skip to content

Commit

Permalink
removed GenHandler system
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed May 11, 2024
1 parent 7002182 commit 94ec9fe
Showing 1 changed file with 0 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,6 @@ public class AntimatterWorldGenerator {
static final AntimatterFeature<NoneFeatureConfiguration> ORE = new FeatureOre();
static final AntimatterFeature<NoneFeatureConfiguration> STONE_LAYER = new FeatureStoneLayer();


protected record GenHandler(BiomeLoadEvent consumer,
Predicate<Biome.BiomeCategory> validator) {
}
@FunctionalInterface
public interface BiomeLoadEvent{
void accept(ResourceLocation name, Biome.ClimateSettings climate, Biome.BiomeCategory category, BiomeSpecialEffects effects, BiomeGenerationSettings.Builder gen, MobSpawnSettings.Builder spawns);
}

public static void clear() {
AntimatterAPI.all(AntimatterFeature.class, t -> t.getRegistry().clear());
}
Expand Down Expand Up @@ -103,10 +94,6 @@ public static void register(Class<?> c, WorldGenBase<?> base) {
base.getDimensions().forEach(d -> feature.getRegistry().computeIfAbsent(d, k -> new LinkedList<>()).add(base));
}

public static void register(BiomeLoadEvent consumer, String id, String domain, Predicate<Biome.BiomeCategory> validator) {
AntimatterAPI.register(GenHandler.class, id, domain, new GenHandler(consumer, validator));
}

public static <T> List<T> all(Class<T> c, ResourceKey<Level> dim) {
AntimatterFeature<?> feat = AntimatterAPI.get(AntimatterFeature.class, c.getName());
return feat != null ? feat.getRegistry().computeIfAbsent(dim.location(), k -> new LinkedList<>()).stream().map(c::cast).collect(Collectors.toList()) : Collections.emptyList();
Expand Down Expand Up @@ -194,12 +181,6 @@ public static void reloadEvent(ResourceLocation name, Biome.ClimateSettings clim
AntimatterAPI.all(IAntimatterFeature.class, t -> {
t.build(name, climate, category, effects, gen, spawns);
});
AntimatterAPI.all(GenHandler.class, t -> {
if (name == null) return;
if (t.validator.test(category)) {
t.consumer.accept(name, climate, category, effects, gen, spawns);
}
});
if (AntimatterPlatformUtils.isForge()) {
handleFeatureRemoval(gen);
}
Expand Down

0 comments on commit 94ec9fe

Please sign in to comment.