pre genlayer rework

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

View file

@ -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();

View file

@ -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);

View file

@ -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)

View file

@ -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;
}

View file

@ -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();

View file

@ -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;

View file

@ -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) {

View file

@ -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;
// }
}

View file

@ -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());
}
}

View file

@ -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;
}
}

View file

@ -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);
}

View file

@ -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);
}
}
}

View file

@ -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;
}

View file

@ -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;

View file

@ -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));

View file

@ -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();

View 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;
}
}
}
}
}
}

View file

@ -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;

View file

@ -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);
}

View 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();
}
}
}
}
}

View 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);
}
}

View file

@ -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)
{

View file

@ -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) {
}
}

View file

@ -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;
}
}

View file

@ -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);
}
}
}

View file

@ -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) {
}
}

View file

@ -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();
// }
}

View file

@ -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);
}
}

View file

@ -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;
}
}

View file

@ -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));
}
}

View file

@ -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();
}
}

View file

@ -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;
}
}

View file

@ -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);
}
}
}

View file

@ -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));
}
}

View file

@ -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) {
}
}

View file

@ -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);
}
}

View file

@ -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;
}
}

View file

@ -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 {
}

View file

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

View file

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

View file

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

View file

@ -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()

View file

@ -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);
}
}
}

View file

@ -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) {

View file

@ -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

View file

@ -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;

View file

@ -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;
// }
}

View file

@ -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;
}
}

View file

@ -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)
{

View 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));
}
}
}
}

View 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;
}
}

View file

@ -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;
}
}

View 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);
}
}
}

View file

@ -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);
}

View file

@ -0,0 +1,4 @@
package server.worldgen.populator;
public class PopulatorDefault extends PopulatorBasic {
}

View file

@ -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)
{

View file

@ -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;
}
};
}
}
}

View 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)));
}
}
}

View 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);
}
}

View 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;
}
}

View 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;
}
}

View file

@ -0,0 +1,9 @@
package server.worldgen.populator;
public class PopulatorNoMushrooms extends PopulatorBasic
{
public PopulatorNoMushrooms()
{
this.mushroomsPerChunk = -1;
}
}

View file

@ -1,14 +1,12 @@
package server.worldgen.biome;
package server.worldgen.populator;
import common.biome.Biome;
import common.block.foliage.BlockFlower;
import common.entity.animal.EntityHorse;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import server.world.WorldServer;
public class BiomePlains extends GenBiome
public class PopulatorPlains extends PopulatorBasic
{
private static final BlockFlower.EnumFlowerType[] TULIP_TYPES = new BlockFlower.EnumFlowerType[] {
BlockFlower.EnumFlowerType.ORANGE_TULIP, BlockFlower.EnumFlowerType.RED_TULIP,
@ -16,22 +14,19 @@ public class BiomePlains extends GenBiome
};
private static final BlockFlower.EnumFlowerType[] FLOWER_TYPES = new BlockFlower.EnumFlowerType[] {
BlockFlower.EnumFlowerType.POPPY, BlockFlower.EnumFlowerType.HOUSTONIA, BlockFlower.EnumFlowerType.OXEYE_DAISY
BlockFlower.EnumFlowerType.POPPY, BlockFlower.EnumFlowerType.HOUSTONIA, BlockFlower.EnumFlowerType.DAISY
};
// protected boolean field_150628_aC;
protected BiomePlains()
protected PopulatorPlains()
{
super(Biome.PLAIN);
this.setScaling(Scaling.PLAINS_LOW);
this.mobs.add(new RngSpawn(EntityHorse.class, 5, 2, 6));
this.treesPerChunk = -999;
this.flowersPerChunk = 4;
this.grassPerChunk = 10;
}
public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
{
double d0 = GRASS_NOISE.generate((double)pos.getX() / 200.0D, (double)pos.getZ() / 200.0D);

View file

@ -0,0 +1,12 @@
package server.worldgen.populator;
public class PopulatorRocky extends PopulatorBasic
{
public PopulatorRocky()
{
this.treesPerChunk = -999;
this.deadBushPerChunk = 0;
this.reedsPerChunk = 0;
this.cactiPerChunk = 0;
}
}

View file

@ -0,0 +1,52 @@
package server.worldgen.populator;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import server.world.WorldServer;
import server.worldgen.tree.WorldGenSavanna;
import server.worldgen.tree.WorldGenTree;
public class PopulatorSavanna extends PopulatorBasic
{
private static final WorldGenSavanna field_150627_aC = new WorldGenSavanna(false);
private final boolean dplant;
protected PopulatorSavanna(boolean dplant)
{
this.dplant = dplant;
if(dplant) {
this.treesPerChunk = 1;
this.flowersPerChunk = 4;
this.grassPerChunk = 20;
}
else {
this.treesPerChunk = 2;
this.flowersPerChunk = 2;
this.grassPerChunk = 5;
}
}
protected WorldGenTree genBigTreeChance(Random rand)
{
return (WorldGenTree)(rand.rarity(5) ? field_150627_aC : this.worldGeneratorTrees);
}
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
{
if(this.dplant) {
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);
}
}

View file

@ -1,9 +1,6 @@
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.WorldGenIcePath;
@ -11,21 +8,15 @@ import server.worldgen.feature.WorldGenIceSpike;
import server.worldgen.tree.WorldGenTaiga2;
import server.worldgen.tree.WorldGenTree;
public class BiomeSnow extends GenBiome
public class PopulatorSnow extends PopulatorBasic
{
private final WorldGenIceSpike spikeGen = new WorldGenIceSpike();
private final WorldGenIcePath pathGen = new WorldGenIcePath(4);
private final boolean spiky;
public BiomeSnow(Biome base, boolean spiky)
public PopulatorSnow(boolean spiky)
{
super(base);
this.spiky = spiky;
if(spiky)
this.topBlock = Blocks.snow.getState();
}
protected void addMobs(WeightedList<RngSpawn> mobs) {
}
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
@ -50,16 +41,8 @@ public class BiomeSnow extends GenBiome
super.decorate(worldIn, rand, pos);
}
public WorldGenTree genBigTreeChance(Random rand)
protected WorldGenTree genBigTreeChance(Random rand)
{
return new WorldGenTaiga2(false);
}
protected GenBiome createMutatedBiome(Biome base)
{
GenBiome biomegenbase = (new BiomeSnow(base, true)).enableColdBeach().setScaling(this.depth + 0.1F, this.scale + 0.1F);
biomegenbase.depth = this.depth + 0.3F;
biomegenbase.scale = this.scale + 0.4F;
return biomegenbase;
}
}

View file

@ -0,0 +1,44 @@
package server.worldgen.populator;
import common.block.foliage.BlockFlower;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import server.worldgen.FeatureGenerator;
import server.worldgen.foliage.WorldGenTallGrass;
import server.worldgen.tree.WorldGenSwamp;
import server.worldgen.tree.WorldGenTree;
public class PopulatorSwamp extends PopulatorBasic
{
protected final WorldGenSwamp worldGeneratorSwamp = new WorldGenSwamp();
protected PopulatorSwamp()
{
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;
}
protected WorldGenTree genBigTreeChance(Random rand)
{
return this.worldGeneratorSwamp;
}
protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
{
return BlockFlower.EnumFlowerType.BLUE_ORCHID;
}
protected FeatureGenerator getRandomWorldGenForGrass(Random rand)
{
return new WorldGenTallGrass(Blocks.swamp_grass);
}
}

View file

@ -1,12 +1,9 @@
package server.worldgen.biome;
package server.worldgen.populator;
import common.biome.Biome;
import common.entity.animal.EntityWolf;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import server.world.WorldServer;
import server.worldgen.ChunkPrimer;
import server.worldgen.FeatureGenerator;
import server.worldgen.feature.WorldGenBlockBlob;
import server.worldgen.foliage.WorldGenTallGrass;
@ -15,23 +12,21 @@ import server.worldgen.tree.WorldGenTaiga1;
import server.worldgen.tree.WorldGenTaiga2;
import server.worldgen.tree.WorldGenTree;
public class BiomeTaiga extends GenBiome
public class PopulatorTaiga extends PopulatorBasic
{
private static final WorldGenTaiga1 field_150639_aC = new WorldGenTaiga1();
private static final WorldGenTaiga2 field_150640_aD = new WorldGenTaiga2(false);
private static final WorldGenPine field_150641_aE = new WorldGenPine(false, false);
private static final WorldGenPine field_150642_aF = new WorldGenPine(false, true);
private static final WorldGenBlockBlob field_150643_aG = new WorldGenBlockBlob(Blocks.mossy_cobblestone, 0);
private int field_150644_aH;
private final int subType;
public BiomeTaiga(Biome base, int p_i45385_2_)
public PopulatorTaiga(int subType)
{
super(base);
this.field_150644_aH = p_i45385_2_;
this.mobs.add(new RngSpawn(EntityWolf.class, 8, 4, 4));
this.subType = subType;
this.treesPerChunk = 10;
if (p_i45385_2_ != 1 && p_i45385_2_ != 2)
if (subType != 1 && subType != 2)
{
this.grassPerChunk = 1;
this.mushroomsPerChunk = 1;
@ -44,22 +39,19 @@ public class BiomeTaiga extends GenBiome
}
}
public WorldGenTree genBigTreeChance(Random rand)
protected WorldGenTree genBigTreeChance(Random rand)
{
return (WorldGenTree)((this.field_150644_aH == 1 || this.field_150644_aH == 2) && rand.chance(3) ? (this.field_150644_aH != 2 && rand.rarity(13) ? field_150641_aE : field_150642_aF) : (rand.chance(3) ? field_150639_aC : field_150640_aD));
return (WorldGenTree)((this.subType == 1 || this.subType == 2) && rand.chance(3) ? (this.subType != 2 && rand.rarity(13) ? field_150641_aE : field_150642_aF) : (rand.chance(3) ? field_150639_aC : field_150640_aD));
}
/**
* Gets a WorldGen appropriate for this biome.
*/
public FeatureGenerator getRandomWorldGenForGrass(Random rand)
protected FeatureGenerator getRandomWorldGenForGrass(Random rand)
{
return rand.rarity(5) ? new WorldGenTallGrass(Blocks.fern) : new WorldGenTallGrass(Blocks.tallgrass);
}
public void decorate(WorldServer worldIn, Random rand, BlockPos pos)
{
if (this.field_150644_aH == 1 || this.field_150644_aH == 2)
if (this.subType == 1 || this.subType == 2)
{
int i = rand.zrange(3);
@ -84,29 +76,4 @@ public class BiomeTaiga extends GenBiome
super.decorate(worldIn, rand, pos);
}
public void genTerrainBlocks(WorldServer worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
{
if (this.field_150644_aH == 1 || this.field_150644_aH == 2)
{
this.topBlock = Blocks.grass.getState();
this.fillerBlock = Blocks.dirt.getState();
if (noiseVal > 1.75D)
{
this.topBlock = Blocks.coarse_dirt.getState();
}
else if (noiseVal > -0.95D)
{
this.topBlock = Blocks.podzol.getState();
}
}
this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, x, z, noiseVal);
}
protected GenBiome createMutatedBiome(Biome base)
{
return this.base == Biome.LARGE_TAIGA ? (new BiomeTaiga(base, 2)).setScaling(this.depth, this.scale) : super.createMutatedBiome(base);
}
}

View file

@ -1,16 +1,9 @@
package server.worldgen.biome;
package server.worldgen.populator;
import common.biome.Biome;
import common.block.foliage.BlockFlower;
import common.entity.animal.EntityBat;
import common.entity.animal.EntityMouse;
import common.entity.animal.EntityRabbit;
import common.entity.npc.EntityCultivator;
import common.entity.npc.EntityMerfolk;
import common.init.Blocks;
import common.init.WoodType;
import common.rng.Random;
import common.rng.WeightedList;
import common.util.BlockPos;
import server.world.WorldServer;
import server.worldgen.FeatureGenerator;
@ -20,7 +13,7 @@ import server.worldgen.tree.WorldGenBaseTree;
import server.worldgen.tree.WorldGenBigTree;
import server.worldgen.tree.WorldGenTree;
public class BiomeTian extends GenBiome
public class PopulatorTian extends PopulatorBasic
{
protected FeatureGenerator spikeGen = new WorldGenSpikes(Blocks.tian_soil, 128, 2, 3, Blocks.obsidian.getState(), true);
protected FeatureGenerator mushroomBlueGen = new WorldGenMushroom(Blocks.blue_mushroom);
@ -32,30 +25,19 @@ public class BiomeTian extends GenBiome
protected WorldGenTree treeGen4 = new WorldGenBigTree(false, Blocks.tian_log.getState(), WoodType.TIAN)
.setHeightLimit(12, 15);
public BiomeTian()
public PopulatorTian()
{
super(Biome.TIAN);
this.topBlock = Blocks.tian_soil.getState();
this.fillerBlock = Blocks.tian.getState();
this.mushroomsPerChunk = -1;
this.grassPerChunk = 0;
this.treesPerChunk = 1;
}
protected void addMobs(WeightedList<RngSpawn> mobs) {
mobs.add(new 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 BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
{
return BlockFlower.EnumFlowerType.BLACK_LOTUS;
}
public WorldGenTree genBigTreeChance(Random rand)
protected WorldGenTree genBigTreeChance(Random rand)
{
return rand.pick(rand.chance(this.treeGen2, this.treeGen1, 4), rand.chance(this.treeGen3, this.treeGen4, 15));
}

View file

@ -1,8 +1,5 @@
package server.worldgen.biome;
package server.worldgen.populator;
import common.biome.Biome;
import common.entity.animal.EntityChicken;
import common.entity.animal.EntityCat;
import common.init.Blocks;
import common.init.WoodType;
import common.rng.Random;
@ -18,7 +15,7 @@ import server.worldgen.tree.WorldGenBaseTree;
import server.worldgen.tree.WorldGenJungle;
import server.worldgen.tree.WorldGenTree;
public class BiomeJungle extends GenBiome
public class PopulatorTropical extends PopulatorBasic
{
private static final State LOG = Blocks.jungle_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE);
private static final WoodType LEAVES = WoodType.JUNGLE; // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false));
@ -26,9 +23,8 @@ public class BiomeJungle extends GenBiome
private final boolean edge;
public BiomeJungle(Biome base, boolean edge)
public PopulatorTropical(boolean edge)
{
super(base);
this.edge = edge;
if (edge)
@ -42,24 +38,14 @@ public class BiomeJungle extends GenBiome
this.grassPerChunk = 25;
this.flowersPerChunk = 4;
if (!edge)
{
this.mobs.add(new RngSpawn(EntityCat.class, 2, 1, 1));
}
this.mobs.add(new RngSpawn(EntityChicken.class, 10, 4, 4));
}
public WorldGenTree genBigTreeChance(Random rand)
protected WorldGenTree genBigTreeChance(Random rand)
{
return (WorldGenTree)(rand.chance(10) ? this.worldGeneratorBigTree : (rand.chance(2) ? new WorldGenShrub(LOG, BUSH) : (!this.edge && rand.chance(3) ? new WorldGenJungle(false, 10, 20, LOG, LEAVES) : new WorldGenBaseTree(false, rand.range(4, 10), LOG, LEAVES, true))));
}
/**
* Gets a WorldGen appropriate for this biome.
*/
public FeatureGenerator getRandomWorldGenForGrass(Random rand)
protected FeatureGenerator getRandomWorldGenForGrass(Random rand)
{
return rand.chance(4) ? new WorldGenTallGrass(Blocks.fern) : new WorldGenTallGrass(Blocks.tallgrass);
}

View file

@ -42,9 +42,9 @@ public class MapGenScatteredFeature extends MapGenStructure
k = k + random.zrange(MapGenScatteredFeature.MAX_DISTANCE - MapGenScatteredFeature.MIN_DISTANCE);
l = l + random.zrange(MapGenScatteredFeature.MAX_DISTANCE - MapGenScatteredFeature.MIN_DISTANCE);
if (i == k && j == l)
if (i == k && j == l && this.worldObj.getBiomeGenerator() != null)
{
Biome biomegenbase = this.worldObj.getBiomeGenerator().getBiomeGenerator(new BlockPos(i * 16 + 8, 0, j * 16 + 8), null);
Biome biomegenbase = this.worldObj.getBiomeGenerator().getBiomeAt(new BlockPos(i * 16 + 8, 0, j * 16 + 8), null);
if (biomegenbase == null)
{
@ -92,7 +92,7 @@ public class MapGenScatteredFeature extends MapGenStructure
public Start(WorldServer worldIn, Random p_i2060_2_, int p_i2060_3_, int p_i2060_4_)
{
super(p_i2060_3_, p_i2060_4_);
Biome biomegenbase = worldIn.getBiomeGenForCoords(new BlockPos(p_i2060_3_ * 16 + 8, 0, p_i2060_4_ * 16 + 8));
Biome biomegenbase = worldIn.getBiomeGenerator().getBiomeAt(new BlockPos(p_i2060_3_ * 16 + 8, 0, p_i2060_4_ * 16 + 8), null);
if (biomegenbase != Biome.TROPIC && biomegenbase != Biome.TROPIC_HILLS)
{

View file

@ -69,7 +69,7 @@ public class MapGenVillage extends MapGenStructure
k = k + random.zrange(this.distance - this.field_82666_h);
l = l + random.zrange(this.distance - this.field_82666_h);
if (i == k && j == l)
if (i == k && j == l && this.worldObj.getBiomeGenerator() != null)
{
boolean flag = this.worldObj.getBiomeGenerator().areBiomesViable(i * 16 + 8, j * 16 + 8, 0, villageSpawnBiomes);

View file

@ -1429,7 +1429,7 @@ public class StructureVillage
this.biomeGen = genIn;
this.structureVillageWeightedPieceList = p_i2104_6_;
this.terrainType = p_i2104_7_;
Biome biomegenbase = genIn.getBiomeGenerator(new BlockPos(p_i2104_4_, 0, p_i2104_5_), Biome.DEF_BIOME);
Biome biomegenbase = genIn.getBiomeAt(new BlockPos(p_i2104_4_, 0, p_i2104_5_), null);
this.inDesert = biomegenbase == Biome.DESERT || biomegenbase == Biome.DESERT_HILLS;
this.func_175846_a(this.inDesert);
}