9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-30 12:29:20 +00:00

GUI & Tasking utils

This commit is contained in:
Daniel Mills
2020-08-24 08:03:05 -04:00
parent e9544bb610
commit 273f7c7a73
50 changed files with 3937 additions and 55 deletions

View File

@@ -60,6 +60,11 @@ public class IrisAxisRotationClamp
return min == max && min == 0;
}
public boolean isLocked()
{
return min == max && !isUnlimited();
}
public double getRadians(int rng)
{
if(isUnlimited())

View File

@@ -104,6 +104,17 @@ public class IrisObject extends IrisRegistrant
}
}
public void clean()
{
KMap<BlockVector, BlockData> d = blocks.copy();
blocks.clear();
for(BlockVector i : d.k())
{
blocks.put(new BlockVector(i.getBlockX(), i.getBlockY(), i.getBlockZ()), d.get(i));
}
}
public void setUnsigned(int x, int y, int z, BlockData block)
{
if(x >= w || y >= h || z >= d)
@@ -370,6 +381,17 @@ public class IrisObject extends IrisRegistrant
return y;
}
public void rotate(IrisObjectRotation r, int spinx, int spiny, int spinz)
{
KMap<BlockVector, BlockData> v = blocks.copy();
blocks.clear();
for(BlockVector i : v.keySet())
{
blocks.put(r.rotate(i.clone(), spinx, spiny, spinz), r.rotate(v.get(i).clone(), spinx, spiny, spinz));
}
}
public void place(Location at)
{

View File

@@ -201,7 +201,38 @@ public class IrisObjectRotation
if(canRotateY())
{
v.rotateAroundY(getYRotation(spiny));
if(getYAxis().isLocked())
{
if(Math.abs(getYAxis().getMax()) == 180D)
{
v.setX(-v.getX());
v.setZ(-v.getZ());
}
else if(getYAxis().getMax() == 90D || getYAxis().getMax() == -270D)
{
double x = v.getX();
v.setX(v.getZ());
v.setZ(-x);
}
else if(getYAxis().getMax() == -90D || getYAxis().getMax() == 270D)
{
double x = v.getX();
v.setX(-v.getZ());
v.setZ(x);
}
else
{
v.rotateAroundY(getYRotation(spiny));
}
}
else
{
v.rotateAroundY(getYRotation(spiny));
}
}
return v;

View File

@@ -62,14 +62,16 @@ public class IrisStructureTile
@Desc("List of objects to place centered in this tile")
private KList<String> objects = new KList<>();
private transient IrisObject forceObject;
@RegistryListObject
@ArrayType(min = 1, type = IrisRareObject.class)
@DontObfuscate
@Desc("List of objects to place centered in this tile but with rarity. These items only place some of the time so specify objects for common stuff too.")
private KList<IrisRareObject> rareObjects = new KList<>();
private AtomicCache<Integer> minFaces = new AtomicCache<>();
private AtomicCache<Integer> maxFaces = new AtomicCache<>();
private transient AtomicCache<Integer> minFaces = new AtomicCache<>();
private transient AtomicCache<Integer> maxFaces = new AtomicCache<>();
public IrisStructureTile()
{