Small fix, cleanup

This commit is contained in:
paulevsGitch 2021-12-01 14:52:21 +03:00
parent 211d0fc751
commit 72e29223a1
4 changed files with 47 additions and 38 deletions

View file

@ -3,6 +3,7 @@ package ru.bclib.world.biomes;
import com.google.common.collect.Maps;
import net.minecraft.core.Registry;
import net.minecraft.data.BuiltinRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome;
import org.jetbrains.annotations.Nullable;
@ -26,6 +27,14 @@ public class BCLBiome {
private float genChance = 1.0F;
private float edgeSize = 0.0F;
/**
* Create wrapper for existing biome using its {@link ResourceLocation} identifier.
* @param biomeKey {@link ResourceKey} for the {@link Biome}.
*/
public BCLBiome(ResourceKey<Biome> biomeKey) {
this(biomeKey.location());
}
/**
* Create wrapper for existing biome using its {@link ResourceLocation} identifier.
* @param biomeID {@link ResourceLocation} biome ID.
@ -43,6 +52,7 @@ public class BCLBiome {
}
public BCLBiome(ResourceLocation biomeID, Biome biome) {
this.subbiomes.add(this, 1.0F);
this.biomeID = biomeID;
this.biome = biome;
}

View file

@ -65,7 +65,7 @@ public class HexBiomeChunk {
}
for (short index = 0; index < SIZE; index++) {
if (random.nextInt(4) == 0) {
if (outBuffer[index] != null && random.nextInt(4) == 0) {
circle(outBuffer, index, outBuffer[index].getSubBiome(random), outBuffer[index]);
}
}