Settings & Schematic Fixes

This commit is contained in:
Daniel Mills 2020-01-08 08:20:17 -05:00
parent 11e74ef6cc
commit 4094034aaf
4 changed files with 64 additions and 9 deletions

View File

@ -12,7 +12,8 @@ public class Settings
public PerformanceMode performanceMode = PerformanceMode.MATCH_CPU;
public int threadCount = 1;
public int threadPriority = Thread.MIN_PRIORITY;
public boolean loadonstart = true;
public boolean loadonstart = false;
public boolean fastPlacement = false;
}
public static class GeneratorSettings

View File

@ -217,7 +217,7 @@ public class IrisGenerator extends ParallelChunkGenerator
mb = BEDROCK;
}
if(Iris.settings.gen.flatBedrock ? i == 1 : i < glBase.scatterInt(x, i, z, 3))
if(!Iris.settings.gen.flatBedrock ? i <= 2 : i < glBase.scatterInt(x, i, z, 3))
{
mb = BEDROCK;
}

View File

@ -7,11 +7,16 @@ 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;
@ -229,11 +234,19 @@ public class Schematic
if(i.getBlockY() == mountHeight && f.clone().subtract(0, 1, 0).getBlock().isLiquid())
{
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);
}
}
return;
}
@ -244,11 +257,19 @@ public class Schematic
try
{
Iris.refresh.add(f.getChunk());
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);
}
}
catch(Throwable e)
{
e.printStackTrace();
@ -288,12 +309,46 @@ public class Schematic
for(BlockVector i : g.k())
{
s.put(VectorMath.rotate(from, to, i).toBlockVector(), g.get(i));
MB mb = rotate(from, to, g.get(i));
s.put(VectorMath.rotate(from, to, i).toBlockVector(), mb);
}
name = name + "-rt" + to.name();
}
@SuppressWarnings("deprecation")
private MB rotate(Direction from, Direction to, MB mb)
{
Class<? extends MaterialData> cl = mb.material.getData();
if(cl.isAssignableFrom(Directional.class))
{
try
{
Directional d = (Directional) cl.getConstructor(int.class, byte.class).newInstance(mb.material.getId(), mb.data);
BlockFace f = d.getFacing();
Vector mod = new Vector(f.getModX(), f.getModY(), f.getModZ());
Vector modded = VectorMath.rotate(from, to, mod);
for(BlockFace i : BlockFace.values())
{
if(i.getModX() == modded.getBlockX() && i.getModY() == modded.getBlockY() && i.getModZ() == modded.getBlockZ())
{
d.setFacingDirection(i);
return new MB(mb.material, ((MaterialData) d).getData());
}
}
}
catch(Throwable e)
{
e.printStackTrace();
}
}
return mb;
}
public void computeFlag(String j)
{
try

View File

@ -143,7 +143,6 @@ public class SchematicGroup
gg.execute();
gg = Iris.buildPool.startWork();
getSchematics().add(inject);
L.v("# Generated " + inject.size() + " Rotated Objects to " + getName());