Package info.u_team.u_team_core.menu
Class UContainerMenu
java.lang.Object
net.minecraft.world.inventory.AbstractContainerMenu
info.u_team.u_team_core.menu.UAbstractContainerMenu
info.u_team.u_team_core.menu.FluidContainerMenu
info.u_team.u_team_core.menu.UContainerMenu
- Direct Known Subclasses:
UBlockEntityContainerMenu
A basic menu with synchronization capabilities that implements the
FluidContainerMenu
.-
Nested Class Summary
Nested classes/interfaces inherited from class info.u_team.u_team_core.menu.FluidContainerMenu
FluidContainerMenu.FluidSlotHandlerFunction
Nested classes/interfaces inherited from class info.u_team.u_team_core.menu.UAbstractContainerMenu
UAbstractContainerMenu.SlotContainerFunction, UAbstractContainerMenu.SlotHandlerFunction
-
Field Summary
Fields inherited from class info.u_team.u_team_core.menu.FluidContainerMenu
fluidSlots
Fields inherited from class net.minecraft.world.inventory.AbstractContainerMenu
CARRIED_SLOT_SIZE, containerId, containerListeners, lastSlots, QUICKCRAFT_HEADER_CONTINUE, QUICKCRAFT_HEADER_END, QUICKCRAFT_HEADER_START, QUICKCRAFT_TYPE_CHARITABLE, QUICKCRAFT_TYPE_CLONE, QUICKCRAFT_TYPE_GREEDY, SLOT_CLICKED_OUTSIDE, slots, stateId, suppressRemoteUpdates
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
UContainerMenu
(net.minecraft.world.inventory.MenuType<?> menuType, int containerId) Creates a new container. -
Method Summary
Modifier and TypeMethodDescriptionprotected <E extends DataHolder>
EaddDataHolderToClient
(E holder) Adds a newDataHolder
that will automatically synchronize values from the server to the client.protected <E extends DataHolder>
EaddDataHolderToServer
(E holder) Adds a newDataHolder
that will synchronize values from the client to the server.void
Broadcast changed datavoid
Broadcast data from the client to the server if changed.void
Sends all menu data to the client.final void
setDataHolder
(net.minecraftforge.fml.LogicalSide side, int index, net.minecraft.network.FriendlyByteBuf dataHolderBuffer) Called by the packet handler to update the values on the right side.boolean
stillValid
(net.minecraft.world.entity.player.Player player) Default player interaction with this container to trueMethods inherited from class info.u_team.u_team_core.menu.FluidContainerMenu
addFluidSlot, addFluidSlots, addFluidSlots, addFluidSlots, addFluidSlots, broadcastFullState, fluidSlotClick, getFluidSlot, getLastFluidSlots, initializeFluidContents, setFluid, setRemoteFluidSlot, setRemoteFluidSlotNoCopy
Methods inherited from class info.u_team.u_team_core.menu.UAbstractContainerMenu
addPlayerInventory, addSlots, addSlots, addSlots, addSlots, addSlots, addSlots, addSlots, addSlots, getLastSlots, getSynchronizerPlayer, initMenu, setSynchronizerPlayer
Methods inherited from class net.minecraft.world.inventory.AbstractContainerMenu
addDataSlot, addDataSlots, addSlot, addSlotListener, canDragTo, canItemQuickReplace, canTakeItemForPickAll, checkContainerDataCount, checkContainerSize, clearContainer, clicked, clickMenuButton, findSlot, getCarried, getItems, getQuickcraftHeader, getQuickcraftMask, getQuickCraftSlotCount, getQuickcraftType, getRedstoneSignalFromBlockEntity, getRedstoneSignalFromContainer, getSlot, getStateId, getType, incrementStateId, initializeContents, isValidQuickcraftType, isValidSlotIndex, moveItemStackTo, quickMoveStack, removed, removeSlotListener, resetQuickCraft, resumeRemoteUpdates, setCarried, setData, setItem, setRemoteCarried, setRemoteSlot, setRemoteSlotNoCopy, setSynchronizer, slotsChanged, stillValid, suppressRemoteUpdates, transferState
-
Constructor Details
-
UContainerMenu
protected UContainerMenu(net.minecraft.world.inventory.MenuType<?> menuType, int containerId) Creates a new container. Must be implemented by a sub class to be used.- Parameters:
menuType
- Menu typecontainerId
- Container id
-
-
Method Details
-
stillValid
public boolean stillValid(net.minecraft.world.entity.player.Player player) Default player interaction with this container to true- Specified by:
stillValid
in classnet.minecraft.world.inventory.AbstractContainerMenu
-
addDataHolderToClient
Adds a newDataHolder
that will automatically synchronize values from the server to the client.- Parameters:
holder
- Data holder- Returns:
- The supplied data holder
-
addDataHolderToServer
Adds a newDataHolder
that will synchronize values from the client to the server.
To synchronize values automatically the screen must implementUContainerMenuScreen
. If not you must manually callbroadcastChangesToServer()
every time you update values on the client that should be synchronized to the server.- Parameters:
holder
- Data holder- Returns:
- The supplied data holder
-
sendAllDataToRemote
public void sendAllDataToRemote()Sends all menu data to the client.- Overrides:
sendAllDataToRemote
in classFluidContainerMenu
-
broadcastChanges
public void broadcastChanges()Broadcast changed data- Overrides:
broadcastChanges
in classFluidContainerMenu
-
broadcastChangesToServer
public void broadcastChangesToServer()Broadcast data from the client to the server if changed. Needs to be called everytime you want to send changed data from the client to the server. Will be called automatically every tick if the screens base class isUContainerMenuScreen
.- See Also:
-
setDataHolder
public final void setDataHolder(net.minecraftforge.fml.LogicalSide side, int index, net.minecraft.network.FriendlyByteBuf dataHolderBuffer) Called by the packet handler to update the values on the right side.- Parameters:
side
- Side that should set the valuesindex
- Index of the data holder in the listdataHolderBuffer
- The buffer that should be set
-