mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Kboom
This commit is contained in:
parent
921e5912b3
commit
72d4c7eb40
@ -46,6 +46,7 @@ import ninja.bytecode.iris.util.Desc;
|
||||
import ninja.bytecode.iris.util.Direction;
|
||||
import ninja.bytecode.iris.util.GroupedExecutor;
|
||||
import ninja.bytecode.iris.util.IO;
|
||||
import ninja.bytecode.iris.util.RNG;
|
||||
import ninja.bytecode.iris.util.ScoreDirection;
|
||||
import ninja.bytecode.iris.wand.WandController;
|
||||
import ninja.bytecode.shuriken.collections.KList;
|
||||
@ -207,6 +208,7 @@ public class Iris extends JavaPlugin implements BoardProvider
|
||||
{
|
||||
imsg(sender, "/iris dev [dimension] - Create a new dev world");
|
||||
imsg(sender, "/iris what <look/hand> - Data about items & blocks");
|
||||
imsg(sender, "/iris goto <name> - Fast goto biome");
|
||||
imsg(sender, "/iris wand [?] - Get a wand / help");
|
||||
imsg(sender, "/iris save <name> - Save object");
|
||||
imsg(sender, "/iris load <name> - Load & place object");
|
||||
@ -214,6 +216,41 @@ public class Iris extends JavaPlugin implements BoardProvider
|
||||
|
||||
if(args.length >= 1)
|
||||
{
|
||||
if(args[0].equalsIgnoreCase("goto") && args.length == 2)
|
||||
{
|
||||
if(sender instanceof Player)
|
||||
{
|
||||
Player p = (Player) sender;
|
||||
World world = p.getWorld();
|
||||
IrisChunkGenerator g = (IrisChunkGenerator) world.getGenerator();
|
||||
int tries = 10000;
|
||||
IrisBiome biome = data.getBiomeLoader().load(args[1]);
|
||||
|
||||
if(biome == null)
|
||||
{
|
||||
sender.sendMessage("Not a biome. Use the file name (without extension)");
|
||||
}
|
||||
|
||||
while(tries > 0)
|
||||
{
|
||||
tries--;
|
||||
|
||||
int xx = (int) (RNG.r.i(-29999970, 29999970));
|
||||
int zz = (int) (RNG.r.i(-29999970, 29999970));
|
||||
if(g.sampleTrueBiome(xx, zz).getBiome().getLoadKey().equals(biome.getLoadKey()))
|
||||
{
|
||||
p.teleport(new Location(world, xx, world.getHighestBlockYAt(xx, zz), zz));
|
||||
sender.sendMessage("Found in " + (10000 - tries) + "!");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage("Tried to find " + biome.getName() + " looked in 10,000 places no dice.");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("what"))
|
||||
{
|
||||
if(args.length != 2)
|
||||
|
@ -118,6 +118,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
||||
int height = (int) Math.round(noise) + fluidHeight;
|
||||
IrisBiome biome = sampleTrueBiome(rx, rz).getBiome();
|
||||
KList<BlockData> layers = biome.generateLayers(wx, wz, masterRandom, height);
|
||||
KList<BlockData> seaLayers = biome.isSea() ? biome.generateSeaLayers(wx, wz, masterRandom, fluidHeight - height) : new KList<>();
|
||||
|
||||
for(int k = Math.max(height, fluidHeight); k < 255; k++)
|
||||
{
|
||||
@ -150,7 +151,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
||||
|
||||
if(underwater)
|
||||
{
|
||||
block = WATER;
|
||||
block = seaLayers.hasIndex(fluidHeight - k) ? layers.get(depth) : WATER;
|
||||
}
|
||||
|
||||
else
|
||||
@ -219,14 +220,14 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
||||
|
||||
if(stack == 1)
|
||||
{
|
||||
sliver.setSilently(k + 1, d);
|
||||
sliver.set(k + 1, d);
|
||||
}
|
||||
|
||||
else if(k < 255 - stack)
|
||||
{
|
||||
for(int l = 0; l < stack; l++)
|
||||
{
|
||||
sliver.setSilently(k + l + 1, d);
|
||||
sliver.set(k + l + 1, d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,9 @@ public class IrisBiome extends IrisRegistrant
|
||||
@Desc("This defines the layers of materials in this biome. Each layer has a palette and min/max height and some other properties. Usually a grassy/sandy layer then a dirt layer then a stone layer. Iris will fill in the remaining blocks below your layers with stone.")
|
||||
private KList<IrisBiomePaletteLayer> layers = new KList<IrisBiomePaletteLayer>().qadd(new IrisBiomePaletteLayer());
|
||||
|
||||
@Desc("This defines the layers of materials in this biome. Each layer has a palette and min/max height and some other properties. Usually a grassy/sandy layer then a dirt layer then a stone layer. Iris will fill in the remaining blocks below your layers with stone.")
|
||||
private KList<IrisBiomePaletteLayer> seaLayers = new KList<IrisBiomePaletteLayer>();
|
||||
|
||||
@Desc("Decorators are used for things like tall grass, bisected flowers, and even kelp or cactus (random heights)")
|
||||
private KList<IrisBiomeDecorator> decorators = new KList<IrisBiomeDecorator>();
|
||||
|
||||
@ -60,7 +63,9 @@ public class IrisBiome extends IrisRegistrant
|
||||
private transient InferredType inferredType;
|
||||
private transient CNG biomeGenerator;
|
||||
private transient KList<CNG> layerHeightGenerators;
|
||||
private transient KList<CNG> layerSeaHeightGenerators;
|
||||
private transient KList<CNG> layerSurfaceGenerators;
|
||||
private transient KList<CNG> layerSeaSurfaceGenerators;
|
||||
|
||||
public IrisBiome()
|
||||
{
|
||||
@ -141,6 +146,47 @@ public class IrisBiome extends IrisRegistrant
|
||||
return data;
|
||||
}
|
||||
|
||||
public KList<BlockData> generateSeaLayers(double wx, double wz, RNG random, int maxDepth)
|
||||
{
|
||||
KList<BlockData> data = new KList<>();
|
||||
|
||||
for(int i = 0; i < seaLayers.size(); i++)
|
||||
{
|
||||
CNG hgen = getLayerSeaHeightGenerators(random).get(i);
|
||||
int d = hgen.fit(seaLayers.get(i).getMinHeight(), seaLayers.get(i).getMaxHeight(), wx / seaLayers.get(i).getTerrainZoom(), wz / seaLayers.get(i).getTerrainZoom());
|
||||
|
||||
if(d < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for(int j = 0; j < d; j++)
|
||||
{
|
||||
if(data.size() >= maxDepth)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
data.add(getSeaLayers().get(i).get(random.nextParallelRNG(i + j), (wx + j) / seaLayers.get(i).getTerrainZoom(), j, (wz - j) / seaLayers.get(i).getTerrainZoom()));
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
L.ex(e);
|
||||
}
|
||||
}
|
||||
|
||||
if(data.size() >= maxDepth)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public KList<CNG> getLayerHeightGenerators(RNG rng)
|
||||
{
|
||||
lock.lock();
|
||||
@ -160,6 +206,25 @@ public class IrisBiome extends IrisRegistrant
|
||||
return layerHeightGenerators;
|
||||
}
|
||||
|
||||
public KList<CNG> getLayerSeaHeightGenerators(RNG rng)
|
||||
{
|
||||
lock.lock();
|
||||
if(layerSeaHeightGenerators == null)
|
||||
{
|
||||
layerSeaHeightGenerators = new KList<>();
|
||||
|
||||
int m = 7735;
|
||||
|
||||
for(IrisBiomePaletteLayer i : getSeaLayers())
|
||||
{
|
||||
layerSeaHeightGenerators.add(i.getHeightGenerator(rng.nextParallelRNG((m++) * m * m * m)));
|
||||
}
|
||||
}
|
||||
lock.unlock();
|
||||
|
||||
return layerSeaHeightGenerators;
|
||||
}
|
||||
|
||||
public boolean isLand()
|
||||
{
|
||||
if(inferredType == null)
|
||||
|
@ -44,6 +44,7 @@ public class IrisBiomeDecorator
|
||||
private transient KMap<Long, CNG> layerGenerators;
|
||||
private transient CNG heightGenerator;
|
||||
private transient KList<BlockData> blockData;
|
||||
private transient RNG nrng;
|
||||
|
||||
public int getHeight(RNG rng, double x, double z)
|
||||
{
|
||||
@ -105,11 +106,19 @@ public class IrisBiomeDecorator
|
||||
return null;
|
||||
}
|
||||
|
||||
if(getGenerator(rng).fitDoubleD(0D, 1D, x * (dispersion.equals(Dispersion.SCATTER) ? 1000D : 1D), z * (dispersion.equals(Dispersion.SCATTER) ? 1000D : 1D)) <= chance)
|
||||
if(nrng == null)
|
||||
{
|
||||
nrng = rng.nextParallelRNG(2398552 + hashCode());
|
||||
}
|
||||
|
||||
double xx = dispersion.equals(Dispersion.SCATTER) ? nrng.i(-100000, 100000) : x;
|
||||
double zz = dispersion.equals(Dispersion.SCATTER) ? nrng.i(-100000, 100000) : z;
|
||||
|
||||
if(getGenerator(rng).fitDoubleD(0D, 1D, xx, zz) <= chance)
|
||||
{
|
||||
try
|
||||
{
|
||||
return getBlockData().get(getGenerator(rng.nextParallelRNG(53)).fit(0, getBlockData().size() - 1, x * (dispersion.equals(Dispersion.SCATTER) ? 1000D : 1D), z * (dispersion.equals(Dispersion.SCATTER) ? 1000D : 1D)));
|
||||
return getBlockData().get(getGenerator(rng.nextParallelRNG(53)).fit(0, getBlockData().size() - 1, xx, zz));
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user