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

public abstract class FluidContainerMenu extends UAbstractContainerMenu
Adds a management system for fluids in menus like items.
  • Field Details

  • 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 type
      containerId - Container id
  • Method Details

    • addFluidSlot

      protected FluidSlot addFluidSlot(FluidSlot slot)
      Adds a fluid slot to the menu. Should be called in the constructor of the container that implements the menu.
      Parameters:
      slot - Fluid slot to add
      Returns:
      Same instance of the added fluid slot
    • getFluidSlot

      public FluidSlot getFluidSlot(int slotId)
      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 class net.minecraft.world.inventory.AbstractContainerMenu
    • broadcastChanges

      public void broadcastChanges()
      Broadcast changed data
      Overrides:
      broadcastChanges in class net.minecraft.world.inventory.AbstractContainerMenu
    • broadcastFullState

      public void broadcastFullState()
      Broadcast all data
      Overrides:
      broadcastFullState in class net.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 id
      stack - 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 id
      stack - 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 id
      stateId - State id
      stack - Fluid stack
    • initializeFluidContents

      public void initializeFluidContents(int stateId, List<net.minecraftforge.fluids.FluidStack> stacks)
      Sets the fluid slots on the client side
      Parameters:
      stateId - State id
      stacks - Fluid stacks
    • getLastFluidSlots

      protected List<net.minecraftforge.fluids.FluidStack> 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 any FluidHandlerModifiable to the container. You can specialize the inventory height (slot rows) and width (slot columns).
      Parameters:
      handler - Some fluid handler
      inventoryHeight - Slot rows
      inventoryWidth - Slot columns
      x - Start x
      y - Start y
    • addFluidSlots

      protected void addFluidSlots(FluidHandlerModifiable handler, FluidContainerMenu.FluidSlotHandlerFunction function, int inventoryHeight, int inventoryWidth, int x, int y)
      This methods can add any FluidHandlerModifiable to the container. You can specialize the inventory height (slot rows) and width (slot columns). You must supplier a function that create a fluid slot. With this you can set your own slot. implementations.
      Parameters:
      handler - Some fluid handler
      function - Function to create a fluid slot.
      inventoryHeight - Slot rows
      inventoryWidth - Slot columns
      x - Start x
      y - Start y
    • addFluidSlots

      protected void addFluidSlots(FluidHandlerModifiable handler, int startIndex, int inventoryHeight, int inventoryWidth, int x, int y)
      This methods can add any FluidHandlerModifiable to the container. You can specialize the inventory height (slot rows) and width (slot columns).
      Parameters:
      handler - Some fluid handler
      startIndex - Start index of the handler
      inventoryHeight - Slot rows
      inventoryWidth - Slot columns
      x - Start x
      y - Start y
    • addFluidSlots

      protected void addFluidSlots(FluidHandlerModifiable handler, FluidContainerMenu.FluidSlotHandlerFunction function, int startIndex, int inventoryHeight, int inventoryWidth, int x, int y)
      This methods can add any FluidHandlerModifiable to the container. You can specialize the inventory height (slot rows) and width (slot columns). You must supplier a function that create a fluid slot. With this you can set your own slot. implementations.
      Parameters:
      handler - Some fluid handler
      function - Function to create a fluid slot.
      startIndex - Start index of the handler
      inventoryHeight - Slot rows
      inventoryWidth - Slot columns
      x - Start x
      y - Start y