Skip to content

Commit

Permalink
Follow-up for recipe config removal (GTNewHorizons#2906)
Browse files Browse the repository at this point in the history
* Follow-up for recipe config removal

* Remove duration check
Recipes without recipe config key were not removed in the first place

---------

Co-authored-by: boubou19 <[email protected]>
  • Loading branch information
miozune and boubou19 authored Aug 16, 2024
1 parent 95f36a0 commit b5b7e4a
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 126 deletions.
7 changes: 0 additions & 7 deletions src/main/java/gregtech/api/recipe/RecipeMapBackend.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,6 @@ protected Collection<GT_Recipe> doAdd(GT_RecipeBuilder builder) {
Iterable<? extends GT_Recipe> recipes = properties.recipeEmitter.apply(builder);
Collection<GT_Recipe> ret = new ArrayList<>();
for (GT_Recipe recipe : recipes) {
if (properties.recipeConfigCategory != null) {
assert properties.recipeConfigKeyConvertor != null;
String configKey = properties.recipeConfigKeyConvertor.apply(recipe);
if (configKey != null && recipe.mDuration <= 0) {
continue;
}
}
if (recipe.mFluidInputs.length < properties.minFluidInputs
|| recipe.mInputs.length < properties.minItemInputs) {
return Collections.emptyList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,10 @@ static RecipeMapBackendPropertiesBuilder builder() {
@Nullable
public final Function<? super GT_Recipe, ? extends GT_Recipe> recipeTransformer;

@Nullable
public final String recipeConfigCategory;
@Nullable
public final Function<? super GT_Recipe, String> recipeConfigKeyConvertor;

RecipeMapBackendProperties(int minItemInputs, int minFluidInputs, boolean specialSlotSensitive,
boolean disableOptimize,
Function<? super GT_RecipeBuilder, ? extends Iterable<? extends GT_Recipe>> recipeEmitter,
@Nullable Function<? super GT_Recipe, ? extends GT_Recipe> recipeTransformer,
@Nullable String recipeConfigCategory, @Nullable Function<? super GT_Recipe, String> recipeConfigKeyConvertor) {
@Nullable Function<? super GT_Recipe, ? extends GT_Recipe> recipeTransformer) {
if (minItemInputs < 0 || minFluidInputs < 0) {
throw new IllegalArgumentException("minItemInputs and minFluidInputs cannot be negative");
}
Expand All @@ -71,7 +65,5 @@ static RecipeMapBackendPropertiesBuilder builder() {
this.disableOptimize = disableOptimize;
this.recipeEmitter = recipeEmitter;
this.recipeTransformer = recipeTransformer;
this.recipeConfigCategory = recipeConfigCategory;
this.recipeConfigKeyConvertor = recipeConfigKeyConvertor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ public final class RecipeMapBackendPropertiesBuilder {
@Nullable
private Function<? super GT_Recipe, ? extends GT_Recipe> recipeTransformer;

@Nullable
private String recipeConfigCategory;
@Nullable
private Function<? super GT_Recipe, String> recipeConfigKeyConvertor;

RecipeMapBackendPropertiesBuilder() {}

RecipeMapBackendProperties build() {
Expand All @@ -47,9 +42,7 @@ RecipeMapBackendProperties build() {
specialSlotSensitive,
disableOptimize,
recipeEmitter,
recipeTransformer,
recipeConfigCategory,
recipeConfigKeyConvertor);
recipeTransformer);
}

public RecipeMapBackendPropertiesBuilder minItemInputs(int minItemInputs) {
Expand Down Expand Up @@ -97,13 +90,6 @@ public RecipeMapBackendPropertiesBuilder chainRecipeTransformer(
return this;
}

public RecipeMapBackendPropertiesBuilder recipeConfigFile(String category,
Function<? super GT_Recipe, String> keyConvertor) {
this.recipeConfigCategory = category;
this.recipeConfigKeyConvertor = keyConvertor;
return this;
}

private Iterable<? extends GT_Recipe> defaultBuildRecipe(GT_RecipeBuilder builder) {
// TODO sensible validation
GT_RecipeBuilder b = builder;
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/gregtech/api/recipe/RecipeMapBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

import javax.annotation.ParametersAreNonnullByDefault;

import org.apache.commons.lang3.StringUtils;

import com.gtnewhorizons.modularui.api.drawable.FallbackableUITexture;
import com.gtnewhorizons.modularui.api.drawable.IDrawable;
import com.gtnewhorizons.modularui.api.drawable.UITexture;
Expand Down Expand Up @@ -211,12 +209,6 @@ public RecipeMapBuilder<B> chainRecipeTransformer(Consumer<GT_Recipe> recipeTran
return chainRecipeTransformer(withIdentityReturn(recipeTransformer));
}

public RecipeMapBuilder<B> recipeConfigFile(String category, Function<? super GT_Recipe, String> keyConvertor) {
if (StringUtils.isBlank(category)) throw new IllegalArgumentException();
backendPropertiesBuilder.recipeConfigFile(category, keyConvertor);
return this;
}

// endregion

// region frontend UI properties
Expand Down
Loading

0 comments on commit b5b7e4a

Please sign in to comment.