Class ContainerAspectSettings

java.lang.Object
net.minecraft.world.inventory.AbstractContainerMenu
org.cyclops.cyclopscore.inventory.container.ContainerExtended
org.cyclops.cyclopscore.inventory.container.InventoryContainer
org.cyclops.integrateddynamics.core.inventory.container.ContainerAspectSettings
All Implemented Interfaces:
org.cyclops.cyclopscore.inventory.container.button.IContainerButtonClickAcceptorServer<org.cyclops.cyclopscore.inventory.container.ContainerExtended>, org.cyclops.cyclopscore.inventory.IValueNotifiable, org.cyclops.cyclopscore.inventory.IValueNotifier

public class ContainerAspectSettings extends org.cyclops.cyclopscore.inventory.container.InventoryContainer
Container for aspect settings.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    A variable slot that is only visible when its property is the active property.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final int
     
    static final int
    The position of the variable slot of the active property.
    static final int
     

    Fields inherited from class org.cyclops.cyclopscore.inventory.container.InventoryContainer

    inventory

    Fields inherited from class org.cyclops.cyclopscore.inventory.container.ContainerExtended

    ITEMBOX, offsetX, offsetY, player

    Fields inherited from class net.minecraft.world.inventory.AbstractContainerMenu

    CARRIED_SLOT_SIZE, containerId, lastSlots, QUICKCRAFT_HEADER_CONTINUE, QUICKCRAFT_HEADER_END, QUICKCRAFT_HEADER_START, QUICKCRAFT_TYPE_CHARITABLE, QUICKCRAFT_TYPE_CLONE, QUICKCRAFT_TYPE_GREEDY, remoteSlots, SLOT_CLICKED_OUTSIDE, SLOT_SIZE, slots, SLOTS_PER_ROW
  • Constructor Summary

    Constructors
    Constructor
    Description
    ContainerAspectSettings(int id, net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.network.FriendlyByteBuf packetBuffer)
     
    ContainerAspectSettings(int id, net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.world.Container inventory, Optional<PartTarget> target, Optional<IPartContainer> partContainer, Optional<IPartType> partType, IAspect<?,?> aspect)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected void
    Show the value that the variable of a setting currently produces, so that players can inspect what a variable-driven setting evaluates to.
    boolean
    clickMenuButton(net.minecraft.world.entity.player.Player player, int id)
     
    int
     
     
     
     
     
    com.google.common.collect.BiMap<Integer, IAspectPropertyTypeInstance>
     
     
    <T extends IValueType<V>, V extends IValue>
    V
    getPropertyValue(ValueDeseralizationContext valueDeseralizationContext, IAspectPropertyTypeInstance<T,V> property)
     
    net.minecraft.network.chat.Component
     
    protected int
     
     
    protected void
     
    boolean
     
    boolean
     
    void
    onUpdate(int valueId, net.minecraft.nbt.CompoundTag value)
     
    protected static IAspect<?,?>
    readAspect(net.minecraft.network.FriendlyByteBuf packetBuffer)
     
    void
    removed(net.minecraft.world.entity.player.Player player)
     
    void
    Persist any changes to the variable slots into the part state.
    protected void
     
    void
    Indicate which property is currently being configured, so that its variable slot becomes visible.
    void
    setValue(ValueDeseralizationContext valueDeseralizationContext, IAspectPropertyTypeInstance property, IValue value)
     
    boolean
    stillValid(net.minecraft.world.entity.player.Player player)
     

    Methods inherited from class org.cyclops.cyclopscore.inventory.container.InventoryContainer

    getContainerInventory, isAssertInventorySize

    Methods inherited from class org.cyclops.cyclopscore.inventory.container.ContainerExtended

    addInventory, addPlayerArmorInventory, addPlayerInventory, addSlot, addSlotListener, adjustPhantomSlot, clicked, createNewSlot, fillPhantomSlot, getHolderLookupProvider, getNextValueId, getPlayerIInventory, getSlotRange, getSlotStart, getValue, getValueIds, getValueNotifiableType, moveItemStackTo, onButtonClick, putButtonAction, quickMoveStack, registerSyncedVariable, resetQuickCraft, setGuiValueListener, setSlotPosX, setSlotPosY, setValue

    Methods inherited from class net.minecraft.world.inventory.AbstractContainerMenu

    addDataSlot, addDataSlots, addInventoryExtendedSlots, addInventoryHotbarSlots, addStandardInventorySlots, broadcastFullState, canDragTo, canItemQuickReplace, canTakeItemForPickAll, checkContainerDataCount, checkContainerSize, clearContainer, findSlot, getCarried, getItems, getQuickcraftHeader, getQuickcraftMask, getQuickCraftPlaceCount, getQuickcraftType, getRedstoneSignalFromBlockEntity, getRedstoneSignalFromContainer, getSlot, getStateId, getType, incrementStateId, initializeContents, isValidQuickcraftType, isValidSlotIndex, removeSlotListener, resumeRemoteUpdates, sendAllDataToRemote, setCarried, setData, setItem, setRemoteCarried, setRemoteSlot, setRemoteSlotUnsafe, setSelectedBundleItemIndex, setSynchronizer, slotsChanged, stillValid, suppressRemoteUpdates, transferState

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • ContainerAspectSettings

      public ContainerAspectSettings(int id, net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.network.FriendlyByteBuf packetBuffer)
    • ContainerAspectSettings

      public ContainerAspectSettings(int id, net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.world.Container inventory, Optional<PartTarget> target, Optional<IPartContainer> partContainer, Optional<IPartType> partType, IAspect<?,?> aspect)
  • Method Details

    • readAspect

      protected static IAspect<?,?> readAspect(net.minecraft.network.FriendlyByteBuf packetBuffer)
    • getPropertyIds

      public com.google.common.collect.BiMap<Integer, IAspectPropertyTypeInstance> getPropertyIds()
    • getPropertyTypes

      public List<IAspectPropertyTypeInstance> getPropertyTypes()
    • getPartType

      public Optional<IPartType> getPartType()
    • getAspect

      public IAspect getAspect()
    • getTarget

      public Optional<PartTarget> getTarget()
    • getActivePropertyIndex

      public int getActivePropertyIndex()
      Returns:
      The index of the property whose variable slot is currently visible.
    • setActivePropertyIndex

      public void setActivePropertyIndex(int index)
      Indicate which property is currently being configured, so that its variable slot becomes visible. This must be called on both sides, as the client informs the server via clickMenuButton(Player, int).
      Parameters:
      index - The property index.
    • clickMenuButton

      public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id)
      Overrides:
      clickMenuButton in class net.minecraft.world.inventory.AbstractContainerMenu
    • isPropertyVariableFilled

      public boolean isPropertyVariableFilled(int index)
      Parameters:
      index - A property index.
      Returns:
      If the variable slot of the given property holds a variable.
    • getPropertyVariableError

      @Nullable public net.minecraft.network.chat.Component getPropertyVariableError(int index)
      Parameters:
      index - A property index.
      Returns:
      The error inside the variable slot of the given property, or null if there is no error.
    • initializeValues

      protected void initializeValues()
      Overrides:
      initializeValues in class org.cyclops.cyclopscore.inventory.container.ContainerExtended
    • setValue

      public void setValue(ValueDeseralizationContext valueDeseralizationContext, IAspectPropertyTypeInstance property, IValue value)
    • getPartState

      public Optional<IPartState> getPartState()
    • stillValid

      public boolean stillValid(net.minecraft.world.entity.player.Player player)
      Overrides:
      stillValid in class org.cyclops.cyclopscore.inventory.container.InventoryContainer
    • getSizeInventory

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

      public <T extends IValueType<V>, V extends IValue> V getPropertyValue(ValueDeseralizationContext valueDeseralizationContext, IAspectPropertyTypeInstance<T,V> property)
    • broadcastChanges

      public void broadcastChanges()
      Overrides:
      broadcastChanges in class org.cyclops.cyclopscore.inventory.container.ContainerExtended
    • broadcastVariableDrivenValues

      protected void broadcastVariableDrivenValues(IPartState partState)
      Show the value that the variable of a setting currently produces, so that players can inspect what a variable-driven setting evaluates to. Settings that are not driven by a variable keep showing their statically configured value.
      Parameters:
      partState - The part state.
    • getEffectivePropertyValue

      @Nullable public IValue getEffectivePropertyValue(int index)
      Parameters:
      index - A property index.
      Returns:
      The value that is shown for the given property: the value that its variable produces if it is driven by one, and the statically configured value otherwise. This can only be called server-side.
    • isPropertyVariableDriven

      public boolean isPropertyVariableDriven(int index)
      Parameters:
      index - A property index.
      Returns:
      If the value of the given property is currently determined by its variable.
    • removed

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

      public void saveVariablesInventory()
      Persist any changes to the variable slots into the part state.
    • saveVariablesInventory

      protected void saveVariablesInventory(IPartState partState)
    • onUpdate

      public void onUpdate(int valueId, net.minecraft.nbt.CompoundTag value)
      Specified by:
      onUpdate in interface org.cyclops.cyclopscore.inventory.IValueNotifiable
      Overrides:
      onUpdate in class org.cyclops.cyclopscore.inventory.container.ContainerExtended