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 Summary
ConstructorsConstructorDescriptionInventoryVariableEvaluator(net.minecraft.world.Container inventory, int slot, Supplier<ValueDeseralizationContext> valueDeseralizationContext, IValueType<V> containingValueType) InventoryVariableEvaluator(net.minecraft.world.Container inventory, int slot, ValueDeseralizationContext valueDeseralizationContext, IValueType<V> containingValueType) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddError(net.minecraft.network.chat.MutableComponent error) Set the current error for the given aspect.voidList<net.minecraft.network.chat.MutableComponent> getVariable(INetwork network) getVariable(INetwork network, IPartNetwork partNetwork) booleanvoidprotected voidvoidrefreshVariable(INetwork network, boolean sendVariablesUpdateEvent) Refresh the variable reference by checking the inventory, and validating the containing variable.void
-
Constructor Details
-
InventoryVariableEvaluator
public InventoryVariableEvaluator(net.minecraft.world.Container inventory, int slot, Supplier<ValueDeseralizationContext> valueDeseralizationContext, IValueType<V> containingValueType) -
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
Refresh the variable reference by checking the inventory, and validating the containing variable.- Parameters:
network- The network.sendVariablesUpdateEvent- If aVariableContentsUpdatedEventevent must be sent if the variable has changed.
-
getVariable
-
getVariable
-
getVariableFacade
-
preValidate
protected void preValidate() -
clearErrors
public void clearErrors() -
setErrors
-
getErrors
-
addError
public void addError(net.minecraft.network.chat.MutableComponent error) Description copied from interface:IVariableFacade.IValidatorSet the current error for the given aspect.- Specified by:
addErrorin interfaceIVariableFacade.IValidator- Parameters:
error- The error to set, or null to clear.
-
onErrorsChanged
public void onErrorsChanged()
-