Modded feature sorting
This commit is contained in:
parent
e09085aa3b
commit
fb3147c6c5
1 changed files with 6 additions and 2 deletions
|
@ -85,6 +85,7 @@ public class BiomeAPI {
|
||||||
private static Registry<Biome> biomeRegistry;
|
private static Registry<Biome> biomeRegistry;
|
||||||
|
|
||||||
private static final Map<PlacedFeature, Integer> FEATURE_ORDER = Maps.newHashMap();
|
private static final Map<PlacedFeature, Integer> FEATURE_ORDER = Maps.newHashMap();
|
||||||
|
private static final MutableInt FEATURE_ORDER_ID = new MutableInt(0);
|
||||||
|
|
||||||
private static final Map<ResourceKey, List<BiConsumer<ResourceLocation, Biome>>> MODIFICATIONS = Maps.newHashMap();
|
private static final Map<ResourceKey, List<BiConsumer<ResourceLocation, Biome>>> MODIFICATIONS = Maps.newHashMap();
|
||||||
private static final Map<ResourceLocation, SurfaceRules.RuleSource> SURFACE_RULES = Maps.newHashMap();
|
private static final Map<ResourceLocation, SurfaceRules.RuleSource> SURFACE_RULES = Maps.newHashMap();
|
||||||
|
@ -104,7 +105,6 @@ public class BiomeAPI {
|
||||||
public static final BCLBiome SMALL_END_ISLANDS = registerEndVoidBiome(getFromRegistry(new ResourceLocation("small_end_islands")));
|
public static final BCLBiome SMALL_END_ISLANDS = registerEndVoidBiome(getFromRegistry(new ResourceLocation("small_end_islands")));
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
MutableInt integer = new MutableInt(0);
|
|
||||||
BuiltinRegistries.BIOME
|
BuiltinRegistries.BIOME
|
||||||
.entrySet()
|
.entrySet()
|
||||||
.stream()
|
.stream()
|
||||||
|
@ -116,7 +116,7 @@ public class BiomeAPI {
|
||||||
features.forEach(step -> {
|
features.forEach(step -> {
|
||||||
step.forEach(provider -> {
|
step.forEach(provider -> {
|
||||||
PlacedFeature feature = provider.get();
|
PlacedFeature feature = provider.get();
|
||||||
FEATURE_ORDER.computeIfAbsent(feature, f -> integer.getAndIncrement());
|
FEATURE_ORDER.computeIfAbsent(feature, f -> FEATURE_ORDER_ID.getAndIncrement());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -711,6 +711,10 @@ public class BiomeAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sortFeatures(List<Supplier<PlacedFeature>> features) {
|
public static void sortFeatures(List<Supplier<PlacedFeature>> features) {
|
||||||
|
features.forEach(provider -> {
|
||||||
|
PlacedFeature feature = provider.get();
|
||||||
|
FEATURE_ORDER.computeIfAbsent(feature, f -> FEATURE_ORDER_ID.getAndIncrement());
|
||||||
|
});
|
||||||
features.sort((f1, f2) -> {
|
features.sort((f1, f2) -> {
|
||||||
int v1 = FEATURE_ORDER.getOrDefault(f1.get(), 2048);
|
int v1 = FEATURE_ORDER.getOrDefault(f1.get(), 2048);
|
||||||
int v2 = FEATURE_ORDER.getOrDefault(f2.get(), 2048);
|
int v2 = FEATURE_ORDER.getOrDefault(f2.get(), 2048);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue