public class SyncedGuiDescription extends net.minecraft.screen.ScreenHandler implements GuiDescription
| Modifier and Type | Field and Description |
|---|---|
protected net.minecraft.inventory.Inventory |
blockInventory |
protected int |
darkTitleColor |
protected WWidget |
focus |
protected boolean |
fullscreen |
protected net.minecraft.entity.player.PlayerInventory |
playerInventory |
protected net.minecraft.screen.PropertyDelegate |
propertyDelegate |
protected WPanel |
rootPanel |
protected HorizontalAlignment |
titleAlignment |
protected int |
titleColor |
protected boolean |
titleVisible |
protected net.minecraft.world.World |
world |
| Constructor and Description |
|---|
SyncedGuiDescription(net.minecraft.screen.ScreenHandlerType<?> type,
int syncId,
net.minecraft.entity.player.PlayerInventory playerInventory) |
SyncedGuiDescription(net.minecraft.screen.ScreenHandlerType<?> type,
int syncId,
net.minecraft.entity.player.PlayerInventory playerInventory,
net.minecraft.inventory.Inventory blockInventory,
net.minecraft.screen.PropertyDelegate propertyDelegate) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPainters()
Guis should use this method to add clientside styles and BackgroundPainters to their controls
|
void |
addSlotPeer(ValidatedSlot slot)
Typical users won't call this.
|
boolean |
canUse(net.minecraft.entity.player.PlayerEntity entity) |
WPlayerInvPanel |
createPlayerInventoryPanel()
Creates a player inventory widget from this panel's player inventory.
|
WPlayerInvPanel |
createPlayerInventoryPanel(boolean hasLabel)
Creates a player inventory widget from this panel's player inventory.
|
WPlayerInvPanel |
createPlayerInventoryPanel(WWidget label)
Creates a player inventory widget from this panel's player inventory.
|
static net.minecraft.inventory.Inventory |
getBlockInventory(net.minecraft.screen.ScreenHandlerContext ctx)
Gets the block inventory at the context.
|
static net.minecraft.inventory.Inventory |
getBlockInventory(net.minecraft.screen.ScreenHandlerContext ctx,
int size)
Gets the block inventory at the context.
|
static net.minecraft.screen.PropertyDelegate |
getBlockPropertyDelegate(net.minecraft.screen.ScreenHandlerContext ctx)
Gets the property delegate at the context.
|
static net.minecraft.screen.PropertyDelegate |
getBlockPropertyDelegate(net.minecraft.screen.ScreenHandlerContext ctx,
int size)
Gets the property delegate at the context.
|
WWidget |
getFocus()
Gets the currently-focused WWidget.
|
NetworkSide |
getNetworkSide()
Gets the network side this GUI description runs on.
|
net.fabricmc.fabric.api.networking.v1.PacketSender |
getPacketSender()
Gets the packet sender corresponding to this GUI's network side.
|
@Nullable net.minecraft.screen.PropertyDelegate |
getPropertyDelegate()
Gets the object which manages the integer properties used by WBars and such.
|
WPanel |
getRootPanel() |
HorizontalAlignment |
getTitleAlignment()
Gets the horizontal alignment of the GUI title.
|
int |
getTitleColor() |
boolean |
isFocused(WWidget widget)
Tests whether the widget is the currently-focused one.
|
boolean |
isFullscreen()
Gets whether this GUI is fullscreen.
|
boolean |
isTitleVisible()
Gets whether the title of this GUI should be rendered by the screen.
|
void |
onSlotClick(int slotNumber,
int button,
net.minecraft.screen.slot.SlotActionType action,
net.minecraft.entity.player.PlayerEntity player) |
void |
releaseFocus(WWidget widget)
Notifies this gui that the widget wants to give up its hold over focus.
|
void |
requestFocus(WWidget widget)
Notifies this gui that the widget wants to acquire focus.
|
void |
setFullscreen(boolean fullscreen)
Sets whether this GUI is fullscreen.
|
GuiDescription |
setPropertyDelegate(net.minecraft.screen.PropertyDelegate delegate)
Sets the object which manages the integer properties used by WBars
|
SyncedGuiDescription |
setRootPanel(WPanel panel) |
void |
setTitleAlignment(HorizontalAlignment titleAlignment)
Sets the horizontal alignment of the GUI title.
|
SyncedGuiDescription |
setTitleColor(int color)
Sets the title color of this GUI.
|
SyncedGuiDescription |
setTitleColor(int lightColor,
int darkColor)
Sets the light and dark title colors of this GUI.
|
void |
setTitleVisible(boolean titleVisible)
Sets whether the title of this GUI should be rendered by the screen.
|
addListener, addProperties, addProperty, addSlot, calculateComparatorOutput, calculateComparatorOutput, calculateStackSize, canInsertIntoSlot, canInsertIntoSlot, canInsertItemIntoSlot, canUse, checkDataCount, checkSize, close, copySharedSlots, disableSyncing, dropInventory, enableSyncing, endQuickCraft, getCursorStack, getSlot, getStacks, getType, insertItem, onButtonClick, onContentChanged, packQuickCraftData, removeListener, sendContentUpdates, setCursorStack, setPreviousCursorStack, setPreviousTrackedSlot, setProperty, setStackInSlot, shouldQuickCraftContinue, syncState, transferSlot, unpackQuickCraftButton, unpackQuickCraftStage, updateSlotStacks, updateSyncHandlerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcycleFocusprotected net.minecraft.inventory.Inventory blockInventory
protected net.minecraft.entity.player.PlayerInventory playerInventory
protected net.minecraft.world.World world
protected net.minecraft.screen.PropertyDelegate propertyDelegate
protected WPanel rootPanel
protected int titleColor
protected int darkTitleColor
protected boolean fullscreen
protected boolean titleVisible
protected HorizontalAlignment titleAlignment
protected WWidget focus
public SyncedGuiDescription(net.minecraft.screen.ScreenHandlerType<?> type,
int syncId,
net.minecraft.entity.player.PlayerInventory playerInventory)
public SyncedGuiDescription(net.minecraft.screen.ScreenHandlerType<?> type,
int syncId,
net.minecraft.entity.player.PlayerInventory playerInventory,
net.minecraft.inventory.Inventory blockInventory,
net.minecraft.screen.PropertyDelegate propertyDelegate)
public WPanel getRootPanel()
getRootPanel in interface GuiDescriptionpublic int getTitleColor()
getTitleColor in interface GuiDescriptionpublic SyncedGuiDescription setRootPanel(WPanel panel)
setRootPanel in interface GuiDescriptionpublic SyncedGuiDescription setTitleColor(int color)
GuiDescriptionThe dark-mode title color will also be set by this method.
If the specified color is WLabel.DEFAULT_TEXT_COLOR,
the dark-mode color will be WLabel.DEFAULT_DARKMODE_TEXT_COLOR;
otherwise it will be the specified color.
setTitleColor in interface GuiDescriptioncolor - the new title colorpublic SyncedGuiDescription setTitleColor(int lightColor, int darkColor)
GuiDescriptionsetTitleColor in interface GuiDescriptionlightColor - the light-mode colordarkColor - the dark-mode color@Environment(value=CLIENT) public void addPainters()
GuiDescriptionaddPainters in interface GuiDescriptionpublic void addSlotPeer(ValidatedSlot slot)
GuiDescriptionaddSlotPeer in interface GuiDescriptionpublic void onSlotClick(int slotNumber,
int button,
net.minecraft.screen.slot.SlotActionType action,
net.minecraft.entity.player.PlayerEntity player)
onSlotClick in class net.minecraft.screen.ScreenHandler@Nullable public @Nullable net.minecraft.screen.PropertyDelegate getPropertyDelegate()
GuiDescriptiongetPropertyDelegate in interface GuiDescriptionpublic GuiDescription setPropertyDelegate(net.minecraft.screen.PropertyDelegate delegate)
GuiDescriptionsetPropertyDelegate in interface GuiDescriptionpublic WPlayerInvPanel createPlayerInventoryPanel()
public WPlayerInvPanel createPlayerInventoryPanel(boolean hasLabel)
hasLabel - whether the "Inventory" label should be displayedpublic WPlayerInvPanel createPlayerInventoryPanel(WWidget label)
label - the inventory label widgetpublic static net.minecraft.inventory.Inventory getBlockInventory(net.minecraft.screen.ScreenHandlerContext ctx)
If no inventory is found, returns EmptyInventory.INSTANCE.
Searches for these implementations in the following order:
InventoryProviderInventoryProviderInventoryctx - the contextpublic static net.minecraft.inventory.Inventory getBlockInventory(net.minecraft.screen.ScreenHandlerContext ctx,
int size)
If no inventory is found, returns a simple mutable inventory with the specified number of slots.
Searches for these implementations in the following order:
InventoryProviderInventoryProviderInventoryctx - the contextsize - the fallback inventory sizepublic static net.minecraft.screen.PropertyDelegate getBlockPropertyDelegate(net.minecraft.screen.ScreenHandlerContext ctx)
If no property delegate is found, returns an empty property delegate with no properties.
Searches for block entities implementing PropertyDelegateHolder.
ctx - the contextpublic static net.minecraft.screen.PropertyDelegate getBlockPropertyDelegate(net.minecraft.screen.ScreenHandlerContext ctx,
int size)
If no property delegate is found, returns an array property delegate with the specified number of properties.
Searches for block entities implementing PropertyDelegateHolder.
ctx - the contextsize - the number of propertiespublic boolean canUse(net.minecraft.entity.player.PlayerEntity entity)
canUse in class net.minecraft.screen.ScreenHandlerpublic boolean isFocused(WWidget widget)
GuiDescriptionisFocused in interface GuiDescriptionpublic WWidget getFocus()
GuiDescriptiongetFocus in interface GuiDescriptionpublic void requestFocus(WWidget widget)
GuiDescriptionrequestFocus in interface GuiDescriptionpublic void releaseFocus(WWidget widget)
GuiDescriptionreleaseFocus in interface GuiDescriptionpublic boolean isFullscreen()
GuiDescriptionFullscreen GUIs have no default background painter and have the root panel stretched to fit the entire screen on the client.
isFullscreen in interface GuiDescriptionpublic void setFullscreen(boolean fullscreen)
GuiDescriptionsetFullscreen in interface GuiDescriptionfullscreen - true if this GUI is fullscreen, false otherwisepublic boolean isTitleVisible()
GuiDescriptionModders can disable this to render the title themselves with a widget.
isTitleVisible in interface GuiDescriptionpublic void setTitleVisible(boolean titleVisible)
GuiDescriptionsetTitleVisible in interface GuiDescriptiontitleVisible - true if the title is visible, false otherwisepublic HorizontalAlignment getTitleAlignment()
GuiDescriptiongetTitleAlignment in interface GuiDescriptionpublic void setTitleAlignment(HorizontalAlignment titleAlignment)
GuiDescriptionsetTitleAlignment in interface GuiDescriptiontitleAlignment - the new alignmentpublic final NetworkSide getNetworkSide()
public final net.fabricmc.fabric.api.networking.v1.PacketSender getPacketSender()