mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
30185626a6
@ -12,6 +12,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||
import ninja.bytecode.iris.spec.IrisBiome;
|
||||
import ninja.bytecode.shuriken.format.F;
|
||||
|
||||
public class CommandIris implements CommandExecutor
|
||||
{
|
||||
@ -25,6 +26,7 @@ public class CommandIris implements CommandExecutor
|
||||
{
|
||||
if(args.length == 0)
|
||||
{
|
||||
msg(sender, "/iris timings - Iris Timings");
|
||||
msg(sender, "/iris rtp [biome] - RTP to a biome");
|
||||
msg(sender, "/iris gen - Gen a new Iris World");
|
||||
msg(sender, "/ish - Iris Schematic Commands");
|
||||
@ -32,6 +34,17 @@ public class CommandIris implements CommandExecutor
|
||||
|
||||
if(args.length > 0)
|
||||
{
|
||||
if(args[0].equalsIgnoreCase("timings"))
|
||||
{
|
||||
double t = Iris.profiler.getResult("terrain").getAverage();
|
||||
double c = Iris.profiler.getResult("caves").getAverage();
|
||||
double d = Iris.profiler.getResult("decor").getAverage();
|
||||
msg(sender, "Generation: " + ChatColor.BOLD + ChatColor.WHITE + F.duration(t + d, 2));
|
||||
msg(sender, " \\Terrain: " + ChatColor.BOLD + ChatColor.WHITE + F.duration(t, 2));
|
||||
msg(sender, " \\Caves: " + ChatColor.BOLD + ChatColor.WHITE + F.duration(c, 2));
|
||||
msg(sender, " \\Decor: " + ChatColor.BOLD + ChatColor.WHITE + F.duration(d, 2));
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("rtp"))
|
||||
{
|
||||
if(sender instanceof Player)
|
||||
|
@ -78,6 +78,16 @@ public class Iris extends JavaPlugin implements Listener
|
||||
new WandManager();
|
||||
loadComplete();
|
||||
}
|
||||
|
||||
public static void started(String obj)
|
||||
{
|
||||
profiler.start(obj);
|
||||
}
|
||||
|
||||
public static void stopped(String obj)
|
||||
{
|
||||
profiler.stop(obj);
|
||||
}
|
||||
|
||||
private void loadComplete()
|
||||
{
|
||||
|
@ -13,7 +13,6 @@ public class Settings
|
||||
public int threadCount = 1;
|
||||
public int threadPriority = Thread.MIN_PRIORITY;
|
||||
public boolean loadonstart = true;
|
||||
public boolean fastPlacement = false;
|
||||
public int compilerThreads = 4;
|
||||
public int compilerPriority = Thread.MAX_PRIORITY;
|
||||
public int decorationAccuracy = 3;
|
||||
|
@ -13,12 +13,6 @@ import ninja.bytecode.iris.generator.layer.GenLayerBase;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerBiome;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerCaves;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerLayeredNoise;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerOreCoal;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerOreDiamond;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerOreEmerald;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerOreGold;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerOreIron;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerOreLapis;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerRidge;
|
||||
import ninja.bytecode.iris.generator.populator.ObjectPopulator;
|
||||
import ninja.bytecode.iris.schematic.SchematicGroup;
|
||||
@ -64,12 +58,6 @@ public class IrisGenerator extends ParallelChunkGenerator
|
||||
private GenLayerRidge glRidge;
|
||||
private GenLayerBiome glBiome;
|
||||
private GenLayerCaves glCaves;
|
||||
private GenLayerOreIron glOreIron;
|
||||
private GenLayerOreCoal glOreCoal;
|
||||
private GenLayerOreLapis glOreLapis;
|
||||
private GenLayerOreGold glOreGold;
|
||||
private GenLayerOreEmerald glOreEmerald;
|
||||
private GenLayerOreDiamond glOreDiamond;
|
||||
private RNG rTerrain;
|
||||
private IrisDimension dim;
|
||||
private World world;
|
||||
@ -121,12 +109,6 @@ public class IrisGenerator extends ParallelChunkGenerator
|
||||
glRidge = new GenLayerRidge(this, world, random, rTerrain.nextParallelRNG(3));
|
||||
glBiome = new GenLayerBiome(this, world, random, rTerrain.nextParallelRNG(4), dim.getBiomes());
|
||||
glCaves = new GenLayerCaves(this, world, random, rTerrain.nextParallelRNG(-1));
|
||||
glOreIron = new GenLayerOreIron(this, world, random, rTerrain.nextParallelRNG(-500), 10);
|
||||
glOreLapis = new GenLayerOreLapis(this, world, random, rTerrain.nextParallelRNG(-501), 15);
|
||||
glOreCoal = new GenLayerOreCoal(this, world, random, rTerrain.nextParallelRNG(-502), 20);
|
||||
glOreGold = new GenLayerOreGold(this, world, random, rTerrain.nextParallelRNG(-503), 25);
|
||||
glOreEmerald = new GenLayerOreEmerald(this, world, random, rTerrain.nextParallelRNG(-504), 30);
|
||||
glOreDiamond = new GenLayerOreDiamond(this, world, random, rTerrain.nextParallelRNG(-505), 35);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -224,14 +206,8 @@ public class IrisGenerator extends ParallelChunkGenerator
|
||||
setBlock(x, i, z, mb.material, mb.data);
|
||||
}
|
||||
|
||||
glCaves.genCaves(wxx, wzx, x, z, height, this);
|
||||
glOreIron.genOre(wxx, wzx, x, z, height, this, biome);
|
||||
glOreLapis.genOre(wxx, wzx, x, z, height, this, biome);
|
||||
glOreCoal.genOre(wxx, wzx, x, z, height, this, biome);
|
||||
glOreGold.genOre(wxx, wzx, x, z, height, this, biome);
|
||||
glOreEmerald.genOre(wxx, wzx, x, z, height, this, biome);
|
||||
glOreDiamond.genOre(wxx, wzx, x, z, height, this, biome);
|
||||
|
||||
plan.caveMs(glCaves.genCaves(wxx, wzx, x, z, height, this));
|
||||
|
||||
return biome.getRealBiome();
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ import ninja.bytecode.iris.Iris;
|
||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||
import ninja.bytecode.iris.util.GenLayer;
|
||||
import ninja.bytecode.iris.util.MaxingGenerator;
|
||||
import ninja.bytecode.shuriken.bench.PrecisionStopwatch;
|
||||
import ninja.bytecode.shuriken.math.CNG;
|
||||
import ninja.bytecode.shuriken.math.RNG;
|
||||
|
||||
@ -29,8 +30,9 @@ public class GenLayerCaves extends GenLayer
|
||||
|
||||
}
|
||||
|
||||
public void genCaves(double wxx, double wzx, int x, int z, int s, IrisGenerator g)
|
||||
public double genCaves(double wxx, double wzx, int x, int z, int s, IrisGenerator g)
|
||||
{
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
for(double itr = 0; itr < 0.1 * Iris.settings.gen.caveDensity; itr += 0.1)
|
||||
{
|
||||
double thickness = 0.25 + itr + (0.5 * caveClamp.noise(wxx, wzx));
|
||||
@ -69,6 +71,8 @@ public class GenLayerCaves extends GenLayer
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return p.getMilliseconds();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,45 +0,0 @@
|
||||
package ninja.bytecode.iris.generator.layer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||
import ninja.bytecode.iris.spec.IrisBiome;
|
||||
import ninja.bytecode.iris.util.GenLayer;
|
||||
import ninja.bytecode.iris.util.MB;
|
||||
import ninja.bytecode.shuriken.math.CNG;
|
||||
import ninja.bytecode.shuriken.math.RNG;
|
||||
|
||||
public class GenLayerOreCoal extends GenLayer
|
||||
{
|
||||
private CNG ore;
|
||||
|
||||
public GenLayerOreCoal(IrisGenerator iris, World world, Random random, RNG rng, int shift)
|
||||
{
|
||||
//@builder
|
||||
super(iris, world, random, rng);
|
||||
ore = new CNG(rng.nextParallelRNG(281 + shift), 1D, 1).scale(0.1125).fractureWith(new CNG(rng.nextParallelRNG(412 + shift), 1D, 1)
|
||||
.scale(0.015).fractureWith(new CNG(rng.nextParallelRNG(412 + shift), 1D, 1)
|
||||
.scale(0.03), 33), 592);
|
||||
|
||||
//@done
|
||||
}
|
||||
|
||||
public void genOre(double wxx, double wzx, int x, int z, int s, IrisGenerator g, IrisBiome b)
|
||||
{
|
||||
double orenoise = ore.noise(wxx, wzx);
|
||||
|
||||
if(IrisGenerator.ROCK.contains(MB.of(g.getType(x, (int) (orenoise * 200D) - 15, z))))
|
||||
{
|
||||
g.setBlock(x, (int) (orenoise * 200D) - 15, z, Material.COAL_ORE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double generateLayer(double noise, double dx, double dz)
|
||||
{
|
||||
return noise;
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package ninja.bytecode.iris.generator.layer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||
import ninja.bytecode.iris.spec.IrisBiome;
|
||||
import ninja.bytecode.iris.util.GenLayer;
|
||||
import ninja.bytecode.iris.util.MB;
|
||||
import ninja.bytecode.shuriken.math.CNG;
|
||||
import ninja.bytecode.shuriken.math.RNG;
|
||||
|
||||
public class GenLayerOreDiamond extends GenLayer
|
||||
{
|
||||
private CNG ore;
|
||||
private CNG clamp;
|
||||
|
||||
public GenLayerOreDiamond(IrisGenerator iris, World world, Random random, RNG rng, int shift)
|
||||
{
|
||||
//@builder
|
||||
super(iris, world, random, rng);
|
||||
ore = new CNG(rng.nextParallelRNG(281 + shift), 1D, 1).scale(0.08725).fractureWith(new CNG(rng.nextParallelRNG(412 + shift), 1D, 1)
|
||||
.scale(0.015).fractureWith(new CNG(rng.nextParallelRNG(412 + shift), 1D, 1)
|
||||
.scale(0.03), 33), 592);
|
||||
clamp = new CNG(rng.nextParallelRNG(299 + shift), 1D, 1).scale(0.0325).fractureWith(new CNG(rng.nextParallelRNG(412 + shift), 1D, 1)
|
||||
.scale(0.015).fractureWith(new CNG(rng.nextParallelRNG(412 + shift), 1D, 1)
|
||||
.scale(0.03), 33), 592);
|
||||
//@done
|
||||
}
|
||||
|
||||
public void genOre(double wxx, double wzx, int x, int z, int s, IrisGenerator g, IrisBiome b)
|
||||
{
|
||||
double orenoise = ore.noise(wxx, wzx);
|
||||
|
||||
if(clamp.noise(wxx, wzx) > 0.85 && IrisGenerator.ROCK.contains(MB.of(g.getType(x, (int) (orenoise * 12D), z))))
|
||||
{
|
||||
g.setBlock(x, (int) (orenoise * 12D), z, Material.DIAMOND_ORE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double generateLayer(double noise, double dx, double dz)
|
||||
{
|
||||
return noise;
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package ninja.bytecode.iris.generator.layer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||
import ninja.bytecode.iris.spec.IrisBiome;
|
||||
import ninja.bytecode.iris.util.GenLayer;
|
||||
import ninja.bytecode.iris.util.MB;
|
||||
import ninja.bytecode.shuriken.math.CNG;
|
||||
import ninja.bytecode.shuriken.math.RNG;
|
||||
|
||||
public class GenLayerOreEmerald extends GenLayer
|
||||
{
|
||||
private CNG ore;
|
||||
|
||||
public GenLayerOreEmerald(IrisGenerator iris, World world, Random random, RNG rng, int shift)
|
||||
{
|
||||
//@builder
|
||||
super(iris, world, random, rng);
|
||||
ore = new CNG(rng.nextParallelRNG(281 + shift), 1D, 1).scale(0.1125).fractureWith(new CNG(rng.nextParallelRNG(412 + shift), 1D, 1)
|
||||
.scale(0.015).fractureWith(new CNG(rng.nextParallelRNG(412 + shift), 1D, 1)
|
||||
.scale(0.03), 33), 592);
|
||||
|
||||
//@done
|
||||
}
|
||||
|
||||
public void genOre(double wxx, double wzx, int x, int z, int s, IrisGenerator g, IrisBiome b)
|
||||
{
|
||||
double orenoise = ore.noise(wxx, wzx);
|
||||
|
||||
if(b.getScatterChanceSingle().material.equals(Material.LONG_GRASS) && b.getScatterChanceSingle().material.equals(Material.LONG_GRASS) && b.getScatterChanceSingle().material.equals(Material.LONG_GRASS) && IrisGenerator.ROCK.contains(MB.of(g.getType(x, (int) (orenoise * 32D), z))))
|
||||
{
|
||||
g.setBlock(x, (int) (orenoise * 32D), z, Material.EMERALD_ORE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double generateLayer(double noise, double dx, double dz)
|
||||
{
|
||||
return noise;
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package ninja.bytecode.iris.generator.layer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||
import ninja.bytecode.iris.spec.IrisBiome;
|
||||
import ninja.bytecode.iris.util.GenLayer;
|
||||
import ninja.bytecode.iris.util.MB;
|
||||
import ninja.bytecode.shuriken.math.CNG;
|
||||
import ninja.bytecode.shuriken.math.RNG;
|
||||
|
||||
public class GenLayerOreGold extends GenLayer
|
||||
{
|
||||
private CNG ore;
|
||||
private CNG clamp;
|
||||
|
||||
public GenLayerOreGold(IrisGenerator iris, World world, Random random, RNG rng, int shift)
|
||||
{
|
||||
//@builder
|
||||
super(iris, world, random, rng);
|
||||
ore = new CNG(rng.nextParallelRNG(281 + shift), 1D, 3).scale(0.0925).fractureWith(new CNG(rng.nextParallelRNG(412 + shift), 1D, 1)
|
||||
.scale(0.0015).fractureWith(new CNG(rng.nextParallelRNG(412 + shift), 1D, 1)
|
||||
.scale(0.03), 33), 592);
|
||||
clamp = new CNG(rng.nextParallelRNG(299 + shift), 1D, 1).scale(0.0325).fractureWith(new CNG(rng.nextParallelRNG(412 + shift), 1D, 1)
|
||||
.scale(0.015).fractureWith(new CNG(rng.nextParallelRNG(412 + shift), 1D, 1)
|
||||
.scale(0.03), 33), 592);
|
||||
//@done
|
||||
}
|
||||
|
||||
public void genOre(double wxx, double wzx, int x, int z, int s, IrisGenerator g, IrisBiome b)
|
||||
{
|
||||
double orenoise = ore.noise(wxx, wzx);
|
||||
|
||||
if(clamp.noise(wxx, wzx) > 0.75 && (int) (orenoise * 200D) - 42 < 45 && b.getSurface().contains(new MB(Material.GRASS)) && IrisGenerator.ROCK.contains(MB.of(g.getType(x, (int) (orenoise * 200D) - 42, z))))
|
||||
{
|
||||
g.setBlock(x, (int) (orenoise * 200D) - 42, z, Material.GOLD_ORE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double generateLayer(double noise, double dx, double dz)
|
||||
{
|
||||
return noise;
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package ninja.bytecode.iris.generator.layer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||
import ninja.bytecode.iris.spec.IrisBiome;
|
||||
import ninja.bytecode.iris.util.GenLayer;
|
||||
import ninja.bytecode.iris.util.MB;
|
||||
import ninja.bytecode.shuriken.math.CNG;
|
||||
import ninja.bytecode.shuriken.math.RNG;
|
||||
|
||||
public class GenLayerOreIron extends GenLayer
|
||||
{
|
||||
private CNG ore;
|
||||
|
||||
public GenLayerOreIron(IrisGenerator iris, World world, Random random, RNG rng, int shift)
|
||||
{
|
||||
//@builder
|
||||
super(iris, world, random, rng);
|
||||
ore = new CNG(rng.nextParallelRNG(281 + shift), 1D, 1).scale(0.1125).fractureWith(new CNG(rng.nextParallelRNG(412 + shift), 1D, 1)
|
||||
.scale(0.015).fractureWith(new CNG(rng.nextParallelRNG(412 + shift), 1D, 1)
|
||||
.scale(0.03), 33), 592);
|
||||
|
||||
//@done
|
||||
}
|
||||
|
||||
public void genOre(double wxx, double wzx, int x, int z, int s, IrisGenerator g, IrisBiome b)
|
||||
{
|
||||
double orenoise = ore.noise(wxx, wzx);
|
||||
|
||||
if(IrisGenerator.ROCK.contains(MB.of(g.getType(x, (int) (orenoise * 200D), z))))
|
||||
{
|
||||
g.setBlock(x, (int) (orenoise * 200D), z, Material.IRON_ORE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double generateLayer(double noise, double dx, double dz)
|
||||
{
|
||||
return noise;
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package ninja.bytecode.iris.generator.layer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||
import ninja.bytecode.iris.spec.IrisBiome;
|
||||
import ninja.bytecode.iris.util.GenLayer;
|
||||
import ninja.bytecode.iris.util.MB;
|
||||
import ninja.bytecode.shuriken.math.CNG;
|
||||
import ninja.bytecode.shuriken.math.RNG;
|
||||
|
||||
public class GenLayerOreLapis extends GenLayer
|
||||
{
|
||||
private CNG ore;
|
||||
|
||||
public GenLayerOreLapis(IrisGenerator iris, World world, Random random, RNG rng, int shift)
|
||||
{
|
||||
//@builder
|
||||
super(iris, world, random, rng);
|
||||
ore = new CNG(rng.nextParallelRNG(281 + shift), 1D, 3).scale(0.4125).fractureWith(new CNG(rng.nextParallelRNG(412 + shift), 1D, 1)
|
||||
.scale(0.0015).fractureWith(new CNG(rng.nextParallelRNG(412 + shift), 1D, 1)
|
||||
.scale(0.03), 33), 592);
|
||||
|
||||
//@done
|
||||
}
|
||||
|
||||
public void genOre(double wxx, double wzx, int x, int z, int s, IrisGenerator g, IrisBiome b)
|
||||
{
|
||||
double orenoise = ore.noise(wxx, wzx);
|
||||
|
||||
if(b.getSurface().contains(new MB(Material.SAND)) && IrisGenerator.ROCK.contains(MB.of(g.getType(x, (int) (orenoise * 200D), z))))
|
||||
{
|
||||
g.setBlock(x, (int) (orenoise * 200D), z, Material.LAPIS_ORE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double generateLayer(double noise, double dx, double dz)
|
||||
{
|
||||
return noise;
|
||||
}
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
package ninja.bytecode.iris.generator.populator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
|
||||
import ninja.bytecode.iris.schematic.Schematic;
|
||||
import ninja.bytecode.iris.spec.IrisBiome;
|
||||
import ninja.bytecode.iris.util.MB;
|
||||
|
||||
public class BiomeBiasSchematicPopulator extends SurfaceBiasSchematicPopulator
|
||||
{
|
||||
protected IrisBiome biome;
|
||||
public BiomeBiasSchematicPopulator(double chance, IrisBiome biome, Schematic... schematics)
|
||||
{
|
||||
super(chance, schematics);
|
||||
this.biome = biome;
|
||||
|
||||
for(MB i : biome.getSurface())
|
||||
{
|
||||
surface(i.material);
|
||||
}
|
||||
}
|
||||
|
||||
public void doPopulate(World world, Random random, Chunk source, int wx, int wz)
|
||||
{
|
||||
if(world.getBiome(wx, wz).equals(biome.getRealBiome()))
|
||||
{
|
||||
super.doPopulate(world, random, source, wx, wz);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((biome == null) ? 0 : biome.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if(this == obj)
|
||||
return true;
|
||||
if(!super.equals(obj))
|
||||
return false;
|
||||
if(getClass() != obj.getClass())
|
||||
return false;
|
||||
BiomeBiasSchematicPopulator other = (BiomeBiasSchematicPopulator) obj;
|
||||
if(biome == null)
|
||||
{
|
||||
if(other.biome != null)
|
||||
return false;
|
||||
}
|
||||
else if(!biome.equals(other.biome))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package ninja.bytecode.iris.generator.populator;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.Block;
|
||||
@ -45,6 +46,7 @@ public class ObjectPopulator extends BlockPopulator
|
||||
@Override
|
||||
public void populate(World world, Random random, Chunk source)
|
||||
{
|
||||
Iris.started("decor");
|
||||
GSet<Biome> hits = new GSet<>();
|
||||
|
||||
for(int i = 0; i < Iris.settings.performance.decorationAccuracy; i++)
|
||||
@ -73,11 +75,13 @@ public class ObjectPopulator extends BlockPopulator
|
||||
}
|
||||
|
||||
hits.add(biome);
|
||||
populate(world, random, source, biome, objects);
|
||||
populate(world, random, source, biome, ibiome, objects);
|
||||
}
|
||||
|
||||
Iris.stopped("decor");
|
||||
}
|
||||
|
||||
private void populate(World world, Random random, Chunk source, Biome biome, GMap<SchematicGroup, Double> objects)
|
||||
private void populate(World world, Random random, Chunk source, Biome biome, IrisBiome ibiome, GMap<SchematicGroup, Double> objects)
|
||||
{
|
||||
for(SchematicGroup i : objects.k())
|
||||
{
|
||||
@ -85,14 +89,15 @@ public class ObjectPopulator extends BlockPopulator
|
||||
{
|
||||
int x = (source.getX() << 4) + random.nextInt(16);
|
||||
int z = (source.getZ() << 4) + random.nextInt(16);
|
||||
Block b = world.getHighestBlockAt(x, z);
|
||||
Block b = world.getHighestBlockAt(x, z).getRelative(BlockFace.DOWN);
|
||||
Material t = b.getType();
|
||||
|
||||
if(!b.getRelative(BlockFace.DOWN).getType().isSolid())
|
||||
if(!t.isSolid() || !ibiome.isSurface(t))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
i.getSchematics().get(random.nextInt(i.getSchematics().size())).place(world, x, b.getY() - 1, z);
|
||||
i.getSchematics().get(random.nextInt(i.getSchematics().size())).place(world, x, b.getY(), z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,60 +0,0 @@
|
||||
package ninja.bytecode.iris.generator.populator;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import ninja.bytecode.iris.schematic.Schematic;
|
||||
import ninja.bytecode.iris.util.ChancedPopulator;
|
||||
|
||||
public class SchematicPopulator extends ChancedPopulator
|
||||
{
|
||||
protected final Schematic[] schematics;
|
||||
|
||||
public SchematicPopulator(double chance, Schematic... schematics)
|
||||
{
|
||||
super(chance);
|
||||
this.schematics = schematics;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doPopulate(World world, Random random, Chunk source, int wx, int wz)
|
||||
{
|
||||
Block b = world.getHighestBlockAt(wx, wz);
|
||||
|
||||
if(!b.getRelative(BlockFace.DOWN).getType().isSolid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
schematics[random.nextInt(schematics.length)].place(world, wx, b.getY() - 1, wz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + Arrays.hashCode(schematics);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if(this == obj)
|
||||
return true;
|
||||
if(!super.equals(obj))
|
||||
return false;
|
||||
if(getClass() != obj.getClass())
|
||||
return false;
|
||||
SchematicPopulator other = (SchematicPopulator) obj;
|
||||
if(!Arrays.equals(schematics, other.schematics))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
package ninja.bytecode.iris.generator.populator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import ninja.bytecode.iris.schematic.Schematic;
|
||||
import ninja.bytecode.shuriken.collections.GList;
|
||||
|
||||
public class SurfaceBiasSchematicPopulator extends SchematicPopulator
|
||||
{
|
||||
private GList<Material> bias;
|
||||
|
||||
public SurfaceBiasSchematicPopulator(double chance, Schematic... schematics)
|
||||
{
|
||||
super(chance, schematics);
|
||||
this.bias = new GList<>();
|
||||
}
|
||||
|
||||
public SurfaceBiasSchematicPopulator surface(Material mb)
|
||||
{
|
||||
bias.add(mb);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((bias == null) ? 0 : bias.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if(this == obj)
|
||||
return true;
|
||||
if(!super.equals(obj))
|
||||
return false;
|
||||
if(getClass() != obj.getClass())
|
||||
return false;
|
||||
SurfaceBiasSchematicPopulator other = (SurfaceBiasSchematicPopulator) obj;
|
||||
if(bias == null)
|
||||
{
|
||||
if(other.bias != null)
|
||||
return false;
|
||||
}
|
||||
else if(!bias.equals(other.bias))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doPopulate(World world, Random random, Chunk source, int wx, int wz)
|
||||
{
|
||||
if(schematics.length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Block b = world.getHighestBlockAt(wx, wz);
|
||||
|
||||
for(Material i : bias)
|
||||
{
|
||||
if(b.getRelative(BlockFace.DOWN).getType().equals(i))
|
||||
{
|
||||
schematics[random.nextInt(schematics.length)].place(world, wx, b.getY() - 1, wz);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -7,21 +7,17 @@ import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.material.Button;
|
||||
import org.bukkit.material.Directional;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.util.BlockVector;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import ninja.bytecode.iris.Iris;
|
||||
import ninja.bytecode.iris.util.Catalyst12;
|
||||
import ninja.bytecode.iris.util.Direction;
|
||||
import ninja.bytecode.iris.util.MB;
|
||||
import ninja.bytecode.iris.util.VectorMath;
|
||||
@ -235,16 +231,7 @@ public class Schematic
|
||||
{
|
||||
for(Location j : undo.k())
|
||||
{
|
||||
if(Iris.settings.performance.fastPlacement)
|
||||
{
|
||||
Catalyst12.setBlock(source, j.getBlockX(), j.getBlockY(), j.getBlockZ(), undo.get(j));
|
||||
Iris.refresh.add(j.getChunk());
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
source.getBlockAt(j.getBlockX(), j.getBlockY(), j.getBlockZ()).setTypeIdAndData(undo.get(j).material.getId(), undo.get(j).data, false);
|
||||
}
|
||||
source.getBlockAt(j.getBlockX(), j.getBlockY(), j.getBlockZ()).setTypeIdAndData(undo.get(j).material.getId(), undo.get(j).data, false);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -258,16 +245,7 @@ public class Schematic
|
||||
try
|
||||
{
|
||||
undo.put(f, MB.of(f.getBlock().getType(), f.getBlock().getData()));
|
||||
if(Iris.settings.performance.fastPlacement)
|
||||
{
|
||||
Iris.refresh.add(f.getChunk());
|
||||
Catalyst12.setBlock(source, f.getBlockX(), f.getBlockY(), f.getBlockZ(), b);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
source.getBlockAt(f.getBlockX(), f.getBlockY(), f.getBlockZ()).setTypeIdAndData(b.material.getId(), b.data, false);
|
||||
}
|
||||
source.getBlockAt(f.getBlockX(), f.getBlockY(), f.getBlockZ()).setTypeIdAndData(b.material.getId(), b.data, false);
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
|
@ -462,4 +462,17 @@ public class IrisBiome
|
||||
{
|
||||
return schematicGroups;
|
||||
}
|
||||
|
||||
public boolean isSurface(Material t)
|
||||
{
|
||||
for(MB i : surface)
|
||||
{
|
||||
if(i.material.equals(t))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ public class ChunkPlan
|
||||
private final GMap<ChunkedVector, Double> heightCache;
|
||||
private final GMap<ChunkedVector, IrisBiome> biomeCache;
|
||||
private final GMap<BlockVector, Schematic> schematics;
|
||||
private double caveMs;
|
||||
|
||||
public ChunkPlan()
|
||||
{
|
||||
@ -21,6 +22,11 @@ public class ChunkPlan
|
||||
this.biomeCache = new GMap<>();
|
||||
}
|
||||
|
||||
public double getCaveMs()
|
||||
{
|
||||
return caveMs;
|
||||
}
|
||||
|
||||
public void planSchematic(BlockVector b, Schematic s)
|
||||
{
|
||||
schematics.put(b, s);
|
||||
@ -68,4 +74,9 @@ public class ChunkPlan
|
||||
{
|
||||
setHeight(new ChunkedVector(x, z), h);
|
||||
}
|
||||
|
||||
public void caveMs(double genCaves)
|
||||
{
|
||||
caveMs += genCaves;
|
||||
}
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
|
||||
|
||||
public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome)
|
||||
{
|
||||
Iris.started("terrain");
|
||||
this.world = world;
|
||||
Shuriken.profiler.start("chunkgen-" + world.getName());
|
||||
data = new AtomicChunkData(world);
|
||||
|
||||
try
|
||||
@ -75,7 +75,7 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
|
||||
TaskResult r = tg.execute();
|
||||
onPostChunk(world, x, z, random, data, plan.get());
|
||||
rs.put(r.timeElapsed);
|
||||
Shuriken.profiler.stop("chunkgen-" + world.getName());
|
||||
Iris.profiler.getResult("caves").put(plan.get().getCaveMs());
|
||||
cg++;
|
||||
}
|
||||
|
||||
@ -95,6 +95,8 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
|
||||
}
|
||||
}
|
||||
|
||||
Iris.stopped("terrain");
|
||||
|
||||
return data.toChunkData();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user