pre genlayer rework
This commit is contained in:
parent
0525ba5d56
commit
0f128c1b1b
112 changed files with 2464 additions and 3353 deletions
|
@ -99,7 +99,6 @@ import client.window.WindowEvent;
|
|||
import client.world.ChunkClient;
|
||||
import client.world.WorldClient;
|
||||
import common.Version;
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
|
@ -523,7 +522,6 @@ public class Client implements IThreadListener {
|
|||
Window.init();
|
||||
ModelBlock.setAsProvider();
|
||||
Registry.register();
|
||||
UniverseRegistry.register();
|
||||
Log.setSync(CLIENT);
|
||||
CLIENT.run(time);
|
||||
Window.end();
|
||||
|
@ -1721,15 +1719,13 @@ public class Client implements IThreadListener {
|
|||
break;
|
||||
}
|
||||
|
||||
Biome biome = null;
|
||||
String bline;
|
||||
String lline;
|
||||
if(this.world.isBlockLoaded(blockpos)) {
|
||||
ChunkClient chunk = this.world.getChunk(blockpos);
|
||||
biome = chunk.getBiome(blockpos);
|
||||
bline = "Biom: " + biome.display + " (" + biome.name + "), D: " +
|
||||
TextColor.stripCodes(this.world.dimension.getDisplay()) +
|
||||
" (" + (this.dimensionName == null ? UniverseRegistry.getName(this.world.dimension) : this.dimensionName) + ")";
|
||||
bline = String.format("Biom: %.2f K, N: %.2f K, D: %s (%s)", 0.0f, 0.0f,
|
||||
TextColor.stripCodes(this.world.dimension.getDisplay()),
|
||||
this.dimensionName == null ? UniverseRegistry.getName(this.world.dimension) : this.dimensionName);
|
||||
lline = "Licht: " + chunk.getLightSub(blockpos, 0) + " (" + chunk.getLight(LightType.SKY, blockpos) + " Himmel, "
|
||||
+ chunk.getLight(LightType.BLOCK, blockpos) + " Blöcke, " + String.format(
|
||||
"%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt), A: "
|
||||
|
@ -1744,7 +1740,6 @@ public class Client implements IThreadListener {
|
|||
+ String.format("%.1f °", this.world.getCelestialAngle(1.0f));
|
||||
}
|
||||
|
||||
float temp = Math.max(this.world.getTempOffset() + (biome != null ? biome.getTemperature(blockpos) : 0.0f), 0.0f);
|
||||
long ticked = System.currentTimeMillis() - this.lastTicked;
|
||||
|
||||
return
|
||||
|
@ -1780,7 +1775,7 @@ public class Client implements IThreadListener {
|
|||
String.format("Laub: %s%s, T: %.2f K / %.2f °C, %s (R %.1f, %.1f)",
|
||||
!this.world.dimension.hasSeasons() ? "*" : "",
|
||||
this.world.getLeavesGen(blockpos).getDisplayName(),
|
||||
temp, World.ABSOLUTE_ZERO + temp,
|
||||
this.world.getTemperatureK(blockpos), this.world.getTemperatureC(blockpos),
|
||||
this.world.getWeather().getDisplay(), this.world.getRainStrength(),
|
||||
this.world.getDarkness()
|
||||
) + "\n" +
|
||||
|
|
|
@ -90,7 +90,7 @@ public class GuiCreateDimension extends Gui {
|
|||
|
||||
private static Dimension addFlatPreset(String display, String base, Biome biome, boolean populate, State main, Object ... layers) {
|
||||
Dimension dim = addPreset("Flach - " + display, base, "ClearGenerator:1b" + (populate ? "" : ",NoPopulation:1b"));
|
||||
dim.setBiome(biome);
|
||||
// dim.setBiome(biome); // TODO: populator
|
||||
if(main != null)
|
||||
dim.setFlatGen(main, layers);
|
||||
return dim;
|
||||
|
@ -121,18 +121,18 @@ public class GuiCreateDimension extends Gui {
|
|||
52, Blocks.dirt.getState(), 5, Blocks.sand.getState(), 90, Blocks.water.getState());
|
||||
|
||||
addFlatPreset("Oberfläche", Biome.PLAIN, 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)
|
||||
3, Blocks.dirt.getState(), Blocks.grass.getState()).setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.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.ICE, 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.ICE, 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()
|
||||
3, Blocks.dirt.getState(), Blocks.grass.getState(), Blocks.snow_layer.getState()).setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()).enableVillages()
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false);
|
||||
|
||||
addFlatPreset("Unendliche Grube", Biome.PLAIN, false, Blocks.dirt.getState(), 2, Blocks.cobblestone.getState(), 3, Blocks.dirt.getState(), Blocks.grass.getState())
|
||||
.setBiomeReplacer(Blocks.gravel.getState()).enableVillages();
|
||||
.setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()).enableVillages();
|
||||
|
||||
addFlatPreset("Wüste", Biome.DESERT, false, Blocks.stone.getState(), Blocks.bedrock.getState(), 3, Blocks.stone.getState(), 52, Blocks.sandstone.getState())
|
||||
.enableVillages().enableScattered();
|
||||
|
|
|
@ -90,7 +90,6 @@ import common.packet.SPacketPlayerAbilities;
|
|||
import common.packet.SPacketTabComplete;
|
||||
import common.packet.SPacketUpdateEntityTags;
|
||||
import common.packet.SPacketAnimation;
|
||||
import common.packet.SPacketBiome;
|
||||
import common.packet.SPacketBlockBreakAnim;
|
||||
import common.packet.SPacketBlockChange;
|
||||
import common.packet.SPacketCamera;
|
||||
|
@ -768,14 +767,6 @@ public class ClientPlayer implements IClientPlayer
|
|||
}
|
||||
}
|
||||
|
||||
public void handleBiomes(SPacketBiome packetIn)
|
||||
{
|
||||
NetHandler.checkThread(packetIn, this, this.gm, this.world);
|
||||
ChunkClient chunk = this.world.getChunk(packetIn.getChunkX(), packetIn.getChunkZ());
|
||||
chunk.setBiome(packetIn.getPos(), packetIn.getBiome());
|
||||
this.world.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, -World.MAX_SIZE_Y, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, World.MAX_SIZE_Y, (packetIn.getChunkZ() << 4) + 15);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the block and metadata and generates a blockupdate (and notify the clients)
|
||||
*/
|
||||
|
|
|
@ -13,7 +13,6 @@ import client.Client;
|
|||
import client.renderer.texture.DynamicTexture;
|
||||
import client.renderer.texture.TextureMap;
|
||||
import client.world.WorldClient;
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.effect.Effect;
|
||||
|
@ -1140,10 +1139,9 @@ public class EntityRenderer {
|
|||
for (int l = 0; l < k; ++l)
|
||||
{
|
||||
BlockPos blockpos1 = world.getPrecipitationHeight(blockpos.add(this.random.zrange(i) - this.random.zrange(i), 0, this.random.zrange(i) - this.random.zrange(i)));
|
||||
Biome biomegenbase = world.getBiomeGenForCoords(blockpos1);
|
||||
BlockPos blockpos2 = blockpos1.down();
|
||||
Block block = world.getState(blockpos2).getBlock();
|
||||
float temp = World.ABSOLUTE_ZERO + world.getTempOffset() + biomegenbase.getTemperature(blockpos1);
|
||||
float temp = world.getTemperatureC(blockpos1);
|
||||
|
||||
if (blockpos1.getY() <= blockpos.getY() + i && blockpos1.getY() >= blockpos.getY() - i && /* biomegenbase.canRain() && */ temp > 0.0F)
|
||||
{
|
||||
|
@ -1235,7 +1233,6 @@ public class EntityRenderer {
|
|||
double rx = (double)this.rainXCoords[idx] * 0.5D;
|
||||
double rz = (double)this.rainZCoords[idx] * 0.5D;
|
||||
pos.set(x, 0, z);
|
||||
Biome biome = world.getBiomeGenForCoords(pos);
|
||||
|
||||
int prec = world.getPrecipitationHeight(pos).getY();
|
||||
int miny = ey - hrange;
|
||||
|
@ -1258,7 +1255,7 @@ public class EntityRenderer {
|
|||
if(miny != maxy) {
|
||||
this.random.setSeed((long)(x * x * 3121 + x * 45238971 ^ z * z * 418711 + z * 13761));
|
||||
pos.set(x, miny, z);
|
||||
float temp = World.ABSOLUTE_ZERO + world.getTempOffset() + biome.getTemperature(pos);
|
||||
float temp = world.getTemperatureC(pos);
|
||||
|
||||
if(temp > 0.0F) {
|
||||
if(mode != (temp >= 194.0f ? 2 : (temp <= 5.0f ? 3 : 0))) {
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.Arrays;
|
|||
|
||||
import client.world.ChunkClient;
|
||||
import client.world.WorldClient;
|
||||
import common.biome.Biome;
|
||||
import common.init.Blocks;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
|
@ -139,11 +138,6 @@ public class RegionRenderCache implements IWorldAccess
|
|||
return i << 20 | j << 4;
|
||||
}
|
||||
|
||||
public Biome getBiomeGenForCoords(BlockPos pos)
|
||||
{
|
||||
return this.world.getBiomeGenForCoords(pos);
|
||||
}
|
||||
|
||||
private int getLightForExt(LightType p_175629_1_, BlockPos pos)
|
||||
{
|
||||
if (p_175629_1_ == LightType.SKY && !this.world.dimension.hasSkyLight())
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package client.world;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.tileentity.TileEntity;
|
||||
|
@ -11,6 +10,9 @@ import common.world.Chunk;
|
|||
import common.world.World;
|
||||
|
||||
public class ChunkClient extends Chunk {
|
||||
private final float[] temperatures = new float[256];
|
||||
private final float[] offsets = new float[256];
|
||||
|
||||
public ChunkClient(World world, int x, int z) {
|
||||
super(world, x, z);
|
||||
}
|
||||
|
@ -105,9 +107,11 @@ public class ChunkClient extends Chunk {
|
|||
}
|
||||
|
||||
if(biomes) {
|
||||
for(int k = 0; k < this.biomes.length; ++k) {
|
||||
this.biomes[k] = (char)((data[pos + 1] & 255) << 8 | data[pos] & 255);
|
||||
pos += 2;
|
||||
for(int k = 0; k < this.temperatures.length; ++k) {
|
||||
this.temperatures[k] = Float.intBitsToFloat((int)((data[pos + 3] & 255) << 24 | (data[pos + 2] & 255) << 16 | (data[pos + 1] & 255) << 8 | data[pos] & 255));
|
||||
pos += 4;
|
||||
this.offsets[k] = Float.intBitsToFloat((int)((data[pos + 3] & 255) << 24 | (data[pos + 2] & 255) << 16 | (data[pos + 1] & 255) << 8 | data[pos] & 255));
|
||||
pos += 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,12 +134,20 @@ public class ChunkClient extends Chunk {
|
|||
public void setLoaded() {
|
||||
this.loaded = true;
|
||||
}
|
||||
|
||||
public void setBiome(BlockPos pos, Biome biome) {
|
||||
this.biomes[((pos.getZ() & 15) << 4 | pos.getX() & 15)] = (char)biome.id;
|
||||
}
|
||||
|
||||
public boolean isDummy() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public float getTemperature(BlockPos pos) {
|
||||
int x = pos.getX() & 15;
|
||||
int z = pos.getZ() & 15;
|
||||
return this.temperatures[z << 4 | x];
|
||||
}
|
||||
|
||||
public float getOffset(BlockPos pos) {
|
||||
int x = pos.getX() & 15;
|
||||
int z = pos.getZ() & 15;
|
||||
return this.offsets[z << 4 | x];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package client.world;
|
|||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.block.natural.BlockFire;
|
||||
import common.collect.Lists;
|
||||
|
@ -146,12 +145,13 @@ public class ChunkEmpty extends ChunkClient {
|
|||
|
||||
public void setData(byte[] data, int[] extend, boolean biomes) {
|
||||
}
|
||||
|
||||
public Biome getBiome(BlockPos pos) {
|
||||
return Biome.DEF_BIOME;
|
||||
|
||||
public float getTemperature(BlockPos pos) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public void setBiome(BlockPos pos, Biome biome) {
|
||||
|
||||
public float getOffset(BlockPos pos) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public void resetRelight() {
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import client.Client;
|
||||
import common.biome.Biome;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Sets;
|
||||
import common.dimension.Dimension;
|
||||
|
@ -411,11 +410,11 @@ public class WorldClient extends AWorldClient
|
|||
return this.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
|
||||
}
|
||||
|
||||
public Biome getBiomeGenForCoords(BlockPos pos) {
|
||||
if(this.isBlockLoaded(pos))
|
||||
return this.getChunk(pos).getBiome(pos);
|
||||
else
|
||||
return Biome.DEF_BIOME;
|
||||
protected float getTemperature(BlockPos pos) {
|
||||
if(!this.isBlockLoaded(pos))
|
||||
return 0.0f;
|
||||
ChunkClient chunk = this.getChunk(pos);
|
||||
return pos.getY() > 64 ? chunk.getTemperature(pos) - (chunk.getOffset(pos) + (float)pos.getY() - 64.0F) / 15.0f : chunk.getTemperature(pos);
|
||||
}
|
||||
|
||||
protected boolean isLoaded(int x, int z, boolean allowEmpty) {
|
||||
|
@ -769,24 +768,14 @@ public class WorldClient extends AWorldClient
|
|||
public Vec3 getSkyColor(Entity entity, float partial) {
|
||||
BlockPos pos = new BlockPos(ExtMath.floord(entity.posX), ExtMath.floord(entity.posY),
|
||||
ExtMath.floord(entity.posZ));
|
||||
Biome biome = this.getBiomeGenForCoords(pos);
|
||||
Vec3 vec;
|
||||
if(this.dimension.isExterminated())
|
||||
vec = new Vec3(0x101010);
|
||||
else
|
||||
vec = new Vec3(this.dimension.getSkyColor());
|
||||
if(this.dimension.hasDaylight()) {
|
||||
float mult = ExtMath.clampf(ExtMath.cos(this.getDayPhase(partial)) * 2.0F + 0.5F,
|
||||
0.0F, 1.0F);
|
||||
if(this.dimension.getSkyColor() == 0xffffffff) {
|
||||
float temp = ExtMath.clampf(((biome.getTemperature(pos) + 14.0f) / 40.0f + 0.15f) / 3.0F,
|
||||
-1.0F, 1.0F);
|
||||
Vec3 sky = new Vec3(hsvToRGB(0.62222224F - temp * 0.05F, 0.5F + temp * 0.1F, 1.0F));
|
||||
vec = new Vec3(vec.xCoord * sky.xCoord * mult, vec.yCoord * sky.yCoord * mult, vec.zCoord * sky.zCoord * mult);
|
||||
}
|
||||
else {
|
||||
vec = new Vec3(vec.xCoord * mult, vec.yCoord * mult, vec.zCoord * mult);
|
||||
}
|
||||
float mult = ExtMath.clampf(ExtMath.cos(this.getDayPhase(partial)) * 2.0F + 0.5F, 0.0F, 1.0F);
|
||||
vec = new Vec3(vec.xCoord * mult, vec.yCoord * mult, vec.zCoord * mult);
|
||||
}
|
||||
float r = (float)vec.xCoord;
|
||||
float g = (float)vec.yCoord;
|
||||
|
|
|
@ -1,194 +1,149 @@
|
|||
package common.biome;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.log.Log;
|
||||
import common.rng.PerlinGen;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Displayable;
|
||||
import common.util.Identifyable;
|
||||
|
||||
public enum Biome implements Identifyable, Displayable {
|
||||
NONE("none", "<Keins>", 0x000000),
|
||||
PLAIN("plain", "Ebene", 0x8db360, 12.0f, 40.0f),
|
||||
DESERT("desert", "Wüste", 0xfa9418, 60.0f, 0.0f),
|
||||
HILLS("hills", "Bergland", 0x606060, -12.0f, 30.0f),
|
||||
FOREST("forest", "Wald", 0x056621, 8.0f, 80.0f),
|
||||
TAIGA("taiga", "Taiga", 0x0b6659, -10.0f, 80.0f),
|
||||
SWAMP("swamp", "Sumpf", 0x07f9b2, 12.0f, 90.0f),
|
||||
RIVER("river", "Fluss", 0x0000ff),
|
||||
EXTERMINATED("exterminated", "Ausgelöscht", 0x000000, 150.0f, 0.0f),
|
||||
SPACE("space", "Leere des Weltraums", 0x000000, 0.0f, 0.0f),
|
||||
ICE_SEA("ice_sea", "Vereister See", 0x9090a0, -20.0f),
|
||||
ICE_RIVER("ice_river", "Vereister Fluss", 0xa0a0ff, -20.0f),
|
||||
ICE("ice", "Eisebene", 0xffffff, -20.0f),
|
||||
ICE_HILLS("ice_hills", "Vereistes Bergland", 0xa0a0a0, -20.0f),
|
||||
MUSHROOM("mushroom", "Pilzland", 0xff00ff, 16.0f, 100.0f),
|
||||
BLACKENED("blackened", "Schwarz", 0x000000, 0.0f, 0.0f),
|
||||
BEACH("beach", "Strand", 0xfade55, 12.0f, 40.0f),
|
||||
DESERT_HILLS("desert_hills", "Wüsten-Bergland", 0xd25f12, 60.0f, 0.0f),
|
||||
FOREST_HILLS("forest_hills", "Wald-Bergland", 0x22551c, 8.0f, 80.0f),
|
||||
TAIGA_HILLS("taiga_hills", "Taiga-Bergland", 0x163933, -10.0f, 80.0f),
|
||||
HILLS_EDGE("hills_edge", "Bergland-Grenze", 0x72789a, -12.0f, 30.0f),
|
||||
TROPIC("tropic", "Urwald", 0x537b09, 18.0f, 90.0f),
|
||||
TROPIC_HILLS("tropic_hills", "Urwald-Bergland", 0x2c4205, 18.0f, 90.0f),
|
||||
TROPIC_EDGE("tropic_edge", "Urwald-Grenze", 0x628b17, 18.0f, 80.0f),
|
||||
SEA("sea", "See", 0x000070),
|
||||
STONE_BEACH("stone_beach", "Steinstrand", 0xa2a284, -12.0f, 30.0f),
|
||||
ICE_BEACH("ice_beach", "Vereister Strand", 0xfaf0c0, -18.0f, 30.0f),
|
||||
BIRCH_FOREST("birch_forest", "Birkenwald", 0x307444, 4.0f, 60.0f),
|
||||
BIRCH_HILLS("birch_hills", "Birken-Bergland", 0x1f5f32, 4.0f, 60.0f),
|
||||
DARK_FOREST("dark_forest", "Dichter Wald", 0x40511a, 8.0f, 80.0f),
|
||||
ICE_TAIGA("ice_taiga", "Vereiste Taiga", 0x31554a, -40.0f, 40.0f),
|
||||
ICE_TAIGA_HILLS("ice_taiga_hills", "Vereistes Taiga-Bergland", 0x243f36, -40.0f, 40.0f),
|
||||
LARGE_TAIGA("large_taiga", "Hohe Taiga", 0x596651, -8.0f, 80.0f),
|
||||
LARGE_TAIGA_HILLS("large_taiga_hills", "Hohes Taiga-Bergland", 0x454f3e, -8.0f, 80.0f),
|
||||
LARGE_HILLS("large_hills", "Hohes Bergland", 0x507050, -12.0f, 30.0f),
|
||||
SAVANNA("savanna", "Savanne", 0xbdb25f, 28.0f, 0.0f),
|
||||
SAVANNA_PLATEAU("savanna_plateau", "Savannen-Plateau", 0xa79d64, 20.0f, 0.0f),
|
||||
MESA("mesa", "Mesa", 0xd94515, 0.0f, 0.0f),
|
||||
MESA_FOREST("mesa_forest", "Mesa-Wald", 0xb09765, 0.0f, 0.0f),
|
||||
MESA_PLATEAU("mesa_plateau", "Mesa-Plateau", 0xca8c65, 0.0f, 0.0f),
|
||||
SNOW("snow", "Eisland", 0xffffff, 0.0f, 100.0f),
|
||||
TIAN("tian", "Tian", 0x808080, 0.0f, 80.0f),
|
||||
ELVEN_FOREST("elven_forest", "Elbenwald", 0x059821, 8.0f, 90.0f),
|
||||
UPPER_HELL("upper_hell", "Übergang in die Hölle", 0xff0000, 0.0f, 0.0f),
|
||||
LOWER_HELL("lower_hell", "Abgrund der Hölle", 0xff0000, 0.0f, 0.0f),
|
||||
HELL_HILLS("hell_hills", "Bergland der Hölle", 0xff0000, 0.0f, 0.0f),
|
||||
SOUL_PLAINS("soul_plains", "Seelenland", 0xff0000, 0.0f, 0.0f),
|
||||
ASH("ash", "Verbrannt", 0xff0000, 0.0f, 0.0f),
|
||||
MOON("moon", "Mondoberfläche", 0xa0a0a0, 0.0f, 0.0f),
|
||||
CHAOS("chaos", "Chaos", 0xff00ff),
|
||||
public class Biome {
|
||||
public static final Biome NONE = new Biome(0.0f, 50.0f).setSea();
|
||||
public static final Biome PLAIN = new Biome(12.0f, 40.0f).setScaling(Scaling.PLAINS_LOW);
|
||||
public static final Biome DESERT = new Biome(60.0f, 0.0f).setScaling(Scaling.PLAINS_LOW);
|
||||
public static final Biome HILLS = new Biome(-12.0f, 30.0f).setScaling(Scaling.HILLS_LARGE);
|
||||
public static final Biome FOREST = new Biome(8.0f, 80.0f);
|
||||
public static final Biome TAIGA = new Biome(-10.0f, 80.0f).setScaling(Scaling.PLAINS_MEDIUM);
|
||||
public static final Biome SWAMP = new Biome(12.0f, 90.0f).setScaling(Scaling.SEA_POND).disableBeach();
|
||||
public static final Biome RIVER = new Biome(0.0f, 50.0f).setScaling(Scaling.SEA_SHALLOW).disableBeach();
|
||||
public static final Biome ICE_SEA = new Biome(-20.0f, 50.0f).enableColdBeach().setScaling(Scaling.SEA_MEDIUM).setSea().disableBeach();
|
||||
public static final Biome ICE_RIVER = new Biome(-20.0f, 50.0f).enableColdBeach().setScaling(Scaling.SEA_SHALLOW).disableBeach();
|
||||
public static final Biome ICE = new Biome(-20.0f, 50.0f).enableColdBeach().setScaling(Scaling.PLAINS_LOW);
|
||||
public static final Biome ICE_HILLS = new Biome(-20.0f, 50.0f).enableColdBeach().setScaling(Scaling.HILLS_LOW);
|
||||
public static final Biome BEACH = new Biome(12.0f, 40.0f).setScaling(Scaling.SEA_SHORE);
|
||||
public static final Biome DESERT_HILLS = new Biome(60.0f, 0.0f).setScaling(Scaling.HILLS_LOW);
|
||||
public static final Biome FOREST_HILLS = new Biome(8.0f, 80.0f).setScaling(Scaling.HILLS_LOW);
|
||||
public static final Biome TAIGA_HILLS = new Biome(-10.0f, 80.0f).setScaling(Scaling.HILLS_LOW);
|
||||
public static final Biome HILLS_EDGE = new Biome(-12.0f, 30.0f).setScaling(Scaling.HILLS_MEDIUM);
|
||||
public static final Biome TROPIC = new Biome(18.0f, 90.0f).setTropical();
|
||||
public static final Biome TROPIC_HILLS = new Biome(18.0f, 90.0f).setTropical().setScaling(Scaling.HILLS_LOW);
|
||||
public static final Biome TROPIC_EDGE = new Biome(18.0f, 80.0f).setTropical();
|
||||
public static final Biome SEA = new Biome(0.0f, 50.0f).setScaling(Scaling.SEA_MEDIUM).setSea().disableBeach();
|
||||
public static final Biome STONE_BEACH = new Biome(-12.0f, 30.0f).setScaling(Scaling.SEA_VARYING);
|
||||
public static final Biome ICE_BEACH = new Biome(-18.0f, 30.0f).setScaling(Scaling.SEA_SHORE).enableColdBeach();
|
||||
public static final Biome BIRCH_FOREST = new Biome(4.0f, 60.0f);
|
||||
public static final Biome BIRCH_HILLS = new Biome(4.0f, 60.0f).setScaling(Scaling.HILLS_LOW);
|
||||
public static final Biome DARK_FOREST = new Biome(8.0f, 80.0f);
|
||||
public static final Biome ICE_TAIGA = new Biome(-40.0f, 40.0f).enableColdBeach().setScaling(Scaling.PLAINS_MEDIUM);
|
||||
public static final Biome ICE_TAIGA_HILLS = new Biome(-40.0f, 40.0f).enableColdBeach().setScaling(Scaling.HILLS_LOW);
|
||||
public static final Biome LARGE_TAIGA = new Biome(-8.0f, 80.0f).setScaling(Scaling.PLAINS_MEDIUM);
|
||||
public static final Biome LARGE_TAIGA_HILLS = new Biome(-8.0f, 80.0f).setScaling(Scaling.HILLS_LOW);
|
||||
public static final Biome LARGE_HILLS = new Biome(-12.0f, 30.0f).setScaling(Scaling.HILLS_LARGE);
|
||||
public static final Biome SAVANNA = new Biome(28.0f, 0.0f).setScaling(Scaling.PLAINS_LOW);
|
||||
public static final Biome SAVANNA_PLATEAU = new Biome(20.0f, 0.0f).setScaling(Scaling.HILLS_PLATEAU);
|
||||
|
||||
DESERT_MOD("desert_mod", "Wüste M", 0xfa9418, 60.0f, 0.0f),
|
||||
HILLS_MOD("hills_mod", "Bergland M", 0x606060, -12.0f, 30.0f),
|
||||
FLOWER_FOREST("flower_forest", "Blumenwald", 0x6a7425, 8.0f, 80.0f),
|
||||
TAIGA_MOD("taiga_mod", "Taiga M", 0x0b6659, -10.0f, 80.0f),
|
||||
SWAMP_MOD("swamp_mod", "Sumpf M", 0x07f9b2, 12.0f, 90.0f),
|
||||
ICE_SPIKES("ice_spikes", "Eisebene mit Spitzen", 0xd2ffff, -20.0f),
|
||||
TROPIC_MOD("tropic_mod", "Urwald M", 0x537b09, 18.0f, 90.0f),
|
||||
TROPIC_EDGE_MOD("propic_edge_mod", "Urwald-Grenze M", 0x628b17, 18.0f, 80.0f),
|
||||
BIRCH_FOREST_MOD("birch_forest_mod", "Birkenwald M", 0x307444, 4.0f, 60.0f),
|
||||
BIRCH_HILLS_MOD("birch_hills_mod", "Birken-Bergland M", 0x1f5f32, 4.0f, 60.0f),
|
||||
DARK_FOREST_MOD("dark_forest_mod", "Dichter Wald M", 0x40511a, 8.0f, 80.0f),
|
||||
ICE_TAIGA_MOD("ice_taiga_mod", "Vereiste Taiga M", 0x31554a, -40.0f, 40.0f),
|
||||
SPRUCE_TAIGA("spruce_taiga", "Fichtentaiga", 0x596651, -10.0f, 80.0f),
|
||||
REDWOOD_TAIGA("redwood_taiga", "Mammutbaumtaiga", 0x596651, -10.0f, 80.0f),
|
||||
LARGE_HILLS_MOD("large_hills_mod", "Hohes Bergland M", 0x507050, -12.0f, 30.0f),
|
||||
SAVANNA_MOD("savanna_mod", "Savanne M", 0xbdb25f, 24.0f, 0.0f),
|
||||
SAVANNA_PLATEAU_MOD("savanna_plateau_mod", "Savannen-Plateau M", 0xa79d64, 20.0f, 0.0f),
|
||||
MESA_PEAK("mesa_peak", "Mesa-Spitze", 0xd94515, 0.0f, 0.0f),
|
||||
MESA_FOREST_MOD("mesa_forest_mod", "Mesa-Wald M", 0xb09765, 0.0f, 0.0f),
|
||||
MESA_PLATEAU_MOD("mesa_plateau_mod", "Mesa-Plateau M", 0xca8c65, 0.0f, 0.0f);
|
||||
public static final Biome DESERT_MOD = DESERT.mutate(60.0f, 0.0f);
|
||||
public static final Biome HILLS_MOD = HILLS.mutate(new Biome(-12.0f, 30.0f).setScaling(HILLS.depth, HILLS.scale));
|
||||
public static final Biome FLOWER_FOREST = FOREST.mutate(new Biome(8.0f, 80.0f).setScaling(FOREST.depth, FOREST.scale + 0.2F));
|
||||
public static final Biome TAIGA_MOD = TAIGA.mutate(-10.0f, 80.0f);
|
||||
public static final Biome SWAMP_MOD = SWAMP.mutate(12.0f, 90.0f);
|
||||
public static final Biome ICE_SPIKES = ICE.mutate(new Biome(-20.0f, 50.0f).enableColdBeach().setScaling(ICE.depth + 0.3F, ICE.scale + 0.4F));
|
||||
public static final Biome TROPIC_MOD = TROPIC.mutate(18.0f, 90.0f);
|
||||
public static final Biome TROPIC_EDGE_MOD = TROPIC_EDGE.mutate(18.0f, 80.0f);
|
||||
public static final Biome BIRCH_FOREST_MOD = BIRCH_FOREST.mutate(4.0f, 60.0f);
|
||||
public static final Biome BIRCH_HILLS_MOD = BIRCH_HILLS.mutate(4.0f, 60.0f);
|
||||
public static final Biome DARK_FOREST_MOD = DARK_FOREST.mutate(8.0f, 80.0f);
|
||||
public static final Biome ICE_TAIGA_MOD = ICE_TAIGA.mutate(-40.0f, 40.0f);
|
||||
public static final Biome SPRUCE_TAIGA = LARGE_TAIGA.mutate((new Biome(-10.0f, 80.0f)).setScaling(LARGE_TAIGA.depth, LARGE_TAIGA.scale));
|
||||
public static final Biome REDWOOD_TAIGA = LARGE_TAIGA.mutate(-10.0f, 80.0f);
|
||||
public static final Biome LARGE_HILLS_MOD = LARGE_HILLS.mutate(new Biome(-12.0f, 30.0f).setScaling(LARGE_HILLS.depth, LARGE_HILLS.scale));
|
||||
public static final Biome SAVANNA_MOD = SAVANNA.mutate(new Biome(24.0f, 0.0f, SAVANNA).setScaling(SAVANNA.depth * 0.5F + 0.3F, SAVANNA.scale * 0.5F + 1.2F));
|
||||
public static final Biome SAVANNA_PLATEAU_MOD = SAVANNA_PLATEAU.mutate(new Biome(20.0f, 0.0f, SAVANNA_PLATEAU).setScaling(SAVANNA_PLATEAU.depth * 0.5F + 0.3F, SAVANNA_PLATEAU.scale * 0.5F + 1.2F));
|
||||
|
||||
public static final Biome DEF_BIOME = FOREST;
|
||||
private static final PerlinGen TEMP_NOISE = new PerlinGen(new Random(836430928262265276L), 1);
|
||||
private static final Biome[] BIOMES = new Biome[256];
|
||||
private static final Map<String, Biome> LOOKUP = Maps.newTreeMap();
|
||||
|
||||
public final int id;
|
||||
public final String name;
|
||||
public final String display;
|
||||
public final int color;
|
||||
public int id;
|
||||
public final float temperature;
|
||||
public final float humidity;
|
||||
|
||||
static {
|
||||
for(Biome biome : values()) {
|
||||
BIOMES[biome.id] = biome;
|
||||
if(LOOKUP.containsKey(biome.name))
|
||||
throw new IllegalStateException("Biom \"" + biome.name + "\" ist als ID " + LOOKUP.get(biome.name).id + " und " + biome.id + " definiert");
|
||||
LOOKUP.put(biome.name, biome);
|
||||
}
|
||||
}
|
||||
|
||||
public static Biome getBiome(int id)
|
||||
{
|
||||
if (id >= 0 && id < BIOMES.length)
|
||||
{
|
||||
return BIOMES[id];
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.TICK.warn("Biom-ID ist nicht im Bereich: " + id + ", verwende " + DEF_BIOME.id + " (" + DEF_BIOME.name + ")");
|
||||
return DEF_BIOME;
|
||||
}
|
||||
}
|
||||
|
||||
public static Biome getBiomeDef(int id)
|
||||
{
|
||||
if (id >= 0 && id < BIOMES.length)
|
||||
{
|
||||
Biome biome = BIOMES[id];
|
||||
return biome == null ? DEF_BIOME : biome;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.TICK.warn("Biom-ID ist nicht im Bereich: " + id + ", verwende " + DEF_BIOME.id + " (" + DEF_BIOME.name + ")");
|
||||
return DEF_BIOME;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> getBiomeNames() {
|
||||
return Lists.newArrayList(LOOKUP.keySet());
|
||||
}
|
||||
protected Biome baseBiome;
|
||||
public Biome mutated = null;
|
||||
public float depth = Scaling.VARYING_LOW.depth;
|
||||
public float scale = Scaling.VARYING_LOW.scale;
|
||||
public float factor;
|
||||
public boolean allowColdBeach = false;
|
||||
public boolean disallowBeach = false;
|
||||
public boolean tropical = false;
|
||||
public Temperature category;
|
||||
|
||||
public static Biome findByName(String name) {
|
||||
Biome biome = LOOKUP.get(name.toLowerCase().replace(" ", "").replace("_", ""));
|
||||
if(biome == null) {
|
||||
int z;
|
||||
try {
|
||||
z = Integer.parseInt(name);
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
return DEF_BIOME;
|
||||
}
|
||||
return z < 0 || z >= BIOMES.length || BIOMES[z] == null ? DEF_BIOME : BIOMES[z];
|
||||
}
|
||||
return biome;
|
||||
}
|
||||
|
||||
private Biome(String name, String display, int color, float temperature, float humidity) {
|
||||
this.id = this.ordinal();
|
||||
this.name = name;
|
||||
this.display = display;
|
||||
public Biome(float temperature, float humidity) {
|
||||
BIOMES[id] = this;
|
||||
this.id = id;
|
||||
this.temperature = temperature;
|
||||
this.humidity = humidity;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
private Biome(String name, String display, int color, float temperature) {
|
||||
this(name, display, color, temperature, 50.0f);
|
||||
}
|
||||
|
||||
private Biome(String name, String display, int color) {
|
||||
this(name, display, color, 0.0f, 50.0f);
|
||||
}
|
||||
|
||||
public final float getTemperature(BlockPos pos) {
|
||||
if(pos.getY() > 64) {
|
||||
float f = (float)(TEMP_NOISE.generate((double)pos.getX() * 1.0D / 8.0D, (double)pos.getZ() * 1.0D / 8.0D) * 4.0D);
|
||||
return this.temperature - (f + (float)pos.getY() - 64.0F) / 15.0f;
|
||||
}
|
||||
return this.temperature;
|
||||
this.category = temperature < -12.0f ? Temperature.COLD : (temperature < 20.0f ? Temperature.MEDIUM : Temperature.WARM);
|
||||
this.factor = Math.min(humidity * 0.01f * ((temperature + 14.0f) / 40.0f + 0.15f), 1.0f);
|
||||
}
|
||||
|
||||
public float getFactor() {
|
||||
float f = this.humidity * 0.01f * ((this.temperature + 14.0f) / 40.0f + 0.15f);
|
||||
return f > 1.0f ? 1.0f : f;
|
||||
public Biome(float temperature, float humidity, Biome biome)
|
||||
{
|
||||
this(temperature, humidity);
|
||||
this.baseBiome = biome;
|
||||
this.allowColdBeach = biome.allowColdBeach;
|
||||
this.tropical = biome.tropical;
|
||||
this.disallowBeach = biome.disallowBeach;
|
||||
this.depth = biome.depth + 0.1F;
|
||||
this.scale = biome.scale + 0.2F;
|
||||
this.category = biome.category;
|
||||
this.factor = biome.factor;
|
||||
}
|
||||
|
||||
// skycolor = ((temp + 14) / 40 + 0.15) / 3
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
protected final Biome setScaling(Scaling scaling)
|
||||
{
|
||||
return this.setScaling(scaling.depth, scaling.scale);
|
||||
}
|
||||
|
||||
public String getDisplay() {
|
||||
return this.display;
|
||||
}
|
||||
protected final Biome setScaling(float depth, float scale)
|
||||
{
|
||||
this.depth = depth;
|
||||
this.scale = scale;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Biome enableColdBeach()
|
||||
{
|
||||
this.allowColdBeach = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Biome disableBeach()
|
||||
{
|
||||
this.disallowBeach = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Biome setTropical()
|
||||
{
|
||||
this.tropical = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Biome setSea()
|
||||
{
|
||||
this.category = Temperature.SEA;
|
||||
return this;
|
||||
}
|
||||
|
||||
private Biome mutate(Biome mutated)
|
||||
{
|
||||
return this.mutated = mutated;
|
||||
}
|
||||
|
||||
private Biome mutate(float temperature, float humidity)
|
||||
{
|
||||
return this.mutated = new Biome(temperature, humidity, this);
|
||||
}
|
||||
|
||||
public Class <? extends Biome > getBiomeClass()
|
||||
{
|
||||
return this.baseBiome != null ? this.baseBiome.getBiomeClass() : this.getClass();
|
||||
}
|
||||
|
||||
public boolean isEqualTo(Biome biome)
|
||||
{
|
||||
return this.baseBiome != null ? this.baseBiome.isEqualTo(biome) : (biome == this || (biome != null && this.getBiomeClass() == biome.getBiomeClass()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
package common.biome;
|
||||
|
||||
import common.init.BlockRegistry;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.State;
|
||||
|
||||
public interface IBiome {
|
||||
public static abstract class BiomeProvider {
|
||||
private static BiomeProvider provider = new BiomeProvider() {
|
||||
public IBiome getBiome(Biome base) {
|
||||
return new IBiome() {
|
||||
public State getFiller() {
|
||||
return BlockRegistry.byName("air").getState();
|
||||
}
|
||||
public State getTop() {
|
||||
return BlockRegistry.byName("air").getState();
|
||||
}
|
||||
public void growGrass(AWorldServer worldIn, BlockPos pos, State state, Random rand) {
|
||||
}
|
||||
public boolean generateBigMushroom(AWorldServer worldIn, BlockPos pos, State state, Random rand) {
|
||||
return false;
|
||||
}
|
||||
public void generateTree(AWorldServer worldIn, BlockPos pos, State state, Random rand) {
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
public abstract IBiome getBiome(Biome base);
|
||||
}
|
||||
|
||||
public static void setProvider(BiomeProvider provider) {
|
||||
BiomeProvider.provider = provider;
|
||||
}
|
||||
|
||||
public static IBiome getBiome(Biome base) {
|
||||
return BiomeProvider.provider.getBiome(base);
|
||||
}
|
||||
|
||||
void growGrass(AWorldServer worldIn, BlockPos pos, State state, Random rand);
|
||||
boolean generateBigMushroom(AWorldServer worldIn, BlockPos pos, State state, Random rand);
|
||||
void generateTree(AWorldServer worldIn, BlockPos pos, State state, Random rand);
|
||||
State getFiller();
|
||||
State getTop();
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package server.worldgen.biome;
|
||||
package common.biome;
|
||||
|
||||
public enum Scaling {
|
||||
VARYING_LOW(0.1F, 0.2F),
|
|
@ -1,4 +1,4 @@
|
|||
package server.worldgen.biome;
|
||||
package common.biome;
|
||||
|
||||
public enum Temperature {
|
||||
SEA, COLD, MEDIUM, WARM;
|
|
@ -15,7 +15,6 @@ import java.util.function.Function;
|
|||
|
||||
import common.attributes.Attribute;
|
||||
import common.attributes.UsageSlot;
|
||||
import common.biome.Biome;
|
||||
import common.block.artificial.BlockSlab;
|
||||
import common.block.natural.BlockSnow;
|
||||
import common.collect.ImmutableList;
|
||||
|
@ -46,7 +45,6 @@ import common.rng.Random;
|
|||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.HitPosition;
|
||||
import common.util.Vec3;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package common.block.foliage;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.init.Blocks;
|
||||
|
@ -41,7 +40,6 @@ public class BlockBlackenedSoil extends Block
|
|||
if ((iblockstate.getBlock() == Blocks.dirt || iblockstate.getBlock() == Blocks.grass || iblockstate.getBlock() == Blocks.swamp || iblockstate.getBlock() == Blocks.blackened_dirt) && worldIn.getLightFromNeighbors(blockpos.up()) >= 2 && block.getLightOpacity() <= 6)
|
||||
{
|
||||
worldIn.setState(blockpos, Blocks.blackened_soil.getState());
|
||||
worldIn.setBiome(blockpos, Biome.BLACKENED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package common.block.foliage;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.block.SoundType;
|
||||
|
|
|
@ -69,7 +69,7 @@ public class BlockFlower extends BlockBush
|
|||
ORANGE_TULIP("orange_tulip", "Orange Tulpe"),
|
||||
WHITE_TULIP("white_tulip", "Weiße Tulpe"),
|
||||
PINK_TULIP("pink_tulip", "Rosa Tulpe"),
|
||||
OXEYE_DAISY("daisy", "Margerite"),
|
||||
DAISY("daisy", "Margerite"),
|
||||
BLACK_LOTUS("black_lotus", "Schwarzer Lotus");
|
||||
|
||||
private final String name;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package common.block.foliage;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.biome.IBiome;
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.init.Blocks;
|
||||
|
@ -86,7 +84,7 @@ public class BlockGrass extends Block implements IGrowable
|
|||
|
||||
public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state)
|
||||
{
|
||||
IBiome.getBiome(worldIn.getBiomeGenForCoords(pos)).growGrass(worldIn, pos, state, rand);
|
||||
worldIn.growGrass(pos, state, rand);
|
||||
}
|
||||
|
||||
protected Property[] getProperties()
|
||||
|
|
|
@ -2,7 +2,6 @@ package common.block.foliage;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.block.SoundType;
|
||||
|
@ -16,8 +15,6 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.tool.ItemShears;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
|
@ -25,7 +22,6 @@ import common.tileentity.TileEntity;
|
|||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.vars.Vars;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package common.block.foliage;
|
||||
|
||||
import common.biome.IBiome;
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.model.Model;
|
||||
|
@ -102,7 +101,7 @@ public class BlockMushroom extends BlockBush implements IGrowable
|
|||
|
||||
public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state)
|
||||
{
|
||||
IBiome.getBiome(worldIn.getBiomeGenForCoords(pos)).generateBigMushroom(worldIn, pos, state, rand);
|
||||
worldIn.generateBigMushroom(pos, state, rand);
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -2,9 +2,7 @@ package common.block.foliage;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import common.biome.IBiome;
|
||||
import common.block.Block;
|
||||
import common.block.foliage.BlockTallGrass.EnumType;
|
||||
import common.collect.Lists;
|
||||
import common.init.Blocks;
|
||||
import common.init.WoodType;
|
||||
|
@ -80,7 +78,7 @@ public class BlockSapling extends BlockBush implements IGrowable
|
|||
}
|
||||
else
|
||||
{
|
||||
IBiome.getBiome(worldIn.getBiomeGenForCoords(pos)).generateTree(worldIn, pos, state, rand);
|
||||
worldIn.generateTree(pos, state, rand);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package common.block.foliage;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
@ -17,7 +16,6 @@ import common.tileentity.TileEntity;
|
|||
import common.util.BlockPos;
|
||||
import common.util.Identifyable;
|
||||
import common.vars.Vars;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package common.block.foliage;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package common.block.natural;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.init.Blocks;
|
||||
|
@ -37,7 +36,6 @@ public class BlockBlackenedDirt extends Block
|
|||
else if ((iblockstate.getBlock() == Blocks.grass || iblockstate.getBlock() == Blocks.swamp) && worldIn.getLightFromNeighbors(blockpos.up()) >= 2 && block.getLightOpacity() <= 6)
|
||||
{
|
||||
worldIn.setState(blockpos, Blocks.blackened_soil.getState());
|
||||
worldIn.setBiome(blockpos, Biome.BLACKENED);
|
||||
}
|
||||
else if (iblockstate.getBlock() == Blocks.stone && rand.chance(25))
|
||||
{
|
||||
|
|
|
@ -3,15 +3,19 @@ package common.dimension;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import common.biome.Biome;
|
||||
import common.biome.IBiome;
|
||||
import common.block.foliage.LeavesType;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.entity.Entity;
|
||||
import common.entity.animal.EntityChicken;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.init.EntityRegistry;
|
||||
import common.init.MetalType;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.tags.TagObject;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Vec3;
|
||||
|
@ -57,7 +61,7 @@ public abstract class Dimension extends Section {
|
|||
|
||||
public static GeneratorType getByName(String name) {
|
||||
GeneratorType type = LOOKUP.get(name.toLowerCase());
|
||||
return type == null ? PERLIN : type;
|
||||
return type == null ? FLAT : type;
|
||||
}
|
||||
|
||||
static {
|
||||
|
@ -68,7 +72,7 @@ public abstract class Dimension extends Section {
|
|||
}
|
||||
|
||||
public static enum ReplacerType {
|
||||
NONE("none"), BIOMES("biomes"), SIMPLE("simple"), ALTERNATE("alternate"), TOPLAYER("toplayer");
|
||||
NONE("none"), TERRANIAN("terranian"), MESARIAN("mesarian"), ALT_SIMPLE("alt_simple"), SIMPLE("simple"), ALTERNATE("alternate"), TOPLAYER("toplayer");
|
||||
|
||||
private static final Map<String, ReplacerType> LOOKUP = Maps.newHashMap();
|
||||
|
||||
|
@ -84,7 +88,7 @@ public abstract class Dimension extends Section {
|
|||
|
||||
public static ReplacerType getByName(String name) {
|
||||
ReplacerType type = LOOKUP.get(name.toLowerCase());
|
||||
return type == null ? BIOMES : type;
|
||||
return type == null ? NONE : type;
|
||||
}
|
||||
|
||||
static {
|
||||
|
@ -94,6 +98,33 @@ public abstract class Dimension extends Section {
|
|||
}
|
||||
}
|
||||
|
||||
public static enum PopulatorType {
|
||||
NONE("none"), TERRANIAN("terranian"), MESARIAN("mesarian");
|
||||
|
||||
private static final Map<String, PopulatorType> LOOKUP = Maps.newHashMap();
|
||||
|
||||
private final String name;
|
||||
|
||||
private PopulatorType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public static PopulatorType getByName(String name) {
|
||||
PopulatorType type = LOOKUP.get(name.toLowerCase());
|
||||
return type == null ? NONE : type;
|
||||
}
|
||||
|
||||
static {
|
||||
for(PopulatorType type : values()) {
|
||||
LOOKUP.put(type.name, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static interface ColorGenerator {
|
||||
int getColor(long time);
|
||||
}
|
||||
|
@ -180,9 +211,8 @@ public abstract class Dimension extends Section {
|
|||
|
||||
private GeneratorType generatorType = GeneratorType.FLAT;
|
||||
private ReplacerType replacerType = ReplacerType.NONE;
|
||||
|
||||
private boolean populated = true;
|
||||
private boolean mobs = false; // mobgen+spawn
|
||||
private PopulatorType populatorType = PopulatorType.NONE;
|
||||
|
||||
private boolean snow = false; // snowgen+update
|
||||
private boolean caves = false;
|
||||
private boolean ravines = false;
|
||||
|
@ -201,6 +231,8 @@ public abstract class Dimension extends Section {
|
|||
private int seaRarity = 50; // b.layered
|
||||
private int addRarity = 50; // b.layered
|
||||
private int seaLevel = 0; // g.perlin, g.cavern, g.simple, g.destroyed, lake (r), r.biome, r.simple, r.alternate, ...
|
||||
private float depth = 0.1f; // g.perlin
|
||||
private float scale = 0.2f; // g.perlin
|
||||
|
||||
private Biome defaultBiome = Biome.NONE; // biomegen
|
||||
|
||||
|
@ -223,6 +255,7 @@ public abstract class Dimension extends Section {
|
|||
private final List<Ore> ores = Lists.newArrayList();
|
||||
private final List<Lake> lakes = Lists.newArrayList();
|
||||
private final List<Liquid> liquids = Lists.newArrayList();
|
||||
private final WeightedList<RngSpawn> spawns = new WeightedList<RngSpawn>();
|
||||
|
||||
private long seed = 0L;
|
||||
private boolean exterminated = false;
|
||||
|
@ -246,6 +279,26 @@ public abstract class Dimension extends Section {
|
|||
return readState(tag, "Block", def);
|
||||
}
|
||||
|
||||
public static void writeType(TagObject tag, String name, Class<? extends EntityLiving> type) {
|
||||
if(type != null)
|
||||
tag.setString(name, EntityRegistry.getEntityString(type));
|
||||
}
|
||||
|
||||
public static void writeType(TagObject tag, Class<? extends EntityLiving> type) {
|
||||
writeType(tag, "Type", type);
|
||||
}
|
||||
|
||||
public static Class<? extends EntityLiving> readType(TagObject tag, String name, Class<? extends EntityLiving> def) {
|
||||
if(!tag.hasString(name))
|
||||
return def;
|
||||
Class<? extends Entity> type = EntityRegistry.getEntityClass(tag.getString(name));
|
||||
return type != null && EntityLiving.class.isAssignableFrom(type) ? (Class<? extends EntityLiving>)type : def;
|
||||
}
|
||||
|
||||
public static Class<? extends EntityLiving> readType(TagObject tag, Class<? extends EntityLiving> def) {
|
||||
return readType(tag, "Type", def);
|
||||
}
|
||||
|
||||
protected Dimension(boolean custom) {
|
||||
super(custom);
|
||||
}
|
||||
|
@ -372,9 +425,54 @@ public abstract class Dimension extends Section {
|
|||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setBiomeReplacer(State alt1) {
|
||||
public final Dimension setPerlinGen(State filler, State liquid, int seaLevel, float depth, float scale) {
|
||||
this.depth = depth; // TODO: save
|
||||
this.scale = scale;
|
||||
return this.setPerlinGen(filler, liquid, seaLevel);
|
||||
}
|
||||
|
||||
public final Dimension setTerranianReplacer(State surface, State top, State alt1, State alt2) {
|
||||
this.surface = surface;
|
||||
this.top = top;
|
||||
this.alt1 = alt1;
|
||||
this.replacerType = ReplacerType.BIOMES;
|
||||
this.alt2 = alt2;
|
||||
this.replacerType = ReplacerType.TERRANIAN;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setMesarianReplacer(State surface) {
|
||||
this.surface = surface;
|
||||
this.replacerType = ReplacerType.MESARIAN;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setSimpleAltReplacer(State surface, State top, State alt1) {
|
||||
this.surface = surface;
|
||||
this.top = top;
|
||||
this.alt1 = alt1;
|
||||
this.replacerType = ReplacerType.ALT_SIMPLE;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setSimpleAltReplacer(State surface, State top) {
|
||||
this.surface = surface;
|
||||
this.top = top;
|
||||
this.replacerType = ReplacerType.ALT_SIMPLE;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setSimpleAltReplacer(State alt1) {
|
||||
this.alt1 = alt1;
|
||||
this.replacerType = ReplacerType.ALT_SIMPLE;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setSimpleReplacer(State surface, State top, State alt1, State alt2) {
|
||||
this.surface = surface;
|
||||
this.top = top;
|
||||
this.alt1 = alt1;
|
||||
this.alt2 = alt2;
|
||||
this.replacerType = ReplacerType.SIMPLE;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -397,6 +495,11 @@ public abstract class Dimension extends Section {
|
|||
this.replacerType = ReplacerType.TOPLAYER;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setPopulator(PopulatorType type) {
|
||||
this.populatorType = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setBiomeGen(Biome mainBiome, boolean semiFixed, int biomeSize, int riverSize, int snowRarity, int seaRarity) {
|
||||
return this.setBiomeGen(mainBiome, semiFixed, biomeSize, riverSize, snowRarity, seaRarity, 1);
|
||||
|
@ -405,9 +508,6 @@ public abstract class Dimension extends Section {
|
|||
public final Dimension setBiomeGen(Biome mainBiome, boolean semiFixed, int biomeSize, int riverSize, int snowRarity, int seaRarity,
|
||||
int addRarity, Biome ... add) {
|
||||
this.defaultBiome = mainBiome;
|
||||
IBiome biome = IBiome.getBiome(mainBiome);
|
||||
this.top = biome.getFiller();
|
||||
this.surface = biome.getTop();
|
||||
this.semiFixed = semiFixed;
|
||||
this.biomeSize = biomeSize;
|
||||
this.riverSize = riverSize;
|
||||
|
@ -437,19 +537,6 @@ public abstract class Dimension extends Section {
|
|||
this.hotBiomes = biomes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setBiome(Biome value) {
|
||||
this.defaultBiome = value;
|
||||
IBiome biome = IBiome.getBiome(value);
|
||||
this.top = biome.getFiller();
|
||||
this.surface = biome.getTop();
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension enableMobs() {
|
||||
this.mobs = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension enableSnow() {
|
||||
this.snow = true;
|
||||
|
@ -544,6 +631,11 @@ public abstract class Dimension extends Section {
|
|||
return this;
|
||||
}
|
||||
|
||||
public final Dimension addSpawn(Class<? extends EntityLiving> type, int weight, int min, int max) {
|
||||
this.spawns.add(new RngSpawn(type, weight, min, max));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected final Dimension setPhysics(int size, long orbitalPeriod, long rotationPeriod, float orbitOffset, float gravity, float temperature,
|
||||
|
@ -834,10 +926,6 @@ public abstract class Dimension extends Section {
|
|||
return this.top;
|
||||
}
|
||||
|
||||
public final State getAltFiller1() {
|
||||
return this.alt1;
|
||||
}
|
||||
|
||||
public final State getLiquid() {
|
||||
return this.liquid;
|
||||
}
|
||||
|
@ -846,10 +934,6 @@ public abstract class Dimension extends Section {
|
|||
return this.defaultLeaves;
|
||||
}
|
||||
|
||||
public final boolean hasMobs() {
|
||||
return this.mobs;
|
||||
}
|
||||
|
||||
public final boolean hasSnow() {
|
||||
return this.snow;
|
||||
}
|
||||
|
@ -881,9 +965,13 @@ public abstract class Dimension extends Section {
|
|||
public final boolean hasFortresses() {
|
||||
return this.useFortresses;
|
||||
}
|
||||
|
||||
public final boolean hasPopulator() {
|
||||
return this.populated;
|
||||
|
||||
public float getDepth() {
|
||||
return this.depth;
|
||||
}
|
||||
|
||||
public float getScale() {
|
||||
return this.scale;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1023,7 +1111,7 @@ public abstract class Dimension extends Section {
|
|||
this.noiseGen.biomeScaleOffset = tag.getFloat("BScaleOffset");
|
||||
this.generatorType = GeneratorType.getByName(tag.getString("Generator"));
|
||||
this.replacerType = ReplacerType.getByName(tag.getString("Replacer"));
|
||||
this.mobs = tag.getBool("MobGen");
|
||||
this.populatorType = PopulatorType.getByName(tag.getString("Populator"));
|
||||
this.snow = tag.getBool("SnowGen");
|
||||
this.ceiling = tag.getBool("Ceiling");
|
||||
this.caves = tag.getBool("Caves");
|
||||
|
@ -1167,7 +1255,16 @@ public abstract class Dimension extends Section {
|
|||
gen.getInt("Chance"), gen.getInt("Min"), gen.getInt("Max"), gen.getBool("Lower")));
|
||||
}
|
||||
}
|
||||
this.populated = !tag.hasBool("NoPopulation") || !tag.getBool("NoPopulation");
|
||||
this.spawns.clear();
|
||||
if(tag.hasList("Spawns")) {
|
||||
List<TagObject> list = tag.getList("Spawns");
|
||||
for(int z = 0; z < list.size(); z++) {
|
||||
TagObject gen = list.get(z);
|
||||
this.spawns.add(new RngSpawn(
|
||||
readType(gen, EntityChicken.class),
|
||||
gen.getInt("Weight"), gen.getInt("Min"), gen.getInt("Max")));
|
||||
}
|
||||
}
|
||||
this.denseFog = tag.getBool("DenseFog");
|
||||
this.brightness = tag.getInt("Brightness");
|
||||
this.skyColor = tag.getInt("SkyColor");
|
||||
|
@ -1234,7 +1331,7 @@ public abstract class Dimension extends Section {
|
|||
tag.setFloat("BScaleOffset", this.noiseGen.biomeScaleOffset);
|
||||
tag.setString("Generator", this.generatorType.getName());
|
||||
tag.setString("Replacer", this.replacerType.getName());
|
||||
tag.setBool("MobGen", this.mobs);
|
||||
tag.setString("Populator", this.populatorType.getName());
|
||||
tag.setBool("SnowGen", this.snow);
|
||||
tag.setBool("Ceiling", this.ceiling);
|
||||
tag.setBool("Caves", this.caves);
|
||||
|
@ -1251,7 +1348,7 @@ public abstract class Dimension extends Section {
|
|||
tag.setInt("SnowRarity", this.snowRarity);
|
||||
tag.setInt("SeaRarity", this.seaRarity);
|
||||
tag.setInt("AddRarity", this.addRarity);
|
||||
tag.setString("DefaultBiome", this.defaultBiome.name.toLowerCase());
|
||||
tag.setString("DefaultBiome", this.defaultBiome.getName());
|
||||
tag.setBool("SemiFixed", this.semiFixed);
|
||||
tag.setString("DefaultWeather", this.defaultWeather.getName());
|
||||
tag.setString("DefaultLeaves", this.defaultLeaves.getName());
|
||||
|
@ -1270,35 +1367,35 @@ public abstract class Dimension extends Section {
|
|||
if(this.addBiomes != null) {
|
||||
String[] list = new String[this.addBiomes.length];
|
||||
for(int z = 0; z < this.addBiomes.length; z++) {
|
||||
list[z] = this.addBiomes[z].name.toLowerCase();
|
||||
list[z] = this.addBiomes[z].getName();
|
||||
}
|
||||
tag.setStringArray("AddBiomes", list);
|
||||
}
|
||||
if(this.frostBiomes != null) {
|
||||
String[] list = new String[this.frostBiomes.length];
|
||||
for(int z = 0; z < this.frostBiomes.length; z++) {
|
||||
list[z] = this.frostBiomes[z].name.toLowerCase();
|
||||
list[z] = this.frostBiomes[z].getName();
|
||||
}
|
||||
tag.setStringArray("FrostBiomes", list);
|
||||
}
|
||||
if(this.coldBiomes != null) {
|
||||
String[] list = new String[this.coldBiomes.length];
|
||||
for(int z = 0; z < this.coldBiomes.length; z++) {
|
||||
list[z] = this.coldBiomes[z].name.toLowerCase();
|
||||
list[z] = this.coldBiomes[z].getName();
|
||||
}
|
||||
tag.setStringArray("ColdBiomes", list);
|
||||
}
|
||||
if(this.mediumBiomes != null) {
|
||||
String[] list = new String[this.mediumBiomes.length];
|
||||
for(int z = 0; z < this.mediumBiomes.length; z++) {
|
||||
list[z] = this.mediumBiomes[z].name.toLowerCase();
|
||||
list[z] = this.mediumBiomes[z].getName();
|
||||
}
|
||||
tag.setStringArray("MediumBiomes", list);
|
||||
}
|
||||
if(this.hotBiomes != null) {
|
||||
String[] list = new String[this.hotBiomes.length];
|
||||
for(int z = 0; z < this.hotBiomes.length; z++) {
|
||||
list[z] = this.hotBiomes[z].name.toLowerCase();
|
||||
list[z] = this.hotBiomes[z].getName();
|
||||
}
|
||||
tag.setStringArray("HotBiomes", list);
|
||||
}
|
||||
|
@ -1345,8 +1442,18 @@ public abstract class Dimension extends Section {
|
|||
}
|
||||
tag.setList("Liquids", list);
|
||||
}
|
||||
if(!this.populated)
|
||||
tag.setBool("NoPopulation", true);
|
||||
if(!this.spawns.isEmpty()) {
|
||||
List<TagObject> list = Lists.newArrayList();
|
||||
for(RngSpawn gen : this.spawns) {
|
||||
TagObject spawn = new TagObject();
|
||||
writeType(spawn, gen.type);
|
||||
spawn.setInt("Weight", gen.weight);
|
||||
spawn.setInt("Min", gen.min);
|
||||
spawn.setInt("Max", gen.max);
|
||||
list.add(spawn);
|
||||
}
|
||||
tag.setList("Spawns", list);
|
||||
}
|
||||
tag.setBool("DenseFog", this.denseFog);
|
||||
tag.setInt("Brightness", this.brightness);
|
||||
tag.setInt("SkyColor", this.skyColor);
|
||||
|
@ -1459,6 +1566,10 @@ public abstract class Dimension extends Section {
|
|||
return this.replacerType;
|
||||
}
|
||||
|
||||
public PopulatorType getPopulatorType() {
|
||||
return this.populatorType;
|
||||
}
|
||||
|
||||
public State getAlt1() {
|
||||
return this.alt1;
|
||||
}
|
||||
|
@ -1502,4 +1613,8 @@ public abstract class Dimension extends Section {
|
|||
public List<Liquid> getLiquids() {
|
||||
return this.liquids;
|
||||
}
|
||||
|
||||
public WeightedList<RngSpawn> getSpawns() {
|
||||
return this.spawns;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package common.dimension;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.UniverseRegistry;
|
||||
|
@ -10,21 +9,20 @@ public final class Moon extends Dimension {
|
|||
super(true);
|
||||
}
|
||||
|
||||
public Moon(int sky, int fog, int radius, long orbit, long rotation, float gravity, float temperature, int brightness, Block surface, Block liquid) {
|
||||
public Moon(int sky, int fog, int radius, long orbit, long rotation, float gravity, float temperature, int brightness, Block surface, Block liquid, float depth, float scale) {
|
||||
super(false);
|
||||
this.setPhysics(Planet.radiusToSize(Math.min(radius, 26000000)), orbit, rotation, 0.0f, gravity, temperature, brightness);
|
||||
this.setStarBrightness(0.75f).setDeepStarBrightness(0.75f);
|
||||
this.setSkyColor(sky).setFogColor(fog);
|
||||
this.setPerlinGen(surface.getState(), liquid.getState(), 63);
|
||||
this.setBiome(Biome.MOON);
|
||||
this.setPerlinGen(surface.getState(), liquid.getState(), 63, depth, scale);
|
||||
}
|
||||
|
||||
public Moon(int color, int radius, long orbit, long rotation, float gravity, float temperature, Block surface, Block liquid) {
|
||||
this(color, color, radius, orbit, rotation, gravity, temperature, 8, surface, liquid);
|
||||
public Moon(int color, int radius, long orbit, long rotation, float gravity, float temperature, Block surface, Block liquid, float depth, float scale) {
|
||||
this(color, color, radius, orbit, rotation, gravity, temperature, 8, surface, liquid, depth, scale);
|
||||
}
|
||||
|
||||
public Moon(int radius, long orbit, long rotation, float gravity, float temperature) {
|
||||
this(0x333333, radius, orbit, rotation, gravity, temperature, Blocks.moon_rock, Blocks.air);
|
||||
this(0x333333, radius, orbit, rotation, gravity, temperature, Blocks.moon_rock, Blocks.air, 0.125F, 0.05F);
|
||||
}
|
||||
|
||||
public Moon(int radius, long orbitRotation, float gravity, float temperature) {
|
||||
|
|
|
@ -24,7 +24,7 @@ public final class Planet extends Dimension {
|
|||
}
|
||||
|
||||
public Planet(int radius, long orbit, long rotation, float offset, float gravity, float temperature) {
|
||||
this(0xffffffff, 0xc0d8ff, 0xffffff, radius, orbit, rotation, offset, gravity, temperature, 0);
|
||||
this(0x7aa7ff, 0xc0d8ff, 0xffffff, radius, orbit, rotation, offset, gravity, temperature, 0);
|
||||
}
|
||||
|
||||
public Planet(int sky, int fog, int clouds, int radius, long orbit, long rotation, float gravity, float temperature) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package server.worldgen.biome;
|
||||
package common.dimension;
|
||||
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.rng.RngItem;
|
|
@ -9,7 +9,7 @@ public final class Space extends Dimension {
|
|||
private Space() {
|
||||
super(false);
|
||||
this.setPhysics(World.MAX_SIZE, 1L, 1L, 0.0f, 0.0f, 2.7f, 15);
|
||||
this.setBiome(Biome.SPACE).setStarBrightness(1.0f).setDeepStarBrightness(1.0f);
|
||||
this.setStarBrightness(1.0f).setDeepStarBrightness(1.0f);
|
||||
}
|
||||
|
||||
public final DimType getType() {
|
||||
|
|
|
@ -356,14 +356,6 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
return this.passenger == null;
|
||||
}
|
||||
|
||||
public boolean prepareChunkForSpawn()
|
||||
{
|
||||
int i = ExtMath.floord(this.posX);
|
||||
int j = ExtMath.floord(this.posZ);
|
||||
this.worldObj.getBiomeGenForCoords(new BlockPos(i, 0, j));
|
||||
return true;
|
||||
}
|
||||
|
||||
public void dropChests()
|
||||
{
|
||||
if (!this.worldObj.client && this.isChested())
|
||||
|
@ -492,15 +484,6 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the entity's current position is a valid location to spawn this entity.
|
||||
*/
|
||||
public boolean getCanSpawnHere()
|
||||
{
|
||||
this.prepareChunkForSpawn();
|
||||
return super.getCanSpawnHere();
|
||||
}
|
||||
|
||||
protected EntityHorse getClosestHorse(Entity entityIn, double distance)
|
||||
{
|
||||
double d0 = Double.MAX_VALUE;
|
||||
|
|
|
@ -11,7 +11,6 @@ import common.ai.EntityAISwimming;
|
|||
import common.ai.EntityAITempt;
|
||||
import common.ai.EntityAIWander;
|
||||
import common.ai.EntityAIWatchClosest;
|
||||
import common.biome.Biome;
|
||||
import common.block.artificial.BlockWool;
|
||||
import common.collect.Maps;
|
||||
import common.color.DyeColor;
|
||||
|
@ -286,9 +285,9 @@ public class EntitySheep extends EntityAnimal
|
|||
DyeColor.MAGENTA, DyeColor.ORANGE, DyeColor.PINK, DyeColor.PURPLE, DyeColor.RED
|
||||
};
|
||||
|
||||
public static DyeColor getRandomSheepColor(Random random, Biome biome)
|
||||
public static DyeColor getRandomSheepColor(Random random, float temp)
|
||||
{
|
||||
if(biome == Biome.SNOW)
|
||||
if(temp <= 0.0f)
|
||||
return DyeColor.WHITE;
|
||||
int i = random.zrange(140);
|
||||
return i < 20 ? DyeColor.BLACK :
|
||||
|
@ -326,7 +325,7 @@ public class EntitySheep extends EntityAnimal
|
|||
public Object onInitialSpawn(Object livingdata)
|
||||
{
|
||||
livingdata = super.onInitialSpawn(livingdata);
|
||||
this.setFleeceColor(getRandomSheepColor(this.worldObj.rand, this.worldObj.getBiomeGenForCoords(this.getPosition())));
|
||||
this.setFleeceColor(getRandomSheepColor(this.worldObj.rand, this.worldObj.getTemperatureC(this.getPosition())));
|
||||
return livingdata;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ package common.entity.npc;
|
|||
|
||||
import common.ai.EntityAIBase;
|
||||
import common.ai.EntityMoveHelper;
|
||||
import common.biome.Biome;
|
||||
import common.entity.DamageSource;
|
||||
import common.entity.Entity;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.init.ItemRegistry;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
|
@ -383,9 +383,7 @@ public class EntitySlime extends EntityNPC
|
|||
// {
|
||||
// if (this.worldObj.getDifficulty() != Difficulty.PEACEFUL)
|
||||
// {
|
||||
Biome biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos);
|
||||
|
||||
if (biomegenbase == Biome.SWAMP && this.posY > 50.0D && this.posY < 70.0D && this.rand.floatv() < 0.5F && this.rand.floatv() < this.worldObj.getMoonPhase() && this.worldObj.getLightFromNeighbors(new BlockPos(this)) <= this.rand.zrange(8))
|
||||
if (this.worldObj.getState(new BlockPos(this.posX, this.getEntityBoundingBox().minY - 1.0, this.posZ)).getBlock() == Blocks.swamp && this.posY > 50.0D && this.posY < 70.0D && this.rand.floatv() < 0.5F && this.rand.floatv() < this.worldObj.getMoonPhase() && this.worldObj.getLightFromNeighbors(new BlockPos(this)) <= this.rand.zrange(8))
|
||||
{
|
||||
return super.getCanSpawnHere();
|
||||
}
|
||||
|
|
|
@ -10,5 +10,6 @@ public abstract class Registry {
|
|||
CraftingRegistry.register();
|
||||
SmeltingRegistry.register();
|
||||
EntityRegistry.register();
|
||||
UniverseRegistry.register();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,11 +17,43 @@ import common.dimension.Galaxy;
|
|||
import common.dimension.Moon;
|
||||
import common.dimension.Section;
|
||||
import common.dimension.Planet;
|
||||
import common.dimension.RngSpawn;
|
||||
import common.dimension.Sector;
|
||||
import common.dimension.Semi;
|
||||
import common.dimension.Space;
|
||||
import common.dimension.Star;
|
||||
import common.entity.Entity;
|
||||
import common.entity.animal.EntityBat;
|
||||
import common.entity.animal.EntityCat;
|
||||
import common.entity.animal.EntityChicken;
|
||||
import common.entity.animal.EntityCow;
|
||||
import common.entity.animal.EntityFox;
|
||||
import common.entity.animal.EntityHorse;
|
||||
import common.entity.animal.EntityMouse;
|
||||
import common.entity.animal.EntityPig;
|
||||
import common.entity.animal.EntityRabbit;
|
||||
import common.entity.animal.EntitySheep;
|
||||
import common.entity.animal.EntityWolf;
|
||||
import common.entity.npc.EntityArachnoid;
|
||||
import common.entity.npc.EntityBloodElf;
|
||||
import common.entity.npc.EntityCultivator;
|
||||
import common.entity.npc.EntityDwarf;
|
||||
import common.entity.npc.EntityElf;
|
||||
import common.entity.npc.EntityFireDemon;
|
||||
import common.entity.npc.EntityHaunter;
|
||||
import common.entity.npc.EntityMage;
|
||||
import common.entity.npc.EntityMerfolk;
|
||||
import common.entity.npc.EntityMetalhead;
|
||||
import common.entity.npc.EntitySlime;
|
||||
import common.entity.npc.EntitySpirit;
|
||||
import common.entity.npc.EntityTiefling;
|
||||
import common.entity.npc.EntityUndead;
|
||||
import common.entity.npc.EntityWoodElf;
|
||||
import common.entity.npc.EntityZombie;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.rng.WeightedList;
|
||||
import common.world.Weather;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class UniverseRegistry {
|
||||
|
@ -396,8 +428,77 @@ public abstract class UniverseRegistry {
|
|||
private static void registerMoon(String display, int radius, long orbitRotation, float gravity, float temperature) {
|
||||
registerMoon(display, new Moon(radius, orbitRotation, gravity, temperature));
|
||||
}
|
||||
|
||||
/*public class BiomeBlackened extends MobPopulator {
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
mobs.add(new RngSpawn(EntityMetalhead.class, 50, 1, 1));
|
||||
}
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
public class BiomeChaos extends MobPopulator {
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
for(Class<? extends Entity> clazz : EntityRegistry.getAllClasses()) {
|
||||
if(EntityLiving.class.isAssignableFrom(clazz))
|
||||
mobs.add(new RngSpawn((Class<? extends EntityLiving>)clazz, 1, 1, 8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BiomeHell extends MobPopulator {
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
mobs.add(new RngSpawn(EntityFireDemon.class, 50, 4, 4));
|
||||
mobs.add(new RngSpawn(EntityTiefling.class, 100, 4, 4));
|
||||
mobs.add(new RngSpawn(EntityBloodElf.class, 50, 2, 10));
|
||||
mobs.add(new RngSpawn(EntityCultivator.class, 10, 1, 1));
|
||||
}
|
||||
}
|
||||
|
||||
public class BiomeMetalHell extends MobPopulator {
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
mobs.add(new RngSpawn(EntityFireDemon.class, 50, 4, 4));
|
||||
mobs.add(new RngSpawn(EntityTiefling.class, 100, 4, 4));
|
||||
mobs.add(new RngSpawn(EntityBloodElf.class, 10, 1, 2));
|
||||
mobs.add(new RngSpawn(EntityMetalhead.class, 1, 1, 1));
|
||||
}
|
||||
}
|
||||
|
||||
public class BiomeMushroom extends MobPopulator {
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
mobs.add(new RngSpawn(EntityDwarf.class, 8, 4, 8));
|
||||
}
|
||||
}
|
||||
|
||||
public class BiomeSnowLand extends MobPopulator {
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
mobs.add(new RngSpawn(EntitySheep.class, 50, 4, 4));
|
||||
mobs.add(new RngSpawn(EntitySpirit.class, 10, 1, 1));
|
||||
}
|
||||
}
|
||||
|
||||
public class BiomeTian extends MobPopulator {
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
mobs.add(new RngSpawn(EntityCultivator.class, 50, 1, 1));
|
||||
mobs.add(new RngSpawn(EntityMerfolk.class, 10, 4, 4));
|
||||
mobs.add(new RngSpawn(EntityRabbit.class, 10, 3, 10));
|
||||
mobs.add(new RngSpawn(EntityBat.class, 10, 8, 8));
|
||||
mobs.add(new RngSpawn(EntityMouse.class, 10, 8, 8));
|
||||
}
|
||||
}
|
||||
|
||||
public class BiomeElvenForest extends MobPopulator {
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
mobs.add(new RngSpawn(EntitySheep.class, 12, 4, 4));
|
||||
mobs.add(new RngSpawn(EntityRabbit.class, 10, 3, 10));
|
||||
mobs.add(new RngSpawn(EntityChicken.class, 10, 4, 4));
|
||||
mobs.add(new RngSpawn(EntityMouse.class, 10, 8, 8));
|
||||
mobs.add(new RngSpawn(EntityWoodElf.class, 100, 4, 16));
|
||||
mobs.add(new RngSpawn(EntityElf.class, 12, 4, 16));
|
||||
mobs.add(new RngSpawn(EntityFox.class, 3, 2, 5));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
static void register() { //TODO: add mushroom 0.2F, 0.3F
|
||||
register("space", "Der Weltraum", Space.INSTANCE);
|
||||
|
||||
registerGalaxy("milkyway", "Galaxie Milchstraße", () -> {
|
||||
|
@ -405,8 +506,8 @@ public abstract class UniverseRegistry {
|
|||
registerStar("Sol", 695508000, 274.0f, 5778.0f, () -> {
|
||||
registerPlanet("Terra", new Planet(6378136, 8766144L, 24000L, 28.0f, 9.81f, 259.15f)
|
||||
.setPerlinGen(Blocks.stone.getState(), Blocks.water.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.gravel.getState())
|
||||
.setBiomeGen(Biome.FOREST, false, 4, 4, 6, 50, 50, Biome.MUSHROOM).enableMobs().enableSnow()
|
||||
.setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState())
|
||||
.setBiomeGen(Biome.FOREST, false, 4, 4, 6, 50).enableMobs().enableSnow()
|
||||
.setFrostBiomes(Biome.ICE, Biome.ICE, Biome.ICE, Biome.ICE_TAIGA, Biome.LARGE_TAIGA)
|
||||
.setColdBiomes(Biome.FOREST, Biome.HILLS, Biome.TAIGA, Biome.PLAIN)
|
||||
.setMediumBiomes(Biome.FOREST, Biome.DARK_FOREST, Biome.HILLS, Biome.PLAIN, Biome.BIRCH_FOREST,
|
||||
|
@ -427,6 +528,26 @@ public abstract class UniverseRegistry {
|
|||
.addOre(Blocks.diamond_ore.getState(), 1, 0, 8, 0, 16, false)
|
||||
.addOre(Blocks.ruby_ore.getState(), 1, 0, 4, 12, 8, true)
|
||||
.addOre(Blocks.cinnabar_ore.getState(), 1, 0, 11, 0, 24, false)
|
||||
.addSpawn(EntitySheep.class, 12, 4, 4)
|
||||
.addSpawn(EntityRabbit.class, 10, 3, 10)
|
||||
.addSpawn(EntityPig.class, 10, 4, 4)
|
||||
.addSpawn(EntityChicken.class, 10, 4, 4)
|
||||
.addSpawn(EntityCow.class, 8, 4, 4)
|
||||
.addSpawn(EntityArachnoid.class, 100, 4, 4)
|
||||
.addSpawn(EntityZombie.class, 100, 4, 4)
|
||||
.addSpawn(EntityUndead.class, 100, 4, 4)
|
||||
.addSpawn(EntityHaunter.class, 100, 4, 4)
|
||||
.addSpawn(EntitySlime.class, 100, 4, 4)
|
||||
.addSpawn(EntityMage.class, 5, 1, 1)
|
||||
.addSpawn(EntityBat.class, 10, 8, 8)
|
||||
.addSpawn(EntityMouse.class, 10, 8, 8)
|
||||
.addSpawn(EntityWolf.class, 5, 2, 4)
|
||||
.addSpawn(EntityFox.class, 4, 2, 6)
|
||||
.addSpawn(EntityWoodElf.class, 100, 4, 16)
|
||||
.addSpawn(EntityElf.class, 12, 4, 16)
|
||||
.addSpawn(EntityMerfolk.class, 10, 4, 4)
|
||||
.addSpawn(EntityHorse.class, 5, 2, 6)
|
||||
.addSpawn(EntityCat.class, 2, 1, 1)
|
||||
.enableVillages().enableMineshafts().enableScattered().enableStrongholds(), () -> {
|
||||
registerMoon("Luna", 1737100, 655728L, 1.62f, 210.0f);
|
||||
});
|
||||
|
@ -488,9 +609,9 @@ public abstract class UniverseRegistry {
|
|||
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63));
|
||||
});
|
||||
registerStar("Gi'rok", 603421976, 232.0f, 5220.0f, () -> {
|
||||
registerPlanet("gharoth", "Elbenplanet Gharoth", new Planet(2806382, 4837386L, 52960L, 30.0f, 10.0f, 257.3f)
|
||||
registerPlanet("gharoth", "Elbenplanet Gharoth", new Planet(2806382, 4837386L, 52960L, 30.0f, 10.0f, 257.3f + 8.0f) //TODO: check temp
|
||||
.setSimpleGen(Blocks.dirt.getState(), Blocks.water.getState(), 64)
|
||||
.setSimpleReplacer(Blocks.gravel.getState(), Blocks.sand.getState()).setBiome(Biome.ELVEN_FOREST)
|
||||
.setSimpleReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState())
|
||||
.enableCaves(Blocks.air.getState()).setDungeons(4).enableMobs().enableSnow()
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
|
||||
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
|
||||
|
@ -500,7 +621,7 @@ public abstract class UniverseRegistry {
|
|||
.addOre(Blocks.gyriyn_ore.getState(), 0, 2, 3, 0, 12, false));
|
||||
registerPlanet("transylvania", "Vampirplanet Transsylvanien", new Planet(8374921, 33850466L, 49760L, 20.0f, 10.0f, 255.5f)
|
||||
.setPerlinGen(Blocks.rock.getState(), Blocks.water.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.gravel.getState()).setBiomeGen(Biome.FOREST, true, 5, 3, 3, 30)
|
||||
.setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()).setBiomeGen(Biome.FOREST, true, 5, 3, 3, 30)
|
||||
.enableCavesRavines(Blocks.lava.getState()).setDungeons(10).enableMobs().enableSnow()
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
|
||||
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
|
||||
|
@ -509,16 +630,25 @@ public abstract class UniverseRegistry {
|
|||
.addOre(Blocks.coal_ore.getState(), 12, 0, 14, 4, 28, false)
|
||||
.addOre(Blocks.lead_ore.getState(), 2, 0, 8, 0, 8, false)
|
||||
.addOre(Blocks.ardite_ore.getState(), 0, 2, 3, 0, 12, false)
|
||||
.addOre(Blocks.nichun_ore.getState(), 0, 10, 1, 0, 10, false), () -> {
|
||||
registerMoon("yrdinath", "Eismond Yrdinath", new Moon(0xccccff, 2503812, 46743637L, 17460L, 2.5f, 239.15f, Blocks.snow, Blocks.ice)
|
||||
.setBiome(Biome.SNOW).enableMobs().enableSnow().setDefaultWeather(Weather.SNOW));
|
||||
registerMoon("mythril", "Eismond Mythril", new Moon(0xbbbbff, 2213749, 42659432L, 15330L, 2.25f, 221.65f, Blocks.snow, Blocks.ice)
|
||||
.setBiome(Biome.SNOW).enableMobs().enableSnow().setDefaultWeather(Weather.SNOW));
|
||||
.addOre(Blocks.nichun_ore.getState(), 0, 10, 1, 0, 10, false)
|
||||
.addSpawn(EntitySheep.class, 12, 4, 4)
|
||||
.addSpawn(EntityCow.class, 8, 4, 4)
|
||||
.addSpawn(EntityArachnoid.class, 100, 4, 4)
|
||||
.addSpawn(EntityZombie.class, 100, 4, 4)
|
||||
.addSpawn(EntityUndead.class, 100, 4, 4)
|
||||
.addSpawn(EntitySlime.class, 100, 4, 4)
|
||||
.addSpawn(EntityBat.class, 10, 8, 8)
|
||||
.addSpawn(EntityMouse.class, 10, 8, 8)
|
||||
.addSpawn(EntityWolf.class, 5, 2, 4)
|
||||
.addSpawn(EntityHorse.class, 5, 2, 6), () -> {
|
||||
registerMoon("yrdinath", "Eismond Yrdinath", new Moon(0xccccff, 2503812, 46743637L, 17460L, 2.5f, 239.15f, Blocks.snow, Blocks.ice, 0.1F, 0.2F) //TODO: check height
|
||||
.enableMobs().enableSnow().setDefaultWeather(Weather.SNOW));
|
||||
registerMoon("mythril", "Eismond Mythril", new Moon(0xbbbbff, 2213749, 42659432L, 15330L, 2.25f, 221.65f, Blocks.snow, Blocks.ice, 0.1F, 0.2F)
|
||||
.enableMobs().enableSnow().setDefaultWeather(Weather.SNOW));
|
||||
});
|
||||
registerPlanet("mesar", "Wüstenplanet Me'sar", new Planet(0xff7f3f, 0xff6022, 0xff6f00, 9823183, 56643366L, 87340L, 11.0f, 333.15f)
|
||||
.setPerlinGen(Blocks.rock.getState(), Blocks.air.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.red_sand.getState())
|
||||
.setBiomeGen(Biome.MESA, true, 3, 1000, 100000, 100000)
|
||||
.setPerlinGen(Blocks.rock.getState(), Blocks.air.getState(), 63, 0.2f, 0.4f)
|
||||
.setMesarianReplacer(Blocks.red_sand.getState())
|
||||
.enableCavesRavines(Blocks.lava.getState()).enableMobs()
|
||||
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
|
||||
.addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true)
|
||||
|
@ -536,7 +666,7 @@ public abstract class UniverseRegistry {
|
|||
registerStar("Ov'rol", new Star(0x000000, 832718528, 302.0f, 12666.0f, Blocks.goo), () -> {
|
||||
registerPlanet("blackplanet", "Der Schwarze Planet", new Planet(0x000000, 0x000000, 0x000000, 13038204, 4632918508L, 204556L, 12.0f, 0.0f)
|
||||
.setPerlinGen(Blocks.blackened_stone.getState(), Blocks.goo.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.blackened_cobble.getState()).setBiome(Biome.BLACKENED)
|
||||
.setSimpleAltReplacer(Blocks.blackened_soil.getState(), Blocks.blackened_dirt.getState(), Blocks.blackened_cobble.getState())
|
||||
.enableCaves(Blocks.air.getState()).setDungeons(4).enableMobs()
|
||||
.addLake(Blocks.goo.getState(), null, null, 8, 8, 255, true)
|
||||
// .addOre(Blocks.PLACEHOLDER_ore.getState(), 0, 2, 3, 0, 12, false)
|
||||
|
@ -546,8 +676,8 @@ public abstract class UniverseRegistry {
|
|||
});
|
||||
|
||||
registerSemi("warp", "Der Warp", new Semi(0x0c001f, 0x190033, 124072917, 285.0f, 3).setCloudTexture(CloudType.DENSE).setCloudHeight(238.0f)
|
||||
.setPerlinGen(Blocks.obsidian.getState(), Blocks.lava.getState(), 63)
|
||||
.setBiome(Biome.CHAOS).enableCavesRavines(Blocks.air.getState()).enableLongCaves().enableMobs().enableSnow()
|
||||
.setPerlinGen(Blocks.obsidian.getState(), Blocks.lava.getState(), 63, 1.0F, 2.0F)
|
||||
.enableCavesRavines(Blocks.air.getState()).enableLongCaves().enableMobs().enableSnow()
|
||||
.addLake(Blocks.water.getState(), null, Blocks.obsidian.getState(), 8, 0, 255, false)
|
||||
.addLake(Blocks.lava.getState(), null, null, 1, 8, 255, false)
|
||||
.addLiquid(Blocks.flowing_water.getState(), 1, 8, 255, false)
|
||||
|
@ -557,8 +687,8 @@ public abstract class UniverseRegistry {
|
|||
|
||||
registerDomain("Tian'Xin", () -> {
|
||||
registerArea("Ni'enrath", new Area(0x7f00ff, 532109, 276.15f, 1).setLightColor(0x07000f).setBlockColor(0xcf6fff)
|
||||
.setPerlinGen(Blocks.tian.getState(), Blocks.spring_water.getState(), 63).setBiome(Biome.TIAN)
|
||||
.setBiomeReplacer(Blocks.tian.getState()).enableLongCaves().enableMobs().enableSnow()
|
||||
.setPerlinGen(Blocks.tian.getState(), Blocks.spring_water.getState(), 63, 0.1F, 1.0F)
|
||||
.setSimpleAltReplacer(Blocks.tian_soil.getState(), Blocks.tian.getState()).enableLongCaves().enableMobs().enableSnow()
|
||||
.addLake(Blocks.spring_water.getState(), Blocks.tian.getState(), Blocks.tian.getState(), 4, 0, 255, false)
|
||||
.addLiquid(Blocks.flowing_spring_water.getState(), 50, 8, 255, false));
|
||||
});
|
||||
|
@ -571,28 +701,26 @@ public abstract class UniverseRegistry {
|
|||
registerArea("thedric", "Kreis Thedric", new Area(0x330707, 105639735, 347.15f, 2).enableLongCaves().enableMobs().enableFortresses()
|
||||
.enableWorldCeiling().enableDenseFog()
|
||||
.setCavernGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63)
|
||||
.setSurfaceReplacer(Blocks.gravel.getState(), Blocks.soul_sand.getState())
|
||||
.setBiome(Biome.UPPER_HELL));
|
||||
.setSurfaceReplacer(Blocks.gravel.getState(), Blocks.soul_sand.getState()));
|
||||
registerArea("kyroth", "Kreis Kyroth", new Area(0x990000, 86742970, 387.15f, 3).enableLongCaves().enableMobs()
|
||||
.setSimpleGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 64)
|
||||
.setSimpleReplacer(Blocks.obsidian.getState(), Blocks.soul_sand.getState())
|
||||
.setBiome(Biome.LOWER_HELL)
|
||||
.addLake(Blocks.lava.getState(), null, null, 4, 8, 255, false)
|
||||
.addLiquid(Blocks.flowing_lava.getState(), 40, 8, 255, true));
|
||||
registerArea("ahrd", "Kreis Ahrd", new Area(0xcc0000, 67028432, 467.15f, 15).enableLongCaves().enableMobs()
|
||||
.setPerlinGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.HELL_HILLS)
|
||||
.setPerlinGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63, 1.0F, 0.5F)
|
||||
.setSimpleAltReplacer(Blocks.soul_sand.getState())
|
||||
.addLake(Blocks.lava.getState(), Blocks.soul_sand.getState(), Blocks.soul_sand.getState(),
|
||||
2, 8, 255, false).addLiquid(Blocks.flowing_lava.getState(), 80, 8, 255, true));
|
||||
registerArea("mizorath", "Kreis Mizorath", new Area(0xff0000, 54029584, 1067.15f, 15).enableMobs()
|
||||
.setPerlinGen(Blocks.hellrock.getState(), Blocks.blood.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.SOUL_PLAINS));
|
||||
.setPerlinGen(Blocks.hellrock.getState(), Blocks.blood.getState(), 63, -0.2F, 0.1F)
|
||||
.setSimpleAltReplacer(Blocks.soul_sand.getState()));
|
||||
registerArea("dargoth", "Kreis Dargoth", new Area(0xff3f0c, 43293629, 1707.15f, 15).enableMobs()
|
||||
.setPerlinGen(Blocks.hellrock.getState(), Blocks.magma.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.SOUL_PLAINS));
|
||||
.setPerlinGen(Blocks.hellrock.getState(), Blocks.magma.getState(), 63, -0.2F, 0.1F)
|
||||
.setSimpleAltReplacer(Blocks.soul_sand.getState()));
|
||||
registerArea("aasirith", "Kreis Aasirith", new Area(0x191919, 36291872, 2482.0f, 1).enableLongCaves().enableMobs()
|
||||
.setPerlinGen(Blocks.rock.getState(), Blocks.magma.getState(), 63)
|
||||
.setBiomeReplacer(Blocks.ash.getState()).setBiome(Biome.ASH)
|
||||
.setPerlinGen(Blocks.rock.getState(), Blocks.magma.getState(), 63, 0.125F, 0.05F)
|
||||
.setSimpleAltReplacer(Blocks.ash.getState(), Blocks.rock.getState(), Blocks.ash.getState())
|
||||
.addLake(Blocks.lava.getState(), Blocks.rock.getState(), Blocks.rock.getState(),
|
||||
2, 8, 255, false).addLiquid(Blocks.flowing_lava.getState(), 80, 8, 255, true));
|
||||
});
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package common.item.tool;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.color.TextColor;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.item.ItemStack;
|
||||
|
@ -16,10 +15,9 @@ public class ItemScanner extends ItemWand {
|
|||
|
||||
public void onUse(ItemStack stack, EntityNPC player, AWorldServer world, Vec3 vec)
|
||||
{
|
||||
Biome biome = world.getBiomeGenForCoords(new BlockPos(vec.xCoord, 0, vec.zCoord));
|
||||
player.connection.addHotbar(TextColor.NEON + "* Position in %s: %.3f %.3f %.3f, %s, %.2f °C", world.dimension.getDisplay(),
|
||||
player.connection.addHotbar(TextColor.NEON + "* Position in %s: %.3f %.3f %.3f, %.2f K, %.2f °C", world.dimension.getDisplay(),
|
||||
vec.xCoord, vec.yCoord, vec.zCoord,
|
||||
biome.display, world.getTemperatureC(new BlockPos(vec)));
|
||||
world.getTemperatureK(new BlockPos(vec)), world.getTemperatureC(new BlockPos(vec)));
|
||||
}
|
||||
|
||||
public int getRange(ItemStack stack, EntityNPC player) {
|
||||
|
|
|
@ -29,7 +29,6 @@ import common.packet.SPacketPlayerAbilities;
|
|||
import common.packet.SPacketTabComplete;
|
||||
import common.packet.SPacketUpdateEntityTags;
|
||||
import common.packet.SPacketAnimation;
|
||||
import common.packet.SPacketBiome;
|
||||
import common.packet.SPacketBlockBreakAnim;
|
||||
import common.packet.SPacketBlockChange;
|
||||
import common.packet.SPacketCamera;
|
||||
|
@ -93,7 +92,6 @@ public interface IClientPlayer extends NetHandler {
|
|||
void handlePlayerPosLook(SPacketPlayerPosLook packet);
|
||||
void handleMultiBlockChange(SPacketMultiBlockChange packet);
|
||||
void handleChunkData(SPacketChunkData packet);
|
||||
void handleBiomes(SPacketBiome packet);
|
||||
void handleBlockChange(SPacketBlockChange packet);
|
||||
void handleDisconnect(SPacketDisconnect packet);
|
||||
void handleCollectItem(SPacketCollectItem packet);
|
||||
|
|
|
@ -66,7 +66,6 @@ import common.packet.SPacketPlayerAbilities;
|
|||
import common.packet.SPacketTabComplete;
|
||||
import common.packet.SPacketUpdateEntityTags;
|
||||
import common.packet.SPacketAnimation;
|
||||
import common.packet.SPacketBiome;
|
||||
import common.packet.SPacketBlockBreakAnim;
|
||||
import common.packet.SPacketBlockChange;
|
||||
import common.packet.SPacketCamera;
|
||||
|
@ -176,7 +175,6 @@ public enum PacketRegistry {
|
|||
this.server(SPacketSkin.class);
|
||||
this.server(SPacketDisconnect.class);
|
||||
this.server(SPacketCamera.class);
|
||||
this.server(SPacketBiome.class);
|
||||
this.server(SPacketUpdateEntityTags.class);
|
||||
this.server(SPacketTrades.class);
|
||||
this.server(SPacketDimensionName.class);
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
package common.packet;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.network.IClientPlayer;
|
||||
import common.network.Packet;
|
||||
import common.network.PacketBuffer;
|
||||
import common.util.BlockPos;
|
||||
|
||||
public class SPacketBiome implements Packet<IClientPlayer> {
|
||||
private int posX;
|
||||
private int posZ;
|
||||
private Biome biome;
|
||||
|
||||
public SPacketBiome() {
|
||||
}
|
||||
|
||||
public SPacketBiome(BlockPos pos, Biome biome) {
|
||||
this.posX = pos.getX();
|
||||
this.posZ = pos.getZ();
|
||||
this.biome = biome;
|
||||
}
|
||||
|
||||
public void readPacketData(PacketBuffer buf) throws IOException {
|
||||
this.posX = buf.readInt();
|
||||
this.posZ = buf.readInt();
|
||||
this.biome = buf.readEnumValue(Biome.class);
|
||||
}
|
||||
|
||||
public void writePacketData(PacketBuffer buf) throws IOException {
|
||||
buf.writeInt(this.posX);
|
||||
buf.writeInt(this.posZ);
|
||||
buf.writeEnumValue(this.biome);
|
||||
}
|
||||
|
||||
public void processPacket(IClientPlayer handler) {
|
||||
handler.handleBiomes(this);
|
||||
}
|
||||
|
||||
public int getChunkX() {
|
||||
return this.posX >> 4;
|
||||
}
|
||||
|
||||
public int getChunkZ() {
|
||||
return this.posZ >> 4;
|
||||
}
|
||||
|
||||
public BlockPos getPos() {
|
||||
return new BlockPos(this.posX, 0, this.posZ);
|
||||
}
|
||||
|
||||
public Biome getBiome() {
|
||||
return this.biome;
|
||||
}
|
||||
}
|
|
@ -73,7 +73,7 @@ public class SPacketChunkData implements Packet<IClientPlayer>
|
|||
int i = segments * 2 * 16 * 16 * 16;
|
||||
int j = segments * 16 * 16 * 16 / 2;
|
||||
int k = overworld ? segments * 16 * 16 * 16 / 2 : 0;
|
||||
int l = biomes ? 256 * 2 : 0;
|
||||
int l = biomes ? 256 * 8 : 0;
|
||||
return i + j + k + l;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package common.world;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.dimension.Dimension;
|
||||
import common.entity.Entity;
|
||||
|
@ -10,6 +9,7 @@ import common.entity.npc.EntityNPC;
|
|||
import common.entity.types.EntityLiving;
|
||||
import common.network.IPlayer;
|
||||
import common.network.Packet;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.ParticleType;
|
||||
|
@ -46,6 +46,8 @@ public abstract class AWorldServer extends World {
|
|||
public abstract boolean isDaytime();
|
||||
public abstract int getSkylightSubtracted();
|
||||
public abstract <T extends Entity> T findNearestEntityWithinAABB(Class<? extends T> entityType, BoundingBox aabb, T closestTo);
|
||||
public abstract void setBiome(BlockPos pos, Biome biome);
|
||||
public abstract void markChunkDirty(BlockPos pos);
|
||||
public abstract void growGrass(BlockPos pos, State state, Random rand);
|
||||
public abstract boolean generateBigMushroom(BlockPos pos, State state, Random rand);
|
||||
public abstract void generateTree(BlockPos pos, State state, Random rand);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import java.util.Set;
|
|||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.block.ITileEntityProvider;
|
||||
import common.block.Material;
|
||||
|
@ -32,7 +31,6 @@ public abstract class Chunk {
|
|||
protected final Block fillerBlock;
|
||||
protected final IntHashMap<BlockArray> blocks = new IntHashMap();
|
||||
protected final Set<BlockArray> blockList = Sets.newHashSet();
|
||||
protected final char[] biomes = new char[256];
|
||||
protected final int[] precHeight = new int[256];
|
||||
protected final boolean[] updateSky = new boolean[256];
|
||||
protected final int[] height = new int[256];
|
||||
|
@ -841,10 +839,4 @@ public abstract class Chunk {
|
|||
public int getLowest() {
|
||||
return this.minHeight;
|
||||
}
|
||||
|
||||
public Biome getBiome(BlockPos pos) {
|
||||
int x = pos.getX() & 15;
|
||||
int z = pos.getZ() & 15;
|
||||
return Biome.getBiomeDef(this.biomes[z << 4 | x]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package common.world;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
|
||||
|
@ -8,5 +7,4 @@ public interface IWorldAccess extends IBlockAccess
|
|||
{
|
||||
TileEntity getTileEntity(BlockPos pos);
|
||||
int getCombinedLight(BlockPos pos, int lightValue);
|
||||
Biome getBiomeGenForCoords(BlockPos pos);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.block.artificial.BlockSlab;
|
||||
|
@ -20,7 +19,6 @@ import common.collect.Lists;
|
|||
import common.collect.Sets;
|
||||
import common.dimension.DimType;
|
||||
import common.dimension.Dimension;
|
||||
import common.dimension.Galaxy;
|
||||
import common.dimension.Moon;
|
||||
import common.dimension.Planet;
|
||||
import common.dimension.Sector;
|
||||
|
@ -189,7 +187,7 @@ public abstract class World implements IWorldAccess {
|
|||
return this.formatTime(player == null ? null : player.getOrigin().getDimension(), days);
|
||||
}
|
||||
|
||||
public abstract Biome getBiomeGenForCoords(BlockPos pos);
|
||||
protected abstract float getTemperature(BlockPos pos);
|
||||
|
||||
public boolean isAirBlock(BlockPos pos) {
|
||||
return this.getState(pos).getBlock() == Blocks.air;
|
||||
|
@ -1598,7 +1596,7 @@ public abstract class World implements IWorldAccess {
|
|||
}
|
||||
|
||||
public float getTemperatureK(BlockPos pos) {
|
||||
return Math.max(this.temp + this.getBiomeGenForCoords(pos).getTemperature(pos), 0.0f);
|
||||
return this.dimension.isExterminated() ? World.ABSOLUTE_ZERO + 150.0f : Math.max(this.temp + this.getTemperature(pos), 0.0f);
|
||||
}
|
||||
|
||||
public float getTemperatureC(BlockPos pos) {
|
||||
|
|
|
@ -165,8 +165,6 @@ public final class Server implements IThreadListener, Executor {
|
|||
if(Util.DEVMODE)
|
||||
Log.SYSTEM.warn("Entwicklungsmodus aktiv - Debugging-Features sind verfügbar");
|
||||
Registry.register();
|
||||
GenBiome.setAsProvider();
|
||||
UniverseRegistry.register();
|
||||
TeleportRegistry.register();
|
||||
RotationRegistry.register();
|
||||
ReorderRegistry.register();
|
||||
|
|
|
@ -3,7 +3,6 @@ package server.command.commands;
|
|||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.collect.Iterables;
|
||||
import common.collect.Lists;
|
||||
import common.color.TextColor;
|
||||
|
@ -15,7 +14,6 @@ import common.dimension.Star;
|
|||
import common.init.NameRegistry;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.rng.Random;
|
||||
import common.world.World;
|
||||
import server.command.ArgumentParser;
|
||||
import server.command.Command;
|
||||
import server.command.CommandEnvironment;
|
||||
|
@ -81,7 +79,6 @@ public class CommandLoad extends Command {
|
|||
this.addString("display", false);
|
||||
this.setParamsOptional();
|
||||
this.addString("star", false);
|
||||
this.addEnum("biome", Biome.DEF_BIOME, Biome.class, Biome.values());
|
||||
this.addString("convert", 'c', false, (env, last) -> {
|
||||
File[] list = IMPORTS_DIR.listFiles(file -> file.isDirectory());
|
||||
if(list != null)
|
||||
|
@ -89,18 +86,18 @@ public class CommandLoad extends Command {
|
|||
return list == null ? Lists.newArrayList() : Lists.newArrayList(Iterables.transform(Lists.newArrayList(list), file -> ArgumentParser.escape(file.getName())));
|
||||
});
|
||||
this.addFlag("teleport", 't');
|
||||
this.addColor("sky", 's', 0xffffffff);
|
||||
this.addColor("sky", 's', 0x7aa7ff);
|
||||
this.addColor("fog", 'f', 0xc0d8ff);
|
||||
this.addColor("clouds", 'w', 0xffffff);
|
||||
this.addLong("orbit", 'o', 1L, 1000000000000L, 8000000L);
|
||||
this.addLong("rotation", 'r', 1L, 1000000000000L, 24000L);
|
||||
this.addLong("rotation", 'r', 1L, 1000000000000L, 25000L);
|
||||
this.addDouble("offset", 'm', 0.0, 100000.0, 0.0);
|
||||
this.addDouble("gravity", 'g', 0.0, 100000.0, 9.81);
|
||||
this.addDouble("temperature", 'k', 0.0, 100000.0, 259.15);
|
||||
this.addDouble("gravity", 'g', 0.0, 100000.0, 10.0);
|
||||
this.addDouble("temperature", 'k', 0.0, 100000.0, 260.0);
|
||||
this.addInt("brightness", 'b', 0, 15, 0);
|
||||
}
|
||||
|
||||
public void exec(CommandEnvironment env, Executor exec, String name, String display, String star, Biome biome, String convert, boolean teleport, int sky, int fog, int clouds,
|
||||
public void exec(CommandEnvironment env, Executor exec, String name, String display, String star, String convert, boolean teleport, int sky, int fog, int clouds,
|
||||
long orbit, long rotation, double offset, double gravity, double temperature, int brightness) {
|
||||
if(teleport && !exec.isPlayer())
|
||||
throw new RunException("Nur Spieler können teleportiert werden");
|
||||
|
@ -121,7 +118,6 @@ public class CommandLoad extends Command {
|
|||
this.loadingDim = name;
|
||||
if(Converter.convert(dir, name, pos -> env.getServer().schedule(() -> {
|
||||
Planet planet = registerPlanet(star, name, display, sky, fog, clouds, orbit, rotation, (float)offset, (float)gravity, (float)temperature, brightness);
|
||||
planet.setBiome(biome);
|
||||
this.loadingDim = null;
|
||||
exec.log(TextColor.GREEN + "Welt %s wurde erfolgreich in Dimension '%s' konvertiert", dir, display);
|
||||
if(teleport && pos != null) {
|
||||
|
@ -139,7 +135,6 @@ public class CommandLoad extends Command {
|
|||
return;
|
||||
}
|
||||
Planet planet = registerPlanet(star, name, display, sky, fog, clouds, orbit, rotation, (float)offset, (float)gravity, (float)temperature, brightness);
|
||||
planet.setBiome(biome);
|
||||
exec.log(TextColor.GREEN + "Dimension '%s' wurde registriert", display);
|
||||
if(teleport && ((Player)exec).getPresentEntity() != null)
|
||||
((Player)exec).getPresentEntity().teleport(CommandWorld.adjust(env.getServer().getWorld(planet), ((Player)exec).getPresentEntity().getPosition()), planet);
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.block.artificial.BlockFence;
|
||||
import common.block.artificial.BlockFenceGate;
|
||||
|
@ -135,6 +136,7 @@ import server.vars.SVars;
|
|||
import server.world.ChunkServer;
|
||||
import server.world.Region;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.BiomeGenerator;
|
||||
|
||||
public class Player extends User implements Executor, IPlayer
|
||||
{
|
||||
|
@ -827,10 +829,10 @@ public class Player extends User implements Executor, IPlayer
|
|||
|
||||
|
||||
|
||||
public static SPacketChunkData.Extracted getExtractedData(ChunkServer chunk, boolean biomes, boolean overworld, int[] extend)
|
||||
public static SPacketChunkData.Extracted getExtractedData(WorldServer world, ChunkServer chunk, boolean biomes, boolean overworld, int[] extend)
|
||||
{
|
||||
Set<BlockArray> aextendedblockstorage = chunk.getStorage();
|
||||
SPacketChunkData.Extracted s21packetchunkdata$extracted = new SPacketChunkData.Extracted();
|
||||
SPacketChunkData.Extracted dataset = new SPacketChunkData.Extracted();
|
||||
List<BlockArray> list = Lists.<BlockArray>newArrayList();
|
||||
|
||||
if(extend == null) {
|
||||
|
@ -851,8 +853,8 @@ public class Player extends User implements Executor, IPlayer
|
|||
extend[z] = list.get(z).getY() >> 4;
|
||||
}
|
||||
|
||||
s21packetchunkdata$extracted.extend = extend;
|
||||
s21packetchunkdata$extracted.data = new byte[SPacketChunkData.getSize(extend.length, overworld, biomes)];
|
||||
dataset.extend = extend;
|
||||
dataset.data = new byte[SPacketChunkData.getSize(extend.length, overworld, biomes)];
|
||||
int j = 0;
|
||||
|
||||
for (BlockArray extendedblockstorage1 : list)
|
||||
|
@ -861,36 +863,45 @@ public class Player extends User implements Executor, IPlayer
|
|||
|
||||
for (char c0 : achar)
|
||||
{
|
||||
s21packetchunkdata$extracted.data[j++] = (byte)(c0 & 255);
|
||||
s21packetchunkdata$extracted.data[j++] = (byte)(c0 >> 8 & 255);
|
||||
dataset.data[j++] = (byte)(c0 & 255);
|
||||
dataset.data[j++] = (byte)(c0 >> 8 & 255);
|
||||
}
|
||||
}
|
||||
|
||||
for (BlockArray extendedblockstorage2 : list)
|
||||
{
|
||||
j = copyTo(extendedblockstorage2.getBlocklight().getData(), s21packetchunkdata$extracted.data, j);
|
||||
j = copyTo(extendedblockstorage2.getBlocklight().getData(), dataset.data, j);
|
||||
}
|
||||
|
||||
if (overworld)
|
||||
{
|
||||
for (BlockArray extendedblockstorage3 : list)
|
||||
{
|
||||
j = copyTo(extendedblockstorage3.getSkylight().getData(), s21packetchunkdata$extracted.data, j);
|
||||
j = copyTo(extendedblockstorage3.getSkylight().getData(), dataset.data, j);
|
||||
}
|
||||
}
|
||||
|
||||
if (biomes)
|
||||
{
|
||||
char[] achar = chunk.getBiomes();
|
||||
|
||||
for (char c0 : achar)
|
||||
BiomeGenerator gen = world.getBiomeGenerator();
|
||||
for (int n = 0; n < 256; n++)
|
||||
{
|
||||
s21packetchunkdata$extracted.data[j++] = (byte)(c0 & 255);
|
||||
s21packetchunkdata$extracted.data[j++] = (byte)(c0 >> 8 & 255);
|
||||
int x = (chunk.xPos << 4) | (n >> 4);
|
||||
int z = (chunk.zPos << 4) | (n & 15);
|
||||
int temp = Float.floatToIntBits(gen == null ? 0.0f : gen.getBiomeAt(new BlockPos(x, 0, z), Biome.NONE).temperature);
|
||||
int off = Float.floatToIntBits(world.getTempNoise(x, z));
|
||||
dataset.data[j++] = (byte)(temp & 255);
|
||||
dataset.data[j++] = (byte)(temp >> 8 & 255);
|
||||
dataset.data[j++] = (byte)(temp >> 16 & 255);
|
||||
dataset.data[j++] = (byte)(temp >> 24 & 255);
|
||||
dataset.data[j++] = (byte)(off & 255);
|
||||
dataset.data[j++] = (byte)(off >> 8 & 255);
|
||||
dataset.data[j++] = (byte)(off >> 16 & 255);
|
||||
dataset.data[j++] = (byte)(off >> 24 & 255);
|
||||
}
|
||||
}
|
||||
|
||||
return s21packetchunkdata$extracted;
|
||||
return dataset;
|
||||
}
|
||||
|
||||
private static int copyTo(byte[] src, byte[] dest, int offset)
|
||||
|
@ -899,12 +910,12 @@ public class Player extends User implements Executor, IPlayer
|
|||
return offset + src.length;
|
||||
}
|
||||
|
||||
public static SPacketChunkData getPacket(ChunkServer chunkIn, boolean biomes, int[] extend, boolean sky)
|
||||
public static SPacketChunkData getPacket(WorldServer world, ChunkServer chunkIn, boolean biomes, int[] extend, boolean sky)
|
||||
{
|
||||
return new SPacketChunkData(chunkIn.xPos, chunkIn.zPos, biomes, getExtractedData(chunkIn, biomes, sky, extend));
|
||||
return new SPacketChunkData(chunkIn.xPos, chunkIn.zPos, biomes, getExtractedData(world, chunkIn, biomes, sky, extend));
|
||||
}
|
||||
|
||||
private static SPacketMapChunkBulk getPacket(List<ChunkServer> chunks, boolean sky)
|
||||
private static SPacketMapChunkBulk getPacket(WorldServer world, List<ChunkServer> chunks, boolean sky)
|
||||
{
|
||||
int i = chunks.size();
|
||||
int[] xPositions = new int[i];
|
||||
|
@ -914,7 +925,7 @@ public class Player extends User implements Executor, IPlayer
|
|||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
ChunkServer chunk = chunks.get(j);
|
||||
SPacketChunkData.Extracted s21packetchunkdata$extracted = getExtractedData(chunk, true, sky, null);
|
||||
SPacketChunkData.Extracted s21packetchunkdata$extracted = getExtractedData(world, chunk, true, sky, null);
|
||||
xPositions[j] = chunk.xPos;
|
||||
zPositions[j] = chunk.zPos;
|
||||
chunksData[j] = s21packetchunkdata$extracted;
|
||||
|
@ -961,6 +972,7 @@ public class Player extends User implements Executor, IPlayer
|
|||
List<ChunkServer> list = Lists.<ChunkServer>newArrayList();
|
||||
Iterator<ChunkPos> iterator1 = this.loadedChunks.iterator();
|
||||
List<TileEntity> list1 = Lists.<TileEntity>newArrayList();
|
||||
WorldServer world = this.getEntityWorld();
|
||||
|
||||
int n = 10; // TODO: this.local ? 1024 : 10;
|
||||
|
||||
|
@ -970,14 +982,14 @@ public class Player extends User implements Executor, IPlayer
|
|||
|
||||
if (chunkcoordintpair != null)
|
||||
{
|
||||
if (this.entity.worldObj.isBlockLoaded(new BlockPos(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)))
|
||||
if (world.isBlockLoaded(new BlockPos(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)))
|
||||
{
|
||||
ChunkServer chunk = this.getEntityWorld().getChunk(chunkcoordintpair.x, chunkcoordintpair.z);
|
||||
ChunkServer chunk = world.getChunk(chunkcoordintpair.x, chunkcoordintpair.z);
|
||||
|
||||
if (chunk.isPopulated())
|
||||
{
|
||||
list.add(chunk);
|
||||
list1.addAll(((WorldServer)this.entity.worldObj).getTileEntitiesIn(chunkcoordintpair.x * 16, -World.MAX_SIZE_Y, chunkcoordintpair.z * 16, chunkcoordintpair.x * 16 + 16, World.MAX_SIZE_Y, chunkcoordintpair.z * 16 + 16));
|
||||
list1.addAll(world.getTileEntitiesIn(chunkcoordintpair.x * 16, -World.MAX_SIZE_Y, chunkcoordintpair.z * 16, chunkcoordintpair.x * 16 + 16, World.MAX_SIZE_Y, chunkcoordintpair.z * 16 + 16));
|
||||
iterator1.remove();
|
||||
}
|
||||
}
|
||||
|
@ -992,11 +1004,11 @@ public class Player extends User implements Executor, IPlayer
|
|||
{
|
||||
if (list.size() == 1)
|
||||
{
|
||||
this.sendPacket(getPacket(list.get(0), true, null, this.entity.worldObj.dimension.hasSkyLight()));
|
||||
this.sendPacket(getPacket(world, list.get(0), true, null, this.entity.worldObj.dimension.hasSkyLight()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.sendPacket(getPacket(list, this.entity.worldObj.dimension.hasSkyLight()));
|
||||
this.sendPacket(getPacket(world, list, this.entity.worldObj.dimension.hasSkyLight()));
|
||||
}
|
||||
|
||||
for (TileEntity tileentity : list1)
|
||||
|
|
|
@ -25,7 +25,7 @@ public class ChunkServer extends Chunk {
|
|||
super(world, x, z);
|
||||
}
|
||||
|
||||
public ChunkServer(World world, char[] data, int height, boolean base, boolean ceil, Random rand, Biome[] biomes, int x, int z) {
|
||||
public ChunkServer(World world, char[] data, int height, boolean base, boolean ceil, Random rand, int x, int z) {
|
||||
this(world, x, z);
|
||||
boolean sky = world.dimension.hasSkyLight();
|
||||
for(int bx = 0; bx < 16; ++bx) {
|
||||
|
@ -85,20 +85,11 @@ public class ChunkServer extends Chunk {
|
|||
}
|
||||
}
|
||||
}
|
||||
for(int n = 0; n < this.biomes.length; ++n) {
|
||||
this.biomes[n] = (char)biomes[n].id;
|
||||
}
|
||||
if(ceil)
|
||||
this.resetRelight();
|
||||
else
|
||||
this.genSkyLight();
|
||||
}
|
||||
|
||||
public ChunkServer(World world, Biome biome, int x, int z) {
|
||||
this(world, x, z);
|
||||
Arrays.fill(this.biomes, (char)biome.id);
|
||||
this.genSkyLight();
|
||||
}
|
||||
|
||||
public int getTopSegment() {
|
||||
return this.top;
|
||||
|
@ -146,22 +137,6 @@ public class ChunkServer extends Chunk {
|
|||
}
|
||||
}
|
||||
|
||||
public char[] getBiomes() {
|
||||
return this.biomes;
|
||||
}
|
||||
|
||||
public void setBiomes(char[] biomes) {
|
||||
if(this.biomes.length != biomes.length) {
|
||||
Log.IO.warn("Konnte Biome des Chunks nicht setzen, Länge des Arrays ist " + biomes.length + " statt " + this.biomes.length);
|
||||
Arrays.fill(this.biomes, (char)Biome.DEF_BIOME.id);
|
||||
}
|
||||
else {
|
||||
for(int n = 0; n < this.biomes.length; ++n) {
|
||||
this.biomes[n] = biomes[n];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getHeights() {
|
||||
return this.height;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import java.io.FileInputStream;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -20,7 +19,6 @@ import java.util.Set;
|
|||
import java.util.zip.DeflaterOutputStream;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
|
@ -119,71 +117,6 @@ public class Region {
|
|||
return false;
|
||||
}
|
||||
|
||||
private static boolean makeBiomeMap(TagObject tag) {
|
||||
Map<Character, String> biomes = Maps.newTreeMap();
|
||||
Map<String, Character> assign = Maps.newHashMap();
|
||||
if(tag.hasStringArray("biomes")) {
|
||||
String[] ids = tag.getStringArray("biomes");
|
||||
for(char bid = 1; bid < ids.length; bid++) {
|
||||
String id = ids[bid];
|
||||
if(!id.isEmpty()) {
|
||||
biomes.put(bid, id);
|
||||
assign.put(id, bid);
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<Character, String> mapping = Maps.newHashMap();
|
||||
List<String> missing = Lists.newArrayList();
|
||||
char highest = 0;
|
||||
for(Biome state : Biome.values()) {
|
||||
if(state == Biome.NONE)
|
||||
continue;
|
||||
String id = state.getName();
|
||||
if(assign.containsKey(id)) {
|
||||
char bid = assign.get(id);
|
||||
if(bid == 0) {
|
||||
missing.add(id);
|
||||
continue;
|
||||
}
|
||||
mapping.put(bid, id);
|
||||
highest = bid > highest ? bid : highest;
|
||||
biomes.remove(bid);
|
||||
Log.IO.debug("Bestehende Biom-ID %d = %s", (int)bid, id);
|
||||
}
|
||||
else {
|
||||
missing.add(id);
|
||||
}
|
||||
}
|
||||
for(Entry<Character, String> entry : biomes.entrySet()) {
|
||||
Log.IO.debug("Entfernte Biom-ID %d = %s", (int)entry.getKey(), entry.getValue());
|
||||
}
|
||||
char bid = 1;
|
||||
for(String id : missing) {
|
||||
while(mapping.containsKey(bid)) {
|
||||
++bid;
|
||||
}
|
||||
mapping.put(bid, id);
|
||||
highest = bid > highest ? bid : highest;
|
||||
Log.IO.debug("Neue Biom-ID %d = %s", (int)bid, id);
|
||||
}
|
||||
for(Entry<Character, String> entry : mapping.entrySet()) {
|
||||
bid = entry.getKey();
|
||||
char ids = (char)Biome.findByName(entry.getValue()).id;
|
||||
BDECODE_MAP[bid] = ids;
|
||||
BENCODE_MAP[ids] = bid;
|
||||
}
|
||||
if(!missing.isEmpty() || !biomes.isEmpty()) {
|
||||
String[] ids = new String[highest + 1];
|
||||
ids[0] = Biome.NONE.getName();
|
||||
for(bid = 1; bid < ids.length; bid++) {
|
||||
ids[bid] = mapping.getOrDefault(bid, "");
|
||||
}
|
||||
tag.setStringArray("biomes", ids);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void loadMap() {
|
||||
File mapFile = new File("datamap.cdt");
|
||||
TagObject tag;
|
||||
|
@ -199,10 +132,8 @@ public class Region {
|
|||
else {
|
||||
tag = new TagObject();
|
||||
}
|
||||
boolean states = makeMap(tag);
|
||||
boolean biomes = makeBiomeMap(tag);
|
||||
if(states || biomes) {
|
||||
Log.IO.info((states ? "Block-IDs" : "") + (states && biomes ? " und " : "") + (biomes ? "Biom-IDs" : "") + " haben sich geändert, schreibe %s", mapFile);
|
||||
if(makeMap(tag)) {
|
||||
Log.IO.info("Block-IDs haben sich geändert, schreibe %s", mapFile);
|
||||
try {
|
||||
TagObject.writeGZip(tag, mapFile);
|
||||
}
|
||||
|
@ -242,8 +173,6 @@ public class Region {
|
|||
private static final List<WorldServer> QUEUE = Collections.<WorldServer>synchronizedList(Lists.<WorldServer>newArrayList());
|
||||
private static final char[] DECODE_MAP = new char[65536];
|
||||
private static final char[] ENCODE_MAP = new char[65536];
|
||||
private static final char[] BDECODE_MAP = new char[65536];
|
||||
private static final char[] BENCODE_MAP = new char[65536];
|
||||
|
||||
private static volatile long queued;
|
||||
private static volatile long saved;
|
||||
|
@ -593,18 +522,6 @@ public class Region {
|
|||
|
||||
chunk.setStorage(sections);
|
||||
|
||||
if(tag.hasByteArray("Biomes")) {
|
||||
byte[] bdata = tag.getByteArray("Biomes");
|
||||
char[] biomes = new char[bdata.length / 2];
|
||||
for(int n = 0; n < biomes.length; n++) {
|
||||
biomes[n] = BDECODE_MAP[(char)((bdata[n * 2] & 255) << 8 | bdata[n * 2 + 1] & 255)];
|
||||
}
|
||||
chunk.setBiomes(biomes);
|
||||
}
|
||||
else {
|
||||
Arrays.fill(chunk.getBiomes(), (char)Biome.DEF_BIOME.id);
|
||||
}
|
||||
|
||||
List<TagObject> entities = tag.getList("Entities");
|
||||
|
||||
if(entities != null) {
|
||||
|
@ -734,14 +651,6 @@ public class Region {
|
|||
}
|
||||
|
||||
tag.setList("Sections", sects);
|
||||
char[] biomes = chunk.getBiomes();
|
||||
byte[] bdata = new byte[biomes.length * 2];
|
||||
for(int n = 0; n < biomes.length; n++) {
|
||||
char biome = BENCODE_MAP[biomes[n]];
|
||||
bdata[n * 2] = (byte)(biome >> 8 & 255);
|
||||
bdata[n * 2 + 1] = (byte)(biome & 255);
|
||||
}
|
||||
tag.setByteArray("Biomes", bdata);
|
||||
chunk.setHasEntities(false);
|
||||
List<TagObject> entities = Lists.newArrayList();
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Set;
|
|||
|
||||
import common.block.Block;
|
||||
import common.collect.Sets;
|
||||
import common.dimension.RngSpawn;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.npc.EntityWaterNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
|
@ -16,7 +17,6 @@ import common.util.ExtMath;
|
|||
import common.world.World;
|
||||
import server.vars.SVars;
|
||||
import server.worldgen.biome.GenBiome;
|
||||
import server.worldgen.biome.RngSpawn;
|
||||
|
||||
public abstract class Spawner {
|
||||
private static final int MOB_COUNT_DIV = (int)Math.pow(17.0D, 2.0D);
|
||||
|
@ -158,15 +158,11 @@ public abstract class Spawner {
|
|||
return spawned;
|
||||
}
|
||||
|
||||
public static void generate(WorldServer world, GenBiome biome, int x, int z, int sx, int sz, Random rand) {
|
||||
public static void generate(WorldServer world, WeightedList<RngSpawn> list, int x, int z, int sx, int sz, Random rand) {
|
||||
int iters = 0;
|
||||
while(rand.floatv() < biome.getMobGenChance()) {
|
||||
while(rand.floatv() < 0.1f) {
|
||||
if(iters++ == 10)
|
||||
break;
|
||||
WeightedList<RngSpawn> list = biome.getMobs();
|
||||
if(list.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
RngSpawn entry = list.pick(world.rand);
|
||||
int count = entry.min + rand.zrange(1 + entry.max - entry.min);
|
||||
Object data = null;
|
||||
|
|
|
@ -18,6 +18,8 @@ import common.block.BlockFalling;
|
|||
import common.block.ITileEntityProvider;
|
||||
import common.block.Material;
|
||||
import common.block.artificial.BlockDoor;
|
||||
import common.block.foliage.BlockFlower;
|
||||
import common.block.foliage.BlockSapling;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.block.natural.BlockSnow;
|
||||
import common.collect.Lists;
|
||||
|
@ -28,6 +30,7 @@ import common.dimension.Dimension.GeneratorType;
|
|||
import common.dimension.Lake;
|
||||
import common.dimension.Liquid;
|
||||
import common.dimension.Ore;
|
||||
import common.dimension.RngSpawn;
|
||||
import common.entity.DamageSource;
|
||||
import common.entity.Entity;
|
||||
import common.entity.EntityTrackerEntry;
|
||||
|
@ -37,6 +40,7 @@ import common.entity.types.EntityLiving;
|
|||
import common.init.Blocks;
|
||||
import common.init.SoundEvent;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.init.WoodType;
|
||||
import common.log.Log;
|
||||
import common.network.IPlayer;
|
||||
import common.network.Packet;
|
||||
|
@ -47,11 +51,11 @@ import common.packet.SPacketSoundEffect;
|
|||
import common.packet.SPacketParticles;
|
||||
import common.packet.SPacketChangeGameState;
|
||||
import common.packet.SPacketSpawnGlobalEntity;
|
||||
import common.packet.SPacketBiome;
|
||||
import common.packet.SPacketBlockBreakAnim;
|
||||
import common.packet.SPacketBlockChange;
|
||||
import common.packet.SPacketCelestials;
|
||||
import common.packet.SPacketMultiBlockChange;
|
||||
import common.rng.PerlinGen;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.tags.TagObject;
|
||||
|
@ -81,14 +85,13 @@ import server.init.TeleportRegistry;
|
|||
import server.network.Player;
|
||||
import server.vars.SVars;
|
||||
import server.village.VillageCollection;
|
||||
import server.worldgen.BiomeGenLayered;
|
||||
import server.worldgen.BiomeGenPerlin;
|
||||
import server.worldgen.BiomeGenSingle;
|
||||
import server.worldgen.BiomeGenerator;
|
||||
import server.worldgen.BlockReplacer;
|
||||
import server.worldgen.ChunkGenerator;
|
||||
import server.worldgen.ChunkPrimer;
|
||||
import server.worldgen.FeatureDungeons;
|
||||
import server.worldgen.FeatureGenerator;
|
||||
import server.worldgen.FeatureLakes;
|
||||
import server.worldgen.FeatureLiquids;
|
||||
import server.worldgen.FeatureOres;
|
||||
|
@ -99,20 +102,33 @@ import server.worldgen.GeneratorIsland;
|
|||
import server.worldgen.GeneratorPerlin;
|
||||
import server.worldgen.GeneratorSimple;
|
||||
import server.worldgen.MobConstants;
|
||||
import server.worldgen.ReplacerAltSimple;
|
||||
import server.worldgen.ReplacerAltBiome;
|
||||
import server.worldgen.ReplacerAltSurface;
|
||||
import server.worldgen.ReplacerBiome;
|
||||
import server.worldgen.ReplacerMesa;
|
||||
import server.worldgen.ReplacerTerranian;
|
||||
import server.worldgen.ReplacerTopLayer;
|
||||
import server.worldgen.biome.GenBiome;
|
||||
import server.worldgen.biome.RngSpawn;
|
||||
import server.worldgen.caves.MapGenBigCaves;
|
||||
import server.worldgen.caves.MapGenCaves;
|
||||
import server.worldgen.caves.MapGenRavine;
|
||||
import server.worldgen.foliage.WorldGenBigMushroom;
|
||||
import server.worldgen.populator.Populator;
|
||||
import server.worldgen.populator.PopulatorBasic;
|
||||
import server.worldgen.structure.MapGenBridge;
|
||||
import server.worldgen.structure.MapGenMineshaft;
|
||||
import server.worldgen.structure.MapGenScatteredFeature;
|
||||
import server.worldgen.structure.MapGenStronghold;
|
||||
import server.worldgen.structure.MapGenVillage;
|
||||
import server.worldgen.tree.WorldGenBaseTree;
|
||||
import server.worldgen.tree.WorldGenBigTree;
|
||||
import server.worldgen.tree.WorldGenBirch;
|
||||
import server.worldgen.tree.WorldGenDarkOak;
|
||||
import server.worldgen.tree.WorldGenJungle;
|
||||
import server.worldgen.tree.WorldGenPine;
|
||||
import server.worldgen.tree.WorldGenSavanna;
|
||||
import server.worldgen.tree.WorldGenTaiga2;
|
||||
|
||||
public final class WorldServer extends AWorldServer {
|
||||
private static final int[][] XZ_DIRS = new int[][] {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
|
||||
|
@ -139,7 +155,7 @@ public final class WorldServer extends AWorldServer {
|
|||
private final Map<String, WorldSavedData> dataMap = Maps.<String, WorldSavedData>newHashMap();
|
||||
private final List<WorldSavedData> dataList = Lists.<WorldSavedData>newArrayList();
|
||||
private final List<BlockArray> toTick = Lists.newArrayList();
|
||||
private final Biome[] biomes = new Biome[256];
|
||||
private final PerlinGen tempGen;
|
||||
|
||||
private MapGenCaves caveGen;
|
||||
private MapGenBigCaves bigCaveGen;
|
||||
|
@ -154,6 +170,8 @@ public final class WorldServer extends AWorldServer {
|
|||
private BiomeGenerator biomeGen;
|
||||
private BlockReplacer replacer;
|
||||
private FeatureDungeons dungeons;
|
||||
private Populator populator;
|
||||
private WeightedList<RngSpawn> mobs;
|
||||
private State liquid;
|
||||
private boolean base;
|
||||
private boolean ceil;
|
||||
|
@ -164,9 +182,7 @@ public final class WorldServer extends AWorldServer {
|
|||
private int height;
|
||||
private int size;
|
||||
private int seaLevel;
|
||||
private boolean mobs;
|
||||
private boolean snow;
|
||||
private boolean populate;
|
||||
|
||||
private int updatesForced;
|
||||
private boolean loadersModified;
|
||||
|
@ -204,12 +220,12 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
|
||||
private BiomeGenerator createBiomeGenerator(Random rand) {
|
||||
return this.dimension.getBiomeSize() > 0 ? new BiomeGenLayered(rand.longv(), this.dimension.getDefaultBiome(), this.dimension.isSemiFixed(), this.dimension.getBiomeSize(), this.dimension.getRiverSize(),
|
||||
return this.dimension.getBiomeSize() > 0 ? new BiomeGenerator(rand.longv(), this.dimension.getDefaultBiome(), this.dimension.isSemiFixed(), this.dimension.getBiomeSize(), this.dimension.getRiverSize(),
|
||||
this.dimension.getSnowRarity(), this.dimension.getSeaRarity(), this.dimension.getAddBiomes() == null ? new Biome[0] : this.dimension.getAddBiomes(), this.dimension.getAddRarity(),
|
||||
this.dimension.getHotBiomes() == null ? new Biome[] {this.dimension.getDefaultBiome()} : this.dimension.getHotBiomes(),
|
||||
this.dimension.getMediumBiomes() == null ? new Biome[] {this.dimension.getDefaultBiome()} : this.dimension.getMediumBiomes(),
|
||||
this.dimension.getColdBiomes() == null ? new Biome[] {this.dimension.getDefaultBiome()} : this.dimension.getColdBiomes(),
|
||||
this.dimension.getFrostBiomes() == null ? new Biome[] {this.dimension.getDefaultBiome()} : this.dimension.getFrostBiomes()) : new BiomeGenSingle(this.dimension.getDefaultBiome());
|
||||
this.dimension.getFrostBiomes() == null ? new Biome[] {this.dimension.getDefaultBiome()} : this.dimension.getFrostBiomes()) : null;
|
||||
}
|
||||
|
||||
private ChunkGenerator createChunkGenerator(Random rand) {
|
||||
|
@ -218,10 +234,11 @@ public final class WorldServer extends AWorldServer {
|
|||
return this.dimension.getLayers() == null ? new GeneratorFlat(this.dimension.getSeaLevel(), this.dimension.getFiller()) : new GeneratorFlat(this.dimension.getLayers());
|
||||
case PERLIN:
|
||||
default:
|
||||
return new GeneratorPerlin(rand, this.dimension.getFiller(), this.dimension.getLiquid(), this.dimension.getNoiseGen());
|
||||
return this.biomeGen == null ? new GeneratorPerlin(rand, this.dimension.getFiller(), this.dimension.getLiquid(), this.dimension.getNoiseGen(), this.dimension.getDepth(), this.dimension.getScale()) :
|
||||
new GeneratorPerlin(rand, this.dimension.getFiller(), this.dimension.getLiquid(), this.dimension.getNoiseGen());
|
||||
case SIMPLE:
|
||||
return new GeneratorSimple(rand, this.dimension.getFiller(), this.dimension.getLiquid(),
|
||||
this.dimension.getBiomeSize() > 0 ? null : new BiomeGenPerlin(rand.longv()));
|
||||
this.biomeGen != null ? null : new BiomeGenPerlin(rand.longv()));
|
||||
case ISLAND:
|
||||
return new GeneratorIsland(rand, this.dimension.getFiller());
|
||||
case CAVERN:
|
||||
|
@ -233,11 +250,15 @@ public final class WorldServer extends AWorldServer {
|
|||
|
||||
private BlockReplacer createBlockReplacer(Random rand) {
|
||||
switch(this.dimension.getReplacerType()) {
|
||||
case BIOMES:
|
||||
case TERRANIAN:
|
||||
default:
|
||||
return new ReplacerBiome(rand);
|
||||
return new ReplacerTerranian(rand, this.dimension.getSurface(), this.dimension.getTop(), this.dimension.getFiller(), this.dimension.getAlt1(), this.dimension.getAlt2(), this.dimension.getLiquid(), this.dimension.getSeaLevel());
|
||||
case MESARIAN:
|
||||
return new ReplacerMesa(rand, this.dimension.getFiller(), this.dimension.getLiquid(), this.dimension.getSeaLevel(), this.dimension.getSurface());
|
||||
case ALT_SIMPLE:
|
||||
return new ReplacerAltSimple(rand, this.dimension.getSurface(), this.dimension.getTop(), this.dimension.getFiller(), this.dimension.getAlt1(), this.dimension.getLiquid(), this.dimension.getSeaLevel());
|
||||
case SIMPLE:
|
||||
return new ReplacerAltBiome(rand, this.dimension.getFiller(), this.dimension.getLiquid(), this.dimension.getAlt2(), this.dimension.getAlt1());
|
||||
return new ReplacerAltBiome(rand, this.dimension.getSurface(), this.dimension.getTop(), this.dimension.getFiller(), this.dimension.getLiquid(), this.dimension.getAlt2(), this.dimension.getAlt1());
|
||||
case ALTERNATE:
|
||||
return new ReplacerAltSurface(rand, this.dimension.getFiller(), this.dimension.getAlt1(), this.dimension.getAlt2(), this.dimension.getLiquid());
|
||||
case TOPLAYER:
|
||||
|
@ -247,6 +268,12 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
}
|
||||
|
||||
private Populator createPopulator() {
|
||||
switch(this.dimension.getPopulatorType()) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private FeatureDungeons createDungeonGenerator() {
|
||||
return this.dimension.getDungeons() > 0 ? new FeatureDungeons(this.dimension.getDungeons()) : null;
|
||||
}
|
||||
|
@ -254,13 +281,13 @@ public final class WorldServer extends AWorldServer {
|
|||
private MapGenCaves createCaveGenerator() {
|
||||
return this.dimension.hasCaves() ?
|
||||
(new MapGenCaves(this.dimension.getCaveFiller(), this.dimension.getFiller().getBlock(), this.dimension.getTop().getBlock(),
|
||||
this.dimension.getSurface().getBlock(), this.dimension.getAlt1().getBlock())) : null;
|
||||
this.dimension.getSurface(), this.dimension.getAlt1().getBlock())) : null;
|
||||
}
|
||||
|
||||
private MapGenRavine createRavineGenerator() {
|
||||
return this.dimension.hasRavines() ?
|
||||
(new MapGenRavine(this.dimension.getCaveFiller(), this.dimension.getFiller().getBlock(),
|
||||
this.dimension.getTop().getBlock(), this.dimension.getSurface().getBlock())) : null;
|
||||
this.dimension.getTop().getBlock(), this.dimension.getSurface())) : null;
|
||||
}
|
||||
|
||||
private MapGenBigCaves createBigCaveGenerator() {
|
||||
|
@ -314,7 +341,8 @@ public final class WorldServer extends AWorldServer {
|
|||
this.seed = this.dimension.getSeed();
|
||||
this.time = this.dimension.getTimeExisted();
|
||||
|
||||
this.grng = new Random(this.seed);
|
||||
this.grng = new Random(this.seed ^ 836430928262265276L);
|
||||
this.tempGen = new PerlinGen(this.grng, 1);
|
||||
this.initGenerator(this.dimension.isExterminated());
|
||||
this.calculateInitialSkylight();
|
||||
this.calculateInitialWeather();
|
||||
|
@ -345,9 +373,10 @@ public final class WorldServer extends AWorldServer {
|
|||
public void tick() {
|
||||
this.updatePhysics();
|
||||
this.updateWeather(false);
|
||||
this.biomeGen.cleanupCache();
|
||||
if(this.biomeGen != null)
|
||||
this.biomeGen.cleanupCache();
|
||||
// this.profiler.start("mobSpawner");
|
||||
if(this.mobs && Vars.mobs && SVars.tickSpawn) {
|
||||
if((this.mobs != null || this.bridgeGen != null || this.scatteredGen != null) && Vars.mobs && SVars.tickSpawn) {
|
||||
Spawner.spawn(this);
|
||||
}
|
||||
// this.profiler.next("chunkSource");
|
||||
|
@ -434,13 +463,12 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
|
||||
private WeightedList<RngSpawn> getSpawnTypes(BlockPos pos) {
|
||||
Biome biome = this.getBiomeGenForCoords(pos);
|
||||
if(this.bridgeGen != null && (this.bridgeGen.isPresent(pos)
|
||||
|| (this.bridgeGen.isPositionInStructure(this, pos) && this.getState(pos.down()).getBlock() == Blocks.blood_brick)))
|
||||
return MobConstants.FORTRESS_MOBS;
|
||||
else if(this.scatteredGen != null && this.scatteredGen.hasMageHut(pos))
|
||||
return MobConstants.MAGEHUT_MOBS;
|
||||
return GenBiome.BIOMES[biome.id].getMobs();
|
||||
return this.mobs;
|
||||
}
|
||||
|
||||
public RngSpawn getSpawnListEntryForTypeAt(BlockPos pos) {
|
||||
|
@ -461,13 +489,6 @@ public final class WorldServer extends AWorldServer {
|
|||
return this.biomeGen;
|
||||
}
|
||||
|
||||
public Biome getBiomeGenForCoords(final BlockPos pos) {
|
||||
if(this.isBlockLoaded(pos))
|
||||
return this.getChunk(pos).getBiome(pos);
|
||||
else
|
||||
return this.biomeGen.getBiomeGenerator(pos, Biome.DEF_BIOME);
|
||||
}
|
||||
|
||||
public void setItemData(String dataID, WorldSavedData worldSavedDataIn) {
|
||||
this.setData(dataID, worldSavedDataIn);
|
||||
}
|
||||
|
@ -1333,7 +1354,6 @@ public final class WorldServer extends AWorldServer {
|
|||
int bx = x * 16;
|
||||
int bz = z * 16;
|
||||
BlockPos pos = new BlockPos(bx, 0, bz);
|
||||
GenBiome biome = GenBiome.BIOMES[this.getBiomeGenForCoords(pos.add(16, 0, 16)).id];
|
||||
this.grng.setSeed(this.seed);
|
||||
long sx = this.grng.longv() / 2L * 2L + 1L;
|
||||
long sz = this.grng.longv() / 2L * 2L + 1L;
|
||||
|
@ -1355,7 +1375,7 @@ public final class WorldServer extends AWorldServer {
|
|||
if(this.scatteredGen != null) {
|
||||
this.scatteredGen.generateStructure(this, this.grng, coord);
|
||||
}
|
||||
if(lakes && this.lakes != null && biome.generateLakes) {
|
||||
if(lakes && this.lakes != null && (this.populator == null || this.populator.canGenerateLakes())) {
|
||||
for(FeatureLakes lake : this.lakes) {
|
||||
lake.generate(this, this.grng, pos);
|
||||
}
|
||||
|
@ -1368,16 +1388,16 @@ public final class WorldServer extends AWorldServer {
|
|||
ore.generate(this, this.grng, pos);
|
||||
}
|
||||
}
|
||||
if(this.populate) {
|
||||
biome.decorate(this, this.grng, pos);
|
||||
if(this.populator != null) {
|
||||
this.populator.decorate(this, this.grng, pos);
|
||||
}
|
||||
if(this.liquids != null && biome.generateLiquids) {
|
||||
if(this.liquids != null && (this.populator == null || this.populator.canGenerateLiquids())) {
|
||||
for(FeatureLiquids liquid : this.liquids) {
|
||||
liquid.generate(this, this.grng, pos);
|
||||
}
|
||||
}
|
||||
if(this.mobs && Vars.mobs && SVars.genSpawn) {
|
||||
Spawner.generate(this, biome, bx + 8, bz + 8, 16, 16, this.grng);
|
||||
if(this.mobs != null && Vars.mobs && SVars.genSpawn) {
|
||||
Spawner.generate(this, this.mobs, bx + 8, bz + 8, 16, 16, this.grng);
|
||||
}
|
||||
// if(this.snow) {
|
||||
pos = pos.add(8, 0, 8);
|
||||
|
@ -1400,14 +1420,16 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
|
||||
private ChunkServer generate(int x, int z) {
|
||||
if(x < -this.size || z < -this.size || x >= this.size || z >= this.size)
|
||||
return new ChunkServer(this, Biome.SPACE, x, z);
|
||||
if(x < -this.size || z < -this.size || x >= this.size || z >= this.size) {
|
||||
ChunkServer chunk = new ChunkServer(this, x, z);
|
||||
chunk.genSkyLight();
|
||||
return chunk;
|
||||
}
|
||||
this.grng.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
|
||||
ChunkPrimer primer = new ChunkPrimer(this.height);
|
||||
this.generator.generateChunk(this, x, z, primer);
|
||||
this.biomeGen.getChunkBiomes(this.biomes, x * 16, z * 16, 16, 16);
|
||||
if(this.replacer != null) {
|
||||
this.replacer.replaceBlocks(this, x, z, primer, this.grng, this.biomes);
|
||||
this.replacer.replaceBlocks(this, x, z, primer, this.grng);
|
||||
}
|
||||
if(this.caveGen != null) {
|
||||
this.caveGen.generate(this, x, z, primer);
|
||||
|
@ -1433,7 +1455,7 @@ public final class WorldServer extends AWorldServer {
|
|||
if(this.scatteredGen != null) {
|
||||
this.scatteredGen.generate(this, x, z, primer);
|
||||
}
|
||||
return new ChunkServer(this, primer.getData(), primer.height, this.base, this.ceil, this.grng, this.biomes, x, z);
|
||||
return new ChunkServer(this, primer.getData(), primer.height, this.base, this.ceil, this.grng, x, z);
|
||||
}
|
||||
|
||||
public boolean isExterminated() {
|
||||
|
@ -1565,16 +1587,16 @@ public final class WorldServer extends AWorldServer {
|
|||
private void initGenerator(boolean exterminated) {
|
||||
this.grng.setSeed(this.seed);
|
||||
this.liquid = exterminated ? Blocks.air.getState() : this.dimension.getLiquid();
|
||||
this.biomeGen = exterminated ? new BiomeGenSingle(Biome.EXTERMINATED) : this.createBiomeGenerator(this.grng);
|
||||
this.biomeGen = exterminated ? null : this.createBiomeGenerator(this.grng);
|
||||
this.generator = exterminated ? new GeneratorDestroyed(this.dimension.getSeaLevel()) : this.createChunkGenerator(this.grng);
|
||||
this.replacer = exterminated ? null : this.createBlockReplacer(this.grng);
|
||||
this.populate = !exterminated && this.dimension.hasPopulator();
|
||||
this.populator = exterminated ? null : this.createPopulator();
|
||||
this.caveGen = exterminated ? null : this.createCaveGenerator();
|
||||
this.bigCaveGen = exterminated ? null : this.createBigCaveGenerator();
|
||||
this.ravineGen = exterminated ? null : this.createRavineGenerator();
|
||||
this.base = !exterminated && this.dimension.getFiller().getBlock() != Blocks.air && this.dimension.getGeneratorType() != GeneratorType.FLAT;
|
||||
this.ceil = !exterminated && this.dimension.hasWorldCeiling();
|
||||
this.mobs = !exterminated && this.dimension.hasMobs();
|
||||
this.mobs = exterminated || this.dimension.getSpawns().isEmpty() ? null : this.dimension.getSpawns();
|
||||
this.snow = !exterminated && this.dimension.hasSnow();
|
||||
this.strongholdGen = !exterminated && this.dimension.hasStrongholds() ? new MapGenStronghold() : null;
|
||||
this.villageGen = !exterminated && this.dimension.hasVillages() ? new MapGenVillage() : null;
|
||||
|
@ -1719,22 +1741,6 @@ public final class WorldServer extends AWorldServer {
|
|||
return this.instances.getValueByKey(v) != null;
|
||||
}
|
||||
|
||||
public void setBiome(BlockPos pos, Biome biome) {
|
||||
if(this.dimension.isExterminated())
|
||||
return;
|
||||
ChunkServer chunk = this.getChunk(pos);
|
||||
if(chunk == null || !chunk.isLoaded())
|
||||
return;
|
||||
chunk.getBiomes()[((pos.getZ() & 0xF) << 4 | pos.getX() & 0xF)] = (char)biome.id;
|
||||
chunk.setModified(true);
|
||||
int chunkX = pos.getX() >> 4;
|
||||
int chunkZ = pos.getZ() >> 4;
|
||||
long v = (long)chunkX + 2147483647L | (long)chunkZ + 2147483647L << 32;
|
||||
PlayerInstance ins = this.instances.getValueByKey(v);
|
||||
if(ins != null)
|
||||
ins.sendToAllPlayersWatchingChunk(new SPacketBiome(pos, biome));
|
||||
}
|
||||
|
||||
private PlayerInstance getPlayerInstance(int chunkX, int chunkZ, boolean create) {
|
||||
long v = (long)chunkX + 2147483647L | (long)chunkZ + 2147483647L << 32;
|
||||
PlayerInstance inst = this.instances.getValueByKey(v);
|
||||
|
@ -2332,6 +2338,15 @@ public final class WorldServer extends AWorldServer {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected float getTemperature(BlockPos pos) {
|
||||
float temperature = this.biomeGen == null ? 0.0f : this.biomeGen.getBiomeAt(pos, Biome.NONE).temperature;
|
||||
return pos.getY() > 64 ? temperature - (this.getTempNoise(pos.getX(), pos.getZ()) + (float)pos.getY() - 64.0F) / 15.0f : temperature;
|
||||
}
|
||||
|
||||
public float getTempNoise(int x, int z) {
|
||||
return (float)(this.tempGen.generate((double)x * 1.0D / 8.0D, (double)z * 1.0D / 8.0D) * 4.0D);
|
||||
}
|
||||
|
||||
// public boolean canBlockSeeSky(BlockPos pos) {
|
||||
// if(pos.getY() >= this.getSeaLevel()) {
|
||||
|
@ -2606,6 +2621,227 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
return new SPacketMultiBlockChange(pos, changes);
|
||||
}
|
||||
|
||||
public boolean generateBigMushroom(BlockPos pos, State state, Random rand)
|
||||
{
|
||||
this.setBlockToAir(pos);
|
||||
FeatureGenerator worldgenerator = null;
|
||||
|
||||
if (state.getBlock() == Blocks.brown_mushroom)
|
||||
{
|
||||
worldgenerator = new WorldGenBigMushroom(Blocks.brown_mushroom_block);
|
||||
}
|
||||
else if (state.getBlock() == Blocks.red_mushroom)
|
||||
{
|
||||
worldgenerator = new WorldGenBigMushroom(Blocks.red_mushroom_block);
|
||||
}
|
||||
|
||||
if (worldgenerator != null && worldgenerator.generate(this, rand, pos))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setState(pos, state, 3);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isTypeAt(BlockPos pos, WoodType type)
|
||||
{
|
||||
State iblockstate = this.getState(pos);
|
||||
return iblockstate.getBlock() instanceof BlockSapling && ((BlockSapling)iblockstate.getBlock()).getWoodType() == type;
|
||||
}
|
||||
|
||||
private boolean isSameSaplingTypeIn(BlockPos pos, int xOff, int yOff, WoodType type)
|
||||
{
|
||||
return this.isTypeAt(pos.add(xOff, 0, yOff), type) && this.isTypeAt(pos.add(xOff + 1, 0, yOff), type) && this.isTypeAt(pos.add(xOff, 0, yOff + 1), type) && this.isTypeAt(pos.add(xOff + 1, 0, yOff + 1), type);
|
||||
}
|
||||
|
||||
public void generateTree(BlockPos pos, State state, Random rand)
|
||||
{
|
||||
WoodType type = state.getBlock() instanceof BlockSapling ? ((BlockSapling)state.getBlock()).getWoodType() : 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());
|
||||
WoodType leaves = type == WoodType.CHERRY || type == WoodType.MAPLE ? type : WoodType.OAK;
|
||||
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(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(), WoodType.TIAN)
|
||||
.setHeightLimit(6, 20);
|
||||
break;
|
||||
|
||||
case JUNGLE:
|
||||
State iblockstate = Blocks.jungle_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE);
|
||||
WoodType iblockstate1 = WoodType.JUNGLE; // .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(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(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)
|
||||
{
|
||||
this.setState(pos.add(i, 0, j), iblockstate2, 4);
|
||||
this.setState(pos.add(i + 1, 0, j), iblockstate2, 4);
|
||||
this.setState(pos.add(i, 0, j + 1), iblockstate2, 4);
|
||||
this.setState(pos.add(i + 1, 0, j + 1), iblockstate2, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setState(pos, iblockstate2, 4);
|
||||
}
|
||||
|
||||
if (!worldgenerator.generate(this, rand, pos.add(i, 0, j)))
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
this.setState(pos.add(i, 0, j), state, 4);
|
||||
this.setState(pos.add(i + 1, 0, j), state, 4);
|
||||
this.setState(pos.add(i, 0, j + 1), state, 4);
|
||||
this.setState(pos.add(i + 1, 0, j + 1), state, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setState(pos, state, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void growGrass(BlockPos pos, State state, Random rand)
|
||||
{
|
||||
BlockPos blockpos = pos.up();
|
||||
|
||||
for (int i = 0; i < 128; ++i)
|
||||
{
|
||||
BlockPos blockpos1 = blockpos;
|
||||
int j = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (j >= i / 16)
|
||||
{
|
||||
if (this.getState(blockpos1).getBlock() == Blocks.air)
|
||||
{
|
||||
if (rand.chance(8))
|
||||
{
|
||||
BlockFlower.EnumFlowerType blockflower$enumflowertype = rand.pick(BlockFlower.EnumFlowerType.ROSE, BlockFlower.EnumFlowerType.DANDELION, BlockFlower.EnumFlowerType.POPPY, BlockFlower.EnumFlowerType.DAISY);
|
||||
BlockFlower blockflower = BlockFlower.getByType(blockflower$enumflowertype);
|
||||
State iblockstate = blockflower.getState();
|
||||
|
||||
if (blockflower.canBlockStay(this, blockpos1, iblockstate))
|
||||
{
|
||||
this.setState(blockpos1, iblockstate, 3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
State iblockstate1 = Blocks.tallgrass.getState();
|
||||
|
||||
if (Blocks.tallgrass.canBlockStay(this, blockpos1, iblockstate1))
|
||||
{
|
||||
this.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 (this.getState(blockpos1.down()).getBlock() != Blocks.grass || this.getState(blockpos1).getBlock().isNormalCube())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
++j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class PlayerInstance {
|
||||
private final List<EntityNPC> watching = Lists.<EntityNPC>newArrayList();
|
||||
|
@ -2642,7 +2878,7 @@ public final class WorldServer extends AWorldServer {
|
|||
ChunkServer chunk = WorldServer.this.getChunk(this.position.x, this.position.z);
|
||||
|
||||
if(chunk.isPopulated()) {
|
||||
player.connection.sendPacket(Player.getPacket(chunk, true, new int[0], WorldServer.this.dimension.hasSkyLight()));
|
||||
player.connection.sendPacket(Player.getPacket(WorldServer.this, chunk, true, new int[0], WorldServer.this.dimension.hasSkyLight()));
|
||||
}
|
||||
|
||||
this.watching.remove(player);
|
||||
|
@ -2733,7 +2969,7 @@ public final class WorldServer extends AWorldServer {
|
|||
extend[n++] = i;
|
||||
}
|
||||
}
|
||||
this.sendToAllPlayersWatchingChunk(Player.getPacket(WorldServer.this.getChunk(this.position.x, this.position.z),
|
||||
this.sendToAllPlayersWatchingChunk(Player.getPacket(WorldServer.this, WorldServer.this.getChunk(this.position.x, this.position.z),
|
||||
this.biomes, extend, WorldServer.this.dimension.hasSkyLight()));
|
||||
|
||||
if(this.biomes) {
|
||||
|
|
|
@ -1,276 +0,0 @@
|
|||
package server.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 server.worldgen.layer.GenLayer;
|
||||
import server.worldgen.layer.GenLayerAddAreas;
|
||||
import server.worldgen.layer.GenLayerAddExtra;
|
||||
import server.worldgen.layer.GenLayerAddSea;
|
||||
import server.worldgen.layer.GenLayerAddSnow;
|
||||
import server.worldgen.layer.GenLayerBase;
|
||||
import server.worldgen.layer.GenLayerBiome;
|
||||
import server.worldgen.layer.GenLayerBiomeEdge;
|
||||
import server.worldgen.layer.GenLayerEdge;
|
||||
import server.worldgen.layer.GenLayerFuzzyZoom;
|
||||
import server.worldgen.layer.GenLayerHills;
|
||||
import server.worldgen.layer.GenLayerRemoveEmpty;
|
||||
import server.worldgen.layer.GenLayerRiver;
|
||||
import server.worldgen.layer.GenLayerRiverInit;
|
||||
import server.worldgen.layer.GenLayerRiverMix;
|
||||
import server.worldgen.layer.GenLayerShore;
|
||||
import server.worldgen.layer.GenLayerSmooth;
|
||||
import server.worldgen.layer.GenLayerVoronoiZoom;
|
||||
import server.worldgen.layer.GenLayerZoom;
|
||||
import server.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.getBiomeDef(aint[i]);
|
||||
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.getBiomeDef(aint[i]);
|
||||
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.getBiomeDef(aint[i]);
|
||||
}
|
||||
}
|
||||
|
||||
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.getBiomeDef(aint[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,47 +0,0 @@
|
|||
package server.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());
|
||||
}
|
||||
}
|
|
@ -1,16 +1,248 @@
|
|||
package server.worldgen;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.collect.Lists;
|
||||
import common.log.Log;
|
||||
import common.util.BlockPos;
|
||||
import common.util.LongHashMap;
|
||||
import server.worldgen.layer.GenLayer;
|
||||
import server.worldgen.layer.GenLayerAddAreas;
|
||||
import server.worldgen.layer.GenLayerAddExtra;
|
||||
import server.worldgen.layer.GenLayerAddSea;
|
||||
import server.worldgen.layer.GenLayerAddSnow;
|
||||
import server.worldgen.layer.GenLayerBase;
|
||||
import server.worldgen.layer.GenLayerBiome;
|
||||
import server.worldgen.layer.GenLayerBiomeEdge;
|
||||
import server.worldgen.layer.GenLayerEdge;
|
||||
import server.worldgen.layer.GenLayerFuzzyZoom;
|
||||
import server.worldgen.layer.GenLayerHills;
|
||||
import server.worldgen.layer.GenLayerRemoveEmpty;
|
||||
import server.worldgen.layer.GenLayerRiver;
|
||||
import server.worldgen.layer.GenLayerRiverInit;
|
||||
import server.worldgen.layer.GenLayerRiverMix;
|
||||
import server.worldgen.layer.GenLayerShore;
|
||||
import server.worldgen.layer.GenLayerSmooth;
|
||||
import server.worldgen.layer.GenLayerVoronoiZoom;
|
||||
import server.worldgen.layer.GenLayerZoom;
|
||||
import server.worldgen.layer.IntCache;
|
||||
|
||||
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 void cleanupCache();
|
||||
public class 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;
|
||||
BiomeGenerator.this.getFactors(this.factors, x << 4, z << 4, 16, 16);
|
||||
BiomeGenerator.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 final Biome[] biomes = new Biome[256];
|
||||
private final Biome defBiome;
|
||||
private long lastCleanupTime;
|
||||
|
||||
public BiomeGenerator(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 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(this, 1000L, layer22n);
|
||||
GenLayer layer21l = GenLayerZoom.magnify(1000L, layer20, 2);
|
||||
GenLayer layer24n = new GenLayerHills(this, 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(this, 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;
|
||||
this.defBiome = def;
|
||||
}
|
||||
|
||||
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 getBiome(int id)
|
||||
{
|
||||
return id >= 0 && id < this.biomes.length ? this.biomes[id] : null;
|
||||
}
|
||||
|
||||
public Biome getBiomeAt(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;
|
||||
}
|
||||
|
||||
private 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 = this.getBiome(aint[i]);
|
||||
listToReuse[i] = biome == null ? 0.0 : (double)biome.factor;
|
||||
}
|
||||
}
|
||||
|
||||
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 = this.getBiome(aint[i]);
|
||||
factors[i] = biome == null ? 0.0 : (double)biome.factor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void getGenBiomes(float[] depths, float[] scales, 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) {
|
||||
Biome biome = this.getBiome(aint[i]);
|
||||
depths[i] = biome == null ? 0.0f : biome.depth;
|
||||
scales[i] = biome == null ? 0.0f : biome.scale;
|
||||
}
|
||||
}
|
||||
|
||||
private 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) {
|
||||
Biome biome = this.getBiome(aint[i]);
|
||||
listToReuse[i] = biome == null ? this.defBiome : 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 = this.getBiome(aint[k1]);
|
||||
|
||||
if(biome == null || !allowed.contains(biome.base)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package server.worldgen;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.rng.Random;
|
||||
import server.world.WorldServer;
|
||||
|
||||
public interface BlockReplacer {
|
||||
public void replaceBlocks(WorldServer world, int x, int z, ChunkPrimer primer, Random rand, Biome[] biomes);
|
||||
public void replaceBlocks(WorldServer world, int x, int z, ChunkPrimer primer, Random rand);
|
||||
}
|
||||
|
|
|
@ -109,6 +109,9 @@ public class FeatureLakes
|
|||
}
|
||||
}
|
||||
|
||||
Block replace = this.top != null ? worldIn.dimension.getSurface().getBlock() : null;
|
||||
boolean useTop = false;
|
||||
|
||||
for (int k1 = 0; k1 < 16; ++k1)
|
||||
{
|
||||
for (int l2 = 0; l2 < 16; ++l2)
|
||||
|
@ -119,17 +122,21 @@ public class FeatureLakes
|
|||
|
||||
if (flag)
|
||||
{
|
||||
Material material = worldIn.getState(position.add(k1, k, l2)).getBlock().getMaterial();
|
||||
State state = worldIn.getState(position.add(k1, k, l2));
|
||||
Material material = state.getBlock().getMaterial();
|
||||
|
||||
if (k >= 4 && material.isLiquid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (k < 4 && !material.isSolid() && worldIn.getState(position.add(k1, k, l2)).getBlock() != this.block)
|
||||
if (k < 4 && !material.isSolid() && state.getBlock() != this.block)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(replace != null && !useTop && state.getBlock() == replace)
|
||||
useTop = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -149,8 +156,8 @@ public class FeatureLakes
|
|||
}
|
||||
}
|
||||
|
||||
if(this.top != null) {
|
||||
Block replace = worldIn.dimension.getTop().getBlock();
|
||||
if(useTop) {
|
||||
replace = worldIn.dimension.getTop().getBlock();
|
||||
for (int i2 = 0; i2 < 16; ++i2)
|
||||
{
|
||||
for (int j3 = 0; j3 < 16; ++j3)
|
||||
|
@ -163,16 +170,7 @@ public class FeatureLakes
|
|||
|
||||
if (worldIn.getState(blockpos).getBlock() == replace && worldIn.getLightFor(LightType.SKY, position.add(i2, j4, j3)) > 0)
|
||||
{
|
||||
GenBiome biomegenbase = GenBiome.BIOMES[worldIn.getBiomeGenForCoords(blockpos).id];
|
||||
|
||||
if (biomegenbase.topBlock.getBlock() == Blocks.mycelium)
|
||||
{
|
||||
worldIn.setState(blockpos, Blocks.mycelium.getState(), 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setState(blockpos, this.top, 2);
|
||||
}
|
||||
worldIn.setState(blockpos, this.top, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package server.worldgen;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.dimension.Dimension;
|
||||
import common.rng.NoiseGen;
|
||||
|
@ -52,7 +54,8 @@ public class GeneratorPerlin implements ChunkGenerator
|
|||
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];
|
||||
private final float[] depths = new float[100];
|
||||
private final float[] scales = new float[100];
|
||||
|
||||
// public GeneratorNew(Random rand, GeneratorSettings settings)
|
||||
// {
|
||||
|
@ -63,6 +66,12 @@ public class GeneratorPerlin implements ChunkGenerator
|
|||
// 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, float depth, float scale) {
|
||||
this(rand, block, liquid, settings);
|
||||
Arrays.fill(this.depths, depth);
|
||||
Arrays.fill(this.scales, scale);
|
||||
}
|
||||
|
||||
public GeneratorPerlin(Random rand, State block, State liquid, Dimension.GeneratorSettings settings) {
|
||||
this(rand, /* dim.hasFarLands(), dim.getSeaLevel(), */ block, liquid,
|
||||
|
@ -108,8 +117,9 @@ public class GeneratorPerlin implements ChunkGenerator
|
|||
|
||||
public void generateChunk(WorldServer world, int x, int z, ChunkPrimer primer)
|
||||
{
|
||||
int sea = world.getSeaLevel();
|
||||
world.getBiomeGenerator().getGenBiomes(this.biomes, x * 4 - 2, z * 4 - 2, 10, 10);
|
||||
int sea = world.getSeaLevel();
|
||||
if(world.getBiomeGenerator() != null)
|
||||
world.getBiomeGenerator().getGenBiomes(this.depths, this.scales, x * 4 - 2, z * 4 - 2, 10, 10);
|
||||
this.genNoisemap(x * 4, 0, z * 4);
|
||||
|
||||
for (int xb = 0; xb < 4; ++xb)
|
||||
|
@ -196,16 +206,18 @@ public class GeneratorPerlin implements ChunkGenerator
|
|||
float max = 0.0F;
|
||||
float min = 0.0F;
|
||||
float sum = 0.0F;
|
||||
int range = 2;
|
||||
GenBiome biome = GenBiome.BIOMES[this.biomes[u + 2 + (v + 2) * 10].id];
|
||||
int range = 2;
|
||||
float depth1 = this.depths[u + 2 + (v + 2) * 10];
|
||||
float scale1 = this.scales[u + 2 + (v + 2) * 10];
|
||||
|
||||
for (int a = -range; a <= range; ++a)
|
||||
{
|
||||
for (int b = -range; b <= range; ++b)
|
||||
{
|
||||
GenBiome biome2 = GenBiome.BIOMES[this.biomes[u + a + 2 + (v + b + 2) * 10].id];
|
||||
float bmin = this.biomeDepthOffset + biome2.depth * this.biomeDepthWeight;
|
||||
float bmax = this.biomeScaleOffset + biome2.scale * this.biomeScaleWeight;
|
||||
{
|
||||
float depth2 = this.depths[u + a + 2 + (v + b + 2) * 10];
|
||||
float scale2 = this.scales[u + a + 2 + (v + b + 2) * 10];
|
||||
float bmin = this.biomeDepthOffset + depth2 * this.biomeDepthWeight;
|
||||
float bmax = this.biomeScaleOffset + scale2 * this.biomeScaleWeight;
|
||||
|
||||
if (this.amplification > 0.0F && bmin > 0.0F)
|
||||
{
|
||||
|
@ -215,7 +227,7 @@ public class GeneratorPerlin implements ChunkGenerator
|
|||
|
||||
float fact = PARABOLIC[a + 2 + (b + 2) * 5] / (bmin + 2.0F);
|
||||
|
||||
if (biome2.depth > biome.depth)
|
||||
if (depth2 > depth1)
|
||||
{
|
||||
fact /= 2.0F;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package server.worldgen;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import common.rng.NoiseGen;
|
||||
import common.rng.OctaveGen;
|
||||
import common.rng.Random;
|
||||
|
@ -56,10 +58,10 @@ public class GeneratorSimple implements ChunkGenerator
|
|||
|
||||
public void generateChunk(WorldServer world, int x, int z, ChunkPrimer primer)
|
||||
{
|
||||
if(this.biomeGen == null)
|
||||
world.getBiomeGenerator().genFactors(this.factors, x * 16, z * 16, 16, 16);
|
||||
else
|
||||
if(this.biomeGen != null)
|
||||
this.biomeGen.generate(this.factors, x, z);
|
||||
else if(world.getBiomeGenerator() != null)
|
||||
world.getBiomeGenerator().genFactors(this.factors, x * 16, z * 16, 16, 16);
|
||||
byte range = 4;
|
||||
int sea = world.getSeaLevel();
|
||||
int xr = range + 1;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package server.worldgen;
|
||||
|
||||
import common.dimension.RngSpawn;
|
||||
import common.entity.npc.EntityDarkMage;
|
||||
import common.entity.npc.EntityMage;
|
||||
import common.entity.npc.EntityTiefling;
|
||||
import common.entity.npc.EntityUndead;
|
||||
import common.rng.WeightedList;
|
||||
import server.worldgen.biome.RngSpawn;
|
||||
|
||||
public abstract class MobConstants {
|
||||
public static final WeightedList<RngSpawn> MAGEHUT_MOBS = new WeightedList<RngSpawn>(new RngSpawn(EntityMage.class, 1, 1, 1));
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package server.worldgen;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.rng.NoiseGen;
|
||||
|
@ -16,6 +15,8 @@ public class ReplacerAltBiome implements BlockReplacer
|
|||
private final NoiseGen exclNoiseGen;
|
||||
|
||||
private final State filler;
|
||||
private final State top;
|
||||
private final State surface;
|
||||
private final State liquid;
|
||||
private final State alt1;
|
||||
private final State alt2;
|
||||
|
@ -36,7 +37,7 @@ public class ReplacerAltBiome implements BlockReplacer
|
|||
// 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)
|
||||
public ReplacerAltBiome(Random rand, /* boolean farlands, */ State surface, State top, 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);
|
||||
|
@ -45,9 +46,11 @@ public class ReplacerAltBiome implements BlockReplacer
|
|||
this.alt1 = alt1;
|
||||
this.alt2 = alt2;
|
||||
this.block = filler.getBlock();
|
||||
this.surface = surface;
|
||||
this.top = top;
|
||||
}
|
||||
|
||||
public void replaceBlocks(WorldServer world, int x, int z, ChunkPrimer primer, Random rand, Biome[] biomes)
|
||||
public void replaceBlocks(WorldServer world, int x, int z, ChunkPrimer primer, Random rand)
|
||||
{
|
||||
int seaLevel = world.getSeaLevel();
|
||||
double scale = 0.03125D;
|
||||
|
@ -58,13 +61,12 @@ public class ReplacerAltBiome implements BlockReplacer
|
|||
{
|
||||
for(int px = 0; px < 16; px++)
|
||||
{
|
||||
GenBiome biome = GenBiome.BIOMES[biomes[pz * 16 + px].id];
|
||||
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;
|
||||
State topBlock = this.surface;
|
||||
State fillerBlock = this.top;
|
||||
for(int py = primer.height - 1; py >= 0; py--)
|
||||
{
|
||||
Block currentBlock = primer.get(px, py, pz).getBlock();
|
||||
|
@ -86,8 +88,8 @@ public class ReplacerAltBiome implements BlockReplacer
|
|||
} else
|
||||
if(py >= seaLevel - 4 && py <= seaLevel + 1)
|
||||
{
|
||||
topBlock = biome.topBlock;
|
||||
fillerBlock = biome.fillerBlock;
|
||||
topBlock = this.surface;
|
||||
fillerBlock = this.top;
|
||||
if(alt1)
|
||||
{
|
||||
topBlock = Blocks.air.getState();
|
||||
|
|
108
server/src/main/java/server/worldgen/ReplacerAltSimple.java
Normal file
108
server/src/main/java/server/worldgen/ReplacerAltSimple.java
Normal file
|
@ -0,0 +1,108 @@
|
|||
package server.worldgen;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
import server.world.WorldServer;
|
||||
|
||||
public class ReplacerAltSimple extends ReplacerBiome
|
||||
{
|
||||
protected final State alt;
|
||||
protected final State surface;
|
||||
protected final State top;
|
||||
|
||||
public ReplacerAltSimple(Random rand, State surface, State top, State filler, State alt, State liquid, int seaLevel)
|
||||
{
|
||||
super(rand, filler, liquid, seaLevel);
|
||||
this.alt = alt;
|
||||
this.surface = surface;
|
||||
this.top = top;
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(WorldServer world, Random rand, ChunkPrimer primer, int x, int z, double noise) {
|
||||
this.genTerrainBlocks(world, rand, primer, x, z, noise, this.surface, this.top);
|
||||
}
|
||||
|
||||
protected State adjust(State current) {
|
||||
return current;
|
||||
}
|
||||
|
||||
protected final void genTerrainBlocks(WorldServer world, Random rand, ChunkPrimer primer, int x, int z, double noise, State baseSurface, State baseTop)
|
||||
{
|
||||
State surface = baseSurface;
|
||||
State top = baseTop;
|
||||
State adjusted;
|
||||
int sel = -1;
|
||||
int rng = (int)(noise / 3.0D + 3.0D + rand.doublev() * 0.25D);
|
||||
int bx = x & 15;
|
||||
int bz = z & 15;
|
||||
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
||||
|
||||
for (int by = primer.height - 1; by >= 0; by--)
|
||||
{
|
||||
State current = primer.get(bz, by, bx);
|
||||
|
||||
if (current.getBlock() == Blocks.air)
|
||||
{
|
||||
sel = -1;
|
||||
}
|
||||
else if (current.getBlock() == this.fillerBlock)
|
||||
{
|
||||
if (sel == -1)
|
||||
{
|
||||
if (rng <= 0)
|
||||
{
|
||||
surface = null;
|
||||
top = this.filler;
|
||||
}
|
||||
else if (by >= this.seaLevel - 4 && by <= this.seaLevel + 1)
|
||||
{
|
||||
surface = baseSurface;
|
||||
top = baseTop;
|
||||
}
|
||||
|
||||
if (by < this.seaLevel && (surface == null || surface.getBlock() == Blocks.air))
|
||||
{
|
||||
if (this.freeze && world.getTemperatureC(pos.set(x, by, z)) <= 0.0F)
|
||||
{
|
||||
surface = Blocks.ice.getState();
|
||||
}
|
||||
else
|
||||
{
|
||||
surface = this.liquid;
|
||||
}
|
||||
}
|
||||
|
||||
sel = rng;
|
||||
|
||||
if (by >= this.seaLevel - 1)
|
||||
{
|
||||
primer.set(bz, by, bx, surface);
|
||||
}
|
||||
else if (by < this.seaLevel - 7 - rng)
|
||||
{
|
||||
surface = null;
|
||||
top = this.filler;
|
||||
primer.set(bz, by, bx, this.alt);
|
||||
}
|
||||
else
|
||||
{
|
||||
primer.set(bz, by, bx, top);
|
||||
}
|
||||
}
|
||||
else if (sel > 0)
|
||||
{
|
||||
--sel;
|
||||
primer.set(bz, by, bx, top);
|
||||
if (sel == 0 && (adjusted = this.adjust(top)) != top)
|
||||
{
|
||||
sel = rand.zrange(4) + Math.max(0, by - 63);
|
||||
top = adjusted;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package server.worldgen;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.rng.OctaveGen;
|
||||
|
@ -38,7 +37,7 @@ public class ReplacerAltSurface implements BlockReplacer
|
|||
this.fillerBlock = filler.getBlock();
|
||||
}
|
||||
|
||||
public void replaceBlocks(WorldServer world, int x, int z, ChunkPrimer primer, Random rand, Biome[] biomes)
|
||||
public void replaceBlocks(WorldServer world, int x, int z, ChunkPrimer primer, Random rand)
|
||||
{
|
||||
int i = world.getSeaLevel() + 1;
|
||||
double d0 = 0.03125D;
|
||||
|
|
|
@ -1,33 +1,45 @@
|
|||
package server.worldgen;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.rng.PerlinGen;
|
||||
import common.rng.Random;
|
||||
import common.world.State;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.biome.GenBiome;
|
||||
|
||||
public class ReplacerBiome implements BlockReplacer
|
||||
public abstract class ReplacerBiome implements BlockReplacer
|
||||
{
|
||||
private final PerlinGen stoneNoiseGen;
|
||||
private final double[] stoneNoise = new double[256];
|
||||
private final double[] stoneNoise = new double[256];
|
||||
protected final int seaLevel;
|
||||
protected final State filler;
|
||||
protected final Block fillerBlock;
|
||||
protected final State liquid;
|
||||
protected final boolean freeze;
|
||||
|
||||
public ReplacerBiome(Random rand)
|
||||
public ReplacerBiome(Random rand, State filler, State liquid, int seaLevel)
|
||||
{
|
||||
this.stoneNoiseGen = new PerlinGen(rand, 4);
|
||||
this.seaLevel = seaLevel;
|
||||
this.filler = filler;
|
||||
this.fillerBlock = filler.getBlock();
|
||||
this.liquid = liquid;
|
||||
this.freeze = liquid.getBlock().getMaterial() == Material.WATER;
|
||||
}
|
||||
|
||||
public void replaceBlocks(WorldServer world, int x, int z, ChunkPrimer primer, Random rand, Biome[] biomes)
|
||||
public void replaceBlocks(WorldServer world, int x, int z, ChunkPrimer primer, Random rand)
|
||||
{
|
||||
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);
|
||||
double m = 0.03125D;
|
||||
this.stoneNoiseGen.generate(this.stoneNoise, (double)(x * 16), (double)(z * 16), 16, 16, m * 2.0D, m * 2.0D, 1.0D);
|
||||
|
||||
for (int i = 0; i < 16; ++i)
|
||||
for (int px = 0; px < 16; ++px)
|
||||
{
|
||||
for (int j = 0; j < 16; ++j)
|
||||
for (int pz = 0; pz < 16; ++pz)
|
||||
{
|
||||
GenBiome biome = GenBiome.BIOMES[biomes[j + i * 16].id];
|
||||
biome.genTerrainBlocks(world, rand, primer, x * 16 + i, z * 16 + j, this.stoneNoise[j + i * 16]);
|
||||
this.genTerrainBlocks(world, rand, primer, x * 16 + px, z * 16 + pz, this.stoneNoise[pz + px * 16]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void genTerrainBlocks(WorldServer world, Random rand, ChunkPrimer primer, int x, int z, double noise);
|
||||
}
|
||||
|
|
253
server/src/main/java/server/worldgen/ReplacerMesa.java
Normal file
253
server/src/main/java/server/worldgen/ReplacerMesa.java
Normal file
|
@ -0,0 +1,253 @@
|
|||
package server.worldgen;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import common.block.natural.BlockColoredClay;
|
||||
import common.init.Blocks;
|
||||
import common.rng.PerlinGen;
|
||||
import common.rng.Random;
|
||||
import common.world.State;
|
||||
import server.world.WorldServer;
|
||||
|
||||
public class ReplacerMesa extends ReplacerBiome
|
||||
{
|
||||
private final State[] layers;
|
||||
private final PerlinGen baseBryceGen;
|
||||
private final PerlinGen highBryceGen;
|
||||
private final PerlinGen clayColorGen;
|
||||
private final State surface;
|
||||
|
||||
private boolean bryce;
|
||||
private boolean soil;
|
||||
|
||||
public ReplacerMesa(Random rand, State filler, State liquid, int seaLevel, State surface) {
|
||||
super(rand, filler, liquid, seaLevel);
|
||||
this.layers = new State[64];
|
||||
Arrays.fill(this.layers, Blocks.hardened_clay.getState());
|
||||
this.clayColorGen = new PerlinGen(rand, 1);
|
||||
this.baseBryceGen = new PerlinGen(rand, 4);
|
||||
this.highBryceGen = new PerlinGen(rand, 1);
|
||||
this.setupLayers(rand);
|
||||
this.surface = surface;
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(WorldServer world, Random rand, ChunkPrimer primer, int x, int z, double noise)
|
||||
{
|
||||
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(noise), 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 bx = x & 15;
|
||||
int by = z & 15;
|
||||
State surface = Blocks.white_clay.getState();
|
||||
State top = Blocks.white_clay.getState();
|
||||
int rng = (int)(noise / 3.0D + 3.0D + rand.doublev() * 0.25D);
|
||||
boolean hard = Math.cos(noise / 3.0D * Math.PI) > 0.0D;
|
||||
int sel = -1;
|
||||
boolean base = false;
|
||||
|
||||
for (int i1 = primer.height - 1; i1 >= 0; --i1)
|
||||
{
|
||||
if (primer.get(by, i1, bx).getBlock() == Blocks.air && i1 < (int)d4)
|
||||
{
|
||||
primer.set(by, i1, bx, this.filler);
|
||||
}
|
||||
|
||||
State iblockstate1 = primer.get(by, i1, bx);
|
||||
|
||||
if (iblockstate1.getBlock() == Blocks.air)
|
||||
{
|
||||
sel = -1;
|
||||
}
|
||||
else if (iblockstate1.getBlock() == this.fillerBlock)
|
||||
{
|
||||
if (sel == -1)
|
||||
{
|
||||
base = false;
|
||||
|
||||
if (rng <= 0)
|
||||
{
|
||||
surface = null;
|
||||
top = this.filler;
|
||||
}
|
||||
else if (i1 >= this.seaLevel - 4 && i1 <= this.seaLevel + 1)
|
||||
{
|
||||
surface = Blocks.white_clay.getState();
|
||||
top = Blocks.white_clay.getState();
|
||||
}
|
||||
|
||||
if (i1 < this.seaLevel && (surface == null || surface.getBlock() == Blocks.air))
|
||||
{
|
||||
surface = this.liquid;
|
||||
}
|
||||
|
||||
sel = rng + Math.max(0, i1 - this.seaLevel);
|
||||
|
||||
if (i1 < this.seaLevel - 1)
|
||||
{
|
||||
primer.set(by, i1, bx, top);
|
||||
|
||||
if (top.getBlock() instanceof BlockColoredClay)
|
||||
{
|
||||
primer.set(by, i1, bx, Blocks.orange_clay.getState());
|
||||
}
|
||||
}
|
||||
else if (this.soil && i1 > 86 + rng * 2)
|
||||
{
|
||||
if (hard)
|
||||
{
|
||||
primer.set(by, i1, bx, Blocks.coarse_dirt.getState());
|
||||
}
|
||||
else
|
||||
{
|
||||
primer.set(by, i1, bx, Blocks.grass.getState());
|
||||
}
|
||||
}
|
||||
else if (i1 <= this.seaLevel + 3 + rng)
|
||||
{
|
||||
primer.set(by, i1, bx, this.surface);
|
||||
base = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
State iblockstate4;
|
||||
|
||||
if (i1 >= 64 && i1 <= 127)
|
||||
{
|
||||
if (hard)
|
||||
{
|
||||
iblockstate4 = Blocks.hardened_clay.getState();
|
||||
}
|
||||
else
|
||||
{
|
||||
iblockstate4 = this.getBlockAt(x, i1, z);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iblockstate4 = Blocks.orange_clay.getState();
|
||||
}
|
||||
|
||||
primer.set(by, i1, bx, iblockstate4);
|
||||
}
|
||||
}
|
||||
else if (sel > 0)
|
||||
{
|
||||
--sel;
|
||||
|
||||
if (base)
|
||||
{
|
||||
primer.set(by, i1, bx, Blocks.orange_clay.getState());
|
||||
}
|
||||
else
|
||||
{
|
||||
State iblockstate2 = this.getBlockAt(x, i1, z);
|
||||
primer.set(by, i1, bx, iblockstate2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setupLayers(Random random)
|
||||
{
|
||||
for (int l1 = 0; l1 < 64; ++l1)
|
||||
{
|
||||
l1 += random.roll(5);
|
||||
|
||||
if (l1 < 64)
|
||||
{
|
||||
this.layers[l1] = Blocks.orange_clay.getState();
|
||||
}
|
||||
}
|
||||
|
||||
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.yellow_clay.getState();
|
||||
}
|
||||
}
|
||||
|
||||
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.brown_clay.getState();
|
||||
}
|
||||
}
|
||||
|
||||
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.red_clay.getState();
|
||||
}
|
||||
}
|
||||
|
||||
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.white_clay.getState();
|
||||
|
||||
if (j4 + k1 > 1 && random.chance())
|
||||
{
|
||||
this.layers[j4 + k1 - 1] = Blocks.silver_clay.getState();
|
||||
}
|
||||
|
||||
if (j4 + k1 < 63 && random.chance())
|
||||
{
|
||||
this.layers[j4 + k1 + 1] = Blocks.silver_clay.getState();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
118
server/src/main/java/server/worldgen/ReplacerTerranian.java
Normal file
118
server/src/main/java/server/worldgen/ReplacerTerranian.java
Normal file
|
@ -0,0 +1,118 @@
|
|||
package server.worldgen;
|
||||
|
||||
import common.block.foliage.BlockLilyPad;
|
||||
import common.init.Blocks;
|
||||
import common.rng.PerlinGen;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
import server.world.WorldServer;
|
||||
|
||||
public class ReplacerTerranian extends ReplacerAltSimple {
|
||||
private final PerlinGen grassNoiseGen;
|
||||
private final State dry;
|
||||
|
||||
private boolean stone; // hills*
|
||||
private boolean gravel; // hills_mod*
|
||||
private boolean podzol; // mega_taiga*
|
||||
private boolean savanna; // savanna_mod*
|
||||
private boolean swamp; // swamp*
|
||||
private boolean sand; // beach*, desert*
|
||||
private boolean fullStone; // stonebeach*
|
||||
private boolean snow; // ice_spikes
|
||||
|
||||
public ReplacerTerranian(Random rand, State surface, State top, State filler, State alt, State dry, State liquid, int seaLevel) {
|
||||
super(rand, surface, top, filler, alt, liquid, seaLevel);
|
||||
this.grassNoiseGen = new PerlinGen(rand, 1);
|
||||
this.dry = dry;
|
||||
}
|
||||
|
||||
protected State adjust(State current) {
|
||||
return current.getBlock() == Blocks.sand ? Blocks.sandstone.getState() : current;
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(WorldServer world, Random rand, ChunkPrimer primer, int x, int z, double noise)
|
||||
{
|
||||
float absTemp = world.getTemperatureC(new BlockPos(x, 0, z));
|
||||
|
||||
State topBlock = this.surface;
|
||||
State fillerBlock = this.top;
|
||||
|
||||
if(this.sand) {
|
||||
topBlock = this.dry;
|
||||
fillerBlock = this.dry;
|
||||
}
|
||||
else if(this.fullStone) {
|
||||
topBlock = this.filler;
|
||||
fillerBlock = this.filler;
|
||||
}
|
||||
else if(this.snow) {
|
||||
topBlock = Blocks.snow.getState();
|
||||
}
|
||||
if (this.gravel && (noise < -1.0D || noise > 2.0D))
|
||||
{
|
||||
topBlock = this.alt;
|
||||
fillerBlock = this.alt;
|
||||
}
|
||||
else if (this.stone && noise > 1.0D)
|
||||
{
|
||||
topBlock = this.filler;
|
||||
fillerBlock = this.filler;
|
||||
}
|
||||
if (this.podzol)
|
||||
{
|
||||
if (noise > 1.75D)
|
||||
{
|
||||
topBlock = Blocks.coarse_dirt.getState();
|
||||
}
|
||||
else if (noise > -0.95D)
|
||||
{
|
||||
topBlock = Blocks.podzol.getState();
|
||||
}
|
||||
}
|
||||
if(this.savanna) {
|
||||
if (noise > 1.75D)
|
||||
{
|
||||
topBlock = this.filler;
|
||||
fillerBlock = this.filler;
|
||||
}
|
||||
else if (noise > -0.5D)
|
||||
{
|
||||
topBlock = Blocks.coarse_dirt.getState();
|
||||
}
|
||||
}
|
||||
if(this.swamp) {
|
||||
topBlock = Blocks.swamp.getState();
|
||||
int sea = world.getSeaLevel() - 1;
|
||||
double d0 = grassNoiseGen.generate((double)x * 0.25D, (double)z * 0.25D);
|
||||
if (d0 > 0.0D)
|
||||
{
|
||||
int i = x & 15;
|
||||
int j = z & 15;
|
||||
|
||||
for (int k = primer.height - 1; k >= 0; --k)
|
||||
{
|
||||
if (primer.get(j, k, i).getBlock() != Blocks.air)
|
||||
{
|
||||
if (k == sea)
|
||||
{
|
||||
if(!primer.get(j, k, i).getBlock().getMaterial().isLiquid() || k <= 0 || !primer.get(j, k - 1, i).getBlock().getMaterial().isLiquid())
|
||||
primer.set(j, k, i, Blocks.swamp_water.getState());
|
||||
|
||||
if (d0 < 0.12D)
|
||||
{
|
||||
primer.set(j, k + 1, i, Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, Facing.randHorizontal(rand)));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.genTerrainBlocks(world, rand, primer, x, z, noise, topBlock, fillerBlock);
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package server.worldgen;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
|
@ -21,7 +20,7 @@ public class ReplacerTopLayer implements BlockReplacer
|
|||
this.replace = replace;
|
||||
}
|
||||
|
||||
public void replaceBlocks(WorldServer world, int x, int z, ChunkPrimer primer, Random rand, Biome[] biomes)
|
||||
public void replaceBlocks(WorldServer world, int x, int z, ChunkPrimer primer, Random rand)
|
||||
{
|
||||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
package server.worldgen.biome;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.init.Blocks;
|
||||
import common.rng.WeightedList;
|
||||
|
||||
public class BiomeBeach extends GenBiome
|
||||
{
|
||||
public BiomeBeach(boolean cold)
|
||||
{
|
||||
super(cold ? Biome.ICE_BEACH : Biome.BEACH);
|
||||
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,36 +0,0 @@
|
|||
package server.worldgen.biome;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.foliage.BlockFlower;
|
||||
import common.entity.npc.EntityMetalhead;
|
||||
import common.init.Blocks;
|
||||
import common.init.WoodType;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import server.worldgen.tree.WorldGenBaseTree;
|
||||
import server.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeBlackened extends GenBiome {
|
||||
protected final WorldGenTree treeGen = new WorldGenBaseTree(false, Blocks.blackwood_log.getState(), WoodType.BLACKWOOD);
|
||||
|
||||
public BiomeBlackened() {
|
||||
super(Biome.BLACKENED);
|
||||
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,45 +0,0 @@
|
|||
package server.worldgen.biome;
|
||||
|
||||
import common.biome.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 server.world.WorldServer;
|
||||
import server.worldgen.FeatureGenerator;
|
||||
import server.worldgen.foliage.WorldGenMushroom;
|
||||
|
||||
public class BiomeChaos extends GenBiome
|
||||
{
|
||||
protected FeatureGenerator mushroomBlueGen = new WorldGenMushroom(Blocks.blue_mushroom);
|
||||
|
||||
public BiomeChaos()
|
||||
{
|
||||
super(Biome.CHAOS);
|
||||
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(WorldServer 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,22 +0,0 @@
|
|||
package server.worldgen.biome;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import server.world.WorldServer;
|
||||
|
||||
public class BiomeExterminated extends GenBiome {
|
||||
public BiomeExterminated() {
|
||||
super(Biome.EXTERMINATED);
|
||||
this.topBlock = Blocks.air.getState();
|
||||
this.fillerBlock = Blocks.air.getState();
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
}
|
||||
|
||||
public void decorate(WorldServer worldIn, Random rand, BlockPos pos) {
|
||||
}
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
package server.worldgen.biome;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.entity.npc.EntityBloodElf;
|
||||
import common.entity.npc.EntityCultivator;
|
||||
import common.entity.npc.EntityFireDemon;
|
||||
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 server.world.WorldServer;
|
||||
import server.worldgen.FeatureOres;
|
||||
import server.worldgen.feature.WorldGenFire;
|
||||
import server.worldgen.feature.WorldGenGlowStone;
|
||||
import server.worldgen.feature.WorldGenHellLava;
|
||||
import server.worldgen.foliage.WorldGenMushroom;
|
||||
|
||||
public class BiomeHell extends GenBiome
|
||||
{
|
||||
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(Biome base, int subtype)
|
||||
{
|
||||
super(base);
|
||||
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));
|
||||
}
|
||||
|
||||
public void decorate(WorldServer 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();
|
||||
// }
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
package server.worldgen.biome;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.ChunkPrimer;
|
||||
import server.worldgen.FeatureOres;
|
||||
import server.worldgen.tree.WorldGenTaiga2;
|
||||
import server.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeHills extends GenBiome
|
||||
{
|
||||
// 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(Biome base, boolean large)
|
||||
{
|
||||
super(base);
|
||||
this.field_150638_aH = this.field_150635_aE;
|
||||
|
||||
if (large)
|
||||
{
|
||||
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(WorldServer 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(WorldServer 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(GenBiome p_150633_1_)
|
||||
{
|
||||
this.field_150638_aH = this.field_150637_aG;
|
||||
this.setScaling(p_150633_1_.depth, p_150633_1_.scale);
|
||||
return this;
|
||||
}
|
||||
|
||||
protected GenBiome createMutatedBiome(Biome base)
|
||||
{
|
||||
return (new BiomeHills(base, false)).mutateHills(this);
|
||||
}
|
||||
}
|
|
@ -1,328 +0,0 @@
|
|||
package server.worldgen.biome;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.Block;
|
||||
import common.block.natural.BlockColoredClay;
|
||||
import common.init.Blocks;
|
||||
import common.rng.PerlinGen;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.ChunkPrimer;
|
||||
import server.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeMesa extends GenBiome
|
||||
{
|
||||
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(Biome base, boolean bryce, boolean soil)
|
||||
{
|
||||
super(base);
|
||||
this.bryce = bryce;
|
||||
this.soil = soil;
|
||||
// this.setDisableRain();
|
||||
// this.setTemperatureLegacy(2.0F).setHumidity(0.0F);
|
||||
// this.mobs.clear();
|
||||
this.topBlock = Blocks.red_sand.getState();
|
||||
this.fillerBlock = Blocks.white_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 void decorate(WorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
super.decorate(worldIn, rand, pos);
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(WorldServer 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.white_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() == Blocks.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() == Blocks.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.white_clay.getState();
|
||||
iblockstate3 = this.fillerBlock;
|
||||
}
|
||||
|
||||
if (i1 < l1 && (iblockstate == null || iblockstate.getBlock() == Blocks.air))
|
||||
{
|
||||
iblockstate = liquid;
|
||||
}
|
||||
|
||||
l = k + Math.max(0, i1 - l1);
|
||||
|
||||
if (i1 < l1 - 1)
|
||||
{
|
||||
chunkPrimerIn.set(k1, i1, j1, iblockstate3);
|
||||
|
||||
if (iblockstate3.getBlock() instanceof BlockColoredClay)
|
||||
{
|
||||
chunkPrimerIn.set(k1, i1, j1, Blocks.orange_clay.getState());
|
||||
}
|
||||
}
|
||||
else if (this.soil && i1 > 86 + k * 2)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
chunkPrimerIn.set(k1, i1, j1, Blocks.coarse_dirt.getState());
|
||||
}
|
||||
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.orange_clay.getState();
|
||||
}
|
||||
|
||||
chunkPrimerIn.set(k1, i1, j1, iblockstate4);
|
||||
}
|
||||
}
|
||||
else if (l > 0)
|
||||
{
|
||||
--l;
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
chunkPrimerIn.set(k1, i1, j1, Blocks.orange_clay.getState());
|
||||
}
|
||||
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.orange_clay.getState();
|
||||
}
|
||||
}
|
||||
|
||||
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.yellow_clay.getState();
|
||||
}
|
||||
}
|
||||
|
||||
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.brown_clay.getState();
|
||||
}
|
||||
}
|
||||
|
||||
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.red_clay.getState();
|
||||
}
|
||||
}
|
||||
|
||||
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.white_clay.getState();
|
||||
|
||||
if (j4 + k1 > 1 && random.chance())
|
||||
{
|
||||
this.layers[j4 + k1 - 1] = Blocks.silver_clay.getState();
|
||||
}
|
||||
|
||||
if (j4 + k1 < 63 && random.chance())
|
||||
{
|
||||
this.layers[j4 + k1 + 1] = Blocks.silver_clay.getState();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 GenBiome createMutatedBiome(Biome base)
|
||||
{
|
||||
boolean bryce = this.base == Biome.MESA;
|
||||
BiomeMesa mesa = new BiomeMesa(base, bryce, this.soil);
|
||||
|
||||
if (!bryce)
|
||||
{
|
||||
mesa.setScaling(Scaling.HILLS_LOW);
|
||||
}
|
||||
|
||||
return mesa;
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package server.worldgen.biome;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.entity.npc.EntityDwarf;
|
||||
import common.init.Blocks;
|
||||
import common.rng.WeightedList;
|
||||
|
||||
public class BiomeMushroom extends GenBiome {
|
||||
public BiomeMushroom() {
|
||||
super(Biome.MUSHROOM);
|
||||
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(EntityDwarf.class, 8, 4, 8));
|
||||
}
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
package server.worldgen.biome;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.ChunkPrimer;
|
||||
import server.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeMutated extends GenBiome
|
||||
{
|
||||
protected GenBiome baseBiome;
|
||||
|
||||
public BiomeMutated(Biome base, GenBiome biome)
|
||||
{
|
||||
super(base);
|
||||
this.baseBiome = biome;
|
||||
this.topBlock = biome.topBlock;
|
||||
this.fillerBlock = biome.fillerBlock;
|
||||
// this.minHeight = biome.minHeight;
|
||||
// this.maxHeight = biome.maxHeight;
|
||||
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(WorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
this.baseBiome.decorate(worldIn, rand, pos); // TODO: check
|
||||
}
|
||||
|
||||
public void decorateNormal(WorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
super.decorate(worldIn, rand, pos);
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(WorldServer 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 Class <? extends GenBiome > getBiomeClass()
|
||||
{
|
||||
return this.baseBiome.getBiomeClass();
|
||||
}
|
||||
|
||||
/**
|
||||
* returns true if the biome specified is equal to this biome
|
||||
*/
|
||||
public boolean isEqualTo(GenBiome biome)
|
||||
{
|
||||
return this.baseBiome.isEqualTo(biome);
|
||||
}
|
||||
|
||||
public Temperature getTempCategory()
|
||||
{
|
||||
return this.baseBiome.getTempCategory();
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package server.worldgen.biome;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.ChunkPrimer;
|
||||
|
||||
public class BiomeNone extends GenBiome {
|
||||
public BiomeNone() {
|
||||
super(Biome.NONE);
|
||||
this.topBlock = Blocks.air.getState();
|
||||
this.fillerBlock = Blocks.air.getState();
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(WorldServer worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {
|
||||
}
|
||||
|
||||
public void decorate(WorldServer worldIn, Random rand, BlockPos pos) {
|
||||
}
|
||||
|
||||
public Temperature getTempCategory() {
|
||||
return Temperature.SEA;
|
||||
}
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
package server.worldgen.biome;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.entity.animal.EntityHorse;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.ChunkPrimer;
|
||||
import server.worldgen.tree.WorldGenSavanna;
|
||||
import server.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeSavanna extends GenBiome
|
||||
{
|
||||
private static final WorldGenSavanna field_150627_aC = new WorldGenSavanna(false);
|
||||
|
||||
protected BiomeSavanna(boolean plateau)
|
||||
{
|
||||
super(plateau ? Biome.SAVANNA_PLATEAU : Biome.SAVANNA);
|
||||
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 GenBiome createMutatedBiome(Biome base)
|
||||
{
|
||||
GenBiome biomegenbase = new BiomeSavanna.Mutated(base, this);
|
||||
biomegenbase.depth = this.depth * 0.5F + 0.3F;
|
||||
biomegenbase.scale = this.scale * 0.5F + 1.2F;
|
||||
return biomegenbase;
|
||||
}
|
||||
|
||||
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
DOUBLE_PLANT_GEN.setPlantType(Blocks.large_tallgrass);
|
||||
|
||||
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(Biome base, GenBiome p_i45382_2_)
|
||||
{
|
||||
super(base, p_i45382_2_);
|
||||
this.treesPerChunk = 2;
|
||||
this.flowersPerChunk = 2;
|
||||
this.grassPerChunk = 5;
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(WorldServer 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.coarse_dirt.getState();
|
||||
}
|
||||
|
||||
this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, x, z, noiseVal);
|
||||
}
|
||||
|
||||
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
this.decorateNormal(worldIn, rand, pos);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package server.worldgen.biome;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.entity.animal.EntitySheep;
|
||||
import common.entity.npc.EntitySpirit;
|
||||
import common.init.Blocks;
|
||||
import common.rng.WeightedList;
|
||||
|
||||
public class BiomeSnowLand extends GenBiome
|
||||
{
|
||||
public BiomeSnowLand()
|
||||
{
|
||||
super(Biome.SNOW);
|
||||
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,23 +0,0 @@
|
|||
package server.worldgen.biome;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.init.Blocks;
|
||||
import common.rng.WeightedList;
|
||||
|
||||
public class BiomeStoneBeach extends GenBiome
|
||||
{
|
||||
public BiomeStoneBeach()
|
||||
{
|
||||
super(Biome.STONE_BEACH);
|
||||
// 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,87 +0,0 @@
|
|||
package server.worldgen.biome;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.foliage.BlockFlower;
|
||||
import common.block.foliage.BlockLilyPad;
|
||||
import common.entity.npc.EntitySlime;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.ChunkPrimer;
|
||||
import server.worldgen.FeatureGenerator;
|
||||
import server.worldgen.foliage.WorldGenTallGrass;
|
||||
import server.worldgen.tree.WorldGenSwamp;
|
||||
import server.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeSwamp extends GenBiome
|
||||
{
|
||||
protected final WorldGenSwamp worldGeneratorSwamp = new WorldGenSwamp();
|
||||
|
||||
protected BiomeSwamp()
|
||||
{
|
||||
super(Biome.SWAMP);
|
||||
this.topBlock = Blocks.swamp.getState();
|
||||
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.mobs.add(new RngSpawn(EntitySlime.class, 1, 1, 1));
|
||||
this.disableBeach();
|
||||
}
|
||||
|
||||
public WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return this.worldGeneratorSwamp;
|
||||
}
|
||||
|
||||
public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
|
||||
{
|
||||
return BlockFlower.EnumFlowerType.BLUE_ORCHID;
|
||||
}
|
||||
|
||||
public FeatureGenerator getRandomWorldGenForGrass(Random rand)
|
||||
{
|
||||
return new WorldGenTallGrass(Blocks.swamp_grass);
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(WorldServer worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
|
||||
{
|
||||
int sea = worldIn.getSeaLevel() - 1;
|
||||
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() != Blocks.air)
|
||||
{
|
||||
if (k == sea)
|
||||
{
|
||||
if(!chunkPrimerIn.get(j, k, i).getBlock().getMaterial().isLiquid() || k <= 0 || !chunkPrimerIn.get(j, k - 1, i).getBlock().getMaterial().isLiquid())
|
||||
chunkPrimerIn.set(j, k, i, Blocks.swamp_water.getState());
|
||||
|
||||
if (d0 < 0.12D)
|
||||
{
|
||||
chunkPrimerIn.set(j, k + 1, i, Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, Facing.randHorizontal(rand)));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, x, z, noiseVal);
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package server.worldgen.biome;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.entity.npc.EntityMerfolk;
|
||||
import common.rng.WeightedList;
|
||||
|
||||
public class BiomeWater extends GenBiome {
|
||||
private final boolean river;
|
||||
|
||||
public BiomeWater(Biome base, boolean river) {
|
||||
super(base);
|
||||
this.river = river;
|
||||
this.disableBeach();
|
||||
if(!this.river)
|
||||
this.mobs.add(new RngSpawn(EntityMerfolk.class, 10, 4, 4));
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
}
|
||||
|
||||
public Temperature getTempCategory() {
|
||||
return this.river ? super.getTempCategory() : Temperature.SEA;
|
||||
}
|
||||
}
|
|
@ -1,873 +1,7 @@
|
|||
package server.worldgen.biome;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.biome.IBiome;
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.block.foliage.BlockFlower;
|
||||
import common.block.foliage.BlockSapling;
|
||||
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.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.init.WoodType;
|
||||
import common.log.Log;
|
||||
import common.rng.PerlinGen;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.ChunkPrimer;
|
||||
import server.worldgen.FeatureGenerator;
|
||||
import server.worldgen.feature.WorldGenClay;
|
||||
import server.worldgen.feature.WorldGenClayExt;
|
||||
import server.worldgen.feature.WorldGenSand;
|
||||
import server.worldgen.foliage.FeatureDoublePlant;
|
||||
import server.worldgen.foliage.WorldGenBigMushroom;
|
||||
import server.worldgen.foliage.WorldGenCactus;
|
||||
import server.worldgen.foliage.WorldGenDeadBush;
|
||||
import server.worldgen.foliage.WorldGenFlowers;
|
||||
import server.worldgen.foliage.WorldGenMushroom;
|
||||
import server.worldgen.foliage.WorldGenPumpkin;
|
||||
import server.worldgen.foliage.WorldGenReed;
|
||||
import server.worldgen.foliage.WorldGenTallGrass;
|
||||
import server.worldgen.foliage.WorldGenWaterlily;
|
||||
import server.worldgen.tree.WorldGenBaseTree;
|
||||
import server.worldgen.tree.WorldGenBigTree;
|
||||
import server.worldgen.tree.WorldGenBirch;
|
||||
import server.worldgen.tree.WorldGenDarkOak;
|
||||
import server.worldgen.tree.WorldGenJungle;
|
||||
import server.worldgen.tree.WorldGenPine;
|
||||
import server.worldgen.tree.WorldGenSavanna;
|
||||
import server.worldgen.tree.WorldGenSwamp;
|
||||
import server.worldgen.tree.WorldGenTaiga2;
|
||||
import server.worldgen.tree.WorldGenTree;
|
||||
|
||||
public abstract class GenBiome implements IBiome {
|
||||
public static final GenBiome[] BIOMES = new GenBiome[256];
|
||||
|
||||
public static final GenBiome none = (new BiomeNone());
|
||||
|
||||
public static final GenBiome plains = (new BiomePlains());
|
||||
public static final GenBiome desert = (new BiomeDesert(false)).setScaling(Scaling.PLAINS_LOW);
|
||||
public static final GenBiome extremeHills = (new BiomeHills(Biome.HILLS, false)).setScaling(Scaling.HILLS_LARGE);
|
||||
public static final GenBiome forest = (new BiomeForest(Biome.FOREST, 0));
|
||||
public static final GenBiome taiga = (new BiomeTaiga(Biome.TAIGA, 0)).setScaling(Scaling.PLAINS_MEDIUM);
|
||||
public static final GenBiome swampland = (new BiomeSwamp()).setScaling(Scaling.SEA_POND);
|
||||
public static final GenBiome river = (new BiomeWater(Biome.RIVER, true)).setScaling(Scaling.SEA_SHALLOW);
|
||||
|
||||
public static final GenBiome exterminated = (new BiomeExterminated());
|
||||
public static final GenBiome space = (new BiomeSpace());
|
||||
|
||||
public static final GenBiome frozenSea = (new BiomeWater(Biome.ICE_SEA, false)).enableColdBeach().setScaling(Scaling.SEA_MEDIUM);
|
||||
public static final GenBiome frozenRiver = (new BiomeWater(Biome.ICE_RIVER, true)).enableColdBeach().setScaling(Scaling.SEA_SHALLOW);
|
||||
public static final GenBiome icePlains = (new BiomeSnow(Biome.ICE, false)).enableColdBeach().setScaling(Scaling.PLAINS_LOW);
|
||||
public static final GenBiome iceMountains = (new BiomeSnow(Biome.ICE_HILLS, false)).enableColdBeach().setScaling(Scaling.HILLS_LOW);
|
||||
public static final GenBiome mushroomPlains = (new BiomeMushroom()).setScaling(Scaling.PLAINS_VARYING);
|
||||
public static final GenBiome blackened = (new BiomeBlackened());
|
||||
public static final GenBiome beach = (new BiomeBeach(false)).setScaling(Scaling.SEA_SHORE);
|
||||
public static final GenBiome desertHills = (new BiomeDesert(true)).setScaling(Scaling.HILLS_LOW);
|
||||
public static final GenBiome forestHills = (new BiomeForest(Biome.FOREST_HILLS, 0)).setScaling(Scaling.HILLS_LOW);
|
||||
public static final GenBiome taigaHills = (new BiomeTaiga(Biome.TAIGA_HILLS, 0)).setScaling(Scaling.HILLS_LOW);
|
||||
public static final GenBiome extremeHillsEdge = (new BiomeHills(Biome.HILLS_EDGE, true)).setScaling(Scaling.HILLS_MEDIUM);
|
||||
public static final GenBiome jungle = (new BiomeJungle(Biome.TROPIC, false));
|
||||
public static final GenBiome jungleHills = (new BiomeJungle(Biome.TROPIC_HILLS, false)).setScaling(Scaling.HILLS_LOW);
|
||||
public static final GenBiome jungleEdge = (new BiomeJungle(Biome.TROPIC_EDGE, true));
|
||||
public static final GenBiome sea = (new BiomeWater(Biome.SEA, false)).setScaling(Scaling.SEA_MEDIUM);
|
||||
public static final GenBiome stoneBeach = (new BiomeStoneBeach()).setScaling(Scaling.SEA_VARYING);
|
||||
public static final GenBiome coldBeach = (new BiomeBeach(true)).setScaling(Scaling.SEA_SHORE).enableColdBeach();
|
||||
public static final GenBiome birchForest = (new BiomeForest(Biome.BIRCH_FOREST, 2));
|
||||
public static final GenBiome birchForestHills = (new BiomeForest(Biome.BIRCH_HILLS, 2)).setScaling(Scaling.HILLS_LOW);
|
||||
public static final GenBiome roofedForest = (new BiomeForest(Biome.DARK_FOREST, 3));
|
||||
public static final GenBiome coldTaiga = (new BiomeTaiga(Biome.ICE_TAIGA, 0)).enableColdBeach().setScaling(Scaling.PLAINS_MEDIUM);
|
||||
public static final GenBiome coldTaigaHills = (new BiomeTaiga(Biome.ICE_TAIGA_HILLS, 0)).enableColdBeach().setScaling(Scaling.HILLS_LOW);
|
||||
public static final GenBiome megaTaiga = (new BiomeTaiga(Biome.LARGE_TAIGA, 1)).setScaling(Scaling.PLAINS_MEDIUM);
|
||||
public static final GenBiome megaTaigaHills = (new BiomeTaiga(Biome.LARGE_TAIGA_HILLS, 1)).setScaling(Scaling.HILLS_LOW);
|
||||
public static final GenBiome extremeHillsPlus = (new BiomeHills(Biome.LARGE_HILLS, true)).setScaling(Scaling.HILLS_LARGE);
|
||||
public static final GenBiome savanna = (new BiomeSavanna(false)).setScaling(Scaling.PLAINS_LOW);
|
||||
public static final GenBiome savannaPlateau = (new BiomeSavanna(true)).setScaling(Scaling.HILLS_PLATEAU);
|
||||
|
||||
public static final GenBiome mesa = (new BiomeMesa(Biome.MESA, false, false));
|
||||
public static final GenBiome mesaPlateau_F = (new BiomeMesa(Biome.MESA_FOREST, false, true)).setScaling(Scaling.HILLS_PLATEAU);
|
||||
public static final GenBiome mesaPlateau = (new BiomeMesa(Biome.MESA_PLATEAU, false, false)).setScaling(Scaling.HILLS_PLATEAU);
|
||||
|
||||
public static final GenBiome snowLand = (new BiomeSnowLand()).enableColdBeach();
|
||||
public static final GenBiome tian = (new BiomeTian()).setScaling(Scaling.VARYING_MEDIUM);
|
||||
public static final GenBiome elvenForest = (new BiomeForest(Biome.ELVEN_FOREST, 4));
|
||||
public static final GenBiome upperHell = (new BiomeHell(Biome.UPPER_HELL, 0));
|
||||
public static final GenBiome lowerHell = (new BiomeHell(Biome.LOWER_HELL, 1));
|
||||
public static final GenBiome hellHills = (new BiomeHell(Biome.HELL_HILLS, 1)).setScaling(Scaling.HILLS_LARGE);
|
||||
public static final GenBiome soulPlains = (new BiomeHell(Biome.SOUL_PLAINS, 1)).setScaling(Scaling.SEA_POND);
|
||||
public static final GenBiome ashLand = (new BiomeHell(Biome.ASH, 2)).setScaling(Scaling.PLAINS_LOW);
|
||||
public static final GenBiome moon = (new BiomeMoon()).setScaling(Scaling.PLAINS_LOW);
|
||||
public static final GenBiome chaos = (new BiomeChaos()).setScaling(Scaling.VARYING_CHAOTIC);
|
||||
|
||||
protected static final PerlinGen TREE_NOISE = new PerlinGen(new Random(726528729282625L), 8);
|
||||
protected static final PerlinGen GRASS_NOISE = new PerlinGen(new Random(297363826225L), 1);
|
||||
protected static final FeatureDoublePlant DOUBLE_PLANT_GEN = new FeatureDoublePlant();
|
||||
|
||||
public final Biome base;
|
||||
|
||||
protected final WeightedList<RngSpawn> mobs = new WeightedList<RngSpawn>();
|
||||
protected final WorldGenBaseTree worldGeneratorTrees = new WorldGenBaseTree(false);
|
||||
protected final WorldGenBigTree worldGeneratorBigTree = new WorldGenBigTree(false);
|
||||
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.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 Biome mutated = null;
|
||||
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;
|
||||
|
||||
public static GenBiome getBiome(int id)
|
||||
{
|
||||
if (id >= 0 && id < BIOMES.length)
|
||||
{
|
||||
return BIOMES[id];
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.TICK.warn("Biom-ID ist nicht im Bereich: " + id + ", verwende " + Biome.DEF_BIOME.id + " (" + Biome.DEF_BIOME.name + ")");
|
||||
return BIOMES[Biome.DEF_BIOME.id];
|
||||
}
|
||||
}
|
||||
|
||||
public static void setAsProvider() {
|
||||
IBiome.setProvider(new IBiome.BiomeProvider() {
|
||||
public final IBiome getBiome(Biome base) {
|
||||
return BIOMES[base.id];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static {
|
||||
desert.mutate(Biome.DESERT_MOD);
|
||||
forest.mutate(Biome.FLOWER_FOREST);
|
||||
taiga.mutate(Biome.TAIGA_MOD);
|
||||
swampland.mutate(Biome.SWAMP_MOD);
|
||||
icePlains.mutate(Biome.ICE_SPIKES);
|
||||
jungle.mutate(Biome.TROPIC_MOD);
|
||||
jungleEdge.mutate(Biome.TROPIC_EDGE_MOD);
|
||||
coldTaiga.mutate(Biome.ICE_TAIGA_MOD);
|
||||
savanna.mutate(Biome.SAVANNA_MOD);
|
||||
savannaPlateau.mutate(Biome.SAVANNA_PLATEAU_MOD);
|
||||
mesa.mutate(Biome.MESA_PEAK);
|
||||
mesaPlateau_F.mutate(Biome.MESA_FOREST_MOD);
|
||||
mesaPlateau.mutate(Biome.MESA_PLATEAU_MOD);
|
||||
birchForest.mutate(Biome.BIRCH_FOREST_MOD);
|
||||
birchForestHills.mutate(Biome.BIRCH_HILLS_MOD);
|
||||
roofedForest.mutate(Biome.DARK_FOREST_MOD);
|
||||
megaTaiga.mutate(Biome.SPRUCE_TAIGA);
|
||||
extremeHills.mutate(Biome.HILLS_MOD);
|
||||
extremeHillsPlus.mutate(Biome.LARGE_HILLS_MOD);
|
||||
megaTaiga.mutate(Biome.REDWOOD_TAIGA);
|
||||
}
|
||||
|
||||
protected GenBiome(Biome base) {
|
||||
BIOMES[base.id] = this;
|
||||
this.base = base;
|
||||
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(EntityBat.class, 10, 8, 8));
|
||||
mobs.add(new RngSpawn(EntityMouse.class, 10, 8, 8));
|
||||
}
|
||||
|
||||
protected final GenBiome setScaling(Scaling scaling)
|
||||
{
|
||||
return this.setScaling(scaling.depth, scaling.scale);
|
||||
}
|
||||
|
||||
protected final GenBiome 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, boolean humid)
|
||||
{
|
||||
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)) || (humid && rand.chance(3)) ? this.worldGeneratorBigTree :
|
||||
this.worldGeneratorTrees;
|
||||
}
|
||||
|
||||
public FeatureGenerator getRandomWorldGenForGrass(Random rand)
|
||||
{
|
||||
return new WorldGenTallGrass(Blocks.tallgrass);
|
||||
}
|
||||
|
||||
public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
|
||||
{
|
||||
return rand.rarity(3) ? BlockFlower.EnumFlowerType.DANDELION : BlockFlower.EnumFlowerType.ROSE;
|
||||
}
|
||||
|
||||
public State getFiller() {
|
||||
return this.fillerBlock;
|
||||
}
|
||||
|
||||
public State getTop() {
|
||||
return this.topBlock;
|
||||
}
|
||||
|
||||
protected GenBiome enableColdBeach()
|
||||
{
|
||||
this.allowColdBeach = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected GenBiome disableBeach()
|
||||
{
|
||||
this.disallowBeach = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WeightedList<RngSpawn> getMobs()
|
||||
{
|
||||
return this.mobs;
|
||||
}
|
||||
|
||||
public float getMobGenChance()
|
||||
{
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
public void decorate(WorldServer 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.getHighestFreePos(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.getHighestFreePos(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.getHighestFreePos(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.getHighestFreePos(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);
|
||||
|
||||
this.yellowFlowerGen.setGeneratedBlock(BlockFlower.getByType(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 void genTerrainBlocks(WorldServer 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(WorldServer 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() == Blocks.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() == Blocks.air))
|
||||
{
|
||||
if (freeze && World.ABSOLUTE_ZERO + worldIn.getTempOffset() + this.base.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 = Blocks.sandstone.getState(); //TODO: check!
|
||||
}
|
||||
else if (j == 0 && iblockstate1.getBlock() == Blocks.red_sand)
|
||||
{
|
||||
j = rand.zrange(4) + Math.max(0, j1 - 63);
|
||||
iblockstate1 = Blocks.orange_clay.getState(); //TODO: check!
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean generateBigMushroom(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
||||
{
|
||||
worldIn.setBlockToAir(pos);
|
||||
FeatureGenerator worldgenerator = null;
|
||||
|
||||
if (state.getBlock() == Blocks.brown_mushroom)
|
||||
{
|
||||
worldgenerator = new WorldGenBigMushroom(Blocks.brown_mushroom_block);
|
||||
}
|
||||
else if (state.getBlock() == Blocks.red_mushroom)
|
||||
{
|
||||
worldgenerator = new WorldGenBigMushroom(Blocks.red_mushroom_block);
|
||||
}
|
||||
|
||||
if (worldgenerator != null && worldgenerator.generate((WorldServer)worldIn, rand, pos))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setState(pos, state, 3);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isTypeAt(World worldIn, BlockPos pos, WoodType type)
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos);
|
||||
return iblockstate.getBlock() instanceof BlockSapling && ((BlockSapling)iblockstate.getBlock()).getWoodType() == type;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public void generateTree(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
||||
{
|
||||
WoodType type = state.getBlock() instanceof BlockSapling ? ((BlockSapling)state.getBlock()).getWoodType() : 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());
|
||||
WoodType leaves = type == WoodType.CHERRY || type == WoodType.MAPLE ? type : WoodType.OAK;
|
||||
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(), WoodType.TIAN)
|
||||
.setHeightLimit(6, 20);
|
||||
break;
|
||||
|
||||
case JUNGLE:
|
||||
State iblockstate = Blocks.jungle_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE);
|
||||
WoodType iblockstate1 = WoodType.JUNGLE; // .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((WorldServer)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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void growGrass(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
||||
{
|
||||
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() == Blocks.air)
|
||||
{
|
||||
if (rand.chance(8))
|
||||
{
|
||||
BlockFlower.EnumFlowerType blockflower$enumflowertype = BIOMES[worldIn.getBiomeGenForCoords(blockpos1).id].pickRandomFlower(rand, blockpos1);
|
||||
BlockFlower blockflower = BlockFlower.getByType(blockflower$enumflowertype);
|
||||
State iblockstate = blockflower.getState();
|
||||
|
||||
if (blockflower.canBlockStay(worldIn, blockpos1, iblockstate))
|
||||
{
|
||||
worldIn.setState(blockpos1, iblockstate, 3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
State iblockstate1 = Blocks.tallgrass.getState();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected GenBiome createMutatedBiome(Biome base)
|
||||
{
|
||||
return new BiomeMutated(base, this);
|
||||
}
|
||||
|
||||
private void mutate(Biome base)
|
||||
{
|
||||
this.createMutatedBiome(this.mutated = base);
|
||||
}
|
||||
|
||||
public Class <? extends GenBiome > getBiomeClass()
|
||||
{
|
||||
return this.getClass();
|
||||
}
|
||||
|
||||
public boolean isEqualTo(GenBiome biome)
|
||||
{
|
||||
return biome == this ? true : (biome == null ? false : this.getBiomeClass() == biome.getBiomeClass());
|
||||
}
|
||||
|
||||
public Temperature getTempCategory()
|
||||
{
|
||||
return this.base.temperature < -12.0f ? Temperature.COLD : (this.base.temperature < 20.0f ? Temperature.MEDIUM : Temperature.WARM);
|
||||
}
|
||||
public class GenBiome extends Biome {
|
||||
}
|
||||
|
|
|
@ -9,21 +9,22 @@ import common.util.ExtMath;
|
|||
import common.world.State;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.ChunkPrimer;
|
||||
import server.worldgen.biome.GenBiome;
|
||||
|
||||
public class MapGenCaves extends MapGenBase
|
||||
{
|
||||
private final State filler;
|
||||
private final Block replace;
|
||||
private final Block top;
|
||||
private final Block surface;
|
||||
private final State surface;
|
||||
private final Block surfaceBlock;
|
||||
private final Block alt;
|
||||
|
||||
public MapGenCaves(State filler, Block replace, Block top, Block surface, Block alt) {
|
||||
public MapGenCaves(State filler, Block replace, Block top, State surface, Block alt) {
|
||||
this.filler = filler;
|
||||
this.replace = replace;
|
||||
this.top = top;
|
||||
this.surface = surface;
|
||||
this.surfaceBlock = surface.getBlock();
|
||||
this.alt = alt;
|
||||
}
|
||||
|
||||
|
@ -187,18 +188,17 @@ public class MapGenCaves extends MapGenBase
|
|||
|
||||
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();
|
||||
State current = p_180702_5_.get(j3, j2, i2);
|
||||
State above = j2 + 1 < p_180702_5_.height ? p_180702_5_.get(j3, j2 + 1, i2) : null;
|
||||
if(above == null)
|
||||
above = Blocks.air.getState();
|
||||
|
||||
if (iblockstate1.getBlock() == this.surface || iblockstate1.getBlock() == Blocks.mycelium)
|
||||
if (current.getBlock() == this.surfaceBlock)
|
||||
{
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
if (this.func_175793_a(iblockstate1, iblockstate2))
|
||||
if (this.canReplace(current, above))
|
||||
{
|
||||
if (j2 - 1 < 10)
|
||||
{
|
||||
|
@ -208,11 +208,11 @@ public class MapGenCaves extends MapGenBase
|
|||
{
|
||||
p_180702_5_.set(j3, j2, i2, Blocks.air.getState());
|
||||
|
||||
if (iblockstate2.getBlock() == Blocks.sand)
|
||||
if (above.getBlock() == Blocks.sand)
|
||||
{
|
||||
p_180702_5_.set(j3, j2 + 1, i2, Blocks.sandstone.getState()); //TODO: check!
|
||||
}
|
||||
else if (iblockstate2.getBlock() == Blocks.red_sand)
|
||||
else if (above.getBlock() == Blocks.red_sand)
|
||||
{
|
||||
p_180702_5_.set(j3, j2 + 1, i2, Blocks.orange_clay.getState()); //TODO: check!
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ public class MapGenCaves extends MapGenBase
|
|||
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, GenBiome.BIOMES[this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).id].topBlock.getBlock().getState());
|
||||
p_180702_5_.set(j3, j2 - 1, i2, this.surface);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -240,10 +240,17 @@ public class MapGenCaves extends MapGenBase
|
|||
}
|
||||
}
|
||||
|
||||
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() instanceof BlockColoredClay ? 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()))))))); // );
|
||||
}
|
||||
protected boolean canReplace(State state, State above) {
|
||||
return state.getBlock() == this.replace ? true
|
||||
: (state.getBlock() == this.top ? true
|
||||
: (state.getBlock() == this.surfaceBlock ? true
|
||||
: (state.getBlock() == Blocks.hardened_clay ? true
|
||||
: (state.getBlock() instanceof BlockColoredClay ? true
|
||||
: (state.getBlock() == Blocks.sandstone ? true
|
||||
: /* (p_175793_1_.getBlock() == Blocks.red_sandstone ? true : */ (state.getBlock() == Blocks.mycelium ? true
|
||||
: (state.getBlock() == Blocks.snow_layer ? true
|
||||
: (state.getBlock() == Blocks.sand || state.getBlock() == this.alt) && !above.getBlock().getMaterial().isColdLiquid()))))))); // );
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively called by generate()
|
||||
|
|
|
@ -8,22 +8,23 @@ import common.util.ExtMath;
|
|||
import common.world.State;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.ChunkPrimer;
|
||||
import server.worldgen.biome.GenBiome;
|
||||
|
||||
public class MapGenRavine extends MapGenBase
|
||||
{
|
||||
private final State filler;
|
||||
private final Block replace;
|
||||
private final Block top;
|
||||
private final Block surface;
|
||||
private final State surface;
|
||||
private final Block surfaceBlock;
|
||||
|
||||
private float[] field_75046_d = new float[1024];
|
||||
|
||||
public MapGenRavine(State filler, Block replace, Block top, Block surface) {
|
||||
public MapGenRavine(State filler, Block replace, Block top, State surface) {
|
||||
this.filler = filler;
|
||||
this.replace = replace;
|
||||
this.top = top;
|
||||
this.surface = surface;
|
||||
this.surfaceBlock = surface.getBlock();
|
||||
}
|
||||
|
||||
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_)
|
||||
|
@ -179,12 +180,12 @@ public class MapGenRavine extends MapGenBase
|
|||
{
|
||||
State iblockstate1 = p_180707_5_.get(j3, j2, i2);
|
||||
|
||||
if (iblockstate1.getBlock() == this.surface)
|
||||
if (iblockstate1.getBlock() == this.surfaceBlock)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (iblockstate1.getBlock() == this.replace || iblockstate1.getBlock() == this.top || iblockstate1.getBlock() == this.surface)
|
||||
if (iblockstate1.getBlock() == this.replace || iblockstate1.getBlock() == this.top || iblockstate1.getBlock() == this.surfaceBlock)
|
||||
{
|
||||
if (j2 - 1 < 10)
|
||||
{
|
||||
|
@ -197,7 +198,7 @@ public class MapGenRavine extends MapGenBase
|
|||
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, GenBiome.BIOMES[this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).id].topBlock);
|
||||
p_180707_5_.set(j3, j2 - 1, i2, this.surface);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,25 @@
|
|||
package server.worldgen.layer;
|
||||
|
||||
import common.biome.Biome;
|
||||
import server.worldgen.biome.GenBiome;
|
||||
import server.worldgen.BiomeGenerator;
|
||||
|
||||
public abstract class GenLayer {
|
||||
protected BiomeGenerator generator;
|
||||
|
||||
private long worldGenSeed;
|
||||
private long chunkSeed;
|
||||
private long baseSeed;
|
||||
protected GenLayer parent;
|
||||
|
||||
protected static boolean canBeNearby(int id1, int id2) {
|
||||
protected boolean canBeNearby(int id1, int id2) {
|
||||
if(id1 == id2) {
|
||||
return true;
|
||||
}
|
||||
else { // if(id1 != Biome.mesaPlateau_F.id && id1 != Biome.mesaPlateau.id) {
|
||||
final GenBiome biome1 = GenBiome.getBiome(id1);
|
||||
final GenBiome biome2 = GenBiome.getBiome(id2);
|
||||
else {
|
||||
Biome biome1 = this.generator.getBiome(id1);
|
||||
Biome biome2 = this.generator.getBiome(id2);
|
||||
return biome1 != null && biome2 != null ? biome1.isEqualTo(biome2) : false;
|
||||
}
|
||||
// else {
|
||||
// return id2 == Biome.mesaPlateau_F.id || id2 == Biome.mesaPlateau.id;
|
||||
// }
|
||||
}
|
||||
|
||||
protected static boolean isSea(int id) {
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
package server.worldgen.layer;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.biome.Temperature;
|
||||
import server.worldgen.BiomeGenerator;
|
||||
import server.worldgen.biome.GenBiome;
|
||||
import server.worldgen.biome.Temperature;
|
||||
|
||||
public class GenLayerBiomeEdge extends GenLayer
|
||||
{
|
||||
public GenLayerBiomeEdge(long p_i45475_1_, GenLayer p_i45475_3_)
|
||||
public GenLayerBiomeEdge(BiomeGenerator gen, long p_i45475_1_, GenLayer p_i45475_3_)
|
||||
{
|
||||
super(p_i45475_1_);
|
||||
this.parent = p_i45475_3_;
|
||||
this.generator = gen;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,13 +152,13 @@ public class GenLayerBiomeEdge extends GenLayer
|
|||
}
|
||||
else
|
||||
{
|
||||
GenBiome biomegenbase = GenBiome.getBiome(p_151634_1_);
|
||||
GenBiome biomegenbase1 = GenBiome.getBiome(p_151634_2_);
|
||||
Biome biomegenbase = this.generator.getBiome(p_151634_1_);
|
||||
Biome biomegenbase1 = this.generator.getBiome(p_151634_2_);
|
||||
|
||||
if (biomegenbase != null && biomegenbase1 != null)
|
||||
{
|
||||
Temperature biomegenbase$tempcategory = biomegenbase.getTempCategory();
|
||||
Temperature biomegenbase$tempcategory1 = biomegenbase1.getTempCategory();
|
||||
Temperature biomegenbase$tempcategory = biomegenbase.category;
|
||||
Temperature biomegenbase$tempcategory1 = biomegenbase1.category;
|
||||
return biomegenbase$tempcategory == biomegenbase$tempcategory1 || biomegenbase$tempcategory == Temperature.MEDIUM || biomegenbase$tempcategory1 == Temperature.MEDIUM;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -2,19 +2,20 @@ package server.worldgen.layer;
|
|||
|
||||
import common.biome.Biome;
|
||||
import common.log.Log;
|
||||
import server.worldgen.biome.GenBiome;
|
||||
import server.worldgen.BiomeGenerator;
|
||||
|
||||
public class GenLayerHills extends GenLayer
|
||||
{
|
||||
private GenLayer field_151628_d;
|
||||
private final int def;
|
||||
|
||||
public GenLayerHills(long p_i45479_1_, GenLayer p_i45479_3_, GenLayer p_i45479_4_, Biome def)
|
||||
public GenLayerHills(BiomeGenerator gen, long p_i45479_1_, GenLayer p_i45479_3_, GenLayer p_i45479_4_, Biome def)
|
||||
{
|
||||
super(p_i45479_1_);
|
||||
this.parent = p_i45479_3_;
|
||||
this.field_151628_d = p_i45479_4_;
|
||||
this.def = def.id;
|
||||
this.generator = gen;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,9 +44,10 @@ public class GenLayerHills extends GenLayer
|
|||
|
||||
if (k != 0 && l >= 2 && (l - 2) % 29 == 1 && k < 128)
|
||||
{
|
||||
if (Biome.getBiome(k + 128) != null)
|
||||
Biome gb = this.generator.getBiome(k);
|
||||
if (gb != null && gb.mutated != null)
|
||||
{
|
||||
aint2[j + i * areaWidth] = k + 128;
|
||||
aint2[j + i * areaWidth] = gb.mutated.id;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -139,7 +141,7 @@ public class GenLayerHills extends GenLayer
|
|||
|
||||
if (flag && i1 != k)
|
||||
{
|
||||
GenBiome gb = GenBiome.getBiome(i1);
|
||||
Biome gb = this.generator.getBiome(i1);
|
||||
if (gb != null && gb.mutated != null)
|
||||
{
|
||||
i1 = gb.mutated.id;
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package server.worldgen.layer;
|
||||
|
||||
import common.biome.Biome;
|
||||
import server.worldgen.biome.BiomeJungle;
|
||||
import server.worldgen.BiomeGenerator;
|
||||
import server.worldgen.biome.GenBiome;
|
||||
|
||||
public class GenLayerShore extends GenLayer
|
||||
{
|
||||
public GenLayerShore(long base, GenLayer parent)
|
||||
public GenLayerShore(BiomeGenerator gen, long base, GenLayer parent)
|
||||
{
|
||||
super(base);
|
||||
this.parent = parent;
|
||||
this.generator = gen;
|
||||
}
|
||||
|
||||
public int[] getInts(int x, int z, int width, int height)
|
||||
|
@ -23,33 +24,16 @@ public class GenLayerShore extends GenLayer
|
|||
{
|
||||
this.initChunkSeed((long)(j + x), (long)(i + z));
|
||||
int id = pre[j + 1 + (i + 1) * (width + 2)];
|
||||
GenBiome biome = GenBiome.getBiome(id);
|
||||
Biome biome = this.generator.getBiome(id);
|
||||
|
||||
// if (id == Biome.mushroomPlains.id)
|
||||
// {
|
||||
// int j2 = pre[j + 1 + (i + 1 - 1) * (width + 2)];
|
||||
// int i3 = pre[j + 1 + 1 + (i + 1) * (width + 2)];
|
||||
// int l3 = pre[j + 1 - 1 + (i + 1) * (width + 2)];
|
||||
// int k4 = pre[j + 1 + (i + 1 + 1) * (width + 2)];
|
||||
//
|
||||
// if (j2 != Biome.swampland.id && i3 != Biome.swampland.id && l3 != Biome.swampland.id && k4 != Biome.swampland.id)
|
||||
// {
|
||||
// data[j + i * width] = id;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// data[j + i * width] = Biome.mushroomPlainsEdge.id;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
if (biome != null && biome.getBiomeClass() == BiomeJungle.class)
|
||||
if (biome != null && biome.tropical)
|
||||
{
|
||||
int i2 = pre[j + 1 + (i + 1 - 1) * (width + 2)];
|
||||
int l2 = pre[j + 1 + 1 + (i + 1) * (width + 2)];
|
||||
int k3 = pre[j + 1 - 1 + (i + 1) * (width + 2)];
|
||||
int j4 = pre[j + 1 + (i + 1 + 1) * (width + 2)];
|
||||
|
||||
if (this.canNBJungle(i2) && this.canNBJungle(l2) && this.canNBJungle(k3) && this.canNBJungle(j4))
|
||||
if (this.canPlaceTropical(i2) && this.canPlaceTropical(l2) && this.canPlaceTropical(k3) && this.canPlaceTropical(j4))
|
||||
{
|
||||
if (!isSea(i2) && !isSea(l2) && !isSea(k3) && !isSea(j4))
|
||||
{
|
||||
|
@ -71,9 +55,7 @@ public class GenLayerShore extends GenLayer
|
|||
{
|
||||
this.putBeach(pre, data, j, i, width, id, Biome.ICE_BEACH.id);
|
||||
}
|
||||
else // if (id != Biome.mesa.id && id != Biome.mesaPlateau_F.id)
|
||||
// {
|
||||
if (biome != null && !biome.disallowBeach)
|
||||
else if (biome != null && !biome.disallowBeach)
|
||||
{
|
||||
int l1 = pre[j + 1 + (i + 1 - 1) * (width + 2)];
|
||||
int k2 = pre[j + 1 + 1 + (i + 1) * (width + 2)];
|
||||
|
@ -93,30 +75,6 @@ public class GenLayerShore extends GenLayer
|
|||
{
|
||||
data[j + i * width] = id;
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// int l = pre[j + 1 + (i + 1 - 1) * (width + 2)];
|
||||
// int i1 = pre[j + 1 + 1 + (i + 1) * (width + 2)];
|
||||
// int j1 = pre[j + 1 - 1 + (i + 1) * (width + 2)];
|
||||
// int k1 = pre[j + 1 + (i + 1 + 1) * (width + 2)];
|
||||
//
|
||||
// if (!isSea(l) && !isSea(i1) && !isSea(j1) && !isSea(k1))
|
||||
// {
|
||||
// if (this.canNBMesa(l) && this.canNBMesa(i1) && this.canNBMesa(j1) && this.canNBMesa(k1))
|
||||
// {
|
||||
// data[j + i * width] = id;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// data[j + i * width] = Biome.desert.id;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// data[j + i * width] = id;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -152,14 +110,9 @@ public class GenLayerShore extends GenLayer
|
|||
}
|
||||
}
|
||||
|
||||
private boolean canNBJungle(int id)
|
||||
private boolean canPlaceTropical(int id)
|
||||
{
|
||||
GenBiome biome = GenBiome.getBiome(id);
|
||||
return biome != null && biome.getBiomeClass() == BiomeJungle.class ? true : id == Biome.TROPIC_EDGE.id || id == Biome.TROPIC.id || id == Biome.TROPIC_HILLS.id || id == Biome.FOREST.id || id == Biome.TAIGA.id || isSea(id);
|
||||
Biome biome = this.generator.getBiome(id);
|
||||
return (biome != null && biome.tropical) || id == Biome.TROPIC_EDGE.id || id == Biome.TROPIC.id || id == Biome.TROPIC_HILLS.id || id == Biome.FOREST.id || id == Biome.TAIGA.id || isSea(id);
|
||||
}
|
||||
|
||||
// private boolean canNBMesa(int id)
|
||||
// {
|
||||
// return Biome.getBiome(id) instanceof BiomeMesa;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package server.worldgen.populator;
|
||||
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import server.world.WorldServer;
|
||||
|
||||
public interface Populator {
|
||||
void decorate(WorldServer world, Random rand, BlockPos pos);
|
||||
default boolean canGenerateLakes() {
|
||||
return true;
|
||||
}
|
||||
default boolean canGenerateLiquids() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,30 +1,18 @@
|
|||
package server.worldgen.biome;
|
||||
package server.worldgen.populator;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.FeatureGenerator;
|
||||
import server.worldgen.feature.WorldGenAsteroid;
|
||||
|
||||
public class BiomeSpace extends GenBiome
|
||||
public class PopulatorAsteroids extends PopulatorBasic
|
||||
{
|
||||
protected FeatureGenerator asteroidGen1 = new WorldGenAsteroid(Blocks.stone.getState(),
|
||||
Blocks.rock.getState());
|
||||
protected FeatureGenerator asteroidGen2 = new WorldGenAsteroid(Blocks.dirt.getState(),
|
||||
Blocks.coarse_dirt.getState());
|
||||
|
||||
public BiomeSpace()
|
||||
{
|
||||
super(Biome.SPACE);
|
||||
this.topBlock = Blocks.air.getState();
|
||||
this.fillerBlock = Blocks.air.getState();
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
}
|
||||
|
||||
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
347
server/src/main/java/server/worldgen/populator/PopulatorBasic.java
Executable file
347
server/src/main/java/server/worldgen/populator/PopulatorBasic.java
Executable file
|
@ -0,0 +1,347 @@
|
|||
package server.worldgen.populator;
|
||||
|
||||
import common.block.foliage.BlockFlower;
|
||||
import common.init.Blocks;
|
||||
import common.rng.PerlinGen;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.FeatureGenerator;
|
||||
import server.worldgen.feature.WorldGenClay;
|
||||
import server.worldgen.feature.WorldGenClayExt;
|
||||
import server.worldgen.feature.WorldGenSand;
|
||||
import server.worldgen.foliage.FeatureDoublePlant;
|
||||
import server.worldgen.foliage.WorldGenBigMushroom;
|
||||
import server.worldgen.foliage.WorldGenCactus;
|
||||
import server.worldgen.foliage.WorldGenDeadBush;
|
||||
import server.worldgen.foliage.WorldGenFlowers;
|
||||
import server.worldgen.foliage.WorldGenMushroom;
|
||||
import server.worldgen.foliage.WorldGenPumpkin;
|
||||
import server.worldgen.foliage.WorldGenReed;
|
||||
import server.worldgen.foliage.WorldGenTallGrass;
|
||||
import server.worldgen.foliage.WorldGenWaterlily;
|
||||
import server.worldgen.tree.WorldGenBaseTree;
|
||||
import server.worldgen.tree.WorldGenBigTree;
|
||||
import server.worldgen.tree.WorldGenTree;
|
||||
|
||||
public abstract class PopulatorBasic implements Populator {
|
||||
public static final PopulatorBasic plains = (new PopulatorPlains());
|
||||
public static final PopulatorBasic desert = (new PopulatorDesert());
|
||||
public static final PopulatorBasic extremeHills = (new PopulatorHills(false));
|
||||
public static final PopulatorBasic extremeHillsPlus = (new PopulatorHills(true));
|
||||
public static final PopulatorBasic taiga = (new PopulatorTaiga(0));
|
||||
public static final PopulatorBasic megaTaiga = (new PopulatorTaiga(1));
|
||||
public static final PopulatorBasic tallTreeTaiga = new PopulatorTaiga(2);
|
||||
public static final PopulatorBasic swampland = (new PopulatorSwamp());
|
||||
public static final PopulatorBasic river = (new PopulatorDefault());
|
||||
public static final PopulatorBasic icePlains = (new PopulatorSnow(false));
|
||||
public static final PopulatorBasic iceSpikes = new PopulatorSnow(true);
|
||||
public static final PopulatorBasic beach = (new PopulatorBeach());
|
||||
public static final PopulatorBasic jungle = (new PopulatorTropical(false));
|
||||
public static final PopulatorBasic jungleEdge = (new PopulatorTropical(true));
|
||||
public static final PopulatorBasic stoneBeach = (new PopulatorRocky());
|
||||
public static final PopulatorBasic savanna = (new PopulatorSavanna(true));
|
||||
public static final PopulatorBasic savannaNoDPlants = new PopulatorSavanna(false);
|
||||
public static final PopulatorBasic forest = (new PopulatorForest(0));
|
||||
public static final PopulatorBasic flowerForest = new PopulatorForest(1);
|
||||
public static final PopulatorBasic birchForest = (new PopulatorForest(2));
|
||||
public static final PopulatorBasic roofedForest = (new PopulatorForest(3));
|
||||
public static final PopulatorBasic tallBirchForest = new PopulatorForest(5);
|
||||
|
||||
public static final PopulatorBasic elvenForest = (new PopulatorForest(4));
|
||||
public static final PopulatorBasic mesa = (new PopulatorMesa(false));
|
||||
public static final PopulatorBasic mesaPlateau_F = (new PopulatorMesa(true));
|
||||
public static final PopulatorBasic space = (new PopulatorAsteroids());
|
||||
public static final PopulatorBasic mushroomPlains = (new PopulatorMushrooms());
|
||||
public static final PopulatorBasic upperHell = (new PopulatorHell());
|
||||
public static final PopulatorBasic blackened = (new PopulatorBlackened());
|
||||
public static final PopulatorBasic snowLand = (new PopulatorNoMushrooms());
|
||||
public static final PopulatorBasic tian = (new PopulatorTian());
|
||||
public static final PopulatorBasic moon = (new PopulatorCheese());
|
||||
public static final PopulatorBasic chaos = (new PopulatorChaos());
|
||||
|
||||
protected static final PerlinGen TREE_NOISE = new PerlinGen(new Random(726528729282625L), 8);
|
||||
protected static final PerlinGen GRASS_NOISE = new PerlinGen(new Random(297363826225L), 1);
|
||||
protected static final FeatureDoublePlant DOUBLE_PLANT_GEN = new FeatureDoublePlant();
|
||||
|
||||
protected final WorldGenBaseTree worldGeneratorTrees = new WorldGenBaseTree(false);
|
||||
protected final WorldGenBigTree worldGeneratorBigTree = new WorldGenBigTree(false);
|
||||
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.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);
|
||||
|
||||
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 WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return rand.chance(10) ? this.worldGeneratorBigTree : this.worldGeneratorTrees;
|
||||
}
|
||||
|
||||
protected WorldGenTree genBigTreeLegacy(Random rand, BlockPos pos, boolean humid)
|
||||
{
|
||||
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)) || (humid && rand.chance(3)) ? this.worldGeneratorBigTree :
|
||||
this.worldGeneratorTrees;
|
||||
}
|
||||
|
||||
protected FeatureGenerator getRandomWorldGenForGrass(Random rand)
|
||||
{
|
||||
return new WorldGenTallGrass(Blocks.tallgrass);
|
||||
}
|
||||
|
||||
protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
|
||||
{
|
||||
return rand.rarity(3) ? BlockFlower.EnumFlowerType.DANDELION : BlockFlower.EnumFlowerType.ROSE;
|
||||
}
|
||||
|
||||
public void decorate(WorldServer 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.getHighestFreePos(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.getHighestFreePos(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.getHighestFreePos(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.getHighestFreePos(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);
|
||||
|
||||
this.yellowFlowerGen.setGeneratedBlock(BlockFlower.getByType(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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
12
server/src/main/java/server/worldgen/populator/PopulatorBeach.java
Executable file
12
server/src/main/java/server/worldgen/populator/PopulatorBeach.java
Executable file
|
@ -0,0 +1,12 @@
|
|||
package server.worldgen.populator;
|
||||
|
||||
public class PopulatorBeach extends PopulatorBasic
|
||||
{
|
||||
public PopulatorBeach()
|
||||
{
|
||||
this.treesPerChunk = -999;
|
||||
this.deadBushPerChunk = 0;
|
||||
this.reedsPerChunk = 0;
|
||||
this.cactiPerChunk = 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package server.worldgen.populator;
|
||||
|
||||
import common.block.foliage.BlockFlower;
|
||||
import common.init.Blocks;
|
||||
import common.init.WoodType;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import server.worldgen.tree.WorldGenBaseTree;
|
||||
import server.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class PopulatorBlackened extends PopulatorBasic {
|
||||
protected final WorldGenTree treeGen = new WorldGenBaseTree(false, Blocks.blackwood_log.getState(), WoodType.BLACKWOOD);
|
||||
|
||||
public PopulatorBlackened() {
|
||||
this.treesPerChunk = 3;
|
||||
}
|
||||
|
||||
protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos) {
|
||||
return BlockFlower.EnumFlowerType.BLACK_LOTUS;
|
||||
}
|
||||
|
||||
protected WorldGenTree genBigTreeChance(Random rand) {
|
||||
return this.treeGen;
|
||||
}
|
||||
}
|
26
server/src/main/java/server/worldgen/populator/PopulatorChaos.java
Executable file
26
server/src/main/java/server/worldgen/populator/PopulatorChaos.java
Executable file
|
@ -0,0 +1,26 @@
|
|||
package server.worldgen.populator;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.FeatureGenerator;
|
||||
import server.worldgen.foliage.WorldGenMushroom;
|
||||
|
||||
public class PopulatorChaos extends PopulatorBasic
|
||||
{
|
||||
protected FeatureGenerator mushroomBlueGen = new WorldGenMushroom(Blocks.blue_mushroom);
|
||||
|
||||
public void decorate(WorldServer 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,25 +1,14 @@
|
|||
package server.worldgen.biome;
|
||||
package server.worldgen.populator;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.FeatureOres;
|
||||
|
||||
public class BiomeMoon extends GenBiome {
|
||||
public class PopulatorCheese extends PopulatorBasic {
|
||||
private FeatureOres cheeseGenerator = new FeatureOres(Blocks.moon_cheese.getState(), 8, 8, 12, 24, 52, false);
|
||||
|
||||
public BiomeMoon() {
|
||||
super(Biome.MOON);
|
||||
this.topBlock = Blocks.moon_rock.getState();
|
||||
this.fillerBlock = Blocks.moon_rock.getState();
|
||||
}
|
||||
|
||||
protected void addMobs(WeightedList<RngSpawn> mobs) {
|
||||
}
|
||||
|
||||
public void decorate(WorldServer worldIn, Random rand, BlockPos pos) {
|
||||
this.cheeseGenerator.generate(worldIn, rand, pos);
|
||||
}
|
4
server/src/main/java/server/worldgen/populator/PopulatorDefault.java
Executable file
4
server/src/main/java/server/worldgen/populator/PopulatorDefault.java
Executable file
|
@ -0,0 +1,4 @@
|
|||
package server.worldgen.populator;
|
||||
|
||||
public class PopulatorDefault extends PopulatorBasic {
|
||||
}
|
|
@ -1,29 +1,23 @@
|
|||
package server.worldgen.biome;
|
||||
package server.worldgen.populator;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.util.BlockPos;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.feature.WorldGenDesertWells;
|
||||
|
||||
public class BiomeDesert extends GenBiome
|
||||
public class PopulatorDesert extends PopulatorBasic
|
||||
{
|
||||
public BiomeDesert(boolean hills)
|
||||
public PopulatorDesert()
|
||||
{
|
||||
super(hills ? Biome.DESERT_HILLS : Biome.DESERT);
|
||||
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 boolean canGenerateLakes() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
|
@ -1,12 +1,7 @@
|
|||
package server.worldgen.biome;
|
||||
package server.worldgen.populator;
|
||||
|
||||
import common.biome.Biome;
|
||||
import common.block.foliage.BlockDoublePlant;
|
||||
import common.block.foliage.BlockFlower;
|
||||
import common.entity.animal.EntityFox;
|
||||
import common.entity.animal.EntityWolf;
|
||||
import common.entity.npc.EntityElf;
|
||||
import common.entity.npc.EntityWoodElf;
|
||||
import common.init.Blocks;
|
||||
import common.init.WoodType;
|
||||
import common.rng.Random;
|
||||
|
@ -20,7 +15,7 @@ import server.worldgen.tree.WorldGenBirch;
|
|||
import server.worldgen.tree.WorldGenDarkOak;
|
||||
import server.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class BiomeForest extends GenBiome
|
||||
public class PopulatorForest extends PopulatorBasic
|
||||
{
|
||||
private static final BlockDoublePlant[] FLOWER_TYPES = new BlockDoublePlant[] {
|
||||
Blocks.syringa, Blocks.rose_bush, Blocks.paeonia
|
||||
|
@ -44,9 +39,8 @@ public class BiomeForest extends GenBiome
|
|||
protected WorldGenBigTree mapleBig = new WorldGenBigTree(false, Blocks.maple_log.getState(), // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.MAPLE),
|
||||
WoodType.MAPLE); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen()));
|
||||
|
||||
public BiomeForest(Biome base, int type)
|
||||
public PopulatorForest(int type)
|
||||
{
|
||||
super(base);
|
||||
this.subType = type;
|
||||
this.treesPerChunk = 10;
|
||||
this.grassPerChunk = 2;
|
||||
|
@ -66,31 +60,17 @@ public class BiomeForest extends GenBiome
|
|||
this.reedsPerChunk = 50;
|
||||
this.waterlilyPerChunk = 4;
|
||||
}
|
||||
|
||||
if (this.subType == 0)
|
||||
{
|
||||
this.mobs.add(new RngSpawn(EntityWolf.class, 5, 2, 4));
|
||||
this.mobs.add(new RngSpawn(EntityFox.class, 1, 2, 6));
|
||||
}
|
||||
|
||||
if (this.subType == 3)
|
||||
{
|
||||
this.treesPerChunk = -999;
|
||||
this.mobs.add(new RngSpawn(EntityFox.class, 1, 2, 4));
|
||||
}
|
||||
|
||||
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));
|
||||
this.mobs.add(new RngSpawn(EntityFox.class, 3, 2, 5));
|
||||
}
|
||||
}
|
||||
|
||||
public WorldGenTree genBigTreeChance(Random rand)
|
||||
protected WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
if(this.subType == 5)
|
||||
return rand.chance() ? PopulatorForest.tallBirch : PopulatorForest.normalBirch;
|
||||
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) :
|
||||
|
@ -98,7 +78,7 @@ public class BiomeForest extends GenBiome
|
|||
(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)
|
||||
protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
|
||||
{
|
||||
if (this.subType == 1)
|
||||
{
|
||||
|
@ -199,30 +179,4 @@ public class BiomeForest extends GenBiome
|
|||
|
||||
super.decorate(worldIn, rand, pos);
|
||||
}
|
||||
|
||||
protected GenBiome createMutatedBiome(Biome base)
|
||||
{
|
||||
if (this.base == Biome.FOREST)
|
||||
{
|
||||
BiomeForest biomegenforest = new BiomeForest(base, 1);
|
||||
biomegenforest.setScaling(this.depth, this.scale + 0.2F);
|
||||
return biomegenforest;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.base != Biome.BIRCH_FOREST && this.base != Biome.BIRCH_HILLS ? new BiomeMutated(base, this)
|
||||
{
|
||||
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
this.baseBiome.decorate(worldIn, rand, pos);
|
||||
}
|
||||
}: new BiomeMutated(base, this)
|
||||
{
|
||||
public WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return rand.chance() ? BiomeForest.tallBirch : BiomeForest.normalBirch;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
75
server/src/main/java/server/worldgen/populator/PopulatorHell.java
Executable file
75
server/src/main/java/server/worldgen/populator/PopulatorHell.java
Executable file
|
@ -0,0 +1,75 @@
|
|||
package server.worldgen.populator;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.FeatureOres;
|
||||
import server.worldgen.feature.WorldGenFire;
|
||||
import server.worldgen.feature.WorldGenGlowStone;
|
||||
import server.worldgen.feature.WorldGenHellLava;
|
||||
import server.worldgen.foliage.WorldGenMushroom;
|
||||
|
||||
public class PopulatorHell extends PopulatorBasic
|
||||
{
|
||||
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 PopulatorHell()
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
this.quartzGen.generate(worldIn, rand, pos);
|
||||
|
||||
for (int j1 = 0; j1 < 16; ++j1)
|
||||
{
|
||||
this.lavaGen1.generate(worldIn, rand, pos.add(rand.zrange(16), rand.zrange(108) + 10, rand.zrange(16)));
|
||||
}
|
||||
}
|
||||
}
|
32
server/src/main/java/server/worldgen/populator/PopulatorHills.java
Executable file
32
server/src/main/java/server/worldgen/populator/PopulatorHills.java
Executable file
|
@ -0,0 +1,32 @@
|
|||
package server.worldgen.populator;
|
||||
|
||||
import common.init.Blocks;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.FeatureOres;
|
||||
import server.worldgen.tree.WorldGenTaiga2;
|
||||
import server.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class PopulatorHills extends PopulatorBasic
|
||||
{
|
||||
private FeatureOres theEmeraldGenerator = new FeatureOres(Blocks.emerald_ore.getState(), 3, 5, 1, 4, 32, false);
|
||||
private WorldGenTaiga2 field_150634_aD = new WorldGenTaiga2(false);
|
||||
|
||||
protected PopulatorHills(boolean trees)
|
||||
{
|
||||
if(trees)
|
||||
this.treesPerChunk = 3;
|
||||
}
|
||||
|
||||
protected WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return (WorldGenTree)(rand.rarity(3) ? this.field_150634_aD : super.genBigTreeChance(rand));
|
||||
}
|
||||
|
||||
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
|
||||
{
|
||||
super.decorate(worldIn, rand, pos);
|
||||
this.theEmeraldGenerator.generate(worldIn, rand, pos);
|
||||
}
|
||||
}
|
23
server/src/main/java/server/worldgen/populator/PopulatorMesa.java
Executable file
23
server/src/main/java/server/worldgen/populator/PopulatorMesa.java
Executable file
|
@ -0,0 +1,23 @@
|
|||
package server.worldgen.populator;
|
||||
|
||||
import common.rng.Random;
|
||||
import server.worldgen.tree.WorldGenTree;
|
||||
|
||||
public class PopulatorMesa extends PopulatorBasic
|
||||
{
|
||||
public PopulatorMesa(boolean soil)
|
||||
{
|
||||
this.treesPerChunk = -999;
|
||||
this.deadBushPerChunk = 20;
|
||||
this.reedsPerChunk = 3;
|
||||
this.cactiPerChunk = 5;
|
||||
this.flowersPerChunk = 0;
|
||||
if (soil)
|
||||
this.treesPerChunk = 5;
|
||||
}
|
||||
|
||||
protected WorldGenTree genBigTreeChance(Random rand)
|
||||
{
|
||||
return this.worldGeneratorTrees;
|
||||
}
|
||||
}
|
11
server/src/main/java/server/worldgen/populator/PopulatorMushrooms.java
Executable file
11
server/src/main/java/server/worldgen/populator/PopulatorMushrooms.java
Executable file
|
@ -0,0 +1,11 @@
|
|||
package server.worldgen.populator;
|
||||
|
||||
public class PopulatorMushrooms extends PopulatorBasic {
|
||||
public PopulatorMushrooms() {
|
||||
this.treesPerChunk = -100;
|
||||
this.flowersPerChunk = -100;
|
||||
this.grassPerChunk = -100;
|
||||
this.mushroomsPerChunk = 1;
|
||||
this.bigMushroomsPerChunk = 1;
|
||||
}
|
||||
}
|
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