mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-01 23:47:21 +00:00
Tweaks
This commit is contained in:
parent
c2d7fe8612
commit
e1e47caf72
@ -9,10 +9,10 @@ public class Settings
|
||||
|
||||
public static class PerformanceSettings
|
||||
{
|
||||
public PerformanceMode performanceMode = PerformanceMode.MATCH_CPU;
|
||||
public PerformanceMode performanceMode = PerformanceMode.HALF_CPU;
|
||||
public int threadCount = 12;
|
||||
public int threadPriority = Thread.MIN_PRIORITY;
|
||||
public boolean loadonstart = true;
|
||||
public boolean loadonstart = false;
|
||||
}
|
||||
|
||||
public static class GeneratorSettings
|
||||
|
@ -316,6 +316,8 @@ public class IrisGenerator extends ParallelChunkGenerator
|
||||
J.attempt(() -> g.setPriority(Integer.valueOf(i.split("\\Q=\\E")[1]).intValue()));
|
||||
}
|
||||
}
|
||||
|
||||
g.generateRotationVariants();
|
||||
|
||||
schematicCache.put(folder, g);
|
||||
return g;
|
||||
|
@ -15,7 +15,9 @@ import org.bukkit.World;
|
||||
import org.bukkit.util.BlockVector;
|
||||
|
||||
import ninja.bytecode.iris.util.Catalyst12;
|
||||
import ninja.bytecode.iris.util.Direction;
|
||||
import ninja.bytecode.iris.util.MB;
|
||||
import ninja.bytecode.iris.util.VectorMath;
|
||||
import ninja.bytecode.shuriken.collections.GMap;
|
||||
import ninja.bytecode.shuriken.io.CustomOutputStream;
|
||||
import ninja.bytecode.shuriken.logging.L;
|
||||
@ -128,6 +130,7 @@ public class Schematic
|
||||
}
|
||||
|
||||
dos.close();
|
||||
center();
|
||||
}
|
||||
|
||||
public BlockVector getOffset()
|
||||
@ -204,4 +207,44 @@ public class Schematic
|
||||
L.i("Loaded Schematic: " + f.getPath() + " Size: " + s.getSchematic().size());
|
||||
return s;
|
||||
}
|
||||
|
||||
public void center()
|
||||
{
|
||||
GMap<BlockVector, MB> s = getSchematic().copy();
|
||||
clear();
|
||||
BlockVector max = new BlockVector(-10000, -10000, -10000);
|
||||
BlockVector min = new BlockVector(10000, 10000, 10000);
|
||||
|
||||
for(BlockVector i : s.k())
|
||||
{
|
||||
if(i.lengthSquared() < min.lengthSquared())
|
||||
{
|
||||
min = i;
|
||||
}
|
||||
|
||||
if(i.lengthSquared() > max.lengthSquared())
|
||||
{
|
||||
max = i;
|
||||
}
|
||||
}
|
||||
|
||||
BlockVector center = min.clone().add(max.clone().multiply(0.5D)).toBlockVector();
|
||||
|
||||
for(BlockVector i : s.k())
|
||||
{
|
||||
getSchematic().put(i.clone().subtract(center).toBlockVector(), s.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void rotate(Direction from, Direction to)
|
||||
{
|
||||
center();
|
||||
GMap<BlockVector, MB> s = getSchematic().copy();
|
||||
clear();
|
||||
|
||||
for(BlockVector i : s.k())
|
||||
{
|
||||
getSchematic().put(VectorMath.rotate(from, to, i).toBlockVector(), s.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package ninja.bytecode.iris.schematic;
|
||||
|
||||
import ninja.bytecode.iris.util.Direction;
|
||||
import ninja.bytecode.shuriken.collections.GList;
|
||||
|
||||
public class SchematicGroup
|
||||
@ -61,4 +62,28 @@ public class SchematicGroup
|
||||
{
|
||||
return getSchematics().size();
|
||||
}
|
||||
|
||||
public void generateRotationVariants()
|
||||
{
|
||||
if(flags.contains("rotation=none"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GList<Schematic> variants = new GList<>();
|
||||
GList<Direction> directions = flags.contains("rotation=all") ? Direction.udnews() : Direction.news();
|
||||
directions.remove(Direction.N);
|
||||
|
||||
for(Schematic i : getSchematics())
|
||||
{
|
||||
for(Direction j : directions)
|
||||
{
|
||||
Schematic rotated = i.copy();
|
||||
rotated.rotate(Direction.N, j);
|
||||
variants.add(rotated);
|
||||
}
|
||||
}
|
||||
|
||||
getSchematics().add(variants);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user