Class InventoryVariableEvaluator<V extends IValue>

java.lang.Object
org.cyclops.integrateddynamics.core.evaluate.InventoryVariableEvaluator<V>
Type Parameters:
V - The variable value type
All Implemented Interfaces:
IVariableFacade.IValidator

public class InventoryVariableEvaluator<V extends IValue> extends Object implements IVariableFacade.IValidator
A convenience holder class for getting variables from variable cards in a certain inventory slot.
  • Constructor Details

    • InventoryVariableEvaluator

      public InventoryVariableEvaluator(net.minecraft.world.Container inventory, int slot, ValueDeseralizationContext valueDeseralizationContext, IValueType<V> containingValueType)
  • Method Details

    • hasVariable

      public boolean hasVariable()
      Returns:
      If the configured slot has an item.
    • refreshVariable

      public void refreshVariable(@Nullable INetwork network, boolean sendVariablesUpdateEvent)
      Refresh the variable reference by checking the inventory, and validating the containing variable.
      Parameters:
      network - The network.
      sendVariablesUpdateEvent - If a VariableContentsUpdatedEvent event must be sent if the variable has changed.
    • getVariable

      @Nullable public IVariable<V> getVariable(INetwork network)
    • getVariable

      @Nullable @Deprecated public IVariable<V> getVariable(IPartNetwork partNetwork)
      Deprecated.
    • getVariable

      @Nullable public IVariable<V> getVariable(INetwork network, IPartNetwork partNetwork)
    • getVariableFacade

      public IVariableFacade getVariableFacade()
    • preValidate

      protected void preValidate()
    • clearErrors

      public void clearErrors()
    • setErrors

      public void setErrors(List<net.minecraft.network.chat.MutableComponent> errors)
    • getErrors

      public List<net.minecraft.network.chat.MutableComponent> getErrors()
    • addError

      public void addError(net.minecraft.network.chat.MutableComponent error)
      Description copied from interface: IVariableFacade.IValidator
      Set the current error for the given aspect.
      Specified by:
      addError in interface IVariableFacade.IValidator
      Parameters:
      error - The error to set, or null to clear.
    • onErrorsChanged

      public void onErrorsChanged()