Skip to content

Commit

Permalink
removed RecipeTag in favor of just using simple strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Jan 26, 2025
1 parent 98ab165 commit 203b59b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 36 deletions.
4 changes: 2 additions & 2 deletions common/src/main/java/muramasa/antimatter/recipe/IRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public interface IRecipe extends net.minecraft.world.item.crafting.Recipe<Contai

void setFake(boolean fake);

void addTags(Set<RecipeTag> tags);
void addTags(Set<String> tags);

boolean hasInputItems();

Expand Down Expand Up @@ -93,7 +93,7 @@ default long getTotalPower(){

boolean isFake();

Set<RecipeTag> getTags();
Set<String> getTags();

String getMapId();

Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/muramasa/antimatter/recipe/Recipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class Recipe implements IRecipe {
@Setter
private boolean hidden, fake;
@Getter
private Set<RecipeTag> tags = new ObjectOpenHashSet<>();
private Set<String> tags = new ObjectOpenHashSet<>();
public ResourceLocation id;
public String mapId;
//Used for recipe validators, e.g. cleanroom.
Expand Down Expand Up @@ -88,7 +88,7 @@ public void addInputChances(int[] chances) {
this.inputChances = chances;
}

public void addTags(Set<RecipeTag> tags) {
public void addTags(Set<String> tags) {
this.tags = tags;
}

Expand Down
21 changes: 0 additions & 21 deletions common/src/main/java/muramasa/antimatter/recipe/RecipeTag.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import muramasa.antimatter.datagen.AntimatterDynamics;
import muramasa.antimatter.recipe.IRecipe;
import muramasa.antimatter.recipe.Recipe;
import muramasa.antimatter.recipe.RecipeTag;
import muramasa.antimatter.recipe.ingredient.FluidIngredient;
import muramasa.antimatter.util.AntimatterPlatformUtils;
import muramasa.antimatter.util.Utils;
Expand Down Expand Up @@ -49,7 +48,7 @@ public class RecipeBuilder {
protected long power;
protected int amps;
protected boolean hidden, fake;
protected Set<RecipeTag> tags = new ObjectOpenHashSet<>();
protected Set<String> tags = new ObjectOpenHashSet<>();
protected ResourceLocation id;
protected boolean recipeMapOnly = false;

Expand Down Expand Up @@ -316,7 +315,7 @@ public RecipeBuilder recipeMapOnly(){
return this;
}

public RecipeBuilder tags(RecipeTag... tags) {
public RecipeBuilder tags(String... tags) {
this.tags = new ObjectOpenHashSet<>(tags);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import muramasa.antimatter.Antimatter;
import muramasa.antimatter.AntimatterAPI;
import muramasa.antimatter.Ref;
import muramasa.antimatter.recipe.BaseRecipeSerializer;
import muramasa.antimatter.recipe.IRecipe;
import muramasa.antimatter.recipe.RecipeTag;
import muramasa.antimatter.recipe.RecipeUtil;
import muramasa.antimatter.recipe.ingredient.FluidIngredient;
import muramasa.antimatter.recipe.ingredient.RecipeIngredient;
Expand Down Expand Up @@ -98,10 +96,7 @@ public T fromJson(ResourceLocation recipeId, JsonObject json) {
r.setFake(json.get("fake").getAsBoolean());
if (json.has("tags")){
JsonArray array = json.getAsJsonArray("tags");
Set<RecipeTag> tags = Streams.stream(array).map(e -> {
String[] strings = e.getAsString().split(":", 1);
return AntimatterAPI.get(RecipeTag.class, strings[1], strings[0]);
}).collect(Collectors.toSet());
Set<String> tags = Streams.stream(array).map(JsonElement::getAsString).collect(Collectors.toSet());
r.addTags(tags);
}
r.setIds(recipeId, mapId);
Expand Down Expand Up @@ -323,8 +318,8 @@ public void toJson(JsonObject json, IRecipe recipe) {
json.addProperty("hidden", recipe.isHidden());
json.addProperty("fake", recipe.isFake());
array = new JsonArray();
for (RecipeTag tag : recipe.getTags()){
array.add(tag.getLoc().toString());
for (String tag : recipe.getTags()){
array.add(tag);
}
if (!array.isEmpty()){
json.add("tags", array);
Expand Down

0 comments on commit 203b59b

Please sign in to comment.