Skip to content

Commit cadb7d5

Browse files
committed
Fix wall rotations
- Also make /struct build default to false for mirrored
1 parent 6267ef8 commit cadb7d5

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

res/command.rdcml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ structure,struct {
1111
hook create
1212
user player
1313
}
14-
build int<0,3>:rotation?(0) boolean:mirrored?(true) {
14+
build int<0,3>:rotation?(0) boolean:mirrored?(false) {
1515
help Build the created structure at your location
1616
hook build
1717
user player

res/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: RedLib
22
main: redempt.redlib.RedLib
3-
version: 2022-09-16 05:12
3+
version: 2022-09-23 01:40
44
author: Redempt
55
api-version: 1.13
66
load: STARTUP

src/redempt/redlib/multiblock/Rotator.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,16 @@ private <T> void rotate(T[] arr) {
129129
rot[i] = arr[i];
130130
}
131131
for (int i = 0; i < 4; i++) {
132-
int dir = (i + rotation) % 4;
133-
if (mirrored && (i == 0 || i == 2)) {
134-
dir = (dir + 2) % 4;
135-
}
132+
int dir = (i + 4 - rotation) % 4;
136133
arr[i] = (T) rot[dir];
137134
}
135+
if (mirrored) {
136+
int first = rotation % 2 == 0 ? 1 : 0;
137+
int second = rotation % 2 == 0 ? 3 : 2;
138+
T tmp = arr[first];
139+
arr[first] = arr[second];
140+
arr[second] = tmp;
141+
}
138142
}
139143

140144
/**

0 commit comments

Comments
 (0)