Skip to content

Commit

Permalink
fix: fix Miner recipe handling in EMI (#1099)
Browse files Browse the repository at this point in the history
  • Loading branch information
GaeaKat authored Mar 24, 2024
1 parent eb45ea7 commit a608359
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.RecipeHolder;
import net.minecraft.world.item.crafting.RecipeManager;

Expand Down Expand Up @@ -67,13 +68,13 @@ public void register(EmiRegistry emiRegistry) {
emiRegistry.addRecipe(new CrushingRecipeCategory(recipe));
}

for(MinerRecipe recipe:manager.getAllRecipesFor(OccultismRecipes.MINER_TYPE.get())){
if(recipe.getIngredients().get(0).values.length==1) {
if (recipe.getIngredients().get(0).values[0] instanceof Ingredient.TagValue) {
var tag = ((Ingredient.TagValue) recipe.getIngredients().get(0).values[0]).tag;
for(RecipeHolder<MinerRecipe> recipe:manager.getAllRecipesFor(OccultismRecipes.MINER_TYPE.get())){
if(recipe.value().getIngredients().get(0).values.length==1) {
if (recipe.value().getIngredients().get(0).values[0] instanceof Ingredient.TagValue) {
var tag = ((Ingredient.TagValue) recipe.value().getIngredients().get(0).values[0]).tag();
if(!MinerRecipeCategory.totalWeights.containsKey(tag))
MinerRecipeCategory.totalWeights.put(tag,0L);
MinerRecipeCategory.totalWeights.put(tag,MinerRecipeCategory.totalWeights.get(tag)+recipe.getWeightedOutput().getWeight().asInt());
MinerRecipeCategory.totalWeights.put(tag,MinerRecipeCategory.totalWeights.get(tag)+recipe.value().getWeightedOutput().getWeight().asInt());


}
Expand Down

0 comments on commit a608359

Please sign in to comment.