Skip to content

Commit ed9ad59

Browse files
committed
Fixed the relative direction tooltip crashing with controllers, closes #445
1 parent 6b90d45 commit ed9ad59

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# VERSION 1.5.3
2+
3+
* Fixed the relative direction tooltip crashing with controllers, closes #445
4+
15
# VERSION 1.5.2
26

37
* Update zh_cn.json 1.21 - Mooncywin

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
org.gradle.jvmargs=-Xmx2048M
22
modGroup=com.buuz135
3-
mod_version=1.5.2
3+
mod_version=1.5.3
44
modBaseName=functionalstorage
55

66
neo_version=21.1.40

src/main/java/com/buuz135/functionalstorage/client/ClientSetup.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,17 @@ public static void init() {
2424
.process(event -> {
2525
var sc = (BasicAddonScreen) Minecraft.getInstance().screen;
2626
var blockstate = ((ControllableDrawerTile<?>) sc.getMenu().getObject()).getBlockState();
27-
var direction = blockstate.getValue(Drawer.FACING_HORIZONTAL_CUSTOM);
28-
if (blockstate.hasProperty(Drawer.FACING_ALL) && (direction == Direction.UP || direction == Direction.DOWN)) {
29-
var subdirection = blockstate.getValue(RotatableBlock.FACING_ALL);
30-
System.out.println(subdirection);
31-
event.getToolTip().add(3, Component.translatable("drawer_upgrade.functionalstorage.relative_direction", UpgradeItem.getRelativeDirectionVertical(direction, subdirection, UpgradeItem.getDirection(event.getItemStack()))).withStyle(ChatFormatting.YELLOW));
32-
} else {
27+
if (blockstate.hasProperty(Drawer.FACING_HORIZONTAL_CUSTOM)) {
28+
var direction = blockstate.getValue(Drawer.FACING_HORIZONTAL_CUSTOM);
29+
if (blockstate.hasProperty(Drawer.FACING_ALL) && (direction == Direction.UP || direction == Direction.DOWN)) {
30+
var subdirection = blockstate.getValue(RotatableBlock.FACING_ALL);
31+
event.getToolTip().add(3, Component.translatable("drawer_upgrade.functionalstorage.relative_direction", UpgradeItem.getRelativeDirectionVertical(direction, subdirection, UpgradeItem.getDirection(event.getItemStack()))).withStyle(ChatFormatting.YELLOW));
32+
} else {
33+
event.getToolTip().add(3, Component.translatable("drawer_upgrade.functionalstorage.relative_direction", UpgradeItem.getRelativeDirection(direction, UpgradeItem.getDirection(event.getItemStack()))).withStyle(ChatFormatting.YELLOW));
34+
}
35+
} else if (blockstate.hasProperty(Drawer.FACING_HORIZONTAL)) {
36+
var direction = blockstate.getValue(Drawer.FACING_HORIZONTAL);
3337
event.getToolTip().add(3, Component.translatable("drawer_upgrade.functionalstorage.relative_direction", UpgradeItem.getRelativeDirection(direction, UpgradeItem.getDirection(event.getItemStack()))).withStyle(ChatFormatting.YELLOW));
34-
3538
}
3639
}).subscribe();
3740

0 commit comments

Comments
 (0)