Skip to content

Commit bb490c0

Browse files
authored
feat: Expanded Enderchest support (#368)
resolve #367
1 parent 0b860a4 commit bb490c0

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

src/main/java/com/fibermc/essentialcommands/commands/bench/EnderchestCommand.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.fibermc.essentialcommands.commands.bench;
22

3+
import com.fibermc.essentialcommands.EssentialCommands;
34
import org.jetbrains.annotations.NotNull;
45

56
import net.minecraft.network.chat.Component;
@@ -18,8 +19,21 @@ protected Component getScreenTitle() {
1819
@Override
1920
protected @NotNull MenuProvider getScreenHandlerFactory() {
2021
return new SimpleMenuProvider(
21-
(syncId, inventory, player) ->
22-
ChestMenu.threeRows(syncId, inventory, player.getEnderChestInventory()),
22+
(syncId, inventory, player) -> {
23+
var echestInventory = player.getEnderChestInventory();
24+
if (echestInventory.getContainerSize() == 9 * 3) {
25+
return ChestMenu.threeRows(syncId, inventory, echestInventory);
26+
}
27+
if (echestInventory.getContainerSize() == 9 * 6) {
28+
return ChestMenu.sixRows(syncId, inventory, echestInventory);
29+
}
30+
EssentialCommands.LOGGER.warn(
31+
"Expected enderchest to be 9x3 or 9x6 (modded), but found size '{}'."
32+
+ " This is unsupported (If this is an intended configuration, report"
33+
+ " this along with your log file / mod list at https://github.com/John-Paul-R/Essential-Commands/issues)",
34+
echestInventory.getContainerSize());
35+
return ChestMenu.threeRows(syncId, inventory, echestInventory);
36+
},
2337
Component.translatable("container.enderchest")
2438
);
2539
}

0 commit comments

Comments
 (0)