Skip to content

Commit b4ebddc

Browse files
authored
Open Display wall settings on sneak-right-click (#14)
1 parent 719b589 commit b4ebddc

3 files changed

Lines changed: 6 additions & 14 deletions

File tree

‎loader-common/src/main/java/org/cyclops/colossalchests2/block/DisplayWallInteractions.java‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,23 +159,19 @@ public static ItemInteractionResult useItemOn(ItemStack stack, Player player, Bl
159159

160160
/**
161161
* A right-click with an empty hand on a face: right after an insert there it inserts all of the type it shows,
162-
* otherwise it opens the settings. Sneaking does nothing, except on a hidden face, where it is the only way to the
163-
* settings.
162+
* otherwise it opens the settings. Sneaking opens the settings on any face, like on other functional walls.
164163
* @return The result, or null to fall back to the default wall behaviour.
165164
*/
166165
@Nullable
167166
public static InteractionResult useWithoutItem(Player player, BlockEntityChestWall wall, Direction face) {
168-
if (wall.isFaceHidden(face)) {
169-
if (!player.isSecondaryUseActive()) {
170-
return null;
171-
}
167+
if (player.isSecondaryUseActive()) {
172168
if (player instanceof ServerPlayer serverPlayer) {
173169
openSettings(serverPlayer, wall);
174170
}
175171
return InteractionResult.sidedSuccess(player.level().isClientSide);
176172
}
177-
if (player.isSecondaryUseActive()) {
178-
return InteractionResult.PASS;
173+
if (wall.isFaceHidden(face)) {
174+
return null;
179175
}
180176
// Only the server knows about the previous click, the client lets it decide.
181177
if (player instanceof ServerPlayer serverPlayer) {

‎loader-common/src/main/java/org/cyclops/colossalchests2/gametest/GameTestsCommon.java‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1861,11 +1861,7 @@ public void testDisplayWallInsertsAndTakes(GameTestHelper helper) {
18611861
helper.assertTrue(player.getInventory().getItem(4).is(Items.DIRT), "Expected the held dirt to stay");
18621862
helper.assertValueEqual(countInInventory(player, Items.STONE), 1, "stone next to the held dirt");
18631863
player.getInventory().selected = 0;
1864-
// Sneaking with an empty hand does nothing.
1865-
player.getInventory().clearContent();
1866-
player.setShiftKeyDown(true);
1867-
helper.assertValueEqual(click(helper, player, display), InteractionResult.PASS, "sneaking click");
1868-
helper.assertTrue(wall.getDisplayed(Direction.UP).is(Items.STONE), "Expected stone to stay shown");
1864+
// Sneaking with an empty hand opens the settings. Checked in-game, as NeoForge does not open menus for mock players.
18691865
})
18701866
.thenSucceed();
18711867
}

‎loader-common/src/main/resources/assets/colossalchests2/lang/en_us.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"block.colossalchests2.chest_wall_magnet.info": "Pulls dropped items around it into the chest. Sneak-right-click with empty hand to set its radius.",
1717
"block.colossalchests2.chest_wall_redstone": "Redstone Chest Wall",
1818
"block.colossalchests2.chest_wall_redstone.info": "Emits a redstone signal based on how full the chest is.",
19-
"block.colossalchests2.chest_wall_display.info": "Shows an item and its count. Take items with (sneak-)left-click and insert with (double) right-click.",
19+
"block.colossalchests2.chest_wall_display.info": "Shows an item and its count. Take items with (sneak-)left-click and insert with (double) right-click. Sneak-right-click with empty hand to configure.",
2020
"block.colossalchests2.chest_wall_gold": "Golden Chest Wall",
2121
"block.colossalchests2.chest_core_gold": "Golden Chest Core",
2222
"block.colossalchests2.chest_wall_diamond": "Diamond Chest Wall",

0 commit comments

Comments
 (0)