Skip to content

Commit

Permalink
Fix wall rotations
Browse files Browse the repository at this point in the history
- Also make /struct build default to false for mirrored
  • Loading branch information
boxbeam committed Sep 23, 2022
1 parent 6267ef8 commit cadb7d5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion res/command.rdcml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ structure,struct {
hook create
user player
}
build int<0,3>:rotation?(0) boolean:mirrored?(true) {
build int<0,3>:rotation?(0) boolean:mirrored?(false) {
help Build the created structure at your location
hook build
user player
Expand Down
2 changes: 1 addition & 1 deletion res/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: RedLib
main: redempt.redlib.RedLib
version: 2022-09-16 05:12
version: 2022-09-23 01:40
author: Redempt
api-version: 1.13
load: STARTUP
12 changes: 8 additions & 4 deletions src/redempt/redlib/multiblock/Rotator.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,16 @@ private <T> void rotate(T[] arr) {
rot[i] = arr[i];
}
for (int i = 0; i < 4; i++) {
int dir = (i + rotation) % 4;
if (mirrored && (i == 0 || i == 2)) {
dir = (dir + 2) % 4;
}
int dir = (i + 4 - rotation) % 4;
arr[i] = (T) rot[dir];
}
if (mirrored) {
int first = rotation % 2 == 0 ? 1 : 0;
int second = rotation % 2 == 0 ? 3 : 2;
T tmp = arr[first];
arr[first] = arr[second];
arr[second] = tmp;
}
}

/**
Expand Down

0 comments on commit cadb7d5

Please sign in to comment.