forked from sddsd2332/MEK-1.12.2-v10
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "Merge branch 'main' of https://github.com/RuiXuqi/MEK…
…-1.12.2-v10"" This reverts commit 1498f1e.
- Loading branch information
Showing
6 changed files
with
101 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/java/mekanism/common/integration/groovyscript/machinerecipe/Smelter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package mekanism.common.integration.groovyscript.machinerecipe; | ||
|
||
import com.cleanroommc.groovyscript.api.GroovyLog; | ||
import com.cleanroommc.groovyscript.api.IIngredient; | ||
import com.cleanroommc.groovyscript.compat.mods.mekanism.recipe.VirtualizedMekanismRegistry; | ||
import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; | ||
import mekanism.common.recipe.RecipeHandler; | ||
import mekanism.common.recipe.inputs.ItemStackInput; | ||
import mekanism.common.recipe.machines.SmeltingRecipe; | ||
import net.minecraft.item.ItemStack; | ||
|
||
public class Smelter extends VirtualizedMekanismRegistry<SmeltingRecipe> { | ||
|
||
public Smelter(){ | ||
super(RecipeHandler.Recipe.ENERGIZED_SMELTER,"Smelter","smelter","Energized_Smelter"); | ||
} | ||
|
||
public SmeltingRecipe add(IIngredient ingredient, ItemStack output){ | ||
GroovyLog.Msg msg = GroovyLog.msg("Error adding Energized Smelter recipe").error(); | ||
msg.add(IngredientHelper.isEmpty(ingredient), () -> "input must not be empty"); | ||
msg.add(IngredientHelper.isEmpty(output), () -> "output must not be empty"); | ||
if (msg.postIfNotEmpty()) return null; | ||
output = output.copy(); | ||
SmeltingRecipe recipe1 = null; | ||
for (ItemStack itemStack : ingredient.getMatchingStacks()) { | ||
SmeltingRecipe recipe = new SmeltingRecipe(itemStack.copy(), output); | ||
if (recipe1 == null) recipe1 = recipe; | ||
recipeRegistry.put(recipe); | ||
addScripted(recipe); | ||
} | ||
return recipe1; | ||
} | ||
public boolean removeByInput(IIngredient ingredient) { | ||
if (IngredientHelper.isEmpty(ingredient)) { | ||
removeError("input must not be empty"); | ||
return false; | ||
} | ||
boolean found = false; | ||
for (ItemStack itemStack : ingredient.getMatchingStacks()) { | ||
SmeltingRecipe recipe = recipeRegistry.get().remove(new ItemStackInput(itemStack)); | ||
if (recipe != null) { | ||
addBackup(recipe); | ||
found = true; | ||
} | ||
} | ||
if (!found) { | ||
removeError("could not find recipe for %s", ingredient); | ||
} | ||
return found; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters