mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-05 15:26:28 +00:00
Tweaks
This commit is contained in:
@@ -11,7 +11,6 @@ import org.bukkit.generator.BlockPopulator;
|
||||
import ninja.bytecode.iris.Iris;
|
||||
import ninja.bytecode.iris.controller.PackController;
|
||||
import ninja.bytecode.iris.generator.genobject.GenObjectDecorator;
|
||||
import ninja.bytecode.iris.generator.layer.BiomeNoiseGenerator;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerBiome;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerCarving;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerCaverns;
|
||||
@@ -67,7 +66,6 @@ public class IrisGenerator extends ParallelChunkGenerator
|
||||
private GenLayerCarving glCarving;
|
||||
private GenLayerCaverns glCaverns;
|
||||
private GenLayerSnow glSnow;
|
||||
private BiomeNoiseGenerator glBase;
|
||||
private GenLayerCliffs glCliffs;
|
||||
private RNG rTerrain;
|
||||
private CompiledDimension dim;
|
||||
@@ -145,7 +143,17 @@ public class IrisGenerator extends ParallelChunkGenerator
|
||||
|
||||
public IrisBiome getBiome(int wxx, int wzx)
|
||||
{
|
||||
return glBiome.getBiome(wxx, wzx);
|
||||
IrisBiome biome = glBiome.getBiome(wxx, wzx);
|
||||
IrisBiome real = glBiome.getBiome(wxx, wzx, true);
|
||||
boolean frozen = getRegion(biome) != null ? getRegion(biome).isFrozen() : false;
|
||||
int height = computeHeight(wxx, wzx, new ChunkPlan(), biome);
|
||||
int max = Math.max(height, Iris.settings.gen.seaLevel);
|
||||
IrisBiome nbiome = height < 63 ? getOcean(real, height) : biome;
|
||||
biome = nbiome;
|
||||
biome = height > 61 && height < 65 ? frozen ? biome : getBeach(real) : biome;
|
||||
biome = height > 63 && biome.getType().equals(BiomeType.FLUID) ? getBeach(real) : biome;
|
||||
|
||||
return biome;
|
||||
}
|
||||
|
||||
public IrisBiome biome(String name)
|
||||
@@ -236,14 +244,11 @@ public class IrisGenerator extends ParallelChunkGenerator
|
||||
int highest = 0;
|
||||
int seaLevel = Iris.settings.gen.seaLevel;
|
||||
IrisBiome biome = getBiome(wxx, wzx);
|
||||
boolean frozen = getRegion(biome) != null ? getRegion(biome).isFrozen() : false;
|
||||
IrisRegion r = getRegion(biome);
|
||||
boolean frozen = r != null && r.isFrozen();
|
||||
int height = computeHeight(wxx, wzx, plan, biome);
|
||||
int max = Math.max(height, seaLevel);
|
||||
IrisBiome nbiome = height < 63 ? getOcean(biome, height) : biome;
|
||||
biome = nbiome;
|
||||
biome = height > 61 && height < 65 ? frozen ? biome : getBeach(biome) : biome;
|
||||
biome = height > 63 && biome.getType().equals(BiomeType.FLUID) ? getBeach(biome) : biome;
|
||||
|
||||
|
||||
for(int i = 0; i < max; i++)
|
||||
{
|
||||
MB mb = ROCK.get(scatterInt(wzx, i, wxx, ROCK.size()));
|
||||
|
||||
@@ -15,6 +15,9 @@ import org.bukkit.util.BlockVector;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mortar.compute.math.M;
|
||||
import mortar.logic.format.F;
|
||||
import mortar.util.text.C;
|
||||
import ninja.bytecode.iris.Iris;
|
||||
import ninja.bytecode.iris.generator.placer.NMSPlacer;
|
||||
import ninja.bytecode.iris.util.Direction;
|
||||
import ninja.bytecode.iris.util.IPlacer;
|
||||
@@ -225,17 +228,17 @@ public class GenObject
|
||||
return g % 2 == 0 ? m : m + 1;
|
||||
}
|
||||
|
||||
public void place(Location l)
|
||||
public Location place(Location l)
|
||||
{
|
||||
place(l, new NMSPlacer(l.getWorld()));
|
||||
return place(l, new NMSPlacer(l.getWorld()));
|
||||
}
|
||||
|
||||
public void place(Location l, IPlacer placer)
|
||||
public Location place(Location l, IPlacer placer)
|
||||
{
|
||||
place(l.getBlockX(), l.getBlockY(), l.getBlockZ(), placer);
|
||||
return place(l.getBlockX(), l.getBlockY(), l.getBlockZ(), placer);
|
||||
}
|
||||
|
||||
public void place(int wx, int wy, int wz, IPlacer placer)
|
||||
public Location place(int wx, int wy, int wz, IPlacer placer)
|
||||
{
|
||||
Location start = new Location(placer.getWorld(), wx, wy, wz).clone().add(sh(w), sh(h) + 1, sh(d));
|
||||
|
||||
@@ -275,7 +278,12 @@ public class GenObject
|
||||
placer.set(j, undo.get(j));
|
||||
}
|
||||
|
||||
return;
|
||||
if(Iris.settings.performance.verbose)
|
||||
{
|
||||
L.w(C.WHITE + "Object " + C.YELLOW + getName() + C.WHITE + " failed to place in " + C.YELLOW + m.toString().toLowerCase() + C.WHITE + " at " + C.YELLOW + F.f(f.getBlockX()) + " " + F.f(f.getBlockY()) + " " + F.f(f.getBlockZ()));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if(b.material.equals(Material.SKULL))
|
||||
@@ -294,6 +302,8 @@ public class GenObject
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return start;
|
||||
}
|
||||
|
||||
public static GenObject load(InputStream in) throws IOException
|
||||
|
||||
@@ -3,12 +3,15 @@ package ninja.bytecode.iris.generator.genobject;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
|
||||
import mortar.logic.format.F;
|
||||
import mortar.util.text.C;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import ninja.bytecode.iris.Iris;
|
||||
import ninja.bytecode.iris.controller.TimingsController;
|
||||
@@ -38,7 +41,7 @@ public class GenObjectDecorator extends BlockPopulator
|
||||
for(IrisBiome i : generator.getDimension().getBiomes())
|
||||
{
|
||||
GMap<GenObjectGroup, Double> gc = new GMap<>();
|
||||
|
||||
int ff = 0;
|
||||
for(String j : i.getSchematicGroups().k())
|
||||
{
|
||||
double c = i.getSchematicGroups().get(j);
|
||||
@@ -46,7 +49,7 @@ public class GenObjectDecorator extends BlockPopulator
|
||||
try
|
||||
{
|
||||
GenObjectGroup g = generator.getDimension().getObjectGroup(j);
|
||||
|
||||
ff += g.size();
|
||||
gc.put(g, c);
|
||||
}
|
||||
|
||||
@@ -60,6 +63,11 @@ public class GenObjectDecorator extends BlockPopulator
|
||||
if(!gc.isEmpty())
|
||||
{
|
||||
populationCache.put(i, gc);
|
||||
|
||||
if(Iris.settings.performance.verbose)
|
||||
{
|
||||
L.v(C.DARK_GREEN + i.getName() + ": " + C.DARK_AQUA + F.f(ff) + " Objects");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,7 +85,7 @@ public class GenObjectDecorator extends BlockPopulator
|
||||
{
|
||||
int x = (source.getX() << 4) + random.nextInt(16);
|
||||
int z = (source.getZ() << 4) + random.nextInt(16);
|
||||
IrisBiome biome = g.getBiome(x, z);
|
||||
IrisBiome biome = g.getBiome((int) g.getOffsetX(x), (int) g.getOffsetX(z));
|
||||
|
||||
if(hits.contains(biome))
|
||||
{
|
||||
@@ -102,6 +110,11 @@ public class GenObjectDecorator extends BlockPopulator
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if(Iris.settings.performance.verbose)
|
||||
{
|
||||
L.flush();
|
||||
}
|
||||
}
|
||||
|
||||
private void populate(World world, Random random, Chunk source, IrisBiome biome, GMap<GenObjectGroup, Double> objects)
|
||||
@@ -110,30 +123,39 @@ public class GenObjectDecorator extends BlockPopulator
|
||||
{
|
||||
for(int j = 0; j < getTries(objects.get(i)); j++)
|
||||
{
|
||||
int x = (source.getX() << 4) + random.nextInt(16);
|
||||
int z = (source.getZ() << 4) + random.nextInt(16);
|
||||
Block b = world.getHighestBlockAt(x, z).getRelative(BlockFace.DOWN);
|
||||
Material t = b.getType();
|
||||
|
||||
if(!t.isSolid() || !biome.isSurface(t))
|
||||
if(M.r(Iris.settings.gen.objectDensity))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
int x = (source.getX() << 4) + random.nextInt(16);
|
||||
int z = (source.getZ() << 4) + random.nextInt(16);
|
||||
Block b = world.getHighestBlockAt(x, z).getRelative(BlockFace.DOWN);
|
||||
Material t = b.getType();
|
||||
|
||||
if(placer == null)
|
||||
{
|
||||
if(Iris.settings.performance.fastDecoration)
|
||||
if(!t.isSolid() || !biome.isSurface(t))
|
||||
{
|
||||
placer = new NMSPlacer(world);
|
||||
continue;
|
||||
}
|
||||
|
||||
else
|
||||
if(placer == null)
|
||||
{
|
||||
placer = new BukkitPlacer(world, false);
|
||||
if(Iris.settings.performance.fastDecoration)
|
||||
{
|
||||
placer = new NMSPlacer(world);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
placer = new BukkitPlacer(world, false);
|
||||
}
|
||||
}
|
||||
|
||||
GenObject g = i.getSchematics().get(random.nextInt(i.getSchematics().size()));
|
||||
Location start = g.place(x, b.getY(), z, placer);
|
||||
|
||||
if(start != null && Iris.settings.performance.verbose)
|
||||
{
|
||||
L.v(C.GRAY + "Placed " + C.DARK_GREEN + i.getName() + C.WHITE + "/" + C.DARK_GREEN + g.getName() + C.GRAY + " at " + C.DARK_GREEN + F.f(start.getBlockX()) + " " + F.f(start.getBlockY()) + " " + F.f(start.getBlockZ()));
|
||||
}
|
||||
}
|
||||
|
||||
i.getSchematics().get(random.nextInt(i.getSchematics().size())).place(x, b.getY(), z, placer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
@@ -196,34 +195,42 @@ public class GenObjectGroup
|
||||
|
||||
public void processVariants()
|
||||
{
|
||||
TaskExecutor te = new TaskExecutor(Runtime.getRuntime().availableProcessors(), Thread.MAX_PRIORITY, "Variant Processor");
|
||||
TaskGroup g = te.startWork();
|
||||
GList<GenObject> inject = new GList<>();
|
||||
String x = Thread.currentThread().getName();
|
||||
ReentrantLock rr = new ReentrantLock();
|
||||
for(GenObject i : getSchematics())
|
||||
{
|
||||
for(Direction j : new Direction[] {Direction.S, Direction.E, Direction.W})
|
||||
{
|
||||
GenObject cp = i.copy();
|
||||
GenObject f = cp;
|
||||
f.rotate(Direction.N, j);
|
||||
rr.lock();
|
||||
inject.add(f);
|
||||
rr.unlock();
|
||||
g.queue(() ->
|
||||
{
|
||||
GenObject cp = i.copy();
|
||||
GenObject f = cp;
|
||||
f.rotate(Direction.N, j);
|
||||
inject.add(f);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
g.execute();
|
||||
getSchematics().add(inject);
|
||||
|
||||
g = te.startWork();
|
||||
for(GenObject i : getSchematics())
|
||||
{
|
||||
i.recalculateMountShift();
|
||||
|
||||
for(String j : flags)
|
||||
g.queue(() ->
|
||||
{
|
||||
i.computeFlag(j);
|
||||
}
|
||||
i.recalculateMountShift();
|
||||
|
||||
for(String j : flags)
|
||||
{
|
||||
i.computeFlag(j);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
g.execute();
|
||||
te.close();
|
||||
|
||||
L.i(ChatColor.LIGHT_PURPLE + "Processed " + ChatColor.WHITE + F.f(schematics.size()) + ChatColor.LIGHT_PURPLE + " Schematics in " + ChatColor.WHITE + name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package ninja.bytecode.iris.generator.layer;
|
||||
|
||||
import ninja.bytecode.iris.pack.IrisBiome;
|
||||
import ninja.bytecode.iris.util.GenLayer;
|
||||
import ninja.bytecode.shuriken.math.CNG;
|
||||
import ninja.bytecode.shuriken.math.RNG;
|
||||
|
||||
|
||||
@@ -123,11 +123,22 @@ public class GenLayerBiome extends GenLayer
|
||||
}
|
||||
|
||||
public IrisBiome getBiome(double wxx, double wzx)
|
||||
{
|
||||
return getBiome(wxx, wzx, false);
|
||||
}
|
||||
|
||||
public IrisBiome getBiome(double wxx, double wzx, boolean real)
|
||||
{
|
||||
double wx = Math.round((double) wxx * (Iris.settings.gen.horizontalZoom / 1.90476190476)) * Iris.settings.gen.biomeScale;
|
||||
double wz = Math.round((double) wzx * (Iris.settings.gen.horizontalZoom / 1.90476190476)) * Iris.settings.gen.biomeScale;
|
||||
double x = wx + (Iris.settings.gen.biomeEdgeScramble == 0 ? 0 : (fracture.noise(wz, wx) * Iris.settings.gen.biomeEdgeScramble));
|
||||
double z = wz - (Iris.settings.gen.biomeEdgeScramble == 0 ? 0 : (fracture.noise(wx, wz) * Iris.settings.gen.biomeEdgeScramble));
|
||||
|
||||
if(real)
|
||||
{
|
||||
return getRegionGenerator(x, z).getChoice(x, z);
|
||||
}
|
||||
|
||||
IrisBiome cbi = iris.biome("Ocean");
|
||||
double land = island.noise(x, z);
|
||||
double landChance = 1D - M.clip(Iris.settings.gen.landChance, 0D, 1D);
|
||||
|
||||
Reference in New Issue
Block a user