Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split smelting & energized smelter recipe registration.
Fixes #5010
- Loading branch information
1 parent
2b6fafd
commit c713b3a
Showing
4 changed files
with
41 additions
and
12 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
12 changes: 12 additions & 0 deletions
12
src/main/java/mekanism/client/jei/machine/basic/SmeltingRecipeWrapper.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,12 @@ | ||
package mekanism.client.jei.machine.basic; | ||
|
||
import mekanism.client.jei.machine.MachineRecipeWrapper; | ||
import mekanism.common.recipe.machines.BasicMachineRecipe; | ||
|
||
public class SmeltingRecipeWrapper extends MachineRecipeWrapper | ||
{ | ||
public SmeltingRecipeWrapper(BasicMachineRecipe r) | ||
{ | ||
super(r); | ||
} | ||
} |
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
20 changes: 18 additions & 2 deletions
20
src/main/java/mekanism/common/tile/TileEntityEnergizedSmelter.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 |
---|---|---|
@@ -1,24 +1,40 @@ | ||
package mekanism.common.tile; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import mekanism.common.block.states.BlockStateMachine; | ||
import mekanism.common.config.MekanismConfig.usage; | ||
import mekanism.common.recipe.RecipeHandler.Recipe; | ||
import mekanism.common.recipe.inputs.ItemStackInput; | ||
import mekanism.common.recipe.machines.SmeltingRecipe; | ||
import mekanism.common.recipe.outputs.ItemStackOutput; | ||
import mekanism.common.tile.prefab.TileEntityElectricMachine; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.crafting.FurnaceRecipes; | ||
|
||
public class TileEntityEnergizedSmelter extends TileEntityElectricMachine<SmeltingRecipe> | ||
{ | ||
private static Map<ItemStackInput, SmeltingRecipe> cachedRecipes; | ||
|
||
public TileEntityEnergizedSmelter() | ||
{ | ||
super("smelter", "EnergizedSmelter", BlockStateMachine.MachineType.ENERGIZED_SMELTER.baseEnergy, usage.energizedSmelterUsage, 200); | ||
} | ||
|
||
@Override | ||
public Map<ItemStackInput, SmeltingRecipe> getRecipes() | ||
public synchronized Map<ItemStackInput, SmeltingRecipe> getRecipes() | ||
{ | ||
return Recipe.ENERGIZED_SMELTER.get(); | ||
if(cachedRecipes == null) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
tomelfring
Author
Collaborator
|
||
{ | ||
cachedRecipes = new HashMap<>(); | ||
cachedRecipes.putAll(Recipe.ENERGIZED_SMELTER.get()); | ||
for(Map.Entry<ItemStack, ItemStack> entry : FurnaceRecipes.instance().getSmeltingList().entrySet()) | ||
{ | ||
SmeltingRecipe recipe = new SmeltingRecipe(new ItemStackInput(entry.getKey()), new ItemStackOutput(entry.getValue())); | ||
cachedRecipes.put(recipe.getInput(), recipe); | ||
} | ||
} | ||
return cachedRecipes; | ||
} | ||
} |
why not just do this in postinit?, so that you could theoretically remove normal smelting recipes from the ES with CT