This commit is contained in:
dordsor21 2021-09-10 14:53:07 +01:00
parent effb94623a
commit 3f182c63bc
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -52,6 +52,7 @@ import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -106,13 +107,13 @@ public class BlockTransformExtent extends ResettableExtent {
WEST, PropertyKey.WEST WEST, PropertyKey.WEST
); );
private static final EnumSet<Direction> NESW = EnumSet.range(NORTH, WEST);
private final int[] ALL = new int[0];
private Transform transform; private Transform transform;
private Transform transformInverse; private Transform transformInverse;
private int[] BLOCK_ROTATION_BITMASK; private int[] BLOCK_ROTATION_BITMASK;
private int[][] BLOCK_TRANSFORM; private int[][] BLOCK_TRANSFORM;
private int[][] BLOCK_TRANSFORM_INVERSE; private int[][] BLOCK_TRANSFORM_INVERSE;
private final int[] ALL = new int[0];
public BlockTransformExtent(Extent parent) { public BlockTransformExtent(Extent parent) {
this(parent, new AffineTransform()); this(parent, new AffineTransform());
@ -420,22 +421,15 @@ public class BlockTransformExtent extends ResettableExtent {
// Rotate North, East, South, West // Rotate North, East, South, West
if (type.hasProperty(PropertyKey.NORTH) && type.hasProperty(PropertyKey.EAST) && type.hasProperty(PropertyKey.SOUTH) && type if (type.hasProperty(PropertyKey.NORTH) && type.hasProperty(PropertyKey.EAST) && type.hasProperty(PropertyKey.SOUTH) && type
.hasProperty(PropertyKey.WEST)) { .hasProperty(PropertyKey.WEST)) {
Direction newNorth = findClosest(transform.apply(NORTH.toVector()), Flag.CARDINAL);
Direction newEast = findClosest(transform.apply(EAST.toVector()), Flag.CARDINAL);
Direction newSouth = findClosest(transform.apply(SOUTH.toVector()), Flag.CARDINAL);
Direction newWest = findClosest(transform.apply(WEST.toVector()), Flag.CARDINAL);
BlockState tmp = state; BlockState tmp = state;
for (Direction direction : NESW) {
Object northState = tmp.getState(PropertyKey.NORTH); Direction newDir = findClosest(transform.apply(direction.toVector()), Flag.CARDINAL);
Object eastState = tmp.getState(PropertyKey.EAST); if (newDir != null) {
Object southState = tmp.getState(PropertyKey.SOUTH); Object dirState = tmp.getState(directionMap.get(direction));
Object westState = tmp.getState(PropertyKey.WEST); tmp = tmp.with(directionMap.get(newDir), dirState);
}
tmp = tmp.with(directionMap.get(newNorth), northState); }
tmp = tmp.with(directionMap.get(newEast), eastState);
tmp = tmp.with(directionMap.get(newSouth), southState);
tmp = tmp.with(directionMap.get(newWest), westState);
newMaskedId = tmp.getInternalId(); newMaskedId = tmp.getInternalId();
} }