mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-13 21:13:53 +00:00
Fix button rotation, add support for up/down flipping and restore unit test functionality.
This commit is contained in:
@ -95,12 +95,22 @@ public final class BlockData {
|
||||
}
|
||||
break;
|
||||
|
||||
case BlockID.LEVER:
|
||||
case BlockID.STONE_BUTTON:
|
||||
case BlockID.WOODEN_BUTTON:
|
||||
case BlockID.WOODEN_BUTTON: {
|
||||
int thrown = data & 0x8;
|
||||
int withoutThrown = data & ~0x8;
|
||||
switch (withoutThrown) {
|
||||
switch (data & ~0x8) {
|
||||
case 1: return 3 | thrown;
|
||||
case 2: return 4 | thrown;
|
||||
case 3: return 2 | thrown;
|
||||
case 4: return 1 | thrown;
|
||||
// 0 and 5 are vertical
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case BlockID.LEVER: {
|
||||
int thrown = data & 0x8;
|
||||
switch (data & ~0x8) {
|
||||
case 1: return 3 | thrown;
|
||||
case 2: return 4 | thrown;
|
||||
case 3: return 2 | thrown;
|
||||
@ -111,6 +121,7 @@ public final class BlockData {
|
||||
case 0: return 7 | thrown;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case BlockID.WOODEN_DOOR:
|
||||
case BlockID.IRON_DOOR:
|
||||
@ -316,12 +327,22 @@ public final class BlockData {
|
||||
}
|
||||
break;
|
||||
|
||||
case BlockID.LEVER:
|
||||
case BlockID.STONE_BUTTON:
|
||||
case BlockID.WOODEN_BUTTON:
|
||||
case BlockID.WOODEN_BUTTON: {
|
||||
int thrown = data & 0x8;
|
||||
int withoutThrown = data & ~0x8;
|
||||
switch (withoutThrown) {
|
||||
switch (data & ~0x8) {
|
||||
case 3: return 1 | thrown;
|
||||
case 4: return 2 | thrown;
|
||||
case 2: return 3 | thrown;
|
||||
case 1: return 4 | thrown;
|
||||
// 0 and 5 are vertical
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case BlockID.LEVER: {
|
||||
int thrown = data & 0x8;
|
||||
switch (data & ~0x8) {
|
||||
case 3: return 1 | thrown;
|
||||
case 4: return 2 | thrown;
|
||||
case 2: return 3 | thrown;
|
||||
@ -332,6 +353,7 @@ public final class BlockData {
|
||||
case 7: return 0 | thrown;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case BlockID.WOODEN_DOOR:
|
||||
case BlockID.IRON_DOOR:
|
||||
@ -509,11 +531,29 @@ public final class BlockData {
|
||||
case BlockID.REDSTONE_TORCH_OFF:
|
||||
case BlockID.REDSTONE_TORCH_ON:
|
||||
if (data < 1 || data > 4) break;
|
||||
/* FALL-THROUGH */
|
||||
switch (data) {
|
||||
case 1: return data + flipX;
|
||||
case 2: return data - flipX;
|
||||
case 3: return data + flipZ;
|
||||
case 4: return data - flipZ;
|
||||
}
|
||||
break;
|
||||
|
||||
case BlockID.STONE_BUTTON:
|
||||
case BlockID.WOODEN_BUTTON: {
|
||||
switch (data & ~0x8) {
|
||||
case 1: return data + flipX;
|
||||
case 2: return data - flipX;
|
||||
case 3: return data + flipZ;
|
||||
case 4: return data - flipZ;
|
||||
case 0:
|
||||
case 5:
|
||||
return data ^ (flipY * 5);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case BlockID.LEVER:
|
||||
case BlockID.STONE_BUTTON:
|
||||
case BlockID.WOODEN_BUTTON:
|
||||
switch (data & ~0x8) {
|
||||
case 1: return data + flipX;
|
||||
case 2: return data - flipX;
|
||||
|
@ -1842,6 +1842,10 @@ public enum BlockType {
|
||||
addCardinals(BlockID.STONE_BUTTON, offset + 4, offset + 1, offset + 3, offset + 2);
|
||||
addCardinals(BlockID.WOODEN_BUTTON, offset + 4, offset + 1, offset + 3, offset + 2);
|
||||
}
|
||||
dataAttachments.put(typeDataKey(BlockID.STONE_BUTTON, 0), PlayerDirection.UP);
|
||||
dataAttachments.put(typeDataKey(BlockID.STONE_BUTTON, 5), PlayerDirection.DOWN);
|
||||
dataAttachments.put(typeDataKey(BlockID.WOODEN_BUTTON, 0), PlayerDirection.UP);
|
||||
dataAttachments.put(typeDataKey(BlockID.WOODEN_BUTTON, 5), PlayerDirection.DOWN);
|
||||
nonDataAttachments.put(BlockID.CACTUS, PlayerDirection.DOWN);
|
||||
nonDataAttachments.put(BlockID.REED, PlayerDirection.DOWN);
|
||||
nonDataAttachments.put(BlockID.CAKE_BLOCK, PlayerDirection.DOWN);
|
||||
|
Reference in New Issue
Block a user