biome fixes + refactoring, blackened

This commit is contained in:
Sen 2025-04-14 12:35:45 +02:00
parent 6d912ae7ac
commit 1834c26b72
41 changed files with 296 additions and 328 deletions

View file

@ -176,18 +176,15 @@ public class BiomeGenLayered implements BiomeGenerator {
int[] aint = this.biomeIndexLayer.getInts(x, z, width, length);
for(int i = 0; i < width * length; ++i) {
Biome biome = Biome.getBiomeFromBiomeList(aint[i], Biome.DEF_BIOME);
float f = biome.humidity * biome.temperature;
if(f > 1.0F)
f = 1.0F;
listToReuse[i] = (double)f;
Biome biome = Biome.getBiome(aint[i], Biome.DEF_BIOME);
listToReuse[i] = (double)biome.getFactor();
}
}
public void genFactors(double[] factors, int xPos, int zPos, int sizeX, int sizeZ) {
IntCache.resetIntCache();
if(true && sizeX == 16 && sizeZ == 16 && (xPos & 15) == 0 && (zPos & 15) == 0) {
if(sizeX == 16 && sizeZ == 16 && (xPos & 15) == 0 && (zPos & 15) == 0) {
double[] cachedFacts = this.getBiomeCacheBlock(xPos, zPos).factors;
System.arraycopy(cachedFacts, 0, factors, 0, sizeX * sizeZ);
}
@ -195,11 +192,8 @@ public class BiomeGenLayered implements BiomeGenerator {
int[] aint = this.biomeIndexLayer.getInts(xPos, zPos, sizeX, sizeZ);
for(int i = 0; i < sizeX * sizeZ; ++i) {
Biome biome = Biome.getBiomeFromBiomeList(aint[i], Biome.DEF_BIOME);
float f = biome.humidity * biome.temperature;
if(f > 1.0F)
f = 1.0F;
factors[i] = (double)f;
Biome biome = Biome.getBiome(aint[i], Biome.DEF_BIOME);
factors[i] = (double)biome.getFactor();
}
}
}
@ -210,7 +204,7 @@ public class BiomeGenLayered implements BiomeGenerator {
int[] aint = this.genBiomes.getInts(x, z, width, height);
for(int i = 0; i < width * height; ++i) {
biomes[i] = Biome.getBiomeFromBiomeList(aint[i], Biome.DEF_BIOME);
biomes[i] = Biome.getBiome(aint[i], Biome.DEF_BIOME);
}
}
@ -229,7 +223,7 @@ public class BiomeGenLayered implements BiomeGenerator {
int[] aint = this.biomeIndexLayer.getInts(x, z, width, length);
for(int i = 0; i < width * length; ++i) {
listToReuse[i] = Biome.getBiomeFromBiomeList(aint[i], Biome.DEF_BIOME);
listToReuse[i] = Biome.getBiome(aint[i], Biome.DEF_BIOME);
}
}
}

View file

@ -42,6 +42,6 @@ public class BiomeGenSingle implements BiomeGenerator {
}
public void genFactors(double[] factors, int xPos, int zPos, int sizeX, int sizeZ) {
Arrays.fill(factors, 0, sizeX * sizeZ, this.biome.humidity * this.biome.temperature);
Arrays.fill(factors, 0, sizeX * sizeZ, this.biome.getFactor());
}
}

View file

@ -203,8 +203,8 @@ public class GeneratorPerlin implements ChunkGenerator
for (int b = -range; b <= range; ++b)
{
Biome biome2 = this.biomes[u + a + 2 + (v + b + 2) * 10];
float bmin = this.biomeDepthOffset + biome2.minHeight * this.biomeDepthWeight;
float bmax = this.biomeScaleOffset + biome2.maxHeight * this.biomeScaleWeight;
float bmin = this.biomeDepthOffset + biome2.depth * this.biomeDepthWeight;
float bmax = this.biomeScaleOffset + biome2.scale * this.biomeScaleWeight;
if (this.amplification > 0.0F && bmin > 0.0F)
{
@ -214,7 +214,7 @@ public class GeneratorPerlin implements ChunkGenerator
float fact = PARABOLIC[a + 2 + (b + 2) * 5] / (bmin + 2.0F);
if (biome2.minHeight > biome.minHeight)
if (biome2.depth > biome.depth)
{
fact /= 2.0F;
}

View file

@ -1,6 +1,6 @@
package game.worldgen;
import game.biome.Biome;
import game.biome.RngSpawn;
import game.color.DyeColor;
import game.entity.npc.EntityDarkMage;
import game.entity.npc.EntityMage;
@ -95,8 +95,8 @@ public abstract class LootConstants {
new RngLoot(Items.wood_axe, 0, 1, 1, 5), new RngLoot(Items.stone_pickaxe, 0, 1, 1, 3), new RngLoot(Items.wood_pickaxe, 0, 1, 1, 5),
new RngLoot(Items.apple, 0, 2, 3, 5), new RngLoot(Items.bread, 0, 2, 3, 3),
new RngLoot(ItemRegistry.getItemFromBlock(Blocks.acacia_log), 0, 1, 3, 10));
public static final WeightedList<Biome.RngSpawn> MAGEHUT_MOBS = new WeightedList<Biome.RngSpawn>(new Biome.RngSpawn(EntityMage.class, 1, 1, 1));
public static final WeightedList<Biome.RngSpawn> FORTRESS_MOBS = new WeightedList<Biome.RngSpawn>(new Biome.RngSpawn(EntityDarkMage.class, 10, 2, 3),
new Biome.RngSpawn(EntityTiefling.class, 5, 4, 4), new Biome.RngSpawn(EntityUndead.class, 10, 4, 4),
new Biome.RngSpawn(EntityMagma.class, 3, 4, 4));
public static final WeightedList<RngSpawn> MAGEHUT_MOBS = new WeightedList<RngSpawn>(new RngSpawn(EntityMage.class, 1, 1, 1));
public static final WeightedList<RngSpawn> FORTRESS_MOBS = new WeightedList<RngSpawn>(new RngSpawn(EntityDarkMage.class, 10, 2, 3),
new RngSpawn(EntityTiefling.class, 5, 4, 4), new RngSpawn(EntityUndead.class, 10, 4, 4),
new RngSpawn(EntityMagma.class, 3, 4, 4));
}

View file

@ -1,6 +1,7 @@
package game.worldgen.layer;
import game.biome.Biome;
import game.biome.Temperature;
public class GenLayerBiomeEdge extends GenLayer
{
@ -153,9 +154,9 @@ public class GenLayerBiomeEdge extends GenLayer
if (biomegenbase != null && biomegenbase1 != null)
{
Biome.TempCategory biomegenbase$tempcategory = biomegenbase.getTempCategory();
Biome.TempCategory biomegenbase$tempcategory1 = biomegenbase1.getTempCategory();
return biomegenbase$tempcategory == biomegenbase$tempcategory1 || biomegenbase$tempcategory == Biome.TempCategory.MEDIUM || biomegenbase$tempcategory1 == Biome.TempCategory.MEDIUM;
Temperature biomegenbase$tempcategory = biomegenbase.getTempCategory();
Temperature biomegenbase$tempcategory1 = biomegenbase1.getTempCategory();
return biomegenbase$tempcategory == biomegenbase$tempcategory1 || biomegenbase$tempcategory == Temperature.MEDIUM || biomegenbase$tempcategory1 == Temperature.MEDIUM;
}
else
{

View file

@ -66,13 +66,13 @@ public class GenLayerShore extends GenLayer
}
else if (id != Biome.extremeHills.id && id != Biome.extremeHillsPlus.id && id != Biome.extremeHillsEdge.id)
{
if (biome != null && biome.snowyGen)
if (biome != null && biome.allowColdBeach)
{
this.putBeach(pre, data, j, i, width, id, Biome.coldBeach.id);
}
else // if (id != Biome.mesa.id && id != Biome.mesaPlateau_F.id)
// {
if (biome != null && !biome.waterGen)
if (biome != null && !biome.disallowBeach)
{
int l1 = pre[j + 1 + (i + 1 - 1) * (width + 2)];
int k2 = pre[j + 1 + 1 + (i + 1) * (width + 2)];