diff options
author | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2023-07-23 16:14:53 +0800 |
---|---|---|
committer | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2023-08-30 22:49:52 -0400 |
commit | 2452ce3afafec1f9230a0cbfe384cd97d93e2d72 (patch) | |
tree | 7b9f5627dda4cb2f0dc0365e0cf83a4732d3548b /src/test | |
parent | d531919154c78783b8423299083bbc9a34a8b617 (diff) | |
download | Skyblocker-2452ce3afafec1f9230a0cbfe384cd97d93e2d72.tar.gz Skyblocker-2452ce3afafec1f9230a0cbfe384cd97d93e2d72.tar.bz2 Skyblocker-2452ce3afafec1f9230a0cbfe384cd97d93e2d72.zip |
Add room matching
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonRoomsDFU.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/test/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonRoomsDFU.java b/src/test/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonRoomsDFU.java index 7e85d721..613f642c 100644 --- a/src/test/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonRoomsDFU.java +++ b/src/test/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonRoomsDFU.java @@ -104,6 +104,8 @@ public class DungeonRoomsDFU { for (int i = 0; i < oldRoom.length; i++) { room[i] = updateBlock(oldRoom[i]); } + // Technically not needed, as the long array should be sorted already. + Arrays.sort(room); return room; } @@ -114,9 +116,9 @@ public class DungeonRoomsDFU { * @return the new block state in the new format */ private static int updateBlock(long oldBlock) { - short x = (short) ((oldBlock >> 48) & 0xFFFF); - short y = (short) ((oldBlock >> 32) & 0xFFFF); - short z = (short) ((oldBlock >> 16) & 0xFFFF); + short x = (short) (oldBlock >> 48 & 0xFFFF); + short y = (short) (oldBlock >> 32 & 0xFFFF); + short z = (short) (oldBlock >> 16 & 0xFFFF); // Blocks should be within the range 0 to 256, since a dungeon room is at most around 128 blocks long and around 150 blocks tall. if (x < 0 || x > 0xFF || y < 0 || y > 0xFF || z < 0 || z > 0xFF) { throw new IllegalArgumentException("Invalid block: " + oldBlock); @@ -127,7 +129,7 @@ public class DungeonRoomsDFU { if (newId == null) { newId = ItemIdFix.fromId(oldId / 100); } - return (x << 24) | (y << 16) | (z << 8) | DungeonSecrets.NUMERIC_ID.get(newId); + return x << 24 | y << 16 | z << 8 | DungeonSecrets.NUMERIC_ID.get(newId); } private static CompletableFuture<Void> save() { |