Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,23 +159,19 @@ public static ItemInteractionResult useItemOn(ItemStack stack, Player player, Bl

/**
* A right-click with an empty hand on a face: right after an insert there it inserts all of the type it shows,
* otherwise it opens the settings. Sneaking does nothing, except on a hidden face, where it is the only way to the
* settings.
* otherwise it opens the settings. Sneaking opens the settings on any face, like on other functional walls.
* @return The result, or null to fall back to the default wall behaviour.
*/
@Nullable
public static InteractionResult useWithoutItem(Player player, BlockEntityChestWall wall, Direction face) {
if (wall.isFaceHidden(face)) {
if (!player.isSecondaryUseActive()) {
return null;
}
if (player.isSecondaryUseActive()) {
if (player instanceof ServerPlayer serverPlayer) {
openSettings(serverPlayer, wall);
}
return InteractionResult.sidedSuccess(player.level().isClientSide);
}
if (player.isSecondaryUseActive()) {
return InteractionResult.PASS;
if (wall.isFaceHidden(face)) {
return null;
}
// Only the server knows about the previous click, the client lets it decide.
if (player instanceof ServerPlayer serverPlayer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1860,11 +1860,7 @@ public void testDisplayWallInsertsAndTakes(GameTestHelper helper) {
helper.assertTrue(player.getInventory().getItem(4).is(Items.DIRT), "Expected the held dirt to stay");
helper.assertValueEqual(countInInventory(player, Items.STONE), 1, "stone next to the held dirt");
player.getInventory().selected = 0;
// Sneaking with an empty hand does nothing.
player.getInventory().clearContent();
player.setShiftKeyDown(true);
helper.assertValueEqual(click(helper, player, display), InteractionResult.PASS, "sneaking click");
helper.assertTrue(wall.getDisplayed(Direction.UP).is(Items.STONE), "Expected stone to stay shown");
// Sneaking with an empty hand opens the settings. Checked in-game, as NeoForge does not open menus for mock players.
})
.thenSucceed();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"block.colossalchests2.chest_wall_magnet.info": "Pulls dropped items around it into the chest. Sneak-right-click with empty hand to set its radius.",
"block.colossalchests2.chest_wall_redstone": "Redstone Chest Wall",
"block.colossalchests2.chest_wall_redstone.info": "Emits a redstone signal based on how full the chest is.",
"block.colossalchests2.chest_wall_display.info": "Shows an item and its count. Take items with (sneak-)left-click and insert with (double) right-click.",
"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.",
"block.colossalchests2.chest_wall_gold": "Golden Chest Wall",
"block.colossalchests2.chest_core_gold": "Golden Chest Core",
"block.colossalchests2.chest_wall_diamond": "Diamond Chest Wall",
Expand Down
Loading