Skip to content

Commit

Permalink
removed reversed crafting proxy, fixed proxy recipes showing in jei/r…
Browse files Browse the repository at this point in the history
…ei even if hidden
  • Loading branch information
Trinsdar committed Sep 18, 2023
1 parent b1a33eb commit ae9a534
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private List<IRecipe> getRecipes(IRecipeMap recipeMap){
List<net.minecraft.world.item.crafting.Recipe<?>> proxyRecipes = (List<net.minecraft.world.item.crafting.Recipe<?>>) manager.getAllRecipesFor(recipeMap.getProxy().loc());
proxyRecipes.forEach(recipe -> {
IRecipe recipe1 = recipeMap.getProxy().handler().apply(recipe, map.RB());
if (recipe1 != null){
if (recipe1 != null && !recipe1.isHidden()){
recipes.add(recipe1);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public void registerDisplays(DisplayRegistry registry) {
registry.registerRecipeFiller(net.minecraft.world.item.crafting.Recipe.class, m.getProxy().loc(), r -> {
IRecipe recipe = m.getProxy().handler().apply(r, m.RB());
if (recipe == null) return null;
if (recipe.isHidden()) return null;
return new RecipeMapDisplay(recipe);
});
}
Expand Down
27 changes: 0 additions & 27 deletions common/src/main/java/muramasa/antimatter/recipe/RecipeProxies.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,6 @@ private static BiFunction<Recipe<?>, RecipeBuilder, muramasa.antimatter.recipe.I
};
}

private static BiFunction<Recipe<?>, RecipeBuilder, muramasa.antimatter.recipe.IRecipe> getDefaultCrafting(int power, int duration) {
return (t, b) -> {
if (!(t instanceof ShapedRecipe shapedRecipe)) return null;
List<Ingredient> ingredients = t.getIngredients();
if (!((t.getResultItem().getItem() instanceof IAntimatterTool tool && tool.getAntimatterToolType().isPowered()) ||
(t.getResultItem().getItem() instanceof BlockItem blockItem && blockItem.getBlock() instanceof BlockMachine))) return null;
List<ItemStack> list = new ObjectArrayList<>();
for (Ingredient i : ingredients){
for (ItemStack stack : i.getItems()){
if (!stack.isEmpty() && !stack.isDamageableItem()){
list.add(stack);
break;
}
}
}
ItemStack craftingOut = shapedRecipe.getResultItem();
if (list.isEmpty()) return null;
RecipeIngredient ing = RecipeIngredient.of(craftingOut);
IRecipe recipe = b.recipeMapOnly().ii(ing)
.io(list.toArray(new ItemStack[0])).add(t.getId().getPath(), duration, power, 0, 1);
recipe.setMapId(b.getMap().getId());
return recipe;
};
}

/*
private static Function<IRecipe, Recipe> CRAFTING = t -> {
if (t instanceof ShapedRecipe) return null;
Expand All @@ -82,8 +57,6 @@ private static BiFunction<Recipe<?>, RecipeBuilder, muramasa.antimatter.recipe.I
};
*/
public static BiFunction<Integer, Integer, Proxy> FURNACE_PROXY = (power, duration) -> new Proxy(RecipeType.SMELTING, getDefault(power, duration));

public static BiFunction<Integer, Integer, Proxy> REVERSE_CRAFTING_PROXY = (power, duration) -> new Proxy(RecipeType.CRAFTING, getDefaultCrafting(power, duration));
public static BiFunction<Integer, Integer, Proxy> BLASTING_PROXY = (power, duration) -> new Proxy(RecipeType.BLASTING, getDefault(power, duration));
public static BiFunction<Integer, Integer, Proxy> SMOKING_PROXY = (power, duration) -> new Proxy(RecipeType.SMOKING, getDefault(power, duration));
//public static RecipeMap.Proxy CRAFTING_PROXY = new RecipeMap.Proxy(IRecipeType.CRAFTING, CRAFTING);
Expand Down

0 comments on commit ae9a534

Please sign in to comment.