Skip to content

Commit

Permalink
🐛 Fix Stonecutter recipe with DynamaticRegistryManager
Browse files Browse the repository at this point in the history
  • Loading branch information
wendavid552 committed Jan 18, 2024
1 parent 16e2814 commit c2a2b14
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import fi.dy.masa.itemscroller.villager.VillagerDataStorage;
import fi.dy.masa.itemscroller.villager.VillagerUtils;
import fi.dy.masa.malilib.util.GuiUtils;
import net.minecraft.registry.DynamicRegistryManager;
import org.apache.commons.lang3.StringUtils;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntComparator;
Expand Down Expand Up @@ -1349,9 +1350,10 @@ public static int getStonecuttingRecipeFromPattern(RecipePattern recipe) {
search.setStack(i, items[i]);
}
List<StonecuttingRecipe> inputRecipes = recipeManager.getAllMatches(RecipeType.STONECUTTING, search, mc.world);
DynamicRegistryManager stonecuttingRegistryManger = mc.world.getRegistryManager();
for(int i=0; i<inputRecipes.size(); ++i) {
StonecuttingRecipe inputRecipe = inputRecipes.get(i);
if(inputRecipe.getOutput().getItem() == recipe.getResult().getItem()) {
if(inputRecipe.getOutput(stonecuttingRegistryManger).getItem() == recipe.getResult().getItem()) {
recipe.cachedRecipeFromStonecutting = i;
return recipe.cachedRecipeFromStonecutting;
}
Expand Down Expand Up @@ -1393,6 +1395,7 @@ public static void craftEverythingPossibleWithCurrentRecipe(RecipePattern recipe
}
}
if(!StringUtils.isBlank(cacheName) && gui instanceof AnvilScreen) {
// System.out.println(cacheName);
((IMixinAnvilScreen)gui).itemscroller_setItemName(cacheName);
}
shiftClickSlot(gui, slot.id);
Expand Down

0 comments on commit c2a2b14

Please sign in to comment.