More biome API changes

This commit is contained in:
paulevsGitch 2021-12-01 12:31:25 +03:00
parent 548cedcffe
commit e1e09c4efa
8 changed files with 121 additions and 90 deletions

View file

@ -45,7 +45,7 @@ public class BiomeAPI {
* Empty biome used as default value if requested biome doesn't exist or linked. Shouldn't be registered anywhere to prevent bugs. * Empty biome used as default value if requested biome doesn't exist or linked. Shouldn't be registered anywhere to prevent bugs.
* Have {@code Biomes.THE_VOID} as the reference biome. * Have {@code Biomes.THE_VOID} as the reference biome.
*/ */
public static final BCLBiome EMPTY_BIOME = new BCLBiome(Biomes.THE_VOID.location(), BuiltinRegistries.BIOME.get(Biomes.THE_VOID), 1, 0); public static final BCLBiome EMPTY_BIOME = new BCLBiome(Biomes.THE_VOID.location());
public static final BiomePicker NETHER_BIOME_PICKER = new BiomePicker(); public static final BiomePicker NETHER_BIOME_PICKER = new BiomePicker();
public static final BiomePicker END_LAND_BIOME_PICKER = new BiomePicker(); public static final BiomePicker END_LAND_BIOME_PICKER = new BiomePicker();
@ -100,9 +100,8 @@ public class BiomeAPI {
return subBiome; return subBiome;
} }
public static BCLBiome registerSubBiome(BCLBiome parent, Biome biome, float chance) { public static BCLBiome registerSubBiome(BCLBiome parent, Biome biome, float genChance) {
ResourceKey<Biome> key = BuiltinRegistries.BIOME.getResourceKey(biome).get(); BCLBiome subBiome = new BCLBiome(biome).setGenChance(genChance);
BCLBiome subBiome = new BCLBiome(key.location(), biome, 1, chance);
return registerSubBiome(parent, subBiome); return registerSubBiome(parent, subBiome);
} }
@ -122,8 +121,8 @@ public class BiomeAPI {
Climate.ParameterPoint parameters = Climate.parameters( Climate.ParameterPoint parameters = Climate.parameters(
MHelper.randRange(-1.5F, 1.5F, random), MHelper.randRange(-1.5F, 1.5F, random),
MHelper.randRange(-1.5F, 1.5F, random), MHelper.randRange(-1.5F, 1.5F, random),
0.0f, //new in 1.18 MHelper.randRange(-1.5F, 1.5F, random), //new in 1.18
0.0f, //new in 1.18 MHelper.randRange(-1.5F, 1.5F, random), //new in 1.18
MHelper.randRange(-1.5F, 1.5F, random), MHelper.randRange(-1.5F, 1.5F, random),
MHelper.randRange(-1.5F, 1.5F, random), MHelper.randRange(-1.5F, 1.5F, random),
random.nextFloat() random.nextFloat()
@ -140,8 +139,7 @@ public class BiomeAPI {
* @return {@link BCLBiome} * @return {@link BCLBiome}
*/ */
public static BCLBiome registerNetherBiome(Biome biome) { public static BCLBiome registerNetherBiome(Biome biome) {
ResourceKey<Biome> key = BuiltinRegistries.BIOME.getResourceKey(biome).get(); BCLBiome bclBiome = new BCLBiome(biome);
BCLBiome bclBiome = new BCLBiome(key.location(), biome, 1, 1);
NETHER_BIOME_PICKER.addBiome(bclBiome); NETHER_BIOME_PICKER.addBiome(bclBiome);
registerBiome(bclBiome); registerBiome(bclBiome);
return bclBiome; return bclBiome;
@ -170,8 +168,7 @@ public class BiomeAPI {
* @return {@link BCLBiome} * @return {@link BCLBiome}
*/ */
public static BCLBiome registerEndLandBiome(Biome biome) { public static BCLBiome registerEndLandBiome(Biome biome) {
ResourceKey<Biome> key = BuiltinRegistries.BIOME.getResourceKey(biome).get(); BCLBiome bclBiome = new BCLBiome(biome);
BCLBiome bclBiome = new BCLBiome(key.location(), biome, 1, 1);
END_LAND_BIOME_PICKER.addBiome(bclBiome); END_LAND_BIOME_PICKER.addBiome(bclBiome);
registerBiome(bclBiome); registerBiome(bclBiome);
return bclBiome; return bclBiome;
@ -181,12 +178,11 @@ public class BiomeAPI {
* Register {@link BCLBiome} wrapper for {@link Biome}. * Register {@link BCLBiome} wrapper for {@link Biome}.
* After that biome will be added to BCLib End Biome Generator and into Fabric Biome API as a land biome (will generate only on islands). * After that biome will be added to BCLib End Biome Generator and into Fabric Biome API as a land biome (will generate only on islands).
* @param biome {@link BCLBiome}; * @param biome {@link BCLBiome};
* @param weight float generation chance. * @param genChance float generation chance.
* @return {@link BCLBiome} * @return {@link BCLBiome}
*/ */
public static BCLBiome registerEndLandBiome(Biome biome, float weight) { public static BCLBiome registerEndLandBiome(Biome biome, float genChance) {
ResourceKey<Biome> key = BuiltinRegistries.BIOME.getResourceKey(biome).get(); BCLBiome bclBiome = new BCLBiome(biome).setGenChance(genChance);
BCLBiome bclBiome = new BCLBiome(key.location(), biome, 1, weight);
END_LAND_BIOME_PICKER.addBiome(bclBiome); END_LAND_BIOME_PICKER.addBiome(bclBiome);
registerBiome(bclBiome); registerBiome(bclBiome);
return bclBiome; return bclBiome;
@ -214,8 +210,7 @@ public class BiomeAPI {
* @return {@link BCLBiome} * @return {@link BCLBiome}
*/ */
public static BCLBiome registerEndVoidBiome(Biome biome) { public static BCLBiome registerEndVoidBiome(Biome biome) {
ResourceKey<Biome> key = BuiltinRegistries.BIOME.getResourceKey(biome).get(); BCLBiome bclBiome = new BCLBiome(biome);
BCLBiome bclBiome = new BCLBiome(key.location(), biome, 1, 1);
END_VOID_BIOME_PICKER.addBiome(bclBiome); END_VOID_BIOME_PICKER.addBiome(bclBiome);
registerBiome(bclBiome); registerBiome(bclBiome);
return bclBiome; return bclBiome;
@ -224,13 +219,13 @@ public class BiomeAPI {
/** /**
* Register {@link BCLBiome} instance and its {@link Biome} if necessary. * Register {@link BCLBiome} instance and its {@link Biome} if necessary.
* After that biome will be added to BCLib End Biome Generator and into Fabric Biome API as a void biome (will generate only in the End void - between islands). * After that biome will be added to BCLib End Biome Generator and into Fabric Biome API as a void biome (will generate only in the End void - between islands).
* @param biome {@link BCLBiome}; * @param biome {@link BCLBiome}.
* @param weight float generation chance. * @param genChance float generation chance.
* @return {@link BCLBiome} * @return {@link BCLBiome}
*/ */
public static BCLBiome registerEndVoidBiome(Biome biome, float weight) { public static BCLBiome registerEndVoidBiome(Biome biome, float genChance) {
ResourceKey<Biome> key = BuiltinRegistries.BIOME.getResourceKey(biome).get(); ResourceKey<Biome> key = BuiltinRegistries.BIOME.getResourceKey(biome).get();
BCLBiome bclBiome = new BCLBiome(key.location(), biome, 1, weight); BCLBiome bclBiome = new BCLBiome(biome).setGenChance(genChance);
END_VOID_BIOME_PICKER.addBiome(bclBiome); END_VOID_BIOME_PICKER.addBiome(bclBiome);
registerBiome(bclBiome); registerBiome(bclBiome);
return bclBiome; return bclBiome;
@ -238,7 +233,6 @@ public class BiomeAPI {
/** /**
* Get {@link BCLBiome} from {@link Biome} instance on server. Used to convert world biomes to BCLBiomes. * Get {@link BCLBiome} from {@link Biome} instance on server. Used to convert world biomes to BCLBiomes.
*
* @param biome - {@link Biome} from world. * @param biome - {@link Biome} from world.
* @return {@link BCLBiome} or {@code BiomeAPI.EMPTY_BIOME}. * @return {@link BCLBiome} or {@code BiomeAPI.EMPTY_BIOME}.
*/ */
@ -251,7 +245,6 @@ public class BiomeAPI {
/** /**
* Get {@link BCLBiome} from biome on client. Used in fog rendering. * Get {@link BCLBiome} from biome on client. Used in fog rendering.
*
* @param biome - {@link Biome} from client world. * @param biome - {@link Biome} from client world.
* @return {@link BCLBiome} or {@code BiomeAPI.EMPTY_BIOME}. * @return {@link BCLBiome} or {@code BiomeAPI.EMPTY_BIOME}.
*/ */
@ -269,7 +262,6 @@ public class BiomeAPI {
/** /**
* Get biome {@link ResourceLocation} from given {@link Biome}. * Get biome {@link ResourceLocation} from given {@link Biome}.
*
* @param biome - {@link Biome} from server world. * @param biome - {@link Biome} from server world.
* @return biome {@link ResourceLocation}. * @return biome {@link ResourceLocation}.
*/ */
@ -280,7 +272,6 @@ public class BiomeAPI {
/** /**
* Get {@link BCLBiome} from given {@link ResourceLocation}. * Get {@link BCLBiome} from given {@link ResourceLocation}.
*
* @param biomeID - biome {@link ResourceLocation}. * @param biomeID - biome {@link ResourceLocation}.
* @return {@link BCLBiome} or {@code BiomeAPI.EMPTY_BIOME}. * @return {@link BCLBiome} or {@code BiomeAPI.EMPTY_BIOME}.
*/ */
@ -290,7 +281,6 @@ public class BiomeAPI {
/** /**
* Check if biome with {@link ResourceLocation} exists in API registry. * Check if biome with {@link ResourceLocation} exists in API registry.
*
* @param biomeID - biome {@link ResourceLocation}. * @param biomeID - biome {@link ResourceLocation}.
* @return {@code true} if biome exists in API registry and {@code false} if not. * @return {@code true} if biome exists in API registry and {@code false} if not.
*/ */
@ -455,12 +445,9 @@ public class BiomeAPI {
* @param structure {@link ConfiguredStructureFeature} to add. * @param structure {@link ConfiguredStructureFeature} to add.
*/ */
public static void addBiomeStructure(Biome biome, ConfiguredStructureFeature structure) { public static void addBiomeStructure(Biome biome, ConfiguredStructureFeature structure) {
BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE.getResourceKey(structure) BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE
.ifPresent((key)-> .getResourceKey(structure)
BiomeModifications.addStructure( .ifPresent(key -> BiomeModifications.addStructure(ctx -> ctx.getBiomeKey().location().equals(BuiltinRegistries.BIOME.getKey(biome)), key));
(ctx)-> ctx.getBiomeKey().location().equals(BuiltinRegistries.BIOME.getKey(biome)),
key
));
} }
/** /**
* Adds new structure feature to existing biome. * Adds new structure feature to existing biome.

View file

@ -18,7 +18,6 @@ import net.minecraft.network.chat.Component;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import ru.bclib.gui.gridlayout.GridLayout.Alignment; import ru.bclib.gui.gridlayout.GridLayout.Alignment;
import ru.bclib.util.Pair;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)

View file

@ -1,9 +1,5 @@
package ru.bclib.mixin.common; package ru.bclib.mixin.common;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.function.Supplier;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
@ -23,6 +19,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import ru.bclib.api.BiomeAPI; import ru.bclib.api.BiomeAPI;
import ru.bclib.api.LifeCycleAPI; import ru.bclib.api.LifeCycleAPI;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.function.Supplier;
@Mixin(ServerLevel.class) @Mixin(ServerLevel.class)
public abstract class ServerLevelMixin extends Level { public abstract class ServerLevelMixin extends Level {
private static String bclib_lastWorld = null; private static String bclib_lastWorld = null;

View file

@ -1,26 +1,13 @@
package ru.bclib.world.biomes; package ru.bclib.world.biomes;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.data.BuiltinRegistries;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.Biomes;
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import ru.bclib.config.Configs;
import ru.bclib.util.JsonFactory;
import ru.bclib.util.StructureHelper;
import ru.bclib.util.WeightedList; import ru.bclib.util.WeightedList;
import ru.bclib.world.features.BCLFeature;
import ru.bclib.world.features.ListFeature;
import ru.bclib.world.features.ListFeature.StructureInfo;
import ru.bclib.world.features.NBTStructureFeature.TerrainMerge;
import java.io.InputStream;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
@ -39,6 +26,22 @@ public class BCLBiome {
private float genChance = 1.0F; private float genChance = 1.0F;
private float edgeSize = 0.0F; private float edgeSize = 0.0F;
/**
* Create wrapper for existing biome using its {@link ResourceLocation} identifier.
* @param biomeID {@link ResourceLocation} biome ID.
*/
public BCLBiome(ResourceLocation biomeID) {
this(biomeID, BuiltinRegistries.BIOME.get(biomeID));
}
/**
* Create wrapper for existing biome using biome instance from {@link BuiltinRegistries}.
* @param biome {@link Biome} to wrap.
*/
public BCLBiome(Biome biome) {
this(BuiltinRegistries.BIOME.getKey(biome), biome);
}
public BCLBiome(ResourceLocation biomeID, Biome biome) { public BCLBiome(ResourceLocation biomeID, Biome biome) {
this.biomeID = biomeID; this.biomeID = biomeID;
this.biome = biome; this.biome = biome;
@ -56,10 +59,12 @@ public class BCLBiome {
/** /**
* Set biome edge for this biome instance. * Set biome edge for this biome instance.
* @param edge {@link BCLBiome} as the edge biome. * @param edge {@link BCLBiome} as the edge biome.
* @return same {@link BCLBiome}.
*/ */
public void setEdge(BCLBiome edge) { public BCLBiome setEdge(BCLBiome edge) {
this.edge = edge; this.edge = edge;
edge.biomeParent = this; edge.biomeParent = this;
return this;
} }
/** /**
@ -73,19 +78,23 @@ public class BCLBiome {
/** /**
* Set edges size for this biome. Size is in relative units to work fine with biome scale. * Set edges size for this biome. Size is in relative units to work fine with biome scale.
* @param size as a float value. * @param size as a float value.
* @return same {@link BCLBiome}.
*/ */
public void setEdgeSize(float size) { public BCLBiome setEdgeSize(float size) {
edgeSize = size; edgeSize = size;
return this;
} }
/** /**
* Adds sub-biome into this biome instance. Biome chance will be interpreted as a sub-biome generation chance. * Adds sub-biome into this biome instance. Biome chance will be interpreted as a sub-biome generation chance.
* Biome itself has chance 1.0 compared to all its sub-biomes. * Biome itself has chance 1.0 compared to all its sub-biomes.
* @param biome {@link Random} to be added. * @param biome {@link Random} to be added.
* @return same {@link BCLBiome}.
*/ */
public void addSubBiome(BCLBiome biome) { public BCLBiome addSubBiome(BCLBiome biome) {
biome.biomeParent = this; biome.biomeParent = this;
subbiomes.add(biome, biome.getGenChance()); subbiomes.add(biome, biome.getGenChance());
return this;
} }
/** /**
@ -115,32 +124,13 @@ public class BCLBiome {
return this.biomeParent; return this.biomeParent;
} }
/**
* Checks if this biome has edge biome.
* @return true if it has edge.
*/
@Deprecated(forRemoval = true)
public boolean hasEdge() {
return edge != null;
}
/**
* Checks if this biome has parent biome.
* @return true if it has parent.
*/
@Deprecated(forRemoval = true)
public boolean hasParentBiome() {
return biomeParent != null;
}
/** /**
* Compares biome instances (directly) and their parents. Used in custom world generator. * Compares biome instances (directly) and their parents. Used in custom world generator.
* @param biome {@link BCLBiome} * @param biome {@link BCLBiome}
* @return true if biome or its parent is same. * @return true if biome or its parent is same.
*/ */
@Deprecated(forRemoval = true)
public boolean isSame(BCLBiome biome) { public boolean isSame(BCLBiome biome) {
return biome == this || (biome.hasParentBiome() && biome.getParentBiome() == this); return biome == this || (biome.biomeParent != null && biome.biomeParent == this);
} }
/** /**
@ -183,6 +173,16 @@ public class BCLBiome {
return this.genChance; return this.genChance;
} }
/**
* Set gen chance for this biome, default value is 1.0.
* @param genChance chance of this biome to be generated.
* @return same {@link BCLBiome}.
*/
public BCLBiome setGenChance(float genChance) {
this.genChance = genChance;
return this;
}
/** /**
* Recursively update biomes to correct world biome registry instances, for internal usage only. * Recursively update biomes to correct world biome registry instances, for internal usage only.
* @param biomeRegistry {@link Registry} for {@link Biome}. * @param biomeRegistry {@link Registry} for {@link Biome}.
@ -225,17 +225,21 @@ public class BCLBiome {
* Adds custom data object to this biome instance. * Adds custom data object to this biome instance.
* @param name {@link String} name of data object. * @param name {@link String} name of data object.
* @param obj any data to add. * @param obj any data to add.
* @return same {@link BCLBiome}.
*/ */
public void addCustomData(String name, Object obj) { public BCLBiome addCustomData(String name, Object obj) {
customData.put(name, obj); customData.put(name, obj);
return this;
} }
/** /**
* Adds custom data object to this biome instance. * Adds custom data object to this biome instance.
* @param data a {@link Map} with custom data. * @param data a {@link Map} with custom data.
* @return same {@link BCLBiome}.
*/ */
public void addCustomData(Map<String, Object> data) { public BCLBiome addCustomData(Map<String, Object> data) {
customData.putAll(data); customData.putAll(data);
return this;
} }
/** /**

View file

@ -1,13 +1,23 @@
package ru.bclib.world.biomes; package ru.bclib.world.biomes;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.level.biome.Biome.BiomeBuilder;
import net.minecraft.world.level.biome.Biome.BiomeCategory; import net.minecraft.world.level.biome.Biome.BiomeCategory;
import net.minecraft.world.level.biome.Biome.Precipitation; import net.minecraft.world.level.biome.Biome.Precipitation;
import net.minecraft.world.level.biome.BiomeSpecialEffects;
import net.minecraft.world.level.biome.MobSpawnSettings;
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
import java.util.ArrayList;
import java.util.List;
public class BCLBiomeBuilder { public class BCLBiomeBuilder {
private static final BCLBiomeBuilder INSTANCE = new BCLBiomeBuilder(); private static final BCLBiomeBuilder INSTANCE = new BCLBiomeBuilder();
private List<SpawnerData> mobs = new ArrayList<>(32);
private BiomeSpecialEffects.Builder effectsBuilder;
private Precipitation precipitation; private Precipitation precipitation;
private ResourceLocation biomeID; private ResourceLocation biomeID;
private BiomeCategory category; private BiomeCategory category;
@ -23,7 +33,9 @@ public class BCLBiomeBuilder {
INSTANCE.biomeID = biomeID; INSTANCE.biomeID = biomeID;
INSTANCE.precipitation = Precipitation.NONE; INSTANCE.precipitation = Precipitation.NONE;
INSTANCE.category = BiomeCategory.NONE; INSTANCE.category = BiomeCategory.NONE;
INSTANCE.effectsBuilder = null;
INSTANCE.temperature = 1.0F; INSTANCE.temperature = 1.0F;
INSTANCE.mobs.clear();
return INSTANCE; return INSTANCE;
} }
@ -67,17 +79,46 @@ public class BCLBiomeBuilder {
return this; return this;
} }
/**
* Adds mob spawning to biome.
* @param entityType {@link EntityType} mob type.
* @param weight spawn weight.
* @param minGroupCount minimum mobs in group.
* @param maxGroupCount maximum mobs in group.
* @return
*/
public <M extends Mob> BCLBiomeBuilder spawn(EntityType<M> entityType, int weight, int minGroupCount, int maxGroupCount) {
mobs.add(new SpawnerData(entityType, weight, minGroupCount, maxGroupCount));
return this;
}
public BCLBiome build() { public BCLBiome build() {
Biome biome = new Biome.BiomeBuilder() BiomeBuilder builder = new BiomeBuilder()
.precipitation(precipitation) .precipitation(precipitation)
.biomeCategory(category) .biomeCategory(category)
.temperature(temperature) .temperature(temperature)
.downfall(downfall) .downfall(downfall);
/* /*
.specialEffects(effects.build())
.mobSpawnSettings(spawnSettings.build())
.generationSettings(generationSettings.build())*/ .generationSettings(generationSettings.build())*/
.build(); //.build();
return new BCLBiome(biomeID, biome);
if (!mobs.isEmpty()) {
MobSpawnSettings.Builder spawnSettings = new MobSpawnSettings.Builder();
mobs.forEach(spawn -> spawnSettings.addSpawn(spawn.type.getCategory(), spawn));
builder.mobSpawnSettings(spawnSettings.build());
}
if (effectsBuilder != null) {
builder.specialEffects(effectsBuilder.build());
}
return new BCLBiome(biomeID, builder.build());
}
private BiomeSpecialEffects.Builder getEffects() {
if (effectsBuilder == null) {
effectsBuilder = new BiomeSpecialEffects.Builder();
}
return effectsBuilder;
} }
} }

View file

@ -53,12 +53,12 @@ public class BCLibEndBiomeSource extends BiomeSource {
this.possibleBiomes().forEach(biome -> { this.possibleBiomes().forEach(biome -> {
ResourceLocation key = biomeRegistry.getKey(biome); ResourceLocation key = biomeRegistry.getKey(biome);
if (!BiomeAPI.hasBiome(key)) { if (!BiomeAPI.hasBiome(key)) {
BCLBiome bclBiome = new BCLBiome(key, biome, 1, 1); BCLBiome bclBiome = new BCLBiome(key, biome);
BiomeAPI.END_LAND_BIOME_PICKER.addBiomeMutable(bclBiome); BiomeAPI.END_LAND_BIOME_PICKER.addBiomeMutable(bclBiome);
} }
else { else {
BCLBiome bclBiome = BiomeAPI.getBiome(key); BCLBiome bclBiome = BiomeAPI.getBiome(key);
if (bclBiome != BiomeAPI.EMPTY_BIOME && !bclBiome.hasParentBiome()) { if (bclBiome != BiomeAPI.EMPTY_BIOME && bclBiome.getParentBiome() == null) {
if (!BiomeAPI.END_LAND_BIOME_PICKER.containsImmutable(key) && !BiomeAPI.END_VOID_BIOME_PICKER.containsImmutable(key)) { if (!BiomeAPI.END_LAND_BIOME_PICKER.containsImmutable(key) && !BiomeAPI.END_VOID_BIOME_PICKER.containsImmutable(key)) {
BiomeAPI.END_LAND_BIOME_PICKER.addBiomeMutable(bclBiome); BiomeAPI.END_LAND_BIOME_PICKER.addBiomeMutable(bclBiome);
} }
@ -105,7 +105,7 @@ public class BCLibEndBiomeSource extends BiomeSource {
BCLBiome bclBiome = BiomeAPI.getBiome(key); BCLBiome bclBiome = BiomeAPI.getBiome(key);
if (bclBiome != BiomeAPI.EMPTY_BIOME) { if (bclBiome != BiomeAPI.EMPTY_BIOME) {
if (bclBiome.hasParentBiome()) { if (bclBiome.getParentBiome() != null) {
bclBiome = bclBiome.getParentBiome(); bclBiome = bclBiome.getParentBiome();
} }
key = bclBiome.getID(); key = bclBiome.getID();

View file

@ -42,12 +42,12 @@ public class BCLibNetherBiomeSource extends BiomeSource {
this.possibleBiomes().forEach(biome -> { this.possibleBiomes().forEach(biome -> {
ResourceLocation key = biomeRegistry.getKey(biome); ResourceLocation key = biomeRegistry.getKey(biome);
if (!BiomeAPI.hasBiome(key)) { if (!BiomeAPI.hasBiome(key)) {
BCLBiome bclBiome = new BCLBiome(key, biome, 1, 1); BCLBiome bclBiome = new BCLBiome(key, biome);
BiomeAPI.NETHER_BIOME_PICKER.addBiomeMutable(bclBiome); BiomeAPI.NETHER_BIOME_PICKER.addBiomeMutable(bclBiome);
} }
else { else {
BCLBiome bclBiome = BiomeAPI.getBiome(key); BCLBiome bclBiome = BiomeAPI.getBiome(key);
if (bclBiome != BiomeAPI.EMPTY_BIOME && !bclBiome.hasParentBiome()) { if (bclBiome != BiomeAPI.EMPTY_BIOME && bclBiome.getParentBiome() == null) {
if (!BiomeAPI.NETHER_BIOME_PICKER.containsImmutable(key)) { if (!BiomeAPI.NETHER_BIOME_PICKER.containsImmutable(key)) {
BiomeAPI.NETHER_BIOME_PICKER.addBiomeMutable(bclBiome); BiomeAPI.NETHER_BIOME_PICKER.addBiomeMutable(bclBiome);
} }
@ -82,7 +82,7 @@ public class BCLibNetherBiomeSource extends BiomeSource {
BCLBiome bclBiome = BiomeAPI.getBiome(key); BCLBiome bclBiome = BiomeAPI.getBiome(key);
if (bclBiome != BiomeAPI.EMPTY_BIOME) { if (bclBiome != BiomeAPI.EMPTY_BIOME) {
if (bclBiome.hasParentBiome()) { if (bclBiome.getParentBiome() != null) {
bclBiome = bclBiome.getParentBiome(); bclBiome = bclBiome.getParentBiome();
} }
key = bclBiome.getID(); key = bclBiome.getID();

View file

@ -87,9 +87,9 @@ public class BiomeMap {
public BCLBiome getBiome(int x, int z) { public BCLBiome getBiome(int x, int z) {
BCLBiome biome = getRawBiome(x, z); BCLBiome biome = getRawBiome(x, z);
if (biome.hasEdge() || (biome.hasParentBiome() && biome.getParentBiome().hasEdge())) { if (biome.getEdge() != null || (biome.getParentBiome() != null && biome.getParentBiome().getEdge() != null)) {
BCLBiome search = biome; BCLBiome search = biome;
if (biome.hasParentBiome()) { if (biome.getParentBiome() != null) {
search = biome.getParentBiome(); search = biome.getParentBiome();
} }
int d = (int) Math.ceil(search.getEdgeSize() / 4F) << 2; int d = (int) Math.ceil(search.getEdgeSize() / 4F) << 2;