move worldgen to server
This commit is contained in:
parent
e26938ee77
commit
111226fe28
159 changed files with 1917 additions and 1951 deletions
|
@ -1,6 +1,96 @@
|
|||
package common.biome;
|
||||
|
||||
public abstract class BaseBiome {
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.color.Colorizer;
|
||||
import common.log.Log;
|
||||
import common.rng.PerlinGen;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
|
||||
public enum BaseBiome {
|
||||
NONE(0, "none", "<Keins>", 0x000000),
|
||||
PLAINS(1, "plains", "Ebene", 0x8db360, 12.0f, 40.0f),
|
||||
DESERT(2, "desert", "Wüste", 0xfa9418, 60.0f, 0.0f),
|
||||
EXTREMEHILLS(3, "extremeHills", "Extremes Bergland", 0x606060, -12.0f, 30.0f),
|
||||
FOREST(4, "forest", "Wald", 0x056621, 8.0f, 80.0f),
|
||||
TAIGA(5, "taiga", "Taiga", 0x0b6659, -10.0f, 80.0f),
|
||||
SWAMPLAND(6, "swampland", "Sumpf", 0x07f9b2, 12.0f, 90.0f, 0xe0ffae, 0xffffffff, 6975545),
|
||||
RIVER(7, "river", "Fluss", 0x0000ff),
|
||||
EXTERMINATED(8, "exterminated", "Ausgelöscht", 0x000000, 150.0f, 0.0f, 0x202020, 0x303030, 0x303030, 0x101010, 0x303030, 0x000000),
|
||||
SPACE(9, "space", "Leere des Weltraums", 0x000000, 0.0f, 0.0f),
|
||||
FROZENSEA(10, "frozenSea", "Vereister See", 0x9090a0, -20.0f),
|
||||
FROZENRIVER(11, "frozenRiver", "Vereister Fluss", 0xa0a0ff, -20.0f),
|
||||
ICEPLAINS(12, "icePlains", "Eisebene", 0xffffff, -20.0f),
|
||||
ICEMOUNTAINS(13, "iceMountains", "Vereistes Bergland", 0xa0a0a0, -20.0f),
|
||||
MUSHROOMPLAINS(14, "mushroomPlains", "Pilzland", 0xff00ff, 16.0f, 100.0f),
|
||||
BLACKENED(15, "blackened", "Schwarz", 0x000000, 0.0f, 0.0f),
|
||||
BEACH(16, "beach", "Strand", 0xfade55, 12.0f, 40.0f),
|
||||
DESERTHILLS(17, "desertHills", "Wüsten-Bergland", 0xd25f12, 60.0f, 0.0f),
|
||||
FORESTHILLS(18, "forestHills", "Wald-Bergland", 0x22551c, 8.0f, 80.0f),
|
||||
TAIGAHILLS(19, "taigaHills", "Taiga-Bergland", 0x163933, -10.0f, 80.0f),
|
||||
EXTREMEHILLSEDGE(20, "extremeHillsEdge", "Extremes Bergland Gr.", 0x72789a, -12.0f, 30.0f),
|
||||
JUNGLE(21, "jungle", "Urwald", 0x537b09, 18.0f, 90.0f),
|
||||
JUNGLEHILLS(22, "jungleHills", "Urwald-Bergland", 0x2c4205, 18.0f, 90.0f),
|
||||
JUNGLEEDGE(23, "jungleEdge", "Urwald Gr.", 0x628b17, 18.0f, 80.0f),
|
||||
SEA(24, "sea", "See", 0x000070),
|
||||
STONEBEACH(25, "stoneBeach", "Steinstrand", 0xa2a284, -12.0f, 30.0f),
|
||||
COLDBEACH(26, "coldBeach", "Vereister Strand", 0xfaf0c0, -18.0f, 30.0f),
|
||||
BIRCHFOREST(27, "birchForest", "Birkenwald", 0x307444, 4.0f, 60.0f),
|
||||
BIRCHFORESTHILLS(28, "birchForestHills", "Birkenwald-Bergland", 0x1f5f32, 4.0f, 60.0f),
|
||||
ROOFEDFOREST(29, "roofedForest", "Dichter Wald", 0x40511a, 8.0f, 80.0f),
|
||||
COLDTAIGA(30, "coldTaiga", "Vereiste Taiga", 0x31554a, -40.0f, 40.0f),
|
||||
COLDTAIGAHILLS(31, "coldTaigaHills", "Vereistes Taiga-Bergland", 0x243f36, -40.0f, 40.0f),
|
||||
MEGATAIGA(32, "megaTaiga", "Hohe Taiga", 0x596651, -8.0f, 80.0f),
|
||||
MEGATAIGAHILLS(33, "megaTaigaHills", "Hohes Taiga-Bergland", 0x454f3e, -8.0f, 80.0f),
|
||||
EXTREMEHILLSPLUS(34, "extremeHillsPlus", "Extremes Bergland +", 0x507050, -12.0f, 30.0f),
|
||||
SAVANNA(35, "savanna", "Savanne", 0xbdb25f, 28.0f, 0.0f),
|
||||
SAVANNAPLATEAU(36, "savannaPlateau", "Savannen-Plateau", 0xa79d64, 20.0f, 0.0f),
|
||||
MESA(37, "mesa", "Mesa", 0xd94515, 0.0f, 0.0f, 0xffffff, 9470285, 10387789),
|
||||
MESAPLATEAUF(38, "mesaPlateauF", "Mesa-Waldplateau", 0xb09765, 0.0f, 0.0f, 0xffffff, 9470285, 10387789),
|
||||
MESAPLATEAU(39, "mesaPlateau", "Mesa-Plateau", 0xca8c65, 0.0f, 0.0f, 0xffffff, 9470285, 10387789),
|
||||
SNOWLAND(40, "snowLand", "Eisland", 0xffffff, 0.0f, 100.0f),
|
||||
TIAN(41, "tian", "Tian", 0x808080, 0.0f, 80.0f),
|
||||
ELVENFOREST(42, "elvenForest", "Elbenwald", 0x059821, 8.0f, 90.0f),
|
||||
UPPERHELL(43, "upperHell", "Übergang in die Hölle", 0xff0000, 0.0f, 0.0f, 0x000000, 0x000000, 0x000000),
|
||||
LOWERHELL(44, "lowerHell", "Abgrund der Hölle", 0xff0000, 0.0f, 0.0f, 0x000000, 0x000000, 0x000000),
|
||||
HELLHILLS(45, "hellHills", "Bergland der Hölle", 0xff0000, 0.0f, 0.0f, 0x000000, 0x000000, 0x000000),
|
||||
SOULPLAINS(46, "soulPlains", "Seelenland", 0xff0000, 0.0f, 0.0f, 0x000000, 0x000000, 0x000000),
|
||||
ASHLAND(47, "ashLand", "Verbrannt", 0xff0000, 0.0f, 0.0f, 0x000000, 0x000000, 0x000000),
|
||||
MOON(48, "moon", "Mondoberfläche", 0xa0a0a0, 0.0f, 0.0f),
|
||||
CHAOS(49, "chaos", "Chaos", 0xff00ff),
|
||||
|
||||
DESERTM(130, "desertM", "Wüste M", 0xfa9418, 60.0f, 0.0f),
|
||||
EXTREMEHILLSM(131, "extremeHillsM", "Extremes Bergland M", 0x606060, -12.0f, 30.0f),
|
||||
FLOWERFOREST(132, "flowerForest", "Blumenwald", 0x6a7425, 8.0f, 80.0f),
|
||||
TAIGAM(133, "taigaM", "Taiga M", 0x0b6659, -10.0f, 80.0f),
|
||||
SWAMPLANDM(134, "swamplandM", "Sumpf M", 0x07f9b2, 12.0f, 90.0f, 0xe0ffae, 0xffffffff, 6975545),
|
||||
ICEPLAINSSPIKES(140, "icePlainsSpikes", "Eisebene + Spitzen", 0xd2ffff, -20.0f),
|
||||
JUNGLEM(149, "jungleM", "Urwald M", 0x537b09, 18.0f, 90.0f),
|
||||
JUNGLEEDGEM(151, "jungleEdgeM", "Urwald Gr. M", 0x628b17, 18.0f, 80.0f),
|
||||
BIRCHFORESTM(155, "birchForestM", "Birkenwald M", 0x307444, 4.0f, 60.0f),
|
||||
BIRCHFORESTHILLSM(156, "birchForestHillsM", "Birkenwald-Bergland M", 0x1f5f32, 4.0f, 60.0f),
|
||||
ROOFEDFORESTM(157, "roofedForestM", "Dichter Wald M", 0x40511a, 8.0f, 80.0f),
|
||||
COLDTAIGAM(158, "coldTaigaM", "Vereiste Taiga M", 0x31554a, -40.0f, 40.0f),
|
||||
MEGASPRUCETAIGA(160, "megaSpruceTaiga", "Hohe Fichtentaiga", 0x596651, -10.0f, 80.0f),
|
||||
REDWOODTAIGAHILLSM(161, "redwoodTaigaHillsM", "Mammutbaumtaiga", 0x596651, -10.0f, 80.0f),
|
||||
EXTREMEHILLSPLUSM(162, "extremeHillsPlusM", "Extremes Bergland + M", 0x507050, -12.0f, 30.0f),
|
||||
SAVANNAM(163, "savannaM", "Savanne M", 0xbdb25f, 24.0f, 0.0f),
|
||||
SAVANNAPLATEAUM(164, "savannaPlateauM", "Savannen-Plateau M", 0xa79d64, 20.0f, 0.0f),
|
||||
MESABRYCE(165, "mesaBryce", "Mesa (Bryce)", 0xd94515, 0.0f, 0.0f, 0xffffff, 9470285, 10387789),
|
||||
MESAPLATEAUFM(166, "mesaPlateauFM", "Mesa-Waldplateau M", 0xb09765, 0.0f, 0.0f, 0xffffff, 9470285, 10387789),
|
||||
MESAPLATEAUM(167, "mesaPlateauM", "Mesa-Plateau M", 0xca8c65, 0.0f, 0.0f, 0xffffff, 9470285, 10387789);
|
||||
|
||||
public static final BaseBiome DEF_BIOME = FOREST;
|
||||
private static final PerlinGen TEMP_NOISE = new PerlinGen(new Random(1234L), 1);
|
||||
private static final PerlinGen COLOR_NOISE = new PerlinGen(new Random(2345L), 1);
|
||||
private static final BaseBiome[] BIOMES = new BaseBiome[256];
|
||||
private static final Map<String, BaseBiome> LOOKUP = Maps.newTreeMap();
|
||||
|
||||
public final int id;
|
||||
public final String name;
|
||||
public final String display;
|
||||
|
@ -8,11 +98,68 @@ public abstract class BaseBiome {
|
|||
public final float temperature;
|
||||
public final float humidity;
|
||||
public final int waterColor;
|
||||
public final int grassColor;
|
||||
public final int foliageColor;
|
||||
public final int skyColor;
|
||||
public final int fogColor;
|
||||
public final int cloudColor;
|
||||
|
||||
static {
|
||||
for(BaseBiome biome : values()) {
|
||||
BIOMES[biome.id] = biome;
|
||||
if(LOOKUP.containsKey(biome.name.toLowerCase()))
|
||||
throw new IllegalStateException("Biom \"" + biome.name + "\" ist als ID " + LOOKUP.get(biome.name.toLowerCase()).id + " und " + biome.id + " definiert");
|
||||
LOOKUP.put(biome.name.toLowerCase(), biome);
|
||||
}
|
||||
}
|
||||
|
||||
public static BaseBiome getBiome(int id)
|
||||
{
|
||||
if (id >= 0 && id < BIOMES.length)
|
||||
{
|
||||
return BIOMES[id];
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.JNI.warn("Biom-ID ist nicht im Bereich: " + id + ", verwende " + DEF_BIOME.id + " (" + DEF_BIOME.name + ")");
|
||||
return DEF_BIOME;
|
||||
}
|
||||
}
|
||||
|
||||
private BaseBiome(int id, String name, String display, int color, float temperature, float humidity, int waterColor, int skyColor, int fogColor, int cloudColor) {
|
||||
public static BaseBiome getBiomeDef(int id)
|
||||
{
|
||||
if (id >= 0 && id < BIOMES.length)
|
||||
{
|
||||
BaseBiome biome = BIOMES[id];
|
||||
return biome == null ? DEF_BIOME : biome;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.JNI.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());
|
||||
}
|
||||
|
||||
public static BaseBiome findByName(String name) {
|
||||
BaseBiome 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 BaseBiome(int id, String name, String display, int color, float temperature, float humidity, int waterColor, int grassColor, int foliageColor, int skyColor, int fogColor, int cloudColor) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.display = display;
|
||||
|
@ -20,28 +167,69 @@ public abstract class BaseBiome {
|
|||
this.humidity = humidity;
|
||||
this.color = color;
|
||||
this.waterColor = waterColor;
|
||||
this.grassColor = grassColor;
|
||||
this.foliageColor = foliageColor;
|
||||
this.skyColor = skyColor;
|
||||
this.fogColor = fogColor;
|
||||
this.cloudColor = cloudColor;
|
||||
}
|
||||
|
||||
private BaseBiome(int id, String name, String display, int color, float temperature, float humidity, int waterColor) {
|
||||
this(id, name, display, color, temperature, humidity, waterColor, 0xffffffff, 0xffffffff, 0xffffffff);
|
||||
}
|
||||
|
||||
private BaseBiome(int id, String name, String display, int color, float temperature, float humidity, int skyColor, int fogColor, int cloudColor) {
|
||||
this(id, name, display, color, temperature, humidity, 0xffffff, skyColor, fogColor, cloudColor);
|
||||
private BaseBiome(int id, String name, String display, int color, float temperature, float humidity, int waterColor, int grassColor, int foliageColor) {
|
||||
this(id, name, display, color, temperature, humidity, waterColor, grassColor, foliageColor, 0xffffffff, 0xffffffff, 0xffffffff);
|
||||
}
|
||||
|
||||
private BaseBiome(int id, String name, String display, int color, float temperature, float humidity) {
|
||||
this(id, name, display, color, temperature, humidity, 0xffffff, 0xffffffff, 0xffffffff, 0xffffffff);
|
||||
this(id, name, display, color, temperature, humidity, 0xffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
|
||||
}
|
||||
|
||||
private BaseBiome(int id, String name, String display, int color, float temperature) {
|
||||
this(id, name, display, color, temperature, 50.0f, 0xffffff, 0xffffffff, 0xffffffff, 0xffffffff);
|
||||
this(id, name, display, color, temperature, 50.0f, 0xffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
|
||||
}
|
||||
|
||||
private BaseBiome(int id, String name, String display, int color) {
|
||||
this(id, name, display, color, 0.0f, 50.0f, 0xffffff, 0xffffffff, 0xffffffff, 0xffffffff);
|
||||
this(id, name, display, color, 0.0f, 50.0f, 0xffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 boolean isHighHumidity() {
|
||||
return this.humidity > 85.0f;
|
||||
}
|
||||
|
||||
// skycolor = ((temp + 14) / 40 + 0.15) / 3
|
||||
|
||||
public int getGrassColorAtPos(BlockPos pos) {
|
||||
if(this.grassColor != 0xffffffff)
|
||||
return this.grassColor;
|
||||
if(this == SWAMPLAND || this == SWAMPLANDM) {
|
||||
double d0 = COLOR_NOISE.generate((double)pos.getX() * 0.0225D, (double)pos.getZ() * 0.0225D);
|
||||
return d0 < -0.1D ? 5011004 : 6975545;
|
||||
}
|
||||
if(this == ELVENFOREST)
|
||||
return Colorizer.getGrassColor(1.0f, this.humidity * 0.01f);
|
||||
double d0 = (double)ExtMath.clampf((this.getTemperature(pos) + 14.0f) / 40.0f + 0.15f, 0.0F, 1.0F);
|
||||
double d1 = (double)ExtMath.clampf(this.humidity * 0.01f, 0.0F, 1.0F);
|
||||
return this == ROOFEDFOREST || this == ROOFEDFORESTM ? (Colorizer.getGrassColor(d0, d1) & 16711422) + 2634762 >> 1 : Colorizer.getGrassColor(d0, d1);
|
||||
}
|
||||
|
||||
public int getFoliageColorAtPos(BlockPos pos) {
|
||||
if(this.foliageColor != 0xffffffff)
|
||||
return this.foliageColor;
|
||||
if(this == ELVENFOREST)
|
||||
return Colorizer.getFoliageColor(1.0f, this.humidity * 0.01f);
|
||||
double d0 = (double)ExtMath.clampf((this.getTemperature(pos) + 14.0f) / 40.0f + 0.15f, 0.0F, 1.0F);
|
||||
double d1 = (double)ExtMath.clampf(this.humidity * 0.01f, 0.0F, 1.0F);
|
||||
return Colorizer.getFoliageColor(d0, d1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,772 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockColored;
|
||||
import common.block.BlockFlower;
|
||||
import common.block.BlockSand;
|
||||
import common.block.BlockTallGrass;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.color.Colorizer;
|
||||
import common.color.DyeColor;
|
||||
import common.entity.animal.EntityBat;
|
||||
import common.entity.animal.EntityChicken;
|
||||
import common.entity.animal.EntityCow;
|
||||
import common.entity.animal.EntityMouse;
|
||||
import common.entity.animal.EntityPig;
|
||||
import common.entity.animal.EntityRabbit;
|
||||
import common.entity.animal.EntitySheep;
|
||||
import common.entity.animal.EntitySquid;
|
||||
import common.entity.npc.EntityArachnoid;
|
||||
import common.entity.npc.EntityHaunter;
|
||||
import common.entity.npc.EntityMage;
|
||||
import common.entity.npc.EntitySlime;
|
||||
import common.entity.npc.EntityUndead;
|
||||
import common.entity.npc.EntityZombie;
|
||||
import common.init.Blocks;
|
||||
import common.log.Log;
|
||||
import common.material.Material;
|
||||
import common.rng.PerlinGen;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.ChunkPrimer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
import common.worldgen.feature.WorldGenClay;
|
||||
import common.worldgen.feature.WorldGenClayExt;
|
||||
import common.worldgen.feature.WorldGenSand;
|
||||
import common.worldgen.foliage.FeatureDoublePlant;
|
||||
import common.worldgen.foliage.WorldGenBigMushroom;
|
||||
import common.worldgen.foliage.WorldGenCactus;
|
||||
import common.worldgen.foliage.WorldGenDeadBush;
|
||||
import common.worldgen.foliage.WorldGenFlowers;
|
||||
import common.worldgen.foliage.WorldGenMushroom;
|
||||
import common.worldgen.foliage.WorldGenPumpkin;
|
||||
import common.worldgen.foliage.WorldGenReed;
|
||||
import common.worldgen.foliage.WorldGenTallGrass;
|
||||
import common.worldgen.foliage.WorldGenWaterlily;
|
||||
import common.worldgen.tree.WorldGenBaseTree;
|
||||
import common.worldgen.tree.WorldGenBigTree;
|
||||
import common.worldgen.tree.WorldGenSwamp;
|
||||
import common.worldgen.tree.WorldGenTree;
|
||||
|
||||
public abstract class Biome {
|
||||
private static final Biome[] BIOMES = new Biome[256];
|
||||
|
||||
public static final Biome none = (new BiomeNone(0)).setBiomeName("none", "<Keins>");
|
||||
|
||||
public static final Biome plains = (new BiomePlains(1)).setColor(9286496).setBiomeName("plains", "Ebene");
|
||||
public static final Biome desert = (new BiomeDesert(2)).setColor(16421912).setBiomeName("desert", "Wüste").setTemperature(60.0f).setHumidity(0.0f).setScaling(Scaling.PLAINS_LOW);
|
||||
public static final Biome extremeHills = (new BiomeHills(3, false)).setColor(6316128).setBiomeName("extremeHills", "Extremes Bergland").setScaling(Scaling.HILLS_LARGE).setTemperature(-12.0f).setHumidity(30.0f);
|
||||
public static final Biome forest = (new BiomeForest(4, 0)).setColor(353825).setBiomeName("forest", "Wald");
|
||||
public static final Biome taiga = (new BiomeTaiga(5, 0)).setColor(747097).setBiomeName("taiga", "Taiga").setTemperature(-10.0f).setHumidity(80.0f).setScaling(Scaling.PLAINS_MEDIUM);
|
||||
public static final Biome swampland = (new BiomeSwamp(6)).setColor(522674).setBiomeName("swampland", "Sumpf").setScaling(Scaling.SEA_POND).setTemperature(12.0f).setHumidity(90.0f);
|
||||
public static final Biome river = (new BiomeWater(7, true)).setColor(255).setBiomeName("river", "Fluss").setScaling(Scaling.SEA_SHALLOW);
|
||||
|
||||
public static final Biome exterminated = (new BiomeExterminated(8)).setColor(0x000000).setBiomeName("exterminated", "Ausgelöscht").setHumidity(0.0f).setTemperature(150.0f);
|
||||
public static final Biome space = (new BiomeSpace(9)).setColor(0x000000).setBiomeName("space", "Leere des Weltraums").setHumidity(0.0f);
|
||||
|
||||
public static final Biome frozenSea = (new BiomeWater(10, false)).setColor(9474208).setBiomeName("frozenSea", "Vereister See").enableColdBeach().setScaling(Scaling.SEA_MEDIUM).setTemperature(-20.0f).setHumidity(50.0f);
|
||||
public static final Biome frozenRiver = (new BiomeWater(11, true)).setColor(10526975).setBiomeName("frozenRiver", "Vereister Fluss").enableColdBeach().setScaling(Scaling.SEA_SHALLOW).setTemperature(-20.0f).setHumidity(50.0f);
|
||||
public static final Biome icePlains = (new BiomeSnow(12, false)).setColor(16777215).setBiomeName("icePlains", "Eisebene").enableColdBeach().setTemperature(-20.0f).setHumidity(50.0f).setScaling(Scaling.PLAINS_LOW);
|
||||
public static final Biome iceMountains = (new BiomeSnow(13, false)).setColor(10526880).setBiomeName("iceMountains", "Vereistes Bergland").enableColdBeach().setScaling(Scaling.HILLS_LOW).setTemperature(-20.0f).setHumidity(50.0f);
|
||||
public static final Biome mushroomPlains = (new BiomeMushroom(14)).setColor(16711935).setBiomeName("mushroomPlains", "Pilzland").setTemperature(16.0f).setHumidity(100.0f).setScaling(Scaling.PLAINS_VARYING);
|
||||
public static final Biome blackened = (new BiomeBlackened(15)).setColor(0x000000).setBiomeName("blackened", "Schwarz").setHumidity(0.0f);
|
||||
public static final Biome beach = (new BiomeBeach(16)).setColor(16440917).setBiomeName("beach", "Strand").setTemperature(12.0f).setHumidity(40.0f).setScaling(Scaling.SEA_SHORE);
|
||||
public static final Biome desertHills = (new BiomeDesert(17)).setColor(13786898).setBiomeName("desertHills", "Wüsten-Bergland").setTemperature(60.0f).setHumidity(0.0f).setScaling(Scaling.HILLS_LOW);
|
||||
public static final Biome forestHills = (new BiomeForest(18, 0)).setColor(2250012).setBiomeName("forestHills", "Wald-Bergland").setScaling(Scaling.HILLS_LOW);
|
||||
public static final Biome taigaHills = (new BiomeTaiga(19, 0)).setColor(1456435).setBiomeName("taigaHills", "Taiga-Bergland").setTemperature(-10.0f).setHumidity(80.0f).setScaling(Scaling.HILLS_LOW);
|
||||
public static final Biome extremeHillsEdge = (new BiomeHills(20, true)).setColor(7501978).setBiomeName("extremeHillsEdge", "Extremes Bergland Gr.").setScaling(Scaling.HILLS_MEDIUM).setTemperature(-12.0f).setHumidity(30.0f);
|
||||
public static final Biome jungle = (new BiomeJungle(21, false)).setColor(5470985).setBiomeName("jungle", "Urwald").setTemperature(18.0f).setHumidity(90.0f);
|
||||
public static final Biome jungleHills = (new BiomeJungle(22, false)).setColor(2900485).setBiomeName("jungleHills", "Urwald-Bergland").setTemperature(18.0f).setHumidity(90.0f).setScaling(Scaling.HILLS_LOW);
|
||||
public static final Biome jungleEdge = (new BiomeJungle(23, true)).setColor(6458135).setBiomeName("jungleEdge", "Urwald Gr.").setTemperature(18.0f).setHumidity(80.0f);
|
||||
public static final Biome sea = (new BiomeWater(24, false)).setColor(112).setBiomeName("sea", "See").setScaling(Scaling.SEA_MEDIUM);
|
||||
public static final Biome stoneBeach = (new BiomeStoneBeach(25)).setColor(10658436).setBiomeName("stoneBeach", "Steinstrand").setTemperature(-12.0f).setHumidity(30.0f).setScaling(Scaling.SEA_VARYING);
|
||||
public static final Biome coldBeach = (new BiomeBeach(26)).setColor(16445632).setBiomeName("coldBeach", "Vereister Strand").setTemperature(-18.0f).setHumidity(30.0f).setScaling(Scaling.SEA_SHORE).enableColdBeach();
|
||||
public static final Biome birchForest = (new BiomeForest(27, 2)).setBiomeName("birchForest", "Birkenwald").setColor(3175492);
|
||||
public static final Biome birchForestHills = (new BiomeForest(28, 2)).setBiomeName("birchForestHills", "Birkenwald-Bergland").setColor(2055986).setScaling(Scaling.HILLS_LOW);
|
||||
public static final Biome roofedForest = (new BiomeForest(29, 3)).setColor(4215066).setBiomeName("roofedForest", "Dichter Wald");
|
||||
public static final Biome coldTaiga = (new BiomeTaiga(30, 0)).setColor(3233098).setBiomeName("coldTaiga", "Vereiste Taiga").enableColdBeach().setTemperature(-40.0f).setHumidity(40.0f).setScaling(Scaling.PLAINS_MEDIUM);
|
||||
public static final Biome coldTaigaHills = (new BiomeTaiga(31, 0)).setColor(2375478).setBiomeName("coldTaigaHills", "Vereistes Taiga-Bergland").enableColdBeach().setTemperature(-40.0f).setHumidity(40.0f).setScaling(Scaling.HILLS_LOW);
|
||||
public static final Biome megaTaiga = (new BiomeTaiga(32, 1)).setColor(5858897).setBiomeName("megaTaiga", "Hohe Taiga").setTemperature(-8.0f).setHumidity(80.0f).setScaling(Scaling.PLAINS_MEDIUM);
|
||||
public static final Biome megaTaigaHills = (new BiomeTaiga(33, 1)).setColor(4542270).setBiomeName("megaTaigaHills", "Hohes Taiga-Bergland").setTemperature(-8.0f).setHumidity(80.0f).setScaling(Scaling.HILLS_LOW);
|
||||
public static final Biome extremeHillsPlus = (new BiomeHills(34, true)).setColor(5271632).setBiomeName("extremeHillsPlus", "Extremes Bergland +").setScaling(Scaling.HILLS_LARGE).setTemperature(-12.0f).setHumidity(30.0f);
|
||||
public static final Biome savanna = (new BiomeSavanna(35)).setColor(12431967).setBiomeName("savanna", "Savanne").setTemperature(28.0F).setHumidity(0.0f).setScaling(Scaling.PLAINS_LOW);
|
||||
public static final Biome savannaPlateau = (new BiomeSavanna(36)).setColor(10984804).setBiomeName("savannaPlateau", "Savannen-Plateau").setTemperature(20.0F).setHumidity(0.0f).setScaling(Scaling.HILLS_PLATEAU);
|
||||
|
||||
public static final Biome mesa = (new BiomeMesa(37, false, false)).setColor(14238997).setBiomeName("mesa", "Mesa");
|
||||
public static final Biome mesaPlateau_F = (new BiomeMesa(38, false, true)).setColor(11573093).setBiomeName("mesaPlateauF", "Mesa-Waldplateau").setScaling(Scaling.HILLS_PLATEAU);
|
||||
public static final Biome mesaPlateau = (new BiomeMesa(39, false, false)).setColor(13274213).setBiomeName("mesaPlateau", "Mesa-Plateau").setScaling(Scaling.HILLS_PLATEAU);
|
||||
|
||||
public static final Biome snowLand = (new BiomeSnowLand(40)).setColor(0xffffff).setBiomeName("snowLand", "Eisland").enableColdBeach().setHumidity(100.0f);
|
||||
public static final Biome tian = (new BiomeTian(41)).setColor(0x808080).setBiomeName("tian", "Tian").setHumidity(80.0f).setScaling(Scaling.VARYING_MEDIUM);
|
||||
public static final Biome elvenForest = (new BiomeForest(42, 4)).setColor(0x059821).setBiomeName("elvenForest", "Elbenwald").setHumidity(90.0f);
|
||||
public static final Biome upperHell = (new BiomeHell(43, 0)).setColor(16711680).setBiomeName("upperHell", "Übergang in die Hölle").setHumidity(0.0f);
|
||||
public static final Biome lowerHell = (new BiomeHell(44, 1)).setColor(16711680).setBiomeName("lowerHell", "Abgrund der Hölle").setHumidity(0.0f);
|
||||
public static final Biome hellHills = (new BiomeHell(45, 1)).setColor(16711680).setBiomeName("hellHills", "Bergland der Hölle").setHumidity(0.0f).setScaling(Scaling.HILLS_LARGE);
|
||||
public static final Biome soulPlains = (new BiomeHell(46, 1)).setColor(16711680).setBiomeName("soulPlains", "Seelenland").setHumidity(0.0f).setScaling(Scaling.SEA_POND);
|
||||
public static final Biome ashLand = (new BiomeHell(47, 2)).setColor(16711680).setBiomeName("ashLand", "Verbrannt").setHumidity(0.0f).setScaling(Scaling.PLAINS_LOW);
|
||||
public static final Biome moon = (new BiomeMoon(48)).setColor(0xa0a0a0).setBiomeName("moon", "Mondoberfläche").setHumidity(0.0f).setScaling(Scaling.PLAINS_LOW);
|
||||
public static final Biome chaos = (new BiomeChaos(49)).setColor(0xff00ff).setBiomeName("chaos", "Chaos").setHumidity(50.0f).setScaling(Scaling.VARYING_CHAOTIC);
|
||||
|
||||
public static final Biome DEF_BIOME = forest;
|
||||
protected static final PerlinGen TEMP_NOISE;
|
||||
protected static final PerlinGen TREE_NOISE;
|
||||
protected static final PerlinGen GRASS_NOISE;
|
||||
protected static final FeatureDoublePlant DOUBLE_PLANT_GEN;
|
||||
private static final Map<String, Biome> LOOKUP = Maps.newTreeMap();
|
||||
private static final List<Biome> LIST = Lists.newArrayList();
|
||||
|
||||
public final int id;
|
||||
|
||||
protected final WeightedList<RngSpawn> mobs = new WeightedList<RngSpawn>();
|
||||
protected final WorldGenBaseTree worldGeneratorTrees = new WorldGenBaseTree(false);
|
||||
protected final WorldGenBigTree worldGeneratorBigTree = new WorldGenBigTree(false);
|
||||
protected final WorldGenSwamp worldGeneratorSwamp = new WorldGenSwamp();
|
||||
private final FeatureGenerator clayGen = new WorldGenClay(4);
|
||||
private final FeatureGenerator sandGen = new WorldGenSand(Blocks.sand, 7);
|
||||
private final FeatureGenerator gravelAsSandGen = new WorldGenSand(Blocks.gravel, 6);
|
||||
private final WorldGenFlowers yellowFlowerGen = new WorldGenFlowers(Blocks.flower, BlockFlower.EnumFlowerType.DANDELION);
|
||||
private final FeatureGenerator mushroomBrownGen = new WorldGenMushroom(Blocks.brown_mushroom);
|
||||
private final FeatureGenerator mushroomRedGen = new WorldGenMushroom(Blocks.red_mushroom);
|
||||
private final FeatureGenerator bigMushroomGen = new WorldGenBigMushroom();
|
||||
private final FeatureGenerator reedGen = new WorldGenReed();
|
||||
private final FeatureGenerator cactusGen = new WorldGenCactus();
|
||||
private final FeatureGenerator waterlilyGen = new WorldGenWaterlily();
|
||||
private final FeatureGenerator clayGenExt = new WorldGenClayExt(32);
|
||||
|
||||
public String name = null;
|
||||
public String display = "<?>";
|
||||
public int color = 0x000000;
|
||||
protected float temperature = 0.0f;
|
||||
protected float humidity = 50.0f;
|
||||
public int waterColor = 0xffffff;
|
||||
|
||||
public State topBlock = Blocks.grass.getState();
|
||||
public State fillerBlock = Blocks.dirt.getState();
|
||||
public float depth = Scaling.VARYING_LOW.depth;
|
||||
public float scale = Scaling.VARYING_LOW.scale;
|
||||
public boolean generateLakes = true;
|
||||
public boolean generateLiquids = true;
|
||||
public boolean allowColdBeach = false;
|
||||
public boolean disallowBeach = false;
|
||||
|
||||
protected int waterlilyPerChunk = 0;
|
||||
protected int treesPerChunk = 0;
|
||||
protected int flowersPerChunk = 2;
|
||||
protected int grassPerChunk = 1;
|
||||
protected int deadBushPerChunk = 0;
|
||||
protected int mushroomsPerChunk = 0;
|
||||
protected int reedsPerChunk = 0;
|
||||
protected int cactiPerChunk = 0;
|
||||
protected int sandPerChunk = 1;
|
||||
protected int sandPerChunk2 = 3;
|
||||
protected int clayPerChunk = 1;
|
||||
protected int clayExtPerChunk = 0; // 10
|
||||
protected int bigMushroomsPerChunk = 0;
|
||||
|
||||
protected Biome(int id) {
|
||||
this.id = id;
|
||||
BIOMES[id] = this;
|
||||
this.addMobs(this.mobs);
|
||||
}
|
||||
|
||||
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(EntityPig.class, 10, 4, 4));
|
||||
mobs.add(new RngSpawn(EntityChicken.class, 10, 4, 4));
|
||||
mobs.add(new RngSpawn(EntityCow.class, 8, 4, 4));
|
||||
mobs.add(new RngSpawn(EntityArachnoid.class, 100, 4, 4));
|
||||
mobs.add(new RngSpawn(EntityZombie.class, 100, 4, 4));
|
||||
mobs.add(new RngSpawn(EntityUndead.class, 100, 4, 4));
|
||||
mobs.add(new RngSpawn(EntityHaunter.class, 100, 4, 4));
|
||||
mobs.add(new RngSpawn(EntitySlime.class, 100, 4, 4));
|
||||
// mobs.add(new Biome.RngSpawn(EntityEnder....class, 10, 1, 4));
|
||||
mobs.add(new RngSpawn(EntityMage.class, 5, 1, 1));
|
||||
mobs.add(new RngSpawn(EntitySquid.class, 10, 4, 4));
|
||||
mobs.add(new RngSpawn(EntityBat.class, 10, 8, 8));
|
||||
mobs.add(new RngSpawn(EntityMouse.class, 10, 8, 8));
|
||||
}
|
||||
|
||||
public int getSkyColor() {
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
public int getFogColor() {
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
public int getCloudColor() {
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
public float getFactor() {
|
||||
float f = this.humidity * 0.01f * ((this.temperature + 14.0f) / 40.0f + 0.15f);
|
||||
return f > 1.0f ? 1.0f : f;
|
||||
}
|
||||
|
||||
// skycolor = ((temp + 14) / 40 + 0.15) / 3
|
||||
protected Biome setTemperature(float temp)
|
||||
{
|
||||
this.temperature = temp;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Biome setHumidity(float humidity)
|
||||
{
|
||||
this.humidity = humidity;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected final Biome setScaling(Scaling scaling)
|
||||
{
|
||||
return this.setScaling(scaling.depth, scaling.scale);
|
||||
}
|
||||
|
||||
protected final Biome setScaling(float depth, float scale)
|
||||
{
|
||||
this.depth = depth;
|
||||
this.scale = scale;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return rand.chance(10) ? this.worldGeneratorBigTree : this.worldGeneratorTrees;
|
||||
}
|
||||
|
||||
public WorldGenTree genBigTreeLegacy(Random rand, BlockPos pos)
|
||||
{
|
||||
int noise = (int)((TREE_NOISE.generate((double)pos.getX() * 0.5D, (double)pos.getZ() * 0.5D) / 8D + rand.doublev() * 4D + 4D) / 3D);
|
||||
return (noise > 0 && rand.chance(noise)) || (this.isHighHumidity() && rand.chance(3)) ? this.worldGeneratorBigTree :
|
||||
this.worldGeneratorTrees;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a WorldGen appropriate for this biome.
|
||||
*/
|
||||
public FeatureGenerator getRandomWorldGenForGrass(Random rand)
|
||||
{
|
||||
return new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS);
|
||||
}
|
||||
|
||||
public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
|
||||
{
|
||||
return rand.rarity(3) ? BlockFlower.EnumFlowerType.DANDELION : BlockFlower.EnumFlowerType.ROSE;
|
||||
}
|
||||
|
||||
protected Biome enableColdBeach()
|
||||
{
|
||||
this.allowColdBeach = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Biome disableBeach()
|
||||
{
|
||||
this.disallowBeach = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Biome setBiomeName(String name, String display)
|
||||
{
|
||||
this.name = name;
|
||||
this.display = display;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Biome setColor(int colorIn)
|
||||
{
|
||||
this.color = colorIn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WeightedList<RngSpawn> getMobs()
|
||||
{
|
||||
return this.mobs;
|
||||
}
|
||||
|
||||
public boolean isHighHumidity()
|
||||
{
|
||||
return this.humidity > 85.0f;
|
||||
}
|
||||
|
||||
public float getMobGenChance()
|
||||
{
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.temperature;
|
||||
}
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer world, Random rand, BlockPos pos)
|
||||
{
|
||||
for (int i = 0; i < this.sandPerChunk2; ++i)
|
||||
{
|
||||
int j = rand.chOffset();
|
||||
int k = rand.chOffset();
|
||||
this.sandGen.generate(world, rand, world.getTopSolidOrLiquidBlock(pos.add(j, 0, k)));
|
||||
}
|
||||
|
||||
for (int i1 = 0; i1 < this.clayPerChunk; ++i1)
|
||||
{
|
||||
int l1 = rand.chOffset();
|
||||
int i6 = rand.chOffset();
|
||||
this.clayGen.generate(world, rand, world.getTopSolidOrLiquidBlock(pos.add(l1, 0, i6)));
|
||||
}
|
||||
|
||||
for (int j1 = 0; j1 < this.sandPerChunk; ++j1)
|
||||
{
|
||||
int i2 = rand.chOffset();
|
||||
int j6 = rand.chOffset();
|
||||
this.gravelAsSandGen.generate(world, rand, world.getTopSolidOrLiquidBlock(pos.add(i2, 0, j6)));
|
||||
}
|
||||
|
||||
for (int i1 = 0; i1 < this.clayExtPerChunk; ++i1)
|
||||
{
|
||||
int l1 = rand.chOffset();
|
||||
int i6 = rand.chOffset();
|
||||
this.clayGenExt.generate(world, rand, world.getTopSolidOrLiquidBlock(pos.add(l1, 0, i6)));
|
||||
}
|
||||
|
||||
int k1 = this.treesPerChunk;
|
||||
|
||||
if (rand.chance(10))
|
||||
{
|
||||
++k1;
|
||||
}
|
||||
|
||||
for (int j2 = 0; j2 < k1; ++j2)
|
||||
{
|
||||
int k6 = rand.chOffset();
|
||||
int l = rand.chOffset();
|
||||
WorldGenTree treeGen = this.genBigTreeChance(rand);
|
||||
treeGen.prepare();
|
||||
BlockPos blockpos = world.getHeight(pos.add(k6, 0, l));
|
||||
|
||||
if (treeGen.generate(world, rand, blockpos))
|
||||
{
|
||||
treeGen.finish(world, rand, blockpos);
|
||||
}
|
||||
}
|
||||
|
||||
for (int k2 = 0; k2 < this.bigMushroomsPerChunk; ++k2)
|
||||
{
|
||||
int l6 = rand.chOffset();
|
||||
int k10 = rand.chOffset();
|
||||
this.bigMushroomGen.generate(world, rand, world.getHeight(pos.add(l6, 0, k10)));
|
||||
}
|
||||
|
||||
for (int l2 = 0; l2 < this.flowersPerChunk; ++l2)
|
||||
{
|
||||
int i7 = rand.chOffset();
|
||||
int l10 = rand.chOffset();
|
||||
int j14 = world.getHeight(pos.add(i7, 0, l10)).getY() + 32;
|
||||
|
||||
if (j14 > 0)
|
||||
{
|
||||
int k17 = rand.zrange(j14);
|
||||
BlockPos blockpos1 = pos.add(i7, k17, l10);
|
||||
BlockFlower.EnumFlowerType blockflower$enumflowertype = this.pickRandomFlower(rand, blockpos1);
|
||||
BlockFlower blockflower = blockflower$enumflowertype.getBlockType().getBlock();
|
||||
|
||||
if (blockflower.getMaterial() != Material.air)
|
||||
{
|
||||
this.yellowFlowerGen.setGeneratedBlock(blockflower, blockflower$enumflowertype);
|
||||
this.yellowFlowerGen.generate(world, rand, blockpos1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i3 = 0; i3 < this.grassPerChunk; ++i3)
|
||||
{
|
||||
int j7 = rand.chOffset();
|
||||
int i11 = rand.chOffset();
|
||||
int k14 = world.getHeight(pos.add(j7, 0, i11)).getY() * 2;
|
||||
|
||||
if (k14 > 0)
|
||||
{
|
||||
int l17 = rand.zrange(k14);
|
||||
this.getRandomWorldGenForGrass(rand).generate(world, rand, pos.add(j7, l17, i11));
|
||||
}
|
||||
}
|
||||
|
||||
for (int j3 = 0; j3 < this.deadBushPerChunk; ++j3)
|
||||
{
|
||||
int k7 = rand.chOffset();
|
||||
int j11 = rand.chOffset();
|
||||
int l14 = world.getHeight(pos.add(k7, 0, j11)).getY() * 2;
|
||||
|
||||
if (l14 > 0)
|
||||
{
|
||||
int i18 = rand.zrange(l14);
|
||||
(new WorldGenDeadBush()).generate(world, rand, pos.add(k7, i18, j11));
|
||||
}
|
||||
}
|
||||
|
||||
for (int k3 = 0; k3 < this.waterlilyPerChunk; ++k3)
|
||||
{
|
||||
int l7 = rand.chOffset();
|
||||
int k11 = rand.chOffset();
|
||||
int i15 = world.getHeight(pos.add(l7, 0, k11)).getY() * 2;
|
||||
|
||||
if (i15 > 0)
|
||||
{
|
||||
int j18 = rand.zrange(i15);
|
||||
BlockPos blockpos4;
|
||||
BlockPos blockpos7;
|
||||
|
||||
for (blockpos4 = pos.add(l7, j18, k11); blockpos4.getY() > 0; blockpos4 = blockpos7)
|
||||
{
|
||||
blockpos7 = blockpos4.down();
|
||||
|
||||
if (!world.isAirBlock(blockpos7))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.waterlilyGen.generate(world, rand, blockpos4);
|
||||
}
|
||||
}
|
||||
|
||||
for (int l3 = 0; l3 < this.mushroomsPerChunk; ++l3)
|
||||
{
|
||||
if (rand.chance(4))
|
||||
{
|
||||
int i8 = rand.chOffset();
|
||||
int l11 = rand.chOffset();
|
||||
BlockPos blockpos2 = world.getHeight(pos.add(i8, 0, l11));
|
||||
this.mushroomBrownGen.generate(world, rand, blockpos2);
|
||||
}
|
||||
|
||||
if (rand.chance(8))
|
||||
{
|
||||
int j8 = rand.chOffset();
|
||||
int i12 = rand.chOffset();
|
||||
int j15 = world.getHeight(pos.add(j8, 0, i12)).getY() * 2;
|
||||
|
||||
if (j15 > 0)
|
||||
{
|
||||
int k18 = rand.zrange(j15);
|
||||
BlockPos blockpos5 = pos.add(j8, k18, i12);
|
||||
this.mushroomRedGen.generate(world, rand, blockpos5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.mushroomsPerChunk != -1 && rand.chance(4))
|
||||
{
|
||||
int i4 = rand.chOffset();
|
||||
int k8 = rand.chOffset();
|
||||
int j12 = world.getHeight(pos.add(i4, 0, k8)).getY() * 2;
|
||||
|
||||
if (j12 > 0)
|
||||
{
|
||||
int k15 = rand.zrange(j12);
|
||||
this.mushroomBrownGen.generate(world, rand, pos.add(i4, k15, k8));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.mushroomsPerChunk != -1 && rand.chance(8))
|
||||
{
|
||||
int j4 = rand.chOffset();
|
||||
int l8 = rand.chOffset();
|
||||
int k12 = world.getHeight(pos.add(j4, 0, l8)).getY() * 2;
|
||||
|
||||
if (k12 > 0)
|
||||
{
|
||||
int l15 = rand.zrange(k12);
|
||||
this.mushroomRedGen.generate(world, rand, pos.add(j4, l15, l8));
|
||||
}
|
||||
}
|
||||
|
||||
for (int k4 = 0; k4 < this.reedsPerChunk; ++k4)
|
||||
{
|
||||
int i9 = rand.chOffset();
|
||||
int l12 = rand.chOffset();
|
||||
int i16 = world.getHeight(pos.add(i9, 0, l12)).getY() * 2;
|
||||
|
||||
if (i16 > 0)
|
||||
{
|
||||
int l18 = rand.zrange(i16);
|
||||
this.reedGen.generate(world, rand, pos.add(i9, l18, l12));
|
||||
}
|
||||
}
|
||||
|
||||
for (int l4 = 0; l4 < 10; ++l4)
|
||||
{
|
||||
int j9 = rand.chOffset();
|
||||
int i13 = rand.chOffset();
|
||||
int j16 = world.getHeight(pos.add(j9, 0, i13)).getY() * 2;
|
||||
|
||||
if (j16 > 0)
|
||||
{
|
||||
int i19 = rand.zrange(j16);
|
||||
this.reedGen.generate(world, rand, pos.add(j9, i19, i13));
|
||||
}
|
||||
}
|
||||
|
||||
if (rand.chance(32))
|
||||
{
|
||||
int i5 = rand.chOffset();
|
||||
int k9 = rand.chOffset();
|
||||
int j13 = world.getHeight(pos.add(i5, 0, k9)).getY() * 2;
|
||||
|
||||
if (j13 > 0)
|
||||
{
|
||||
int k16 = rand.zrange(j13);
|
||||
(new WorldGenPumpkin()).generate(world, rand, pos.add(i5, k16, k9));
|
||||
}
|
||||
}
|
||||
|
||||
for (int j5 = 0; j5 < this.cactiPerChunk; ++j5)
|
||||
{
|
||||
int l9 = rand.chOffset();
|
||||
int k13 = rand.chOffset();
|
||||
int l16 = world.getHeight(pos.add(l9, 0, k13)).getY() * 2;
|
||||
|
||||
if (l16 > 0)
|
||||
{
|
||||
int j19 = rand.zrange(l16);
|
||||
this.cactusGen.generate(world, rand, pos.add(l9, j19, k13));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getGrassColorAtPos(BlockPos pos)
|
||||
{
|
||||
double d0 = (double)ExtMath.clampf((this.getTemperature(pos) + 14.0f) / 40.0f + 0.15f, 0.0F, 1.0F);
|
||||
double d1 = (double)ExtMath.clampf(this.humidity * 0.01f, 0.0F, 1.0F);
|
||||
return Colorizer.getGrassColor(d0, d1);
|
||||
}
|
||||
|
||||
public int getFoliageColorAtPos(BlockPos pos)
|
||||
{
|
||||
double d0 = (double)ExtMath.clampf((this.getTemperature(pos) + 14.0f) / 40.0f + 0.15f, 0.0F, 1.0F);
|
||||
double d1 = (double)ExtMath.clampf(this.humidity * 0.01f, 0.0F, 1.0F);
|
||||
return Colorizer.getFoliageColor(d0, d1);
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(AWorldServer worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
|
||||
{
|
||||
this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, x, z, noiseVal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given x, z coordinates, we count down all the y positions starting at height - 1 and working our way down. When we hit a
|
||||
* non-air block, we replace it with this.topBlock (default grass, descendants may set otherwise), and then a
|
||||
* relatively shallow layer of blocks of type this.fillerBlock (default dirt). A random set of blocks below y == 5
|
||||
* (but always including y == 0) is replaced with bedrock in Chunk(...).
|
||||
*
|
||||
* If we don't hit non-air until somewhat below sea level, we top with gravel and fill down with stone.
|
||||
*
|
||||
* If this.fillerBlock is red sand, we replace some of that with red sandstone.
|
||||
*/
|
||||
public final void generateBiomeTerrain(AWorldServer worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
|
||||
{
|
||||
int i = worldIn.getSeaLevel();
|
||||
State worldState = worldIn.dimension.getFiller();
|
||||
Block worldBlock = worldState.getBlock();
|
||||
State worldAlt = worldIn.dimension.getAltFiller1();
|
||||
State liquid = worldIn.getSurfaceLiquid();
|
||||
boolean freeze = liquid.getBlock().getMaterial() == Material.water;
|
||||
State iblockstate = this.topBlock;
|
||||
State iblockstate1 = this.fillerBlock;
|
||||
int j = -1;
|
||||
int k = (int)(noiseVal / 3.0D + 3.0D + rand.doublev() * 0.25D);
|
||||
int l = x & 15;
|
||||
int i1 = z & 15;
|
||||
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
||||
|
||||
for (int j1 = chunkPrimerIn.height - 1; j1 >= 0; --j1)
|
||||
{
|
||||
State iblockstate2 = chunkPrimerIn.get(i1, j1, l);
|
||||
|
||||
if (iblockstate2.getBlock().getMaterial() == Material.air)
|
||||
{
|
||||
j = -1;
|
||||
}
|
||||
else if (iblockstate2.getBlock() == worldBlock)
|
||||
{
|
||||
if (j == -1)
|
||||
{
|
||||
if (k <= 0)
|
||||
{
|
||||
iblockstate = null;
|
||||
iblockstate1 = worldState;
|
||||
}
|
||||
else if (j1 >= i - 4 && j1 <= i + 1)
|
||||
{
|
||||
iblockstate = this.topBlock;
|
||||
iblockstate1 = this.fillerBlock;
|
||||
}
|
||||
|
||||
if (j1 < i && (iblockstate == null || iblockstate.getBlock().getMaterial() == Material.air))
|
||||
{
|
||||
if (freeze && World.ABSOLUTE_ZERO + worldIn.getTempOffset() + this.getTemperature(blockpos$mutableblockpos.set(x, j1, z)) <= 0.0F)
|
||||
{
|
||||
iblockstate = Blocks.ice.getState();
|
||||
}
|
||||
else
|
||||
{
|
||||
iblockstate = liquid;
|
||||
}
|
||||
}
|
||||
|
||||
j = k;
|
||||
|
||||
if (j1 >= i - 1)
|
||||
{
|
||||
chunkPrimerIn.set(i1, j1, l, iblockstate);
|
||||
}
|
||||
else if (j1 < i - 7 - k)
|
||||
{
|
||||
iblockstate = null;
|
||||
iblockstate1 = worldState;
|
||||
chunkPrimerIn.set(i1, j1, l, worldAlt);
|
||||
}
|
||||
else
|
||||
{
|
||||
chunkPrimerIn.set(i1, j1, l, iblockstate1);
|
||||
}
|
||||
}
|
||||
else if (j > 0)
|
||||
{
|
||||
--j;
|
||||
chunkPrimerIn.set(i1, j1, l, iblockstate1);
|
||||
|
||||
if (j == 0 && iblockstate1.getBlock() == Blocks.sand)
|
||||
{
|
||||
j = rand.zrange(4) + Math.max(0, j1 - 63);
|
||||
iblockstate1 = iblockstate1.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE) : Blocks.sandstone.getState(); //TODO: check!
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Biome createMutation()
|
||||
{
|
||||
return this.createMutatedBiome(this.id + 128);
|
||||
}
|
||||
|
||||
protected Biome createMutatedBiome(int p_180277_1_)
|
||||
{
|
||||
return new BiomeMutated(p_180277_1_, this);
|
||||
}
|
||||
|
||||
public Class <? extends Biome > getBiomeClass()
|
||||
{
|
||||
return this.getClass();
|
||||
}
|
||||
|
||||
public boolean isEqualTo(Biome biome)
|
||||
{
|
||||
return biome == this ? true : (biome == null ? false : this.getBiomeClass() == biome.getBiomeClass());
|
||||
}
|
||||
|
||||
public Temperature getTempCategory()
|
||||
{
|
||||
return this.temperature < -12.0f ? Temperature.COLD : (this.temperature < 20.0f ? Temperature.MEDIUM : Temperature.WARM);
|
||||
}
|
||||
|
||||
public static Biome getBiome(int id)
|
||||
{
|
||||
return getBiome(id, null);
|
||||
}
|
||||
|
||||
public static Biome getBiome(int id, Biome def)
|
||||
{
|
||||
if (id >= 0 && id < BIOMES.length)
|
||||
{
|
||||
Biome biome = BIOMES[id];
|
||||
return biome == null ? def : biome;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.JNI.warn("Biom-ID ist nicht im Bereich: " + id + ", verwende " + DEF_BIOME.id + " (" + DEF_BIOME.name + ")");
|
||||
return DEF_BIOME;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Biome> getBiomes() {
|
||||
return LIST;
|
||||
}
|
||||
|
||||
public static List<String> getBiomeNames() {
|
||||
return Lists.newArrayList(LOOKUP.keySet());
|
||||
}
|
||||
|
||||
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 null;
|
||||
}
|
||||
return z < 0 || z >= BIOMES.length ? null : BIOMES[z];
|
||||
}
|
||||
return biome;
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
// plains.createMutation();
|
||||
desert.createMutation();
|
||||
forest.createMutation();
|
||||
taiga.createMutation();
|
||||
swampland.createMutation();
|
||||
icePlains.createMutation();
|
||||
jungle.createMutation();
|
||||
jungleEdge.createMutation();
|
||||
coldTaiga.createMutation();
|
||||
savanna.createMutation();
|
||||
savannaPlateau.createMutation();
|
||||
mesa.createMutation();
|
||||
mesaPlateau_F.createMutation();
|
||||
mesaPlateau.createMutation();
|
||||
birchForest.createMutation();
|
||||
birchForestHills.createMutation();
|
||||
roofedForest.createMutation();
|
||||
megaTaiga.createMutation();
|
||||
extremeHills.createMutation();
|
||||
extremeHillsPlus.createMutation();
|
||||
megaTaiga.createMutatedBiome(megaTaigaHills.id + 128).setBiomeName("redwoodTaigaHillsM", "Mammutbaumtaiga");
|
||||
|
||||
TEMP_NOISE = new PerlinGen(new Random(1234L), 1);
|
||||
TREE_NOISE = new PerlinGen(new Random(667L), 8);
|
||||
GRASS_NOISE = new PerlinGen(new Random(2345L), 1);
|
||||
DOUBLE_PLANT_GEN = new FeatureDoublePlant();
|
||||
|
||||
for(Biome biome : BIOMES) {
|
||||
if(biome == null)
|
||||
continue;
|
||||
if(LOOKUP.containsKey(biome.name.toLowerCase()))
|
||||
throw new IllegalStateException("Biom \"" + biome.name + "\" ist als ID " + LOOKUP.get(biome.name.toLowerCase()).id + " und " + biome.id + " definiert");
|
||||
LOOKUP.put(biome.name.toLowerCase(), biome);
|
||||
LIST.add(biome);
|
||||
System.out.printf("%s(%d, \"%s\", \"%s\", 0x%06x, %.1ff, %.1ff),\n", biome.name.toUpperCase(), biome.id, biome.name, biome.display, biome.color, biome.temperature, biome.humidity);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.WeightedList;
|
||||
|
||||
public class BiomeBeach extends Biome
|
||||
{
|
||||
public BiomeBeach(int id)
|
||||
{
|
||||
super(id);
|
||||
this.topBlock = Blocks.sand.getState();
|
||||
this.fillerBlock = Blocks.sand.getState();
|
||||
this.treesPerChunk = -999;
|
||||
this.deadBushPerChunk = 0;
|
||||
this.reedsPerChunk = 0;
|
||||
this.cactiPerChunk = 0;
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.block.BlockFlower;
|
||||
import common.entity.npc.EntityMetalhead;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import common.worldgen.tree.WorldGenBaseTree;
|
||||
import common.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeBlackened extends Biome {
|
||||
protected final WorldGenTree treeGen = new WorldGenBaseTree(false, Blocks.blackwood_log.getState(), Blocks.blackwood_leaves.getState());
|
||||
|
||||
public BiomeBlackened(int id) {
|
||||
super(id);
|
||||
this.topBlock = Blocks.blackened_soil.getState();
|
||||
this.fillerBlock = Blocks.blackened_dirt.getState();
|
||||
this.treesPerChunk = 3;
|
||||
this.generateLakes = false;
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
mobs.add(new RngSpawn(EntityMetalhead.class, 50, 1, 1));
|
||||
}
|
||||
|
||||
public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos) {
|
||||
return BlockFlower.EnumFlowerType.BLACK_LOTUS;
|
||||
}
|
||||
|
||||
public WorldGenTree genBigTreeChance(Random rand) {
|
||||
return this.treeGen;
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.entity.Entity;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.init.EntityRegistry;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
import common.worldgen.foliage.WorldGenMushroom;
|
||||
|
||||
public class BiomeChaos extends Biome
|
||||
{
|
||||
protected FeatureGenerator mushroomBlueGen = new WorldGenMushroom(Blocks.blue_mushroom);
|
||||
|
||||
public BiomeChaos(int id)
|
||||
{
|
||||
super(id);
|
||||
this.topBlock = Blocks.obsidian.getState();
|
||||
this.fillerBlock = Blocks.obsidian.getState();
|
||||
}
|
||||
|
||||
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 void decorate(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
super.decorate(worldIn, rand, pos);
|
||||
|
||||
if (rand.chance(10))
|
||||
{
|
||||
int i8 = rand.chOffset();
|
||||
int l11 = rand.chOffset();
|
||||
BlockPos blockpos2 = worldIn.getHeight(pos.add(i8, 0, l11));
|
||||
this.mushroomBlueGen.generate(worldIn, rand, blockpos2);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.feature.WorldGenDesertWells;
|
||||
|
||||
public class BiomeDesert extends Biome
|
||||
{
|
||||
public BiomeDesert(int id)
|
||||
{
|
||||
super(id);
|
||||
this.topBlock = Blocks.sand.getState();
|
||||
this.fillerBlock = Blocks.sand.getState();
|
||||
this.treesPerChunk = -999;
|
||||
this.deadBushPerChunk = 2;
|
||||
this.reedsPerChunk = 50;
|
||||
this.cactiPerChunk = 10;
|
||||
this.generateLakes = false;
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
super.decorate(worldIn, rand, pos);
|
||||
|
||||
if (rand.chance(1000))
|
||||
{
|
||||
int i = rand.chOffset();
|
||||
int j = rand.chOffset();
|
||||
BlockPos blockpos = worldIn.getHeight(pos.add(i, 0, j)).up();
|
||||
(new WorldGenDesertWells()).generate(worldIn, rand, blockpos);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BiomeExterminated extends Biome {
|
||||
public BiomeExterminated(int id) {
|
||||
super(id);
|
||||
this.topBlock = Blocks.air.getState();
|
||||
this.fillerBlock = Blocks.air.getState();
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos) {
|
||||
}
|
||||
|
||||
public int getSkyColor() {
|
||||
return 0x101010;
|
||||
}
|
||||
|
||||
public int getFogColor() {
|
||||
return 0x303030;
|
||||
}
|
||||
|
||||
public int getCloudColor() {
|
||||
return 0x000000;
|
||||
}
|
||||
}
|
|
@ -1,245 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.block.BlockDoublePlant;
|
||||
import common.block.BlockFlower;
|
||||
import common.color.Colorizer;
|
||||
import common.entity.animal.EntityWolf;
|
||||
import common.entity.npc.EntityElf;
|
||||
import common.entity.npc.EntityWoodElf;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.foliage.WorldGenBigMushroom;
|
||||
import common.worldgen.tree.WorldGenBaseTree;
|
||||
import common.worldgen.tree.WorldGenBigTree;
|
||||
import common.worldgen.tree.WorldGenBirch;
|
||||
import common.worldgen.tree.WorldGenDarkOak;
|
||||
import common.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeForest extends Biome
|
||||
{
|
||||
private static final BlockDoublePlant.EnumPlantType[] FLOWER_TYPES = new BlockDoublePlant.EnumPlantType[] {
|
||||
BlockDoublePlant.EnumPlantType.SYRINGA, BlockDoublePlant.EnumPlantType.ROSE, BlockDoublePlant.EnumPlantType.PAEONIA
|
||||
};
|
||||
protected static final WorldGenBirch tallBirch = new WorldGenBirch(false, true);
|
||||
protected static final WorldGenBirch normalBirch = new WorldGenBirch(false, false);
|
||||
protected static final WorldGenDarkOak darkOak = new WorldGenDarkOak(false);
|
||||
|
||||
private final int subType;
|
||||
// protected LeavesType leavesType = null;
|
||||
// protected WorldGenBaseTree cherry;
|
||||
// protected WorldGenBaseTree maple;
|
||||
// protected WorldGenBigTree cherryBig;
|
||||
// protected WorldGenBigTree mapleBig;
|
||||
protected WorldGenBaseTree cherry = new WorldGenBaseTree(false, Blocks.cherry_log.getState(), // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.CHERRY),
|
||||
Blocks.cherry_leaves.getState()); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen()));
|
||||
protected WorldGenBaseTree maple = new WorldGenBaseTree(false, Blocks.maple_log.getState(), // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.MAPLE),
|
||||
Blocks.maple_leaves.getState()); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen()));
|
||||
protected WorldGenBigTree cherryBig = new WorldGenBigTree(false, Blocks.cherry_log.getState(), // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.CHERRY),
|
||||
Blocks.cherry_leaves.getState()); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen()));
|
||||
protected WorldGenBigTree mapleBig = new WorldGenBigTree(false, Blocks.maple_log.getState(), // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.MAPLE),
|
||||
Blocks.maple_leaves.getState()); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen()));
|
||||
|
||||
public BiomeForest(int id, int type)
|
||||
{
|
||||
super(id);
|
||||
this.subType = type;
|
||||
this.treesPerChunk = 10;
|
||||
this.grassPerChunk = 2;
|
||||
|
||||
if (this.subType == 1)
|
||||
{
|
||||
this.treesPerChunk = 6;
|
||||
this.flowersPerChunk = 100;
|
||||
this.grassPerChunk = 1;
|
||||
}
|
||||
|
||||
if (this.subType == 4)
|
||||
{
|
||||
this.treesPerChunk = 20;
|
||||
this.flowersPerChunk = 20;
|
||||
this.grassPerChunk = 1;
|
||||
this.reedsPerChunk = 50;
|
||||
this.waterlilyPerChunk = 4;
|
||||
}
|
||||
|
||||
this.setTemperature(8.0f).setHumidity(80.0f);
|
||||
|
||||
if (this.subType == 2)
|
||||
{
|
||||
this.setColor(3175492);
|
||||
this.setTemperature(4.0f).setHumidity(60.0f);
|
||||
}
|
||||
|
||||
if (this.subType == 0)
|
||||
{
|
||||
this.mobs.add(new RngSpawn(EntityWolf.class, 5, 4, 4));
|
||||
}
|
||||
|
||||
if (this.subType == 3)
|
||||
{
|
||||
this.treesPerChunk = -999;
|
||||
}
|
||||
|
||||
if(this.subType != 4) {
|
||||
this.mobs.add(new RngSpawn(EntityWoodElf.class, 3, 2, 6));
|
||||
}
|
||||
else {
|
||||
this.mobs.add(new RngSpawn(EntityWoodElf.class, 100, 4, 16));
|
||||
this.mobs.add(new RngSpawn(EntityElf.class, 12, 4, 16));
|
||||
}
|
||||
}
|
||||
|
||||
public WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return (WorldGenTree)
|
||||
(this.subType == 3 && rand.rarity(3) ? darkOak :
|
||||
(this.subType != 2 && rand.rarity(5) ? (this.subType != 3 && this.subType != 4 && rand.chance(this.subType == 1 ? 2 : 30) ? (rand.chance(25) ? this.cherryBig : this.cherry) :
|
||||
this.subType == 4 && rand.chance(42) ? this.worldGeneratorBigTree : this.worldGeneratorTrees) :
|
||||
(this.subType == 4 || rand.chance(this.subType == 2 ? 30 : 2) ? (rand.chance(this.subType == 4 ? 32 : 5) ? this.mapleBig : this.maple) : normalBirch)));
|
||||
}
|
||||
|
||||
public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
|
||||
{
|
||||
if (this.subType == 1)
|
||||
{
|
||||
double d0 = ExtMath.clampd((1.0D + GRASS_NOISE.generate((double)pos.getX() / 48.0D, (double)pos.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D);
|
||||
BlockFlower.EnumFlowerType blockflower$enumflowertype = BlockFlower.EnumFlowerType.values()[(int)(d0 * (double)BlockFlower.EnumFlowerType.values().length)];
|
||||
return blockflower$enumflowertype == BlockFlower.EnumFlowerType.BLUE_ORCHID ? BlockFlower.EnumFlowerType.ROSE : blockflower$enumflowertype;
|
||||
}
|
||||
else if (this.subType == 4)
|
||||
{
|
||||
double d0 = ExtMath.clampd((1.0D + GRASS_NOISE.generate((double)pos.getX() / 48.0D, (double)pos.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D);
|
||||
return BlockFlower.EnumFlowerType.values()[(int)(d0 * (double)BlockFlower.EnumFlowerType.values().length)];
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.pickRandomFlower(rand, pos);
|
||||
}
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
// if(worldIn.getLeavesGen() != this.leavesType) {
|
||||
// this.leavesType = worldIn.getLeavesGen();
|
||||
// this.cherry = new WorldGenBaseTree(false, Blocks.log2.getDefaultState().withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.CHERRY),
|
||||
// Blocks.cherry_leaves.getDefaultState().withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen()));
|
||||
// this.maple = new WorldGenBaseTree(false, Blocks.log2.getDefaultState().withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.MAPLE),
|
||||
// Blocks.maple_leaves.getDefaultState().withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen()));
|
||||
// this.cherryBig = new WorldGenBigTree(false, Blocks.log2.getDefaultState().withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.CHERRY),
|
||||
// Blocks.cherry_leaves.getDefaultState().withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen()));
|
||||
// this.mapleBig = new WorldGenBigTree(false, Blocks.log2.getDefaultState().withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.MAPLE),
|
||||
// Blocks.maple_leaves.getDefaultState().withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen()));
|
||||
// }
|
||||
|
||||
if (this.subType == 3)
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
for (int j = 0; j < 4; ++j)
|
||||
{
|
||||
int k = i * 4 + rand.range(9, 11);
|
||||
int l = j * 4 + rand.range(9, 11);
|
||||
BlockPos blockpos = worldIn.getHeight(pos.add(k, 0, l));
|
||||
|
||||
if (rand.chance(20))
|
||||
{
|
||||
WorldGenBigMushroom worldgenbigmushroom = new WorldGenBigMushroom();
|
||||
worldgenbigmushroom.generate(worldIn, rand, blockpos);
|
||||
}
|
||||
else
|
||||
{
|
||||
WorldGenTree worldgenabstracttree = this.genBigTreeChance(rand);
|
||||
worldgenabstracttree.prepare();
|
||||
|
||||
if (worldgenabstracttree.generate(worldIn, rand, blockpos))
|
||||
{
|
||||
worldgenabstracttree.finish(worldIn, rand, blockpos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int j1 = rand.range(-3, 1);
|
||||
|
||||
if (this.subType == 1)
|
||||
{
|
||||
j1 += 2;
|
||||
}
|
||||
|
||||
for (int k1 = 0; k1 < j1; ++k1)
|
||||
{
|
||||
// int l1 = rand.nextInt(3);
|
||||
|
||||
// if (l1 == 0)
|
||||
// {
|
||||
DOUBLE_PLANT_GEN.setPlantType(rand.pick(FLOWER_TYPES));
|
||||
// }
|
||||
// else if (l1 == 1)
|
||||
// {
|
||||
// DOUBLE_PLANT_GENERATOR.setPlantType();
|
||||
// }
|
||||
// else if (l1 == 2)
|
||||
// {
|
||||
// DOUBLE_PLANT_GENERATOR.setPlantType();
|
||||
// }
|
||||
|
||||
for (int i2 = 0; i2 < 5; ++i2)
|
||||
{
|
||||
int j2 = rand.chOffset();
|
||||
int k2 = rand.chOffset();
|
||||
int i1 = rand.zrange(worldIn.getHeight(pos.add(j2, 0, k2)).getY() + 32);
|
||||
|
||||
if (DOUBLE_PLANT_GEN.generate(worldIn, rand, new BlockPos(pos.getX() + j2, i1, pos.getZ() + k2)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.decorate(worldIn, rand, pos);
|
||||
}
|
||||
|
||||
public int getGrassColorAtPos(BlockPos pos)
|
||||
{
|
||||
return this.subType == 4 ? Colorizer.getGrassColor(1.0f, this.humidity * 0.01f) :
|
||||
(this.subType == 3 ? (super.getGrassColorAtPos(pos) & 16711422) + 2634762 >> 1 :
|
||||
super.getGrassColorAtPos(pos));
|
||||
}
|
||||
|
||||
public int getFoliageColorAtPos(BlockPos pos)
|
||||
{
|
||||
return this.subType == 4 ? Colorizer.getFoliageColor(1.0f, this.humidity * 0.01f) : super.getFoliageColorAtPos(pos);
|
||||
}
|
||||
|
||||
protected Biome createMutatedBiome(final int id)
|
||||
{
|
||||
if (this.id == Biome.forest.id)
|
||||
{
|
||||
BiomeForest biomegenforest = new BiomeForest(id, 1);
|
||||
biomegenforest.setScaling(this.depth, this.scale + 0.2F);
|
||||
biomegenforest.setBiomeName("flowerForest", "Blumenwald");
|
||||
biomegenforest.setColor(6976549);
|
||||
return biomegenforest;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.id != Biome.birchForest.id && this.id != Biome.birchForestHills.id ? new BiomeMutated(id, this)
|
||||
{
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
this.baseBiome.decorate(worldIn, rand, pos);
|
||||
}
|
||||
}: new BiomeMutated(id, this)
|
||||
{
|
||||
public WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return rand.chance() ? BiomeForest.tallBirch : BiomeForest.normalBirch;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.entity.npc.EntityBloodElf;
|
||||
import common.entity.npc.EntityCultivator;
|
||||
import common.entity.npc.EntityFireDemon;
|
||||
import common.entity.npc.EntityMagma;
|
||||
import common.entity.npc.EntityMetalhead;
|
||||
import common.entity.npc.EntityTiefling;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureOres;
|
||||
import common.worldgen.feature.WorldGenFire;
|
||||
import common.worldgen.feature.WorldGenGlowStone;
|
||||
import common.worldgen.feature.WorldGenHellLava;
|
||||
import common.worldgen.foliage.WorldGenMushroom;
|
||||
|
||||
public class BiomeHell extends Biome
|
||||
{
|
||||
private final int subtype;
|
||||
private final WorldGenFire fireGen;
|
||||
private final WorldGenGlowStone glowStoneGen1;
|
||||
private final WorldGenGlowStone glowStoneGen2;
|
||||
private final FeatureOres quartzGen;
|
||||
private final WorldGenHellLava lavaGen1;
|
||||
private final WorldGenHellLava lavaGen2;
|
||||
private final WorldGenMushroom brownMushroomGen;
|
||||
private final WorldGenMushroom redMushroomGen;
|
||||
|
||||
public BiomeHell(int id, int subtype)
|
||||
{
|
||||
super(id);
|
||||
this.subtype = subtype;
|
||||
if(this.subtype == 0) {
|
||||
this.mobs.add(new RngSpawn(EntityBloodElf.class, 10, 1, 2));
|
||||
this.mobs.add(new RngSpawn(EntityMetalhead.class, 1, 1, 1));
|
||||
this.fireGen = new WorldGenFire();
|
||||
this.glowStoneGen1 = new WorldGenGlowStone();
|
||||
this.glowStoneGen2 = new WorldGenGlowStone();
|
||||
this.quartzGen = new FeatureOres(Blocks.quartz_ore.getState(), 16, 0, 14, 10, 118, false);
|
||||
this.lavaGen1 = new WorldGenHellLava(Blocks.flowing_lava, true);
|
||||
this.lavaGen2 = new WorldGenHellLava(Blocks.flowing_lava, false);
|
||||
this.brownMushroomGen = new WorldGenMushroom(Blocks.brown_mushroom);
|
||||
this.redMushroomGen = new WorldGenMushroom(Blocks.red_mushroom);
|
||||
}
|
||||
else {
|
||||
this.mobs.add(new RngSpawn(EntityBloodElf.class, 50, 2, 10));
|
||||
this.mobs.add(new RngSpawn(EntityCultivator.class, 10, 1, 1));
|
||||
this.fireGen = null;
|
||||
this.glowStoneGen1 = null;
|
||||
this.glowStoneGen2 = null;
|
||||
this.quartzGen = null;
|
||||
this.lavaGen1 = null;
|
||||
this.lavaGen2 = null;
|
||||
this.brownMushroomGen = null;
|
||||
this.redMushroomGen = null;
|
||||
}
|
||||
if(this.subtype == 2) {
|
||||
this.topBlock = Blocks.ash.getState();
|
||||
this.fillerBlock = Blocks.rock.getState();
|
||||
}
|
||||
else {
|
||||
this.topBlock = Blocks.hellrock.getState();
|
||||
this.fillerBlock = Blocks.hellrock.getState();
|
||||
}
|
||||
}
|
||||
|
||||
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(EntityMagma.class, 1, 4, 4));
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
if(this.subtype == 0) {
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
this.lavaGen2.generate(worldIn, rand, pos.add(rand.zrange(16) + 8, rand.zrange(120) + 4, rand.zrange(16) + 8));
|
||||
}
|
||||
|
||||
for (int j = 0; j < rand.zrange(rand.zrange(10) + 1) + 1; ++j)
|
||||
{
|
||||
this.fireGen.generate(worldIn, rand, pos.add(rand.zrange(16) + 8, rand.zrange(120) + 4, rand.zrange(16) + 8));
|
||||
}
|
||||
|
||||
for (int k = 0; k < rand.zrange(rand.zrange(10) + 1); ++k)
|
||||
{
|
||||
this.glowStoneGen1.generate(worldIn, rand, pos.add(rand.zrange(16) + 8, rand.zrange(120) + 4, rand.zrange(16) + 8));
|
||||
}
|
||||
|
||||
for (int l = 0; l < 10; ++l)
|
||||
{
|
||||
this.glowStoneGen2.generate(worldIn, rand, pos.add(rand.zrange(16) + 8, rand.zrange(128), rand.zrange(16) + 8));
|
||||
}
|
||||
|
||||
if (rand.chance())
|
||||
{
|
||||
this.brownMushroomGen.generate(worldIn, rand, pos.add(rand.zrange(16) + 8, rand.zrange(128), rand.zrange(16) + 8));
|
||||
}
|
||||
|
||||
if (rand.chance())
|
||||
{
|
||||
this.redMushroomGen.generate(worldIn, rand, pos.add(rand.zrange(16) + 8, rand.zrange(128), rand.zrange(16) + 8));
|
||||
}
|
||||
|
||||
// for (int i1 = 0; i1 < 16; ++i1)
|
||||
// {
|
||||
this.quartzGen.generate(worldIn, rand, pos); // .add(rand.nextInt(16), rand.nextInt(108) + 10, rand.nextInt(16)));
|
||||
// }
|
||||
|
||||
for (int j1 = 0; j1 < 16; ++j1)
|
||||
{
|
||||
this.lavaGen1.generate(worldIn, rand, pos.add(rand.zrange(16), rand.zrange(108) + 10, rand.zrange(16)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
super.decorate(worldIn, rand, pos);
|
||||
}
|
||||
}
|
||||
|
||||
// protected Decorator createBiomeDecorator()
|
||||
// {
|
||||
// return this.subtype == 0 ? new DecoratorHell() : super.createBiomeDecorator();
|
||||
// }
|
||||
|
||||
public int getGrassColorAtPos(BlockPos pos)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getFoliageColorAtPos(BlockPos pos)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.ChunkPrimer;
|
||||
import common.worldgen.FeatureOres;
|
||||
import common.worldgen.tree.WorldGenTaiga2;
|
||||
import common.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeHills extends Biome
|
||||
{
|
||||
// private FeatureGenerator theWorldGenerator = new FeatureOres(Blocks.monster_egg.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.STONE), false, 7, 9, 0, 64);
|
||||
private FeatureOres theEmeraldGenerator = new FeatureOres(Blocks.emerald_ore.getState(), 3, 5, 1, 4, 32, false);
|
||||
private WorldGenTaiga2 field_150634_aD = new WorldGenTaiga2(false);
|
||||
private int field_150635_aE = 0;
|
||||
private int field_150636_aF = 1;
|
||||
private int field_150637_aG = 2;
|
||||
private int field_150638_aH;
|
||||
|
||||
protected BiomeHills(int id, boolean p_i45373_2_)
|
||||
{
|
||||
super(id);
|
||||
this.field_150638_aH = this.field_150635_aE;
|
||||
|
||||
if (p_i45373_2_)
|
||||
{
|
||||
this.treesPerChunk = 3;
|
||||
this.field_150638_aH = this.field_150636_aF;
|
||||
}
|
||||
}
|
||||
|
||||
public WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return (WorldGenTree)(rand.rarity(3) ? this.field_150634_aD : super.genBigTreeChance(rand));
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
super.decorate(worldIn, rand, pos);
|
||||
// int i = 3 + rand.nextInt(6);
|
||||
//
|
||||
// for (int j = 0; j < i; ++j)
|
||||
// {
|
||||
// int k = rand.nextInt(16);
|
||||
// int l = rand.nextInt(28) + 4;
|
||||
// int i1 = rand.nextInt(16);
|
||||
// BlockPos blockpos = pos.add(k, l, i1);
|
||||
//
|
||||
// if (worldIn.getBlockState(blockpos).getBlock() == Blocks.stone)
|
||||
// {
|
||||
// worldIn.setBlockState(blockpos, Blocks.emerald_ore.getDefaultState(), 2);
|
||||
// }
|
||||
// }
|
||||
this.theEmeraldGenerator.generate(worldIn, rand, pos);
|
||||
|
||||
// for (i = 0; i < 7; ++i)
|
||||
// {
|
||||
// int j1 = rand.nextInt(16);
|
||||
// int k1 = rand.nextInt(64);
|
||||
// int l1 = rand.nextInt(16);
|
||||
// this.theWorldGenerator.generate(worldIn, rand, pos); // .add(j1, k1, l1));
|
||||
// }
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(AWorldServer worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
|
||||
{
|
||||
this.topBlock = Blocks.grass.getState();
|
||||
this.fillerBlock = Blocks.dirt.getState();
|
||||
|
||||
if ((noiseVal < -1.0D || noiseVal > 2.0D) && this.field_150638_aH == this.field_150637_aG)
|
||||
{
|
||||
this.topBlock = Blocks.gravel.getState();
|
||||
this.fillerBlock = Blocks.gravel.getState();
|
||||
}
|
||||
else if (noiseVal > 1.0D && this.field_150638_aH != this.field_150636_aF)
|
||||
{
|
||||
this.topBlock = Blocks.stone.getState();
|
||||
this.fillerBlock = Blocks.stone.getState();
|
||||
}
|
||||
|
||||
this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, x, z, noiseVal);
|
||||
}
|
||||
|
||||
/**
|
||||
* this creates a mutation specific to Hills biomes
|
||||
*/
|
||||
private BiomeHills mutateHills(Biome p_150633_1_)
|
||||
{
|
||||
this.field_150638_aH = this.field_150637_aG;
|
||||
this.setColor(p_150633_1_.color);
|
||||
this.setBiomeName(p_150633_1_.name + "M", p_150633_1_.display + " M");
|
||||
this.setScaling(p_150633_1_.depth, p_150633_1_.scale);
|
||||
this.setTemperature(p_150633_1_.temperature);
|
||||
this.setHumidity(p_150633_1_.humidity);
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Biome createMutatedBiome(int p_180277_1_)
|
||||
{
|
||||
return (new BiomeHills(p_180277_1_, false)).mutateHills(this);
|
||||
}
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.block.BlockTallGrass;
|
||||
import common.entity.animal.EntityChicken;
|
||||
import common.entity.animal.EntityOcelot;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
import common.worldgen.foliage.WorldGenMelon;
|
||||
import common.worldgen.foliage.WorldGenShrub;
|
||||
import common.worldgen.foliage.WorldGenTallGrass;
|
||||
import common.worldgen.foliage.WorldGenVines;
|
||||
import common.worldgen.tree.WorldGenBaseTree;
|
||||
import common.worldgen.tree.WorldGenJungle;
|
||||
import common.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeJungle extends Biome
|
||||
{
|
||||
private static final State LOG = Blocks.jungle_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE);
|
||||
private static final State LEAVES = Blocks.jungle_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false));
|
||||
private static final State BUSH = Blocks.oak_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false));
|
||||
|
||||
private final boolean edge;
|
||||
|
||||
public BiomeJungle(int id, boolean edge)
|
||||
{
|
||||
super(id);
|
||||
this.edge = edge;
|
||||
|
||||
if (edge)
|
||||
{
|
||||
this.treesPerChunk = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.treesPerChunk = 50;
|
||||
}
|
||||
|
||||
this.grassPerChunk = 25;
|
||||
this.flowersPerChunk = 4;
|
||||
|
||||
if (!edge)
|
||||
{
|
||||
this.mobs.add(new RngSpawn(EntityOcelot.class, 2, 1, 1));
|
||||
}
|
||||
|
||||
this.mobs.add(new RngSpawn(EntityChicken.class, 10, 4, 4));
|
||||
}
|
||||
|
||||
public WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return (WorldGenTree)(rand.chance(10) ? this.worldGeneratorBigTree : (rand.chance(2) ? new WorldGenShrub(LOG, BUSH) : (!this.edge && rand.chance(3) ? new WorldGenJungle(false, 10, 20, LOG, LEAVES) : new WorldGenBaseTree(false, rand.range(4, 10), LOG, LEAVES, true))));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a WorldGen appropriate for this biome.
|
||||
*/
|
||||
public FeatureGenerator getRandomWorldGenForGrass(Random rand)
|
||||
{
|
||||
return rand.chance(4) ? new WorldGenTallGrass(BlockTallGrass.EnumType.FERN) : new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS);
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
super.decorate(worldIn, rand, pos);
|
||||
int i = rand.chOffset();
|
||||
int j = rand.chOffset();
|
||||
int k = rand.zrange(worldIn.getHeight(pos.add(i, 0, j)).getY() * 2);
|
||||
(new WorldGenMelon()).generate(worldIn, rand, pos.add(i, k, j));
|
||||
WorldGenVines worldgenvines = new WorldGenVines();
|
||||
|
||||
for (j = 0; j < 50; ++j)
|
||||
{
|
||||
k = rand.chOffset();
|
||||
int l = 128;
|
||||
int i1 = rand.chOffset();
|
||||
worldgenvines.generate(worldIn, rand, pos.add(k, 128, i1));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,348 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockColored;
|
||||
import common.block.BlockDirt;
|
||||
import common.block.BlockSand;
|
||||
import common.color.DyeColor;
|
||||
import common.init.Blocks;
|
||||
import common.material.Material;
|
||||
import common.rng.PerlinGen;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.ChunkPrimer;
|
||||
import common.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeMesa extends Biome
|
||||
{
|
||||
private final boolean bryce;
|
||||
private final boolean soil;
|
||||
|
||||
private State[] layers;
|
||||
private long layerSeed;
|
||||
private PerlinGen baseBryceGen;
|
||||
private PerlinGen highBryceGen;
|
||||
private PerlinGen clayColorGen;
|
||||
|
||||
public BiomeMesa(int id, boolean bryce, boolean soil)
|
||||
{
|
||||
super(id);
|
||||
this.bryce = bryce;
|
||||
this.soil = soil;
|
||||
// this.setDisableRain();
|
||||
// this.setTemperatureLegacy(2.0F).setHumidity(0.0F);
|
||||
this.setHumidity(0.0f);
|
||||
// this.mobs.clear();
|
||||
this.topBlock = Blocks.sand.getState().withProperty(BlockSand.VARIANT, BlockSand.EnumType.RED_SAND);
|
||||
this.fillerBlock = Blocks.stained_hardened_clay.getState();
|
||||
this.treesPerChunk = -999;
|
||||
this.deadBushPerChunk = 20;
|
||||
this.reedsPerChunk = 3;
|
||||
this.cactiPerChunk = 5;
|
||||
this.flowersPerChunk = 0;
|
||||
// this.mobs.clear();
|
||||
|
||||
if (soil)
|
||||
{
|
||||
this.treesPerChunk = 5;
|
||||
}
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
}
|
||||
|
||||
public WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return this.worldGeneratorTrees;
|
||||
}
|
||||
|
||||
public int getFoliageColorAtPos(BlockPos pos)
|
||||
{
|
||||
return 10387789;
|
||||
}
|
||||
|
||||
public int getGrassColorAtPos(BlockPos pos)
|
||||
{
|
||||
return 9470285;
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
super.decorate(worldIn, rand, pos);
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(AWorldServer worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
|
||||
{
|
||||
if (this.layers == null || this.layerSeed != worldIn.getSeed())
|
||||
{
|
||||
this.setupLayers(worldIn.getSeed());
|
||||
}
|
||||
|
||||
if (this.baseBryceGen == null || this.highBryceGen == null || this.layerSeed != worldIn.getSeed())
|
||||
{
|
||||
Random random = new Random(this.layerSeed);
|
||||
this.baseBryceGen = new PerlinGen(random, 4);
|
||||
this.highBryceGen = new PerlinGen(random, 1);
|
||||
}
|
||||
|
||||
this.layerSeed = worldIn.getSeed();
|
||||
double d4 = 0.0D;
|
||||
|
||||
if (this.bryce)
|
||||
{
|
||||
int i = (x & -16) + (z & 15);
|
||||
int j = (z & -16) + (x & 15);
|
||||
double d0 = Math.min(Math.abs(noiseVal), this.baseBryceGen.generate((double)i * 0.25D, (double)j * 0.25D));
|
||||
|
||||
if (d0 > 0.0D)
|
||||
{
|
||||
double d1 = 0.001953125D;
|
||||
double d2 = Math.abs(this.highBryceGen.generate((double)i * d1, (double)j * d1));
|
||||
d4 = d0 * d0 * 2.5D;
|
||||
double d3 = Math.ceil(d2 * 50.0D) + 14.0D;
|
||||
|
||||
if (d4 > d3)
|
||||
{
|
||||
d4 = d3;
|
||||
}
|
||||
|
||||
d4 = d4 + 64.0D;
|
||||
}
|
||||
}
|
||||
|
||||
int j1 = x & 15;
|
||||
int k1 = z & 15;
|
||||
int l1 = worldIn.getSeaLevel();
|
||||
State iblockstate = Blocks.stained_hardened_clay.getState();
|
||||
State iblockstate3 = this.fillerBlock;
|
||||
int k = (int)(noiseVal / 3.0D + 3.0D + rand.doublev() * 0.25D);
|
||||
boolean flag = Math.cos(noiseVal / 3.0D * Math.PI) > 0.0D;
|
||||
int l = -1;
|
||||
boolean flag1 = false;
|
||||
State worldState = worldIn.dimension.getFiller();
|
||||
Block worldBlock = worldState.getBlock();
|
||||
State worldAlt = worldIn.dimension.getAltFiller1();
|
||||
State liquid = worldIn.getSurfaceLiquid();
|
||||
// IBlockState bottom = worldIn.dimension.hasBedrock() ? Blocks.bedrock.getDefaultState() : Blocks.air.getDefaultState();
|
||||
|
||||
for (int i1 = chunkPrimerIn.height - 1; i1 >= 0; --i1)
|
||||
{
|
||||
if (chunkPrimerIn.get(k1, i1, j1).getBlock().getMaterial() == Material.air && i1 < (int)d4)
|
||||
{
|
||||
chunkPrimerIn.set(k1, i1, j1, worldState);
|
||||
}
|
||||
|
||||
// if (i1 <= rand.zrange(5) && bedrock)
|
||||
// {
|
||||
// chunkPrimerIn.set(k1, i1, j1, bottom);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
State iblockstate1 = chunkPrimerIn.get(k1, i1, j1);
|
||||
|
||||
if (iblockstate1.getBlock().getMaterial() == Material.air)
|
||||
{
|
||||
l = -1;
|
||||
}
|
||||
else if (iblockstate1.getBlock() == worldBlock)
|
||||
{
|
||||
if (l == -1)
|
||||
{
|
||||
flag1 = false;
|
||||
|
||||
if (k <= 0)
|
||||
{
|
||||
iblockstate = null;
|
||||
iblockstate3 = worldState;
|
||||
}
|
||||
else if (i1 >= l1 - 4 && i1 <= l1 + 1)
|
||||
{
|
||||
iblockstate = Blocks.stained_hardened_clay.getState();
|
||||
iblockstate3 = this.fillerBlock;
|
||||
}
|
||||
|
||||
if (i1 < l1 && (iblockstate == null || iblockstate.getBlock().getMaterial() == Material.air))
|
||||
{
|
||||
iblockstate = liquid;
|
||||
}
|
||||
|
||||
l = k + Math.max(0, i1 - l1);
|
||||
|
||||
if (i1 < l1 - 1)
|
||||
{
|
||||
chunkPrimerIn.set(k1, i1, j1, iblockstate3);
|
||||
|
||||
if (iblockstate3.getBlock() == Blocks.stained_hardened_clay)
|
||||
{
|
||||
chunkPrimerIn.set(k1, i1, j1, iblockstate3.getBlock().getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE));
|
||||
}
|
||||
}
|
||||
else if (this.soil && i1 > 86 + k * 2)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
chunkPrimerIn.set(k1, i1, j1, Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT));
|
||||
}
|
||||
else
|
||||
{
|
||||
chunkPrimerIn.set(k1, i1, j1, Blocks.grass.getState());
|
||||
}
|
||||
}
|
||||
else if (i1 <= l1 + 3 + k)
|
||||
{
|
||||
chunkPrimerIn.set(k1, i1, j1, this.topBlock);
|
||||
flag1 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
State iblockstate4;
|
||||
|
||||
if (i1 >= 64 && i1 <= 127)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
iblockstate4 = Blocks.hardened_clay.getState();
|
||||
}
|
||||
else
|
||||
{
|
||||
iblockstate4 = this.getBlockAt(x, i1, z);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iblockstate4 = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE);
|
||||
}
|
||||
|
||||
chunkPrimerIn.set(k1, i1, j1, iblockstate4);
|
||||
}
|
||||
}
|
||||
else if (l > 0)
|
||||
{
|
||||
--l;
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
chunkPrimerIn.set(k1, i1, j1, Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE));
|
||||
}
|
||||
else
|
||||
{
|
||||
State iblockstate2 = this.getBlockAt(x, i1, z);
|
||||
chunkPrimerIn.set(k1, i1, j1, iblockstate2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
private void setupLayers(long seed)
|
||||
{
|
||||
this.layers = new State[64];
|
||||
Arrays.fill(this.layers, Blocks.hardened_clay.getState());
|
||||
Random random = new Random(seed);
|
||||
this.clayColorGen = new PerlinGen(random, 1);
|
||||
|
||||
for (int l1 = 0; l1 < 64; ++l1)
|
||||
{
|
||||
l1 += random.roll(5);
|
||||
|
||||
if (l1 < 64)
|
||||
{
|
||||
this.layers[l1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE);
|
||||
}
|
||||
}
|
||||
|
||||
int i2 = random.range(2, 5);
|
||||
|
||||
for (int i = 0; i < i2; ++i)
|
||||
{
|
||||
int j = random.roll(3);
|
||||
int k = random.zrange(64);
|
||||
|
||||
for (int l = 0; k + l < 64 && l < j; ++l)
|
||||
{
|
||||
this.layers[k + l] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.YELLOW);
|
||||
}
|
||||
}
|
||||
|
||||
int j2 = random.range(2, 5);
|
||||
|
||||
for (int k2 = 0; k2 < j2; ++k2)
|
||||
{
|
||||
int i3 = random.range(2, 4);
|
||||
int l3 = random.zrange(64);
|
||||
|
||||
for (int i1 = 0; l3 + i1 < 64 && i1 < i3; ++i1)
|
||||
{
|
||||
this.layers[l3 + i1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.BROWN);
|
||||
}
|
||||
}
|
||||
|
||||
int l2 = random.range(2, 5);
|
||||
|
||||
for (int j3 = 0; j3 < l2; ++j3)
|
||||
{
|
||||
int i4 = random.roll(3);
|
||||
int k4 = random.zrange(64);
|
||||
|
||||
for (int j1 = 0; k4 + j1 < 64 && j1 < i4; ++j1)
|
||||
{
|
||||
this.layers[k4 + j1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.RED);
|
||||
}
|
||||
}
|
||||
|
||||
int k3 = random.range(3, 5);
|
||||
int j4 = 0;
|
||||
|
||||
for (int l4 = 0; l4 < k3; ++l4)
|
||||
{
|
||||
int i5 = 1;
|
||||
j4 += random.range(4, 19);
|
||||
|
||||
for (int k1 = 0; j4 + k1 < 64 && k1 < i5; ++k1)
|
||||
{
|
||||
this.layers[j4 + k1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.WHITE);
|
||||
|
||||
if (j4 + k1 > 1 && random.chance())
|
||||
{
|
||||
this.layers[j4 + k1 - 1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.SILVER);
|
||||
}
|
||||
|
||||
if (j4 + k1 < 63 && random.chance())
|
||||
{
|
||||
this.layers[j4 + k1 + 1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.SILVER);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private State getBlockAt(int x, int y, int z)
|
||||
{
|
||||
int i = (int)Math.round(this.clayColorGen.generate((double)x * 1.0D / 512.0D, (double)x * 1.0D / 512.0D) * 2.0D);
|
||||
return this.layers[(y + i + 64) % 64];
|
||||
}
|
||||
|
||||
protected Biome createMutatedBiome(int id)
|
||||
{
|
||||
boolean bryce = this.id == Biome.mesa.id;
|
||||
BiomeMesa mesa = new BiomeMesa(id, bryce, this.soil);
|
||||
|
||||
if (!bryce)
|
||||
{
|
||||
mesa.setScaling(Scaling.HILLS_LOW);
|
||||
mesa.setBiomeName(this.name + "M", this.display + " M");
|
||||
}
|
||||
else
|
||||
{
|
||||
mesa.setBiomeName(this.name + "Bryce", this.display + " (Bryce)");
|
||||
}
|
||||
|
||||
mesa.setColor(this.color);
|
||||
return mesa;
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureOres;
|
||||
|
||||
public class BiomeMoon extends Biome {
|
||||
private FeatureOres cheeseGenerator = new FeatureOres(Blocks.moon_cheese.getState(), 8, 8, 12, 24, 52, false);
|
||||
|
||||
public BiomeMoon(int id) {
|
||||
super(id);
|
||||
this.topBlock = Blocks.moon_rock.getState();
|
||||
this.fillerBlock = Blocks.moon_rock.getState();
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos) {
|
||||
this.cheeseGenerator.generate(worldIn, rand, pos);
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.entity.animal.EntityMooshroom;
|
||||
import common.init.Blocks;
|
||||
import common.rng.WeightedList;
|
||||
|
||||
public class BiomeMushroom extends Biome
|
||||
{
|
||||
public BiomeMushroom(int id)
|
||||
{
|
||||
super(id);
|
||||
this.treesPerChunk = -100;
|
||||
this.flowersPerChunk = -100;
|
||||
this.grassPerChunk = -100;
|
||||
this.mushroomsPerChunk = 1;
|
||||
this.bigMushroomsPerChunk = 1;
|
||||
this.topBlock = Blocks.mycelium.getState();
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
mobs.add(new RngSpawn(EntityMooshroom.class, 8, 4, 8));
|
||||
}
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.ChunkPrimer;
|
||||
import common.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeMutated extends Biome
|
||||
{
|
||||
protected Biome baseBiome;
|
||||
|
||||
public BiomeMutated(int id, Biome biome)
|
||||
{
|
||||
super(id);
|
||||
this.baseBiome = biome;
|
||||
this.setColor(biome.color);
|
||||
this.name = biome.name + "M";
|
||||
this.display = biome.display + " M";
|
||||
this.topBlock = biome.topBlock;
|
||||
this.fillerBlock = biome.fillerBlock;
|
||||
// this.minHeight = biome.minHeight;
|
||||
// this.maxHeight = biome.maxHeight;
|
||||
this.temperature = biome.temperature;
|
||||
this.humidity = biome.humidity;
|
||||
this.waterColor = biome.waterColor;
|
||||
this.allowColdBeach = biome.allowColdBeach;
|
||||
// this.enableRain = biome.enableRain;
|
||||
// this.mobs.clear();
|
||||
this.mobs.addAll(biome.mobs);
|
||||
// this.mobs = new WeightedList(biome.mobs);
|
||||
// this.monsters = new WeightedList(biome.monsters);
|
||||
// this.caveMobs = new WeightedList(biome.caveMobs);
|
||||
// this.waterMobs = new WeightedList(biome.waterMobs);
|
||||
// this.npcs = new WeightedList(biome.npcs);
|
||||
// this.temperature = biome.temperature;
|
||||
// this.humidity = biome.humidity;
|
||||
this.depth = biome.depth + 0.1F;
|
||||
this.scale = biome.scale + 0.2F;
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
this.baseBiome.decorate(worldIn, rand, pos); // TODO: check
|
||||
}
|
||||
|
||||
public void decorateNormal(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
super.decorate(worldIn, rand, pos);
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(AWorldServer worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
|
||||
{
|
||||
this.baseBiome.genTerrainBlocks(worldIn, rand, chunkPrimerIn, x, z, noiseVal);
|
||||
}
|
||||
|
||||
public float getMobGenChance()
|
||||
{
|
||||
return this.baseBiome.getMobGenChance();
|
||||
}
|
||||
|
||||
public WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return this.baseBiome.genBigTreeChance(rand);
|
||||
}
|
||||
|
||||
public int getFoliageColorAtPos(BlockPos pos)
|
||||
{
|
||||
return this.baseBiome.getFoliageColorAtPos(pos);
|
||||
}
|
||||
|
||||
public int getGrassColorAtPos(BlockPos pos)
|
||||
{
|
||||
return this.baseBiome.getGrassColorAtPos(pos);
|
||||
}
|
||||
|
||||
public Class <? extends Biome > getBiomeClass()
|
||||
{
|
||||
return this.baseBiome.getBiomeClass();
|
||||
}
|
||||
|
||||
/**
|
||||
* returns true if the biome specified is equal to this biome
|
||||
*/
|
||||
public boolean isEqualTo(Biome biome)
|
||||
{
|
||||
return this.baseBiome.isEqualTo(biome);
|
||||
}
|
||||
|
||||
public Temperature getTempCategory()
|
||||
{
|
||||
return this.baseBiome.getTempCategory();
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.ChunkPrimer;
|
||||
|
||||
public class BiomeNone extends Biome {
|
||||
public BiomeNone(int id) {
|
||||
super(id);
|
||||
this.topBlock = Blocks.air.getState();
|
||||
this.fillerBlock = Blocks.air.getState();
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(AWorldServer worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos) {
|
||||
}
|
||||
|
||||
public Temperature getTempCategory() {
|
||||
return Temperature.SEA;
|
||||
}
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.block.BlockDoublePlant;
|
||||
import common.block.BlockFlower;
|
||||
import common.entity.animal.EntityHorse;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BiomePlains extends Biome
|
||||
{
|
||||
private static final BlockFlower.EnumFlowerType[] TULIP_TYPES = new BlockFlower.EnumFlowerType[] {
|
||||
BlockFlower.EnumFlowerType.ORANGE_TULIP, BlockFlower.EnumFlowerType.RED_TULIP,
|
||||
BlockFlower.EnumFlowerType.PINK_TULIP, BlockFlower.EnumFlowerType.WHITE_TULIP
|
||||
};
|
||||
|
||||
private static final BlockFlower.EnumFlowerType[] FLOWER_TYPES = new BlockFlower.EnumFlowerType[] {
|
||||
BlockFlower.EnumFlowerType.POPPY, BlockFlower.EnumFlowerType.HOUSTONIA, BlockFlower.EnumFlowerType.OXEYE_DAISY
|
||||
};
|
||||
|
||||
// protected boolean field_150628_aC;
|
||||
|
||||
protected BiomePlains(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setTemperature(12.0f).setHumidity(40.0f);
|
||||
this.setScaling(Scaling.PLAINS_LOW);
|
||||
this.mobs.add(new RngSpawn(EntityHorse.class, 5, 2, 6));
|
||||
this.treesPerChunk = -999;
|
||||
this.flowersPerChunk = 4;
|
||||
this.grassPerChunk = 10;
|
||||
}
|
||||
|
||||
public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
|
||||
{
|
||||
double d0 = GRASS_NOISE.generate((double)pos.getX() / 200.0D, (double)pos.getZ() / 200.0D);
|
||||
|
||||
if (d0 < -0.8D)
|
||||
{
|
||||
return rand.pick(TULIP_TYPES);
|
||||
// int j = rand.nextInt(4);
|
||||
//
|
||||
// switch (j)
|
||||
// {
|
||||
// case 0:
|
||||
// return BlockFlower.EnumFlowerType.ORANGE_TULIP;
|
||||
//
|
||||
// case 1:
|
||||
// return BlockFlower.EnumFlowerType.RED_TULIP;
|
||||
//
|
||||
// case 2:
|
||||
// return BlockFlower.EnumFlowerType.PINK_TULIP;
|
||||
//
|
||||
// case 3:
|
||||
// default:
|
||||
// return BlockFlower.EnumFlowerType.WHITE_TULIP;
|
||||
// }
|
||||
}
|
||||
else if (rand.rarity(3))
|
||||
{
|
||||
return rand.pick(FLOWER_TYPES);
|
||||
// int i = rand.nextInt(3);
|
||||
// return i == 0 ? BlockFlower.EnumFlowerType.POPPY : (i == 1 ? BlockFlower.EnumFlowerType.HOUSTONIA : BlockFlower.EnumFlowerType.OXEYE_DAISY);
|
||||
}
|
||||
else
|
||||
{
|
||||
return BlockFlower.EnumFlowerType.DANDELION;
|
||||
}
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
double d0 = GRASS_NOISE.generate((double)(pos.getX() + 8) / 200.0D, (double)(pos.getZ() + 8) / 200.0D);
|
||||
|
||||
if (d0 < -0.8D)
|
||||
{
|
||||
this.flowersPerChunk = 15;
|
||||
this.grassPerChunk = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.flowersPerChunk = 4;
|
||||
this.grassPerChunk = 10;
|
||||
DOUBLE_PLANT_GEN.setPlantType(BlockDoublePlant.EnumPlantType.GRASS);
|
||||
|
||||
for (int i = 0; i < 7; ++i)
|
||||
{
|
||||
int j = rand.chOffset();
|
||||
int k = rand.chOffset();
|
||||
int l = rand.zrange(worldIn.getHeight(pos.add(j, 0, k)).getY() + 32);
|
||||
DOUBLE_PLANT_GEN.generate(worldIn, rand, pos.add(j, l, k));
|
||||
}
|
||||
}
|
||||
|
||||
// int n = rand.range(0, 2);
|
||||
if (rand.chance())
|
||||
{
|
||||
DOUBLE_PLANT_GEN.setPlantType(BlockDoublePlant.EnumPlantType.SUNFLOWER);
|
||||
|
||||
// for (int i1 = 0; i1 < 10; ++i1)
|
||||
// {
|
||||
int j1 = rand.chOffset();
|
||||
int k1 = rand.chOffset();
|
||||
int l1 = rand.zrange(worldIn.getHeight(pos.add(j1, 0, k1)).getY() + 32);
|
||||
DOUBLE_PLANT_GEN.generate(worldIn, rand, pos.add(j1, l1, k1));
|
||||
// }
|
||||
}
|
||||
|
||||
super.decorate(worldIn, rand, pos);
|
||||
}
|
||||
|
||||
// protected Biome createMutatedBiome(int p_180277_1_)
|
||||
// {
|
||||
// BiomePlains biomegenplains = new BiomePlains(p_180277_1_);
|
||||
// biomegenplains.setBiomeName("sunflowerPlains");
|
||||
// biomegenplains.field_150628_aC = true;
|
||||
// biomegenplains.setColor(9286496);
|
||||
// return biomegenplains;
|
||||
// }
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.block.BlockDirt;
|
||||
import common.block.BlockDoublePlant;
|
||||
import common.entity.animal.EntityHorse;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.ChunkPrimer;
|
||||
import common.worldgen.tree.WorldGenSavanna;
|
||||
import common.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeSavanna extends Biome
|
||||
{
|
||||
private static final WorldGenSavanna field_150627_aC = new WorldGenSavanna(false);
|
||||
|
||||
protected BiomeSavanna(int id)
|
||||
{
|
||||
super(id);
|
||||
this.mobs.add(new RngSpawn(EntityHorse.class, 1, 2, 6));
|
||||
this.treesPerChunk = 1;
|
||||
this.flowersPerChunk = 4;
|
||||
this.grassPerChunk = 20;
|
||||
}
|
||||
|
||||
public WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return (WorldGenTree)(rand.rarity(5) ? field_150627_aC : this.worldGeneratorTrees);
|
||||
}
|
||||
|
||||
protected Biome createMutatedBiome(int p_180277_1_)
|
||||
{
|
||||
Biome biomegenbase = new BiomeSavanna.Mutated(p_180277_1_, this);
|
||||
biomegenbase.temperature = this.temperature == 28.0f ? 24.0f : 20.0f;
|
||||
biomegenbase.depth = this.depth * 0.5F + 0.3F;
|
||||
biomegenbase.scale = this.scale * 0.5F + 1.2F;
|
||||
return biomegenbase;
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
DOUBLE_PLANT_GEN.setPlantType(BlockDoublePlant.EnumPlantType.GRASS);
|
||||
|
||||
for (int i = 0; i < 7; ++i)
|
||||
{
|
||||
int j = rand.chOffset();
|
||||
int k = rand.chOffset();
|
||||
int l = rand.zrange(worldIn.getHeight(pos.add(j, 0, k)).getY() + 32);
|
||||
DOUBLE_PLANT_GEN.generate(worldIn, rand, pos.add(j, l, k));
|
||||
}
|
||||
|
||||
super.decorate(worldIn, rand, pos);
|
||||
}
|
||||
|
||||
public static class Mutated extends BiomeMutated
|
||||
{
|
||||
public Mutated(int p_i45382_1_, Biome p_i45382_2_)
|
||||
{
|
||||
super(p_i45382_1_, p_i45382_2_);
|
||||
this.treesPerChunk = 2;
|
||||
this.flowersPerChunk = 2;
|
||||
this.grassPerChunk = 5;
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(AWorldServer worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
|
||||
{
|
||||
this.topBlock = Blocks.grass.getState();
|
||||
this.fillerBlock = Blocks.dirt.getState();
|
||||
|
||||
if (noiseVal > 1.75D)
|
||||
{
|
||||
this.topBlock = Blocks.stone.getState();
|
||||
this.fillerBlock = Blocks.stone.getState();
|
||||
}
|
||||
else if (noiseVal > -0.5D)
|
||||
{
|
||||
this.topBlock = Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT);
|
||||
}
|
||||
|
||||
this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, x, z, noiseVal);
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
this.decorateNormal(worldIn, rand, pos);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.feature.WorldGenIcePath;
|
||||
import common.worldgen.feature.WorldGenIceSpike;
|
||||
import common.worldgen.tree.WorldGenTaiga2;
|
||||
import common.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeSnow extends Biome
|
||||
{
|
||||
private final WorldGenIceSpike spikeGen = new WorldGenIceSpike();
|
||||
private final WorldGenIcePath pathGen = new WorldGenIcePath(4);
|
||||
private final boolean spiky;
|
||||
|
||||
public BiomeSnow(int id, boolean spiky)
|
||||
{
|
||||
super(id);
|
||||
this.spiky = spiky;
|
||||
if(spiky)
|
||||
this.topBlock = Blocks.snow.getState();
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
if (this.spiky)
|
||||
{
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
int j = rand.chOffset();
|
||||
int k = rand.chOffset();
|
||||
this.spikeGen.generate(worldIn, rand, worldIn.getHeight(pos.add(j, 0, k)));
|
||||
}
|
||||
|
||||
for (int l = 0; l < 2; ++l)
|
||||
{
|
||||
int i1 = rand.chOffset();
|
||||
int j1 = rand.chOffset();
|
||||
this.pathGen.generate(worldIn, rand, worldIn.getHeight(pos.add(i1, 0, j1)));
|
||||
}
|
||||
}
|
||||
|
||||
super.decorate(worldIn, rand, pos);
|
||||
}
|
||||
|
||||
public WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return new WorldGenTaiga2(false);
|
||||
}
|
||||
|
||||
protected Biome createMutatedBiome(int p_180277_1_)
|
||||
{
|
||||
Biome biomegenbase = (new BiomeSnow(p_180277_1_, true)).setColor(13828095).setBiomeName(this.name + "Spikes", this.display + " + Spitzen").enableColdBeach().setTemperature(-20.0f).setHumidity(50.0f).setScaling(this.depth + 0.1F, this.scale + 0.1F);
|
||||
biomegenbase.depth = this.depth + 0.3F;
|
||||
biomegenbase.scale = this.scale + 0.4F;
|
||||
return biomegenbase;
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.entity.animal.EntitySheep;
|
||||
import common.entity.npc.EntitySpirit;
|
||||
import common.init.Blocks;
|
||||
import common.rng.WeightedList;
|
||||
|
||||
public class BiomeSnowLand extends Biome
|
||||
{
|
||||
public BiomeSnowLand(int id)
|
||||
{
|
||||
super(id);
|
||||
this.topBlock = Blocks.snow.getState();
|
||||
this.fillerBlock = Blocks.snow.getState();
|
||||
this.mushroomsPerChunk = -1;
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
mobs.add(new RngSpawn(EntitySheep.class, 50, 4, 4));
|
||||
mobs.add(new RngSpawn(EntitySpirit.class, 10, 1, 1));
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.block.BlockDirt;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
import common.worldgen.feature.WorldGenAsteroid;
|
||||
|
||||
public class BiomeSpace extends Biome
|
||||
{
|
||||
protected FeatureGenerator asteroidGen1 = new WorldGenAsteroid(Blocks.stone.getState(),
|
||||
Blocks.rock.getState());
|
||||
protected FeatureGenerator asteroidGen2 = new WorldGenAsteroid(Blocks.dirt.getState(),
|
||||
Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT));
|
||||
|
||||
public BiomeSpace(int id)
|
||||
{
|
||||
super(id);
|
||||
this.topBlock = Blocks.air.getState();
|
||||
this.fillerBlock = Blocks.air.getState();
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
if(rand.chance(5)) {
|
||||
int x = rand.chOffset();
|
||||
int z = rand.chOffset();
|
||||
rand.chance(this.asteroidGen1, this.asteroidGen2, 100).generate(worldIn, rand,
|
||||
pos.add(x, rand.range(16, 495), z));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.WeightedList;
|
||||
|
||||
public class BiomeStoneBeach extends Biome
|
||||
{
|
||||
public BiomeStoneBeach(int id)
|
||||
{
|
||||
super(id);
|
||||
// this.mobs.clear();
|
||||
this.topBlock = Blocks.stone.getState();
|
||||
this.fillerBlock = Blocks.stone.getState();
|
||||
this.treesPerChunk = -999;
|
||||
this.deadBushPerChunk = 0;
|
||||
this.reedsPerChunk = 0;
|
||||
this.cactiPerChunk = 0;
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
}
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.block.BlockDirectional;
|
||||
import common.block.BlockFlower;
|
||||
import common.entity.npc.EntitySlime;
|
||||
import common.init.Blocks;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.ChunkPrimer;
|
||||
import common.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeSwamp extends Biome
|
||||
{
|
||||
protected BiomeSwamp(int id)
|
||||
{
|
||||
super(id);
|
||||
this.treesPerChunk = 2;
|
||||
this.flowersPerChunk = 1;
|
||||
this.deadBushPerChunk = 1;
|
||||
this.mushroomsPerChunk = 8;
|
||||
this.reedsPerChunk = 10;
|
||||
this.clayPerChunk = 1;
|
||||
this.waterlilyPerChunk = 4;
|
||||
this.sandPerChunk2 = 0;
|
||||
this.sandPerChunk = 0;
|
||||
this.grassPerChunk = 5;
|
||||
this.waterColor = 0xe0ffae;
|
||||
this.mobs.add(new RngSpawn(EntitySlime.class, 1, 1, 1));
|
||||
this.disableBeach();
|
||||
}
|
||||
|
||||
public WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return this.worldGeneratorSwamp;
|
||||
}
|
||||
|
||||
public int getGrassColorAtPos(BlockPos pos)
|
||||
{
|
||||
double d0 = GRASS_NOISE.generate((double)pos.getX() * 0.0225D, (double)pos.getZ() * 0.0225D);
|
||||
return d0 < -0.1D ? 5011004 : 6975545;
|
||||
}
|
||||
|
||||
public int getFoliageColorAtPos(BlockPos pos)
|
||||
{
|
||||
return 6975545;
|
||||
}
|
||||
|
||||
public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
|
||||
{
|
||||
return BlockFlower.EnumFlowerType.BLUE_ORCHID;
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(AWorldServer worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
|
||||
{
|
||||
double d0 = GRASS_NOISE.generate((double)x * 0.25D, (double)z * 0.25D);
|
||||
|
||||
if (d0 > 0.0D)
|
||||
{
|
||||
int i = x & 15;
|
||||
int j = z & 15;
|
||||
|
||||
for (int k = chunkPrimerIn.height - 1; k >= 0; --k)
|
||||
{
|
||||
if (chunkPrimerIn.get(j, k, i).getBlock().getMaterial() != Material.air)
|
||||
{
|
||||
if (k == 62 && chunkPrimerIn.get(j, k, i).getBlock() != Blocks.water)
|
||||
{
|
||||
chunkPrimerIn.set(j, k, i, Blocks.water.getState());
|
||||
|
||||
if (d0 < 0.12D)
|
||||
{
|
||||
chunkPrimerIn.set(j, k + 1, i, Blocks.waterlily.getState().withProperty(BlockDirectional.FACING, Facing.randHorizontal(rand)));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, x, z, noiseVal);
|
||||
}
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.block.BlockDirt;
|
||||
import common.block.BlockDoublePlant;
|
||||
import common.block.BlockTallGrass;
|
||||
import common.entity.animal.EntityWolf;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.ChunkPrimer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
import common.worldgen.feature.WorldGenBlockBlob;
|
||||
import common.worldgen.foliage.WorldGenTallGrass;
|
||||
import common.worldgen.tree.WorldGenPine;
|
||||
import common.worldgen.tree.WorldGenTaiga1;
|
||||
import common.worldgen.tree.WorldGenTaiga2;
|
||||
import common.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeTaiga extends Biome
|
||||
{
|
||||
private static final WorldGenTaiga1 field_150639_aC = new WorldGenTaiga1();
|
||||
private static final WorldGenTaiga2 field_150640_aD = new WorldGenTaiga2(false);
|
||||
private static final WorldGenPine field_150641_aE = new WorldGenPine(false, false);
|
||||
private static final WorldGenPine field_150642_aF = new WorldGenPine(false, true);
|
||||
private static final WorldGenBlockBlob field_150643_aG = new WorldGenBlockBlob(Blocks.mossy_cobblestone, 0);
|
||||
private int field_150644_aH;
|
||||
|
||||
public BiomeTaiga(int id, int p_i45385_2_)
|
||||
{
|
||||
super(id);
|
||||
this.field_150644_aH = p_i45385_2_;
|
||||
this.mobs.add(new RngSpawn(EntityWolf.class, 8, 4, 4));
|
||||
this.treesPerChunk = 10;
|
||||
|
||||
if (p_i45385_2_ != 1 && p_i45385_2_ != 2)
|
||||
{
|
||||
this.grassPerChunk = 1;
|
||||
this.mushroomsPerChunk = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.grassPerChunk = 7;
|
||||
this.deadBushPerChunk = 1;
|
||||
this.mushroomsPerChunk = 3;
|
||||
}
|
||||
}
|
||||
|
||||
public WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return (WorldGenTree)((this.field_150644_aH == 1 || this.field_150644_aH == 2) && rand.chance(3) ? (this.field_150644_aH != 2 && rand.rarity(13) ? field_150641_aE : field_150642_aF) : (rand.chance(3) ? field_150639_aC : field_150640_aD));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a WorldGen appropriate for this biome.
|
||||
*/
|
||||
public FeatureGenerator getRandomWorldGenForGrass(Random rand)
|
||||
{
|
||||
return rand.rarity(5) ? new WorldGenTallGrass(BlockTallGrass.EnumType.FERN) : new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS);
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
if (this.field_150644_aH == 1 || this.field_150644_aH == 2)
|
||||
{
|
||||
int i = rand.zrange(3);
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
int k = rand.chOffset();
|
||||
int l = rand.chOffset();
|
||||
BlockPos blockpos = worldIn.getHeight(pos.add(k, 0, l));
|
||||
field_150643_aG.generate(worldIn, rand, blockpos);
|
||||
}
|
||||
}
|
||||
|
||||
DOUBLE_PLANT_GEN.setPlantType(BlockDoublePlant.EnumPlantType.FERN);
|
||||
|
||||
for (int i1 = 0; i1 < 7; ++i1)
|
||||
{
|
||||
int j1 = rand.chOffset();
|
||||
int k1 = rand.chOffset();
|
||||
int l1 = rand.zrange(worldIn.getHeight(pos.add(j1, 0, k1)).getY() + 32);
|
||||
DOUBLE_PLANT_GEN.generate(worldIn, rand, pos.add(j1, l1, k1));
|
||||
}
|
||||
|
||||
super.decorate(worldIn, rand, pos);
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(AWorldServer worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
|
||||
{
|
||||
if (this.field_150644_aH == 1 || this.field_150644_aH == 2)
|
||||
{
|
||||
this.topBlock = Blocks.grass.getState();
|
||||
this.fillerBlock = Blocks.dirt.getState();
|
||||
|
||||
if (noiseVal > 1.75D)
|
||||
{
|
||||
this.topBlock = Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT);
|
||||
}
|
||||
else if (noiseVal > -0.95D)
|
||||
{
|
||||
this.topBlock = Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL);
|
||||
}
|
||||
}
|
||||
|
||||
this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, x, z, noiseVal);
|
||||
}
|
||||
|
||||
protected Biome createMutatedBiome(int p_180277_1_)
|
||||
{
|
||||
return this.id == Biome.megaTaiga.id ? (new BiomeTaiga(p_180277_1_, 2)).setColor(5858897).setBiomeName("megaSpruceTaiga", "Hohe Fichtentaiga").setTemperature(-10.0f).setHumidity(80.0f).setScaling(this.depth, this.scale) : super.createMutatedBiome(p_180277_1_);
|
||||
}
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.block.BlockFlower;
|
||||
import common.entity.animal.EntityBat;
|
||||
import common.entity.animal.EntityMouse;
|
||||
import common.entity.animal.EntityRabbit;
|
||||
import common.entity.npc.EntityCultivator;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
import common.worldgen.feature.WorldGenSpikes;
|
||||
import common.worldgen.foliage.WorldGenMushroom;
|
||||
import common.worldgen.tree.WorldGenBaseTree;
|
||||
import common.worldgen.tree.WorldGenBigTree;
|
||||
import common.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeTian extends Biome
|
||||
{
|
||||
protected FeatureGenerator spikeGen = new WorldGenSpikes(Blocks.tian_soil, 128, 2, 3, Blocks.obsidian.getState(), true);
|
||||
protected FeatureGenerator mushroomBlueGen = new WorldGenMushroom(Blocks.blue_mushroom);
|
||||
protected WorldGenTree treeGen1 = new WorldGenBigTree(false, Blocks.tian_log.getState(), Blocks.tian_leaves.getState())
|
||||
.setHeightLimit(6, 8);
|
||||
protected WorldGenTree treeGen2 = new WorldGenBigTree(false, Blocks.tian_log.getState(), Blocks.tian_leaves.getState())
|
||||
.setHeightLimit(14, 20);
|
||||
protected WorldGenTree treeGen3 = new WorldGenBaseTree(false, Blocks.tian_log.getState(), Blocks.tian_leaves.getState());
|
||||
protected WorldGenTree treeGen4 = new WorldGenBigTree(false, Blocks.tian_log.getState(), Blocks.tian_leaves.getState())
|
||||
.setHeightLimit(12, 15);
|
||||
|
||||
public BiomeTian(int id)
|
||||
{
|
||||
super(id);
|
||||
this.topBlock = Blocks.tian_soil.getState();
|
||||
this.fillerBlock = Blocks.tian.getState();
|
||||
this.mushroomsPerChunk = -1;
|
||||
this.grassPerChunk = 0;
|
||||
this.treesPerChunk = 1;
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
// mobs.add(new Biome.RngSpawn(EntityHaunter.class, 50, 4, 4));
|
||||
mobs.add(new RngSpawn(EntityCultivator.class, 50, 1, 1));
|
||||
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 BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
|
||||
{
|
||||
return BlockFlower.EnumFlowerType.BLACK_LOTUS;
|
||||
}
|
||||
|
||||
public WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return rand.pick(rand.chance(this.treeGen2, this.treeGen1, 4), rand.chance(this.treeGen3, this.treeGen4, 15));
|
||||
}
|
||||
|
||||
public void decorate(AWorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
super.decorate(worldIn, rand, pos);
|
||||
|
||||
for (int l3 = 0; l3 < 2; ++l3)
|
||||
{
|
||||
if (rand.chance(4))
|
||||
{
|
||||
int i8 = rand.chOffset();
|
||||
int l11 = rand.chOffset();
|
||||
BlockPos blockpos2 = worldIn.getHeight(pos.add(i8, 0, l11));
|
||||
this.mushroomBlueGen.generate(worldIn, rand, blockpos2);
|
||||
}
|
||||
}
|
||||
|
||||
if (rand.chance(4))
|
||||
{
|
||||
int i = rand.chOffset();
|
||||
int j = rand.chOffset();
|
||||
this.spikeGen.generate(worldIn, rand, worldIn.getTopSolidOrLiquidBlock(pos.add(i, 0, j)));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.entity.animal.EntitySquid;
|
||||
import common.rng.WeightedList;
|
||||
|
||||
public class BiomeWater extends Biome {
|
||||
private final boolean river;
|
||||
|
||||
public BiomeWater(int id, boolean river) {
|
||||
super(id);
|
||||
this.river = river;
|
||||
this.disableBeach();
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
mobs.add(new RngSpawn(EntitySquid.class, 10, 4, 4));
|
||||
}
|
||||
|
||||
public Temperature getTempCategory() {
|
||||
return this.river ? super.getTempCategory() : Temperature.SEA;
|
||||
}
|
||||
}
|
47
common/src/common/biome/IBiome.java
Normal file
47
common/src/common/biome/IBiome.java
Normal file
|
@ -0,0 +1,47 @@
|
|||
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(BaseBiome base) {
|
||||
return new IBiome() {
|
||||
public State getFiller() {
|
||||
return BlockRegistry.getRegisteredBlock("air").getState();
|
||||
}
|
||||
public State getTop() {
|
||||
return BlockRegistry.getRegisteredBlock("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(BaseBiome base);
|
||||
}
|
||||
|
||||
public static void setProvider(BiomeProvider provider) {
|
||||
BiomeProvider.provider = provider;
|
||||
}
|
||||
|
||||
public static IBiome getBiome(BaseBiome 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();
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
public enum Temperature {
|
||||
SEA, COLD, MEDIUM, WARM;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
|
||||
import common.biome.IBiome;
|
||||
import common.color.Colorizer;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
|
@ -113,54 +114,7 @@ public class BlockGrass extends Block implements IGrowable
|
|||
|
||||
public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state)
|
||||
{
|
||||
BlockPos blockpos = pos.up();
|
||||
|
||||
for (int i = 0; i < 128; ++i)
|
||||
{
|
||||
BlockPos blockpos1 = blockpos;
|
||||
int j = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (j >= i / 16)
|
||||
{
|
||||
if (worldIn.getState(blockpos1).getBlock().material == Material.air)
|
||||
{
|
||||
if (rand.chance(8))
|
||||
{
|
||||
BlockFlower.EnumFlowerType blockflower$enumflowertype = worldIn.getBiomeGenForCoords(blockpos1).pickRandomFlower(rand, blockpos1);
|
||||
BlockFlower blockflower = blockflower$enumflowertype.getBlockType().getBlock();
|
||||
State iblockstate = blockflower.getState().withProperty(blockflower.getTypeProperty(), blockflower$enumflowertype);
|
||||
|
||||
if (blockflower.canBlockStay(worldIn, blockpos1, iblockstate))
|
||||
{
|
||||
worldIn.setState(blockpos1, iblockstate, 3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
State iblockstate1 = Blocks.tallgrass.getState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.GRASS);
|
||||
|
||||
if (Blocks.tallgrass.canBlockStay(worldIn, blockpos1, iblockstate1))
|
||||
{
|
||||
worldIn.setState(blockpos1, iblockstate1, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
blockpos1 = blockpos1.add(rand.zrange(3) - 1, (rand.zrange(3) - 1) * rand.zrange(3) / 2, rand.zrange(3) - 1);
|
||||
|
||||
if (worldIn.getState(blockpos1.down()).getBlock() != Blocks.grass || worldIn.getState(blockpos1).getBlock().isNormalCube())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
++j;
|
||||
}
|
||||
}
|
||||
IBiome.getBiome(worldIn.getBiomeGenForCoords(pos)).growGrass(worldIn, pos, state, rand);
|
||||
}
|
||||
|
||||
public BlockLayer getBlockLayer()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package common.block;
|
||||
|
||||
import common.biome.IBiome;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.model.Model;
|
||||
|
@ -9,8 +10,6 @@ import common.util.BlockPos;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
import common.worldgen.foliage.WorldGenBigMushroom;
|
||||
|
||||
public class BlockMushroom extends BlockBush implements IGrowable
|
||||
{
|
||||
|
@ -86,31 +85,6 @@ public class BlockMushroom extends BlockBush implements IGrowable
|
|||
}
|
||||
}
|
||||
|
||||
public boolean generateBigMushroom(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
||||
{
|
||||
worldIn.setBlockToAir(pos);
|
||||
FeatureGenerator worldgenerator = null;
|
||||
|
||||
if (this == Blocks.brown_mushroom)
|
||||
{
|
||||
worldgenerator = new WorldGenBigMushroom(Blocks.brown_mushroom_block);
|
||||
}
|
||||
else if (this == Blocks.red_mushroom)
|
||||
{
|
||||
worldgenerator = new WorldGenBigMushroom(Blocks.red_mushroom_block);
|
||||
}
|
||||
|
||||
if (worldgenerator != null && worldgenerator.generate(worldIn, rand, pos))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setState(pos, state, 3);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this IGrowable can grow
|
||||
*/
|
||||
|
@ -126,7 +100,7 @@ public class BlockMushroom extends BlockBush implements IGrowable
|
|||
|
||||
public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state)
|
||||
{
|
||||
this.generateBigMushroom(worldIn, pos, state, rand);
|
||||
IBiome.getBiome(worldIn.getBiomeGenForCoords(pos)).generateBigMushroom(worldIn, pos, state, rand);
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package common.block;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import common.biome.IBiome;
|
||||
import common.collect.Lists;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
|
@ -16,15 +17,6 @@ import common.util.BlockPos;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
import common.worldgen.tree.WorldGenBaseTree;
|
||||
import common.worldgen.tree.WorldGenBigTree;
|
||||
import common.worldgen.tree.WorldGenBirch;
|
||||
import common.worldgen.tree.WorldGenDarkOak;
|
||||
import common.worldgen.tree.WorldGenJungle;
|
||||
import common.worldgen.tree.WorldGenPine;
|
||||
import common.worldgen.tree.WorldGenSavanna;
|
||||
import common.worldgen.tree.WorldGenTaiga2;
|
||||
|
||||
public class BlockSapling extends BlockBush implements IGrowable
|
||||
{
|
||||
|
@ -79,158 +71,10 @@ public class BlockSapling extends BlockBush implements IGrowable
|
|||
}
|
||||
else
|
||||
{
|
||||
this.generateTree(worldIn, pos, state, rand);
|
||||
IBiome.getBiome(worldIn.getBiomeGenForCoords(pos)).generateTree(worldIn, pos, state, rand);
|
||||
}
|
||||
}
|
||||
|
||||
public void generateTree(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
||||
{
|
||||
WoodType type = state.getBlock() instanceof BlockSapling ? ((BlockSapling)state.getBlock()).type : WoodType.OAK;
|
||||
State log = type == WoodType.CHERRY ? Blocks.cherry_log.getState() : // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.CHERRY) :
|
||||
(type == WoodType.MAPLE ? Blocks.maple_log.getState() /* .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.MAPLE) */ : Blocks.oak_log.getState());
|
||||
State leaves = type == WoodType.CHERRY ? Blocks.cherry_leaves.getState() :
|
||||
(type == WoodType.MAPLE ? Blocks.maple_leaves.getState() : Blocks.oak_leaves.getState());
|
||||
FeatureGenerator worldgenerator = (FeatureGenerator)(rand.chance(10) ? new WorldGenBigTree(true, log, leaves) : new WorldGenBaseTree(true, log, leaves));
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
boolean flag = false;
|
||||
// leaves = leaves.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen());
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SPRUCE:
|
||||
label114:
|
||||
for (i = 0; i >= -1; --i)
|
||||
{
|
||||
for (j = 0; j >= -1; --j)
|
||||
{
|
||||
if (this.isSameSaplingTypeIn(worldIn, pos, i, j, WoodType.SPRUCE))
|
||||
{
|
||||
worldgenerator = new WorldGenPine(false, rand.chance());
|
||||
flag = true;
|
||||
break label114;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
j = 0;
|
||||
i = 0;
|
||||
worldgenerator = new WorldGenTaiga2(true);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case BIRCH:
|
||||
worldgenerator = new WorldGenBirch(true, false);
|
||||
break;
|
||||
|
||||
case TIAN:
|
||||
worldgenerator = new WorldGenBigTree(true, Blocks.tian_log.getState(), Blocks.tian_leaves.getState())
|
||||
.setHeightLimit(6, 20);
|
||||
break;
|
||||
|
||||
case JUNGLE:
|
||||
State iblockstate = Blocks.jungle_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE);
|
||||
State iblockstate1 = Blocks.jungle_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false));
|
||||
label269:
|
||||
|
||||
for (i = 0; i >= -1; --i)
|
||||
{
|
||||
for (j = 0; j >= -1; --j)
|
||||
{
|
||||
if (this.isSameSaplingTypeIn(worldIn, pos, i, j, WoodType.JUNGLE))
|
||||
{
|
||||
worldgenerator = new WorldGenJungle(true, 10, 20, iblockstate, iblockstate1);
|
||||
flag = true;
|
||||
break label269;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
j = 0;
|
||||
i = 0;
|
||||
worldgenerator = new WorldGenBaseTree(true, rand.range(4, 10), iblockstate, iblockstate1, false);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ACACIA:
|
||||
worldgenerator = new WorldGenSavanna(true);
|
||||
break;
|
||||
|
||||
case DARK_OAK:
|
||||
label390:
|
||||
for (i = 0; i >= -1; --i)
|
||||
{
|
||||
for (j = 0; j >= -1; --j)
|
||||
{
|
||||
if (this.isSameSaplingTypeIn(worldIn, pos, i, j, WoodType.DARK_OAK))
|
||||
{
|
||||
worldgenerator = new WorldGenDarkOak(true);
|
||||
flag = true;
|
||||
break label390;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
case OAK:
|
||||
case CHERRY:
|
||||
case MAPLE:
|
||||
}
|
||||
|
||||
State iblockstate2 = Blocks.air.getState();
|
||||
|
||||
if (flag)
|
||||
{
|
||||
worldIn.setState(pos.add(i, 0, j), iblockstate2, 4);
|
||||
worldIn.setState(pos.add(i + 1, 0, j), iblockstate2, 4);
|
||||
worldIn.setState(pos.add(i, 0, j + 1), iblockstate2, 4);
|
||||
worldIn.setState(pos.add(i + 1, 0, j + 1), iblockstate2, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setState(pos, iblockstate2, 4);
|
||||
}
|
||||
|
||||
if (!worldgenerator.generate(worldIn, rand, pos.add(i, 0, j)))
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
worldIn.setState(pos.add(i, 0, j), state, 4);
|
||||
worldIn.setState(pos.add(i + 1, 0, j), state, 4);
|
||||
worldIn.setState(pos.add(i, 0, j + 1), state, 4);
|
||||
worldIn.setState(pos.add(i + 1, 0, j + 1), state, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setState(pos, state, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSameSaplingTypeIn(World worldIn, BlockPos pos, int xOff, int yOff, WoodType type)
|
||||
{
|
||||
return this.isTypeAt(worldIn, pos.add(xOff, 0, yOff), type) && this.isTypeAt(worldIn, pos.add(xOff + 1, 0, yOff), type) && this.isTypeAt(worldIn, pos.add(xOff, 0, yOff + 1), type) && this.isTypeAt(worldIn, pos.add(xOff + 1, 0, yOff + 1), type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the given BlockPos has a Sapling of the given type
|
||||
*/
|
||||
public boolean isTypeAt(World worldIn, BlockPos pos, WoodType type)
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos);
|
||||
return iblockstate.getBlock() instanceof BlockSapling && ((BlockSapling)iblockstate.getBlock()).type == type;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It
|
||||
// * returns the metadata of the dropped item based on the old metadata of the block.
|
||||
|
@ -296,4 +140,8 @@ public class BlockSapling extends BlockBush implements IGrowable
|
|||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel(name).cross();
|
||||
}
|
||||
|
||||
public WoodType getWoodType() {
|
||||
return this.type;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package common.color;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.biome.BaseBiome;
|
||||
import common.util.BlockPos;
|
||||
import common.world.IWorldAccess;
|
||||
|
||||
|
@ -8,21 +8,21 @@ public enum Colorizer {
|
|||
NONE(0xffffff), BASIC(0x37b500), PINE(0x3f993f), BIRCH(0x68a723);
|
||||
|
||||
private interface ColorResolver {
|
||||
int getColorAtPos(Biome biome, BlockPos pos);
|
||||
int getColorAtPos(BaseBiome biome, BlockPos pos);
|
||||
}
|
||||
|
||||
private static final ColorResolver GRASS_COLOR = new ColorResolver() {
|
||||
public int getColorAtPos(Biome biome, BlockPos pos) {
|
||||
public int getColorAtPos(BaseBiome biome, BlockPos pos) {
|
||||
return biome.getGrassColorAtPos(pos);
|
||||
}
|
||||
};
|
||||
private static final ColorResolver FOLIAGE_COLOR = new ColorResolver() {
|
||||
public int getColorAtPos(Biome biome, BlockPos pos) {
|
||||
public int getColorAtPos(BaseBiome biome, BlockPos pos) {
|
||||
return biome.getFoliageColorAtPos(pos);
|
||||
}
|
||||
};
|
||||
private static final ColorResolver WATER_COLOR_MULTIPLIER = new ColorResolver() {
|
||||
public int getColorAtPos(Biome biome, BlockPos pos) {
|
||||
public int getColorAtPos(BaseBiome biome, BlockPos pos) {
|
||||
return biome.waterColor;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -4,7 +4,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.biome.BaseBiome;
|
||||
import common.biome.IBiome;
|
||||
import common.block.LeavesType;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
|
@ -16,34 +17,13 @@ import common.init.UniverseRegistry;
|
|||
import common.nbt.NBTTagCompound;
|
||||
import common.nbt.NBTTagList;
|
||||
import common.nbt.NBTTagString;
|
||||
import common.rng.Random;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Vec3;
|
||||
import common.world.State;
|
||||
import common.world.Weather;
|
||||
import common.worldgen.BiomeGenLayered;
|
||||
import common.worldgen.BiomeGenPerlin;
|
||||
import common.worldgen.BiomeGenSingle;
|
||||
import common.worldgen.BiomeGenerator;
|
||||
import common.worldgen.BlockReplacer;
|
||||
import common.worldgen.ChunkGenerator;
|
||||
import common.worldgen.FeatureDungeons;
|
||||
import common.worldgen.FeatureLakes;
|
||||
import common.worldgen.FeatureLiquids;
|
||||
import common.worldgen.FeatureOres;
|
||||
import common.worldgen.GeneratorCavern;
|
||||
import common.worldgen.GeneratorDestroyed;
|
||||
import common.worldgen.GeneratorFlat;
|
||||
import common.worldgen.GeneratorIsland;
|
||||
import common.worldgen.GeneratorPerlin;
|
||||
import common.worldgen.GeneratorSimple;
|
||||
import common.worldgen.ReplacerAltBiome;
|
||||
import common.worldgen.ReplacerAltSurface;
|
||||
import common.worldgen.ReplacerBiome;
|
||||
import common.worldgen.ReplacerTopLayer;
|
||||
import common.worldgen.caves.MapGenBigCaves;
|
||||
import common.worldgen.caves.MapGenCaves;
|
||||
import common.worldgen.caves.MapGenRavine;
|
||||
import common.worldgen.FeatureLake;
|
||||
import common.worldgen.FeatureLiquid;
|
||||
import common.worldgen.FeatureOre;
|
||||
|
||||
public abstract class Dimension extends Nameable implements Comparable<Dimension> {
|
||||
public class GeneratorSettings {
|
||||
|
@ -290,7 +270,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
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 Biome defaultBiome = Biome.none; // biomegen
|
||||
private BaseBiome defaultBiome = BaseBiome.NONE; // biomegen
|
||||
|
||||
private State filler = Blocks.air.getState(); // caves+rav, liquid, ore, g.perlin, g.cavern, g.island,
|
||||
// g.simple, g.flat (sealevel), r.biome, r.simple, r.alternate, r.toplayer
|
||||
|
@ -303,15 +283,15 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
private State ceiling = null; // chunk
|
||||
private State caveFiller = Blocks.air.getState(); // cavebase, ravine
|
||||
private State[] layers = null; // g.flat
|
||||
private Biome[] frostBiomes = null; // b.layered
|
||||
private Biome[] coldBiomes = null; // b.layered
|
||||
private Biome[] mediumBiomes = null; // b.layered
|
||||
private Biome[] hotBiomes = null; // b.layered
|
||||
private Biome[] addBiomes = null; // b.layered
|
||||
private BaseBiome[] frostBiomes = null; // b.layered
|
||||
private BaseBiome[] coldBiomes = null; // b.layered
|
||||
private BaseBiome[] mediumBiomes = null; // b.layered
|
||||
private BaseBiome[] hotBiomes = null; // b.layered
|
||||
private BaseBiome[] addBiomes = null; // b.layered
|
||||
|
||||
private final List<FeatureOres> ores = Lists.newArrayList();
|
||||
private final List<FeatureLakes> lakes = Lists.newArrayList();
|
||||
private final List<FeatureLiquids> liquids = Lists.newArrayList();
|
||||
private final List<FeatureOre> ores = Lists.newArrayList();
|
||||
private final List<FeatureLake> lakes = Lists.newArrayList();
|
||||
private final List<FeatureLiquid> liquids = Lists.newArrayList();
|
||||
|
||||
private long seed = 0L;
|
||||
|
||||
|
@ -482,15 +462,16 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setBiomeGen(Biome mainBiome, boolean semiFixed, int biomeSize, int riverSize, int snowRarity, int seaRarity) {
|
||||
public final Dimension setBiomeGen(BaseBiome mainBiome, boolean semiFixed, int biomeSize, int riverSize, int snowRarity, int seaRarity) {
|
||||
return this.setBiomeGen(mainBiome, semiFixed, biomeSize, riverSize, snowRarity, seaRarity, 1);
|
||||
}
|
||||
|
||||
public final Dimension setBiomeGen(Biome mainBiome, boolean semiFixed, int biomeSize, int riverSize, int snowRarity, int seaRarity,
|
||||
int addRarity, Biome ... add) {
|
||||
public final Dimension setBiomeGen(BaseBiome mainBiome, boolean semiFixed, int biomeSize, int riverSize, int snowRarity, int seaRarity,
|
||||
int addRarity, BaseBiome ... add) {
|
||||
this.defaultBiome = mainBiome;
|
||||
this.top = mainBiome.fillerBlock;
|
||||
this.surface = mainBiome.topBlock;
|
||||
IBiome biome = IBiome.getBiome(mainBiome);
|
||||
this.top = biome.getFiller();
|
||||
this.surface = biome.getTop();
|
||||
this.semiFixed = semiFixed;
|
||||
this.biomeSize = biomeSize;
|
||||
this.riverSize = riverSize;
|
||||
|
@ -501,30 +482,31 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setFrostBiomes(Biome ... biomes) {
|
||||
public final Dimension setFrostBiomes(BaseBiome ... biomes) {
|
||||
this.frostBiomes = biomes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setColdBiomes(Biome ... biomes) {
|
||||
public final Dimension setColdBiomes(BaseBiome ... biomes) {
|
||||
this.coldBiomes = biomes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setMediumBiomes(Biome ... biomes) {
|
||||
public final Dimension setMediumBiomes(BaseBiome ... biomes) {
|
||||
this.mediumBiomes = biomes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setHotBiomes(Biome ... biomes) {
|
||||
public final Dimension setHotBiomes(BaseBiome ... biomes) {
|
||||
this.hotBiomes = biomes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setBiome(Biome value) {
|
||||
public final Dimension setBiome(BaseBiome value) {
|
||||
this.defaultBiome = value;
|
||||
this.top = value.fillerBlock;
|
||||
this.surface = value.topBlock;
|
||||
IBiome biome = IBiome.getBiome(value);
|
||||
this.top = biome.getFiller();
|
||||
this.surface = biome.getTop();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -613,24 +595,24 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
|
||||
public final Dimension addLake(State state, State filler, State top, int chance, int minHeight, int maxHeight,
|
||||
boolean ratiod) {
|
||||
this.lakes.add(new FeatureLakes(state, filler, top, chance, minHeight, maxHeight, ratiod));
|
||||
this.lakes.add(new FeatureLake(state, filler, top, chance, minHeight, maxHeight, ratiod));
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension addLiquid(State state, int chance, int minHeight, int maxHeight, boolean lower) {
|
||||
this.liquids.add(new FeatureLiquids(state, chance, minHeight, maxHeight, lower));
|
||||
this.liquids.add(new FeatureLiquid(state, chance, minHeight, maxHeight, lower));
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension addOre(State state, int count, int more, int size, int minHeight, int maxHeight, boolean distrib) {
|
||||
this.ores.add(new FeatureOres(state, count, more, size, minHeight, maxHeight, distrib));
|
||||
this.ores.add(new FeatureOre(state, count, more, size, minHeight, maxHeight, distrib));
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension addMetalOres(MetalType ... metals) {
|
||||
for(MetalType metal : metals) {
|
||||
int count = METAL_COUNTS[metal.rarity];
|
||||
this.ores.add(new FeatureOres(BlockRegistry.getRegisteredBlock(metal.name + "_ore").getState(),
|
||||
this.ores.add(new FeatureOre(BlockRegistry.getRegisteredBlock(metal.name + "_ore").getState(),
|
||||
count < 0 ? 0 : count, count < 0 ? (-count) : 0, METAL_SIZES[metal.rarity], 0, METAL_HEIGHTS[metal.rarity], false));
|
||||
}
|
||||
return this;
|
||||
|
@ -736,86 +718,6 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public final BiomeGenerator createBiomeGenerator(Random rand) {
|
||||
return this.biomeSize > 0 ? new BiomeGenLayered(rand.longv(), this.defaultBiome, this.semiFixed, this.biomeSize, this.riverSize,
|
||||
this.snowRarity, this.seaRarity, this.addBiomes == null ? new Biome[0] : this.addBiomes, this.addRarity,
|
||||
this.hotBiomes == null ? new Biome[] {this.defaultBiome} : this.hotBiomes,
|
||||
this.mediumBiomes == null ? new Biome[] {this.defaultBiome} : this.mediumBiomes,
|
||||
this.coldBiomes == null ? new Biome[] {this.defaultBiome} : this.coldBiomes,
|
||||
this.frostBiomes == null ? new Biome[] {this.defaultBiome} : this.frostBiomes) : new BiomeGenSingle(this.defaultBiome);
|
||||
}
|
||||
|
||||
public final ChunkGenerator createChunkGenerator(Random rand) {
|
||||
switch(this.generatorType) {
|
||||
case FLAT:
|
||||
return this.layers == null ? new GeneratorFlat(this.seaLevel, this.filler) : new GeneratorFlat(this.layers);
|
||||
case PERLIN:
|
||||
default:
|
||||
return new GeneratorPerlin(rand, this.filler, this.liquid, this.noiseGen);
|
||||
case SIMPLE:
|
||||
return new GeneratorSimple(rand, this.filler, this.liquid,
|
||||
this.biomeSize > 0 ? null : new BiomeGenPerlin(rand.longv()));
|
||||
case ISLAND:
|
||||
return new GeneratorIsland(rand, this.filler);
|
||||
case CAVERN:
|
||||
return new GeneratorCavern(rand, this.filler, this.liquid);
|
||||
case DESTROYED:
|
||||
return new GeneratorDestroyed(this.seaLevel);
|
||||
}
|
||||
}
|
||||
|
||||
public final BlockReplacer createBlockReplacer(Random rand) {
|
||||
switch(this.replacerType) {
|
||||
case BIOMES:
|
||||
default:
|
||||
return new ReplacerBiome(rand);
|
||||
case SIMPLE:
|
||||
return new ReplacerAltBiome(rand, this.filler, this.liquid, this.alt2, this.alt1);
|
||||
case ALTERNATE:
|
||||
return new ReplacerAltSurface(rand, this.filler, this.alt1, this.alt2, this.liquid);
|
||||
case TOPLAYER:
|
||||
return new ReplacerTopLayer(this.surface, this.filler.getBlock());
|
||||
case NONE:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public final FeatureDungeons createDungeonGenerator() {
|
||||
return this.dungeons > 0 ? new FeatureDungeons(this.dungeons) : null;
|
||||
}
|
||||
|
||||
public final MapGenCaves createCaveGenerator() {
|
||||
return this.caves ?
|
||||
(new MapGenCaves(this.caveFiller, this.filler.getBlock(), this.top.getBlock(),
|
||||
this.surface.getBlock(), this.alt1.getBlock())) : null;
|
||||
}
|
||||
|
||||
public final MapGenRavine createRavineGenerator() {
|
||||
return this.ravines ?
|
||||
(new MapGenRavine(this.caveFiller, this.filler.getBlock(),
|
||||
this.top.getBlock(), this.surface.getBlock())) : null;
|
||||
}
|
||||
|
||||
public final MapGenBigCaves createBigCaveGenerator() {
|
||||
return this.strideCaves ?
|
||||
(new MapGenBigCaves(this.filler.getBlock(),
|
||||
this.top.getBlock(), this.surface.getBlock())) : null;
|
||||
}
|
||||
|
||||
public final FeatureOres[] getOres() {
|
||||
return this.ores.isEmpty() ? null : this.ores.toArray(new FeatureOres[this.ores.size()]);
|
||||
}
|
||||
|
||||
public final FeatureLakes[] getLakes() {
|
||||
return this.lakes.isEmpty() ? null : this.lakes.toArray(new FeatureLakes[this.lakes.size()]);
|
||||
}
|
||||
|
||||
public final FeatureLiquids[] getLiquids() {
|
||||
return this.liquids.isEmpty() ? null : this.liquids.toArray(new FeatureLiquids[this.liquids.size()]);
|
||||
}
|
||||
|
||||
public final long getSeed() {
|
||||
return this.seed;
|
||||
}
|
||||
|
@ -1108,8 +1010,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.addRarity = tag.getInteger("AddRarity");
|
||||
// this.biomeRarity = tag.getInteger("BiomeRarity");
|
||||
this.seaLevel = tag.getInteger("SeaLevel");
|
||||
this.defaultBiome = Biome.findByName(tag.getString("DefaultBiome"));
|
||||
this.defaultBiome = this.defaultBiome == null ? Biome.DEF_BIOME : this.defaultBiome;
|
||||
this.defaultBiome = BaseBiome.findByName(tag.getString("DefaultBiome"));
|
||||
this.semiFixed = tag.getBoolean("SemiFixed");
|
||||
this.defaultWeather = Weather.getByName(tag.getString("DefaultWeather"));
|
||||
this.defaultWeather = this.defaultWeather == null ? Weather.CLEAR : this.defaultWeather;
|
||||
|
@ -1142,10 +1043,9 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.addBiomes = null;
|
||||
}
|
||||
else {
|
||||
this.addBiomes = new Biome[list.tagCount()];
|
||||
this.addBiomes = new BaseBiome[list.tagCount()];
|
||||
for(int z = 0; z < this.addBiomes.length; z++) {
|
||||
this.addBiomes[z] = Biome.findByName(list.getStringTagAt(z));
|
||||
this.addBiomes[z] = this.addBiomes[z] == null ? Biome.DEF_BIOME : this.addBiomes[z];
|
||||
this.addBiomes[z] = BaseBiome.findByName(list.getStringTagAt(z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1158,10 +1058,9 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.frostBiomes = null;
|
||||
}
|
||||
else {
|
||||
this.frostBiomes = new Biome[list.tagCount()];
|
||||
this.frostBiomes = new BaseBiome[list.tagCount()];
|
||||
for(int z = 0; z < this.frostBiomes.length; z++) {
|
||||
this.frostBiomes[z] = Biome.findByName(list.getStringTagAt(z));
|
||||
this.frostBiomes[z] = this.frostBiomes[z] == null ? Biome.DEF_BIOME : this.frostBiomes[z];
|
||||
this.frostBiomes[z] = BaseBiome.findByName(list.getStringTagAt(z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1174,10 +1073,9 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.coldBiomes = null;
|
||||
}
|
||||
else {
|
||||
this.coldBiomes = new Biome[list.tagCount()];
|
||||
this.coldBiomes = new BaseBiome[list.tagCount()];
|
||||
for(int z = 0; z < this.coldBiomes.length; z++) {
|
||||
this.coldBiomes[z] = Biome.findByName(list.getStringTagAt(z));
|
||||
this.coldBiomes[z] = this.coldBiomes[z] == null ? Biome.DEF_BIOME : this.coldBiomes[z];
|
||||
this.coldBiomes[z] = BaseBiome.findByName(list.getStringTagAt(z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1190,10 +1088,9 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.mediumBiomes = null;
|
||||
}
|
||||
else {
|
||||
this.mediumBiomes = new Biome[list.tagCount()];
|
||||
this.mediumBiomes = new BaseBiome[list.tagCount()];
|
||||
for(int z = 0; z < this.mediumBiomes.length; z++) {
|
||||
this.mediumBiomes[z] = Biome.findByName(list.getStringTagAt(z));
|
||||
this.mediumBiomes[z] = this.mediumBiomes[z] == null ? Biome.DEF_BIOME : this.mediumBiomes[z];
|
||||
this.mediumBiomes[z] = BaseBiome.findByName(list.getStringTagAt(z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1206,10 +1103,9 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
this.hotBiomes = null;
|
||||
}
|
||||
else {
|
||||
this.hotBiomes = new Biome[list.tagCount()];
|
||||
this.hotBiomes = new BaseBiome[list.tagCount()];
|
||||
for(int z = 0; z < this.hotBiomes.length; z++) {
|
||||
this.hotBiomes[z] = Biome.findByName(list.getStringTagAt(z));
|
||||
this.hotBiomes[z] = this.hotBiomes[z] == null ? Biome.DEF_BIOME : this.hotBiomes[z];
|
||||
this.hotBiomes[z] = BaseBiome.findByName(list.getStringTagAt(z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1221,7 +1117,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
NBTTagList list = tag.getTagList("Ores", 10);
|
||||
for(int z = 0; z < list.tagCount(); z++) {
|
||||
NBTTagCompound gen = list.getCompoundTagAt(z);
|
||||
this.ores.add(new FeatureOres(BlockRegistry.getFromIdName(gen.getString("Block"), Blocks.iron_ore.getState()),
|
||||
this.ores.add(new FeatureOre(BlockRegistry.getFromIdName(gen.getString("Block"), Blocks.iron_ore.getState()),
|
||||
gen.getInteger("Count"), gen.getInteger("Add"), gen.getInteger("Size"),
|
||||
gen.getInteger("MinC"), gen.getInteger("MaxS"), gen.getBoolean("Distrib")));
|
||||
}
|
||||
|
@ -1231,7 +1127,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
NBTTagList list = tag.getTagList("Lakes", 10);
|
||||
for(int z = 0; z < list.tagCount(); z++) {
|
||||
NBTTagCompound gen = list.getCompoundTagAt(z);
|
||||
this.lakes.add(new FeatureLakes(
|
||||
this.lakes.add(new FeatureLake(
|
||||
BlockRegistry.getFromIdName(gen.getString("Block"), Blocks.iron_ore.getState()),
|
||||
gen.hasKey("Filler", 8) ? BlockRegistry.getFromIdName(gen.getString("Filler"), null) : null,
|
||||
gen.hasKey("Top", 8) ? BlockRegistry.getFromIdName(gen.getString("Top"), null) : null,
|
||||
|
@ -1243,7 +1139,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
NBTTagList list = tag.getTagList("Liquids", 10);
|
||||
for(int z = 0; z < list.tagCount(); z++) {
|
||||
NBTTagCompound gen = list.getCompoundTagAt(z);
|
||||
this.liquids.add(new FeatureLiquids(
|
||||
this.liquids.add(new FeatureLiquid(
|
||||
BlockRegistry.getFromIdName(gen.getString("Block"), Blocks.iron_ore.getState()),
|
||||
gen.getInteger("Chance"), gen.getInteger("Min"), gen.getInteger("Max"), gen.getBoolean("Lower")));
|
||||
}
|
||||
|
@ -1376,47 +1272,47 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
}
|
||||
if(this.addBiomes != null) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(Biome biome : this.addBiomes) {
|
||||
for(BaseBiome biome : this.addBiomes) {
|
||||
list.appendTag(new NBTTagString(biome.name.toLowerCase()));
|
||||
}
|
||||
tag.setTag("AddBiomes", list);
|
||||
}
|
||||
if(this.frostBiomes != null) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(Biome biome : this.frostBiomes) {
|
||||
for(BaseBiome biome : this.frostBiomes) {
|
||||
list.appendTag(new NBTTagString(biome.name.toLowerCase()));
|
||||
}
|
||||
tag.setTag("FrostBiomes", list);
|
||||
}
|
||||
if(this.coldBiomes != null) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(Biome biome : this.coldBiomes) {
|
||||
for(BaseBiome biome : this.coldBiomes) {
|
||||
list.appendTag(new NBTTagString(biome.name.toLowerCase()));
|
||||
}
|
||||
tag.setTag("ColdBiomes", list);
|
||||
}
|
||||
if(this.mediumBiomes != null) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(Biome biome : this.mediumBiomes) {
|
||||
for(BaseBiome biome : this.mediumBiomes) {
|
||||
list.appendTag(new NBTTagString(biome.name.toLowerCase()));
|
||||
}
|
||||
tag.setTag("MediumBiomes", list);
|
||||
}
|
||||
if(this.hotBiomes != null) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(Biome biome : this.hotBiomes) {
|
||||
for(BaseBiome biome : this.hotBiomes) {
|
||||
list.appendTag(new NBTTagString(biome.name.toLowerCase()));
|
||||
}
|
||||
tag.setTag("HotBiomes", list);
|
||||
}
|
||||
if(!this.ores.isEmpty()) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(FeatureOres gen : this.ores) {
|
||||
for(FeatureOre gen : this.ores) {
|
||||
NBTTagCompound ore = new NBTTagCompound();
|
||||
ore.setString("Block", BlockRegistry.toIdName(gen.oreBlock));
|
||||
ore.setBoolean("Distrib", gen.distributed);
|
||||
ore.setInteger("Size", gen.numberOfBlocks);
|
||||
ore.setInteger("Count", gen.spawns);
|
||||
ore.setString("Block", BlockRegistry.toIdName(gen.state));
|
||||
ore.setBoolean("Distrib", gen.dist);
|
||||
ore.setInteger("Size", gen.size);
|
||||
ore.setInteger("Count", gen.count);
|
||||
ore.setInteger("Add", gen.more);
|
||||
ore.setInteger("MinC", gen.min);
|
||||
ore.setInteger("MaxS", gen.max);
|
||||
|
@ -1426,7 +1322,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
}
|
||||
if(!this.lakes.isEmpty()) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(FeatureLakes gen : this.lakes) {
|
||||
for(FeatureLake gen : this.lakes) {
|
||||
NBTTagCompound lake = new NBTTagCompound();
|
||||
lake.setString("Block", BlockRegistry.toIdName(gen.state));
|
||||
if(gen.filler != null)
|
||||
|
@ -1443,7 +1339,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
}
|
||||
if(!this.liquids.isEmpty()) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(FeatureLiquids gen : this.liquids) {
|
||||
for(FeatureLiquid gen : this.liquids) {
|
||||
NBTTagCompound liquid = new NBTTagCompound();
|
||||
liquid.setString("Block", BlockRegistry.toIdName(gen.state));
|
||||
liquid.setBoolean("Lower", gen.lower);
|
||||
|
@ -1529,4 +1425,112 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
|
|||
protected String getIdentifier() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public int getBiomeSize() {
|
||||
return this.biomeSize;
|
||||
}
|
||||
|
||||
public BaseBiome getDefaultBiome() {
|
||||
return this.defaultBiome;
|
||||
}
|
||||
|
||||
public boolean isSemiFixed() {
|
||||
return this.semiFixed;
|
||||
}
|
||||
|
||||
public int getRiverSize() {
|
||||
return this.riverSize;
|
||||
}
|
||||
|
||||
public int getSnowRarity() {
|
||||
return this.snowRarity;
|
||||
}
|
||||
|
||||
public int getSeaRarity() {
|
||||
return this.seaRarity;
|
||||
}
|
||||
|
||||
public BaseBiome[] getAddBiomes() {
|
||||
return this.addBiomes;
|
||||
}
|
||||
|
||||
public int getAddRarity() {
|
||||
return this.addRarity;
|
||||
}
|
||||
|
||||
public BaseBiome[] getHotBiomes() {
|
||||
return this.hotBiomes;
|
||||
}
|
||||
|
||||
public BaseBiome[] getMediumBiomes() {
|
||||
return this.mediumBiomes;
|
||||
}
|
||||
|
||||
public BaseBiome[] getColdBiomes() {
|
||||
return this.coldBiomes;
|
||||
}
|
||||
|
||||
public BaseBiome[] getFrostBiomes() {
|
||||
return this.frostBiomes;
|
||||
}
|
||||
|
||||
public GeneratorType getGeneratorType() {
|
||||
return this.generatorType;
|
||||
}
|
||||
|
||||
public State[] getLayers() {
|
||||
return this.layers;
|
||||
}
|
||||
|
||||
public GeneratorSettings getNoiseGen() {
|
||||
return this.noiseGen;
|
||||
}
|
||||
|
||||
public ReplacerType getReplacerType() {
|
||||
return this.replacerType;
|
||||
}
|
||||
|
||||
public State getAlt1() {
|
||||
return this.alt1;
|
||||
}
|
||||
|
||||
public State getAlt2() {
|
||||
return this.alt2;
|
||||
}
|
||||
|
||||
public State getSurface() {
|
||||
return this.surface;
|
||||
}
|
||||
|
||||
public int getDungeons() {
|
||||
return this.dungeons;
|
||||
}
|
||||
|
||||
public boolean hasCaves() {
|
||||
return this.caves;
|
||||
}
|
||||
|
||||
public State getCaveFiller() {
|
||||
return this.caveFiller;
|
||||
}
|
||||
|
||||
public boolean hasRavines() {
|
||||
return this.ravines;
|
||||
}
|
||||
|
||||
public boolean hasStrideCaves() {
|
||||
return this.strideCaves;
|
||||
}
|
||||
|
||||
public List<FeatureOre> getOres() {
|
||||
return this.ores;
|
||||
}
|
||||
|
||||
public List<FeatureLake> getLakes() {
|
||||
return this.lakes;
|
||||
}
|
||||
|
||||
public List<FeatureLiquid> getLiquids() {
|
||||
return this.liquids;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package common.dimension;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.biome.BaseBiome;
|
||||
|
||||
public final class Space extends Dimension {
|
||||
public static final Space INSTANCE = new Space();
|
||||
|
@ -8,7 +8,7 @@ public final class Space extends Dimension {
|
|||
private Space() {
|
||||
super(0, "space");
|
||||
this.setPhysics(1L, 1L, 0.0f, 0.0f, 2.7f, 15).setTimeQualifier(8);
|
||||
this.setBiome(Biome.space).setStarBrightness(1.0f).setDeepStarBrightness(1.0f);
|
||||
this.setBiome(BaseBiome.SPACE).setStarBrightness(1.0f).setDeepStarBrightness(1.0f);
|
||||
this.setCustomName("Der Weltraum");
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import common.ai.EntityAITempt;
|
|||
import common.ai.EntityAIWander;
|
||||
import common.ai.EntityAIWatchClosest;
|
||||
import common.attributes.Attributes;
|
||||
import common.biome.Biome;
|
||||
import common.biome.BaseBiome;
|
||||
import common.collect.Maps;
|
||||
import common.color.DyeColor;
|
||||
import common.entity.item.EntityItem;
|
||||
|
@ -303,9 +303,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, BaseBiome biome)
|
||||
{
|
||||
if(biome == Biome.snowLand)
|
||||
if(biome == BaseBiome.SNOWLAND)
|
||||
return DyeColor.WHITE;
|
||||
int i = random.zrange(140);
|
||||
return i < 20 ? DyeColor.BLACK :
|
||||
|
|
|
@ -3,7 +3,7 @@ package common.entity.npc;
|
|||
import common.ai.EntityAIBase;
|
||||
import common.ai.EntityMoveHelper;
|
||||
import common.attributes.Attributes;
|
||||
import common.biome.Biome;
|
||||
import common.biome.BaseBiome;
|
||||
import common.entity.DamageSource;
|
||||
import common.entity.Entity;
|
||||
import common.entity.types.EntityLiving;
|
||||
|
@ -396,9 +396,9 @@ public class EntitySlime extends EntityNPC
|
|||
// {
|
||||
// if (this.worldObj.getDifficulty() != Difficulty.PEACEFUL)
|
||||
// {
|
||||
Biome biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos);
|
||||
BaseBiome biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos);
|
||||
|
||||
if (biomegenbase == Biome.swampland && this.posY > 50.0D && this.posY < 70.0D && this.rand.floatv() < 0.5F && this.rand.floatv() < this.worldObj.getCurrentMoonPhaseFactor() && this.worldObj.getLightFromNeighbors(new BlockPos(this)) <= this.rand.zrange(8))
|
||||
if (biomegenbase == BaseBiome.SWAMPLAND && this.posY > 50.0D && this.posY < 70.0D && this.rand.floatv() < 0.5F && this.rand.floatv() < this.worldObj.getCurrentMoonPhaseFactor() && this.worldObj.getLightFromNeighbors(new BlockPos(this)) <= this.rand.zrange(8))
|
||||
{
|
||||
return super.getCanSpawnHere();
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import common.util.HitPosition;
|
|||
import common.util.Vec3;
|
||||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.LootConstants;
|
||||
|
||||
public class EntityHook extends Entity implements IObjectData
|
||||
{
|
||||
|
@ -614,7 +613,7 @@ public class EntityHook extends Entity implements IObjectData
|
|||
if (f < f1)
|
||||
{
|
||||
// this.angler.triggerAchievement(StatRegistry.junkFishedStat);
|
||||
return ((RngFishable)LootConstants.FISHING_JUNK.pick(this.rand)).getItemStack(this.rand);
|
||||
return ((RngFishable)FishConstants.FISHING_JUNK.pick(this.rand)).getItemStack(this.rand);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -623,13 +622,13 @@ public class EntityHook extends Entity implements IObjectData
|
|||
if (f < f2)
|
||||
{
|
||||
// this.angler.triggerAchievement(StatRegistry.treasureFishedStat);
|
||||
return ((RngFishable)LootConstants.FISHING_TREASURE.pick(this.rand)).getItemStack(this.rand);
|
||||
return ((RngFishable)FishConstants.FISHING_TREASURE.pick(this.rand)).getItemStack(this.rand);
|
||||
}
|
||||
else
|
||||
{
|
||||
float f3 = f - f2;
|
||||
// this.angler.triggerAchievement(StatRegistry.fishCaughtStat);
|
||||
return ((RngFishable)LootConstants.FISH_TYPES.pick(this.rand)).getItemStack(this.rand);
|
||||
return ((RngFishable)FishConstants.FISH_TYPES.pick(this.rand)).getItemStack(this.rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
29
common/src/common/entity/projectile/FishConstants.java
Normal file
29
common/src/common/entity/projectile/FishConstants.java
Normal file
|
@ -0,0 +1,29 @@
|
|||
package common.entity.projectile;
|
||||
|
||||
import common.color.DyeColor;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.item.ItemFishFood;
|
||||
import common.item.ItemStack;
|
||||
import common.rng.WeightedList;
|
||||
|
||||
public abstract class FishConstants {
|
||||
public static final WeightedList<RngFishable> FISHING_JUNK = new WeightedList<RngFishable>(
|
||||
(new RngFishable(new ItemStack(Items.leather_boots), 10)).setMaxDamagePercent(0.9F), new RngFishable(new ItemStack(Items.leather), 10),
|
||||
new RngFishable(new ItemStack(Items.bone), 10), new RngFishable(new ItemStack(Items.potion), 10),
|
||||
new RngFishable(new ItemStack(Items.string), 5), (new RngFishable(new ItemStack(Items.fishing_rod), 2)).setMaxDamagePercent(0.9F),
|
||||
new RngFishable(new ItemStack(Items.bowl), 10), new RngFishable(new ItemStack(Items.stick), 5),
|
||||
new RngFishable(new ItemStack(Items.dye, 10, DyeColor.BLACK.getDyeDamage()), 1),
|
||||
new RngFishable(new ItemStack(Blocks.tripwire_hook), 10), new RngFishable(new ItemStack(Items.rotten_flesh), 10));
|
||||
public static final WeightedList<RngFishable> FISHING_TREASURE = new WeightedList<RngFishable>(
|
||||
new RngFishable(new ItemStack(Blocks.waterlily), 1), new RngFishable(new ItemStack(Items.name_tag), 1),
|
||||
new RngFishable(new ItemStack(Items.saddle), 1),
|
||||
(new RngFishable(new ItemStack(Items.bow), 1)).setMaxDamagePercent(0.25F).setEnchantable(),
|
||||
(new RngFishable(new ItemStack(Items.fishing_rod), 1)).setMaxDamagePercent(0.25F).setEnchantable(),
|
||||
(new RngFishable(new ItemStack(Items.book), 1)).setEnchantable());
|
||||
public static final WeightedList<RngFishable> FISH_TYPES = new WeightedList<RngFishable>(
|
||||
new RngFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.COD.getMetadata()), 60),
|
||||
new RngFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.SALMON.getMetadata()), 25),
|
||||
new RngFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.CLOWNFISH.getMetadata()), 2),
|
||||
new RngFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.PUFFERFISH.getMetadata()), 13));
|
||||
}
|
|
@ -31,7 +31,6 @@ public abstract class Registry {
|
|||
SmeltingRegistry.register();
|
||||
EntityRegistry.register();
|
||||
DispenserRegistry.register();
|
||||
UniverseRegistry.register();
|
||||
}
|
||||
|
||||
public static void setup(String thread) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.biome.BaseBiome;
|
||||
import common.block.BlockColored;
|
||||
import common.block.BlockSand;
|
||||
import common.block.LeavesType;
|
||||
|
@ -518,7 +518,7 @@ public abstract class UniverseRegistry {
|
|||
PORTALS.put(portal.ordinal() | 0x7ff00000, BASE_ALIASES.get(dest).getDimensionId());
|
||||
}
|
||||
|
||||
static void register() {
|
||||
public static void register() {
|
||||
registerGalaxy("Milchstraße", "milkyway");
|
||||
registerSector("Solar", "solar", "milkyway");
|
||||
registerDimension("Sol", new Star(2, "sol", 0xff7f00, 274.0f, 5778.0f, Blocks.lava.getState(), 128).setTimeQualifier(1), "solar");
|
||||
|
@ -526,12 +526,12 @@ public abstract class UniverseRegistry {
|
|||
259.15f).setTimeQualifier(0)
|
||||
.setPerlinGen(Blocks.stone.getState(), Blocks.water.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.gravel.getState())
|
||||
.setBiomeGen(Biome.forest, false, 4, 4, 6, 50, 50, Biome.mushroomPlains).enableMobs().enableSnow()
|
||||
.setFrostBiomes(Biome.icePlains, Biome.icePlains, Biome.icePlains, Biome.coldTaiga, Biome.megaTaiga)
|
||||
.setColdBiomes(Biome.forest, Biome.extremeHills, Biome.taiga, Biome.plains, Biome.blackened)
|
||||
.setMediumBiomes(Biome.forest, Biome.roofedForest, Biome.extremeHills, Biome.plains, Biome.birchForest,
|
||||
Biome.swampland, Biome.jungle, Biome.blackened)
|
||||
.setHotBiomes(Biome.desert, Biome.desert, Biome.desert, Biome.savanna, Biome.savanna, Biome.plains)
|
||||
.setBiomeGen(BaseBiome.FOREST, false, 4, 4, 6, 50, 50, BaseBiome.MUSHROOMPLAINS).enableMobs().enableSnow()
|
||||
.setFrostBiomes(BaseBiome.ICEPLAINS, BaseBiome.ICEPLAINS, BaseBiome.ICEPLAINS, BaseBiome.COLDTAIGA, BaseBiome.MEGATAIGA)
|
||||
.setColdBiomes(BaseBiome.FOREST, BaseBiome.EXTREMEHILLS, BaseBiome.TAIGA, BaseBiome.PLAINS, BaseBiome.BLACKENED)
|
||||
.setMediumBiomes(BaseBiome.FOREST, BaseBiome.ROOFEDFOREST, BaseBiome.EXTREMEHILLS, BaseBiome.PLAINS, BaseBiome.BIRCHFOREST,
|
||||
BaseBiome.SWAMPLAND, BaseBiome.JUNGLE, BaseBiome.BLACKENED)
|
||||
.setHotBiomes(BaseBiome.DESERT, BaseBiome.DESERT, BaseBiome.DESERT, BaseBiome.SAVANNA, BaseBiome.SAVANNA, BaseBiome.PLAINS)
|
||||
.enableCavesRavines(Blocks.lava.getState()).setDungeons(8).setWorldFloor(Blocks.bedrock.getState())
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
|
||||
.addLake(Blocks.lava.getState(), Blocks.stone.getState(), null, 8, 8, 255, true)
|
||||
|
@ -549,7 +549,7 @@ public abstract class UniverseRegistry {
|
|||
.addOre(Blocks.cinnabar_ore.getState(), 1, 0, 11, 0, 24, false)
|
||||
.enableVillages().enableMineshafts().enableScattered().enableStrongholds(), "sol");
|
||||
registerDimension("Luna", new Moon(3, "luna", 0x333333, 0x333333, 655728L, 655728L, 1.62f, 210.0f, 8)
|
||||
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63).setBiome(Biome.moon)
|
||||
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63).setBiome(BaseBiome.MOON)
|
||||
.setTimeQualifier(1), "terra");
|
||||
|
||||
registerDimension("Merkur", new Planet(4, "mercury", 0x666666, 0x535353, 0x858585, 2111297L, 1407509L, 3.7f, 440.0f)
|
||||
|
@ -592,7 +592,7 @@ public abstract class UniverseRegistry {
|
|||
registerDimension("Gi'rok", new Star(100, "girok", 0xff8f00, 232.0f, 5220.0f, Blocks.lava.getState(), 112).setTimeQualifier(2), "solar");
|
||||
registerDimension("'Elbenplanet Gharoth'", new Planet(101, "gharoth", 0xffffffff, 0xc0d8ff, 0xffffff, 4837386L, 52960L, 30.0f, 10.0f, 257.3f)
|
||||
.setTimeQualifier(2).setSimpleGen(Blocks.dirt.getState(), Blocks.water.getState(), 64)
|
||||
.setSimpleReplacer(Blocks.gravel.getState(), Blocks.sand.getState()).setBiome(Biome.elvenForest)
|
||||
.setSimpleReplacer(Blocks.gravel.getState(), Blocks.sand.getState()).setBiome(BaseBiome.ELVENFOREST)
|
||||
.enableCaves(Blocks.air.getState()).setDungeons(4).enableMobs().enableSnow()
|
||||
.setWorldFloor(Blocks.bedrock.getState())
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
|
||||
|
@ -603,7 +603,7 @@ public abstract class UniverseRegistry {
|
|||
.addOre(Blocks.gyriyn_ore.getState(), 0, 2, 3, 0, 12, false), "girok");
|
||||
registerDimension("'Vampirplanet Transsylvanien'", new Planet(102, "transylvania", 0xffffffff, 0xc0d8ff, 0xffffff, 33850466L, 49760L, 20.0f, 10.0f, 255.5f)
|
||||
.setTimeQualifier(5).setPerlinGen(Blocks.rock.getState(), Blocks.water.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.gravel.getState()).setBiomeGen(Biome.forest, true, 5, 3, 3, 30)
|
||||
.setBiomeReplacer(Blocks.gravel.getState()).setBiomeGen(BaseBiome.FOREST, true, 5, 3, 3, 30)
|
||||
.enableCavesRavines(Blocks.lava.getState()).setDungeons(10).enableMobs().enableSnow()
|
||||
.setWorldFloor(Blocks.bedrock.getState())
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
|
||||
|
@ -615,12 +615,12 @@ public abstract class UniverseRegistry {
|
|||
.addOre(Blocks.ardite_ore.getState(), 0, 2, 3, 0, 12, false)
|
||||
.addOre(Blocks.nichun_ore.getState(), 0, 10, 1, 0, 10, false), "girok");
|
||||
registerDimension("'Eismond Yrdinath'", new Moon(103, "yrdinath", 0xccccff, 0xccccff, 46743637L, 17460L, 2.5f, 239.15f, 8).setTimeQualifier(4)
|
||||
.setPerlinGen(Blocks.snow.getState(), Blocks.ice.getState(), 63).setBiome(Biome.snowLand)
|
||||
.setPerlinGen(Blocks.snow.getState(), Blocks.ice.getState(), 63).setBiome(BaseBiome.SNOWLAND)
|
||||
.setWorldFloor(Blocks.air.getState()).enableMobs().enableSnow().setWeather(Weather.SNOW), "transylvania");
|
||||
registerDimension("'Wüstenplanet Me'sar'", new Planet(104, "mesar", 0xff7f3f, 0xff6022, 0xff6f00, 56643366L, 87340L, 11.0f, 333.15f)
|
||||
.setTimeQualifier(5).setPerlinGen(Blocks.rock.getState(), Blocks.air.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.sand.getState().withProperty(BlockSand.VARIANT, BlockSand.EnumType.RED_SAND))
|
||||
.setBiomeGen(Biome.mesa, true, 3, 1000, 100000, 100000)
|
||||
.setBiomeGen(BaseBiome.MESA, true, 3, 1000, 100000, 100000)
|
||||
.enableCavesRavines(Blocks.lava.getState()).enableMobs()
|
||||
.setWorldFloor(Blocks.bedrock.getState())
|
||||
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
|
||||
|
@ -637,7 +637,7 @@ public abstract class UniverseRegistry {
|
|||
registerDimension("Ov'rol", new Star(120, "ovrol", 0x000000, 302.0f, 12666.0f, Blocks.goo.getState(), 192), "blvck");
|
||||
registerDimension("'Schwarzplanet'", new Planet(121, "blackplanet", 0x000000, 0x000000, 0x000000, 4632918508L, 204556L, 12.0f, 0.0f)
|
||||
.setPerlinGen(Blocks.blackened_stone.getState(), Blocks.goo.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.blackened_cobble.getState()).setBiome(Biome.blackened)
|
||||
.setBiomeReplacer(Blocks.blackened_cobble.getState()).setBiome(BaseBiome.BLACKENED)
|
||||
.enableCaves(Blocks.air.getState()).setDungeons(4).enableMobs()
|
||||
.setWorldFloor(Blocks.bedrock.getState())
|
||||
.addLake(Blocks.goo.getState(), null, null, 8, 8, 255, true)
|
||||
|
@ -646,7 +646,7 @@ public abstract class UniverseRegistry {
|
|||
|
||||
registerDimension("Der Warp", new Semi(-1, "warp", 0x0c001f, 0x0c001f, 0x190033, 285.0f, 3).setCloudTexture("clouds_dense").setCloudHeight(238.0f)
|
||||
.setPerlinGen(Blocks.obsidian.getState(), Blocks.lava.getState(), 63)
|
||||
.setBiome(Biome.chaos).enableCavesRavines(Blocks.air.getState()).enableLongCaves().enableMobs().enableSnow()
|
||||
.setBiome(BaseBiome.CHAOS).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)
|
||||
|
@ -656,7 +656,7 @@ public abstract class UniverseRegistry {
|
|||
|
||||
registerDomain("Tian'Xin", "tianxin");
|
||||
registerDimension("Ni'enrath", new Area(-2, "nienrath", 0x7f00ff, 0x7f00ff, 276.15f, 1)
|
||||
.setPerlinGen(Blocks.tian.getState(), Blocks.water.getState(), 63).setBiome(Biome.tian)
|
||||
.setPerlinGen(Blocks.tian.getState(), Blocks.water.getState(), 63).setBiome(BaseBiome.TIAN)
|
||||
.setBiomeReplacer(Blocks.tian.getState()).enableLongCaves().enableMobs().enableSnow()
|
||||
.addLake(Blocks.water.getState(), Blocks.tian.getState(), Blocks.tian.getState(), 4, 0, 255, false)
|
||||
.addLiquid(Blocks.flowing_water.getState(), 50, 8, 255, false), "tianxin");
|
||||
|
@ -670,32 +670,32 @@ public abstract class UniverseRegistry {
|
|||
.setWorldFloor(Blocks.air.getState()).setWorldCeiling(Blocks.bedrock.getState()).enableDenseFog()
|
||||
.setCavernGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63)
|
||||
.setSurfaceReplacer(Blocks.gravel.getState(), Blocks.soul_sand.getState())
|
||||
.setBiome(Biome.upperHell), "hell");
|
||||
.setBiome(BaseBiome.UPPERHELL), "hell");
|
||||
registerDimension("Kreis Kyroth", new Area(-1002, "kyroth", 0x990000, 0x990000, 387.15f, 3).enableLongCaves().enableMobs()
|
||||
.setWorldFloor(Blocks.air.getState())
|
||||
.setSimpleGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 64)
|
||||
.setSimpleReplacer(Blocks.obsidian.getState(), Blocks.soul_sand.getState())
|
||||
.setBiome(Biome.lowerHell)
|
||||
.setBiome(BaseBiome.LOWERHELL)
|
||||
.addLake(Blocks.lava.getState(), null, null, 4, 8, 255, false)
|
||||
.addLiquid(Blocks.flowing_lava.getState(), 40, 8, 255, true), "hell");
|
||||
registerDimension("Kreis Ahrd", new Area(-1003, "ahrd", 0xcc0000, 0xcc0000, 467.15f, 15).enableLongCaves().enableMobs()
|
||||
.setWorldFloor(Blocks.air.getState())
|
||||
.setPerlinGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.hellHills)
|
||||
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(BaseBiome.HELLHILLS)
|
||||
.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), "hell");
|
||||
registerDimension("Kreis Mizorath", new Area(-1004, "mizorath", 0xff0000, 0xff0000, 1067.15f, 15).enableMobs()
|
||||
.setWorldFloor(Blocks.air.getState())
|
||||
.setPerlinGen(Blocks.hellrock.getState(), Blocks.blood.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.soulPlains), "hell");
|
||||
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(BaseBiome.SOULPLAINS), "hell");
|
||||
registerDimension("Kreis Dargoth", new Area(-1005, "dargoth", 0xff3f0c, 0xff3f0c, 1707.15f, 15).enableMobs()
|
||||
.setWorldFloor(Blocks.air.getState())
|
||||
.setPerlinGen(Blocks.hellrock.getState(), Blocks.magma.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.soulPlains), "hell");
|
||||
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(BaseBiome.SOULPLAINS), "hell");
|
||||
registerDimension("Kreis Aasirith", new Area(-1006, "aasirith", 0x191919, 0x191919, 2482.0f, 1).enableLongCaves().enableMobs()
|
||||
.setWorldFloor(Blocks.air.getState())
|
||||
.setPerlinGen(Blocks.rock.getState(), Blocks.magma.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.ash.getState()).setBiome(Biome.ashLand)
|
||||
.setBiomeReplacer(Blocks.ash.getState()).setBiome(BaseBiome.ASHLAND)
|
||||
.addLake(Blocks.lava.getState(), Blocks.rock.getState(), Blocks.rock.getState(),
|
||||
2, 8, 255, false).addLiquid(Blocks.flowing_lava.getState(), 80, 8, 255, true), "hell");
|
||||
|
||||
|
@ -749,7 +749,7 @@ public abstract class UniverseRegistry {
|
|||
dtag.setInteger("SeaRarity", 50);
|
||||
dtag.setInteger("AddRarity", 50);
|
||||
dtag.setInteger("SeaLevel", 0);
|
||||
dtag.setString("DefaultBiome", Biome.none.name.toLowerCase());
|
||||
dtag.setString("DefaultBiome", BaseBiome.NONE.name.toLowerCase());
|
||||
dtag.setBoolean("SemiFixed", false);
|
||||
// dtag.setString("DefaultWeather", Weather.CLEAR.getName());
|
||||
dtag.setString("DefaultLeaves", LeavesType.SPRING.getName());
|
||||
|
@ -768,11 +768,11 @@ public abstract class UniverseRegistry {
|
|||
return dim;
|
||||
}
|
||||
|
||||
private static Dimension addFlatPreset(String name, Biome biome, boolean populate, State main, Object ... layers) {
|
||||
private static Dimension addFlatPreset(String name, BaseBiome biome, boolean populate, State main, Object ... layers) {
|
||||
return addFlatPreset(name, "terra", biome, populate, main, layers);
|
||||
}
|
||||
|
||||
private static Dimension addFlatPreset(String name, String base, Biome biome, boolean populate, State main, Object ... layers) {
|
||||
private static Dimension addFlatPreset(String name, String base, BaseBiome biome, boolean populate, State main, Object ... layers) {
|
||||
Dimension dim = addPreset("Flach - " + name, base, "ClearGenerator:1b" + (populate ? "" : ",NoPopulation:1b"));
|
||||
dim.setBiome(biome);
|
||||
if(main != null)
|
||||
|
@ -795,33 +795,33 @@ public abstract class UniverseRegistry {
|
|||
addPreset("Chaotische Höhlen", "UpperLmtScale:2.0,LowerLmtScale:64.0,SeaLevel:6");
|
||||
addPreset("Viel Glück", "LiquidBlock:lava,SeaLevel:40");
|
||||
|
||||
addFlatPreset("Klassisch", Biome.plains, false, Blocks.dirt.getState(), Blocks.bedrock.getState(), 2, Blocks.dirt.getState(),
|
||||
addFlatPreset("Klassisch", BaseBiome.PLAINS, false, Blocks.dirt.getState(), Blocks.bedrock.getState(), 2, Blocks.dirt.getState(),
|
||||
Blocks.grass.getState()).enableVillages();
|
||||
|
||||
addFlatPreset("Abbauwelt", Biome.extremeHills, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 230, Blocks.stone.getState(),
|
||||
addFlatPreset("Abbauwelt", BaseBiome.EXTREMEHILLS, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 230, Blocks.stone.getState(),
|
||||
5, Blocks.dirt.getState(), Blocks.grass.getState()).enableStrongholds().enableMineshafts().setDungeons(8);
|
||||
|
||||
addFlatPreset("Wasserwelt", Biome.sea, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 5, Blocks.stone.getState(),
|
||||
addFlatPreset("Wasserwelt", BaseBiome.SEA, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 5, Blocks.stone.getState(),
|
||||
52, Blocks.dirt.getState(), 5, Blocks.sand.getState(), 90, Blocks.water.getState());
|
||||
|
||||
addFlatPreset("Oberfläche", Biome.plains, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(),
|
||||
addFlatPreset("Oberfläche", BaseBiome.PLAINS, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(),
|
||||
3, Blocks.dirt.getState(), Blocks.grass.getState()).setBiomeReplacer(Blocks.gravel.getState()).enableVillages().enableStrongholds().enableMineshafts().setDungeons(8)
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false).addLake(Blocks.lava.getState(), Blocks.stone.getState(), null, 8, 8, 255, true);
|
||||
|
||||
addFlatPreset("Verschneites Königreich", Biome.icePlains, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(),
|
||||
addFlatPreset("Verschneites Königreich", BaseBiome.ICEPLAINS, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(),
|
||||
3, Blocks.dirt.getState(), Blocks.grass.getState(), Blocks.snow_layer.getState()).enableVillages();
|
||||
|
||||
addFlatPreset("Verschneites Königreich +", Biome.icePlains, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(),
|
||||
addFlatPreset("Verschneites Königreich +", BaseBiome.ICEPLAINS, true, Blocks.stone.getState(), Blocks.bedrock.getState(), 59, Blocks.stone.getState(),
|
||||
3, Blocks.dirt.getState(), Blocks.grass.getState(), Blocks.snow_layer.getState()).setBiomeReplacer(Blocks.gravel.getState()).enableVillages()
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false);
|
||||
|
||||
addFlatPreset("Unendliche Grube", Biome.plains, false, Blocks.dirt.getState(), 2, Blocks.cobblestone.getState(), 3, Blocks.dirt.getState(), Blocks.grass.getState())
|
||||
addFlatPreset("Unendliche Grube", BaseBiome.PLAINS, false, Blocks.dirt.getState(), 2, Blocks.cobblestone.getState(), 3, Blocks.dirt.getState(), Blocks.grass.getState())
|
||||
.setBiomeReplacer(Blocks.gravel.getState()).enableVillages();
|
||||
|
||||
addFlatPreset("Wüste", Biome.desert, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 3, Blocks.stone.getState(), 52, Blocks.sandstone.getState())
|
||||
addFlatPreset("Wüste", BaseBiome.DESERT, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 3, Blocks.stone.getState(), 52, Blocks.sandstone.getState())
|
||||
.enableVillages().enableScattered();
|
||||
|
||||
addFlatPreset("Redstonewelt", Biome.desert, false, Blocks.sandstone.getState(), Blocks.bedrock.getState(), 3, Blocks.stone.getState(),
|
||||
addFlatPreset("Redstonewelt", BaseBiome.DESERT, false, Blocks.sandstone.getState(), Blocks.bedrock.getState(), 3, Blocks.stone.getState(),
|
||||
52, Blocks.sandstone.getState());
|
||||
|
||||
addPreset("Leer", "ClearGenerator:1b");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package common.item;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.biome.BaseBiome;
|
||||
import common.color.TextColor;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.util.BlockPos;
|
||||
|
@ -14,7 +14,7 @@ public class ItemInfoWand extends ItemWand {
|
|||
|
||||
public void onUse(ItemStack stack, EntityNPC player, AWorldServer world, Vec3 vec)
|
||||
{
|
||||
Biome biome = world.getBiomeGenForCoords(new BlockPos(vec.xCoord, 0, vec.zCoord));
|
||||
BaseBiome biome = world.getBiomeGenForCoords(new BlockPos(vec.xCoord, 0, vec.zCoord));
|
||||
player.connection.addHotbar(TextColor.NEON + "* Position bei Level %d: %.3f %.3f %.3f, %s [%d], %.2f °C", world.dimension.getDimensionId(),
|
||||
vec.xCoord, vec.yCoord, vec.zCoord,
|
||||
biome.display, biome.id, world.getTemperatureC(new BlockPos(vec)));
|
||||
|
|
|
@ -10,12 +10,10 @@ import common.entity.types.EntityLiving;
|
|||
import common.model.ParticleType;
|
||||
import common.network.IPlayer;
|
||||
import common.network.Packet;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.PortalType;
|
||||
import common.village.Village;
|
||||
import common.worldgen.BiomeGenerator;
|
||||
|
||||
public abstract class AWorldServer extends World {
|
||||
protected AWorldServer(Dimension dim, boolean debug) {
|
||||
|
@ -25,10 +23,8 @@ public abstract class AWorldServer extends World {
|
|||
public abstract List<IPlayer> getAllPlayers();
|
||||
public abstract AWorldServer getOtherWorld(int dimension);
|
||||
public abstract void placeInDimension(Entity entity, AWorldServer oldWorld, AWorldServer world, BlockPos pos, PortalType portal);
|
||||
public abstract State getSurfaceLiquid();
|
||||
public abstract boolean addLoader(BlockPos pos);
|
||||
public abstract boolean removeLoader(BlockPos pos);
|
||||
public abstract BiomeGenerator getBiomeGenerator();
|
||||
public abstract boolean isBlockTickPending(BlockPos pos, Block blockType);
|
||||
public abstract void updateBlockTick(BlockPos pos, Block blockIn, int delay, int priority);
|
||||
public abstract void resetUpdateEntityTick();
|
||||
|
@ -39,24 +35,13 @@ public abstract class AWorldServer extends World {
|
|||
public abstract long getSeed();
|
||||
public abstract boolean isExterminated();
|
||||
public abstract boolean exterminate();
|
||||
public abstract void forceBlockUpdateTick(Block blockType, BlockPos pos, Random random);
|
||||
public abstract Village getNearestVillage(BlockPos doorBlock, int radius);
|
||||
public abstract void addToVillagerPositionList(BlockPos blockpos);
|
||||
public abstract void removePlayer(EntityNPC player);
|
||||
public abstract void updateMountedMovingPlayer(EntityNPC player);
|
||||
public abstract boolean isPlayerWatchingChunk(EntityNPC player, int chunkX, int chunkZ);
|
||||
public abstract void untrackEntity(Entity entityIn);
|
||||
public abstract void updateTrackedPlayer(EntityNPC player);
|
||||
public abstract void sendToAllTrackingEntity(Entity entityIn, Packet packet);
|
||||
public abstract void sendToAllTrackingAndSelf(Entity entityIn, Packet packet);
|
||||
public abstract void removePlayerFromTrackers(EntityNPC player);
|
||||
public abstract void updateChunksForPlayer(EntityNPC player, Chunk chunk);
|
||||
public abstract boolean isDaytime();
|
||||
public abstract int getSkylightSubtracted();
|
||||
public abstract boolean isBlockinHighHumidity(BlockPos pos);
|
||||
public abstract <T extends Entity> T findNearestEntityWithinAABB(Class<? extends T> entityType, BoundingBox aabb, T closestTo);
|
||||
public abstract boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj);
|
||||
public abstract BlockPos getTopSolidOrLiquidBlock(BlockPos pos);
|
||||
public abstract void removePlayerEntityDangerously(Entity entityIn);
|
||||
public abstract long getTime();
|
||||
}
|
||||
|
|
|
@ -6,11 +6,12 @@ import java.util.Map;
|
|||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.biome.BaseBiome;
|
||||
import common.block.Block;
|
||||
import common.block.ITileEntityProvider;
|
||||
import common.collect.Maps;
|
||||
import common.entity.Entity;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.log.Log;
|
||||
import common.material.Material;
|
||||
|
@ -24,8 +25,7 @@ import common.util.ExtMath;
|
|||
import common.util.Facing;
|
||||
import common.util.NibbleArray;
|
||||
import common.worldgen.BiomeGenerator;
|
||||
import common.worldgen.ChunkPrimer;
|
||||
import common.worldgen.GeneratorDebug;
|
||||
import common.worldgen.DebugStates;
|
||||
|
||||
public class Chunk {
|
||||
public final int xPos;
|
||||
|
@ -63,14 +63,14 @@ public class Chunk {
|
|||
Arrays.fill(this.biomes, (byte)-1);
|
||||
}
|
||||
|
||||
public Chunk(World world, ChunkPrimer primer, State base, State ceil, Random rand, Biome[] biomes, int x, int z) {
|
||||
public Chunk(World world, short[] data, int height, State base, State ceil, Random rand, BaseBiome[] biomes, int x, int z) {
|
||||
this(world, x, z);
|
||||
boolean sky = !world.dimension.hasNoLight();
|
||||
for(int bx = 0; bx < 16; ++bx) {
|
||||
for(int bz = 0; bz < 16; ++bz) {
|
||||
for(int by = 0; by < primer.height; ++by) {
|
||||
State state = primer.get(bx, by, bz);
|
||||
if(state.getBlock().getMaterial() != Material.air) {
|
||||
for(int by = 0; by < height; ++by) {
|
||||
State state = BlockRegistry.STATEMAP.getByValue(data[bx << 4 | bz | by << 8]);
|
||||
if(state != null && state.getBlock().getMaterial() != Material.air) {
|
||||
int y = by >> 4;
|
||||
if(this.blocks[y] == null)
|
||||
this.blocks[y] = new BlockArray(y << 4, sky);
|
||||
|
@ -92,16 +92,16 @@ public class Chunk {
|
|||
}
|
||||
}
|
||||
if(ceil != null) {
|
||||
int y = (primer.height - 1) >> 4;
|
||||
int y = (height - 1) >> 4;
|
||||
if(this.blocks[y] == null)
|
||||
this.blocks[y] = new BlockArray(y << 4, sky);
|
||||
y = (primer.height - 5) >> 4;
|
||||
y = (height - 5) >> 4;
|
||||
if(this.blocks[y] == null)
|
||||
this.blocks[y] = new BlockArray(y << 4, sky);
|
||||
for(int bx = 0; bx < 16; ++bx) {
|
||||
for(int bz = 0; bz < 16; ++bz) {
|
||||
for(int by = primer.height - 1; by >= primer.height - 5; --by) {
|
||||
if(by >= (primer.height - 1) - rand.zrange(5))
|
||||
for(int by = height - 1; by >= height - 5; --by) {
|
||||
if(by >= (height - 1) - rand.zrange(5))
|
||||
this.blocks[by >> 4].set(bx, by & 15, bz, ceil);
|
||||
}
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ public class Chunk {
|
|||
// }
|
||||
|
||||
if(pos.getY() == 1) {
|
||||
state = GeneratorDebug.getState(pos.getX(), pos.getZ());
|
||||
state = DebugStates.getState(pos.getX(), pos.getZ());
|
||||
}
|
||||
|
||||
return state == null ? Blocks.air.getState() : state;
|
||||
|
@ -956,19 +956,18 @@ public class Chunk {
|
|||
}
|
||||
}
|
||||
|
||||
public Biome getBiome(BlockPos pos, BiomeGenerator gen) {
|
||||
public BaseBiome getBiome(BlockPos pos, BiomeGenerator gen) {
|
||||
int x = pos.getX() & 15;
|
||||
int z = pos.getZ() & 15;
|
||||
int o = this.biomes[z << 4 | x] & 255;
|
||||
|
||||
if(o == 255) {
|
||||
Biome biome = gen == null ? Biome.DEF_BIOME : gen.getBiomeGenerator(pos, Biome.DEF_BIOME);
|
||||
BaseBiome biome = gen == null ? BaseBiome.DEF_BIOME : gen.getBiomeGenerator(pos, BaseBiome.DEF_BIOME);
|
||||
o = biome.id;
|
||||
this.biomes[z << 4 | x] = (byte)(o & 255);
|
||||
}
|
||||
|
||||
Biome biome = Biome.getBiome(o);
|
||||
return biome == null ? Biome.DEF_BIOME : biome;
|
||||
return BaseBiome.getBiomeDef(o);
|
||||
}
|
||||
|
||||
public byte[] getBiomes() {
|
||||
|
|
|
@ -1,279 +0,0 @@
|
|||
package common.world;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.block.LeavesType;
|
||||
import common.entity.Entity;
|
||||
import common.entity.item.EntityExplosion;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.ItemStack;
|
||||
import common.model.ParticleType;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Facing;
|
||||
import common.util.HitPosition;
|
||||
import common.util.Vec3;
|
||||
|
||||
public interface IWorld {
|
||||
|
||||
boolean isBlockSolid(BlockPos pos);
|
||||
|
||||
void setGravity(float gravity);
|
||||
|
||||
Biome getBiomeGenForCoords(BlockPos pos);
|
||||
|
||||
boolean isAirBlock(BlockPos pos);
|
||||
|
||||
boolean isBlockLoaded(BlockPos pos);
|
||||
|
||||
boolean isBlockLoaded(BlockPos pos, boolean allowEmpty);
|
||||
|
||||
boolean isAreaLoaded(BlockPos center, int radius);
|
||||
|
||||
boolean isAreaLoaded(BlockPos center, int radius, boolean allowEmpty);
|
||||
|
||||
boolean isAreaLoaded(BlockPos from, BlockPos to);
|
||||
|
||||
boolean isAreaLoaded(BlockPos from, BlockPos to, boolean allowEmpty);
|
||||
|
||||
Chunk getChunk(BlockPos pos);
|
||||
|
||||
boolean setState(BlockPos pos, State newState, int flags);
|
||||
|
||||
boolean setState(BlockPos pos, State state);
|
||||
|
||||
boolean setBlockToAir(BlockPos pos);
|
||||
|
||||
boolean destroyBlock(BlockPos pos, boolean dropBlock);
|
||||
|
||||
void notifyNeighborsRespectDebug(BlockPos pos, Block blockType);
|
||||
|
||||
void markBlocksDirtyVertical(int x1, int z1, int x2, int z2);
|
||||
|
||||
void markBlockRangeForRenderUpdate(BlockPos rangeMin, BlockPos rangeMax);
|
||||
|
||||
void notifyNeighborsOfStateChange(BlockPos pos, Block blockType);
|
||||
|
||||
void notifyNeighborsOfStateExcept(BlockPos pos, Block blockType, Facing skipSide);
|
||||
|
||||
void notifyBlockOfStateChange(BlockPos pos, Block blockIn);
|
||||
|
||||
boolean canSeeSky(BlockPos pos);
|
||||
|
||||
int getLight(BlockPos pos);
|
||||
|
||||
int getLightFromNeighbors(BlockPos pos);
|
||||
|
||||
BlockPos getHeight(BlockPos pos);
|
||||
|
||||
int getChunksLowestHorizon(int x, int z);
|
||||
|
||||
int getLightFromNeighborsFor(LightType type, BlockPos pos);
|
||||
|
||||
int getLightFor(LightType type, BlockPos pos);
|
||||
|
||||
void setLightFor(LightType type, BlockPos pos, int lightValue);
|
||||
|
||||
int getCombinedLight(BlockPos pos, int lightValue);
|
||||
|
||||
float getLightBrightness(BlockPos pos);
|
||||
|
||||
State getState(BlockPos pos);
|
||||
|
||||
BlockPos getBlockTrace(Entity entity, int distance);
|
||||
|
||||
HitPosition rayTraceBlocks(Vec3 p_72933_1_, Vec3 p_72933_2_);
|
||||
|
||||
HitPosition rayTraceBlocks(Vec3 start, Vec3 end, boolean stopOnLiquid);
|
||||
|
||||
HitPosition rayTraceBlocks(Vec3 vec31, Vec3 vec32, boolean stopOnLiquid, boolean ignoreBlockWithoutBoundingBox,
|
||||
boolean returnLastUncollidableBlock);
|
||||
|
||||
void playSoundAtEntity(Entity entityIn, SoundEvent name, float volume);
|
||||
|
||||
boolean spawnEntityInWorld(Entity entityIn);
|
||||
|
||||
void removeEntity(Entity entityIn);
|
||||
|
||||
List<BoundingBox> getCollidingBoundingBoxes(Entity entityIn, BoundingBox bb);
|
||||
|
||||
List<BoundingBox> getCollisionBoxes(BoundingBox bb);
|
||||
|
||||
int calculateSkylightSubtracted(boolean current);
|
||||
|
||||
float getCelestialAngle(float partialTicks);
|
||||
|
||||
int getMoonPhase();
|
||||
|
||||
float getCurrentMoonPhaseFactor();
|
||||
|
||||
float getCelestialAngleRadians(float partialTicks);
|
||||
|
||||
BlockPos getPrecipitationHeight(BlockPos pos);
|
||||
|
||||
void updateEntities();
|
||||
|
||||
boolean addTileEntity(TileEntity tile);
|
||||
|
||||
void addTileEntities(Collection<TileEntity> tileEntityCollection);
|
||||
|
||||
void updateEntity(Entity entityIn, boolean forceUpdate);
|
||||
|
||||
boolean checkNoEntityCollision(BoundingBox bb);
|
||||
|
||||
boolean checkNoEntityCollision(BoundingBox bb, Entity entityIn);
|
||||
|
||||
boolean isAnyLiquid(BoundingBox bb);
|
||||
|
||||
boolean isFlammableWithin(BoundingBox bb);
|
||||
|
||||
boolean handleLiquidAcceleration(BoundingBox bb, Entity entityIn);
|
||||
|
||||
boolean isMaterialInMolten(BoundingBox bb);
|
||||
|
||||
boolean isAABBInLiquid(BoundingBox bb);
|
||||
|
||||
Explosion createExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isSmoking);
|
||||
|
||||
Explosion createAltExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isSmoking);
|
||||
|
||||
Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking, boolean altSound);
|
||||
|
||||
EntityExplosion newExplosion(double x, double y, double z, int strength);
|
||||
|
||||
float getBlockDensity(Vec3 vec, BoundingBox bb);
|
||||
|
||||
boolean extinguishFire(EntityNPC player, BlockPos pos, Facing side);
|
||||
|
||||
TileEntity getTileEntity(BlockPos pos);
|
||||
|
||||
void setTileEntity(BlockPos pos, TileEntity tileEntityIn);
|
||||
|
||||
void removeTileEntity(BlockPos pos);
|
||||
|
||||
void markTileEntityForRemoval(TileEntity tileEntityIn);
|
||||
|
||||
float getTempOffset();
|
||||
|
||||
LeavesType getLeavesGen(BlockPos pos);
|
||||
|
||||
float getTemperatureK(BlockPos pos);
|
||||
|
||||
float getTemperatureC(BlockPos pos);
|
||||
|
||||
boolean canFreezeAt(BlockPos pos);
|
||||
|
||||
boolean canBurnAt(BlockPos pos);
|
||||
|
||||
boolean doesWaterVaporize(BlockPos pos);
|
||||
|
||||
boolean isLavaFaster(BlockPos pos);
|
||||
|
||||
boolean canSnowAt(BlockPos pos, boolean checkLight, boolean allowLayers);
|
||||
|
||||
boolean checkLight(BlockPos pos);
|
||||
|
||||
boolean checkLightFor(LightType lightType, BlockPos pos);
|
||||
|
||||
List<Entity> getEntitiesWithinAABBExcludingEntity(Entity entityIn, BoundingBox bb);
|
||||
|
||||
List<Entity> getEntitiesInAABBexcluding(Entity entityIn, BoundingBox boundingBox, Predicate<? super Entity> predicate);
|
||||
|
||||
<T extends Entity> List<T> getEntitiesWithinAABB(Class<? extends T> classEntity, BoundingBox bb);
|
||||
|
||||
<T extends Entity> List<T> getEntitiesWithinAABB(Class<? extends T> clazz, BoundingBox aabb, Predicate<? super T> filter);
|
||||
|
||||
Entity getEntityByID(int id);
|
||||
|
||||
void markChunkDirty(BlockPos pos, TileEntity unusedTileEntity);
|
||||
|
||||
void loadEntities(Collection<Entity> entityCollection);
|
||||
|
||||
void unloadEntities(Collection<Entity> entityCollection);
|
||||
|
||||
boolean canBlockBePlaced(Block blockIn, BlockPos pos, boolean p_175716_3_, Facing side, Entity entityIn, ItemStack itemStackIn);
|
||||
|
||||
int getSeaLevel();
|
||||
|
||||
int getStrongPower(BlockPos pos);
|
||||
|
||||
boolean isSidePowered(BlockPos pos, Facing side);
|
||||
|
||||
int getRedstonePower(BlockPos pos, Facing facing);
|
||||
|
||||
boolean isBlockPowered(BlockPos pos);
|
||||
|
||||
int isBlockIndirectlyGettingPowered(BlockPos pos);
|
||||
|
||||
EntityNPC getClosestPlayerToEntity(Entity entityIn, double distance);
|
||||
|
||||
EntityNPC getClosestPlayer(double x, double y, double z, double distance);
|
||||
|
||||
boolean isAnyPlayerWithinRangeAt(double x, double y, double z, double range);
|
||||
|
||||
void setTimeFactor(int factor);
|
||||
|
||||
void setEntityState(Entity entityIn, byte state);
|
||||
|
||||
void addBlockEvent(BlockPos pos, Block blockIn, int eventID, int eventParam);
|
||||
|
||||
Weather getWeather();
|
||||
|
||||
long getDayTime();
|
||||
|
||||
void setWeather(Weather weather);
|
||||
|
||||
void setDayTime(long time);
|
||||
|
||||
float getDarkness();
|
||||
|
||||
void setDarkness(float dark);
|
||||
|
||||
float getRainStrength();
|
||||
|
||||
void setRainStrength(float strength);
|
||||
|
||||
float getFogStrength();
|
||||
|
||||
void setFogStrength(float strength);
|
||||
|
||||
void setTemperature(float temp);
|
||||
|
||||
boolean isDark();
|
||||
|
||||
boolean isThundering();
|
||||
|
||||
boolean hasDownfall();
|
||||
|
||||
boolean isRaining();
|
||||
|
||||
boolean isRainingAt(BlockPos strikePosition, boolean wet);
|
||||
|
||||
void playAuxSFX(int type, BlockPos pos, int data);
|
||||
|
||||
void updateComparatorOutputLevel(BlockPos pos, Block blockIn);
|
||||
|
||||
void scheduleUpdate(BlockPos pos, Block blockIn, int delay);
|
||||
|
||||
void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset,
|
||||
int... data);
|
||||
|
||||
Chunk getChunk(int x, int z);
|
||||
|
||||
void markBlockForUpdate(BlockPos pos);
|
||||
|
||||
void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2);
|
||||
|
||||
void playSound(SoundEvent sound, double x, double y, double z, float volume);
|
||||
|
||||
void playAuxSFX(EntityNPC player, int sfxType, BlockPos blockPosIn, int data);
|
||||
|
||||
void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress);
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package common.world;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.biome.BaseBiome;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
|
||||
|
@ -8,5 +8,5 @@ public interface IWorldAccess extends IBlockAccess
|
|||
{
|
||||
TileEntity getTileEntity(BlockPos pos);
|
||||
int getCombinedLight(BlockPos pos, int lightValue);
|
||||
Biome getBiomeGenForCoords(BlockPos pos);
|
||||
BaseBiome getBiomeGenForCoords(BlockPos pos);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.biome.BaseBiome;
|
||||
import common.block.Block;
|
||||
import common.block.BlockHopper;
|
||||
import common.block.BlockLiquid;
|
||||
|
@ -38,7 +38,7 @@ import common.util.HitPosition;
|
|||
import common.util.IntHashMap;
|
||||
import common.util.Vec3;
|
||||
|
||||
public abstract class World implements IWorldAccess, IWorld {
|
||||
public abstract class World implements IWorldAccess {
|
||||
public static final float[][] BRIGHTNESS = new float[16][16];
|
||||
static {
|
||||
for(int l = 0; l < 16; l++) {
|
||||
|
@ -133,11 +133,11 @@ public abstract class World implements IWorldAccess, IWorld {
|
|||
this.gravity = Math.signum(this.gravity) * 0.075;
|
||||
}
|
||||
|
||||
public Biome getBiomeGenForCoords(final BlockPos pos) {
|
||||
public BaseBiome getBiomeGenForCoords(final BlockPos pos) {
|
||||
if(this.isBlockLoaded(pos))
|
||||
return this.getChunk(pos).getBiome(pos, null);
|
||||
else
|
||||
return Biome.DEF_BIOME;
|
||||
return BaseBiome.DEF_BIOME;
|
||||
}
|
||||
|
||||
public boolean isAirBlock(BlockPos pos) {
|
||||
|
|
|
@ -1,276 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.collect.Lists;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LongHashMap;
|
||||
import common.worldgen.layer.GenLayer;
|
||||
import common.worldgen.layer.GenLayerAddAreas;
|
||||
import common.worldgen.layer.GenLayerAddExtra;
|
||||
import common.worldgen.layer.GenLayerAddSea;
|
||||
import common.worldgen.layer.GenLayerAddSnow;
|
||||
import common.worldgen.layer.GenLayerBase;
|
||||
import common.worldgen.layer.GenLayerBiome;
|
||||
import common.worldgen.layer.GenLayerBiomeEdge;
|
||||
import common.worldgen.layer.GenLayerEdge;
|
||||
import common.worldgen.layer.GenLayerFuzzyZoom;
|
||||
import common.worldgen.layer.GenLayerHills;
|
||||
import common.worldgen.layer.GenLayerRemoveEmpty;
|
||||
import common.worldgen.layer.GenLayerRiver;
|
||||
import common.worldgen.layer.GenLayerRiverInit;
|
||||
import common.worldgen.layer.GenLayerRiverMix;
|
||||
import common.worldgen.layer.GenLayerShore;
|
||||
import common.worldgen.layer.GenLayerSmooth;
|
||||
import common.worldgen.layer.GenLayerVoronoiZoom;
|
||||
import common.worldgen.layer.GenLayerZoom;
|
||||
import common.worldgen.layer.IntCache;
|
||||
|
||||
public class BiomeGenLayered implements BiomeGenerator {
|
||||
private class CacheBlock
|
||||
{
|
||||
public final double[] factors = new double[256];
|
||||
public final Biome[] biomes = new Biome[256];
|
||||
public int xPosition;
|
||||
public int zPosition;
|
||||
public long lastAccessTime;
|
||||
|
||||
public CacheBlock(int x, int z)
|
||||
{
|
||||
this.xPosition = x;
|
||||
this.zPosition = z;
|
||||
BiomeGenLayered.this.getFactors(this.factors, x << 4, z << 4, 16, 16);
|
||||
BiomeGenLayered.this.getBiomes(this.biomes, x << 4, z << 4, 16, 16, false);
|
||||
}
|
||||
|
||||
public Biome getBiomeGenAt(int x, int z)
|
||||
{
|
||||
return this.biomes[x & 15 | (z & 15) << 4];
|
||||
}
|
||||
}
|
||||
|
||||
private final GenLayer genBiomes;
|
||||
private final GenLayer biomeIndexLayer;
|
||||
private final LongHashMap<CacheBlock> cacheMap = new LongHashMap();
|
||||
private final List<CacheBlock> cache = Lists.<CacheBlock>newArrayList();
|
||||
private long lastCleanupTime;
|
||||
|
||||
// public BiomeGenNew(long seed, GeneratorSettings options) {
|
||||
// this(seed, options.biomeMode, options.fixedBiome, options.genMode == 2, options.biomeSize,
|
||||
// options.riverSize, options.snowRarity, options.seaRarity, options.shroomRarity, options.biomeRarity);
|
||||
// }
|
||||
|
||||
// public BiomeGenLayered(Dimension dim, Random rand) {
|
||||
// this();
|
||||
// }
|
||||
|
||||
public BiomeGenLayered(long seed, Biome def, boolean fixed, int biomeSize, int riverSize, int snowRarity, int seaRarity,
|
||||
Biome[] add, int addRarity, Biome[] hot, Biome[] medium, Biome[] cold, Biome[] frost) {
|
||||
// GenLayer[] layers = GenLayer.getLayers(seed, fixedBiome, biomeSize, riverSize, snowRarity, seaRarity, shroomRarity, biomeRarity);
|
||||
GenLayer layer0t1 = new GenLayerBase(1L);
|
||||
layer0t1 = new GenLayerFuzzyZoom(2000L, layer0t1);
|
||||
GenLayerAddAreas layer2 = new GenLayerAddAreas(1L, layer0t1);
|
||||
GenLayerZoom layer3 = new GenLayerZoom(2001L, layer2);
|
||||
GenLayerAddAreas layer4t6 = new GenLayerAddAreas(2L, layer3);
|
||||
layer4t6 = new GenLayerAddAreas(50L, layer4t6);
|
||||
layer4t6 = new GenLayerAddAreas(70L, layer4t6);
|
||||
GenLayerRemoveEmpty layer7 = new GenLayerRemoveEmpty(2L, layer4t6);
|
||||
GenLayerAddSnow layer8 = new GenLayerAddSnow(2L, layer7, snowRarity);
|
||||
GenLayerAddAreas layer9 = new GenLayerAddAreas(3L, layer8);
|
||||
GenLayerEdge layer10t12 = new GenLayerEdge(2L, layer9, GenLayerEdge.Mode.COOL_WARM);
|
||||
layer10t12 = new GenLayerEdge(2L, layer10t12, GenLayerEdge.Mode.HEAT_ICE);
|
||||
// layer10t12 = new GenLayerEdge(3L, layer10t12, GenLayerEdge.Mode.SPECIAL);
|
||||
GenLayerZoom layer13t14 = new GenLayerZoom(2002L, layer10t12);
|
||||
layer13t14 = new GenLayerZoom(2003L, layer13t14);
|
||||
GenLayerAddAreas layer15 = new GenLayerAddAreas(4L, layer13t14);
|
||||
GenLayerAddExtra layer16 = new GenLayerAddExtra(5L, layer15, add, addRarity);
|
||||
GenLayerAddSea layer17 = new GenLayerAddSea(4L, layer16, seaRarity);
|
||||
GenLayer layer18 = GenLayerZoom.magnify(1000L, layer17, 0);
|
||||
GenLayer layer19 = GenLayerZoom.magnify(1000L, layer18, 0);
|
||||
GenLayerRiverInit layer20 = new GenLayerRiverInit(100L, layer19);
|
||||
GenLayerBiome layer21n = new GenLayerBiome(200L, layer18, hot, medium, cold, frost, def, fixed);
|
||||
GenLayer layer22n = GenLayerZoom.magnify(1000L, layer21n, 2);
|
||||
GenLayerBiomeEdge layer23n = new GenLayerBiomeEdge(1000L, layer22n);
|
||||
GenLayer layer21l = GenLayerZoom.magnify(1000L, layer20, 2);
|
||||
GenLayer layer24n = new GenLayerHills(1000L, layer23n, layer21l, def);
|
||||
GenLayer layer21t22a = GenLayerZoom.magnify(1000L, layer20, 2);
|
||||
layer21t22a = GenLayerZoom.magnify(1000L, layer21t22a, riverSize);
|
||||
GenLayerRiver layer23a = new GenLayerRiver(1L, layer21t22a);
|
||||
GenLayerSmooth layer24a = new GenLayerSmooth(1000L, layer23a);
|
||||
// layer24n = new GenLayerRareBiome(1001L, layer24n, biomeRarity);
|
||||
for(int k = 0; k < biomeSize; ++k) {
|
||||
layer24n = new GenLayerZoom((long)(1000 + k), layer24n);
|
||||
if(k == 0) {
|
||||
layer24n = new GenLayerAddAreas(3L, layer24n);
|
||||
}
|
||||
if(k == 1 || biomeSize == 1) {
|
||||
layer24n = new GenLayerShore(1000L, layer24n);
|
||||
}
|
||||
}
|
||||
GenLayerSmooth layer25n = new GenLayerSmooth(1000L, layer24n);
|
||||
GenLayerRiverMix layerOut = new GenLayerRiverMix(100L, layer25n, layer24a, def);
|
||||
GenLayer layerIndex = // perlinGen ? new GenLayerRiverMix(100L, layer25n, layer24a) :
|
||||
new GenLayerVoronoiZoom(10L, layerOut);
|
||||
layerOut.initWorldGenSeed(seed);
|
||||
layerIndex.initWorldGenSeed(seed);
|
||||
// return new GenLayer[] {layerOut, layerIndex};
|
||||
this.genBiomes = layerOut;
|
||||
this.biomeIndexLayer = layerIndex;
|
||||
}
|
||||
|
||||
private CacheBlock getBiomeCacheBlock(int x, int z)
|
||||
{
|
||||
x = x >> 4;
|
||||
z = z >> 4;
|
||||
long i = LongHashMap.packInt(x, z); // (long)x & 4294967295L | ((long)z & 4294967295L) << 32;
|
||||
CacheBlock blk = this.cacheMap.getValueByKey(i);
|
||||
|
||||
if (blk == null)
|
||||
{
|
||||
blk = new CacheBlock(x, z);
|
||||
this.cacheMap.add(i, blk);
|
||||
this.cache.add(blk);
|
||||
}
|
||||
|
||||
blk.lastAccessTime = System.currentTimeMillis();
|
||||
return blk;
|
||||
}
|
||||
|
||||
public void cleanupCache()
|
||||
{
|
||||
long i = System.currentTimeMillis();
|
||||
long j = i - this.lastCleanupTime;
|
||||
|
||||
if (j > 7500L || j < 0L)
|
||||
{
|
||||
this.lastCleanupTime = i;
|
||||
|
||||
for (int k = 0; k < this.cache.size(); ++k)
|
||||
{
|
||||
CacheBlock blk = this.cache.get(k);
|
||||
long l = i - blk.lastAccessTime;
|
||||
|
||||
if (l > 30000L || l < 0L)
|
||||
{
|
||||
this.cache.remove(k--);
|
||||
long i1 = LongHashMap.packInt(blk.xPosition, blk.zPosition) ; // (long)biomecache$block.xPosition & 4294967295L | ((long)biomecache$block.zPosition & 4294967295L) << 32;
|
||||
this.cacheMap.remove(i1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Biome getBiomeGenerator(BlockPos pos, Biome def) {
|
||||
int x = pos.getX();
|
||||
int z = pos.getZ();
|
||||
Biome biome = this.getBiomeCacheBlock(x, z).getBiomeGenAt(x, z);
|
||||
return biome == null ? def : biome;
|
||||
}
|
||||
|
||||
public void getFactors(double[] listToReuse, int x, int z, int width, int length) {
|
||||
IntCache.resetIntCache();
|
||||
|
||||
int[] aint = this.biomeIndexLayer.getInts(x, z, width, length);
|
||||
|
||||
for(int i = 0; i < width * length; ++i) {
|
||||
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(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);
|
||||
}
|
||||
else {
|
||||
int[] aint = this.biomeIndexLayer.getInts(xPos, zPos, sizeX, sizeZ);
|
||||
|
||||
for(int i = 0; i < sizeX * sizeZ; ++i) {
|
||||
Biome biome = Biome.getBiome(aint[i], Biome.DEF_BIOME);
|
||||
factors[i] = (double)biome.getFactor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void getGenBiomes(Biome[] biomes, int x, int z, int width, int height) {
|
||||
IntCache.resetIntCache();
|
||||
|
||||
int[] aint = this.genBiomes.getInts(x, z, width, height);
|
||||
|
||||
for(int i = 0; i < width * height; ++i) {
|
||||
biomes[i] = Biome.getBiome(aint[i], Biome.DEF_BIOME);
|
||||
}
|
||||
}
|
||||
|
||||
public void getChunkBiomes(Biome[] oldBiomeList, int x, int z, int width, int depth) {
|
||||
this.getBiomes(oldBiomeList, x, z, width, depth, true);
|
||||
}
|
||||
|
||||
public void getBiomes(Biome[] listToReuse, int x, int z, int width, int length, boolean cache) {
|
||||
IntCache.resetIntCache();
|
||||
|
||||
if(cache && width == 16 && length == 16 && (x & 15) == 0 && (z & 15) == 0) {
|
||||
Biome[] biomes = this.getBiomeCacheBlock(x, z).biomes;
|
||||
System.arraycopy(biomes, 0, listToReuse, 0, width * length);
|
||||
}
|
||||
else {
|
||||
int[] aint = this.biomeIndexLayer.getInts(x, z, width, length);
|
||||
|
||||
for(int i = 0; i < width * length; ++i) {
|
||||
listToReuse[i] = Biome.getBiome(aint[i], Biome.DEF_BIOME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean areBiomesViable(int x, int z, int size, Set<Biome> allowed) {
|
||||
IntCache.resetIntCache();
|
||||
int i = x - size >> 2;
|
||||
int j = z - size >> 2;
|
||||
int k = x + size >> 2;
|
||||
int l = z + size >> 2;
|
||||
int i1 = k - i + 1;
|
||||
int j1 = l - j + 1;
|
||||
int[] aint = this.genBiomes.getInts(i, j, i1, j1);
|
||||
|
||||
for(int k1 = 0; k1 < i1 * j1; ++k1) {
|
||||
Biome biome = Biome.getBiome(aint[k1]);
|
||||
|
||||
if(!allowed.contains(biome)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// public BlockPos findBiomePosition(int x, int z, int range, Set<Biome> biomes, Random rand) {
|
||||
// IntCache.resetIntCache();
|
||||
// int x1 = x - range >> 2;
|
||||
// int z1 = z - range >> 2;
|
||||
// int x2 = x + range >> 2;
|
||||
// int z2 = z + range >> 2;
|
||||
// int xs = x2 - x1 + 1;
|
||||
// int zs = z2 - z1 + 1;
|
||||
// int[] ints = this.genBiomes.getInts(x1, z1, xs, zs);
|
||||
// BlockPos pos = null;
|
||||
// int count = 0;
|
||||
//
|
||||
// for(int n = 0; n < xs * zs; ++n) {
|
||||
// int bx = x1 + n % xs << 2;
|
||||
// int bz = z1 + n / xs << 2;
|
||||
// Biome biome = Biome.getBiome(ints[n]);
|
||||
//
|
||||
// if(biomes.contains(biome) && (pos == null || rand.zrange(count + 1) == 0)) {
|
||||
// pos = new BlockPos(bx, 0, bz);
|
||||
// ++count;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return pos;
|
||||
// }
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.rng.PerlinGenOld;
|
||||
import common.rng.Random;
|
||||
|
||||
public class BiomeGenPerlin {
|
||||
private final PerlinGenOld tempNoiseGen;
|
||||
private final PerlinGenOld rainNoiseGen;
|
||||
private final PerlinGenOld multNoiseGen;
|
||||
private final double[] tempMult = new double[256];
|
||||
private final double[] temperature = new double[256];
|
||||
private final double[] humidity = new double[256];
|
||||
|
||||
public BiomeGenPerlin(long seed) {
|
||||
this.tempNoiseGen = new PerlinGenOld(new Random(seed * 9871L), 4);
|
||||
this.rainNoiseGen = new PerlinGenOld(new Random(seed * 39811L), 4);
|
||||
this.multNoiseGen = new PerlinGenOld(new Random(seed * 0x84a59L), 2);
|
||||
}
|
||||
|
||||
public void generate(double[] factors, int xPos, int zPos) {
|
||||
xPos *= 16;
|
||||
zPos *= 16;
|
||||
this.tempNoiseGen.generate(this.temperature, xPos, zPos, 16, 16, 0.02500000037252903D, 0.02500000037252903D, 0.25D);
|
||||
this.rainNoiseGen.generate(this.humidity, xPos, zPos, 16, 16, 0.05000000074505806D, 0.05000000074505806D, 0.33333333333333331D);
|
||||
this.multNoiseGen.generate(this.tempMult, xPos, zPos, 16, 16, 0.25D, 0.25D, 0.58823529411764708D);
|
||||
int pos = 0;
|
||||
for(int x = 0; x < 16; x++) {
|
||||
for(int z = 0; z < 16; z++) {
|
||||
double tempMul = this.tempMult[pos] * 1.1000000000000001D + 0.5D;
|
||||
double factor = 0.01D;
|
||||
double ifactor = 1.0D - factor;
|
||||
double temp = (this.temperature[pos] * 0.14999999999999999D + 0.69999999999999996D) * ifactor + tempMul * factor;
|
||||
factor = 0.002D;
|
||||
ifactor = 1.0D - factor;
|
||||
double rain = (this.humidity[pos] * 0.14999999999999999D + 0.5D) * ifactor + tempMul * factor;
|
||||
temp = 1.0D - (1.0D - temp) * (1.0D - temp);
|
||||
if(temp < 0.0D)
|
||||
temp = 0.0D;
|
||||
if(rain < 0.0D)
|
||||
rain = 0.0D;
|
||||
if(temp > 1.0D)
|
||||
temp = 1.0D;
|
||||
if(rain > 1.0D)
|
||||
rain = 1.0D;
|
||||
factors[z * 16 + x] = temp * rain;
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.util.BlockPos;
|
||||
|
||||
public class BiomeGenSingle implements BiomeGenerator {
|
||||
private final Biome biome;
|
||||
|
||||
public BiomeGenSingle(Biome biome) {
|
||||
this.biome = biome;
|
||||
}
|
||||
|
||||
public Biome getBiomeGenerator(BlockPos pos, Biome def) {
|
||||
return this.biome;
|
||||
}
|
||||
|
||||
public void getGenBiomes(Biome[] biomes, int x, int z, int width, int height) {
|
||||
Arrays.fill(biomes, 0, width * height, this.biome);
|
||||
}
|
||||
|
||||
public void getChunkBiomes(Biome[] oldBiomeList, int x, int z, int width, int depth) {
|
||||
Arrays.fill(oldBiomeList, 0, width * depth, this.biome);
|
||||
}
|
||||
|
||||
public void getBiomes(Biome[] listToReuse, int x, int z, int width, int length, boolean cache) {
|
||||
Arrays.fill(listToReuse, 0, width * length, this.biome);
|
||||
}
|
||||
|
||||
// public BlockPos findBiomePosition(int x, int z, int range, Set<Biome> biomes, Random random) {
|
||||
// return biomes.contains(this.biome) ? new BlockPos(x - range + random.zrange(range * 2 + 1), 0, z - range + random.zrange(range * 2 + 1))
|
||||
// : null;
|
||||
// }
|
||||
|
||||
public boolean areBiomesViable(int x, int z, int size, Set<Biome> allowed) {
|
||||
return allowed.contains(this.biome);
|
||||
}
|
||||
|
||||
public void cleanupCache() {
|
||||
}
|
||||
|
||||
public void genFactors(double[] factors, int xPos, int zPos, int sizeX, int sizeZ) {
|
||||
Arrays.fill(factors, 0, sizeX * sizeZ, this.biome.getFactor());
|
||||
}
|
||||
}
|
|
@ -2,15 +2,15 @@ package common.worldgen;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.biome.BaseBiome;
|
||||
import common.util.BlockPos;
|
||||
|
||||
public interface BiomeGenerator {
|
||||
public void genFactors(double[] factors, int xPos, int zPos, int sizeX, int sizeZ);
|
||||
public Biome getBiomeGenerator(BlockPos pos, Biome def);
|
||||
public void getGenBiomes(Biome[] biomes, int x, int z, int width, int height);
|
||||
public void getChunkBiomes(Biome[] oldBiomeList, int x, int z, int width, int depth);
|
||||
public void getBiomes(Biome[] listToReuse, int x, int z, int width, int length, boolean cacheFlag);
|
||||
public boolean areBiomesViable(int x, int z, int size, Set<Biome> allowed);
|
||||
public BaseBiome getBiomeGenerator(BlockPos pos, BaseBiome def);
|
||||
public void getGenBiomes(BaseBiome[] biomes, int x, int z, int width, int height);
|
||||
public void getChunkBiomes(BaseBiome[] oldBiomeList, int x, int z, int width, int depth);
|
||||
public void getBiomes(BaseBiome[] listToReuse, int x, int z, int width, int length, boolean cacheFlag);
|
||||
public boolean areBiomesViable(int x, int z, int size, Set<BaseBiome> allowed);
|
||||
public void cleanupCache();
|
||||
}
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.rng.Random;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public interface BlockReplacer {
|
||||
public void replaceBlocks(AWorldServer world, int x, int z, ChunkPrimer primer, Random rand, Biome[] biomes);
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public interface ChunkGenerator {
|
||||
public void generateChunk(AWorldServer world, int x, int z, ChunkPrimer primer);
|
||||
public int getMaximumHeight();
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.world.State;
|
||||
|
||||
public class ChunkPrimer {
|
||||
public final int height;
|
||||
private final short[] data;
|
||||
|
||||
public ChunkPrimer(int height) {
|
||||
this.data = new short[Math.max(height, 256) * 256];
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public State get(int x, int y, int z) {
|
||||
State state = BlockRegistry.STATEMAP.getByValue(this.data[x << 4 | z | y << 8]);
|
||||
return state != null ? state : Blocks.air.getState();
|
||||
}
|
||||
|
||||
public void set(int x, int y, int z, State state) {
|
||||
this.data[x << 4 | z | y << 8] = (short)BlockRegistry.STATEMAP.get(state);
|
||||
}
|
||||
}
|
95
common/src/common/worldgen/GeneratorDebug.java → common/src/common/worldgen/DebugStates.java
Executable file → Normal file
95
common/src/common/worldgen/GeneratorDebug.java → common/src/common/worldgen/DebugStates.java
Executable file → Normal file
|
@ -1,59 +1,38 @@
|
|||
package common.worldgen;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.collect.Lists;
|
||||
import common.init.BlockRegistry;
|
||||
import common.util.ExtMath;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class GeneratorDebug implements ChunkGenerator
|
||||
{
|
||||
private static final List<State> STATES = Lists.<State>newArrayList();
|
||||
private static final int XSTRETCH;
|
||||
private static final int ZSTRETCH;
|
||||
|
||||
static {
|
||||
for(Block block : BlockRegistry.REGISTRY) {
|
||||
STATES.addAll(block.getValidStates());
|
||||
}
|
||||
XSTRETCH = ExtMath.ceilf(ExtMath.sqrtf((float)STATES.size()));
|
||||
ZSTRETCH = ExtMath.ceilf((float)STATES.size() / (float)XSTRETCH);
|
||||
}
|
||||
|
||||
public static State getState(int x, int z) {
|
||||
State state = null;
|
||||
if(x > 0 && z > 0 && x % 2 != 0 && z % 2 != 0) {
|
||||
x = x / 2;
|
||||
z = z / 2;
|
||||
if(x <= XSTRETCH && z <= ZSTRETCH) {
|
||||
int idx = ExtMath.absi(x * XSTRETCH + z);
|
||||
if(idx < STATES.size()) {
|
||||
state = STATES.get(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
public int getMaximumHeight() {
|
||||
return 72;
|
||||
}
|
||||
|
||||
public void generateChunk(AWorldServer world, int x, int z, ChunkPrimer primer)
|
||||
{
|
||||
for(int bx = 0; bx < 16; ++bx) {
|
||||
for(int bz = 0; bz < 16; ++bz) {
|
||||
int sx = x * 16 + bx;
|
||||
int sz = z * 16 + bz;
|
||||
// primer.set(bx, 60, bz, Blocks.glass.getDefaultState());
|
||||
State state = getState(sx, sz);
|
||||
if(state != null) {
|
||||
primer.set(bx, 1, bz, state);
|
||||
}
|
||||
}
|
||||
package common.worldgen;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.collect.Lists;
|
||||
import common.init.BlockRegistry;
|
||||
import common.util.ExtMath;
|
||||
import common.world.State;
|
||||
|
||||
public class DebugStates {
|
||||
private static final List<State> STATES = Lists.<State>newArrayList();
|
||||
private static final int XSTRETCH;
|
||||
private static final int ZSTRETCH;
|
||||
|
||||
static {
|
||||
for(Block block : BlockRegistry.REGISTRY) {
|
||||
STATES.addAll(block.getValidStates());
|
||||
}
|
||||
}
|
||||
}
|
||||
XSTRETCH = ExtMath.ceilf(ExtMath.sqrtf((float)STATES.size()));
|
||||
ZSTRETCH = ExtMath.ceilf((float)STATES.size() / (float)XSTRETCH);
|
||||
}
|
||||
|
||||
public static State getState(int x, int z) {
|
||||
State state = null;
|
||||
if(x > 0 && z > 0 && x % 2 != 0 && z % 2 != 0) {
|
||||
x = x / 2;
|
||||
z = z / 2;
|
||||
if(x <= XSTRETCH && z <= ZSTRETCH) {
|
||||
int idx = ExtMath.absi(x * XSTRETCH + z);
|
||||
if(idx < STATES.size()) {
|
||||
state = STATES.get(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
}
|
|
@ -1,178 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.item.RngLoot;
|
||||
import common.log.Log;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityChest;
|
||||
import common.tileentity.TileEntityMobSpawner;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class FeatureDungeons
|
||||
{
|
||||
private static final String[] SPAWNERTYPES = new String[] {"Undead", "Zombie", "Zombie", "Arachnoid"};
|
||||
|
||||
private final int chance;
|
||||
|
||||
public FeatureDungeons(int chance) {
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position) {
|
||||
boolean flag = false;
|
||||
for(int z = 0; z < this.chance; z++) {
|
||||
flag |= this.generateDungeon(worldIn, rand, position.add(rand.chOffset(), rand.zrange(256), rand.chOffset()));
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private boolean generateDungeon(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
int i = 3;
|
||||
int j = rand.zrange(2) + 2;
|
||||
int k = -j - 1;
|
||||
int l = j + 1;
|
||||
int i1 = -1;
|
||||
int j1 = 4;
|
||||
int k1 = rand.zrange(2) + 2;
|
||||
int l1 = -k1 - 1;
|
||||
int i2 = k1 + 1;
|
||||
int j2 = 0;
|
||||
|
||||
for (int k2 = k; k2 <= l; ++k2)
|
||||
{
|
||||
for (int l2 = -1; l2 <= 4; ++l2)
|
||||
{
|
||||
for (int i3 = l1; i3 <= i2; ++i3)
|
||||
{
|
||||
BlockPos blockpos = position.add(k2, l2, i3);
|
||||
Material material = worldIn.getState(blockpos).getBlock().getMaterial();
|
||||
boolean flag = material.isSolid();
|
||||
|
||||
if (l2 == -1 && !flag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (l2 == 4 && !flag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((k2 == k || k2 == l || i3 == l1 || i3 == i2) && l2 == 0 && worldIn.isAirBlock(blockpos) && worldIn.isAirBlock(blockpos.up()))
|
||||
{
|
||||
++j2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (j2 >= 1 && j2 <= 5)
|
||||
{
|
||||
for (int k3 = k; k3 <= l; ++k3)
|
||||
{
|
||||
for (int i4 = 3; i4 >= -1; --i4)
|
||||
{
|
||||
for (int k4 = l1; k4 <= i2; ++k4)
|
||||
{
|
||||
BlockPos blockpos1 = position.add(k3, i4, k4);
|
||||
|
||||
if (k3 != k && i4 != -1 && k4 != l1 && k3 != l && i4 != 4 && k4 != i2)
|
||||
{
|
||||
if (worldIn.getState(blockpos1).getBlock() != Blocks.chest)
|
||||
{
|
||||
worldIn.setBlockToAir(blockpos1);
|
||||
}
|
||||
}
|
||||
else if (blockpos1.getY() >= 0 && !worldIn.getState(blockpos1.down()).getBlock().getMaterial().isSolid())
|
||||
{
|
||||
worldIn.setBlockToAir(blockpos1);
|
||||
}
|
||||
else if (worldIn.getState(blockpos1).getBlock().getMaterial().isSolid() && worldIn.getState(blockpos1).getBlock() != Blocks.chest)
|
||||
{
|
||||
if (i4 == -1 && rand.zrange(4) != 0)
|
||||
{
|
||||
worldIn.setState(blockpos1, Blocks.mossy_cobblestone.getState(), 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setState(blockpos1, Blocks.cobblestone.getState(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int l3 = 0; l3 < 2; ++l3)
|
||||
{
|
||||
for (int j4 = 0; j4 < 3; ++j4)
|
||||
{
|
||||
int l4 = position.getX() + rand.zrange(j * 2 + 1) - j;
|
||||
int i5 = position.getY();
|
||||
int j5 = position.getZ() + rand.zrange(k1 * 2 + 1) - k1;
|
||||
BlockPos blockpos2 = new BlockPos(l4, i5, j5);
|
||||
|
||||
if (worldIn.isAirBlock(blockpos2))
|
||||
{
|
||||
int j3 = 0;
|
||||
|
||||
for (Facing enumfacing : Facing.Plane.HORIZONTAL)
|
||||
{
|
||||
if (worldIn.getState(blockpos2.offset(enumfacing)).getBlock().getMaterial().isSolid())
|
||||
{
|
||||
++j3;
|
||||
}
|
||||
}
|
||||
|
||||
if (j3 == 1)
|
||||
{
|
||||
worldIn.setState(blockpos2, Blocks.chest.correctFacing(worldIn, blockpos2, Blocks.chest.getState()), 2);
|
||||
WeightedList<RngLoot> list = RngLoot.addToList(LootConstants.DUNGEON_CHEST, Items.enchanted_book.getRandom(rand));
|
||||
TileEntity tileentity1 = worldIn.getTileEntity(blockpos2);
|
||||
|
||||
if (tileentity1 instanceof TileEntityChest)
|
||||
{
|
||||
RngLoot.generateChestContents(rand, list, (TileEntityChest)tileentity1, 8);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
worldIn.setState(position, Blocks.mob_spawner.getState(), 2);
|
||||
TileEntity tileentity = worldIn.getTileEntity(position);
|
||||
|
||||
if (tileentity instanceof TileEntityMobSpawner)
|
||||
{
|
||||
((TileEntityMobSpawner)tileentity).setEntityName(this.pickMobSpawner(rand));
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.JNI.warn("Konnte kein Mob-Spawner-Objekt bei (" + position.getX() + ", " + position.getY() + ", " + position.getZ() + ") erstellen");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Randomly decides which spawner to use in a dungeon
|
||||
*/
|
||||
private String pickMobSpawner(Random p_76543_1_)
|
||||
{
|
||||
return SPAWNERTYPES[p_76543_1_.zrange(SPAWNERTYPES.length)];
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public abstract class FeatureGenerator
|
||||
{
|
||||
private final boolean doBlockNotify;
|
||||
|
||||
public FeatureGenerator()
|
||||
{
|
||||
this(false);
|
||||
}
|
||||
|
||||
public FeatureGenerator(boolean notify)
|
||||
{
|
||||
this.doBlockNotify = notify;
|
||||
}
|
||||
|
||||
public abstract boolean generate(AWorldServer worldIn, Random rand, BlockPos position);
|
||||
|
||||
protected void setBlockAndNotifyAdequately(AWorldServer worldIn, BlockPos pos, State state)
|
||||
{
|
||||
if (this.doBlockNotify)
|
||||
{
|
||||
worldIn.setState(pos, state, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setState(pos, state, 2);
|
||||
}
|
||||
}
|
||||
}
|
23
common/src/common/worldgen/FeatureLake.java
Normal file
23
common/src/common/worldgen/FeatureLake.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.world.State;
|
||||
|
||||
public class FeatureLake {
|
||||
public final State state;
|
||||
public final State filler;
|
||||
public final State top;
|
||||
public final int chance;
|
||||
public final int minHeight;
|
||||
public final int maxHeight;
|
||||
public final boolean ratiod;
|
||||
|
||||
public FeatureLake(State state, State filler, State top, int chance, int minHeight, int maxHeight, boolean ratiod) {
|
||||
this.state = state;
|
||||
this.filler = filler;
|
||||
this.top = top;
|
||||
this.chance = chance;
|
||||
this.minHeight = minHeight;
|
||||
this.maxHeight = maxHeight;
|
||||
this.ratiod = ratiod;
|
||||
}
|
||||
}
|
|
@ -1,221 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.LightType;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class FeatureLakes
|
||||
{
|
||||
public final State state;
|
||||
private final Block block;
|
||||
public final State filler;
|
||||
// public final Block replace;
|
||||
public final State top;
|
||||
public final int chance;
|
||||
public final int minHeight;
|
||||
public final int maxHeight;
|
||||
public final boolean ratiod;
|
||||
|
||||
public FeatureLakes(State state, State filler, /* Block replace, */ State top, int chance, int minHeight, int maxHeight,
|
||||
boolean ratiod)
|
||||
{
|
||||
this.state = state;
|
||||
this.block = state.getBlock();
|
||||
this.filler = filler;
|
||||
// this.replace = replace;
|
||||
this.top = top;
|
||||
this.chance = chance;
|
||||
this.ratiod = ratiod;
|
||||
if(minHeight > maxHeight) {
|
||||
this.minHeight = maxHeight;
|
||||
this.maxHeight = minHeight;
|
||||
}
|
||||
else {
|
||||
this.minHeight = minHeight;
|
||||
this.maxHeight = maxHeight;
|
||||
}
|
||||
}
|
||||
|
||||
// public WorldGenLakes(Block block)
|
||||
// {
|
||||
// this(block, block == Blocks.lava ? Blocks.stone.getDefaultState() : null, Blocks.dirt, Blocks.grass.getDefaultState());
|
||||
// }
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position) {
|
||||
if(this.ratiod) {
|
||||
if(this.chance >= 1 && rand.chance(this.chance)) {
|
||||
int y = rand.range(this.minHeight, this.maxHeight); // rand.zrange(rand.zrange(248) + 8);
|
||||
if(y < worldIn.getSeaLevel() || rand.chance(this.chance * 5 / 4))
|
||||
return this.generateLake(worldIn, rand, position.add(rand.chOffset(), y, rand.chOffset()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(this.chance >= 1 && rand.chance(this.chance))
|
||||
return this.generateLake(worldIn, rand, position.add(rand.chOffset(), rand.range(this.minHeight, this.maxHeight),
|
||||
rand.chOffset()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean generateLake(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
for (position = position.add(-8, 0, -8); position.getY() > 5 && worldIn.isAirBlock(position); position = position.down())
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
if (position.getY() <= 4)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
position = position.down(4);
|
||||
boolean[] aboolean = new boolean[2048];
|
||||
int i = rand.zrange(4) + 4;
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
double d0 = rand.doublev() * 6.0D + 3.0D;
|
||||
double d1 = rand.doublev() * 4.0D + 2.0D;
|
||||
double d2 = rand.doublev() * 6.0D + 3.0D;
|
||||
double d3 = rand.doublev() * (16.0D - d0 - 2.0D) + 1.0D + d0 / 2.0D;
|
||||
double d4 = rand.doublev() * (8.0D - d1 - 4.0D) + 2.0D + d1 / 2.0D;
|
||||
double d5 = rand.doublev() * (16.0D - d2 - 2.0D) + 1.0D + d2 / 2.0D;
|
||||
|
||||
for (int l = 1; l < 15; ++l)
|
||||
{
|
||||
for (int i1 = 1; i1 < 15; ++i1)
|
||||
{
|
||||
for (int j1 = 1; j1 < 7; ++j1)
|
||||
{
|
||||
double d6 = ((double)l - d3) / (d0 / 2.0D);
|
||||
double d7 = ((double)j1 - d4) / (d1 / 2.0D);
|
||||
double d8 = ((double)i1 - d5) / (d2 / 2.0D);
|
||||
double d9 = d6 * d6 + d7 * d7 + d8 * d8;
|
||||
|
||||
if (d9 < 1.0D)
|
||||
{
|
||||
aboolean[(l * 16 + i1) * 8 + j1] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int k1 = 0; k1 < 16; ++k1)
|
||||
{
|
||||
for (int l2 = 0; l2 < 16; ++l2)
|
||||
{
|
||||
for (int k = 0; k < 8; ++k)
|
||||
{
|
||||
boolean flag = !aboolean[(k1 * 16 + l2) * 8 + k] && (k1 < 15 && aboolean[((k1 + 1) * 16 + l2) * 8 + k] || k1 > 0 && aboolean[((k1 - 1) * 16 + l2) * 8 + k] || l2 < 15 && aboolean[(k1 * 16 + l2 + 1) * 8 + k] || l2 > 0 && aboolean[(k1 * 16 + (l2 - 1)) * 8 + k] || k < 7 && aboolean[(k1 * 16 + l2) * 8 + k + 1] || k > 0 && aboolean[(k1 * 16 + l2) * 8 + (k - 1)]);
|
||||
|
||||
if (flag)
|
||||
{
|
||||
Material material = worldIn.getState(position.add(k1, k, l2)).getBlock().getMaterial();
|
||||
|
||||
if (k >= 4 && material.isLiquid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (k < 4 && !material.isSolid() && worldIn.getState(position.add(k1, k, l2)).getBlock() != this.block)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int l1 = 0; l1 < 16; ++l1)
|
||||
{
|
||||
for (int i3 = 0; i3 < 16; ++i3)
|
||||
{
|
||||
for (int i4 = 0; i4 < 8; ++i4)
|
||||
{
|
||||
if (aboolean[(l1 * 16 + i3) * 8 + i4])
|
||||
{
|
||||
worldIn.setState(position.add(l1, i4, i3), i4 >= 4 ? Blocks.air.getState() : this.state, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.top != null) {
|
||||
Block replace = worldIn.dimension.getTop().getBlock();
|
||||
for (int i2 = 0; i2 < 16; ++i2)
|
||||
{
|
||||
for (int j3 = 0; j3 < 16; ++j3)
|
||||
{
|
||||
for (int j4 = 4; j4 < 8; ++j4)
|
||||
{
|
||||
if (aboolean[(i2 * 16 + j3) * 8 + j4])
|
||||
{
|
||||
BlockPos blockpos = position.add(i2, j4 - 1, j3);
|
||||
|
||||
if (worldIn.getState(blockpos).getBlock() == replace && worldIn.getLightFor(LightType.SKY, position.add(i2, j4, j3)) > 0)
|
||||
{
|
||||
Biome biomegenbase = worldIn.getBiomeGenForCoords(blockpos);
|
||||
|
||||
if (biomegenbase.topBlock.getBlock() == Blocks.mycelium)
|
||||
{
|
||||
worldIn.setState(blockpos, Blocks.mycelium.getState(), 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setState(blockpos, this.top, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.filler != null) // && this.block.getMaterial() == Material.lava)
|
||||
{
|
||||
for (int j2 = 0; j2 < 16; ++j2)
|
||||
{
|
||||
for (int k3 = 0; k3 < 16; ++k3)
|
||||
{
|
||||
for (int k4 = 0; k4 < 8; ++k4)
|
||||
{
|
||||
boolean flag1 = !aboolean[(j2 * 16 + k3) * 8 + k4] && (j2 < 15 && aboolean[((j2 + 1) * 16 + k3) * 8 + k4] || j2 > 0 && aboolean[((j2 - 1) * 16 + k3) * 8 + k4] || k3 < 15 && aboolean[(j2 * 16 + k3 + 1) * 8 + k4] || k3 > 0 && aboolean[(j2 * 16 + (k3 - 1)) * 8 + k4] || k4 < 7 && aboolean[(j2 * 16 + k3) * 8 + k4 + 1] || k4 > 0 && aboolean[(j2 * 16 + k3) * 8 + (k4 - 1)]);
|
||||
|
||||
if (flag1 && (k4 < 4 || rand.zrange(2) != 0) && worldIn.getState(position.add(j2, k4, k3)).getBlock().getMaterial().isSolid())
|
||||
{
|
||||
worldIn.setState(position.add(j2, k4, k3), this.filler, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.block.getMaterial() == Material.water)
|
||||
{
|
||||
for (int k2 = 0; k2 < 16; ++k2)
|
||||
{
|
||||
for (int l3 = 0; l3 < 16; ++l3)
|
||||
{
|
||||
int l4 = 3; // not 4 !!
|
||||
|
||||
if (worldIn.canBlockFreeze(position.add(k2, l4, l3), false))
|
||||
{
|
||||
worldIn.setState(position.add(k2, l4, l3), Blocks.ice.getState(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
19
common/src/common/worldgen/FeatureLiquid.java
Normal file
19
common/src/common/worldgen/FeatureLiquid.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.world.State;
|
||||
|
||||
public class FeatureLiquid {
|
||||
public final State state;
|
||||
public final int chance;
|
||||
public final int minHeight;
|
||||
public final int maxHeight;
|
||||
public final boolean lower;
|
||||
|
||||
public FeatureLiquid(State state, int chance, int minHeight, int maxHeight, boolean lower) {
|
||||
this.state = state;
|
||||
this.chance = chance;
|
||||
this.minHeight = minHeight;
|
||||
this.maxHeight = maxHeight;
|
||||
this.lower = lower;
|
||||
}
|
||||
}
|
|
@ -1,128 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.block.Block;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class FeatureLiquids
|
||||
{
|
||||
public final State state;
|
||||
private final Block block;
|
||||
// public final Block replace;
|
||||
public final int chance;
|
||||
public final int minHeight;
|
||||
public final int maxHeight;
|
||||
public final boolean lower;
|
||||
|
||||
// public WorldGenLiquids(Block block)
|
||||
// {
|
||||
// this(block, Blocks.stone);
|
||||
// }
|
||||
|
||||
public FeatureLiquids(State state, /* Block replace, */ int chance, int minHeight, int maxHeight, boolean lower)
|
||||
{
|
||||
this.state = state;
|
||||
this.block = state.getBlock();
|
||||
// replace = replace;
|
||||
this.chance = chance;
|
||||
this.lower = lower;
|
||||
if(minHeight > maxHeight) {
|
||||
this.minHeight = lower && maxHeight < 1 ? 1 : maxHeight;
|
||||
this.maxHeight = minHeight;
|
||||
}
|
||||
else {
|
||||
this.minHeight = lower && minHeight < 1 ? 1 : minHeight;
|
||||
this.maxHeight = maxHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position) {
|
||||
Block replace = worldIn.dimension.getFiller().getBlock();
|
||||
boolean flag = false;
|
||||
for(int z = 0; z < this.chance; z++) {
|
||||
if(this.lower)
|
||||
// 8, 247)
|
||||
flag |= this.generateLiquid(worldIn, rand, position.add(rand.chOffset(), rand.zrange(rand.range(this.minHeight,
|
||||
rand.range(this.minHeight, this.maxHeight))), rand.chOffset()), replace);
|
||||
else
|
||||
// int i17 = this.randomGenerator.range(8, 255);
|
||||
flag |= this.generateLiquid(worldIn, rand, position.add(rand.chOffset(), rand.range(this.minHeight,
|
||||
rand.range(this.minHeight, this.maxHeight)), rand.chOffset()), replace);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private boolean generateLiquid(AWorldServer worldIn, Random rand, BlockPos position, Block replace)
|
||||
{
|
||||
if (worldIn.getState(position.up()).getBlock() != replace)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (worldIn.getState(position.down()).getBlock() != replace)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (worldIn.getState(position).getBlock().getMaterial() != Material.air && worldIn.getState(position).getBlock() != replace)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (worldIn.getState(position.west()).getBlock() == replace)
|
||||
{
|
||||
++i;
|
||||
}
|
||||
|
||||
if (worldIn.getState(position.east()).getBlock() == replace)
|
||||
{
|
||||
++i;
|
||||
}
|
||||
|
||||
if (worldIn.getState(position.north()).getBlock() == replace)
|
||||
{
|
||||
++i;
|
||||
}
|
||||
|
||||
if (worldIn.getState(position.south()).getBlock() == replace)
|
||||
{
|
||||
++i;
|
||||
}
|
||||
|
||||
int j = 0;
|
||||
|
||||
if (worldIn.isAirBlock(position.west()))
|
||||
{
|
||||
++j;
|
||||
}
|
||||
|
||||
if (worldIn.isAirBlock(position.east()))
|
||||
{
|
||||
++j;
|
||||
}
|
||||
|
||||
if (worldIn.isAirBlock(position.north()))
|
||||
{
|
||||
++j;
|
||||
}
|
||||
|
||||
if (worldIn.isAirBlock(position.south()))
|
||||
{
|
||||
++j;
|
||||
}
|
||||
|
||||
if (i == 3 && j == 1)
|
||||
{
|
||||
worldIn.setState(position, this.state, 2);
|
||||
worldIn.forceBlockUpdateTick(this.block, position, rand);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
23
common/src/common/worldgen/FeatureOre.java
Normal file
23
common/src/common/worldgen/FeatureOre.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.world.State;
|
||||
|
||||
public class FeatureOre {
|
||||
public final State state;
|
||||
public final int count;
|
||||
public final int more;
|
||||
public final int size;
|
||||
public final int min;
|
||||
public final int max;
|
||||
public final boolean dist;
|
||||
|
||||
public FeatureOre(State state, int count, int more, int size, int min, int max, boolean dist) {
|
||||
this.state = state;
|
||||
this.count = count;
|
||||
this.more = more;
|
||||
this.size = size;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.dist = dist;
|
||||
}
|
||||
}
|
|
@ -1,167 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.block.Block;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class FeatureOres
|
||||
{
|
||||
public final State oreBlock;
|
||||
// private final Block replace;
|
||||
public final boolean distributed;
|
||||
private final int spawnTries;
|
||||
private final int moreTries;
|
||||
public final int numberOfBlocks;
|
||||
private final int minHeight;
|
||||
private final int maxHeight;
|
||||
|
||||
public final int spawns;
|
||||
public final int min;
|
||||
public final int max;
|
||||
public final int more;
|
||||
|
||||
// public FeatureOres(IBlockState state, boolean dist, int spawns, int count, int min, int max) {
|
||||
// this(state, dist, spawns, 0, count, min, max);
|
||||
// }
|
||||
|
||||
// public FeatureOres(IBlockState state, boolean dist, int spawns, int more, int count, int min, int max) {
|
||||
// this(state, dist, spawns, more, count, min, max, null);
|
||||
// }
|
||||
|
||||
public FeatureOres(State state, int count, int more, int size, int min, int max, boolean dist) // , Block replace)
|
||||
{
|
||||
this.spawns = count;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.more = more;
|
||||
count = count == 2 ? 3 : count;
|
||||
this.oreBlock = state;
|
||||
this.distributed = dist;
|
||||
if(this.distributed) {
|
||||
min = min < 0 ? 0 : (min > 511 ? 511 : min);
|
||||
max = max < 0 ? 0 : (max > 512 ? 512 : max);
|
||||
if(min + max > 511) {
|
||||
max = 512 - min;
|
||||
}
|
||||
if(min - max < 0) {
|
||||
max = min;
|
||||
}
|
||||
}
|
||||
else {
|
||||
min = min < 0 ? 0 : (min > 512 ? 512 : min);
|
||||
max = max < 0 ? 0 : (max > 512 ? 512 : max);
|
||||
if (max < min)
|
||||
{
|
||||
int i = min;
|
||||
min = max;
|
||||
max = i;
|
||||
}
|
||||
else if (max == min)
|
||||
{
|
||||
if (min < 511)
|
||||
{
|
||||
++max;
|
||||
}
|
||||
else
|
||||
{
|
||||
--min;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.minHeight = min;
|
||||
this.maxHeight = max;
|
||||
int minTries = count <= 0 ? 1 : 0;
|
||||
this.spawnTries = count < 0 ? 0 : count;
|
||||
this.moreTries = more < minTries ? minTries : more;
|
||||
this.numberOfBlocks = size < 1 ? 1 : size;
|
||||
// this.replace = replace;
|
||||
}
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position) {
|
||||
Block replace = /* this.replace != null ? this.replace : */ worldIn.dimension.getFiller().getBlock();
|
||||
int tries = this.spawnTries == 0 ?
|
||||
(rand.zrange(this.moreTries) == 0 ? 1 : 0) :
|
||||
(this.spawnTries + (this.moreTries == 0 ? 0 : rand.zrange(this.moreTries + 1)));
|
||||
// tries = tries == 0 ? (this.numberOfBlocks == 1 ? (rand.nextInt(10) == 0 ? 1 : 0) : rand.nextInt(2)) : tries;
|
||||
for(int j = 0; j < tries; j++) {
|
||||
BlockPos blockpos;
|
||||
if(this.distributed) {
|
||||
blockpos = position.add(rand.zrange(16), rand.zrange(this.maxHeight) + rand.zrange(this.maxHeight) + this.minHeight - this.maxHeight, rand.zrange(16));
|
||||
}
|
||||
else {
|
||||
blockpos = position.add(rand.zrange(16), rand.zrange(this.maxHeight - this.minHeight) + this.minHeight, rand.zrange(16));
|
||||
}
|
||||
if(this.numberOfBlocks == 1) {
|
||||
if(worldIn.getState(blockpos).getBlock() == replace) {
|
||||
worldIn.setState(blockpos, this.oreBlock, 2);
|
||||
}
|
||||
}
|
||||
else { // if(position.getX() >= -67000000 && position.getZ() >= -67000000 && position.getX() <= 67000000 && position.getZ() <= 67000000) {
|
||||
this.generateVein(worldIn, rand, blockpos, replace); // Fix dist
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void generateVein(AWorldServer worldIn, Random rand, BlockPos position, Block replace)
|
||||
{
|
||||
float f = rand.floatv() * (float)Math.PI;
|
||||
double d0 = (double)(/* (float)(position.getX() + 8) */ 8.0f + ExtMath.sin(f) * (float)this.numberOfBlocks / 8.0F);
|
||||
double d1 = (double)(/* (float)(position.getX() + 8) */ 8.0f - ExtMath.sin(f) * (float)this.numberOfBlocks / 8.0F);
|
||||
double d2 = (double)(/* (float)(position.getZ() + 8) */ 8.0f + ExtMath.cos(f) * (float)this.numberOfBlocks / 8.0F);
|
||||
double d3 = (double)(/* (float)(position.getZ() + 8) */ 8.0f - ExtMath.cos(f) * (float)this.numberOfBlocks / 8.0F);
|
||||
double d4 = (double)(/* position.getY() + */ rand.zrange(3) - 2);
|
||||
double d5 = (double)(/* position.getY() + */ rand.zrange(3) - 2);
|
||||
|
||||
for (int i = 0; i < this.numberOfBlocks; ++i)
|
||||
{
|
||||
float f1 = (float)i / (float)this.numberOfBlocks;
|
||||
double d6 = d0 + (d1 - d0) * (double)f1;
|
||||
double d7 = d4 + (d5 - d4) * (double)f1;
|
||||
double d8 = d2 + (d3 - d2) * (double)f1;
|
||||
double d9 = rand.doublev() * (double)this.numberOfBlocks / 16.0D;
|
||||
double d10 = (double)(ExtMath.sin((float)Math.PI * f1) + 1.0F) * d9 + 1.0D;
|
||||
double d11 = (double)(ExtMath.sin((float)Math.PI * f1) + 1.0F) * d9 + 1.0D;
|
||||
int j = ExtMath.floord(d6 - d10 / 2.0D);
|
||||
int k = ExtMath.floord(d7 - d11 / 2.0D);
|
||||
int l = ExtMath.floord(d8 - d10 / 2.0D);
|
||||
int i1 = ExtMath.floord(d6 + d10 / 2.0D);
|
||||
int j1 = ExtMath.floord(d7 + d11 / 2.0D);
|
||||
int k1 = ExtMath.floord(d8 + d10 / 2.0D);
|
||||
|
||||
for (int l1 = j; l1 <= i1; ++l1)
|
||||
{
|
||||
double d12 = ((double)l1 + 0.5D - d6) / (d10 / 2.0D);
|
||||
|
||||
if (d12 * d12 < 1.0D)
|
||||
{
|
||||
for (int i2 = k; i2 <= j1; ++i2)
|
||||
{
|
||||
double d13 = ((double)i2 + 0.5D - d7) / (d11 / 2.0D);
|
||||
|
||||
if (d12 * d12 + d13 * d13 < 1.0D)
|
||||
{
|
||||
for (int j2 = l; j2 <= k1; ++j2)
|
||||
{
|
||||
double d14 = ((double)j2 + 0.5D - d8) / (d10 / 2.0D);
|
||||
|
||||
if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D)
|
||||
{
|
||||
BlockPos blockpos = position.add(l1, i2, j2); // new BlockPos(l1, i2, j2);
|
||||
|
||||
if (worldIn.getState(blockpos).getBlock() == replace)
|
||||
{
|
||||
worldIn.setState(blockpos, this.oreBlock, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,200 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.rng.OctaveGen;
|
||||
import common.rng.Random;
|
||||
import common.util.ExtMath;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class GeneratorCavern implements ChunkGenerator
|
||||
{
|
||||
private final OctaveGen noiseGen2;
|
||||
private final OctaveGen noiseGen3;
|
||||
private final OctaveGen noiseGen1;
|
||||
// private final OctaveGen noiseGen4;
|
||||
// private final OctaveGen noiseGen5;
|
||||
|
||||
private final double[] noiseField = new double[425];
|
||||
private final double[] noiseData1 = new double[425];
|
||||
private final double[] noiseData2 = new double[425];
|
||||
private final double[] noiseData3 = new double[425];
|
||||
// private final double[] noiseData4 = new double[25];
|
||||
// private final double[] noiseData5 = new double[25];
|
||||
|
||||
private final State filler;
|
||||
private final State liquid;
|
||||
|
||||
// public GeneratorCavern(Dimension dim, Random rand) {
|
||||
// this(rand);
|
||||
// }
|
||||
|
||||
public GeneratorCavern(Random rand, State filler, State liquid)
|
||||
{
|
||||
this.noiseGen2 = new OctaveGen(rand, 16);
|
||||
this.noiseGen3 = new OctaveGen(rand, 16);
|
||||
this.noiseGen1 = new OctaveGen(rand, 8);
|
||||
// this.noiseGen4 = new OctaveGen(rand, 10);
|
||||
// this.noiseGen5 = new OctaveGen(rand, 16);
|
||||
this.filler = filler;
|
||||
this.liquid = liquid;
|
||||
}
|
||||
|
||||
public int getMaximumHeight() {
|
||||
return 128;
|
||||
}
|
||||
|
||||
public void generateChunk(AWorldServer world, int x, int z, ChunkPrimer primer)
|
||||
{
|
||||
int range = 4;
|
||||
int lh = world.getSeaLevel() / 2 + 1;
|
||||
int xr = range + 1;
|
||||
int yr = 17;
|
||||
int zr = range + 1;
|
||||
this.genNoisemap(x * range, 0, z * range);
|
||||
|
||||
for (int j1 = 0; j1 < range; ++j1)
|
||||
{
|
||||
for (int k1 = 0; k1 < range; ++k1)
|
||||
{
|
||||
for (int l1 = 0; l1 < 16; ++l1)
|
||||
{
|
||||
double d0 = 0.125D;
|
||||
double d1 = this.noiseField[((j1 + 0) * zr + k1 + 0) * yr + l1 + 0];
|
||||
double d2 = this.noiseField[((j1 + 0) * zr + k1 + 1) * yr + l1 + 0];
|
||||
double d3 = this.noiseField[((j1 + 1) * zr + k1 + 0) * yr + l1 + 0];
|
||||
double d4 = this.noiseField[((j1 + 1) * zr + k1 + 1) * yr + l1 + 0];
|
||||
double d5 = (this.noiseField[((j1 + 0) * zr + k1 + 0) * yr + l1 + 1] - d1) * d0;
|
||||
double d6 = (this.noiseField[((j1 + 0) * zr + k1 + 1) * yr + l1 + 1] - d2) * d0;
|
||||
double d7 = (this.noiseField[((j1 + 1) * zr + k1 + 0) * yr + l1 + 1] - d3) * d0;
|
||||
double d8 = (this.noiseField[((j1 + 1) * zr + k1 + 1) * yr + l1 + 1] - d4) * d0;
|
||||
|
||||
for (int i2 = 0; i2 < 8; ++i2)
|
||||
{
|
||||
double d9 = 0.25D;
|
||||
double d10 = d1;
|
||||
double d11 = d2;
|
||||
double d12 = (d3 - d1) * d9;
|
||||
double d13 = (d4 - d2) * d9;
|
||||
|
||||
for (int j2 = 0; j2 < 4; ++j2)
|
||||
{
|
||||
double d14 = 0.25D;
|
||||
double d15 = d10;
|
||||
double d16 = (d11 - d10) * d14;
|
||||
|
||||
for (int k2 = 0; k2 < 4; ++k2)
|
||||
{
|
||||
State iblockstate = null;
|
||||
|
||||
if (l1 * 8 + i2 < lh)
|
||||
{
|
||||
iblockstate = this.liquid;
|
||||
}
|
||||
|
||||
if (d15 > 0.0D)
|
||||
{
|
||||
iblockstate = this.filler;
|
||||
}
|
||||
|
||||
int l2 = j2 + j1 * 4;
|
||||
int i3 = i2 + l1 * 8;
|
||||
int j3 = k2 + k1 * 4;
|
||||
primer.set(l2, i3, j3, iblockstate);
|
||||
d15 += d16;
|
||||
}
|
||||
|
||||
d10 += d12;
|
||||
d11 += d13;
|
||||
}
|
||||
|
||||
d1 += d5;
|
||||
d2 += d6;
|
||||
d3 += d7;
|
||||
d4 += d8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void genNoisemap(int x, int y, int z)
|
||||
{
|
||||
int xs = 5;
|
||||
int ys = 17;
|
||||
int zs = 5;
|
||||
double d0 = 684.412D;
|
||||
double d1 = 2053.236D;
|
||||
// this.noiseGen4.generate(this.noiseData4, x, y, z, xs, 1, zs, 1.0D, 0.0D, 1.0D);
|
||||
// this.noiseGen5.generate(this.noiseData5, x, y, z, xs, 1, zs, 100.0D, 0.0D, 100.0D);
|
||||
this.noiseGen1.generate(this.noiseData1, x, y, z, xs, ys, zs, d0 / 80.0D, d1 / 60.0D, d0 / 80.0D);
|
||||
this.noiseGen2.generate(this.noiseData2, x, y, z, xs, ys, zs, d0, d1, d0);
|
||||
this.noiseGen3.generate(this.noiseData3, x, y, z, xs, ys, zs, d0, d1, d0);
|
||||
int i = 0;
|
||||
double[] adouble = new double[ys];
|
||||
|
||||
for (int j = 0; j < ys; ++j)
|
||||
{
|
||||
adouble[j] = Math.cos((double)j * Math.PI * 6.0D / (double)ys) * 2.0D;
|
||||
double d2 = (double)j;
|
||||
|
||||
if (j > ys / 2)
|
||||
{
|
||||
d2 = (double)(ys - 1 - j);
|
||||
}
|
||||
|
||||
if (d2 < 4.0D)
|
||||
{
|
||||
d2 = 4.0D - d2;
|
||||
adouble[j] -= d2 * d2 * d2 * 10.0D;
|
||||
}
|
||||
}
|
||||
|
||||
for (int l = 0; l < xs; ++l)
|
||||
{
|
||||
for (int i1 = 0; i1 < zs; ++i1)
|
||||
{
|
||||
double d3 = 0.0D;
|
||||
|
||||
for (int k = 0; k < ys; ++k)
|
||||
{
|
||||
double d4 = 0.0D;
|
||||
double d5 = adouble[k];
|
||||
double d6 = this.noiseData2[i] / 512.0D;
|
||||
double d7 = this.noiseData3[i] / 512.0D;
|
||||
double d8 = (this.noiseData1[i] / 10.0D + 1.0D) / 2.0D;
|
||||
|
||||
if (d8 < 0.0D)
|
||||
{
|
||||
d4 = d6;
|
||||
}
|
||||
else if (d8 > 1.0D)
|
||||
{
|
||||
d4 = d7;
|
||||
}
|
||||
else
|
||||
{
|
||||
d4 = d6 + (d7 - d6) * d8;
|
||||
}
|
||||
|
||||
d4 = d4 - d5;
|
||||
|
||||
if (k > ys - 4)
|
||||
{
|
||||
double d9 = (double)((float)(k - (ys - 4)) / 3.0F);
|
||||
d4 = d4 * (1.0D - d9) + -10.0D * d9;
|
||||
}
|
||||
|
||||
if ((double)k < d3)
|
||||
{
|
||||
double d10 = (d3 - (double)k) / 4.0D;
|
||||
d10 = ExtMath.clampd(d10, 0.0D, 1.0D);
|
||||
d4 = d4 * (1.0D - d10) + -10.0D * d10;
|
||||
}
|
||||
|
||||
this.noiseField[i] = d4;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class GeneratorDestroyed implements ChunkGenerator
|
||||
{
|
||||
private final State block = Blocks.coal_block.getState();
|
||||
private final State alt = Blocks.soul_sand.getState();
|
||||
private final State gap = Blocks.air.getState();
|
||||
private final State liquid = Blocks.lava.getState();
|
||||
private final State top = Blocks.obsidian.getState();
|
||||
private final int height;
|
||||
private final Random rand = new Random(); // NON-DETERMINISTIC!!
|
||||
|
||||
public GeneratorDestroyed(int height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public int getMaximumHeight() {
|
||||
return this.height;
|
||||
}
|
||||
|
||||
public void generateChunk(AWorldServer world, int x, int z, ChunkPrimer primer)
|
||||
{
|
||||
for(int by = 0; by < this.height; ++by) {
|
||||
for(int bx = 0; bx < 16; ++bx) {
|
||||
for(int bz = 0; bz < 16; ++bz) {
|
||||
primer.set(bx, by, bz, by >= this.height - this.rand.zrange(3) ? this.gap :
|
||||
(by == this.height - 1 ? this.top : this.rand.chance(this.block, (by == this.height - 3 ?
|
||||
this.liquid : this.alt), 15)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class GeneratorFlat implements ChunkGenerator {
|
||||
private final State[] layers;
|
||||
|
||||
public GeneratorFlat(State ... layers) {
|
||||
this.layers = layers;
|
||||
}
|
||||
|
||||
public GeneratorFlat(int height, State layer) {
|
||||
this.layers = new State[height];
|
||||
Arrays.fill(this.layers, layer);
|
||||
}
|
||||
|
||||
// public GeneratorFlat(GeneratorSettings settings)
|
||||
// {
|
||||
// int layers = 0;
|
||||
// for(FlatSettings layer : settings.flatLayers) {
|
||||
// layers += layer.height;
|
||||
// }
|
||||
// layers = layers > 512 ? 512 : layers;
|
||||
// this.flatLayers = new IBlockState[layers];
|
||||
// int pos = 0;
|
||||
// for(FlatSettings layer : settings.flatLayers) {
|
||||
// for(int z = 0; z < layer.height; z++) {
|
||||
// this.flatLayers[pos++] = layer.state;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
public int getMaximumHeight() {
|
||||
return this.layers.length;
|
||||
}
|
||||
|
||||
public void generateChunk(AWorldServer world, int x, int z, ChunkPrimer primer) {
|
||||
for(int by = 0; by < this.layers.length; by++) {
|
||||
State state = this.layers[by];
|
||||
for(int bx = 0; bx < 16; bx++) {
|
||||
for(int bz = 0; bz < 16; bz++) {
|
||||
primer.set(bx, by, bz, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,190 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.rng.OctaveGen;
|
||||
import common.rng.Random;
|
||||
import common.util.ExtMath;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class GeneratorIsland implements ChunkGenerator
|
||||
{
|
||||
private final OctaveGen noiseGen1;
|
||||
private final OctaveGen noiseGen2;
|
||||
private final OctaveGen noiseGen3;
|
||||
private final OctaveGen noiseGen4;
|
||||
private final OctaveGen noiseGen5;
|
||||
|
||||
private final double[] densities = new double[297];
|
||||
private final double[] noiseData1 = new double[297];
|
||||
private final double[] noiseData2 = new double[297];
|
||||
private final double[] noiseData3 = new double[297];
|
||||
private final double[] noiseData4 = new double[9];
|
||||
private final double[] noiseData5 = new double[9];
|
||||
|
||||
private final State filler;
|
||||
|
||||
// public GeneratorIsland(Dimension dim, Random rand) {
|
||||
// this(rand, dim.getFiller());
|
||||
// }
|
||||
|
||||
public GeneratorIsland(Random rand, State filler)
|
||||
{
|
||||
this.noiseGen1 = new OctaveGen(rand, 16);
|
||||
this.noiseGen2 = new OctaveGen(rand, 16);
|
||||
this.noiseGen3 = new OctaveGen(rand, 8);
|
||||
this.noiseGen4 = new OctaveGen(rand, 10);
|
||||
this.noiseGen5 = new OctaveGen(rand, 16);
|
||||
this.filler = filler;
|
||||
}
|
||||
|
||||
public int getMaximumHeight() {
|
||||
return 128;
|
||||
}
|
||||
|
||||
public void generateChunk(AWorldServer world, int x, int z, ChunkPrimer primer)
|
||||
{
|
||||
int range = 2;
|
||||
int xr = range + 1;
|
||||
int yr = 33;
|
||||
int zr = range + 1;
|
||||
this.genNoisemap(x * range, 0, z * range);
|
||||
|
||||
for (int i1 = 0; i1 < range; ++i1)
|
||||
{
|
||||
for (int j1 = 0; j1 < range; ++j1)
|
||||
{
|
||||
for (int k1 = 0; k1 < 32; ++k1)
|
||||
{
|
||||
double d0 = 0.25D;
|
||||
double d1 = this.densities[((i1 + 0) * zr + j1 + 0) * yr + k1 + 0];
|
||||
double d2 = this.densities[((i1 + 0) * zr + j1 + 1) * yr + k1 + 0];
|
||||
double d3 = this.densities[((i1 + 1) * zr + j1 + 0) * yr + k1 + 0];
|
||||
double d4 = this.densities[((i1 + 1) * zr + j1 + 1) * yr + k1 + 0];
|
||||
double d5 = (this.densities[((i1 + 0) * zr + j1 + 0) * yr + k1 + 1] - d1) * d0;
|
||||
double d6 = (this.densities[((i1 + 0) * zr + j1 + 1) * yr + k1 + 1] - d2) * d0;
|
||||
double d7 = (this.densities[((i1 + 1) * zr + j1 + 0) * yr + k1 + 1] - d3) * d0;
|
||||
double d8 = (this.densities[((i1 + 1) * zr + j1 + 1) * yr + k1 + 1] - d4) * d0;
|
||||
|
||||
for (int l1 = 0; l1 < 4; ++l1)
|
||||
{
|
||||
double d9 = 0.125D;
|
||||
double d10 = d1;
|
||||
double d11 = d2;
|
||||
double d12 = (d3 - d1) * d9;
|
||||
double d13 = (d4 - d2) * d9;
|
||||
|
||||
for (int i2 = 0; i2 < 8; ++i2)
|
||||
{
|
||||
double d14 = 0.125D;
|
||||
double d15 = d10;
|
||||
double d16 = (d11 - d10) * d14;
|
||||
|
||||
for (int j2 = 0; j2 < 8; ++j2)
|
||||
{
|
||||
State iblockstate = null;
|
||||
|
||||
if (d15 > 0.0D)
|
||||
{
|
||||
iblockstate = this.filler;
|
||||
}
|
||||
|
||||
int k2 = i2 + i1 * 8;
|
||||
int l2 = l1 + k1 * 4;
|
||||
int i3 = j2 + j1 * 8;
|
||||
primer.set(k2, l2, i3, iblockstate);
|
||||
d15 += d16;
|
||||
}
|
||||
|
||||
d10 += d12;
|
||||
d11 += d13;
|
||||
}
|
||||
|
||||
d1 += d5;
|
||||
d2 += d6;
|
||||
d3 += d7;
|
||||
d4 += d8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void genNoisemap(int x, int y, int z)
|
||||
{
|
||||
int xs = 3;
|
||||
int ys = 33;
|
||||
int zs = 3;
|
||||
double d0 = 684.412D;
|
||||
double d1 = 684.412D;
|
||||
this.noiseGen4.generate(this.noiseData4, x, z, xs, zs, 1.121D, 1.121D, 0.5D);
|
||||
this.noiseGen5.generate(this.noiseData5, x, z, xs, zs, 200.0D, 200.0D, 0.5D);
|
||||
d0 = d0 * 2.0D;
|
||||
this.noiseGen3.generate(this.noiseData1, x, y, z, xs, ys, zs, d0 / 80.0D, d1 / 160.0D, d0 / 80.0D);
|
||||
this.noiseGen1.generate(this.noiseData2, x, y, z, xs, ys, zs, d0, d1, d0);
|
||||
this.noiseGen2.generate(this.noiseData3, x, y, z, xs, ys, zs, d0, d1, d0);
|
||||
int i = 0;
|
||||
|
||||
for (int j = 0; j < xs; ++j)
|
||||
{
|
||||
for (int k = 0; k < zs; ++k)
|
||||
{
|
||||
float f = (float)(j + x) / 1.0F;
|
||||
float f1 = (float)(k + z) / 1.0F;
|
||||
float f2 = 100.0F - ExtMath.sqrtf(f * f + f1 * f1) * 8.0F;
|
||||
|
||||
if (f2 > 80.0F)
|
||||
{
|
||||
f2 = 80.0F;
|
||||
}
|
||||
|
||||
if (f2 < -100.0F)
|
||||
{
|
||||
f2 = -100.0F;
|
||||
}
|
||||
|
||||
for (int l = 0; l < ys; ++l)
|
||||
{
|
||||
double d2 = 0.0D;
|
||||
double d3 = this.noiseData2[i] / 512.0D;
|
||||
double d4 = this.noiseData3[i] / 512.0D;
|
||||
double d5 = (this.noiseData1[i] / 10.0D + 1.0D) / 2.0D;
|
||||
|
||||
if (d5 < 0.0D)
|
||||
{
|
||||
d2 = d3;
|
||||
}
|
||||
else if (d5 > 1.0D)
|
||||
{
|
||||
d2 = d4;
|
||||
}
|
||||
else
|
||||
{
|
||||
d2 = d3 + (d4 - d3) * d5;
|
||||
}
|
||||
|
||||
d2 = d2 - 8.0D;
|
||||
d2 = d2 + (double)f2;
|
||||
int i1 = 2;
|
||||
|
||||
if (l > ys / 2 - i1)
|
||||
{
|
||||
double d6 = (double)((float)(l - (ys / 2 - i1)) / 64.0F);
|
||||
d6 = ExtMath.clampd(d6, 0.0D, 1.0D);
|
||||
d2 = d2 * (1.0D - d6) + -3000.0D * d6;
|
||||
}
|
||||
|
||||
i1 = 8;
|
||||
|
||||
if (l < i1)
|
||||
{
|
||||
double d7 = (double)((float)(i1 - l) / ((float)i1 - 1.0F));
|
||||
d2 = d2 * (1.0D - d7) + -30.0D * d7;
|
||||
}
|
||||
|
||||
this.densities[i] = d2;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,296 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.dimension.Dimension;
|
||||
import common.rng.NoiseGen;
|
||||
import common.rng.OctaveGen;
|
||||
import common.rng.Random;
|
||||
import common.util.ExtMath;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class GeneratorPerlin implements ChunkGenerator
|
||||
{
|
||||
private static final float[] PARABOLIC = new float[25];
|
||||
|
||||
static {
|
||||
for (int x = -2; x <= 2; ++x)
|
||||
{
|
||||
for (int z = -2; z <= 2; ++z)
|
||||
{
|
||||
float v = 10.0F / ExtMath.sqrtf((float)(x * x + z * z) + 0.2F);
|
||||
PARABOLIC[x + 2 + (z + 2) * 5] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final NoiseGen lowerNoiseGen;
|
||||
private final NoiseGen upperNoiseGen;
|
||||
private final NoiseGen mainNoiseGen;
|
||||
private final NoiseGen depthNoiseGen;
|
||||
private final State block;
|
||||
private final State liquid;
|
||||
private final float coordinateScale;
|
||||
private final float heightScale;
|
||||
private final float upperLimitScale;
|
||||
private final float lowerLimitScale;
|
||||
private final float depthNoiseScaleX;
|
||||
private final float depthNoiseScaleZ;
|
||||
private final float amplification;
|
||||
private final float mainNoiseScaleX;
|
||||
private final float mainNoiseScaleY;
|
||||
private final float mainNoiseScaleZ;
|
||||
private final float baseSize;
|
||||
private final float stretchY;
|
||||
private final float biomeDepthWeight;
|
||||
private final float biomeDepthOffset;
|
||||
private final float biomeScaleWeight;
|
||||
private final float biomeScaleOffset;
|
||||
private final double[] noiseTable = new double[825];
|
||||
private final double[] mainNoise = new double[825];
|
||||
private final double[] lowerNoise = new double[825];
|
||||
private final double[] upperNoise = new double[825];
|
||||
private final double[] depthNoise = new double[25];
|
||||
private final Biome[] biomes = new Biome[100];
|
||||
|
||||
// public GeneratorNew(Random rand, GeneratorSettings settings)
|
||||
// {
|
||||
// this(rand, settings.farlands, settings.seaLevel, Blocks.stone.getDefaultState(),
|
||||
// settings.useLavaSeas ? Blocks.lava.getDefaultState() : Blocks.water.getDefaultState(),
|
||||
// settings.coordinateScale, settings.heightScale, settings.upperLimitScale, settings.lowerLimitScale,
|
||||
// settings.depthNoiseScaleX, settings.depthNoiseScaleZ, settings.amplification, settings.mainNoiseScaleX,
|
||||
// settings.mainNoiseScaleY, settings.mainNoiseScaleZ, settings.baseSize, settings.stretchY, settings.biomeDepthWeight,
|
||||
// settings.biomeDepthOffset, settings.biomeScaleWeight, settings.biomeScaleOffset);
|
||||
// }
|
||||
|
||||
public GeneratorPerlin(Random rand, State block, State liquid, Dimension.GeneratorSettings settings) {
|
||||
this(rand, /* dim.hasFarLands(), dim.getSeaLevel(), */ block, liquid,
|
||||
settings.coordinateScale, settings.heightScale, settings.upperLimitScale, settings.lowerLimitScale,
|
||||
settings.depthNoiseScaleX, settings.depthNoiseScaleZ, settings.amplification, settings.mainNoiseScaleX,
|
||||
settings.mainNoiseScaleY, settings.mainNoiseScaleZ, settings.baseSize, settings.stretchY, settings.biomeDepthWeight,
|
||||
settings.biomeDepthOffset, settings.biomeScaleWeight, settings.biomeScaleOffset);
|
||||
// 684.412F, 684.412F, 512.0F, 512.0F, 200.0F, 200.0F, 0.0F, 80.0F, 160.0F, 80.0F, 8.5F, 12.0F, 1.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
private GeneratorPerlin(Random rand, /* boolean farlands, int seaLevel, */ State block, State liquid,
|
||||
float coordinateScale, float heightScale, float upperLimitScale, float lowerLimitScale, float depthNoiseScaleX,
|
||||
float depthNoiseScaleZ, float amplification, float mainNoiseScaleX, float mainNoiseScaleY, float mainNoiseScaleZ,
|
||||
float baseSize, float stretchY, float biomeDepthWeight, float biomeDepthOffset, float biomeScaleWeight, float biomeScaleOffset)
|
||||
{
|
||||
this.lowerNoiseGen = /* farlands ? new OctaveGenOld(rand, 16) : */ new OctaveGen(rand, 16);
|
||||
this.upperNoiseGen = /* farlands ? new OctaveGenOld(rand, 16) : */ new OctaveGen(rand, 16);
|
||||
this.mainNoiseGen = /* farlands ? new OctaveGenOld(rand, 8) : */ new OctaveGen(rand, 8);
|
||||
this.depthNoiseGen = /* farlands ? new OctaveGenOld(rand, 16) : */ new OctaveGen(rand, 16);
|
||||
this.liquid = liquid;
|
||||
this.block = block;
|
||||
this.coordinateScale = coordinateScale;
|
||||
this.heightScale = heightScale;
|
||||
this.upperLimitScale = upperLimitScale;
|
||||
this.lowerLimitScale = lowerLimitScale;
|
||||
this.depthNoiseScaleX = depthNoiseScaleX;
|
||||
this.depthNoiseScaleZ = depthNoiseScaleZ;
|
||||
this.amplification = amplification;
|
||||
this.mainNoiseScaleX = mainNoiseScaleX;
|
||||
this.mainNoiseScaleY = mainNoiseScaleY;
|
||||
this.mainNoiseScaleZ = mainNoiseScaleZ;
|
||||
this.baseSize = baseSize;
|
||||
this.stretchY = stretchY;
|
||||
this.biomeDepthWeight = biomeDepthWeight;
|
||||
this.biomeDepthOffset = biomeDepthOffset;
|
||||
this.biomeScaleWeight = biomeScaleWeight;
|
||||
this.biomeScaleOffset = biomeScaleOffset;
|
||||
}
|
||||
|
||||
public int getMaximumHeight() {
|
||||
return 256;
|
||||
}
|
||||
|
||||
public void generateChunk(AWorldServer world, int x, int z, ChunkPrimer primer)
|
||||
{
|
||||
int sea = world.getSeaLevel();
|
||||
world.getBiomeGenerator().getGenBiomes(this.biomes, x * 4 - 2, z * 4 - 2, 10, 10);
|
||||
this.genNoisemap(x * 4, 0, z * 4);
|
||||
|
||||
for (int xb = 0; xb < 4; ++xb)
|
||||
{
|
||||
int x1 = xb * 5;
|
||||
int x2 = (xb + 1) * 5;
|
||||
|
||||
for (int zb = 0; zb < 4; ++zb)
|
||||
{
|
||||
int xz1 = (x1 + zb) * 33;
|
||||
int xz2 = (x1 + zb + 1) * 33;
|
||||
int xz3 = (x2 + zb) * 33;
|
||||
int xz4 = (x2 + zb + 1) * 33;
|
||||
|
||||
for (int yb = 0; yb < 32; ++yb)
|
||||
{
|
||||
double mul1 = 0.125D;
|
||||
double m1 = this.noiseTable[xz1 + yb];
|
||||
double m2 = this.noiseTable[xz2 + yb];
|
||||
double m3 = this.noiseTable[xz3 + yb];
|
||||
double m4 = this.noiseTable[xz4 + yb];
|
||||
double n1 = (this.noiseTable[xz1 + yb + 1] - m1) * mul1;
|
||||
double n2 = (this.noiseTable[xz2 + yb + 1] - m2) * mul1;
|
||||
double n3 = (this.noiseTable[xz3 + yb + 1] - m3) * mul1;
|
||||
double n4 = (this.noiseTable[xz4 + yb + 1] - m4) * mul1;
|
||||
|
||||
for (int ys = 0; ys < 8; ++ys)
|
||||
{
|
||||
double mul2 = 0.25D;
|
||||
double o1 = m1;
|
||||
double o2 = m2;
|
||||
double o3 = (m3 - m1) * mul2;
|
||||
double o4 = (m4 - m2) * mul2;
|
||||
|
||||
for (int xs = 0; xs < 4; ++xs)
|
||||
{
|
||||
double mul3 = 0.25D;
|
||||
double step = (o2 - o1) * mul3;
|
||||
double val = o1 - step;
|
||||
|
||||
for (int zs = 0; zs < 4; ++zs)
|
||||
{
|
||||
if ((val += step) > 0.0D)
|
||||
{
|
||||
primer.set(xb * 4 + xs, yb * 8 + ys, zb * 4 + zs, this.block);
|
||||
}
|
||||
else if (yb * 8 + ys < sea)
|
||||
{
|
||||
primer.set(xb * 4 + xs, yb * 8 + ys, zb * 4 + zs, this.liquid);
|
||||
}
|
||||
}
|
||||
|
||||
o1 += o3;
|
||||
o2 += o4;
|
||||
}
|
||||
|
||||
m1 += n1;
|
||||
m2 += n2;
|
||||
m3 += n3;
|
||||
m4 += n4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void genNoisemap(int x, int y, int z)
|
||||
{
|
||||
this.depthNoiseGen.generate(this.depthNoise, x, z, 5, 5, (double)this.depthNoiseScaleX, (double)this.depthNoiseScaleZ, 0.5);
|
||||
float scale = this.coordinateScale;
|
||||
float height = this.heightScale;
|
||||
this.mainNoiseGen.generate(this.mainNoise, x, y, z, 5, 33, 5, (double)(scale / this.mainNoiseScaleX), (double)(height / this.mainNoiseScaleY), (double)(scale / this.mainNoiseScaleZ));
|
||||
this.lowerNoiseGen.generate(this.lowerNoise, x, y, z, 5, 33, 5, (double)scale, (double)height, (double)scale);
|
||||
this.upperNoiseGen.generate(this.upperNoise, x, y, z, 5, 33, 5, (double)scale, (double)height, (double)scale);
|
||||
z = 0;
|
||||
x = 0;
|
||||
int pos = 0;
|
||||
int dpos = 0;
|
||||
|
||||
for (int u = 0; u < 5; ++u)
|
||||
{
|
||||
for (int v = 0; v < 5; ++v)
|
||||
{
|
||||
float max = 0.0F;
|
||||
float min = 0.0F;
|
||||
float sum = 0.0F;
|
||||
int range = 2;
|
||||
Biome biome = this.biomes[u + 2 + (v + 2) * 10];
|
||||
|
||||
for (int a = -range; a <= range; ++a)
|
||||
{
|
||||
for (int b = -range; b <= range; ++b)
|
||||
{
|
||||
Biome biome2 = this.biomes[u + a + 2 + (v + b + 2) * 10];
|
||||
float bmin = this.biomeDepthOffset + biome2.depth * this.biomeDepthWeight;
|
||||
float bmax = this.biomeScaleOffset + biome2.scale * this.biomeScaleWeight;
|
||||
|
||||
if (this.amplification > 0.0F && bmin > 0.0F)
|
||||
{
|
||||
bmin = 1.0F + bmin * this.amplification;
|
||||
bmax = 1.0F + bmax * this.amplification * 2.0F;
|
||||
}
|
||||
|
||||
float fact = PARABOLIC[a + 2 + (b + 2) * 5] / (bmin + 2.0F);
|
||||
|
||||
if (biome2.depth > biome.depth)
|
||||
{
|
||||
fact /= 2.0F;
|
||||
}
|
||||
|
||||
max += bmax * fact;
|
||||
min += bmin * fact;
|
||||
sum += fact;
|
||||
}
|
||||
}
|
||||
|
||||
max = max / sum;
|
||||
min = min / sum;
|
||||
max = max * 0.9F + 0.1F;
|
||||
min = (min * 4.0F - 1.0F) / 8.0F;
|
||||
double depth = this.depthNoise[dpos] / 8000.0D;
|
||||
|
||||
if (depth < 0.0D)
|
||||
{
|
||||
depth = -depth * 0.3D;
|
||||
}
|
||||
|
||||
depth = depth * 3.0D - 2.0D;
|
||||
|
||||
if (depth < 0.0D)
|
||||
{
|
||||
depth = depth / 2.0D;
|
||||
|
||||
if (depth < -1.0D)
|
||||
{
|
||||
depth = -1.0D;
|
||||
}
|
||||
|
||||
depth = depth / 1.4D;
|
||||
depth = depth / 2.0D;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (depth > 1.0D)
|
||||
{
|
||||
depth = 1.0D;
|
||||
}
|
||||
|
||||
depth = depth / 8.0D;
|
||||
}
|
||||
|
||||
++dpos;
|
||||
double low = (double)min;
|
||||
double high = (double)max;
|
||||
low = low + depth * 0.2D;
|
||||
low = low * (double)this.baseSize / 8.0D;
|
||||
double shift = (double)this.baseSize + low * 4.0D;
|
||||
|
||||
for (int w = 0; w < 33; ++w)
|
||||
{
|
||||
double damp = ((double)w - shift) * (double)this.stretchY * 128.0D / 256.0D / high;
|
||||
|
||||
if (damp < 0.0D)
|
||||
{
|
||||
damp *= 4.0D;
|
||||
}
|
||||
|
||||
double lower = this.lowerNoise[pos] / (double)this.lowerLimitScale;
|
||||
double upper = this.upperNoise[pos] / (double)this.upperLimitScale;
|
||||
double base = (this.mainNoise[pos] / 10.0D + 1.0D) / 2.0D;
|
||||
double noise = (base < 0.0D ? lower : (base > 1.0D ? upper : lower + (upper - lower) * base)) - damp;
|
||||
|
||||
if (w > 29)
|
||||
{
|
||||
double attn = (double)((float)(w - 29) / 3.0F);
|
||||
noise = noise * (1.0D - attn) + -10.0D * attn;
|
||||
}
|
||||
|
||||
this.noiseTable[pos] = noise;
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,235 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.rng.NoiseGen;
|
||||
import common.rng.OctaveGen;
|
||||
import common.rng.Random;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class GeneratorSimple implements ChunkGenerator
|
||||
{
|
||||
private final BiomeGenPerlin biomeGen;
|
||||
private final NoiseGen lowerNoiseGen;
|
||||
private final NoiseGen upperNoiseGen;
|
||||
private final NoiseGen mainNoiseGen;
|
||||
private final NoiseGen biomeNoiseGen;
|
||||
private final NoiseGen depthNoiseGen;
|
||||
|
||||
private final State filler;
|
||||
private final State liquid;
|
||||
private final double noiseTable[] = new double[425];
|
||||
private final double mainNoise[] = new double[425];
|
||||
private final double lowerNoise[] = new double[425];
|
||||
private final double upperNoise[] = new double[425];
|
||||
private final double biomeNoise[] = new double[25];
|
||||
private final double depthNoise[] = new double[25];
|
||||
private final double[] factors = new double[256];
|
||||
|
||||
// public GeneratorSimple(long seed, Random rand, GeneratorSettings settings)
|
||||
// {
|
||||
// this(rand, settings.farlands, Blocks.stone.getDefaultState(),
|
||||
// settings.useLavaSeas ? Blocks.lava.getDefaultState() : Blocks.water.getDefaultState(),
|
||||
// settings.biomeMode == 2 ? new BiomeGenPerlin(seed) : null);
|
||||
// }
|
||||
|
||||
// public GeneratorSimple(Dimension dim, Random rand)
|
||||
// {
|
||||
// this(rand, /* dim.hasFarLands(), */ dim.getFiller(), dim.getLiquid(),
|
||||
// dim.hasBiomes() ? null : new BiomeGenPerlin(rand.longv()));
|
||||
// }
|
||||
|
||||
public GeneratorSimple(Random rand, /* boolean farlands, */ State filler, State liquid, BiomeGenPerlin biomeGen)
|
||||
{
|
||||
this.lowerNoiseGen = /* farlands ? new OctaveGenOld(rand, 16) : */ new OctaveGen(rand, 16);
|
||||
this.upperNoiseGen = /* farlands ? new OctaveGenOld(rand, 16) : */ new OctaveGen(rand, 16);
|
||||
this.mainNoiseGen = /* farlands ? new OctaveGenOld(rand, 8) : */ new OctaveGen(rand, 8);
|
||||
this.biomeNoiseGen = /* farlands ? new OctaveGenOld(rand, 10) : */ new OctaveGen(rand, 10);
|
||||
this.depthNoiseGen = /* farlands ? new OctaveGenOld(rand, 16) : */ new OctaveGen(rand, 16);
|
||||
this.filler = filler;
|
||||
this.liquid = liquid;
|
||||
this.biomeGen = biomeGen;
|
||||
}
|
||||
|
||||
public int getMaximumHeight() {
|
||||
return 128;
|
||||
}
|
||||
|
||||
public void generateChunk(AWorldServer world, int x, int z, ChunkPrimer primer)
|
||||
{
|
||||
if(this.biomeGen == null)
|
||||
world.getBiomeGenerator().genFactors(this.factors, x * 16, z * 16, 16, 16);
|
||||
else
|
||||
this.biomeGen.generate(this.factors, x, z);
|
||||
byte range = 4;
|
||||
int sea = world.getSeaLevel();
|
||||
int xr = range + 1;
|
||||
byte yr = 17;
|
||||
int zr = range + 1;
|
||||
this.genNoisemap(x * range, 0, z * range);
|
||||
for(int xb = 0; xb < range; xb++)
|
||||
{
|
||||
for(int zb = 0; zb < range; zb++)
|
||||
{
|
||||
for(int yb = 0; yb < 16; yb++)
|
||||
{
|
||||
double mul1 = 0.125D;
|
||||
double d1 = this.noiseTable[((xb + 0) * zr + (zb + 0)) * yr + (yb + 0)];
|
||||
double d2 = this.noiseTable[((xb + 0) * zr + (zb + 1)) * yr + (yb + 0)];
|
||||
double d3 = this.noiseTable[((xb + 1) * zr + (zb + 0)) * yr + (yb + 0)];
|
||||
double d4 = this.noiseTable[((xb + 1) * zr + (zb + 1)) * yr + (yb + 0)];
|
||||
double d5 = (this.noiseTable[((xb + 0) * zr + (zb + 0)) * yr + (yb + 1)] - d1) * mul1;
|
||||
double d6 = (this.noiseTable[((xb + 0) * zr + (zb + 1)) * yr + (yb + 1)] - d2) * mul1;
|
||||
double d7 = (this.noiseTable[((xb + 1) * zr + (zb + 0)) * yr + (yb + 1)] - d3) * mul1;
|
||||
double d8 = (this.noiseTable[((xb + 1) * zr + (zb + 1)) * yr + (yb + 1)] - d4) * mul1;
|
||||
for(int ys = 0; ys < 8; ys++)
|
||||
{
|
||||
double mul2 = 0.25D;
|
||||
double n1 = d1;
|
||||
double n2 = d2;
|
||||
double n3 = (d3 - d1) * mul2;
|
||||
double n4 = (d4 - d2) * mul2;
|
||||
for(int xs = 0; xs < 4; xs++)
|
||||
{
|
||||
// int off = xs + xb * 4 << 11 | 0 + zb * 4 << 7 | yb * 8 + ys;
|
||||
// char zo = '\200';
|
||||
double mul3 = 0.25D;
|
||||
double val = n1;
|
||||
double step = (n2 - n1) * mul3;
|
||||
for(int zs = 0; zs < 4; zs++)
|
||||
{
|
||||
if(val > 0.0D)
|
||||
{
|
||||
primer.set(xs + xb * 4, ys + yb * 8, zs + zb * 4, this.filler);
|
||||
// primer.setBlockStateLegacy(off, this.filler);
|
||||
}
|
||||
else if(yb * 8 + ys < sea)
|
||||
{
|
||||
primer.set(xs + xb * 4, ys + yb * 8, zs + zb * 4, this.liquid);
|
||||
// primer.setBlockStateLegacy(off, this.liquid);
|
||||
}
|
||||
// off += zo;
|
||||
val += step;
|
||||
}
|
||||
|
||||
n1 += n3;
|
||||
n2 += n4;
|
||||
}
|
||||
|
||||
d1 += d5;
|
||||
d2 += d6;
|
||||
d3 += d7;
|
||||
d4 += d8;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void genNoisemap(int x, int y, int z)
|
||||
{
|
||||
int xs = 5;
|
||||
int ys = 17;
|
||||
int zs = 5;
|
||||
double scale = 684.41200000000003D;
|
||||
double height = 684.41200000000003D;
|
||||
// double temps[] = this.biomeGen.temperature;
|
||||
// double rains[] = this.biomeGen.humidity;
|
||||
this.biomeNoiseGen.generate(this.biomeNoise, x, z, xs, zs, 1.121D, 1.121D, 0.5D);
|
||||
this.depthNoiseGen.generate(this.depthNoise, x, z, xs, zs, 200D, 200D, 0.5D);
|
||||
this.mainNoiseGen.generate(this.mainNoise, x, y, z, xs, ys, zs, scale / 80D, height / 160D, scale / 80D);
|
||||
this.lowerNoiseGen.generate(this.lowerNoise, x, y, z, xs, ys, zs, scale, height, scale);
|
||||
this.upperNoiseGen.generate(this.upperNoise, x, y, z, xs, ys, zs, scale, height, scale);
|
||||
int pos = 0;
|
||||
int dpos = 0;
|
||||
int ps = 16 / xs;
|
||||
for(int u = 0; u < xs; u++)
|
||||
{
|
||||
int px = u * ps + ps / 2;
|
||||
for(int v = 0; v < zs; v++)
|
||||
{
|
||||
int pz = v * ps + ps / 2;
|
||||
// double temp = temps[px * 16 + pz];
|
||||
// double rain = rains[px * 16 + pz] * temp;
|
||||
double fact = 1.0D - this.factors[pz * 16 + px];
|
||||
fact *= fact;
|
||||
fact *= fact;
|
||||
fact = 1.0D - fact;
|
||||
double high = (this.biomeNoise[dpos] + 256D) / 512D;
|
||||
high *= fact;
|
||||
if(high > 1.0D)
|
||||
{
|
||||
high = 1.0D;
|
||||
}
|
||||
double depth = this.depthNoise[dpos] / 8000D;
|
||||
if(depth < 0.0D)
|
||||
{
|
||||
depth = -depth * 0.29999999999999999D;
|
||||
}
|
||||
depth = depth * 3D - 2D;
|
||||
if(depth < 0.0D)
|
||||
{
|
||||
depth /= 2D;
|
||||
if(depth < -1D)
|
||||
{
|
||||
depth = -1D;
|
||||
}
|
||||
depth /= 1.3999999999999999D;
|
||||
depth /= 2D;
|
||||
high = 0.0D;
|
||||
} else
|
||||
{
|
||||
if(depth > 1.0D)
|
||||
{
|
||||
depth = 1.0D;
|
||||
}
|
||||
depth /= 8D;
|
||||
}
|
||||
if(high < 0.0D)
|
||||
{
|
||||
high = 0.0D;
|
||||
}
|
||||
high += 0.5D;
|
||||
depth = (depth * (double)ys) / 16D;
|
||||
double shift = (double)ys / 2D + depth * 4D;
|
||||
dpos++;
|
||||
for(int w = 0; w < ys; w++)
|
||||
{
|
||||
double noise = 0.0D;
|
||||
double damp = (((double)w - shift) * 12D) / high;
|
||||
if(damp < 0.0D)
|
||||
{
|
||||
damp *= 4D;
|
||||
}
|
||||
double lower = this.lowerNoise[pos] / 512D;
|
||||
double upper = this.upperNoise[pos] / 512D;
|
||||
double base = (this.mainNoise[pos] / 10D + 1.0D) / 2D;
|
||||
if(base < 0.0D)
|
||||
{
|
||||
noise = lower;
|
||||
} else
|
||||
if(base > 1.0D)
|
||||
{
|
||||
noise = upper;
|
||||
} else
|
||||
{
|
||||
noise = lower + (upper - lower) * base;
|
||||
}
|
||||
noise -= damp;
|
||||
if(w > ys - 4)
|
||||
{
|
||||
double d13 = (float)(w - (ys - 4)) / 3F;
|
||||
noise = noise * (1.0D - d13) + -10D * d13;
|
||||
}
|
||||
this.noiseTable[pos] = noise;
|
||||
pos++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.biome.RngSpawn;
|
||||
import common.color.DyeColor;
|
||||
import common.entity.npc.EntityDarkMage;
|
||||
import common.entity.npc.EntityMage;
|
||||
import common.entity.npc.EntityMagma;
|
||||
import common.entity.npc.EntityTiefling;
|
||||
import common.entity.npc.EntityUndead;
|
||||
import common.entity.projectile.RngFishable;
|
||||
import common.init.Blocks;
|
||||
import common.init.ItemRegistry;
|
||||
import common.init.Items;
|
||||
import common.item.ItemFishFood;
|
||||
import common.item.ItemStack;
|
||||
import common.item.RngLoot;
|
||||
import common.rng.WeightedList;
|
||||
|
||||
public abstract class LootConstants {
|
||||
public static final WeightedList<RngFishable> FISHING_JUNK = new WeightedList<RngFishable>(
|
||||
(new RngFishable(new ItemStack(Items.leather_boots), 10)).setMaxDamagePercent(0.9F), new RngFishable(new ItemStack(Items.leather), 10),
|
||||
new RngFishable(new ItemStack(Items.bone), 10), new RngFishable(new ItemStack(Items.potion), 10),
|
||||
new RngFishable(new ItemStack(Items.string), 5), (new RngFishable(new ItemStack(Items.fishing_rod), 2)).setMaxDamagePercent(0.9F),
|
||||
new RngFishable(new ItemStack(Items.bowl), 10), new RngFishable(new ItemStack(Items.stick), 5),
|
||||
new RngFishable(new ItemStack(Items.dye, 10, DyeColor.BLACK.getDyeDamage()), 1),
|
||||
new RngFishable(new ItemStack(Blocks.tripwire_hook), 10), new RngFishable(new ItemStack(Items.rotten_flesh), 10));
|
||||
public static final WeightedList<RngFishable> FISHING_TREASURE = new WeightedList<RngFishable>(
|
||||
new RngFishable(new ItemStack(Blocks.waterlily), 1), new RngFishable(new ItemStack(Items.name_tag), 1),
|
||||
new RngFishable(new ItemStack(Items.saddle), 1),
|
||||
(new RngFishable(new ItemStack(Items.bow), 1)).setMaxDamagePercent(0.25F).setEnchantable(),
|
||||
(new RngFishable(new ItemStack(Items.fishing_rod), 1)).setMaxDamagePercent(0.25F).setEnchantable(),
|
||||
(new RngFishable(new ItemStack(Items.book), 1)).setEnchantable());
|
||||
public static final WeightedList<RngFishable> FISH_TYPES = new WeightedList<RngFishable>(
|
||||
new RngFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.COD.getMetadata()), 60),
|
||||
new RngFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.SALMON.getMetadata()), 25),
|
||||
new RngFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.CLOWNFISH.getMetadata()), 2),
|
||||
new RngFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.PUFFERFISH.getMetadata()), 13));
|
||||
public static final WeightedList<RngLoot> VILLAGE_BLACKSMITH = new WeightedList(new RngLoot(Items.diamond, 0, 1, 3, 3),
|
||||
new RngLoot(Items.iron_ingot, 0, 1, 5, 10), new RngLoot(Items.gold_ingot, 0, 1, 3, 5), new RngLoot(Items.bread, 0, 1, 3, 15),
|
||||
new RngLoot(Items.apple, 0, 1, 3, 15), new RngLoot(Items.iron_pickaxe, 0, 1, 1, 5), new RngLoot(Items.iron_sword, 0, 1, 1, 5),
|
||||
new RngLoot(Items.iron_chestplate, 0, 1, 1, 5), new RngLoot(Items.iron_helmet, 0, 1, 1, 5), new RngLoot(Items.iron_leggings, 0, 1, 1, 5),
|
||||
new RngLoot(Items.iron_boots, 0, 1, 1, 5), new RngLoot(ItemRegistry.getItemFromBlock(Blocks.obsidian), 0, 3, 7, 5),
|
||||
new RngLoot(ItemRegistry.getItemFromBlock(Blocks.oak_sapling), 0, 3, 7, 5), new RngLoot(Items.saddle, 0, 1, 1, 3),
|
||||
new RngLoot(Items.iron_horse_armor, 0, 1, 1, 1), new RngLoot(Items.gold_horse_armor, 0, 1, 1, 1),
|
||||
new RngLoot(Items.diamond_horse_armor, 0, 1, 1, 1));
|
||||
public static final WeightedList<RngLoot> STRONGHOLD_CHEST = new WeightedList(new RngLoot(Items.orb, 0, 1, 1, 10),
|
||||
new RngLoot(Items.diamond, 0, 1, 3, 3), new RngLoot(Items.iron_ingot, 0, 1, 5, 10), new RngLoot(Items.gold_ingot, 0, 1, 3, 5),
|
||||
new RngLoot(Items.redstone, 0, 4, 9, 5), new RngLoot(Items.bread, 0, 1, 3, 15), new RngLoot(Items.apple, 0, 1, 3, 15),
|
||||
new RngLoot(Items.iron_pickaxe, 0, 1, 1, 5), new RngLoot(Items.iron_sword, 0, 1, 1, 5), new RngLoot(Items.iron_chestplate, 0, 1, 1, 5),
|
||||
new RngLoot(Items.iron_helmet, 0, 1, 1, 5), new RngLoot(Items.iron_leggings, 0, 1, 1, 5), new RngLoot(Items.iron_boots, 0, 1, 1, 5),
|
||||
new RngLoot(Items.golden_apple, 0, 1, 1, 1), new RngLoot(Items.saddle, 0, 1, 1, 1), new RngLoot(Items.iron_horse_armor, 0, 1, 1, 1),
|
||||
new RngLoot(Items.gold_horse_armor, 0, 1, 1, 1), new RngLoot(Items.diamond_horse_armor, 0, 1, 1, 1));
|
||||
public static final WeightedList<RngLoot> STRONGHOLD_LIBRARY = new WeightedList(new RngLoot(Items.book, 0, 1, 3, 20),
|
||||
new RngLoot(Items.paper, 0, 2, 7, 20), new RngLoot(Items.string, 0, 1, 1, 1), new RngLoot(Items.navigator, 0, 1, 1, 1));
|
||||
public static final WeightedList<RngLoot> STRONGHOLD_CROSS = new WeightedList(new RngLoot(Items.iron_ingot, 0, 1, 5, 10),
|
||||
new RngLoot(Items.gold_ingot, 0, 1, 3, 5), new RngLoot(Items.redstone, 0, 4, 9, 5), new RngLoot(Items.coal, 0, 3, 8, 10),
|
||||
new RngLoot(Items.bread, 0, 1, 3, 15), new RngLoot(Items.apple, 0, 1, 3, 15), new RngLoot(Items.iron_pickaxe, 0, 1, 1, 1));
|
||||
public static final WeightedList<RngLoot> DESERT_PYRAMID = new WeightedList(new RngLoot(Items.diamond, 0, 1, 3, 3),
|
||||
new RngLoot(Items.iron_ingot, 0, 1, 5, 10), new RngLoot(Items.gold_ingot, 0, 2, 7, 15), new RngLoot(Items.emerald, 0, 1, 3, 2),
|
||||
new RngLoot(Items.bone, 0, 4, 6, 20), new RngLoot(Items.rotten_flesh, 0, 3, 7, 16), new RngLoot(Items.saddle, 0, 1, 1, 3),
|
||||
new RngLoot(Items.iron_horse_armor, 0, 1, 1, 1), new RngLoot(Items.gold_horse_armor, 0, 1, 1, 1),
|
||||
new RngLoot(Items.diamond_horse_armor, 0, 1, 1, 1));
|
||||
public static final WeightedList<RngLoot> JUNGLE_MAIN = new WeightedList(new RngLoot(Items.diamond, 0, 1, 3, 3),
|
||||
new RngLoot(Items.iron_ingot, 0, 1, 5, 10), new RngLoot(Items.gold_ingot, 0, 2, 7, 15), new RngLoot(Items.emerald, 0, 1, 3, 2),
|
||||
new RngLoot(Items.bone, 0, 4, 6, 20), new RngLoot(Items.rotten_flesh, 0, 3, 7, 16), new RngLoot(Items.saddle, 0, 1, 1, 3),
|
||||
new RngLoot(Items.iron_horse_armor, 0, 1, 1, 1), new RngLoot(Items.gold_horse_armor, 0, 1, 1, 1),
|
||||
new RngLoot(Items.diamond_horse_armor, 0, 1, 1, 1));
|
||||
public static final WeightedList<RngLoot> JUNGLE_TRAP = new WeightedList(new RngLoot(Items.arrow, 0, 2, 7, 30));
|
||||
public static final WeightedList<RngLoot> MINESHAFT_CHEST = new WeightedList(new RngLoot(Items.iron_ingot, 0, 1, 5, 10),
|
||||
new RngLoot(Items.gold_ingot, 0, 1, 3, 5), new RngLoot(Items.redstone, 0, 4, 9, 5),
|
||||
new RngLoot(Items.dye, DyeColor.BLUE.getDyeDamage(), 4, 9, 5), new RngLoot(Items.diamond, 0, 1, 2, 3),
|
||||
new RngLoot(Items.coal, 0, 3, 8, 10), new RngLoot(Items.bread, 0, 1, 3, 15), new RngLoot(Items.iron_pickaxe, 0, 1, 1, 1),
|
||||
new RngLoot(ItemRegistry.getItemFromBlock(Blocks.rail), 0, 4, 8, 1), new RngLoot(Items.melon_stem, 0, 2, 4, 10),
|
||||
new RngLoot(Items.pumpkin_stem, 0, 2, 4, 10), new RngLoot(Items.saddle, 0, 1, 1, 3), new RngLoot(Items.iron_horse_armor, 0, 1, 1, 1));
|
||||
public static final WeightedList<RngLoot> HELL_FORTRESS = new WeightedList(new RngLoot(Items.diamond, 0, 1, 3, 5),
|
||||
new RngLoot(Items.iron_ingot, 0, 1, 5, 5), new RngLoot(Items.gold_ingot, 0, 1, 3, 15), new RngLoot(Items.gold_sword, 0, 1, 1, 5),
|
||||
new RngLoot(Items.gold_chestplate, 0, 1, 1, 5), new RngLoot(Items.flint_and_steel, 0, 1, 1, 5),
|
||||
new RngLoot(Items.soul_wart, 0, 3, 7, 5), new RngLoot(Items.saddle, 0, 1, 1, 10), new RngLoot(Items.gold_horse_armor, 0, 1, 1, 8),
|
||||
new RngLoot(Items.iron_horse_armor, 0, 1, 1, 5), new RngLoot(Items.diamond_horse_armor, 0, 1, 1, 3),
|
||||
new RngLoot(ItemRegistry.getItemFromBlock(Blocks.obsidian), 0, 2, 4, 2));
|
||||
public static final WeightedList<RngLoot> DUNGEON_CHEST = new WeightedList(new RngLoot(Items.saddle, 0, 1, 1, 11),
|
||||
new RngLoot(Items.iron_ingot, 0, 1, 4, 11), new RngLoot(Items.bread, 0, 1, 1, 11), new RngLoot(Items.wheats, 0, 1, 4, 11),
|
||||
new RngLoot(Items.gunpowder, 0, 1, 4, 11), new RngLoot(Items.string, 0, 1, 4, 11), new RngLoot(Items.bucket, 0, 1, 1, 11),
|
||||
new RngLoot(Items.golden_apple, 0, 1, 1, 1), new RngLoot(Items.redstone, 0, 1, 4, 11), new RngLoot(Items.aluminium_ingot, 0, 1, 1, 5),
|
||||
new RngLoot(Items.copper_ingot, 0, 1, 1, 5), new RngLoot(Items.name_tag, 0, 1, 1, 11), new RngLoot(Items.gold_horse_armor, 0, 1, 1, 3),
|
||||
new RngLoot(Items.iron_horse_armor, 0, 1, 1, 6), new RngLoot(Items.diamond_horse_armor, 0, 1, 1, 2),
|
||||
new RngLoot(Items.record_13, 0, 1, 1, 1), new RngLoot(Items.record_cat, 0, 1, 1, 1), new RngLoot(Items.record_blocks, 0, 1, 1, 1),
|
||||
new RngLoot(Items.record_chirp, 0, 1, 1, 1), new RngLoot(Items.record_far, 0, 1, 1, 1), new RngLoot(Items.record_mall, 0, 1, 1, 1),
|
||||
new RngLoot(Items.record_mellohi, 0, 1, 1, 1), new RngLoot(Items.record_stal, 0, 1, 1, 1), new RngLoot(Items.record_strad, 0, 1, 1, 1),
|
||||
new RngLoot(Items.record_ward, 0, 1, 1, 1), new RngLoot(Items.record_11, 0, 1, 1, 1), new RngLoot(Items.record_wait, 0, 1, 1, 1),
|
||||
new RngLoot(Items.record_delay, 0, 1, 1, 1), new RngLoot(Items.record_extend, 0, 1, 1, 1));
|
||||
public static final WeightedList<RngLoot> ABANDONED_ITEMS = new WeightedList(new RngLoot(Items.stick, 0, 1, 3, 10),
|
||||
new RngLoot(ItemRegistry.getItemFromBlock(Blocks.oak_planks), 0, 1, 3, 10),
|
||||
new RngLoot(ItemRegistry.getItemFromBlock(Blocks.oak_log), 0, 1, 3, 10), new RngLoot(Items.stone_axe, 0, 1, 1, 3),
|
||||
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<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));
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.rng.NoiseGen;
|
||||
import common.rng.OctaveGen;
|
||||
import common.rng.Random;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class ReplacerAltBiome implements BlockReplacer
|
||||
{
|
||||
private final NoiseGen altNoiseGen;
|
||||
private final NoiseGen exclNoiseGen;
|
||||
|
||||
private final State filler;
|
||||
private final State liquid;
|
||||
private final State alt1;
|
||||
private final State alt2;
|
||||
private final Block block;
|
||||
private final double alt2Noise[] = new double[256];
|
||||
private final double alt1Noise[] = new double[256];
|
||||
private final double exclNoise[] = new double[256];
|
||||
|
||||
// public ReplacerAltBiome(Random rand, GeneratorSettings settings)
|
||||
// {
|
||||
// this(rand, settings.farlands, Blocks.stone.getDefaultState(),
|
||||
// settings.useLavaSeas ? Blocks.lava.getDefaultState() : Blocks.water.getDefaultState(),
|
||||
// Blocks.sand.getDefaultState(), Blocks.gravel.getDefaultState());
|
||||
// }
|
||||
|
||||
// public ReplacerAltBiome(Dimension dim, Random rand)
|
||||
// {
|
||||
// this(rand, /* dim.hasFarLands(), */ dim.getFiller(), dim.getLiquid(), dim.getAltFiller2(), dim.getAltFiller1());
|
||||
// }
|
||||
|
||||
public ReplacerAltBiome(Random rand, /* boolean farlands, */ State filler, State liquid, State alt1, State alt2)
|
||||
{
|
||||
this.altNoiseGen = /* farlands ? new OctaveGenOld(rand, 4) : */ new OctaveGen(rand, 4);
|
||||
this.exclNoiseGen = /* farlands ? new OctaveGenOld(rand, 4) : */ new OctaveGen(rand, 4);
|
||||
this.filler = filler;
|
||||
this.liquid = liquid;
|
||||
this.alt1 = alt1;
|
||||
this.alt2 = alt2;
|
||||
this.block = filler.getBlock();
|
||||
}
|
||||
|
||||
public void replaceBlocks(AWorldServer world, int x, int z, ChunkPrimer primer, Random rand, Biome[] biomes)
|
||||
{
|
||||
int seaLevel = world.getSeaLevel();
|
||||
double scale = 0.03125D;
|
||||
this.altNoiseGen.generate( this.alt2Noise , x * 16, 0 /*.0D */ , z * 16, 16, 1, 16, scale, 1.0D, scale);
|
||||
this.altNoiseGen.generate(this.alt1Noise, z * 16, 109 /*.0134D */, x * 16, 16, 1, 16, scale, 1.0D, scale);
|
||||
this.exclNoiseGen.generate( this.exclNoise , x * 16, 0 /*.0D */ , z * 16, 16, 1, 16, scale * 2D, scale * 2D, scale * 2D);
|
||||
for(int pz = 0; pz < 16; pz++)
|
||||
{
|
||||
for(int px = 0; px < 16; px++)
|
||||
{
|
||||
Biome biome = biomes[pz * 16 + px];
|
||||
boolean alt2 = this.alt2Noise[pz + px * 16] + rand.doublev() * 0.20000000000000001D > 0.0D;
|
||||
boolean alt1 = this.alt1Noise[px + pz * 16] + rand.doublev() * 0.20000000000000001D > 3D;
|
||||
int excl = (int)(this.exclNoise[pz + px * 16] / 3D + 3D + rand.doublev() * 0.25D);
|
||||
int rockHeight = -1;
|
||||
State topBlock = biome.topBlock;
|
||||
State fillerBlock = biome.fillerBlock;
|
||||
for(int py = primer.height - 1; py >= 0; py--)
|
||||
{
|
||||
Block currentBlock = primer.get(px, py, pz).getBlock();
|
||||
if(currentBlock == Blocks.air)
|
||||
{
|
||||
rockHeight = -1;
|
||||
continue;
|
||||
}
|
||||
if(currentBlock != this.block)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(rockHeight == -1)
|
||||
{
|
||||
if(excl <= 0)
|
||||
{
|
||||
topBlock = Blocks.air.getState();
|
||||
fillerBlock = this.filler;
|
||||
} else
|
||||
if(py >= seaLevel - 4 && py <= seaLevel + 1)
|
||||
{
|
||||
topBlock = biome.topBlock;
|
||||
fillerBlock = biome.fillerBlock;
|
||||
if(alt1)
|
||||
{
|
||||
topBlock = Blocks.air.getState();
|
||||
}
|
||||
if(alt1)
|
||||
{
|
||||
fillerBlock = this.alt2;
|
||||
}
|
||||
if(alt2)
|
||||
{
|
||||
topBlock = this.alt1;
|
||||
}
|
||||
if(alt2)
|
||||
{
|
||||
fillerBlock = this.alt1;
|
||||
}
|
||||
}
|
||||
if(py < seaLevel && topBlock.getBlock() == Blocks.air)
|
||||
{
|
||||
topBlock = this.liquid;
|
||||
}
|
||||
rockHeight = excl;
|
||||
if(py >= seaLevel - 1)
|
||||
{
|
||||
primer.set(px, py, pz, topBlock);
|
||||
} else
|
||||
{
|
||||
primer.set(px, py, pz, fillerBlock);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(rockHeight > 0)
|
||||
{
|
||||
rockHeight--;
|
||||
primer.set(px, py, pz, fillerBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,131 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.material.Material;
|
||||
import common.rng.OctaveGen;
|
||||
import common.rng.Random;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class ReplacerAltSurface implements BlockReplacer
|
||||
{
|
||||
private final OctaveGen altNoiseGen;
|
||||
private final OctaveGen exclNoiseGen;
|
||||
|
||||
private final double[] alt2Noise = new double[256];
|
||||
private final double[] alt1Noise = new double[256];
|
||||
private final double[] exclNoise = new double[256];
|
||||
|
||||
private final State filler;
|
||||
private final State alt1;
|
||||
private final State alt2;
|
||||
private final State liquid;
|
||||
private final Block fillerBlock;
|
||||
|
||||
// public ReplacerAltSurface(Dimension dim, Random rand) {
|
||||
// this(rand, dim.getFiller(), dim.getAltFiller1(), dim.getAltFiller2(), dim.getLiquid());
|
||||
// }
|
||||
|
||||
public ReplacerAltSurface(Random rand, State filler, State alt1, State alt2, State liquid)
|
||||
{
|
||||
this.altNoiseGen = new OctaveGen(rand, 4);
|
||||
this.exclNoiseGen = new OctaveGen(rand, 4);
|
||||
this.filler = filler;
|
||||
this.alt1 = alt1;
|
||||
this.alt2 = alt2;
|
||||
this.liquid = liquid;
|
||||
this.fillerBlock = filler.getBlock();
|
||||
}
|
||||
|
||||
public void replaceBlocks(AWorldServer world, int x, int z, ChunkPrimer primer, Random rand, Biome[] biomes)
|
||||
{
|
||||
int i = world.getSeaLevel() + 1;
|
||||
double d0 = 0.03125D;
|
||||
this.altNoiseGen.generate(this.alt2Noise, x * 16, z * 16, 0, 16, 16, 1, d0, d0, 1.0D);
|
||||
this.altNoiseGen.generate(this.alt1Noise, x * 16, 109, z * 16, 16, 1, 16, d0, 1.0D, d0);
|
||||
this.exclNoiseGen.generate(this.exclNoise, x * 16, z * 16, 0, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D);
|
||||
|
||||
for (int j = 0; j < 16; ++j)
|
||||
{
|
||||
for (int k = 0; k < 16; ++k)
|
||||
{
|
||||
boolean flag = this.alt2Noise[j + k * 16] + rand.doublev() * 0.2D > 0.0D;
|
||||
boolean flag1 = this.alt1Noise[j + k * 16] + rand.doublev() * 0.2D > 0.0D;
|
||||
int l = (int)(this.exclNoise[j + k * 16] / 3.0D + 3.0D + rand.doublev() * 0.25D);
|
||||
int i1 = -1;
|
||||
State iblockstate = this.filler;
|
||||
State iblockstate1 = this.filler;
|
||||
|
||||
for (int j1 = primer.height - 1; j1 >= 0; --j1)
|
||||
{
|
||||
// if (j1 < (primer.height - 1) - rand.zrange(5) || this.ceiling == null)
|
||||
// {
|
||||
State iblockstate2 = primer.get(k, j1, j);
|
||||
|
||||
if (iblockstate2.getBlock() != null && iblockstate2.getBlock().getMaterial() != Material.air)
|
||||
{
|
||||
if (iblockstate2.getBlock() == this.fillerBlock)
|
||||
{
|
||||
if (i1 == -1)
|
||||
{
|
||||
if (l <= 0)
|
||||
{
|
||||
iblockstate = null;
|
||||
iblockstate1 = this.filler;
|
||||
}
|
||||
else if (j1 >= i - 4 && j1 <= i + 1)
|
||||
{
|
||||
iblockstate = this.filler;
|
||||
iblockstate1 = this.filler;
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
iblockstate = this.alt1;
|
||||
iblockstate1 = this.filler;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
iblockstate = this.alt2;
|
||||
iblockstate1 = this.alt2;
|
||||
}
|
||||
}
|
||||
|
||||
if (j1 < i && (iblockstate == null || iblockstate.getBlock().getMaterial() == Material.air))
|
||||
{
|
||||
iblockstate = this.liquid;
|
||||
}
|
||||
|
||||
i1 = l;
|
||||
|
||||
if (j1 >= i - 1)
|
||||
{
|
||||
primer.set(k, j1, j, iblockstate);
|
||||
}
|
||||
else
|
||||
{
|
||||
primer.set(k, j1, j, iblockstate1);
|
||||
}
|
||||
}
|
||||
else if (i1 > 0)
|
||||
{
|
||||
--i1;
|
||||
primer.set(k, j1, j, iblockstate1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
i1 = -1;
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// primer.set(k, j1, j, this.ceiling);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.rng.PerlinGen;
|
||||
import common.rng.Random;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class ReplacerBiome implements BlockReplacer
|
||||
{
|
||||
private final PerlinGen stoneNoiseGen;
|
||||
private final double[] stoneNoise = new double[256];
|
||||
|
||||
public ReplacerBiome(Random rand)
|
||||
{
|
||||
this.stoneNoiseGen = new PerlinGen(rand, 4);
|
||||
}
|
||||
|
||||
public void replaceBlocks(AWorldServer world, int x, int z, ChunkPrimer primer, Random rand, Biome[] biomes)
|
||||
{
|
||||
double d0 = 0.03125D;
|
||||
this.stoneNoiseGen.generate(this.stoneNoise, (double)(x * 16), (double)(z * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);
|
||||
|
||||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
for (int j = 0; j < 16; ++j)
|
||||
{
|
||||
Biome biome = biomes[j + i * 16];
|
||||
biome.genTerrainBlocks(world, rand, primer, x * 16 + i, z * 16 + j, this.stoneNoise[j + i * 16]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
package common.worldgen;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class ReplacerTopLayer implements BlockReplacer
|
||||
{
|
||||
private final State filler;
|
||||
private final Block replace;
|
||||
|
||||
// public ReplacerTopLayer(Dimension dim) {
|
||||
// this(dim.getSurface(), dim.getFiller().getBlock());
|
||||
// }
|
||||
|
||||
public ReplacerTopLayer(State filler, Block replace) {
|
||||
this.filler = filler;
|
||||
this.replace = replace;
|
||||
}
|
||||
|
||||
public void replaceBlocks(AWorldServer world, int x, int z, ChunkPrimer primer, Random rand, Biome[] biomes)
|
||||
{
|
||||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
for (int j = 0; j < 16; ++j)
|
||||
{
|
||||
int k = 1;
|
||||
int l = -1;
|
||||
State iblockstate = this.filler;
|
||||
State iblockstate1 = this.filler;
|
||||
|
||||
for (int i1 = primer.height - 1; i1 >= 0; --i1)
|
||||
{
|
||||
State iblockstate2 = primer.get(i, i1, j);
|
||||
|
||||
if (iblockstate2.getBlock().getMaterial() == Material.air)
|
||||
{
|
||||
l = -1;
|
||||
}
|
||||
else if (iblockstate2.getBlock() == this.replace)
|
||||
{
|
||||
if (l == -1)
|
||||
{
|
||||
if (k <= 0)
|
||||
{
|
||||
iblockstate = Blocks.air.getState();
|
||||
iblockstate1 = this.filler;
|
||||
}
|
||||
|
||||
l = k;
|
||||
|
||||
if (i1 >= 0)
|
||||
{
|
||||
primer.set(i, i1, j, iblockstate);
|
||||
}
|
||||
else
|
||||
{
|
||||
primer.set(i, i1, j, iblockstate1);
|
||||
}
|
||||
}
|
||||
else if (l > 0)
|
||||
{
|
||||
--l;
|
||||
primer.set(i, i1, j, iblockstate1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package common.worldgen.caves;
|
||||
|
||||
import common.rng.Random;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.ChunkPrimer;
|
||||
|
||||
public class MapGenBase
|
||||
{
|
||||
/** The number of Chunks to gen-check in any given direction. */
|
||||
protected int range = 8;
|
||||
|
||||
/** The RNG used by the MapGen classes. */
|
||||
protected Random rand = new Random();
|
||||
|
||||
/** This world object. */
|
||||
protected AWorldServer worldObj;
|
||||
|
||||
public void generate(AWorldServer worldIn, int x, int z, ChunkPrimer chunkPrimerIn)
|
||||
{
|
||||
int i = this.range;
|
||||
this.worldObj = worldIn;
|
||||
this.rand.setSeed(worldIn.getSeed());
|
||||
long j = this.rand.longv();
|
||||
long k = this.rand.longv();
|
||||
|
||||
for (int l = x - i; l <= x + i; ++l)
|
||||
{
|
||||
for (int i1 = z - i; i1 <= z + i; ++i1)
|
||||
{
|
||||
long j1 = (long)l * j;
|
||||
long k1 = (long)i1 * k;
|
||||
this.rand.setSeed(j1 ^ k1 ^ worldIn.getSeed());
|
||||
this.recursiveGenerate(worldIn, l, i1, x, z, chunkPrimerIn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively called by generate()
|
||||
*/
|
||||
protected void recursiveGenerate(AWorldServer worldIn, int chunkX, int chunkZ, int p_180701_4_, int p_180701_5_, ChunkPrimer chunkPrimerIn)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,233 +0,0 @@
|
|||
package common.worldgen.caves;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.ExtMath;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.ChunkPrimer;
|
||||
|
||||
public class MapGenBigCaves extends MapGenBase
|
||||
{
|
||||
private final Block replace;
|
||||
private final Block top;
|
||||
private final Block surface;
|
||||
|
||||
public MapGenBigCaves(Block replace, Block top, Block surface) {
|
||||
this.replace = replace;
|
||||
this.top = top;
|
||||
this.surface = surface;
|
||||
}
|
||||
|
||||
protected void func_180705_a(long p_180705_1_, int p_180705_3_, int p_180705_4_, ChunkPrimer p_180705_5_, double p_180705_6_, double p_180705_8_, double p_180705_10_)
|
||||
{
|
||||
this.func_180704_a(p_180705_1_, p_180705_3_, p_180705_4_, p_180705_5_, p_180705_6_, p_180705_8_, p_180705_10_, 1.0F + this.rand.floatv() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D);
|
||||
}
|
||||
|
||||
protected void func_180704_a(long p_180704_1_, int p_180704_3_, int p_180704_4_, ChunkPrimer p_180704_5_, double p_180704_6_, double p_180704_8_, double p_180704_10_, float p_180704_12_, float p_180704_13_, float p_180704_14_, int p_180704_15_, int p_180704_16_, double p_180704_17_)
|
||||
{
|
||||
double d0 = (double)(p_180704_3_ * 16 + 8);
|
||||
double d1 = (double)(p_180704_4_ * 16 + 8);
|
||||
float f = 0.0F;
|
||||
float f1 = 0.0F;
|
||||
Random random = new Random(p_180704_1_);
|
||||
|
||||
if (p_180704_16_ <= 0)
|
||||
{
|
||||
int i = this.range * 16 - 16;
|
||||
p_180704_16_ = i - random.zrange(i / 4);
|
||||
}
|
||||
|
||||
boolean flag1 = false;
|
||||
|
||||
if (p_180704_15_ == -1)
|
||||
{
|
||||
p_180704_15_ = p_180704_16_ / 2;
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
int j = random.zrange(p_180704_16_ / 2) + p_180704_16_ / 4;
|
||||
|
||||
for (boolean flag = random.zrange(6) == 0; p_180704_15_ < p_180704_16_; ++p_180704_15_)
|
||||
{
|
||||
double d2 = 1.5D + (double)(ExtMath.sin((float)p_180704_15_ * (float)Math.PI / (float)p_180704_16_) * p_180704_12_ * 1.0F);
|
||||
double d3 = d2 * p_180704_17_;
|
||||
float f2 = ExtMath.cos(p_180704_14_);
|
||||
float f3 = ExtMath.sin(p_180704_14_);
|
||||
p_180704_6_ += (double)(ExtMath.cos(p_180704_13_) * f2);
|
||||
p_180704_8_ += (double)f3;
|
||||
p_180704_10_ += (double)(ExtMath.sin(p_180704_13_) * f2);
|
||||
|
||||
if (flag)
|
||||
{
|
||||
p_180704_14_ = p_180704_14_ * 0.92F;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_180704_14_ = p_180704_14_ * 0.7F;
|
||||
}
|
||||
|
||||
p_180704_14_ = p_180704_14_ + f1 * 0.1F;
|
||||
p_180704_13_ += f * 0.1F;
|
||||
f1 = f1 * 0.9F;
|
||||
f = f * 0.75F;
|
||||
f1 = f1 + (random.floatv() - random.floatv()) * random.floatv() * 2.0F;
|
||||
f = f + (random.floatv() - random.floatv()) * random.floatv() * 4.0F;
|
||||
|
||||
if (!flag1 && p_180704_15_ == j && p_180704_12_ > 1.0F)
|
||||
{
|
||||
this.func_180704_a(random.longv(), p_180704_3_, p_180704_4_, p_180704_5_, p_180704_6_, p_180704_8_, p_180704_10_, random.floatv() * 0.5F + 0.5F, p_180704_13_ - ((float)Math.PI / 2F), p_180704_14_ / 3.0F, p_180704_15_, p_180704_16_, 1.0D);
|
||||
this.func_180704_a(random.longv(), p_180704_3_, p_180704_4_, p_180704_5_, p_180704_6_, p_180704_8_, p_180704_10_, random.floatv() * 0.5F + 0.5F, p_180704_13_ + ((float)Math.PI / 2F), p_180704_14_ / 3.0F, p_180704_15_, p_180704_16_, 1.0D);
|
||||
return;
|
||||
}
|
||||
|
||||
if (flag1 || random.zrange(4) != 0)
|
||||
{
|
||||
double d4 = p_180704_6_ - d0;
|
||||
double d5 = p_180704_10_ - d1;
|
||||
double d6 = (double)(p_180704_16_ - p_180704_15_);
|
||||
double d7 = (double)(p_180704_12_ + 2.0F + 16.0F);
|
||||
|
||||
if (d4 * d4 + d5 * d5 - d6 * d6 > d7 * d7)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_180704_6_ >= d0 - 16.0D - d2 * 2.0D && p_180704_10_ >= d1 - 16.0D - d2 * 2.0D && p_180704_6_ <= d0 + 16.0D + d2 * 2.0D && p_180704_10_ <= d1 + 16.0D + d2 * 2.0D)
|
||||
{
|
||||
int j2 = ExtMath.floord(p_180704_6_ - d2) - p_180704_3_ * 16 - 1;
|
||||
int k = ExtMath.floord(p_180704_6_ + d2) - p_180704_3_ * 16 + 1;
|
||||
int k2 = ExtMath.floord(p_180704_8_ - d3) - 1;
|
||||
int l = ExtMath.floord(p_180704_8_ + d3) + 1;
|
||||
int l2 = ExtMath.floord(p_180704_10_ - d2) - p_180704_4_ * 16 - 1;
|
||||
int i1 = ExtMath.floord(p_180704_10_ + d2) - p_180704_4_ * 16 + 1;
|
||||
|
||||
if (j2 < 0)
|
||||
{
|
||||
j2 = 0;
|
||||
}
|
||||
|
||||
if (k > 16)
|
||||
{
|
||||
k = 16;
|
||||
}
|
||||
|
||||
if (k2 < 1)
|
||||
{
|
||||
k2 = 1;
|
||||
}
|
||||
|
||||
if (l > 120)
|
||||
{
|
||||
l = 120;
|
||||
}
|
||||
|
||||
if (l2 < 0)
|
||||
{
|
||||
l2 = 0;
|
||||
}
|
||||
|
||||
if (i1 > 16)
|
||||
{
|
||||
i1 = 16;
|
||||
}
|
||||
|
||||
boolean flag2 = false;
|
||||
|
||||
for (int j1 = j2; !flag2 && j1 < k; ++j1)
|
||||
{
|
||||
for (int k1 = l2; !flag2 && k1 < i1; ++k1)
|
||||
{
|
||||
for (int l1 = l + 1; !flag2 && l1 >= k2 - 1; --l1)
|
||||
{
|
||||
if (l1 >= 0 && l1 < 128)
|
||||
{
|
||||
State iblockstate = p_180704_5_.get(j1, l1, k1);
|
||||
|
||||
if (iblockstate.getBlock().getMaterial().isLiquid())
|
||||
{
|
||||
flag2 = true;
|
||||
}
|
||||
|
||||
if (l1 != k2 - 1 && j1 != j2 && j1 != k - 1 && k1 != l2 && k1 != i1 - 1)
|
||||
{
|
||||
l1 = k2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag2)
|
||||
{
|
||||
for (int i3 = j2; i3 < k; ++i3)
|
||||
{
|
||||
double d10 = ((double)(i3 + p_180704_3_ * 16) + 0.5D - p_180704_6_) / d2;
|
||||
|
||||
for (int j3 = l2; j3 < i1; ++j3)
|
||||
{
|
||||
double d8 = ((double)(j3 + p_180704_4_ * 16) + 0.5D - p_180704_10_) / d2;
|
||||
|
||||
for (int i2 = l; i2 > k2; --i2)
|
||||
{
|
||||
double d9 = ((double)(i2 - 1) + 0.5D - p_180704_8_) / d3;
|
||||
|
||||
if (d9 > -0.7D && d10 * d10 + d9 * d9 + d8 * d8 < 1.0D)
|
||||
{
|
||||
State iblockstate1 = p_180704_5_.get(i3, i2, j3);
|
||||
|
||||
if (iblockstate1.getBlock() == this.replace || iblockstate1.getBlock() == this.top || iblockstate1.getBlock() == this.surface)
|
||||
{
|
||||
p_180704_5_.set(i3, i2, j3, Blocks.air.getState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively called by generate()
|
||||
*/
|
||||
protected void recursiveGenerate(AWorldServer worldIn, int chunkX, int chunkZ, int p_180701_4_, int p_180701_5_, ChunkPrimer chunkPrimerIn)
|
||||
{
|
||||
int i = this.rand.zrange(this.rand.zrange(this.rand.zrange(10) + 1) + 1);
|
||||
|
||||
if (this.rand.zrange(5) != 0)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
double d0 = (double)(chunkX * 16 + this.rand.zrange(16));
|
||||
double d1 = (double)this.rand.zrange(128);
|
||||
double d2 = (double)(chunkZ * 16 + this.rand.zrange(16));
|
||||
int k = 1;
|
||||
|
||||
if (this.rand.zrange(4) == 0)
|
||||
{
|
||||
this.func_180705_a(this.rand.longv(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2);
|
||||
k += this.rand.zrange(4);
|
||||
}
|
||||
|
||||
for (int l = 0; l < k; ++l)
|
||||
{
|
||||
float f = this.rand.floatv() * (float)Math.PI * 2.0F;
|
||||
float f1 = (this.rand.floatv() - 0.5F) * 2.0F / 8.0F;
|
||||
float f2 = this.rand.floatv() * 2.0F + this.rand.floatv();
|
||||
this.func_180704_a(this.rand.longv(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2, f2 * 2.0F, f, f1, 0, 0, 0.5D);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,285 +0,0 @@
|
|||
package common.worldgen.caves;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockColored;
|
||||
import common.block.BlockSand;
|
||||
import common.color.DyeColor;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.ChunkPrimer;
|
||||
|
||||
public class MapGenCaves extends MapGenBase
|
||||
{
|
||||
private final State filler;
|
||||
private final Block replace;
|
||||
private final Block top;
|
||||
private final Block surface;
|
||||
private final Block alt;
|
||||
|
||||
public MapGenCaves(State filler, Block replace, Block top, Block surface, Block alt) {
|
||||
this.filler = filler;
|
||||
this.replace = replace;
|
||||
this.top = top;
|
||||
this.surface = surface;
|
||||
this.alt = alt;
|
||||
}
|
||||
|
||||
protected void func_180703_a(long p_180703_1_, int p_180703_3_, int p_180703_4_, ChunkPrimer p_180703_5_, double p_180703_6_, double p_180703_8_, double p_180703_10_)
|
||||
{
|
||||
this.func_180702_a(p_180703_1_, p_180703_3_, p_180703_4_, p_180703_5_, p_180703_6_, p_180703_8_, p_180703_10_, 1.0F + this.rand.floatv() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D);
|
||||
}
|
||||
|
||||
protected void func_180702_a(long p_180702_1_, int p_180702_3_, int p_180702_4_, ChunkPrimer p_180702_5_, double p_180702_6_, double p_180702_8_, double p_180702_10_, float p_180702_12_, float p_180702_13_, float p_180702_14_, int p_180702_15_, int p_180702_16_, double p_180702_17_)
|
||||
{
|
||||
double d0 = (double)(p_180702_3_ * 16 + 8);
|
||||
double d1 = (double)(p_180702_4_ * 16 + 8);
|
||||
float f = 0.0F;
|
||||
float f1 = 0.0F;
|
||||
Random random = new Random(p_180702_1_);
|
||||
|
||||
if (p_180702_16_ <= 0)
|
||||
{
|
||||
int i = this.range * 16 - 16;
|
||||
p_180702_16_ = i - random.zrange(i / 4);
|
||||
}
|
||||
|
||||
boolean flag2 = false;
|
||||
|
||||
if (p_180702_15_ == -1)
|
||||
{
|
||||
p_180702_15_ = p_180702_16_ / 2;
|
||||
flag2 = true;
|
||||
}
|
||||
|
||||
int j = random.zrange(p_180702_16_ / 2) + p_180702_16_ / 4;
|
||||
|
||||
for (boolean flag = random.zrange(6) == 0; p_180702_15_ < p_180702_16_; ++p_180702_15_)
|
||||
{
|
||||
double d2 = 1.5D + (double)(ExtMath.sin((float)p_180702_15_ * (float)Math.PI / (float)p_180702_16_) * p_180702_12_ * 1.0F);
|
||||
double d3 = d2 * p_180702_17_;
|
||||
float f2 = ExtMath.cos(p_180702_14_);
|
||||
float f3 = ExtMath.sin(p_180702_14_);
|
||||
p_180702_6_ += (double)(ExtMath.cos(p_180702_13_) * f2);
|
||||
p_180702_8_ += (double)f3;
|
||||
p_180702_10_ += (double)(ExtMath.sin(p_180702_13_) * f2);
|
||||
|
||||
if (flag)
|
||||
{
|
||||
p_180702_14_ = p_180702_14_ * 0.92F;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_180702_14_ = p_180702_14_ * 0.7F;
|
||||
}
|
||||
|
||||
p_180702_14_ = p_180702_14_ + f1 * 0.1F;
|
||||
p_180702_13_ += f * 0.1F;
|
||||
f1 = f1 * 0.9F;
|
||||
f = f * 0.75F;
|
||||
f1 = f1 + (random.floatv() - random.floatv()) * random.floatv() * 2.0F;
|
||||
f = f + (random.floatv() - random.floatv()) * random.floatv() * 4.0F;
|
||||
|
||||
if (!flag2 && p_180702_15_ == j && p_180702_12_ > 1.0F && p_180702_16_ > 0)
|
||||
{
|
||||
this.func_180702_a(random.longv(), p_180702_3_, p_180702_4_, p_180702_5_, p_180702_6_, p_180702_8_, p_180702_10_, random.floatv() * 0.5F + 0.5F, p_180702_13_ - ((float)Math.PI / 2F), p_180702_14_ / 3.0F, p_180702_15_, p_180702_16_, 1.0D);
|
||||
this.func_180702_a(random.longv(), p_180702_3_, p_180702_4_, p_180702_5_, p_180702_6_, p_180702_8_, p_180702_10_, random.floatv() * 0.5F + 0.5F, p_180702_13_ + ((float)Math.PI / 2F), p_180702_14_ / 3.0F, p_180702_15_, p_180702_16_, 1.0D);
|
||||
return;
|
||||
}
|
||||
|
||||
if (flag2 || random.zrange(4) != 0)
|
||||
{
|
||||
double d4 = p_180702_6_ - d0;
|
||||
double d5 = p_180702_10_ - d1;
|
||||
double d6 = (double)(p_180702_16_ - p_180702_15_);
|
||||
double d7 = (double)(p_180702_12_ + 2.0F + 16.0F);
|
||||
|
||||
if (d4 * d4 + d5 * d5 - d6 * d6 > d7 * d7)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_180702_6_ >= d0 - 16.0D - d2 * 2.0D && p_180702_10_ >= d1 - 16.0D - d2 * 2.0D && p_180702_6_ <= d0 + 16.0D + d2 * 2.0D && p_180702_10_ <= d1 + 16.0D + d2 * 2.0D)
|
||||
{
|
||||
int k2 = ExtMath.floord(p_180702_6_ - d2) - p_180702_3_ * 16 - 1;
|
||||
int k = ExtMath.floord(p_180702_6_ + d2) - p_180702_3_ * 16 + 1;
|
||||
int l2 = ExtMath.floord(p_180702_8_ - d3) - 1;
|
||||
int l = ExtMath.floord(p_180702_8_ + d3) + 1;
|
||||
int i3 = ExtMath.floord(p_180702_10_ - d2) - p_180702_4_ * 16 - 1;
|
||||
int i1 = ExtMath.floord(p_180702_10_ + d2) - p_180702_4_ * 16 + 1;
|
||||
|
||||
if (k2 < 0)
|
||||
{
|
||||
k2 = 0;
|
||||
}
|
||||
|
||||
if (k > 16)
|
||||
{
|
||||
k = 16;
|
||||
}
|
||||
|
||||
if (l2 < 1)
|
||||
{
|
||||
l2 = 1;
|
||||
}
|
||||
|
||||
if (l > 248)
|
||||
{
|
||||
l = 248;
|
||||
}
|
||||
|
||||
if (i3 < 0)
|
||||
{
|
||||
i3 = 0;
|
||||
}
|
||||
|
||||
if (i1 > 16)
|
||||
{
|
||||
i1 = 16;
|
||||
}
|
||||
|
||||
boolean flag3 = false;
|
||||
|
||||
for (int j1 = k2; !flag3 && j1 < k; ++j1)
|
||||
{
|
||||
for (int k1 = i3; !flag3 && k1 < i1; ++k1)
|
||||
{
|
||||
for (int l1 = l + 1; !flag3 && l1 >= l2 - 1; --l1)
|
||||
{
|
||||
if (l1 >= 0 && l1 < p_180702_5_.height)
|
||||
{
|
||||
State iblockstate = p_180702_5_.get(j1, l1, k1);
|
||||
|
||||
if (iblockstate.getBlock().getMaterial().isLiquid())
|
||||
{
|
||||
flag3 = true;
|
||||
}
|
||||
|
||||
if (l1 != l2 - 1 && j1 != k2 && j1 != k - 1 && k1 != i3 && k1 != i1 - 1)
|
||||
{
|
||||
l1 = l2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag3)
|
||||
{
|
||||
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
||||
|
||||
for (int j3 = k2; j3 < k; ++j3)
|
||||
{
|
||||
double d10 = ((double)(j3 + p_180702_3_ * 16) + 0.5D - p_180702_6_) / d2;
|
||||
|
||||
for (int i2 = i3; i2 < i1; ++i2)
|
||||
{
|
||||
double d8 = ((double)(i2 + p_180702_4_ * 16) + 0.5D - p_180702_10_) / d2;
|
||||
boolean flag1 = false;
|
||||
|
||||
if (d10 * d10 + d8 * d8 < 1.0D)
|
||||
{
|
||||
for (int j2 = l; j2 > l2; --j2)
|
||||
{
|
||||
double d9 = ((double)(j2 - 1) + 0.5D - p_180702_8_) / d3;
|
||||
|
||||
if (d9 > -0.7D && d10 * d10 + d9 * d9 + d8 * d8 < 1.0D)
|
||||
{
|
||||
State iblockstate1 = p_180702_5_.get(j3, j2, i2);
|
||||
State iblockstate2 = // (State)Objects.firstNonNull(
|
||||
p_180702_5_.get(j3, j2 + 1, i2); //,
|
||||
if(iblockstate2 == null)
|
||||
iblockstate2 = Blocks.air.getState();
|
||||
|
||||
if (iblockstate1.getBlock() == this.surface || iblockstate1.getBlock() == Blocks.mycelium)
|
||||
{
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
if (this.func_175793_a(iblockstate1, iblockstate2))
|
||||
{
|
||||
if (j2 - 1 < 10)
|
||||
{
|
||||
p_180702_5_.set(j3, j2, i2, this.filler);
|
||||
}
|
||||
else
|
||||
{
|
||||
p_180702_5_.set(j3, j2, i2, Blocks.air.getState());
|
||||
|
||||
if (iblockstate2.getBlock() == Blocks.sand)
|
||||
{
|
||||
p_180702_5_.set(j3, j2 + 1, i2, iblockstate2.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE) : Blocks.sandstone.getState()); //TODO: check!
|
||||
}
|
||||
|
||||
if (flag1 && p_180702_5_.get(j3, j2 - 1, i2).getBlock() == this.top)
|
||||
{
|
||||
blockpos$mutableblockpos.set(j3 + p_180702_3_ * 16, 0, i2 + p_180702_4_ * 16);
|
||||
p_180702_5_.set(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock.getBlock().getState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean func_175793_a(State p_175793_1_, State p_175793_2_)
|
||||
{
|
||||
return p_175793_1_.getBlock() == this.replace ? true : (p_175793_1_.getBlock() == this.top ? true : (p_175793_1_.getBlock() == this.surface ? true : (p_175793_1_.getBlock() == Blocks.hardened_clay ? true : (p_175793_1_.getBlock() == Blocks.stained_hardened_clay ? true : (p_175793_1_.getBlock() == Blocks.sandstone ? true : /* (p_175793_1_.getBlock() == Blocks.red_sandstone ? true : */ (p_175793_1_.getBlock() == Blocks.mycelium ? true : (p_175793_1_.getBlock() == Blocks.snow_layer ? true : (p_175793_1_.getBlock() == Blocks.sand || p_175793_1_.getBlock() == this.alt) && !p_175793_2_.getBlock().getMaterial().isColdLiquid()))))))); // );
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively called by generate()
|
||||
*/
|
||||
protected void recursiveGenerate(AWorldServer worldIn, int chunkX, int chunkZ, int p_180701_4_, int p_180701_5_, ChunkPrimer chunkPrimerIn)
|
||||
{
|
||||
int i = this.rand.zrange(this.rand.zrange(this.rand.zrange(15) + 1) + 1);
|
||||
|
||||
if (this.rand.zrange(7) != 0)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
double d0 = (double)(chunkX * 16 + this.rand.zrange(16));
|
||||
double d1 = (double)this.rand.zrange(this.rand.zrange(120) + 8);
|
||||
double d2 = (double)(chunkZ * 16 + this.rand.zrange(16));
|
||||
int k = 1;
|
||||
|
||||
if (this.rand.zrange(4) == 0)
|
||||
{
|
||||
this.func_180703_a(this.rand.longv(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2);
|
||||
k += this.rand.zrange(4);
|
||||
}
|
||||
|
||||
for (int l = 0; l < k; ++l)
|
||||
{
|
||||
float f = this.rand.floatv() * (float)Math.PI * 2.0F;
|
||||
float f1 = (this.rand.floatv() - 0.5F) * 2.0F / 8.0F;
|
||||
float f2 = this.rand.floatv() * 2.0F + this.rand.floatv();
|
||||
|
||||
if (this.rand.zrange(10) == 0)
|
||||
{
|
||||
f2 *= this.rand.floatv() * this.rand.floatv() * 3.0F + 1.0F;
|
||||
}
|
||||
|
||||
this.func_180702_a(this.rand.longv(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2, f2, f, f1, 0, 0, 1.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,240 +0,0 @@
|
|||
package common.worldgen.caves;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.ChunkPrimer;
|
||||
|
||||
public class MapGenRavine extends MapGenBase
|
||||
{
|
||||
private final State filler;
|
||||
private final Block replace;
|
||||
private final Block top;
|
||||
private final Block surface;
|
||||
|
||||
private float[] field_75046_d = new float[1024];
|
||||
|
||||
public MapGenRavine(State filler, Block replace, Block top, Block surface) {
|
||||
this.filler = filler;
|
||||
this.replace = replace;
|
||||
this.top = top;
|
||||
this.surface = surface;
|
||||
}
|
||||
|
||||
protected void func_180707_a(long p_180707_1_, int p_180707_3_, int p_180707_4_, ChunkPrimer p_180707_5_, double p_180707_6_, double p_180707_8_, double p_180707_10_, float p_180707_12_, float p_180707_13_, float p_180707_14_, int p_180707_15_, int p_180707_16_, double p_180707_17_)
|
||||
{
|
||||
Random random = new Random(p_180707_1_);
|
||||
double d0 = (double)(p_180707_3_ * 16 + 8);
|
||||
double d1 = (double)(p_180707_4_ * 16 + 8);
|
||||
float f = 0.0F;
|
||||
float f1 = 0.0F;
|
||||
|
||||
if (p_180707_16_ <= 0)
|
||||
{
|
||||
int i = this.range * 16 - 16;
|
||||
p_180707_16_ = i - random.zrange(i / 4);
|
||||
}
|
||||
|
||||
boolean flag1 = false;
|
||||
|
||||
if (p_180707_15_ == -1)
|
||||
{
|
||||
p_180707_15_ = p_180707_16_ / 2;
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
float f2 = 1.0F;
|
||||
|
||||
for (int j = 0; j < 256; ++j)
|
||||
{
|
||||
if (j == 0 || random.zrange(3) == 0)
|
||||
{
|
||||
f2 = 1.0F + random.floatv() * random.floatv() * 1.0F;
|
||||
}
|
||||
|
||||
this.field_75046_d[j] = f2 * f2;
|
||||
}
|
||||
|
||||
for (; p_180707_15_ < p_180707_16_; ++p_180707_15_)
|
||||
{
|
||||
double d9 = 1.5D + (double)(ExtMath.sin((float)p_180707_15_ * (float)Math.PI / (float)p_180707_16_) * p_180707_12_ * 1.0F);
|
||||
double d2 = d9 * p_180707_17_;
|
||||
d9 = d9 * ((double)random.floatv() * 0.25D + 0.75D);
|
||||
d2 = d2 * ((double)random.floatv() * 0.25D + 0.75D);
|
||||
float f3 = ExtMath.cos(p_180707_14_);
|
||||
float f4 = ExtMath.sin(p_180707_14_);
|
||||
p_180707_6_ += (double)(ExtMath.cos(p_180707_13_) * f3);
|
||||
p_180707_8_ += (double)f4;
|
||||
p_180707_10_ += (double)(ExtMath.sin(p_180707_13_) * f3);
|
||||
p_180707_14_ = p_180707_14_ * 0.7F;
|
||||
p_180707_14_ = p_180707_14_ + f1 * 0.05F;
|
||||
p_180707_13_ += f * 0.05F;
|
||||
f1 = f1 * 0.8F;
|
||||
f = f * 0.5F;
|
||||
f1 = f1 + (random.floatv() - random.floatv()) * random.floatv() * 2.0F;
|
||||
f = f + (random.floatv() - random.floatv()) * random.floatv() * 4.0F;
|
||||
|
||||
if (flag1 || random.zrange(4) != 0)
|
||||
{
|
||||
double d3 = p_180707_6_ - d0;
|
||||
double d4 = p_180707_10_ - d1;
|
||||
double d5 = (double)(p_180707_16_ - p_180707_15_);
|
||||
double d6 = (double)(p_180707_12_ + 2.0F + 16.0F);
|
||||
|
||||
if (d3 * d3 + d4 * d4 - d5 * d5 > d6 * d6)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_180707_6_ >= d0 - 16.0D - d9 * 2.0D && p_180707_10_ >= d1 - 16.0D - d9 * 2.0D && p_180707_6_ <= d0 + 16.0D + d9 * 2.0D && p_180707_10_ <= d1 + 16.0D + d9 * 2.0D)
|
||||
{
|
||||
int k2 = ExtMath.floord(p_180707_6_ - d9) - p_180707_3_ * 16 - 1;
|
||||
int k = ExtMath.floord(p_180707_6_ + d9) - p_180707_3_ * 16 + 1;
|
||||
int l2 = ExtMath.floord(p_180707_8_ - d2) - 1;
|
||||
int l = ExtMath.floord(p_180707_8_ + d2) + 1;
|
||||
int i3 = ExtMath.floord(p_180707_10_ - d9) - p_180707_4_ * 16 - 1;
|
||||
int i1 = ExtMath.floord(p_180707_10_ + d9) - p_180707_4_ * 16 + 1;
|
||||
|
||||
if (k2 < 0)
|
||||
{
|
||||
k2 = 0;
|
||||
}
|
||||
|
||||
if (k > 16)
|
||||
{
|
||||
k = 16;
|
||||
}
|
||||
|
||||
if (l2 < 1)
|
||||
{
|
||||
l2 = 1;
|
||||
}
|
||||
|
||||
if (l > 248)
|
||||
{
|
||||
l = 248;
|
||||
}
|
||||
|
||||
if (i3 < 0)
|
||||
{
|
||||
i3 = 0;
|
||||
}
|
||||
|
||||
if (i1 > 16)
|
||||
{
|
||||
i1 = 16;
|
||||
}
|
||||
|
||||
boolean flag2 = false;
|
||||
|
||||
for (int j1 = k2; !flag2 && j1 < k; ++j1)
|
||||
{
|
||||
for (int k1 = i3; !flag2 && k1 < i1; ++k1)
|
||||
{
|
||||
for (int l1 = l + 1; !flag2 && l1 >= l2 - 1; --l1)
|
||||
{
|
||||
if (l1 >= 0 && l1 < p_180707_5_.height)
|
||||
{
|
||||
State iblockstate = p_180707_5_.get(j1, l1, k1);
|
||||
|
||||
if (iblockstate.getBlock().getMaterial().isLiquid())
|
||||
{
|
||||
flag2 = true;
|
||||
}
|
||||
|
||||
if (l1 != l2 - 1 && j1 != k2 && j1 != k - 1 && k1 != i3 && k1 != i1 - 1)
|
||||
{
|
||||
l1 = l2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag2)
|
||||
{
|
||||
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
||||
|
||||
for (int j3 = k2; j3 < k; ++j3)
|
||||
{
|
||||
double d10 = ((double)(j3 + p_180707_3_ * 16) + 0.5D - p_180707_6_) / d9;
|
||||
|
||||
for (int i2 = i3; i2 < i1; ++i2)
|
||||
{
|
||||
double d7 = ((double)(i2 + p_180707_4_ * 16) + 0.5D - p_180707_10_) / d9;
|
||||
boolean flag = false;
|
||||
|
||||
if (d10 * d10 + d7 * d7 < 1.0D)
|
||||
{
|
||||
for (int j2 = l; j2 > l2; --j2)
|
||||
{
|
||||
double d8 = ((double)(j2 - 1) + 0.5D - p_180707_8_) / d2;
|
||||
|
||||
if ((d10 * d10 + d7 * d7) * (double)this.field_75046_d[j2 - 1] + d8 * d8 / 6.0D < 1.0D)
|
||||
{
|
||||
State iblockstate1 = p_180707_5_.get(j3, j2, i2);
|
||||
|
||||
if (iblockstate1.getBlock() == this.surface)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (iblockstate1.getBlock() == this.replace || iblockstate1.getBlock() == this.top || iblockstate1.getBlock() == this.surface)
|
||||
{
|
||||
if (j2 - 1 < 10)
|
||||
{
|
||||
p_180707_5_.set(j3, j2, i2, this.filler);
|
||||
}
|
||||
else
|
||||
{
|
||||
p_180707_5_.set(j3, j2, i2, Blocks.air.getState());
|
||||
|
||||
if (flag && p_180707_5_.get(j3, j2 - 1, i2).getBlock() == this.top)
|
||||
{
|
||||
blockpos$mutableblockpos.set(j3 + p_180707_3_ * 16, 0, i2 + p_180707_4_ * 16);
|
||||
p_180707_5_.set(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively called by generate()
|
||||
*/
|
||||
protected void recursiveGenerate(AWorldServer worldIn, int chunkX, int chunkZ, int p_180701_4_, int p_180701_5_, ChunkPrimer chunkPrimerIn)
|
||||
{
|
||||
if (this.rand.zrange(50) == 0)
|
||||
{
|
||||
double d0 = (double)(chunkX * 16 + this.rand.zrange(16));
|
||||
double d1 = (double)(this.rand.zrange(this.rand.zrange(40) + 8) + 20);
|
||||
double d2 = (double)(chunkZ * 16 + this.rand.zrange(16));
|
||||
int i = 1;
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
float f = this.rand.floatv() * (float)Math.PI * 2.0F;
|
||||
float f1 = (this.rand.floatv() - 0.5F) * 2.0F / 8.0F;
|
||||
float f2 = (this.rand.floatv() * 2.0F + this.rand.floatv()) * 2.0F;
|
||||
this.func_180707_a(this.rand.longv(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2, f2, f, f1, 0, 0, 3.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package common.worldgen.feature;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.item.RngLoot;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityChest;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
import common.worldgen.LootConstants;
|
||||
|
||||
public class WorldGenAbandonedChest extends FeatureGenerator
|
||||
{
|
||||
private final WeightedList<RngLoot> items;
|
||||
private final int amount;
|
||||
|
||||
// BlockPos pos = world.getTopSolidOrLiquidBlock(new BlockPos(x, 0, z)).up();
|
||||
|
||||
public WorldGenAbandonedChest(WeightedList<RngLoot> items, int amount)
|
||||
{
|
||||
this.items = items;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public WorldGenAbandonedChest() {
|
||||
this(LootConstants.ABANDONED_ITEMS, 10);
|
||||
}
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
Block block;
|
||||
while (((block = worldIn.getState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 1)
|
||||
{
|
||||
position = position.down();
|
||||
}
|
||||
if (position.getY() < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
position = position.up();
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
BlockPos blockpos = position.add(rand.zrange(4) - rand.zrange(4), rand.zrange(3) - rand.zrange(3), rand.zrange(4) - rand.zrange(4));
|
||||
if (worldIn.isAirBlock(blockpos) && worldIn.isBlockSolid(blockpos.down()))
|
||||
{
|
||||
worldIn.setState(blockpos, Blocks.chest.getState(), 2);
|
||||
TileEntity tileentity = worldIn.getTileEntity(blockpos);
|
||||
if(tileentity instanceof TileEntityChest)
|
||||
RngLoot.generateChestContents(rand, this.items, (TileEntityChest)tileentity, this.amount);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
package common.worldgen.feature;
|
||||
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenAsteroid extends FeatureGenerator {
|
||||
private final State[] blocks;
|
||||
|
||||
public WorldGenAsteroid(State ... blocks) {
|
||||
this.blocks = blocks;
|
||||
}
|
||||
|
||||
public boolean generate(AWorldServer world, Random rand, BlockPos pos) {
|
||||
for(pos = pos.add(-8, 0, -8); pos.getY() > 9 && !world.isAirBlock(pos); pos = pos.down()) {
|
||||
;
|
||||
}
|
||||
if(pos.getY() <= 8)
|
||||
return false;
|
||||
pos = pos.down(8);
|
||||
boolean[] set = new boolean[4096];
|
||||
int iter = rand.range(1, 15);
|
||||
for(int n = 0; n < iter; ++n) {
|
||||
double d0 = rand.doublev() * 6.0D + 3.0D;
|
||||
double d1 = rand.doublev() * 6.0D + 3.0D;
|
||||
double d2 = rand.doublev() * 6.0D + 3.0D;
|
||||
double d3 = rand.doublev() * (16.0D - d0 - 2.0D) + 1.0D + d0 / 2.0D;
|
||||
double d4 = rand.doublev() * (16.0D - d1 - 2.0D) + 1.0D + d1 / 2.0D;
|
||||
double d5 = rand.doublev() * (16.0D - d2 - 2.0D) + 1.0D + d2 / 2.0D;
|
||||
for(int x = 1; x < 15; ++x) {
|
||||
for(int z = 1; z < 15; ++z) {
|
||||
for(int y = 1; y < 15; ++y) {
|
||||
double dx = ((double)x - d3) / (d0 / 2.0D);
|
||||
double dy = ((double)y - d4) / (d1 / 2.0D);
|
||||
double dz = ((double)z - d5) / (d2 / 2.0D);
|
||||
double dist = dx * dx + dy * dy + dz * dz;
|
||||
if(dist < 1.0D) {
|
||||
set[(x * 16 + z) * 16 + y] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int x = 0; x < 16; ++x) {
|
||||
for(int z = 0; z < 16; ++z) {
|
||||
for(int y = 0; y < 16; ++y) {
|
||||
boolean flag = !set[(x * 16 + z) * 16 + y]
|
||||
&& (x < 15 && set[((x + 1) * 16 + z) * 16 + y] || x > 0 && set[((x - 1) * 16 + z) * 16 + y]
|
||||
|| z < 15 && set[(x * 16 + z + 1) * 16 + y] || z > 0 && set[(x * 16 + (z - 1)) * 16 + y]
|
||||
|| y < 7 && set[(x * 16 + z) * 16 + y + 1] || y > 0 && set[(x * 16 + z) * 16 + (y - 1)]);
|
||||
if(flag && !world.isAirBlock(pos.add(x, y, z))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int x = 0; x < 16; ++x) {
|
||||
for(int z = 0; z < 16; ++z) {
|
||||
for(int y = 0; y < 16; ++y) {
|
||||
if(set[(x * 16 + z) * 16 + y]) {
|
||||
world.setState(pos.add(x, y, z), rand.pick(this.blocks), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
package common.worldgen.feature;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenBlockBlob extends FeatureGenerator
|
||||
{
|
||||
private final Block field_150545_a;
|
||||
private final int field_150544_b;
|
||||
|
||||
public WorldGenBlockBlob(Block p_i45450_1_, int p_i45450_2_)
|
||||
{
|
||||
// super(false);
|
||||
this.field_150545_a = p_i45450_1_;
|
||||
this.field_150544_b = p_i45450_2_;
|
||||
}
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
label0:
|
||||
{
|
||||
if (position.getY() > 3)
|
||||
{
|
||||
if (worldIn.isAirBlock(position.down()))
|
||||
{
|
||||
break label0;
|
||||
}
|
||||
|
||||
Block block = worldIn.getState(position.down()).getBlock();
|
||||
|
||||
if (block != Blocks.grass && block != Blocks.dirt && block != Blocks.stone)
|
||||
{
|
||||
break label0;
|
||||
}
|
||||
}
|
||||
|
||||
if (position.getY() <= 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int i1 = this.field_150544_b;
|
||||
|
||||
for (int i = 0; i1 >= 0 && i < 3; ++i)
|
||||
{
|
||||
int j = i1 + rand.zrange(2);
|
||||
int k = i1 + rand.zrange(2);
|
||||
int l = i1 + rand.zrange(2);
|
||||
float f = (float)(j + k + l) * 0.333F + 0.5F;
|
||||
|
||||
for (BlockPos blockpos : BlockPos.getAllInBox(position.add(-j, -k, -l), position.add(j, k, l)))
|
||||
{
|
||||
if (blockpos.distanceSq(position) <= (double)(f * f))
|
||||
{
|
||||
worldIn.setState(blockpos, this.field_150545_a.getState(), 4);
|
||||
}
|
||||
}
|
||||
|
||||
position = position.add(-(i1 + 1) + rand.zrange(2 + i1 * 2), 0 - rand.zrange(2), -(i1 + 1) + rand.zrange(2 + i1 * 2));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
position = position.down();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
package common.worldgen.feature;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenClay extends FeatureGenerator
|
||||
{
|
||||
protected Block clayBlock = Blocks.clay;
|
||||
|
||||
/** The number of blocks to generate. */
|
||||
protected int numberOfBlocks;
|
||||
|
||||
public WorldGenClay(int blocks)
|
||||
{
|
||||
this.numberOfBlocks = blocks;
|
||||
}
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
if (!worldIn.getState(position).getBlock().getMaterial().isColdLiquid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = rand.zrange(this.numberOfBlocks - 2) + 2;
|
||||
int j = 1;
|
||||
|
||||
for (int k = position.getX() - i; k <= position.getX() + i; ++k)
|
||||
{
|
||||
for (int l = position.getZ() - i; l <= position.getZ() + i; ++l)
|
||||
{
|
||||
int i1 = k - position.getX();
|
||||
int j1 = l - position.getZ();
|
||||
|
||||
if (i1 * i1 + j1 * j1 <= i * i)
|
||||
{
|
||||
for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1)
|
||||
{
|
||||
BlockPos blockpos = new BlockPos(k, k1, l);
|
||||
Block block = worldIn.getState(blockpos).getBlock();
|
||||
|
||||
if (block == Blocks.dirt || block == Blocks.clay)
|
||||
{
|
||||
worldIn.setState(blockpos, this.clayBlock.getState(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package common.worldgen.feature;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class WorldGenClayExt extends WorldGenClay {
|
||||
public WorldGenClayExt(int blocks) {
|
||||
super(blocks);
|
||||
}
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position) {
|
||||
if(!worldIn.getState(position).getBlock().getMaterial().isColdLiquid()) {
|
||||
return false;
|
||||
}
|
||||
float f = rand.floatv() * 3.141593F;
|
||||
double d = (float)position.getX() + (ExtMath.sin(f) * (float)numberOfBlocks) / 8F;
|
||||
double d1 = (float)position.getX() - (ExtMath.sin(f) * (float)numberOfBlocks) / 8F;
|
||||
double d2 = (float)position.getZ() + (ExtMath.cos(f) * (float)numberOfBlocks) / 8F;
|
||||
double d3 = (float)position.getZ() - (ExtMath.cos(f) * (float)numberOfBlocks) / 8F;
|
||||
double d4 = position.getY() + rand.zrange(3) + 2;
|
||||
double d5 = position.getY() + rand.zrange(3) + 2;
|
||||
for(int l = 0; l <= numberOfBlocks; l++) {
|
||||
double d6 = d + ((d1 - d) * (double)l) / (double)numberOfBlocks;
|
||||
double d7 = d4 + ((d5 - d4) * (double)l) / (double)numberOfBlocks;
|
||||
double d8 = d2 + ((d3 - d2) * (double)l) / (double)numberOfBlocks;
|
||||
double d9 = (rand.doublev() * (double)numberOfBlocks) / 16D;
|
||||
double d10 = (double)(ExtMath.sin(((float)l * 3.141593F) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D;
|
||||
double d11 = (double)(ExtMath.sin(((float)l * 3.141593F) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D;
|
||||
for(int i1 = (int)(d6 - d10 / 2D); i1 <= (int)(d6 + d10 / 2D); i1++) {
|
||||
for(int j1 = (int)(d7 - d11 / 2D); j1 <= (int)(d7 + d11 / 2D); j1++) {
|
||||
for(int k1 = (int)(d8 - d10 / 2D); k1 <= (int)(d8 + d10 / 2D); k1++) {
|
||||
double d12 = (((double)i1 + 0.5D) - d6) / (d10 / 2D);
|
||||
double d13 = (((double)j1 + 0.5D) - d7) / (d11 / 2D);
|
||||
double d14 = (((double)k1 + 0.5D) - d8) / (d10 / 2D);
|
||||
if(d12 * d12 + d13 * d13 + d14 * d14 >= 1.0D) {
|
||||
continue;
|
||||
}
|
||||
BlockPos blockpos = new BlockPos(i1, j1, k1);
|
||||
Block block = worldIn.getState(blockpos).getBlock();
|
||||
|
||||
if(block == Blocks.sand) {
|
||||
worldIn.setState(blockpos, this.clayBlock.getState(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
package common.worldgen.feature;
|
||||
|
||||
import common.block.BlockSand;
|
||||
import common.block.BlockSlab;
|
||||
import common.init.Blocks;
|
||||
import common.pattern.BlockStateHelper;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Predicates;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenDesertWells extends FeatureGenerator
|
||||
{
|
||||
private static final BlockStateHelper field_175913_a = BlockStateHelper.forBlock(Blocks.sand).where(BlockSand.VARIANT, Predicates.equalTo(BlockSand.EnumType.SAND));
|
||||
private final State field_175911_b = Blocks.sandstone_slab.getState().withProperty(BlockSlab.FACING, Facing.DOWN);
|
||||
private final State field_175912_c = Blocks.sandstone.getState();
|
||||
private final State field_175910_d = Blocks.flowing_water.getState();
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
while (worldIn.isAirBlock(position) && position.getY() > 2)
|
||||
{
|
||||
position = position.down();
|
||||
}
|
||||
|
||||
if (!field_175913_a.test(worldIn.getState(position)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = -2; i <= 2; ++i)
|
||||
{
|
||||
for (int j = -2; j <= 2; ++j)
|
||||
{
|
||||
if (worldIn.isAirBlock(position.add(i, -1, j)) && worldIn.isAirBlock(position.add(i, -2, j)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int l = -1; l <= 0; ++l)
|
||||
{
|
||||
for (int l1 = -2; l1 <= 2; ++l1)
|
||||
{
|
||||
for (int k = -2; k <= 2; ++k)
|
||||
{
|
||||
worldIn.setState(position.add(l1, l, k), this.field_175912_c, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
worldIn.setState(position, this.field_175910_d, 2);
|
||||
|
||||
for (Facing enumfacing : Facing.Plane.HORIZONTAL)
|
||||
{
|
||||
worldIn.setState(position.offset(enumfacing), this.field_175910_d, 2);
|
||||
}
|
||||
|
||||
for (int i1 = -2; i1 <= 2; ++i1)
|
||||
{
|
||||
for (int i2 = -2; i2 <= 2; ++i2)
|
||||
{
|
||||
if (i1 == -2 || i1 == 2 || i2 == -2 || i2 == 2)
|
||||
{
|
||||
worldIn.setState(position.add(i1, 1, i2), this.field_175912_c, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
worldIn.setState(position.add(2, 1, 0), this.field_175911_b, 2);
|
||||
worldIn.setState(position.add(-2, 1, 0), this.field_175911_b, 2);
|
||||
worldIn.setState(position.add(0, 1, 2), this.field_175911_b, 2);
|
||||
worldIn.setState(position.add(0, 1, -2), this.field_175911_b, 2);
|
||||
|
||||
for (int j1 = -1; j1 <= 1; ++j1)
|
||||
{
|
||||
for (int j2 = -1; j2 <= 1; ++j2)
|
||||
{
|
||||
if (j1 == 0 && j2 == 0)
|
||||
{
|
||||
worldIn.setState(position.add(j1, 4, j2), this.field_175912_c, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setState(position.add(j1, 4, j2), this.field_175911_b, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int k1 = 1; k1 <= 3; ++k1)
|
||||
{
|
||||
worldIn.setState(position.add(-1, k1, -1), this.field_175912_c, 2);
|
||||
worldIn.setState(position.add(-1, k1, 1), this.field_175912_c, 2);
|
||||
worldIn.setState(position.add(1, k1, -1), this.field_175912_c, 2);
|
||||
worldIn.setState(position.add(1, k1, 1), this.field_175912_c, 2);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package common.worldgen.feature;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenFire extends FeatureGenerator
|
||||
{
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
for (int i = 0; i < 64; ++i)
|
||||
{
|
||||
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
|
||||
|
||||
if (worldIn.isAirBlock(blockpos) && worldIn.getState(blockpos.down()).getBlock() == Blocks.hellrock)
|
||||
{
|
||||
worldIn.setState(blockpos, Blocks.fire.getState(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
package common.worldgen.feature;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenGlowStone extends FeatureGenerator
|
||||
{
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
if (!worldIn.isAirBlock(position))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (worldIn.getState(position.up()).getBlock() != Blocks.hellrock)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setState(position, Blocks.glowstone.getState(), 2);
|
||||
|
||||
for (int i = 0; i < 1500; ++i)
|
||||
{
|
||||
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), -rand.zrange(12), rand.zrange(8) - rand.zrange(8));
|
||||
|
||||
if (worldIn.getState(blockpos).getBlock().getMaterial() == Material.air)
|
||||
{
|
||||
int j = 0;
|
||||
|
||||
for (Facing enumfacing : Facing.values())
|
||||
{
|
||||
if (worldIn.getState(blockpos.offset(enumfacing)).getBlock() == Blocks.glowstone)
|
||||
{
|
||||
++j;
|
||||
}
|
||||
|
||||
if (j > 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (j == 1)
|
||||
{
|
||||
worldIn.setState(blockpos, Blocks.glowstone.getState(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
package common.worldgen.feature;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenHellLava extends FeatureGenerator
|
||||
{
|
||||
private final Block field_150553_a;
|
||||
private final boolean field_94524_b;
|
||||
|
||||
public WorldGenHellLava(Block p_i45453_1_, boolean p_i45453_2_)
|
||||
{
|
||||
this.field_150553_a = p_i45453_1_;
|
||||
this.field_94524_b = p_i45453_2_;
|
||||
}
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
if (worldIn.getState(position.up()).getBlock() != Blocks.hellrock)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (worldIn.getState(position).getBlock().getMaterial() != Material.air && worldIn.getState(position).getBlock() != Blocks.hellrock)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (worldIn.getState(position.west()).getBlock() == Blocks.hellrock)
|
||||
{
|
||||
++i;
|
||||
}
|
||||
|
||||
if (worldIn.getState(position.east()).getBlock() == Blocks.hellrock)
|
||||
{
|
||||
++i;
|
||||
}
|
||||
|
||||
if (worldIn.getState(position.north()).getBlock() == Blocks.hellrock)
|
||||
{
|
||||
++i;
|
||||
}
|
||||
|
||||
if (worldIn.getState(position.south()).getBlock() == Blocks.hellrock)
|
||||
{
|
||||
++i;
|
||||
}
|
||||
|
||||
if (worldIn.getState(position.down()).getBlock() == Blocks.hellrock)
|
||||
{
|
||||
++i;
|
||||
}
|
||||
|
||||
int j = 0;
|
||||
|
||||
if (worldIn.isAirBlock(position.west()))
|
||||
{
|
||||
++j;
|
||||
}
|
||||
|
||||
if (worldIn.isAirBlock(position.east()))
|
||||
{
|
||||
++j;
|
||||
}
|
||||
|
||||
if (worldIn.isAirBlock(position.north()))
|
||||
{
|
||||
++j;
|
||||
}
|
||||
|
||||
if (worldIn.isAirBlock(position.south()))
|
||||
{
|
||||
++j;
|
||||
}
|
||||
|
||||
if (worldIn.isAirBlock(position.down()))
|
||||
{
|
||||
++j;
|
||||
}
|
||||
|
||||
if (!this.field_94524_b && i == 4 && j == 1 || i == 5)
|
||||
{
|
||||
worldIn.setState(position, this.field_150553_a.getState(), 2);
|
||||
worldIn.forceBlockUpdateTick(this.field_150553_a, position, rand);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package common.worldgen.feature;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenIcePath extends FeatureGenerator
|
||||
{
|
||||
private Block block = Blocks.packed_ice;
|
||||
private int basePathWidth;
|
||||
|
||||
public WorldGenIcePath(int p_i45454_1_)
|
||||
{
|
||||
this.basePathWidth = p_i45454_1_;
|
||||
}
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
while (worldIn.isAirBlock(position) && position.getY() > 2)
|
||||
{
|
||||
position = position.down();
|
||||
}
|
||||
|
||||
if (worldIn.getState(position).getBlock() != Blocks.snow)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = rand.zrange(this.basePathWidth - 2) + 2;
|
||||
int j = 1;
|
||||
|
||||
for (int k = position.getX() - i; k <= position.getX() + i; ++k)
|
||||
{
|
||||
for (int l = position.getZ() - i; l <= position.getZ() + i; ++l)
|
||||
{
|
||||
int i1 = k - position.getX();
|
||||
int j1 = l - position.getZ();
|
||||
|
||||
if (i1 * i1 + j1 * j1 <= i * i)
|
||||
{
|
||||
for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1)
|
||||
{
|
||||
BlockPos blockpos = new BlockPos(k, k1, l);
|
||||
Block block = worldIn.getState(blockpos).getBlock();
|
||||
|
||||
if (block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice)
|
||||
{
|
||||
worldIn.setState(blockpos, this.block.getState(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
package common.worldgen.feature;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenIceSpike extends FeatureGenerator
|
||||
{
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
while (worldIn.isAirBlock(position) && position.getY() > 2)
|
||||
{
|
||||
position = position.down();
|
||||
}
|
||||
|
||||
if (worldIn.getState(position).getBlock() != Blocks.snow)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
position = position.up(rand.zrange(4));
|
||||
int i = rand.zrange(4) + 7;
|
||||
int j = i / 4 + rand.zrange(2);
|
||||
|
||||
if (j > 1 && rand.zrange(60) == 0)
|
||||
{
|
||||
position = position.up(10 + rand.zrange(30));
|
||||
}
|
||||
|
||||
for (int k = 0; k < i; ++k)
|
||||
{
|
||||
float f = (1.0F - (float)k / (float)i) * (float)j;
|
||||
int l = ExtMath.ceilf(f);
|
||||
|
||||
for (int i1 = -l; i1 <= l; ++i1)
|
||||
{
|
||||
float f1 = (float)ExtMath.absi(i1) - 0.25F;
|
||||
|
||||
for (int j1 = -l; j1 <= l; ++j1)
|
||||
{
|
||||
float f2 = (float)ExtMath.absi(j1) - 0.25F;
|
||||
|
||||
if ((i1 == 0 && j1 == 0 || f1 * f1 + f2 * f2 <= f * f) && (i1 != -l && i1 != l && j1 != -l && j1 != l || rand.floatv() <= 0.75F))
|
||||
{
|
||||
Block block = worldIn.getState(position.add(i1, k, j1)).getBlock();
|
||||
|
||||
if (block.getMaterial() == Material.air || block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice)
|
||||
{
|
||||
this.setBlockAndNotifyAdequately(worldIn, position.add(i1, k, j1), Blocks.packed_ice.getState());
|
||||
}
|
||||
|
||||
if (k != 0 && l > 1)
|
||||
{
|
||||
block = worldIn.getState(position.add(i1, -k, j1)).getBlock();
|
||||
|
||||
if (block.getMaterial() == Material.air || block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice)
|
||||
{
|
||||
this.setBlockAndNotifyAdequately(worldIn, position.add(i1, -k, j1), Blocks.packed_ice.getState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int k1 = j - 1;
|
||||
|
||||
if (k1 < 0)
|
||||
{
|
||||
k1 = 0;
|
||||
}
|
||||
else if (k1 > 1)
|
||||
{
|
||||
k1 = 1;
|
||||
}
|
||||
|
||||
for (int l1 = -k1; l1 <= k1; ++l1)
|
||||
{
|
||||
for (int i2 = -k1; i2 <= k1; ++i2)
|
||||
{
|
||||
BlockPos blockpos = position.add(l1, -1, i2);
|
||||
int j2 = 50;
|
||||
|
||||
if (Math.abs(l1) == 1 && Math.abs(i2) == 1)
|
||||
{
|
||||
j2 = rand.zrange(5);
|
||||
}
|
||||
|
||||
while (blockpos.getY() > 50)
|
||||
{
|
||||
Block block1 = worldIn.getState(blockpos).getBlock();
|
||||
|
||||
if (block1.getMaterial() != Material.air && block1 != Blocks.dirt && block1 != Blocks.snow && block1 != Blocks.ice && block1 != Blocks.packed_ice)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
this.setBlockAndNotifyAdequately(worldIn, blockpos, Blocks.packed_ice.getState());
|
||||
blockpos = blockpos.down();
|
||||
--j2;
|
||||
|
||||
if (j2 <= 0)
|
||||
{
|
||||
blockpos = blockpos.down(rand.zrange(5) + 1);
|
||||
j2 = rand.zrange(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
package common.worldgen.feature;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenSand extends FeatureGenerator
|
||||
{
|
||||
private Block block;
|
||||
|
||||
/** The maximum radius used when generating a patch of blocks. */
|
||||
private int radius;
|
||||
|
||||
public WorldGenSand(Block p_i45462_1_, int p_i45462_2_)
|
||||
{
|
||||
this.block = p_i45462_1_;
|
||||
this.radius = p_i45462_2_;
|
||||
}
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
if (!worldIn.getState(position).getBlock().getMaterial().isColdLiquid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = rand.zrange(this.radius - 2) + 2;
|
||||
int j = 2;
|
||||
|
||||
for (int k = position.getX() - i; k <= position.getX() + i; ++k)
|
||||
{
|
||||
for (int l = position.getZ() - i; l <= position.getZ() + i; ++l)
|
||||
{
|
||||
int i1 = k - position.getX();
|
||||
int j1 = l - position.getZ();
|
||||
|
||||
if (i1 * i1 + j1 * j1 <= i * i)
|
||||
{
|
||||
for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1)
|
||||
{
|
||||
BlockPos blockpos = new BlockPos(k, k1, l);
|
||||
Block block = worldIn.getState(blockpos).getBlock();
|
||||
|
||||
if (block == Blocks.dirt || block == Blocks.grass)
|
||||
{
|
||||
worldIn.setState(blockpos, this.block.getState(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
package common.worldgen.feature;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.Entity;
|
||||
import common.entity.item.EntityCrystal;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenSpikes extends FeatureGenerator
|
||||
{
|
||||
private final Block base;
|
||||
private final int maxHeight;
|
||||
private final int minRadius;
|
||||
private final int maxRadius;
|
||||
private final State block;
|
||||
private final boolean crystals;
|
||||
|
||||
public WorldGenSpikes(Block base, int maxHeight, int minRadius, int maxRadius, State placed, boolean crystals)
|
||||
{
|
||||
this.base = base;
|
||||
this.maxHeight = maxHeight;
|
||||
this.minRadius = minRadius;
|
||||
this.maxRadius = maxRadius;
|
||||
this.block = placed;
|
||||
this.crystals = crystals;
|
||||
}
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
if (worldIn.isAirBlock(position) && worldIn.getState(position.down()).getBlock() == this.base)
|
||||
{
|
||||
int i = rand.zrange(this.maxHeight - 6) + 6;
|
||||
int j = rand.range(this.minRadius, this.maxRadius);
|
||||
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
||||
|
||||
for (int k = position.getX() - j; k <= position.getX() + j; ++k)
|
||||
{
|
||||
for (int l = position.getZ() - j; l <= position.getZ() + j; ++l)
|
||||
{
|
||||
int i1 = k - position.getX();
|
||||
int j1 = l - position.getZ();
|
||||
|
||||
if (i1 * i1 + j1 * j1 <= j * j + 1 && worldIn.getState(blockpos$mutableblockpos.set(k, position.getY() - 1, l)).getBlock() != this.base)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int l1 = position.getY(); l1 < position.getY() + i && l1 < 512; ++l1)
|
||||
{
|
||||
for (int i2 = position.getX() - j; i2 <= position.getX() + j; ++i2)
|
||||
{
|
||||
for (int j2 = position.getZ() - j; j2 <= position.getZ() + j; ++j2)
|
||||
{
|
||||
int k2 = i2 - position.getX();
|
||||
int k1 = j2 - position.getZ();
|
||||
|
||||
if (k2 * k2 + k1 * k1 <= j * j + 1)
|
||||
{
|
||||
worldIn.setState(new BlockPos(i2, l1, j2), this.block, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.crystals) {
|
||||
Entity entity = new EntityCrystal(worldIn);
|
||||
entity.setLocationAndAngles((double)((float)position.getX() + 0.5F), (double)(position.getY() + i), (double)((float)position.getZ() + 0.5F), rand.floatv() * 360.0F, 0.0F);
|
||||
worldIn.spawnEntityInWorld(entity);
|
||||
// if(worldIn.dimension.getDimensionId() == 1)
|
||||
// worldIn.setBlockState(position.up(i), Blocks.obsidian.getDefaultState(), 2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package common.worldgen.foliage;
|
||||
|
||||
import common.block.BlockDoublePlant;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class FeatureDoublePlant
|
||||
{
|
||||
private BlockDoublePlant.EnumPlantType type;
|
||||
|
||||
public void setPlantType(BlockDoublePlant.EnumPlantType type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
boolean flag = false;
|
||||
|
||||
for (int i = 0; i < 64; ++i)
|
||||
{
|
||||
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
|
||||
|
||||
if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 254) && Blocks.double_plant.canPlaceBlockAt(worldIn, blockpos))
|
||||
{
|
||||
Blocks.double_plant.placeAt(worldIn, blockpos, this.type, 2);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
}
|
|
@ -1,223 +0,0 @@
|
|||
package common.worldgen.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockHugeMushroom;
|
||||
import common.init.Blocks;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenBigMushroom extends FeatureGenerator
|
||||
{
|
||||
/** The mushroom type. 0 for brown, 1 for red. */
|
||||
private Block mushroomType;
|
||||
|
||||
public WorldGenBigMushroom(Block p_i46449_1_)
|
||||
{
|
||||
super(true);
|
||||
this.mushroomType = p_i46449_1_;
|
||||
}
|
||||
|
||||
public WorldGenBigMushroom()
|
||||
{
|
||||
super(false);
|
||||
}
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
// if (this.mushroomType == null)
|
||||
// {
|
||||
this.mushroomType = rand.chance() ? Blocks.brown_mushroom_block : Blocks.red_mushroom_block;
|
||||
// }
|
||||
|
||||
int i = rand.zrange(3) + 4;
|
||||
boolean flag = true;
|
||||
|
||||
if (position.getY() >= 1 && position.getY() + i + 1 < 512)
|
||||
{
|
||||
for (int j = position.getY(); j <= position.getY() + 1 + i; ++j)
|
||||
{
|
||||
int k = 3;
|
||||
|
||||
if (j <= position.getY() + 3)
|
||||
{
|
||||
k = 0;
|
||||
}
|
||||
|
||||
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
||||
|
||||
for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l)
|
||||
{
|
||||
for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1)
|
||||
{
|
||||
if (j >= 0 && j < 512)
|
||||
{
|
||||
Block block = worldIn.getState(blockpos$mutableblockpos.set(l, j, i1)).getBlock();
|
||||
|
||||
if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Block block1 = worldIn.getState(position.down()).getBlock();
|
||||
|
||||
if (block1 != Blocks.dirt && block1 != Blocks.grass && block1 != Blocks.mycelium)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int k2 = position.getY() + i;
|
||||
|
||||
if (this.mushroomType == Blocks.red_mushroom_block)
|
||||
{
|
||||
k2 = position.getY() + i - 3;
|
||||
}
|
||||
|
||||
for (int l2 = k2; l2 <= position.getY() + i; ++l2)
|
||||
{
|
||||
int j3 = 1;
|
||||
|
||||
if (l2 < position.getY() + i)
|
||||
{
|
||||
++j3;
|
||||
}
|
||||
|
||||
if (this.mushroomType == Blocks.brown_mushroom_block)
|
||||
{
|
||||
j3 = 3;
|
||||
}
|
||||
|
||||
int k3 = position.getX() - j3;
|
||||
int l3 = position.getX() + j3;
|
||||
int j1 = position.getZ() - j3;
|
||||
int k1 = position.getZ() + j3;
|
||||
|
||||
for (int l1 = k3; l1 <= l3; ++l1)
|
||||
{
|
||||
for (int i2 = j1; i2 <= k1; ++i2)
|
||||
{
|
||||
int j2 = 5;
|
||||
|
||||
if (l1 == k3)
|
||||
{
|
||||
--j2;
|
||||
}
|
||||
else if (l1 == l3)
|
||||
{
|
||||
++j2;
|
||||
}
|
||||
|
||||
if (i2 == j1)
|
||||
{
|
||||
j2 -= 3;
|
||||
}
|
||||
else if (i2 == k1)
|
||||
{
|
||||
j2 += 3;
|
||||
}
|
||||
|
||||
BlockHugeMushroom.EnumType blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.byMetadata(j2);
|
||||
|
||||
if (this.mushroomType == Blocks.brown_mushroom_block || l2 < position.getY() + i)
|
||||
{
|
||||
if ((l1 == k3 || l1 == l3) && (i2 == j1 || i2 == k1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (l1 == position.getX() - (j3 - 1) && i2 == j1)
|
||||
{
|
||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.NORTH_WEST;
|
||||
}
|
||||
|
||||
if (l1 == k3 && i2 == position.getZ() - (j3 - 1))
|
||||
{
|
||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.NORTH_WEST;
|
||||
}
|
||||
|
||||
if (l1 == position.getX() + (j3 - 1) && i2 == j1)
|
||||
{
|
||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.NORTH_EAST;
|
||||
}
|
||||
|
||||
if (l1 == l3 && i2 == position.getZ() - (j3 - 1))
|
||||
{
|
||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.NORTH_EAST;
|
||||
}
|
||||
|
||||
if (l1 == position.getX() - (j3 - 1) && i2 == k1)
|
||||
{
|
||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.SOUTH_WEST;
|
||||
}
|
||||
|
||||
if (l1 == k3 && i2 == position.getZ() + (j3 - 1))
|
||||
{
|
||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.SOUTH_WEST;
|
||||
}
|
||||
|
||||
if (l1 == position.getX() + (j3 - 1) && i2 == k1)
|
||||
{
|
||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.SOUTH_EAST;
|
||||
}
|
||||
|
||||
if (l1 == l3 && i2 == position.getZ() + (j3 - 1))
|
||||
{
|
||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.SOUTH_EAST;
|
||||
}
|
||||
}
|
||||
|
||||
if (blockhugemushroom$enumtype == BlockHugeMushroom.EnumType.CENTER && l2 < position.getY() + i)
|
||||
{
|
||||
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.ALL_INSIDE;
|
||||
}
|
||||
|
||||
if (position.getY() >= position.getY() + i - 1 || blockhugemushroom$enumtype != BlockHugeMushroom.EnumType.ALL_INSIDE)
|
||||
{
|
||||
BlockPos blockpos = new BlockPos(l1, l2, i2);
|
||||
|
||||
if (!worldIn.getState(blockpos).getBlock().isFullBlock())
|
||||
{
|
||||
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.mushroomType.getState().withProperty(BlockHugeMushroom.VARIANT, blockhugemushroom$enumtype));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i3 = 0; i3 < i; ++i3)
|
||||
{
|
||||
Block block2 = worldIn.getState(position.up(i3)).getBlock();
|
||||
|
||||
if (!block2.isFullBlock())
|
||||
{
|
||||
this.setBlockAndNotifyAdequately(worldIn, position.up(i3), this.mushroomType.getState().withProperty(BlockHugeMushroom.VARIANT, BlockHugeMushroom.EnumType.STEM));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package common.worldgen.foliage;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenCactus extends FeatureGenerator
|
||||
{
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
|
||||
|
||||
if (worldIn.isAirBlock(blockpos))
|
||||
{
|
||||
int j = 1 + rand.zrange(rand.zrange(3) + 1);
|
||||
|
||||
for (int k = 0; k < j; ++k)
|
||||
{
|
||||
if (Blocks.cactus.canBlockStay(worldIn, blockpos))
|
||||
{
|
||||
worldIn.setState(blockpos.up(k), Blocks.cactus.getState(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package common.worldgen.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.material.Material;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenDeadBush extends FeatureGenerator
|
||||
{
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
Block block;
|
||||
|
||||
while (((block = worldIn.getState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0)
|
||||
{
|
||||
position = position.down();
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
|
||||
|
||||
if (worldIn.isAirBlock(blockpos) && Blocks.deadbush.canBlockStay(worldIn, blockpos, Blocks.deadbush.getState()))
|
||||
{
|
||||
worldIn.setState(blockpos, Blocks.deadbush.getState(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package common.worldgen.foliage;
|
||||
|
||||
import common.block.BlockFlower;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenFlowers extends FeatureGenerator
|
||||
{
|
||||
private BlockFlower flower;
|
||||
private State field_175915_b;
|
||||
|
||||
public WorldGenFlowers(BlockFlower p_i45632_1_, BlockFlower.EnumFlowerType p_i45632_2_)
|
||||
{
|
||||
this.setGeneratedBlock(p_i45632_1_, p_i45632_2_);
|
||||
}
|
||||
|
||||
public void setGeneratedBlock(BlockFlower p_175914_1_, BlockFlower.EnumFlowerType p_175914_2_)
|
||||
{
|
||||
this.flower = p_175914_1_;
|
||||
this.field_175915_b = p_175914_1_.getState().withProperty(p_175914_1_.getTypeProperty(), p_175914_2_);
|
||||
}
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
for (int i = 0; i < 64; ++i)
|
||||
{
|
||||
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
|
||||
|
||||
if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 511) && this.flower.canBlockStay(worldIn, blockpos, this.field_175915_b))
|
||||
{
|
||||
worldIn.setState(blockpos, this.field_175915_b, 2);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package common.worldgen.foliage;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenMelon extends FeatureGenerator
|
||||
{
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
for (int i = 0; i < 64; ++i)
|
||||
{
|
||||
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
|
||||
|
||||
if (Blocks.melon_block.canPlaceBlockAt(worldIn, blockpos) && worldIn.getState(blockpos.down()).getBlock() == Blocks.grass)
|
||||
{
|
||||
worldIn.setState(blockpos, Blocks.melon_block.getState(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package common.worldgen.foliage;
|
||||
|
||||
import common.block.BlockBush;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenMushroom extends FeatureGenerator
|
||||
{
|
||||
private BlockBush field_175908_a;
|
||||
|
||||
public WorldGenMushroom(BlockBush p_i45633_1_)
|
||||
{
|
||||
this.field_175908_a = p_i45633_1_;
|
||||
}
|
||||
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
for (int i = 0; i < 64; ++i)
|
||||
{
|
||||
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
|
||||
|
||||
if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 511) && this.field_175908_a.canBlockStay(worldIn, blockpos, this.field_175908_a.getState()))
|
||||
{
|
||||
worldIn.setState(blockpos, this.field_175908_a.getState(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package common.worldgen.foliage;
|
||||
|
||||
import common.block.BlockPumpkin;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.AWorldServer;
|
||||
import common.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenPumpkin extends FeatureGenerator
|
||||
{
|
||||
public boolean generate(AWorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
for (int i = 0; i < 64; ++i)
|
||||
{
|
||||
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
|
||||
|
||||
if (worldIn.isAirBlock(blockpos) && worldIn.getState(blockpos.down()).getBlock() == Blocks.grass && Blocks.pumpkin.canPlaceBlockAt(worldIn, blockpos))
|
||||
{
|
||||
worldIn.setState(blockpos, Blocks.pumpkin.getState().withProperty(BlockPumpkin.FACING, Facing.Plane.HORIZONTAL.random(rand)), 2);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue