Decorator Changes & Jigsaw Fix

- Fixed Jigsaw pieces with rotation disabled rotating randomly. They will now inherit the parent's rotation
- Fixed pallete of blocks in stacked blocks not being chosen randomly on the Y axis

Fixes for issues in the last commit:
- Fixed CEILING decorators not working with scaleStack
This commit is contained in:
StrangeOne101
2021-07-27 04:12:34 +12:00
parent 21ce09a5b5
commit 38776e74bc
8 changed files with 72 additions and 43 deletions

View File

@@ -49,7 +49,6 @@ public class PlannedPiece {
private IrisDataManager data;
private KList<IrisJigsawPieceConnector> connected;
private boolean dead = false;
private int rotationKey;
private AxisAlignedBB box;
private PlannedStructure structure;
@@ -58,11 +57,14 @@ public class PlannedPiece {
}
public PlannedPiece(PlannedStructure structure, IrisPosition position, IrisJigsawPiece piece, int rx, int ry, int rz) {
this(structure, position, piece, IrisObjectRotation.of(rx * 90D, ry * 90D, rz * 90D));
}
public PlannedPiece(PlannedStructure structure, IrisPosition position, IrisJigsawPiece piece, IrisObjectRotation rot) {
this.structure = structure;
this.position = position;
rotationKey = (rz * 100) + (rx * 10) + ry;
this.data = piece.getLoader();
this.rotation = IrisObjectRotation.of(rx * 90D, ry * 90D, rz * 90D);
this.setRotation(rot);
this.object = structure.rotated(piece, rotation);
this.piece = rotation.rotateCopy(piece);
this.piece.setLoadKey(piece.getLoadKey());
@@ -76,7 +78,7 @@ public class PlannedPiece {
}
public String toString() {
return piece.getLoadKey() + "@(" + position.getX() + "," + position.getY() + "," + position.getZ() + ")[rot:" + rotationKey + "]";
return piece.getLoadKey() + "@(" + position.getX() + "," + position.getY() + "," + position.getZ() + ")[rot:" + rotation.toString() + "]";
}
public AxisAlignedBB getBox() {

View File

@@ -211,6 +211,12 @@ public class PlannedStructure {
}
private boolean generateRotatedPiece(PlannedPiece piece, IrisJigsawPieceConnector pieceConnector, IrisJigsawPiece idea) {
if (!piece.getPiece().getPlacementOptions().getRotation().isEnabled()) {
if (generateRotatedPiece(piece, pieceConnector, idea, 0, 0, 0)) {
return true;
}
}
KList<Integer> forder1 = new KList<Integer>().qadd(0).qadd(1).qadd(2).qadd(3).shuffle(rng);
KList<Integer> forder2 = new KList<Integer>().qadd(0).qadd(1).qadd(2).qadd(3).shuffle(rng);
@@ -238,8 +244,10 @@ public class PlannedStructure {
return false;
}
private boolean generateRotatedPiece(PlannedPiece piece, IrisJigsawPieceConnector pieceConnector, IrisJigsawPiece idea, int x, int y, int z) {
PlannedPiece test = new PlannedPiece(this, piece.getPosition(), idea, x, y, z);
private boolean generateRotatedPiece(PlannedPiece piece, IrisJigsawPieceConnector pieceConnector, IrisJigsawPiece idea, IrisObjectRotation rotation) {
if (!idea.getPlacementOptions().getRotation().isEnabled()) rotation = piece.getRotation(); //Inherit parent rotation
PlannedPiece test = new PlannedPiece(this, piece.getPosition(), idea, rotation);
for (IrisJigsawPieceConnector j : test.getPiece().getConnectors().shuffleCopy(rng)) {
if (generatePositionedPiece(piece, pieceConnector, test, j)) {
@@ -250,6 +258,10 @@ public class PlannedStructure {
return false;
}
private boolean generateRotatedPiece(PlannedPiece piece, IrisJigsawPieceConnector pieceConnector, IrisJigsawPiece idea, int x, int y, int z) {
return generateRotatedPiece(piece, pieceConnector, idea, IrisObjectRotation.of(x, y, z));
}
private boolean generatePositionedPiece(PlannedPiece piece,
IrisJigsawPieceConnector pieceConnector,
PlannedPiece test,