Skip to content

Commit

Permalink
Fix crash when passing any list to Ingr.with_items, Closes #1457
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Jan 9, 2025
1 parent e036306 commit 2d364c4
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
import org.cyclops.commoncapabilities.api.ingredient.IngredientComponent;
import org.cyclops.integrateddynamics.api.evaluate.EvaluationException;
import org.cyclops.integrateddynamics.api.evaluate.operator.IOperator;
import org.cyclops.integrateddynamics.api.evaluate.variable.IValue;
import org.cyclops.integrateddynamics.api.evaluate.variable.IValueType;
import org.cyclops.integrateddynamics.api.evaluate.variable.IValueTypeListProxy;
import org.cyclops.integrateddynamics.api.evaluate.variable.IValueTypeNumber;
import org.cyclops.integrateddynamics.api.evaluate.variable.IVariable;
import org.cyclops.integrateddynamics.api.evaluate.variable.*;
import org.cyclops.integrateddynamics.api.ingredient.IIngredientComponentHandler;
import org.cyclops.integrateddynamics.api.logicprogrammer.IConfigRenderPattern;
import org.cyclops.integrateddynamics.core.evaluate.build.OperatorBuilder;
Expand Down Expand Up @@ -550,7 +546,8 @@ public static <VT extends IValueType<V>, V extends IValue, T, M> List<T> unwrapI
if (list.getRawValue().getValueType() != componentHandler.getValueType()) {
throw new EvaluationException(Component.translatable(
L10NValues.VALUETYPE_ERROR_INVALIDLISTVALUETYPE,
list.getRawValue().getValueType(), componentHandler.getValueType()));
Component.translatable(componentHandler.getValueType().getTranslationKey()),
Component.translatable(list.getRawValue().getValueType().getTranslationKey())));
}
List<T> listTransformed = Lists.newArrayListWithExpectedSize(list.getRawValue().getLength());
for (V value : list.getRawValue()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public CombinedOperator deserialize(ValueDeseralizationContext valueDeseralizati
} catch (ClassCastException e) {
e.printStackTrace();
throw new EvaluationException(Component.translatable(L10NValues.VALUETYPE_ERROR_DESERIALIZE,
valueOperator, e.getMessage()));
valueOperator.toString(), e.getMessage()));
}
IOperator[] operators = new IOperator[list.size()];
for (int i = 0; i < list.size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public CurriedOperator deserialize(ValueDeseralizationContext valueDeseralizatio
} catch (ClassCastException e) {
e.printStackTrace();
throw new EvaluationException(Component.translatable(L10NValues.VALUETYPE_ERROR_DESERIALIZE,
valueOperator, e.getMessage()));
valueOperator.toString(), e.getMessage()));
}
ListTag list = tag.getList("values", Tag.TAG_COMPOUND);
IVariable[] variables = new IVariable[list.size()];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public IOperator deserialize(ValueDeseralizationContext valueDeseralizationConte
IOperatorSerializer serializer = namedSerializers.get(serializerName);
if (serializer == null) {
throw new EvaluationException(
Component.translatable(L10NValues.OPERATOR_ERROR_NO_DESERIALIZER, value));
Component.translatable(L10NValues.OPERATOR_ERROR_NO_DESERIALIZER, value.toString()));
}
return serializer.deserialize(valueDeseralizationContext, tag.get("value"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public PositionedOperator deserialize(ValueDeseralizationContext valueDeseraliza
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException | ClassCastException | IllegalAccessException e) {
e.printStackTrace();
throw new EvaluationException(Component.translatable(L10NValues.VALUETYPE_ERROR_DESERIALIZE,
value, e.getMessage()));
value.toString(), e.getMessage()));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public PredicateOperator<IValueType<IValue>, IValue> deserialize(ValueDeseraliza
} catch (ClassCastException e) {
e.printStackTrace();
throw new EvaluationException(Component.translatable(L10NValues.VALUETYPE_ERROR_DESERIALIZE,
value, e.getMessage()));
value.toString(), e.getMessage()));
}
}
}
Expand Down

0 comments on commit 2d364c4

Please sign in to comment.