Fixes Season 2

- Fixed double sided connectors not working properly
- Fixed skulls not being able to be rotated when they are placed on an angle that isn't perfectly straight (north, south, east, west)
This commit is contained in:
StrangeOne101 2021-06-22 17:34:21 +12:00 committed by DanLT
parent 900510e7f2
commit d6ddb2b247
2 changed files with 45 additions and 13 deletions

View File

@ -157,6 +157,42 @@ public class IrisObjectRotation
return BlockFace.SOUTH; return BlockFace.SOUTH;
} }
public BlockFace getHexFace(BlockVector v)
{
int x = v.getBlockX();
int y = v.getBlockY();
int z = v.getBlockZ();
if(x == 0 && z == -1) return BlockFace.NORTH;
if(x == 1 && z == -2) return BlockFace.NORTH_NORTH_EAST;
if(x == 1 && z == -1) return BlockFace.NORTH_EAST;
if(x == 2 && z == -1) return BlockFace.EAST_NORTH_EAST;
if(x == 1 && z == 0) return BlockFace.EAST;
if(x == 2 && z == 1) return BlockFace.EAST_SOUTH_EAST;
if(x == 1 && z == 1) return BlockFace.SOUTH_EAST;
if(x == 1 && z == 2) return BlockFace.SOUTH_SOUTH_EAST;
if(x == 0 && z == 1) return BlockFace.SOUTH;
if(x == -1 && z == 2) return BlockFace.SOUTH_SOUTH_WEST;
if(x == -1 && z == 1) return BlockFace.SOUTH_WEST;
if(x == -2 && z == 1) return BlockFace.WEST_SOUTH_WEST;
if(x == -1 && z == 0) return BlockFace.WEST;
if(x == -2 && z == -1) return BlockFace.WEST_NORTH_WEST;
if(x == -1 && z == -1) return BlockFace.NORTH_WEST;
if(x == -1 && z == -2) return BlockFace.NORTH_NORTH_WEST;
if(y > 0)
{
return BlockFace.UP;
}
if(y < 0)
{
return BlockFace.DOWN;
}
return BlockFace.SOUTH;
}
public BlockFace faceForAxis(Axis axis) public BlockFace faceForAxis(Axis axis)
{ {
switch(axis) switch(axis)
@ -242,12 +278,13 @@ public class IrisObjectRotation
{ {
Rotatable g = ((Rotatable) d); Rotatable g = ((Rotatable) d);
BlockFace f = g.getRotation(); BlockFace f = g.getRotation();
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
BlockVector bv = new BlockVector(f.getModX(), 0, f.getModZ());
bv = rotate(bv.clone(), spinx, spiny, spinz); bv = rotate(bv.clone(), spinx, spiny, spinz);
BlockFace t = getFace(bv); BlockFace face = getHexFace(bv);
if (t.getModY() == 0) {
g.setRotation(t); g.setRotation(face);
}
} }
else if(d instanceof Orientable) else if(d instanceof Orientable)

View File

@ -21,7 +21,7 @@ public class PlannedPiece {
private IrisJigsawPiece piece; private IrisJigsawPiece piece;
private IrisObjectRotation rotation; private IrisObjectRotation rotation;
private IrisDataManager data; private IrisDataManager data;
private KList<IrisPosition> connected; private KList<IrisJigsawPieceConnector> connected;
private boolean dead = false; private boolean dead = false;
private int rotationKey; private int rotationKey;
private AxisAlignedBB box; private AxisAlignedBB box;
@ -95,7 +95,7 @@ public class PlannedPiece {
for(IrisJigsawPieceConnector i : piece.getConnectors()) for(IrisJigsawPieceConnector i : piece.getConnectors())
{ {
if(!connected.contains(i.getPosition())) if(!connected.contains(i))
{ {
c.add(i); c.add(i);
} }
@ -108,17 +108,12 @@ public class PlannedPiece {
{ {
if(piece.getConnectors().contains(c)) if(piece.getConnectors().contains(c))
{ {
return connect(c.getPosition()); return connected.addIfMissing(c);
} }
return false; return false;
} }
private boolean connect(IrisPosition p)
{
return connected.addIfMissing(p);
}
public IrisPosition getWorldPosition(IrisJigsawPieceConnector c) public IrisPosition getWorldPosition(IrisJigsawPieceConnector c)
{ {
return getWorldPosition(c.getPosition()); return getWorldPosition(c.getPosition());