Class StorageMenuDefinition.Builder
java.lang.Object
net.ixdarklord.coolcatcore.api.menu.StorageMenuDefinition.Builder
- Enclosing class:
StorageMenuDefinition
-
Method Summary
Modifier and TypeMethodDescriptionbuild()button(int id, BiConsumer<StorageMenu, net.minecraft.server.level.ServerPlayer> action) What a button does on the server.grid(int firstSlot, int columns, int rows, int x, int y) Shows container slotsfirstSlotonward in a grid, 18 pixels apart, starting at (x, y).playerInventory(int x, int y) Where the player's inventory starts (its hotbar sits 58 pixels lower).size(int width, int height) The screen's size; the height defaults to fit the player inventory.slot(int containerSlot, int x, int y) Shows one container slot at (x, y).sync(Attachment<T> attachment) Shows the holder's value of an attachment (the block entity's or the stack's) on the screen, throughStorageMenu.get(Attachment), kept up to date while the menu is open, whatever its sync policy.syncValue(String name, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf, T> codec, T defaultValue, Function<StorageMenu, T> getter) Shows any value on the screen (a machine's progress...), read on the server each tick and sent when it changes; the client reads it withStorageMenu.getValue(String, Object).
-
Method Details
-
slot
Shows one container slot at (x, y). -
grid
Shows container slotsfirstSlotonward in a grid, 18 pixels apart, starting at (x, y). -
playerInventory
Where the player's inventory starts (its hotbar sits 58 pixels lower). -
size
The screen's size; the height defaults to fit the player inventory. -
sync
Shows the holder's value of an attachment (the block entity's or the stack's) on the screen, throughStorageMenu.get(Attachment), kept up to date while the menu is open, whatever its sync policy. -
syncValue
public <T> StorageMenuDefinition.Builder syncValue(String name, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf, T> codec, T defaultValue, Function<StorageMenu, T> getter) Shows any value on the screen (a machine's progress...), read on the server each tick and sent when it changes; the client reads it withStorageMenu.getValue(String, Object). -
button
public StorageMenuDefinition.Builder button(int id, BiConsumer<StorageMenu, net.minecraft.server.level.ServerPlayer> action) What a button does on the server. The screen presses it withStorageScreen.pressButton(id); ids are 0 and up. -
build
-