Small post-init change/fix

This commit is contained in:
paulevsGitch 2022-05-26 22:37:55 +03:00
parent 3ebde1991d
commit c03849706e
2 changed files with 25 additions and 25 deletions

View file

@ -55,10 +55,6 @@ public class PostInitAPI {
* @param isClient {@code boolean}, {@code true} for client, {@code false} for server.
*/
public static void postInit(boolean isClient) {
if (postInitFunctions == null) {
return;
}
postInitFunctions.forEach(function -> function.accept(isClient));
Registry.BLOCK.forEach(block -> {
processBlockCommon(block);
if (isClient) {
@ -66,11 +62,15 @@ public class PostInitAPI {
}
});
Registry.ITEM.forEach(item -> {
processItemCommon(item);
});
postInitFunctions = null;
if (postInitFunctions != null) {
postInitFunctions.forEach(function -> function.accept(isClient));
postInitFunctions = null;
}
blockTags = null;
itemTags = null;
BiomeAPI.loadFabricAPIBiomes();

View file

@ -4,7 +4,23 @@ import net.minecraft.world.level.biome.Biome;
import ru.bclib.config.Configs;
public class BCLBiomeSettings {
public static Builder createBCL(){
float terrainHeight;
float fogDensity;
float genChance;
int edgeSize;
boolean vertical;
BCLBiome edge;
protected BCLBiomeSettings() {
this.terrainHeight = 0.1F;
this.fogDensity = 1.0F;
this.genChance = 1.0F;
this.edgeSize = 0;
this.vertical = false;
this.edge = null;
}
public static Builder createBCL() {
return new Builder();
}
@ -13,9 +29,10 @@ public class BCLBiomeSettings {
super(new BCLBiomeSettings());
}
}
public static class CommonBuilder<T extends BCLBiomeSettings, R extends CommonBuilder>{
private final T storage;
CommonBuilder(T storage){
CommonBuilder(T storage) {
this.storage = storage;
}
@ -92,23 +109,6 @@ public class BCLBiomeSettings {
}
}
protected BCLBiomeSettings(){
this.terrainHeight = 0.1F;
this.fogDensity = 1.0F;
this.genChance = 1.0F;
this.edgeSize = 0;
this.vertical = false;
this.edge = null;
}
float terrainHeight;
float fogDensity;
float genChance;
int edgeSize;
boolean vertical;
BCLBiome edge;
/**
* Getter for biome generation chance, used in {@link ru.bclib.world.generator.BiomePicker} and in custom generators.
* @return biome generation chance as float.