Package info.u_team.u_team_core.menu
Class FluidContainerMenu
java.lang.Object
net.minecraft.world.inventory.AbstractContainerMenu
info.u_team.u_team_core.menu.UAbstractContainerMenu
info.u_team.u_team_core.menu.FluidContainerMenu
- Direct Known Subclasses:
UContainerMenu
Adds a management system for fluids in menus like items.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Used as a function to customize fluid slots with the append methodsNested classes/interfaces inherited from class info.u_team.u_team_core.menu.UAbstractContainerMenu
UAbstractContainerMenu.SlotContainerFunction, UAbstractContainerMenu.SlotHandlerFunction
-
Field Summary
FieldsFields 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
FluidContainerMenu
(net.minecraft.world.inventory.MenuType<?> menuType, int containerId) Creates a container menu. -
Method Summary
Modifier and TypeMethodDescriptionprotected FluidSlot
addFluidSlot
(FluidSlot slot) Adds a fluid slot to the menu.protected void
addFluidSlots
(FluidHandlerModifiable handler, int inventoryHeight, int inventoryWidth, int x, int y) This methods can add anyFluidHandlerModifiable
to the container.protected void
addFluidSlots
(FluidHandlerModifiable handler, int startIndex, int inventoryHeight, int inventoryWidth, int x, int y) This methods can add anyFluidHandlerModifiable
to the container.protected void
addFluidSlots
(FluidHandlerModifiable handler, FluidContainerMenu.FluidSlotHandlerFunction function, int inventoryHeight, int inventoryWidth, int x, int y) This methods can add anyFluidHandlerModifiable
to the container.protected void
addFluidSlots
(FluidHandlerModifiable handler, FluidContainerMenu.FluidSlotHandlerFunction function, int startIndex, int inventoryHeight, int inventoryWidth, int x, int y) This methods can add anyFluidHandlerModifiable
to the container.void
Broadcast changed datavoid
Broadcast all datavoid
fluidSlotClick
(net.minecraft.server.level.ServerPlayer player, int index, boolean shift, net.minecraft.world.item.ItemStack clientClickStack) getFluidSlot
(int slotId) Returns the fluid slot for a give slot id.protected List<net.minecraftforge.fluids.FluidStack>
Returns the last slot list that is used to check if a fluid stack has changed since last check.void
initializeFluidContents
(int stateId, List<net.minecraftforge.fluids.FluidStack> stacks) Sets the fluid slots on the client sidevoid
Sends all menu data to the client.void
setFluid
(int slotId, int stateId, net.minecraftforge.fluids.FluidStack stack) Sets a fluid slot on the client sidevoid
setRemoteFluidSlot
(int slotId, net.minecraftforge.fluids.FluidStack stack) Set the fluid stack that should be in the remote fluid slot.void
setRemoteFluidSlotNoCopy
(int slotId, net.minecraftforge.fluids.FluidStack stack) Set the fluid stack that should be in the remote fluid slot.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, stillValid, suppressRemoteUpdates, transferState
-
Field Details
-
fluidSlots
-
-
Constructor Details
-
FluidContainerMenu
protected FluidContainerMenu(net.minecraft.world.inventory.MenuType<?> menuType, int containerId) Creates a container menu. Must be implemented by a sub class to be used.- Parameters:
menuType
- Menu typecontainerId
- Container id
-
-
Method Details
-
getFluidSlot
Returns the fluid slot for a give slot id. Throws exception if the id is out of bounds.- Parameters:
slotId
- Slot id- Returns:
- Fluid slot with that id
-
fluidSlotClick
public void fluidSlotClick(net.minecraft.server.level.ServerPlayer player, int index, boolean shift, net.minecraft.world.item.ItemStack clientClickStack) -
sendAllDataToRemote
public void sendAllDataToRemote()Sends all menu data to the client.- Overrides:
sendAllDataToRemote
in classnet.minecraft.world.inventory.AbstractContainerMenu
-
broadcastChanges
public void broadcastChanges()Broadcast changed data- Overrides:
broadcastChanges
in classnet.minecraft.world.inventory.AbstractContainerMenu
-
broadcastFullState
public void broadcastFullState()Broadcast all data- Overrides:
broadcastFullState
in classnet.minecraft.world.inventory.AbstractContainerMenu
-
setRemoteFluidSlot
public void setRemoteFluidSlot(int slotId, net.minecraftforge.fluids.FluidStack stack) Set the fluid stack that should be in the remote fluid slot. Copies the stack.- Parameters:
slotId
- Slot idstack
- Fluid stack
-
setRemoteFluidSlotNoCopy
public void setRemoteFluidSlotNoCopy(int slotId, net.minecraftforge.fluids.FluidStack stack) Set the fluid stack that should be in the remote fluid slot. Doesn't copy the stack.- Parameters:
slotId
- Slot idstack
- Fluid stack
-
setFluid
public void setFluid(int slotId, int stateId, net.minecraftforge.fluids.FluidStack stack) Sets a fluid slot on the client side- Parameters:
slotId
- Slot idstateId
- State idstack
- Fluid stack
-
initializeFluidContents
Sets the fluid slots on the client side- Parameters:
stateId
- State idstacks
- Fluid stacks
-
getLastFluidSlots
Returns the last slot list that is used to check if a fluid stack has changed since last check. The list should not be modified manually.- Returns:
- List with fluid stacks
-
addFluidSlots
protected void addFluidSlots(FluidHandlerModifiable handler, int inventoryHeight, int inventoryWidth, int x, int y) This methods can add anyFluidHandlerModifiable
to the container. You can specialize the inventory height (slot rows) and width (slot columns).- Parameters:
handler
- Some fluid handlerinventoryHeight
- Slot rowsinventoryWidth
- Slot columnsx
- Start xy
- Start y
-
addFluidSlots
protected void addFluidSlots(FluidHandlerModifiable handler, int startIndex, int inventoryHeight, int inventoryWidth, int x, int y) This methods can add anyFluidHandlerModifiable
to the container. You can specialize the inventory height (slot rows) and width (slot columns).- Parameters:
handler
- Some fluid handlerstartIndex
- Start index of the handlerinventoryHeight
- Slot rowsinventoryWidth
- Slot columnsx
- Start xy
- Start y