Class ContainerLogicProgrammerBase

java.lang.Object
net.minecraft.world.inventory.AbstractContainerMenu
org.cyclops.cyclopscore.inventory.container.ContainerExtended
org.cyclops.cyclopscore.inventory.container.InventoryContainer
org.cyclops.cyclopscore.inventory.container.ScrollingInventoryContainer<ILogicProgrammerElement<RenderPattern, ContainerScreenLogicProgrammerBase<?>, ContainerLogicProgrammerBase, ?>>
org.cyclops.integrateddynamics.inventory.container.ContainerLogicProgrammerBase
All Implemented Interfaces:
org.cyclops.cyclopscore.client.gui.component.WidgetScrollBar.IScrollCallback, org.cyclops.cyclopscore.inventory.container.button.IContainerButtonClickAcceptorServer<org.cyclops.cyclopscore.inventory.container.ContainerExtended>, org.cyclops.cyclopscore.inventory.IValueNotifiable, org.cyclops.cyclopscore.inventory.IValueNotifier, org.cyclops.cyclopscore.persist.IDirtyMarkListener
Direct Known Subclasses:
ContainerLogicProgrammer, ContainerLogicProgrammerPortable

public abstract class ContainerLogicProgrammerBase extends org.cyclops.cyclopscore.inventory.container.ScrollingInventoryContainer<ILogicProgrammerElement<RenderPattern, ContainerScreenLogicProgrammerBase<?>, ContainerLogicProgrammerBase, ?>> implements org.cyclops.cyclopscore.persist.IDirtyMarkListener
Base container for the logic programmer.
  • Field Details

  • Constructor Details

    • ContainerLogicProgrammerBase

      public ContainerLogicProgrammerBase(@Nullable net.minecraft.world.inventory.MenuType<?> type, int id, net.minecraft.world.entity.player.Inventory playerInventory)
  • Method Details

    • getElements

    • setScreenCallbackHandler

      public void setScreenCallbackHandler(ContainerLogicProgrammerBase.ScreenCallbackHandler screenCallbackHandler)
    • getGui

    • initializeSlotsPre

      protected void initializeSlotsPre()
    • initializeSlotsPost

      protected void initializeSlotsPost()
    • getPageSize

      public int getPageSize()
      Specified by:
      getPageSize in class org.cyclops.cyclopscore.inventory.container.ScrollingInventoryContainer<ILogicProgrammerElement<RenderPattern, ContainerScreenLogicProgrammerBase<?>, ContainerLogicProgrammerBase, ?>>
    • isAssertInventorySize

      protected boolean isAssertInventorySize()
      Overrides:
      isAssertInventorySize in class org.cyclops.cyclopscore.inventory.container.InventoryContainer
    • getSizeInventory

      protected int getSizeInventory()
      Overrides:
      getSizeInventory in class org.cyclops.cyclopscore.inventory.container.InventoryContainer
    • setActiveElementById

      public void setActiveElementById(net.minecraft.resources.Identifier typeId, net.minecraft.resources.Identifier elementId)
    • setActiveElement

      public void setActiveElement(ILogicProgrammerElement activeElement, int baseX, int baseY)
      Set the new active element.
      Parameters:
      activeElement - The new element.
      baseX - The slots X coordinate
      baseY - The slots Y coordinate
    • setElementInventory

      public void setElementInventory(ILogicProgrammerElement element, int baseX, int baseY)
      Set the new active element.
      Parameters:
      element - The new element.
      baseX - The slots X coordinate
      baseY - The slots Y coordinate
    • refreshElementInventory

      public void refreshElementInventory(ILogicProgrammerElement element, int baseX, int baseY)
      Recreate the slots of the given element, for example when the element changes its render pattern. In contrast to setElementInventory(ILogicProgrammerElement, int, int), this keeps the current label.
      Parameters:
      element - The element.
      baseX - The slots X coordinate
      baseY - The slots Y coordinate
    • applyExpressionAction

      public void applyExpressionAction(net.minecraft.nbt.CompoundTag action)
      Apply an expression edit action to the active element. This is called on the server via a packet, and directly on the client.
      Parameters:
      action - The action.
    • getExpressionHistory

      public ExpressionHistory getExpressionHistory()
      Returns:
      The changes to the expression in the active element, which are only recorded on the client.
    • getOperatorElement

      @Nullable public OperatorLPElement getOperatorElement(IOperator operator)
      Parameters:
      operator - An operator.
      Returns:
      The element for building expressions with this operator as root, or null if there is none.
    • applySetExpressionAction

      protected void applySetExpressionAction(net.minecraft.nbt.CompoundTag action)
      Replace the whole expression of the active element. If the root operator changes, the element of that operator becomes active, as when loading a card. This also happens if no operator element is active, such as for an expression that was typed in the empty panel.
      Parameters:
      action - A set action.
    • canWriteActiveElementPre

      public boolean canWriteActiveElementPre()
    • canWriteActiveElement

      public boolean canWriteActiveElement()
    • getActiveElement

    • getTemporarySlotsElement

      @Nullable public ILogicProgrammerElement getTemporarySlotsElement()
      Returns:
      The element owning the current temporary input slots. This differs from the active element for nested elements, such as list entries.
    • removed

      public void removed(net.minecraft.world.entity.player.Player player)
      Overrides:
      removed in class org.cyclops.cyclopscore.inventory.container.InventoryContainer
    • onLabelPacket

      public void onLabelPacket(String label)
    • labelCurrent

      protected void labelCurrent()
    • writeElementInfo

      protected net.minecraft.world.item.ItemStack writeElementInfo()
    • onDirty

      public void onDirty()
      Specified by:
      onDirty in interface org.cyclops.cyclopscore.persist.IDirtyMarkListener
    • loadConfigFrom

      protected void loadConfigFrom(net.minecraft.world.item.ItemStack itemStack)
    • getLastError

      public net.minecraft.network.chat.Component getLastError()
    • getTemporaryInputSlots

      public org.cyclops.cyclopscore.inventory.SimpleInventory getTemporaryInputSlots()
    • hasWriteItemInSlot

      public boolean hasWriteItemInSlot()
    • isWriteSlot

      public boolean isWriteSlot(net.minecraft.world.inventory.Slot slot)
      Parameters:
      slot - A slot of this container.
      Returns:
      If it is the slot that cards are written in.
    • returnWriteItemToPlayer

      public void returnWriteItemToPlayer()
    • setExpressionSlotFilter

      public void setExpressionSlotFilter(@Nullable IValueType type)
      Only show operators whose output fits the given type, used while an expression slot is selected. For operator slots, all operators are shown.
      Parameters:
      type - The expected type, or null to disable this filter.
    • additionalApplies

      protected boolean additionalApplies(ILogicProgrammerElement item)
      Overrides:
      additionalApplies in class org.cyclops.cyclopscore.inventory.container.ScrollingInventoryContainer<ILogicProgrammerElement<RenderPattern, ContainerScreenLogicProgrammerBase<?>, ContainerLogicProgrammerBase, ?>>
    • clicked

      public void clicked(int slotId, int mouseButton, net.minecraft.world.inventory.ContainerInput clickType, net.minecraft.world.entity.player.Player player)
      Overrides:
      clicked in class org.cyclops.cyclopscore.inventory.container.ContainerExtended