Skip to content

Commit

Permalink
Allow Ingredient.with* operators to have empty ingredient inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Jun 24, 2024
1 parent 3aaa393 commit 9b52876
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3727,8 +3727,8 @@ public IValue evaluate(OperatorBase.SafeVariablesGetter variables) throws Evalua
ValueObjectTypeIngredients.ValueIngredients value = variables.getValue(0, ValueTypes.OBJECT_INGREDIENTS);
ValueTypeInteger.ValueInteger index = variables.getValue(1, ValueTypes.INTEGER);
ValueObjectTypeItemStack.ValueItemStack itemStack = variables.getValue(2, ValueTypes.OBJECT_ITEMSTACK);
if (!value.getRawValue().isPresent()) {
return value;
if (value.getRawValue().isEmpty()) {
value = ValueObjectTypeIngredients.ValueIngredients.of(new MixedIngredients(Maps.newIdentityHashMap()));
}
IMixedIngredients baseIngredients = value.getRawValue().get();
return ValueObjectTypeIngredients.ValueIngredients.of(new ExtendedIngredientsSingle<>(baseIngredients,
Expand All @@ -3744,8 +3744,8 @@ public IValue evaluate(OperatorBase.SafeVariablesGetter variables) throws Evalua
ValueObjectTypeIngredients.ValueIngredients value = variables.getValue(0, ValueTypes.OBJECT_INGREDIENTS);
ValueTypeInteger.ValueInteger index = variables.getValue(1, ValueTypes.INTEGER);
ValueObjectTypeFluidStack.ValueFluidStack fluidStack = variables.getValue(2, ValueTypes.OBJECT_FLUIDSTACK);
if (!value.getRawValue().isPresent()) {
return value;
if (value.getRawValue().isEmpty()) {
value = ValueObjectTypeIngredients.ValueIngredients.of(new MixedIngredients(Maps.newIdentityHashMap()));
}
IMixedIngredients baseIngredients = value.getRawValue().get();
return ValueObjectTypeIngredients.ValueIngredients.of(new ExtendedIngredientsSingle<>(baseIngredients,
Expand All @@ -3761,8 +3761,8 @@ public IValue evaluate(OperatorBase.SafeVariablesGetter variables) throws Evalua
ValueObjectTypeIngredients.ValueIngredients value = variables.getValue(0, ValueTypes.OBJECT_INGREDIENTS);
ValueTypeInteger.ValueInteger index = variables.getValue(1, ValueTypes.INTEGER);
ValueTypeLong.ValueLong energy = variables.getValue(2, ValueTypes.LONG);
if (!value.getRawValue().isPresent()) {
return value;
if (value.getRawValue().isEmpty()) {
value = ValueObjectTypeIngredients.ValueIngredients.of(new MixedIngredients(Maps.newIdentityHashMap()));
}
IMixedIngredients baseIngredients = value.getRawValue().get();
return ValueObjectTypeIngredients.ValueIngredients.of(new ExtendedIngredientsSingle<>(baseIngredients,
Expand All @@ -3777,8 +3777,8 @@ public IValue evaluate(OperatorBase.SafeVariablesGetter variables) throws Evalua
.function(variables -> {
ValueObjectTypeIngredients.ValueIngredients valueIngredients = variables.getValue(0, ValueTypes.OBJECT_INGREDIENTS);
ValueTypeList.ValueList<ValueObjectTypeItemStack, ValueObjectTypeItemStack.ValueItemStack> list = variables.getValue(1, ValueTypes.LIST);
if (!valueIngredients.getRawValue().isPresent()) {
return valueIngredients;
if (valueIngredients.getRawValue().isEmpty()) {
valueIngredients = ValueObjectTypeIngredients.ValueIngredients.of(new MixedIngredients(Maps.newIdentityHashMap()));
}
IMixedIngredients baseIngredients = valueIngredients.getRawValue().get();
return ValueObjectTypeIngredients.ValueIngredients.of(new ExtendedIngredientsList<>(baseIngredients,
Expand All @@ -3793,8 +3793,8 @@ public IValue evaluate(OperatorBase.SafeVariablesGetter variables) throws Evalua
.function(variables -> {
ValueObjectTypeIngredients.ValueIngredients valueIngredients = variables.getValue(0, ValueTypes.OBJECT_INGREDIENTS);
ValueTypeList.ValueList<ValueObjectTypeFluidStack, ValueObjectTypeFluidStack.ValueFluidStack> list = variables.getValue(1, ValueTypes.LIST);
if (!valueIngredients.getRawValue().isPresent()) {
return valueIngredients;
if (valueIngredients.getRawValue().isEmpty()) {
valueIngredients = ValueObjectTypeIngredients.ValueIngredients.of(new MixedIngredients(Maps.newIdentityHashMap()));
}
IMixedIngredients baseIngredients = valueIngredients.getRawValue().get();
return ValueObjectTypeIngredients.ValueIngredients.of(new ExtendedIngredientsList<>(baseIngredients,
Expand All @@ -3810,8 +3810,8 @@ public IValue evaluate(OperatorBase.SafeVariablesGetter variables) throws Evalua
.function(variables -> {
ValueObjectTypeIngredients.ValueIngredients valueIngredients = variables.getValue(0, ValueTypes.OBJECT_INGREDIENTS);
ValueTypeList.ValueList<ValueTypeInteger, ValueTypeInteger.ValueInteger> list = variables.getValue(1, ValueTypes.LIST);
if (!valueIngredients.getRawValue().isPresent()) {
return valueIngredients;
if (valueIngredients.getRawValue().isEmpty()) {
valueIngredients = ValueObjectTypeIngredients.ValueIngredients.of(new MixedIngredients(Maps.newIdentityHashMap()));
}
IMixedIngredients baseIngredients = valueIngredients.getRawValue().get();
return ValueObjectTypeIngredients.ValueIngredients.of(new ExtendedIngredientsList<>(baseIngredients,
Expand Down

0 comments on commit 9b52876

Please sign in to comment.