pre genlayer rework

This commit is contained in:
Sen 2025-07-22 21:20:06 +02:00
parent 0525ba5d56
commit 0f128c1b1b
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
112 changed files with 2464 additions and 3353 deletions

View file

@ -1,194 +1,149 @@
package common.biome;
import java.util.List;
import java.util.Map;
import common.collect.Lists;
import common.collect.Maps;
import common.log.Log;
import common.rng.PerlinGen;
import common.rng.Random;
import common.util.BlockPos;
import common.util.Displayable;
import common.util.Identifyable;
public enum Biome implements Identifyable, Displayable {
NONE("none", "<Keins>", 0x000000),
PLAIN("plain", "Ebene", 0x8db360, 12.0f, 40.0f),
DESERT("desert", "Wüste", 0xfa9418, 60.0f, 0.0f),
HILLS("hills", "Bergland", 0x606060, -12.0f, 30.0f),
FOREST("forest", "Wald", 0x056621, 8.0f, 80.0f),
TAIGA("taiga", "Taiga", 0x0b6659, -10.0f, 80.0f),
SWAMP("swamp", "Sumpf", 0x07f9b2, 12.0f, 90.0f),
RIVER("river", "Fluss", 0x0000ff),
EXTERMINATED("exterminated", "Ausgelöscht", 0x000000, 150.0f, 0.0f),
SPACE("space", "Leere des Weltraums", 0x000000, 0.0f, 0.0f),
ICE_SEA("ice_sea", "Vereister See", 0x9090a0, -20.0f),
ICE_RIVER("ice_river", "Vereister Fluss", 0xa0a0ff, -20.0f),
ICE("ice", "Eisebene", 0xffffff, -20.0f),
ICE_HILLS("ice_hills", "Vereistes Bergland", 0xa0a0a0, -20.0f),
MUSHROOM("mushroom", "Pilzland", 0xff00ff, 16.0f, 100.0f),
BLACKENED("blackened", "Schwarz", 0x000000, 0.0f, 0.0f),
BEACH("beach", "Strand", 0xfade55, 12.0f, 40.0f),
DESERT_HILLS("desert_hills", "Wüsten-Bergland", 0xd25f12, 60.0f, 0.0f),
FOREST_HILLS("forest_hills", "Wald-Bergland", 0x22551c, 8.0f, 80.0f),
TAIGA_HILLS("taiga_hills", "Taiga-Bergland", 0x163933, -10.0f, 80.0f),
HILLS_EDGE("hills_edge", "Bergland-Grenze", 0x72789a, -12.0f, 30.0f),
TROPIC("tropic", "Urwald", 0x537b09, 18.0f, 90.0f),
TROPIC_HILLS("tropic_hills", "Urwald-Bergland", 0x2c4205, 18.0f, 90.0f),
TROPIC_EDGE("tropic_edge", "Urwald-Grenze", 0x628b17, 18.0f, 80.0f),
SEA("sea", "See", 0x000070),
STONE_BEACH("stone_beach", "Steinstrand", 0xa2a284, -12.0f, 30.0f),
ICE_BEACH("ice_beach", "Vereister Strand", 0xfaf0c0, -18.0f, 30.0f),
BIRCH_FOREST("birch_forest", "Birkenwald", 0x307444, 4.0f, 60.0f),
BIRCH_HILLS("birch_hills", "Birken-Bergland", 0x1f5f32, 4.0f, 60.0f),
DARK_FOREST("dark_forest", "Dichter Wald", 0x40511a, 8.0f, 80.0f),
ICE_TAIGA("ice_taiga", "Vereiste Taiga", 0x31554a, -40.0f, 40.0f),
ICE_TAIGA_HILLS("ice_taiga_hills", "Vereistes Taiga-Bergland", 0x243f36, -40.0f, 40.0f),
LARGE_TAIGA("large_taiga", "Hohe Taiga", 0x596651, -8.0f, 80.0f),
LARGE_TAIGA_HILLS("large_taiga_hills", "Hohes Taiga-Bergland", 0x454f3e, -8.0f, 80.0f),
LARGE_HILLS("large_hills", "Hohes Bergland", 0x507050, -12.0f, 30.0f),
SAVANNA("savanna", "Savanne", 0xbdb25f, 28.0f, 0.0f),
SAVANNA_PLATEAU("savanna_plateau", "Savannen-Plateau", 0xa79d64, 20.0f, 0.0f),
MESA("mesa", "Mesa", 0xd94515, 0.0f, 0.0f),
MESA_FOREST("mesa_forest", "Mesa-Wald", 0xb09765, 0.0f, 0.0f),
MESA_PLATEAU("mesa_plateau", "Mesa-Plateau", 0xca8c65, 0.0f, 0.0f),
SNOW("snow", "Eisland", 0xffffff, 0.0f, 100.0f),
TIAN("tian", "Tian", 0x808080, 0.0f, 80.0f),
ELVEN_FOREST("elven_forest", "Elbenwald", 0x059821, 8.0f, 90.0f),
UPPER_HELL("upper_hell", "Übergang in die Hölle", 0xff0000, 0.0f, 0.0f),
LOWER_HELL("lower_hell", "Abgrund der Hölle", 0xff0000, 0.0f, 0.0f),
HELL_HILLS("hell_hills", "Bergland der Hölle", 0xff0000, 0.0f, 0.0f),
SOUL_PLAINS("soul_plains", "Seelenland", 0xff0000, 0.0f, 0.0f),
ASH("ash", "Verbrannt", 0xff0000, 0.0f, 0.0f),
MOON("moon", "Mondoberfläche", 0xa0a0a0, 0.0f, 0.0f),
CHAOS("chaos", "Chaos", 0xff00ff),
public class Biome {
public static final Biome NONE = new Biome(0.0f, 50.0f).setSea();
public static final Biome PLAIN = new Biome(12.0f, 40.0f).setScaling(Scaling.PLAINS_LOW);
public static final Biome DESERT = new Biome(60.0f, 0.0f).setScaling(Scaling.PLAINS_LOW);
public static final Biome HILLS = new Biome(-12.0f, 30.0f).setScaling(Scaling.HILLS_LARGE);
public static final Biome FOREST = new Biome(8.0f, 80.0f);
public static final Biome TAIGA = new Biome(-10.0f, 80.0f).setScaling(Scaling.PLAINS_MEDIUM);
public static final Biome SWAMP = new Biome(12.0f, 90.0f).setScaling(Scaling.SEA_POND).disableBeach();
public static final Biome RIVER = new Biome(0.0f, 50.0f).setScaling(Scaling.SEA_SHALLOW).disableBeach();
public static final Biome ICE_SEA = new Biome(-20.0f, 50.0f).enableColdBeach().setScaling(Scaling.SEA_MEDIUM).setSea().disableBeach();
public static final Biome ICE_RIVER = new Biome(-20.0f, 50.0f).enableColdBeach().setScaling(Scaling.SEA_SHALLOW).disableBeach();
public static final Biome ICE = new Biome(-20.0f, 50.0f).enableColdBeach().setScaling(Scaling.PLAINS_LOW);
public static final Biome ICE_HILLS = new Biome(-20.0f, 50.0f).enableColdBeach().setScaling(Scaling.HILLS_LOW);
public static final Biome BEACH = new Biome(12.0f, 40.0f).setScaling(Scaling.SEA_SHORE);
public static final Biome DESERT_HILLS = new Biome(60.0f, 0.0f).setScaling(Scaling.HILLS_LOW);
public static final Biome FOREST_HILLS = new Biome(8.0f, 80.0f).setScaling(Scaling.HILLS_LOW);
public static final Biome TAIGA_HILLS = new Biome(-10.0f, 80.0f).setScaling(Scaling.HILLS_LOW);
public static final Biome HILLS_EDGE = new Biome(-12.0f, 30.0f).setScaling(Scaling.HILLS_MEDIUM);
public static final Biome TROPIC = new Biome(18.0f, 90.0f).setTropical();
public static final Biome TROPIC_HILLS = new Biome(18.0f, 90.0f).setTropical().setScaling(Scaling.HILLS_LOW);
public static final Biome TROPIC_EDGE = new Biome(18.0f, 80.0f).setTropical();
public static final Biome SEA = new Biome(0.0f, 50.0f).setScaling(Scaling.SEA_MEDIUM).setSea().disableBeach();
public static final Biome STONE_BEACH = new Biome(-12.0f, 30.0f).setScaling(Scaling.SEA_VARYING);
public static final Biome ICE_BEACH = new Biome(-18.0f, 30.0f).setScaling(Scaling.SEA_SHORE).enableColdBeach();
public static final Biome BIRCH_FOREST = new Biome(4.0f, 60.0f);
public static final Biome BIRCH_HILLS = new Biome(4.0f, 60.0f).setScaling(Scaling.HILLS_LOW);
public static final Biome DARK_FOREST = new Biome(8.0f, 80.0f);
public static final Biome ICE_TAIGA = new Biome(-40.0f, 40.0f).enableColdBeach().setScaling(Scaling.PLAINS_MEDIUM);
public static final Biome ICE_TAIGA_HILLS = new Biome(-40.0f, 40.0f).enableColdBeach().setScaling(Scaling.HILLS_LOW);
public static final Biome LARGE_TAIGA = new Biome(-8.0f, 80.0f).setScaling(Scaling.PLAINS_MEDIUM);
public static final Biome LARGE_TAIGA_HILLS = new Biome(-8.0f, 80.0f).setScaling(Scaling.HILLS_LOW);
public static final Biome LARGE_HILLS = new Biome(-12.0f, 30.0f).setScaling(Scaling.HILLS_LARGE);
public static final Biome SAVANNA = new Biome(28.0f, 0.0f).setScaling(Scaling.PLAINS_LOW);
public static final Biome SAVANNA_PLATEAU = new Biome(20.0f, 0.0f).setScaling(Scaling.HILLS_PLATEAU);
DESERT_MOD("desert_mod", "Wüste M", 0xfa9418, 60.0f, 0.0f),
HILLS_MOD("hills_mod", "Bergland M", 0x606060, -12.0f, 30.0f),
FLOWER_FOREST("flower_forest", "Blumenwald", 0x6a7425, 8.0f, 80.0f),
TAIGA_MOD("taiga_mod", "Taiga M", 0x0b6659, -10.0f, 80.0f),
SWAMP_MOD("swamp_mod", "Sumpf M", 0x07f9b2, 12.0f, 90.0f),
ICE_SPIKES("ice_spikes", "Eisebene mit Spitzen", 0xd2ffff, -20.0f),
TROPIC_MOD("tropic_mod", "Urwald M", 0x537b09, 18.0f, 90.0f),
TROPIC_EDGE_MOD("propic_edge_mod", "Urwald-Grenze M", 0x628b17, 18.0f, 80.0f),
BIRCH_FOREST_MOD("birch_forest_mod", "Birkenwald M", 0x307444, 4.0f, 60.0f),
BIRCH_HILLS_MOD("birch_hills_mod", "Birken-Bergland M", 0x1f5f32, 4.0f, 60.0f),
DARK_FOREST_MOD("dark_forest_mod", "Dichter Wald M", 0x40511a, 8.0f, 80.0f),
ICE_TAIGA_MOD("ice_taiga_mod", "Vereiste Taiga M", 0x31554a, -40.0f, 40.0f),
SPRUCE_TAIGA("spruce_taiga", "Fichtentaiga", 0x596651, -10.0f, 80.0f),
REDWOOD_TAIGA("redwood_taiga", "Mammutbaumtaiga", 0x596651, -10.0f, 80.0f),
LARGE_HILLS_MOD("large_hills_mod", "Hohes Bergland M", 0x507050, -12.0f, 30.0f),
SAVANNA_MOD("savanna_mod", "Savanne M", 0xbdb25f, 24.0f, 0.0f),
SAVANNA_PLATEAU_MOD("savanna_plateau_mod", "Savannen-Plateau M", 0xa79d64, 20.0f, 0.0f),
MESA_PEAK("mesa_peak", "Mesa-Spitze", 0xd94515, 0.0f, 0.0f),
MESA_FOREST_MOD("mesa_forest_mod", "Mesa-Wald M", 0xb09765, 0.0f, 0.0f),
MESA_PLATEAU_MOD("mesa_plateau_mod", "Mesa-Plateau M", 0xca8c65, 0.0f, 0.0f);
public static final Biome DESERT_MOD = DESERT.mutate(60.0f, 0.0f);
public static final Biome HILLS_MOD = HILLS.mutate(new Biome(-12.0f, 30.0f).setScaling(HILLS.depth, HILLS.scale));
public static final Biome FLOWER_FOREST = FOREST.mutate(new Biome(8.0f, 80.0f).setScaling(FOREST.depth, FOREST.scale + 0.2F));
public static final Biome TAIGA_MOD = TAIGA.mutate(-10.0f, 80.0f);
public static final Biome SWAMP_MOD = SWAMP.mutate(12.0f, 90.0f);
public static final Biome ICE_SPIKES = ICE.mutate(new Biome(-20.0f, 50.0f).enableColdBeach().setScaling(ICE.depth + 0.3F, ICE.scale + 0.4F));
public static final Biome TROPIC_MOD = TROPIC.mutate(18.0f, 90.0f);
public static final Biome TROPIC_EDGE_MOD = TROPIC_EDGE.mutate(18.0f, 80.0f);
public static final Biome BIRCH_FOREST_MOD = BIRCH_FOREST.mutate(4.0f, 60.0f);
public static final Biome BIRCH_HILLS_MOD = BIRCH_HILLS.mutate(4.0f, 60.0f);
public static final Biome DARK_FOREST_MOD = DARK_FOREST.mutate(8.0f, 80.0f);
public static final Biome ICE_TAIGA_MOD = ICE_TAIGA.mutate(-40.0f, 40.0f);
public static final Biome SPRUCE_TAIGA = LARGE_TAIGA.mutate((new Biome(-10.0f, 80.0f)).setScaling(LARGE_TAIGA.depth, LARGE_TAIGA.scale));
public static final Biome REDWOOD_TAIGA = LARGE_TAIGA.mutate(-10.0f, 80.0f);
public static final Biome LARGE_HILLS_MOD = LARGE_HILLS.mutate(new Biome(-12.0f, 30.0f).setScaling(LARGE_HILLS.depth, LARGE_HILLS.scale));
public static final Biome SAVANNA_MOD = SAVANNA.mutate(new Biome(24.0f, 0.0f, SAVANNA).setScaling(SAVANNA.depth * 0.5F + 0.3F, SAVANNA.scale * 0.5F + 1.2F));
public static final Biome SAVANNA_PLATEAU_MOD = SAVANNA_PLATEAU.mutate(new Biome(20.0f, 0.0f, SAVANNA_PLATEAU).setScaling(SAVANNA_PLATEAU.depth * 0.5F + 0.3F, SAVANNA_PLATEAU.scale * 0.5F + 1.2F));
public static final Biome DEF_BIOME = FOREST;
private static final PerlinGen TEMP_NOISE = new PerlinGen(new Random(836430928262265276L), 1);
private static final Biome[] BIOMES = new Biome[256];
private static final Map<String, Biome> LOOKUP = Maps.newTreeMap();
public final int id;
public final String name;
public final String display;
public final int color;
public int id;
public final float temperature;
public final float humidity;
static {
for(Biome biome : values()) {
BIOMES[biome.id] = biome;
if(LOOKUP.containsKey(biome.name))
throw new IllegalStateException("Biom \"" + biome.name + "\" ist als ID " + LOOKUP.get(biome.name).id + " und " + biome.id + " definiert");
LOOKUP.put(biome.name, biome);
}
}
public static Biome getBiome(int id)
{
if (id >= 0 && id < BIOMES.length)
{
return BIOMES[id];
}
else
{
Log.TICK.warn("Biom-ID ist nicht im Bereich: " + id + ", verwende " + DEF_BIOME.id + " (" + DEF_BIOME.name + ")");
return DEF_BIOME;
}
}
public static Biome getBiomeDef(int id)
{
if (id >= 0 && id < BIOMES.length)
{
Biome biome = BIOMES[id];
return biome == null ? DEF_BIOME : biome;
}
else
{
Log.TICK.warn("Biom-ID ist nicht im Bereich: " + id + ", verwende " + DEF_BIOME.id + " (" + DEF_BIOME.name + ")");
return DEF_BIOME;
}
}
public static List<String> getBiomeNames() {
return Lists.newArrayList(LOOKUP.keySet());
}
protected Biome baseBiome;
public Biome mutated = null;
public float depth = Scaling.VARYING_LOW.depth;
public float scale = Scaling.VARYING_LOW.scale;
public float factor;
public boolean allowColdBeach = false;
public boolean disallowBeach = false;
public boolean tropical = false;
public Temperature category;
public static Biome findByName(String name) {
Biome biome = LOOKUP.get(name.toLowerCase().replace(" ", "").replace("_", ""));
if(biome == null) {
int z;
try {
z = Integer.parseInt(name);
}
catch(NumberFormatException e) {
return DEF_BIOME;
}
return z < 0 || z >= BIOMES.length || BIOMES[z] == null ? DEF_BIOME : BIOMES[z];
}
return biome;
}
private Biome(String name, String display, int color, float temperature, float humidity) {
this.id = this.ordinal();
this.name = name;
this.display = display;
public Biome(float temperature, float humidity) {
BIOMES[id] = this;
this.id = id;
this.temperature = temperature;
this.humidity = humidity;
this.color = color;
}
private Biome(String name, String display, int color, float temperature) {
this(name, display, color, temperature, 50.0f);
}
private Biome(String name, String display, int color) {
this(name, display, color, 0.0f, 50.0f);
}
public final float getTemperature(BlockPos pos) {
if(pos.getY() > 64) {
float f = (float)(TEMP_NOISE.generate((double)pos.getX() * 1.0D / 8.0D, (double)pos.getZ() * 1.0D / 8.0D) * 4.0D);
return this.temperature - (f + (float)pos.getY() - 64.0F) / 15.0f;
}
return this.temperature;
this.category = temperature < -12.0f ? Temperature.COLD : (temperature < 20.0f ? Temperature.MEDIUM : Temperature.WARM);
this.factor = Math.min(humidity * 0.01f * ((temperature + 14.0f) / 40.0f + 0.15f), 1.0f);
}
public float getFactor() {
float f = this.humidity * 0.01f * ((this.temperature + 14.0f) / 40.0f + 0.15f);
return f > 1.0f ? 1.0f : f;
public Biome(float temperature, float humidity, Biome biome)
{
this(temperature, humidity);
this.baseBiome = biome;
this.allowColdBeach = biome.allowColdBeach;
this.tropical = biome.tropical;
this.disallowBeach = biome.disallowBeach;
this.depth = biome.depth + 0.1F;
this.scale = biome.scale + 0.2F;
this.category = biome.category;
this.factor = biome.factor;
}
// skycolor = ((temp + 14) / 40 + 0.15) / 3
public String getName() {
return this.name;
}
protected final Biome setScaling(Scaling scaling)
{
return this.setScaling(scaling.depth, scaling.scale);
}
public String getDisplay() {
return this.display;
}
protected final Biome setScaling(float depth, float scale)
{
this.depth = depth;
this.scale = scale;
return this;
}
protected Biome enableColdBeach()
{
this.allowColdBeach = true;
return this;
}
protected Biome disableBeach()
{
this.disallowBeach = true;
return this;
}
protected Biome setTropical()
{
this.tropical = true;
return this;
}
protected Biome setSea()
{
this.category = Temperature.SEA;
return this;
}
private Biome mutate(Biome mutated)
{
return this.mutated = mutated;
}
private Biome mutate(float temperature, float humidity)
{
return this.mutated = new Biome(temperature, humidity, this);
}
public Class <? extends Biome > getBiomeClass()
{
return this.baseBiome != null ? this.baseBiome.getBiomeClass() : this.getClass();
}
public boolean isEqualTo(Biome biome)
{
return this.baseBiome != null ? this.baseBiome.isEqualTo(biome) : (biome == this || (biome != null && this.getBiomeClass() == biome.getBiomeClass()));
}
}

View file

@ -1,47 +0,0 @@
package common.biome;
import common.init.BlockRegistry;
import common.rng.Random;
import common.util.BlockPos;
import common.world.AWorldServer;
import common.world.State;
public interface IBiome {
public static abstract class BiomeProvider {
private static BiomeProvider provider = new BiomeProvider() {
public IBiome getBiome(Biome base) {
return new IBiome() {
public State getFiller() {
return BlockRegistry.byName("air").getState();
}
public State getTop() {
return BlockRegistry.byName("air").getState();
}
public void growGrass(AWorldServer worldIn, BlockPos pos, State state, Random rand) {
}
public boolean generateBigMushroom(AWorldServer worldIn, BlockPos pos, State state, Random rand) {
return false;
}
public void generateTree(AWorldServer worldIn, BlockPos pos, State state, Random rand) {
}
};
}
};
public abstract IBiome getBiome(Biome base);
}
public static void setProvider(BiomeProvider provider) {
BiomeProvider.provider = provider;
}
public static IBiome getBiome(Biome base) {
return BiomeProvider.provider.getBiome(base);
}
void growGrass(AWorldServer worldIn, BlockPos pos, State state, Random rand);
boolean generateBigMushroom(AWorldServer worldIn, BlockPos pos, State state, Random rand);
void generateTree(AWorldServer worldIn, BlockPos pos, State state, Random rand);
State getFiller();
State getTop();
}

View file

@ -0,0 +1,28 @@
package common.biome;
public enum Scaling {
VARYING_LOW(0.1F, 0.2F),
VARYING_MEDIUM(0.1F, 1.0F),
VARYING_CHAOTIC(1.0F, 2.0F),
SEA_VARYING(0.1F, 0.8F),
SEA_SHORE(0.0F, 0.025F),
SEA_POND(-0.2F, 0.1F),
SEA_SHALLOW(-0.5F, 0.0F),
SEA_MEDIUM(-1.0F, 0.1F),
SEA_DEEP(-1.8F, 0.1F),
PLAINS_LOW(0.125F, 0.05F),
PLAINS_MEDIUM(0.2F, 0.2F),
PLAINS_VARYING(0.2F, 0.3F),
HILLS_LOW(0.45F, 0.3F),
HILLS_MEDIUM(0.8F, 0.3F),
HILLS_LARGE(1.0F, 0.5F),
HILLS_PLATEAU(1.5F, 0.025F);
public final float depth;
public final float scale;
private Scaling(float depth, float scale) {
this.depth = depth;
this.scale = scale;
}
}

View file

@ -0,0 +1,5 @@
package common.biome;
public enum Temperature {
SEA, COLD, MEDIUM, WARM;
}

View file

@ -15,7 +15,6 @@ import java.util.function.Function;
import common.attributes.Attribute;
import common.attributes.UsageSlot;
import common.biome.Biome;
import common.block.artificial.BlockSlab;
import common.block.natural.BlockSnow;
import common.collect.ImmutableList;
@ -46,7 +45,6 @@ import common.rng.Random;
import common.tileentity.TileEntity;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.ExtMath;
import common.util.Facing;
import common.util.HitPosition;
import common.util.Vec3;

View file

@ -1,6 +1,5 @@
package common.block.foliage;
import common.biome.Biome;
import common.block.Block;
import common.block.Material;
import common.init.Blocks;
@ -41,7 +40,6 @@ public class BlockBlackenedSoil extends Block
if ((iblockstate.getBlock() == Blocks.dirt || iblockstate.getBlock() == Blocks.grass || iblockstate.getBlock() == Blocks.swamp || iblockstate.getBlock() == Blocks.blackened_dirt) && worldIn.getLightFromNeighbors(blockpos.up()) >= 2 && block.getLightOpacity() <= 6)
{
worldIn.setState(blockpos, Blocks.blackened_soil.getState());
worldIn.setBiome(blockpos, Biome.BLACKENED);
}
}
}

View file

@ -1,6 +1,5 @@
package common.block.foliage;
import common.biome.Biome;
import common.block.Block;
import common.block.Material;
import common.block.SoundType;

View file

@ -69,7 +69,7 @@ public class BlockFlower extends BlockBush
ORANGE_TULIP("orange_tulip", "Orange Tulpe"),
WHITE_TULIP("white_tulip", "Weiße Tulpe"),
PINK_TULIP("pink_tulip", "Rosa Tulpe"),
OXEYE_DAISY("daisy", "Margerite"),
DAISY("daisy", "Margerite"),
BLACK_LOTUS("black_lotus", "Schwarzer Lotus");
private final String name;

View file

@ -1,7 +1,5 @@
package common.block.foliage;
import common.biome.Biome;
import common.biome.IBiome;
import common.block.Block;
import common.block.Material;
import common.init.Blocks;
@ -86,7 +84,7 @@ public class BlockGrass extends Block implements IGrowable
public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state)
{
IBiome.getBiome(worldIn.getBiomeGenForCoords(pos)).growGrass(worldIn, pos, state, rand);
worldIn.growGrass(pos, state, rand);
}
protected Property[] getProperties()

View file

@ -2,7 +2,6 @@ package common.block.foliage;
import java.util.List;
import common.biome.Biome;
import common.block.Block;
import common.block.Material;
import common.block.SoundType;
@ -16,8 +15,6 @@ import common.item.CheatTab;
import common.item.Item;
import common.item.ItemStack;
import common.item.tool.ItemShears;
import common.model.Model;
import common.model.ModelProvider;
import common.properties.Property;
import common.properties.PropertyBool;
import common.rng.Random;
@ -25,7 +22,6 @@ import common.tileentity.TileEntity;
import common.util.BlockPos;
import common.util.Facing;
import common.vars.Vars;
import common.world.IWorldAccess;
import common.world.State;
import common.world.World;
import common.world.AWorldServer;

View file

@ -1,6 +1,5 @@
package common.block.foliage;
import common.biome.IBiome;
import common.block.Block;
import common.init.Blocks;
import common.model.Model;
@ -102,7 +101,7 @@ public class BlockMushroom extends BlockBush implements IGrowable
public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state)
{
IBiome.getBiome(worldIn.getBiomeGenForCoords(pos)).generateBigMushroom(worldIn, pos, state, rand);
worldIn.generateBigMushroom(pos, state, rand);
}
public Model getModel(ModelProvider provider, String name, State state) {

View file

@ -2,9 +2,7 @@ package common.block.foliage;
import java.util.List;
import common.biome.IBiome;
import common.block.Block;
import common.block.foliage.BlockTallGrass.EnumType;
import common.collect.Lists;
import common.init.Blocks;
import common.init.WoodType;
@ -80,7 +78,7 @@ public class BlockSapling extends BlockBush implements IGrowable
}
else
{
IBiome.getBiome(worldIn.getBiomeGenForCoords(pos)).generateTree(worldIn, pos, state, rand);
worldIn.generateTree(pos, state, rand);
}
}

View file

@ -1,6 +1,5 @@
package common.block.foliage;
import common.biome.Biome;
import common.block.Block;
import common.block.Material;
import common.entity.npc.EntityNPC;
@ -17,7 +16,6 @@ import common.tileentity.TileEntity;
import common.util.BlockPos;
import common.util.Identifyable;
import common.vars.Vars;
import common.world.IWorldAccess;
import common.world.State;
import common.world.World;
import common.world.AWorldServer;

View file

@ -1,12 +1,10 @@
package common.block.foliage;
import common.biome.Biome;
import common.block.Block;
import common.block.Material;
import common.entity.npc.EntityNPC;
import common.entity.types.EntityLiving;
import common.init.Blocks;
import common.init.Items;
import common.item.CheatTab;
import common.item.Item;
import common.item.ItemStack;

View file

@ -1,6 +1,5 @@
package common.block.natural;
import common.biome.Biome;
import common.block.Block;
import common.block.Material;
import common.init.Blocks;
@ -37,7 +36,6 @@ public class BlockBlackenedDirt extends Block
else if ((iblockstate.getBlock() == Blocks.grass || iblockstate.getBlock() == Blocks.swamp) && worldIn.getLightFromNeighbors(blockpos.up()) >= 2 && block.getLightOpacity() <= 6)
{
worldIn.setState(blockpos, Blocks.blackened_soil.getState());
worldIn.setBiome(blockpos, Biome.BLACKENED);
}
else if (iblockstate.getBlock() == Blocks.stone && rand.chance(25))
{

View file

@ -3,15 +3,19 @@ package common.dimension;
import java.util.List;
import java.util.Map;
import common.biome.Biome;
import common.biome.IBiome;
import common.block.foliage.LeavesType;
import common.collect.Lists;
import common.collect.Maps;
import common.entity.Entity;
import common.entity.animal.EntityChicken;
import common.entity.types.EntityLiving;
import common.init.BlockRegistry;
import common.init.Blocks;
import common.init.EntityRegistry;
import common.init.MetalType;
import common.init.UniverseRegistry;
import common.rng.Random;
import common.rng.WeightedList;
import common.tags.TagObject;
import common.util.ExtMath;
import common.util.Vec3;
@ -57,7 +61,7 @@ public abstract class Dimension extends Section {
public static GeneratorType getByName(String name) {
GeneratorType type = LOOKUP.get(name.toLowerCase());
return type == null ? PERLIN : type;
return type == null ? FLAT : type;
}
static {
@ -68,7 +72,7 @@ public abstract class Dimension extends Section {
}
public static enum ReplacerType {
NONE("none"), BIOMES("biomes"), SIMPLE("simple"), ALTERNATE("alternate"), TOPLAYER("toplayer");
NONE("none"), TERRANIAN("terranian"), MESARIAN("mesarian"), ALT_SIMPLE("alt_simple"), SIMPLE("simple"), ALTERNATE("alternate"), TOPLAYER("toplayer");
private static final Map<String, ReplacerType> LOOKUP = Maps.newHashMap();
@ -84,7 +88,7 @@ public abstract class Dimension extends Section {
public static ReplacerType getByName(String name) {
ReplacerType type = LOOKUP.get(name.toLowerCase());
return type == null ? BIOMES : type;
return type == null ? NONE : type;
}
static {
@ -94,6 +98,33 @@ public abstract class Dimension extends Section {
}
}
public static enum PopulatorType {
NONE("none"), TERRANIAN("terranian"), MESARIAN("mesarian");
private static final Map<String, PopulatorType> LOOKUP = Maps.newHashMap();
private final String name;
private PopulatorType(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
public static PopulatorType getByName(String name) {
PopulatorType type = LOOKUP.get(name.toLowerCase());
return type == null ? NONE : type;
}
static {
for(PopulatorType type : values()) {
LOOKUP.put(type.name, type);
}
}
}
public static interface ColorGenerator {
int getColor(long time);
}
@ -180,9 +211,8 @@ public abstract class Dimension extends Section {
private GeneratorType generatorType = GeneratorType.FLAT;
private ReplacerType replacerType = ReplacerType.NONE;
private boolean populated = true;
private boolean mobs = false; // mobgen+spawn
private PopulatorType populatorType = PopulatorType.NONE;
private boolean snow = false; // snowgen+update
private boolean caves = false;
private boolean ravines = false;
@ -201,6 +231,8 @@ public abstract class Dimension extends Section {
private int seaRarity = 50; // b.layered
private int addRarity = 50; // b.layered
private int seaLevel = 0; // g.perlin, g.cavern, g.simple, g.destroyed, lake (r), r.biome, r.simple, r.alternate, ...
private float depth = 0.1f; // g.perlin
private float scale = 0.2f; // g.perlin
private Biome defaultBiome = Biome.NONE; // biomegen
@ -223,6 +255,7 @@ public abstract class Dimension extends Section {
private final List<Ore> ores = Lists.newArrayList();
private final List<Lake> lakes = Lists.newArrayList();
private final List<Liquid> liquids = Lists.newArrayList();
private final WeightedList<RngSpawn> spawns = new WeightedList<RngSpawn>();
private long seed = 0L;
private boolean exterminated = false;
@ -246,6 +279,26 @@ public abstract class Dimension extends Section {
return readState(tag, "Block", def);
}
public static void writeType(TagObject tag, String name, Class<? extends EntityLiving> type) {
if(type != null)
tag.setString(name, EntityRegistry.getEntityString(type));
}
public static void writeType(TagObject tag, Class<? extends EntityLiving> type) {
writeType(tag, "Type", type);
}
public static Class<? extends EntityLiving> readType(TagObject tag, String name, Class<? extends EntityLiving> def) {
if(!tag.hasString(name))
return def;
Class<? extends Entity> type = EntityRegistry.getEntityClass(tag.getString(name));
return type != null && EntityLiving.class.isAssignableFrom(type) ? (Class<? extends EntityLiving>)type : def;
}
public static Class<? extends EntityLiving> readType(TagObject tag, Class<? extends EntityLiving> def) {
return readType(tag, "Type", def);
}
protected Dimension(boolean custom) {
super(custom);
}
@ -372,9 +425,54 @@ public abstract class Dimension extends Section {
return this;
}
public final Dimension setBiomeReplacer(State alt1) {
public final Dimension setPerlinGen(State filler, State liquid, int seaLevel, float depth, float scale) {
this.depth = depth; // TODO: save
this.scale = scale;
return this.setPerlinGen(filler, liquid, seaLevel);
}
public final Dimension setTerranianReplacer(State surface, State top, State alt1, State alt2) {
this.surface = surface;
this.top = top;
this.alt1 = alt1;
this.replacerType = ReplacerType.BIOMES;
this.alt2 = alt2;
this.replacerType = ReplacerType.TERRANIAN;
return this;
}
public final Dimension setMesarianReplacer(State surface) {
this.surface = surface;
this.replacerType = ReplacerType.MESARIAN;
return this;
}
public final Dimension setSimpleAltReplacer(State surface, State top, State alt1) {
this.surface = surface;
this.top = top;
this.alt1 = alt1;
this.replacerType = ReplacerType.ALT_SIMPLE;
return this;
}
public final Dimension setSimpleAltReplacer(State surface, State top) {
this.surface = surface;
this.top = top;
this.replacerType = ReplacerType.ALT_SIMPLE;
return this;
}
public final Dimension setSimpleAltReplacer(State alt1) {
this.alt1 = alt1;
this.replacerType = ReplacerType.ALT_SIMPLE;
return this;
}
public final Dimension setSimpleReplacer(State surface, State top, State alt1, State alt2) {
this.surface = surface;
this.top = top;
this.alt1 = alt1;
this.alt2 = alt2;
this.replacerType = ReplacerType.SIMPLE;
return this;
}
@ -397,6 +495,11 @@ public abstract class Dimension extends Section {
this.replacerType = ReplacerType.TOPLAYER;
return this;
}
public final Dimension setPopulator(PopulatorType type) {
this.populatorType = type;
return this;
}
public final Dimension setBiomeGen(Biome mainBiome, boolean semiFixed, int biomeSize, int riverSize, int snowRarity, int seaRarity) {
return this.setBiomeGen(mainBiome, semiFixed, biomeSize, riverSize, snowRarity, seaRarity, 1);
@ -405,9 +508,6 @@ public abstract class Dimension extends Section {
public final Dimension setBiomeGen(Biome mainBiome, boolean semiFixed, int biomeSize, int riverSize, int snowRarity, int seaRarity,
int addRarity, Biome ... add) {
this.defaultBiome = mainBiome;
IBiome biome = IBiome.getBiome(mainBiome);
this.top = biome.getFiller();
this.surface = biome.getTop();
this.semiFixed = semiFixed;
this.biomeSize = biomeSize;
this.riverSize = riverSize;
@ -437,19 +537,6 @@ public abstract class Dimension extends Section {
this.hotBiomes = biomes;
return this;
}
public final Dimension setBiome(Biome value) {
this.defaultBiome = value;
IBiome biome = IBiome.getBiome(value);
this.top = biome.getFiller();
this.surface = biome.getTop();
return this;
}
public final Dimension enableMobs() {
this.mobs = true;
return this;
}
public final Dimension enableSnow() {
this.snow = true;
@ -544,6 +631,11 @@ public abstract class Dimension extends Section {
return this;
}
public final Dimension addSpawn(Class<? extends EntityLiving> type, int weight, int min, int max) {
this.spawns.add(new RngSpawn(type, weight, min, max));
return this;
}
protected final Dimension setPhysics(int size, long orbitalPeriod, long rotationPeriod, float orbitOffset, float gravity, float temperature,
@ -834,10 +926,6 @@ public abstract class Dimension extends Section {
return this.top;
}
public final State getAltFiller1() {
return this.alt1;
}
public final State getLiquid() {
return this.liquid;
}
@ -846,10 +934,6 @@ public abstract class Dimension extends Section {
return this.defaultLeaves;
}
public final boolean hasMobs() {
return this.mobs;
}
public final boolean hasSnow() {
return this.snow;
}
@ -881,9 +965,13 @@ public abstract class Dimension extends Section {
public final boolean hasFortresses() {
return this.useFortresses;
}
public final boolean hasPopulator() {
return this.populated;
public float getDepth() {
return this.depth;
}
public float getScale() {
return this.scale;
}
@ -1023,7 +1111,7 @@ public abstract class Dimension extends Section {
this.noiseGen.biomeScaleOffset = tag.getFloat("BScaleOffset");
this.generatorType = GeneratorType.getByName(tag.getString("Generator"));
this.replacerType = ReplacerType.getByName(tag.getString("Replacer"));
this.mobs = tag.getBool("MobGen");
this.populatorType = PopulatorType.getByName(tag.getString("Populator"));
this.snow = tag.getBool("SnowGen");
this.ceiling = tag.getBool("Ceiling");
this.caves = tag.getBool("Caves");
@ -1167,7 +1255,16 @@ public abstract class Dimension extends Section {
gen.getInt("Chance"), gen.getInt("Min"), gen.getInt("Max"), gen.getBool("Lower")));
}
}
this.populated = !tag.hasBool("NoPopulation") || !tag.getBool("NoPopulation");
this.spawns.clear();
if(tag.hasList("Spawns")) {
List<TagObject> list = tag.getList("Spawns");
for(int z = 0; z < list.size(); z++) {
TagObject gen = list.get(z);
this.spawns.add(new RngSpawn(
readType(gen, EntityChicken.class),
gen.getInt("Weight"), gen.getInt("Min"), gen.getInt("Max")));
}
}
this.denseFog = tag.getBool("DenseFog");
this.brightness = tag.getInt("Brightness");
this.skyColor = tag.getInt("SkyColor");
@ -1234,7 +1331,7 @@ public abstract class Dimension extends Section {
tag.setFloat("BScaleOffset", this.noiseGen.biomeScaleOffset);
tag.setString("Generator", this.generatorType.getName());
tag.setString("Replacer", this.replacerType.getName());
tag.setBool("MobGen", this.mobs);
tag.setString("Populator", this.populatorType.getName());
tag.setBool("SnowGen", this.snow);
tag.setBool("Ceiling", this.ceiling);
tag.setBool("Caves", this.caves);
@ -1251,7 +1348,7 @@ public abstract class Dimension extends Section {
tag.setInt("SnowRarity", this.snowRarity);
tag.setInt("SeaRarity", this.seaRarity);
tag.setInt("AddRarity", this.addRarity);
tag.setString("DefaultBiome", this.defaultBiome.name.toLowerCase());
tag.setString("DefaultBiome", this.defaultBiome.getName());
tag.setBool("SemiFixed", this.semiFixed);
tag.setString("DefaultWeather", this.defaultWeather.getName());
tag.setString("DefaultLeaves", this.defaultLeaves.getName());
@ -1270,35 +1367,35 @@ public abstract class Dimension extends Section {
if(this.addBiomes != null) {
String[] list = new String[this.addBiomes.length];
for(int z = 0; z < this.addBiomes.length; z++) {
list[z] = this.addBiomes[z].name.toLowerCase();
list[z] = this.addBiomes[z].getName();
}
tag.setStringArray("AddBiomes", list);
}
if(this.frostBiomes != null) {
String[] list = new String[this.frostBiomes.length];
for(int z = 0; z < this.frostBiomes.length; z++) {
list[z] = this.frostBiomes[z].name.toLowerCase();
list[z] = this.frostBiomes[z].getName();
}
tag.setStringArray("FrostBiomes", list);
}
if(this.coldBiomes != null) {
String[] list = new String[this.coldBiomes.length];
for(int z = 0; z < this.coldBiomes.length; z++) {
list[z] = this.coldBiomes[z].name.toLowerCase();
list[z] = this.coldBiomes[z].getName();
}
tag.setStringArray("ColdBiomes", list);
}
if(this.mediumBiomes != null) {
String[] list = new String[this.mediumBiomes.length];
for(int z = 0; z < this.mediumBiomes.length; z++) {
list[z] = this.mediumBiomes[z].name.toLowerCase();
list[z] = this.mediumBiomes[z].getName();
}
tag.setStringArray("MediumBiomes", list);
}
if(this.hotBiomes != null) {
String[] list = new String[this.hotBiomes.length];
for(int z = 0; z < this.hotBiomes.length; z++) {
list[z] = this.hotBiomes[z].name.toLowerCase();
list[z] = this.hotBiomes[z].getName();
}
tag.setStringArray("HotBiomes", list);
}
@ -1345,8 +1442,18 @@ public abstract class Dimension extends Section {
}
tag.setList("Liquids", list);
}
if(!this.populated)
tag.setBool("NoPopulation", true);
if(!this.spawns.isEmpty()) {
List<TagObject> list = Lists.newArrayList();
for(RngSpawn gen : this.spawns) {
TagObject spawn = new TagObject();
writeType(spawn, gen.type);
spawn.setInt("Weight", gen.weight);
spawn.setInt("Min", gen.min);
spawn.setInt("Max", gen.max);
list.add(spawn);
}
tag.setList("Spawns", list);
}
tag.setBool("DenseFog", this.denseFog);
tag.setInt("Brightness", this.brightness);
tag.setInt("SkyColor", this.skyColor);
@ -1459,6 +1566,10 @@ public abstract class Dimension extends Section {
return this.replacerType;
}
public PopulatorType getPopulatorType() {
return this.populatorType;
}
public State getAlt1() {
return this.alt1;
}
@ -1502,4 +1613,8 @@ public abstract class Dimension extends Section {
public List<Liquid> getLiquids() {
return this.liquids;
}
public WeightedList<RngSpawn> getSpawns() {
return this.spawns;
}
}

View file

@ -1,6 +1,5 @@
package common.dimension;
import common.biome.Biome;
import common.block.Block;
import common.init.Blocks;
import common.init.UniverseRegistry;
@ -10,21 +9,20 @@ public final class Moon extends Dimension {
super(true);
}
public Moon(int sky, int fog, int radius, long orbit, long rotation, float gravity, float temperature, int brightness, Block surface, Block liquid) {
public Moon(int sky, int fog, int radius, long orbit, long rotation, float gravity, float temperature, int brightness, Block surface, Block liquid, float depth, float scale) {
super(false);
this.setPhysics(Planet.radiusToSize(Math.min(radius, 26000000)), orbit, rotation, 0.0f, gravity, temperature, brightness);
this.setStarBrightness(0.75f).setDeepStarBrightness(0.75f);
this.setSkyColor(sky).setFogColor(fog);
this.setPerlinGen(surface.getState(), liquid.getState(), 63);
this.setBiome(Biome.MOON);
this.setPerlinGen(surface.getState(), liquid.getState(), 63, depth, scale);
}
public Moon(int color, int radius, long orbit, long rotation, float gravity, float temperature, Block surface, Block liquid) {
this(color, color, radius, orbit, rotation, gravity, temperature, 8, surface, liquid);
public Moon(int color, int radius, long orbit, long rotation, float gravity, float temperature, Block surface, Block liquid, float depth, float scale) {
this(color, color, radius, orbit, rotation, gravity, temperature, 8, surface, liquid, depth, scale);
}
public Moon(int radius, long orbit, long rotation, float gravity, float temperature) {
this(0x333333, radius, orbit, rotation, gravity, temperature, Blocks.moon_rock, Blocks.air);
this(0x333333, radius, orbit, rotation, gravity, temperature, Blocks.moon_rock, Blocks.air, 0.125F, 0.05F);
}
public Moon(int radius, long orbitRotation, float gravity, float temperature) {

View file

@ -24,7 +24,7 @@ public final class Planet extends Dimension {
}
public Planet(int radius, long orbit, long rotation, float offset, float gravity, float temperature) {
this(0xffffffff, 0xc0d8ff, 0xffffff, radius, orbit, rotation, offset, gravity, temperature, 0);
this(0x7aa7ff, 0xc0d8ff, 0xffffff, radius, orbit, rotation, offset, gravity, temperature, 0);
}
public Planet(int sky, int fog, int clouds, int radius, long orbit, long rotation, float gravity, float temperature) {

View file

@ -0,0 +1,17 @@
package common.dimension;
import common.entity.types.EntityLiving;
import common.rng.RngItem;
public class RngSpawn extends RngItem {
public final Class<? extends EntityLiving> type;
public final int min;
public final int max;
public RngSpawn(Class<? extends EntityLiving> type, int weight, int min, int max) {
super(weight);
this.type = type;
this.min = min;
this.max = max;
}
}

View file

@ -9,7 +9,7 @@ public final class Space extends Dimension {
private Space() {
super(false);
this.setPhysics(World.MAX_SIZE, 1L, 1L, 0.0f, 0.0f, 2.7f, 15);
this.setBiome(Biome.SPACE).setStarBrightness(1.0f).setDeepStarBrightness(1.0f);
this.setStarBrightness(1.0f).setDeepStarBrightness(1.0f);
}
public final DimType getType() {

View file

@ -356,14 +356,6 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
return this.passenger == null;
}
public boolean prepareChunkForSpawn()
{
int i = ExtMath.floord(this.posX);
int j = ExtMath.floord(this.posZ);
this.worldObj.getBiomeGenForCoords(new BlockPos(i, 0, j));
return true;
}
public void dropChests()
{
if (!this.worldObj.client && this.isChested())
@ -492,15 +484,6 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
// }
}
/**
* Checks if the entity's current position is a valid location to spawn this entity.
*/
public boolean getCanSpawnHere()
{
this.prepareChunkForSpawn();
return super.getCanSpawnHere();
}
protected EntityHorse getClosestHorse(Entity entityIn, double distance)
{
double d0 = Double.MAX_VALUE;

View file

@ -11,7 +11,6 @@ import common.ai.EntityAISwimming;
import common.ai.EntityAITempt;
import common.ai.EntityAIWander;
import common.ai.EntityAIWatchClosest;
import common.biome.Biome;
import common.block.artificial.BlockWool;
import common.collect.Maps;
import common.color.DyeColor;
@ -286,9 +285,9 @@ public class EntitySheep extends EntityAnimal
DyeColor.MAGENTA, DyeColor.ORANGE, DyeColor.PINK, DyeColor.PURPLE, DyeColor.RED
};
public static DyeColor getRandomSheepColor(Random random, Biome biome)
public static DyeColor getRandomSheepColor(Random random, float temp)
{
if(biome == Biome.SNOW)
if(temp <= 0.0f)
return DyeColor.WHITE;
int i = random.zrange(140);
return i < 20 ? DyeColor.BLACK :
@ -326,7 +325,7 @@ public class EntitySheep extends EntityAnimal
public Object onInitialSpawn(Object livingdata)
{
livingdata = super.onInitialSpawn(livingdata);
this.setFleeceColor(getRandomSheepColor(this.worldObj.rand, this.worldObj.getBiomeGenForCoords(this.getPosition())));
this.setFleeceColor(getRandomSheepColor(this.worldObj.rand, this.worldObj.getTemperatureC(this.getPosition())));
return livingdata;
}

View file

@ -2,10 +2,10 @@ package common.entity.npc;
import common.ai.EntityAIBase;
import common.ai.EntityMoveHelper;
import common.biome.Biome;
import common.entity.DamageSource;
import common.entity.Entity;
import common.entity.types.EntityLiving;
import common.init.Blocks;
import common.init.ItemRegistry;
import common.init.Items;
import common.init.SoundEvent;
@ -383,9 +383,7 @@ public class EntitySlime extends EntityNPC
// {
// if (this.worldObj.getDifficulty() != Difficulty.PEACEFUL)
// {
Biome biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos);
if (biomegenbase == Biome.SWAMP && this.posY > 50.0D && this.posY < 70.0D && this.rand.floatv() < 0.5F && this.rand.floatv() < this.worldObj.getMoonPhase() && this.worldObj.getLightFromNeighbors(new BlockPos(this)) <= this.rand.zrange(8))
if (this.worldObj.getState(new BlockPos(this.posX, this.getEntityBoundingBox().minY - 1.0, this.posZ)).getBlock() == Blocks.swamp && this.posY > 50.0D && this.posY < 70.0D && this.rand.floatv() < 0.5F && this.rand.floatv() < this.worldObj.getMoonPhase() && this.worldObj.getLightFromNeighbors(new BlockPos(this)) <= this.rand.zrange(8))
{
return super.getCanSpawnHere();
}

View file

@ -10,5 +10,6 @@ public abstract class Registry {
CraftingRegistry.register();
SmeltingRegistry.register();
EntityRegistry.register();
UniverseRegistry.register();
}
}

View file

@ -17,11 +17,43 @@ import common.dimension.Galaxy;
import common.dimension.Moon;
import common.dimension.Section;
import common.dimension.Planet;
import common.dimension.RngSpawn;
import common.dimension.Sector;
import common.dimension.Semi;
import common.dimension.Space;
import common.dimension.Star;
import common.entity.Entity;
import common.entity.animal.EntityBat;
import common.entity.animal.EntityCat;
import common.entity.animal.EntityChicken;
import common.entity.animal.EntityCow;
import common.entity.animal.EntityFox;
import common.entity.animal.EntityHorse;
import common.entity.animal.EntityMouse;
import common.entity.animal.EntityPig;
import common.entity.animal.EntityRabbit;
import common.entity.animal.EntitySheep;
import common.entity.animal.EntityWolf;
import common.entity.npc.EntityArachnoid;
import common.entity.npc.EntityBloodElf;
import common.entity.npc.EntityCultivator;
import common.entity.npc.EntityDwarf;
import common.entity.npc.EntityElf;
import common.entity.npc.EntityFireDemon;
import common.entity.npc.EntityHaunter;
import common.entity.npc.EntityMage;
import common.entity.npc.EntityMerfolk;
import common.entity.npc.EntityMetalhead;
import common.entity.npc.EntitySlime;
import common.entity.npc.EntitySpirit;
import common.entity.npc.EntityTiefling;
import common.entity.npc.EntityUndead;
import common.entity.npc.EntityWoodElf;
import common.entity.npc.EntityZombie;
import common.entity.types.EntityLiving;
import common.rng.WeightedList;
import common.world.Weather;
import java.util.Set;
public abstract class UniverseRegistry {
@ -396,8 +428,77 @@ public abstract class UniverseRegistry {
private static void registerMoon(String display, int radius, long orbitRotation, float gravity, float temperature) {
registerMoon(display, new Moon(radius, orbitRotation, gravity, temperature));
}
/*public class BiomeBlackened extends MobPopulator {
protected void addMobs(WeightedList<RngSpawn> mobs) {
mobs.add(new RngSpawn(EntityMetalhead.class, 50, 1, 1));
}
}
public static void register() {
public class BiomeChaos extends MobPopulator {
protected void addMobs(WeightedList<RngSpawn> mobs) {
for(Class<? extends Entity> clazz : EntityRegistry.getAllClasses()) {
if(EntityLiving.class.isAssignableFrom(clazz))
mobs.add(new RngSpawn((Class<? extends EntityLiving>)clazz, 1, 1, 8));
}
}
}
public class BiomeHell extends MobPopulator {
protected void addMobs(WeightedList<RngSpawn> mobs) {
mobs.add(new RngSpawn(EntityFireDemon.class, 50, 4, 4));
mobs.add(new RngSpawn(EntityTiefling.class, 100, 4, 4));
mobs.add(new RngSpawn(EntityBloodElf.class, 50, 2, 10));
mobs.add(new RngSpawn(EntityCultivator.class, 10, 1, 1));
}
}
public class BiomeMetalHell extends MobPopulator {
protected void addMobs(WeightedList<RngSpawn> mobs) {
mobs.add(new RngSpawn(EntityFireDemon.class, 50, 4, 4));
mobs.add(new RngSpawn(EntityTiefling.class, 100, 4, 4));
mobs.add(new RngSpawn(EntityBloodElf.class, 10, 1, 2));
mobs.add(new RngSpawn(EntityMetalhead.class, 1, 1, 1));
}
}
public class BiomeMushroom extends MobPopulator {
protected void addMobs(WeightedList<RngSpawn> mobs) {
mobs.add(new RngSpawn(EntityDwarf.class, 8, 4, 8));
}
}
public class BiomeSnowLand extends MobPopulator {
protected void addMobs(WeightedList<RngSpawn> mobs) {
mobs.add(new RngSpawn(EntitySheep.class, 50, 4, 4));
mobs.add(new RngSpawn(EntitySpirit.class, 10, 1, 1));
}
}
public class BiomeTian extends MobPopulator {
protected void addMobs(WeightedList<RngSpawn> mobs) {
mobs.add(new RngSpawn(EntityCultivator.class, 50, 1, 1));
mobs.add(new RngSpawn(EntityMerfolk.class, 10, 4, 4));
mobs.add(new RngSpawn(EntityRabbit.class, 10, 3, 10));
mobs.add(new RngSpawn(EntityBat.class, 10, 8, 8));
mobs.add(new RngSpawn(EntityMouse.class, 10, 8, 8));
}
}
public class BiomeElvenForest extends MobPopulator {
protected void addMobs(WeightedList<RngSpawn> mobs) {
mobs.add(new RngSpawn(EntitySheep.class, 12, 4, 4));
mobs.add(new RngSpawn(EntityRabbit.class, 10, 3, 10));
mobs.add(new RngSpawn(EntityChicken.class, 10, 4, 4));
mobs.add(new RngSpawn(EntityMouse.class, 10, 8, 8));
mobs.add(new RngSpawn(EntityWoodElf.class, 100, 4, 16));
mobs.add(new RngSpawn(EntityElf.class, 12, 4, 16));
mobs.add(new RngSpawn(EntityFox.class, 3, 2, 5));
}
}
*/
static void register() { //TODO: add mushroom 0.2F, 0.3F
register("space", "Der Weltraum", Space.INSTANCE);
registerGalaxy("milkyway", "Galaxie Milchstraße", () -> {
@ -405,8 +506,8 @@ public abstract class UniverseRegistry {
registerStar("Sol", 695508000, 274.0f, 5778.0f, () -> {
registerPlanet("Terra", new Planet(6378136, 8766144L, 24000L, 28.0f, 9.81f, 259.15f)
.setPerlinGen(Blocks.stone.getState(), Blocks.water.getState(), 63)
.setBiomeReplacer(Blocks.gravel.getState())
.setBiomeGen(Biome.FOREST, false, 4, 4, 6, 50, 50, Biome.MUSHROOM).enableMobs().enableSnow()
.setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState())
.setBiomeGen(Biome.FOREST, false, 4, 4, 6, 50).enableMobs().enableSnow()
.setFrostBiomes(Biome.ICE, Biome.ICE, Biome.ICE, Biome.ICE_TAIGA, Biome.LARGE_TAIGA)
.setColdBiomes(Biome.FOREST, Biome.HILLS, Biome.TAIGA, Biome.PLAIN)
.setMediumBiomes(Biome.FOREST, Biome.DARK_FOREST, Biome.HILLS, Biome.PLAIN, Biome.BIRCH_FOREST,
@ -427,6 +528,26 @@ public abstract class UniverseRegistry {
.addOre(Blocks.diamond_ore.getState(), 1, 0, 8, 0, 16, false)
.addOre(Blocks.ruby_ore.getState(), 1, 0, 4, 12, 8, true)
.addOre(Blocks.cinnabar_ore.getState(), 1, 0, 11, 0, 24, false)
.addSpawn(EntitySheep.class, 12, 4, 4)
.addSpawn(EntityRabbit.class, 10, 3, 10)
.addSpawn(EntityPig.class, 10, 4, 4)
.addSpawn(EntityChicken.class, 10, 4, 4)
.addSpawn(EntityCow.class, 8, 4, 4)
.addSpawn(EntityArachnoid.class, 100, 4, 4)
.addSpawn(EntityZombie.class, 100, 4, 4)
.addSpawn(EntityUndead.class, 100, 4, 4)
.addSpawn(EntityHaunter.class, 100, 4, 4)
.addSpawn(EntitySlime.class, 100, 4, 4)
.addSpawn(EntityMage.class, 5, 1, 1)
.addSpawn(EntityBat.class, 10, 8, 8)
.addSpawn(EntityMouse.class, 10, 8, 8)
.addSpawn(EntityWolf.class, 5, 2, 4)
.addSpawn(EntityFox.class, 4, 2, 6)
.addSpawn(EntityWoodElf.class, 100, 4, 16)
.addSpawn(EntityElf.class, 12, 4, 16)
.addSpawn(EntityMerfolk.class, 10, 4, 4)
.addSpawn(EntityHorse.class, 5, 2, 6)
.addSpawn(EntityCat.class, 2, 1, 1)
.enableVillages().enableMineshafts().enableScattered().enableStrongholds(), () -> {
registerMoon("Luna", 1737100, 655728L, 1.62f, 210.0f);
});
@ -488,9 +609,9 @@ public abstract class UniverseRegistry {
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63));
});
registerStar("Gi'rok", 603421976, 232.0f, 5220.0f, () -> {
registerPlanet("gharoth", "Elbenplanet Gharoth", new Planet(2806382, 4837386L, 52960L, 30.0f, 10.0f, 257.3f)
registerPlanet("gharoth", "Elbenplanet Gharoth", new Planet(2806382, 4837386L, 52960L, 30.0f, 10.0f, 257.3f + 8.0f) //TODO: check temp
.setSimpleGen(Blocks.dirt.getState(), Blocks.water.getState(), 64)
.setSimpleReplacer(Blocks.gravel.getState(), Blocks.sand.getState()).setBiome(Biome.ELVEN_FOREST)
.setSimpleReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState())
.enableCaves(Blocks.air.getState()).setDungeons(4).enableMobs().enableSnow()
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
@ -500,7 +621,7 @@ public abstract class UniverseRegistry {
.addOre(Blocks.gyriyn_ore.getState(), 0, 2, 3, 0, 12, false));
registerPlanet("transylvania", "Vampirplanet Transsylvanien", new Planet(8374921, 33850466L, 49760L, 20.0f, 10.0f, 255.5f)
.setPerlinGen(Blocks.rock.getState(), Blocks.water.getState(), 63)
.setBiomeReplacer(Blocks.gravel.getState()).setBiomeGen(Biome.FOREST, true, 5, 3, 3, 30)
.setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()).setBiomeGen(Biome.FOREST, true, 5, 3, 3, 30)
.enableCavesRavines(Blocks.lava.getState()).setDungeons(10).enableMobs().enableSnow()
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
@ -509,16 +630,25 @@ public abstract class UniverseRegistry {
.addOre(Blocks.coal_ore.getState(), 12, 0, 14, 4, 28, false)
.addOre(Blocks.lead_ore.getState(), 2, 0, 8, 0, 8, false)
.addOre(Blocks.ardite_ore.getState(), 0, 2, 3, 0, 12, false)
.addOre(Blocks.nichun_ore.getState(), 0, 10, 1, 0, 10, false), () -> {
registerMoon("yrdinath", "Eismond Yrdinath", new Moon(0xccccff, 2503812, 46743637L, 17460L, 2.5f, 239.15f, Blocks.snow, Blocks.ice)
.setBiome(Biome.SNOW).enableMobs().enableSnow().setDefaultWeather(Weather.SNOW));
registerMoon("mythril", "Eismond Mythril", new Moon(0xbbbbff, 2213749, 42659432L, 15330L, 2.25f, 221.65f, Blocks.snow, Blocks.ice)
.setBiome(Biome.SNOW).enableMobs().enableSnow().setDefaultWeather(Weather.SNOW));
.addOre(Blocks.nichun_ore.getState(), 0, 10, 1, 0, 10, false)
.addSpawn(EntitySheep.class, 12, 4, 4)
.addSpawn(EntityCow.class, 8, 4, 4)
.addSpawn(EntityArachnoid.class, 100, 4, 4)
.addSpawn(EntityZombie.class, 100, 4, 4)
.addSpawn(EntityUndead.class, 100, 4, 4)
.addSpawn(EntitySlime.class, 100, 4, 4)
.addSpawn(EntityBat.class, 10, 8, 8)
.addSpawn(EntityMouse.class, 10, 8, 8)
.addSpawn(EntityWolf.class, 5, 2, 4)
.addSpawn(EntityHorse.class, 5, 2, 6), () -> {
registerMoon("yrdinath", "Eismond Yrdinath", new Moon(0xccccff, 2503812, 46743637L, 17460L, 2.5f, 239.15f, Blocks.snow, Blocks.ice, 0.1F, 0.2F) //TODO: check height
.enableMobs().enableSnow().setDefaultWeather(Weather.SNOW));
registerMoon("mythril", "Eismond Mythril", new Moon(0xbbbbff, 2213749, 42659432L, 15330L, 2.25f, 221.65f, Blocks.snow, Blocks.ice, 0.1F, 0.2F)
.enableMobs().enableSnow().setDefaultWeather(Weather.SNOW));
});
registerPlanet("mesar", "Wüstenplanet Me'sar", new Planet(0xff7f3f, 0xff6022, 0xff6f00, 9823183, 56643366L, 87340L, 11.0f, 333.15f)
.setPerlinGen(Blocks.rock.getState(), Blocks.air.getState(), 63)
.setBiomeReplacer(Blocks.red_sand.getState())
.setBiomeGen(Biome.MESA, true, 3, 1000, 100000, 100000)
.setPerlinGen(Blocks.rock.getState(), Blocks.air.getState(), 63, 0.2f, 0.4f)
.setMesarianReplacer(Blocks.red_sand.getState())
.enableCavesRavines(Blocks.lava.getState()).enableMobs()
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
.addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true)
@ -536,7 +666,7 @@ public abstract class UniverseRegistry {
registerStar("Ov'rol", new Star(0x000000, 832718528, 302.0f, 12666.0f, Blocks.goo), () -> {
registerPlanet("blackplanet", "Der Schwarze Planet", new Planet(0x000000, 0x000000, 0x000000, 13038204, 4632918508L, 204556L, 12.0f, 0.0f)
.setPerlinGen(Blocks.blackened_stone.getState(), Blocks.goo.getState(), 63)
.setBiomeReplacer(Blocks.blackened_cobble.getState()).setBiome(Biome.BLACKENED)
.setSimpleAltReplacer(Blocks.blackened_soil.getState(), Blocks.blackened_dirt.getState(), Blocks.blackened_cobble.getState())
.enableCaves(Blocks.air.getState()).setDungeons(4).enableMobs()
.addLake(Blocks.goo.getState(), null, null, 8, 8, 255, true)
// .addOre(Blocks.PLACEHOLDER_ore.getState(), 0, 2, 3, 0, 12, false)
@ -546,8 +676,8 @@ public abstract class UniverseRegistry {
});
registerSemi("warp", "Der Warp", new Semi(0x0c001f, 0x190033, 124072917, 285.0f, 3).setCloudTexture(CloudType.DENSE).setCloudHeight(238.0f)
.setPerlinGen(Blocks.obsidian.getState(), Blocks.lava.getState(), 63)
.setBiome(Biome.CHAOS).enableCavesRavines(Blocks.air.getState()).enableLongCaves().enableMobs().enableSnow()
.setPerlinGen(Blocks.obsidian.getState(), Blocks.lava.getState(), 63, 1.0F, 2.0F)
.enableCavesRavines(Blocks.air.getState()).enableLongCaves().enableMobs().enableSnow()
.addLake(Blocks.water.getState(), null, Blocks.obsidian.getState(), 8, 0, 255, false)
.addLake(Blocks.lava.getState(), null, null, 1, 8, 255, false)
.addLiquid(Blocks.flowing_water.getState(), 1, 8, 255, false)
@ -557,8 +687,8 @@ public abstract class UniverseRegistry {
registerDomain("Tian'Xin", () -> {
registerArea("Ni'enrath", new Area(0x7f00ff, 532109, 276.15f, 1).setLightColor(0x07000f).setBlockColor(0xcf6fff)
.setPerlinGen(Blocks.tian.getState(), Blocks.spring_water.getState(), 63).setBiome(Biome.TIAN)
.setBiomeReplacer(Blocks.tian.getState()).enableLongCaves().enableMobs().enableSnow()
.setPerlinGen(Blocks.tian.getState(), Blocks.spring_water.getState(), 63, 0.1F, 1.0F)
.setSimpleAltReplacer(Blocks.tian_soil.getState(), Blocks.tian.getState()).enableLongCaves().enableMobs().enableSnow()
.addLake(Blocks.spring_water.getState(), Blocks.tian.getState(), Blocks.tian.getState(), 4, 0, 255, false)
.addLiquid(Blocks.flowing_spring_water.getState(), 50, 8, 255, false));
});
@ -571,28 +701,26 @@ public abstract class UniverseRegistry {
registerArea("thedric", "Kreis Thedric", new Area(0x330707, 105639735, 347.15f, 2).enableLongCaves().enableMobs().enableFortresses()
.enableWorldCeiling().enableDenseFog()
.setCavernGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63)
.setSurfaceReplacer(Blocks.gravel.getState(), Blocks.soul_sand.getState())
.setBiome(Biome.UPPER_HELL));
.setSurfaceReplacer(Blocks.gravel.getState(), Blocks.soul_sand.getState()));
registerArea("kyroth", "Kreis Kyroth", new Area(0x990000, 86742970, 387.15f, 3).enableLongCaves().enableMobs()
.setSimpleGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 64)
.setSimpleReplacer(Blocks.obsidian.getState(), Blocks.soul_sand.getState())
.setBiome(Biome.LOWER_HELL)
.addLake(Blocks.lava.getState(), null, null, 4, 8, 255, false)
.addLiquid(Blocks.flowing_lava.getState(), 40, 8, 255, true));
registerArea("ahrd", "Kreis Ahrd", new Area(0xcc0000, 67028432, 467.15f, 15).enableLongCaves().enableMobs()
.setPerlinGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63)
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.HELL_HILLS)
.setPerlinGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63, 1.0F, 0.5F)
.setSimpleAltReplacer(Blocks.soul_sand.getState())
.addLake(Blocks.lava.getState(), Blocks.soul_sand.getState(), Blocks.soul_sand.getState(),
2, 8, 255, false).addLiquid(Blocks.flowing_lava.getState(), 80, 8, 255, true));
registerArea("mizorath", "Kreis Mizorath", new Area(0xff0000, 54029584, 1067.15f, 15).enableMobs()
.setPerlinGen(Blocks.hellrock.getState(), Blocks.blood.getState(), 63)
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.SOUL_PLAINS));
.setPerlinGen(Blocks.hellrock.getState(), Blocks.blood.getState(), 63, -0.2F, 0.1F)
.setSimpleAltReplacer(Blocks.soul_sand.getState()));
registerArea("dargoth", "Kreis Dargoth", new Area(0xff3f0c, 43293629, 1707.15f, 15).enableMobs()
.setPerlinGen(Blocks.hellrock.getState(), Blocks.magma.getState(), 63)
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.SOUL_PLAINS));
.setPerlinGen(Blocks.hellrock.getState(), Blocks.magma.getState(), 63, -0.2F, 0.1F)
.setSimpleAltReplacer(Blocks.soul_sand.getState()));
registerArea("aasirith", "Kreis Aasirith", new Area(0x191919, 36291872, 2482.0f, 1).enableLongCaves().enableMobs()
.setPerlinGen(Blocks.rock.getState(), Blocks.magma.getState(), 63)
.setBiomeReplacer(Blocks.ash.getState()).setBiome(Biome.ASH)
.setPerlinGen(Blocks.rock.getState(), Blocks.magma.getState(), 63, 0.125F, 0.05F)
.setSimpleAltReplacer(Blocks.ash.getState(), Blocks.rock.getState(), Blocks.ash.getState())
.addLake(Blocks.lava.getState(), Blocks.rock.getState(), Blocks.rock.getState(),
2, 8, 255, false).addLiquid(Blocks.flowing_lava.getState(), 80, 8, 255, true));
});

View file

@ -1,6 +1,5 @@
package common.item.tool;
import common.biome.Biome;
import common.color.TextColor;
import common.entity.npc.EntityNPC;
import common.item.ItemStack;
@ -16,10 +15,9 @@ public class ItemScanner extends ItemWand {
public void onUse(ItemStack stack, EntityNPC player, AWorldServer world, Vec3 vec)
{
Biome biome = world.getBiomeGenForCoords(new BlockPos(vec.xCoord, 0, vec.zCoord));
player.connection.addHotbar(TextColor.NEON + "* Position in %s: %.3f %.3f %.3f, %s, %.2f °C", world.dimension.getDisplay(),
player.connection.addHotbar(TextColor.NEON + "* Position in %s: %.3f %.3f %.3f, %.2f K, %.2f °C", world.dimension.getDisplay(),
vec.xCoord, vec.yCoord, vec.zCoord,
biome.display, world.getTemperatureC(new BlockPos(vec)));
world.getTemperatureK(new BlockPos(vec)), world.getTemperatureC(new BlockPos(vec)));
}
public int getRange(ItemStack stack, EntityNPC player) {

View file

@ -29,7 +29,6 @@ import common.packet.SPacketPlayerAbilities;
import common.packet.SPacketTabComplete;
import common.packet.SPacketUpdateEntityTags;
import common.packet.SPacketAnimation;
import common.packet.SPacketBiome;
import common.packet.SPacketBlockBreakAnim;
import common.packet.SPacketBlockChange;
import common.packet.SPacketCamera;
@ -93,7 +92,6 @@ public interface IClientPlayer extends NetHandler {
void handlePlayerPosLook(SPacketPlayerPosLook packet);
void handleMultiBlockChange(SPacketMultiBlockChange packet);
void handleChunkData(SPacketChunkData packet);
void handleBiomes(SPacketBiome packet);
void handleBlockChange(SPacketBlockChange packet);
void handleDisconnect(SPacketDisconnect packet);
void handleCollectItem(SPacketCollectItem packet);

View file

@ -66,7 +66,6 @@ import common.packet.SPacketPlayerAbilities;
import common.packet.SPacketTabComplete;
import common.packet.SPacketUpdateEntityTags;
import common.packet.SPacketAnimation;
import common.packet.SPacketBiome;
import common.packet.SPacketBlockBreakAnim;
import common.packet.SPacketBlockChange;
import common.packet.SPacketCamera;
@ -176,7 +175,6 @@ public enum PacketRegistry {
this.server(SPacketSkin.class);
this.server(SPacketDisconnect.class);
this.server(SPacketCamera.class);
this.server(SPacketBiome.class);
this.server(SPacketUpdateEntityTags.class);
this.server(SPacketTrades.class);
this.server(SPacketDimensionName.class);

View file

@ -1,56 +0,0 @@
package common.packet;
import java.io.IOException;
import common.biome.Biome;
import common.network.IClientPlayer;
import common.network.Packet;
import common.network.PacketBuffer;
import common.util.BlockPos;
public class SPacketBiome implements Packet<IClientPlayer> {
private int posX;
private int posZ;
private Biome biome;
public SPacketBiome() {
}
public SPacketBiome(BlockPos pos, Biome biome) {
this.posX = pos.getX();
this.posZ = pos.getZ();
this.biome = biome;
}
public void readPacketData(PacketBuffer buf) throws IOException {
this.posX = buf.readInt();
this.posZ = buf.readInt();
this.biome = buf.readEnumValue(Biome.class);
}
public void writePacketData(PacketBuffer buf) throws IOException {
buf.writeInt(this.posX);
buf.writeInt(this.posZ);
buf.writeEnumValue(this.biome);
}
public void processPacket(IClientPlayer handler) {
handler.handleBiomes(this);
}
public int getChunkX() {
return this.posX >> 4;
}
public int getChunkZ() {
return this.posZ >> 4;
}
public BlockPos getPos() {
return new BlockPos(this.posX, 0, this.posZ);
}
public Biome getBiome() {
return this.biome;
}
}

View file

@ -73,7 +73,7 @@ public class SPacketChunkData implements Packet<IClientPlayer>
int i = segments * 2 * 16 * 16 * 16;
int j = segments * 16 * 16 * 16 / 2;
int k = overworld ? segments * 16 * 16 * 16 / 2 : 0;
int l = biomes ? 256 * 2 : 0;
int l = biomes ? 256 * 8 : 0;
return i + j + k + l;
}

View file

@ -2,7 +2,6 @@ package common.world;
import java.util.List;
import common.biome.Biome;
import common.block.Block;
import common.dimension.Dimension;
import common.entity.Entity;
@ -10,6 +9,7 @@ import common.entity.npc.EntityNPC;
import common.entity.types.EntityLiving;
import common.network.IPlayer;
import common.network.Packet;
import common.rng.Random;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.ParticleType;
@ -46,6 +46,8 @@ public abstract class AWorldServer extends World {
public abstract boolean isDaytime();
public abstract int getSkylightSubtracted();
public abstract <T extends Entity> T findNearestEntityWithinAABB(Class<? extends T> entityType, BoundingBox aabb, T closestTo);
public abstract void setBiome(BlockPos pos, Biome biome);
public abstract void markChunkDirty(BlockPos pos);
public abstract void growGrass(BlockPos pos, State state, Random rand);
public abstract boolean generateBigMushroom(BlockPos pos, State state, Random rand);
public abstract void generateTree(BlockPos pos, State state, Random rand);
}

View file

@ -7,7 +7,6 @@ import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.function.Predicate;
import common.biome.Biome;
import common.block.Block;
import common.block.ITileEntityProvider;
import common.block.Material;
@ -32,7 +31,6 @@ public abstract class Chunk {
protected final Block fillerBlock;
protected final IntHashMap<BlockArray> blocks = new IntHashMap();
protected final Set<BlockArray> blockList = Sets.newHashSet();
protected final char[] biomes = new char[256];
protected final int[] precHeight = new int[256];
protected final boolean[] updateSky = new boolean[256];
protected final int[] height = new int[256];
@ -841,10 +839,4 @@ public abstract class Chunk {
public int getLowest() {
return this.minHeight;
}
public Biome getBiome(BlockPos pos) {
int x = pos.getX() & 15;
int z = pos.getZ() & 15;
return Biome.getBiomeDef(this.biomes[z << 4 | x]);
}
}

View file

@ -1,6 +1,5 @@
package common.world;
import common.biome.Biome;
import common.tileentity.TileEntity;
import common.util.BlockPos;
@ -8,5 +7,4 @@ public interface IWorldAccess extends IBlockAccess
{
TileEntity getTileEntity(BlockPos pos);
int getCombinedLight(BlockPos pos, int lightValue);
Biome getBiomeGenForCoords(BlockPos pos);
}

View file

@ -6,7 +6,6 @@ import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
import common.biome.Biome;
import common.block.Block;
import common.block.Material;
import common.block.artificial.BlockSlab;
@ -20,7 +19,6 @@ import common.collect.Lists;
import common.collect.Sets;
import common.dimension.DimType;
import common.dimension.Dimension;
import common.dimension.Galaxy;
import common.dimension.Moon;
import common.dimension.Planet;
import common.dimension.Sector;
@ -189,7 +187,7 @@ public abstract class World implements IWorldAccess {
return this.formatTime(player == null ? null : player.getOrigin().getDimension(), days);
}
public abstract Biome getBiomeGenForCoords(BlockPos pos);
protected abstract float getTemperature(BlockPos pos);
public boolean isAirBlock(BlockPos pos) {
return this.getState(pos).getBlock() == Blocks.air;
@ -1598,7 +1596,7 @@ public abstract class World implements IWorldAccess {
}
public float getTemperatureK(BlockPos pos) {
return Math.max(this.temp + this.getBiomeGenForCoords(pos).getTemperature(pos), 0.0f);
return this.dimension.isExterminated() ? World.ABSOLUTE_ZERO + 150.0f : Math.max(this.temp + this.getTemperature(pos), 0.0f);
}
public float getTemperatureC(BlockPos pos) {