mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-22 04:52:26 +00:00
Closes #363. Ore dictionary support for IC2's Rubberized Electron Tubes
This commit is contained in:
1 parent
dbf6202a90
commit
e26da52d21
2 files changed
+28
-3
No files matched your search
@@ -20,6 +20,11 @@ import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class RecipeUtil {
|
||||
|
||||
@@ -38,6 +43,23 @@ public class RecipeUtil {
|
||||
RecipeManagers.fermenterManager.addRecipe(resource, fermentationValue, 1.5f, LiquidHelper.getLiquid(output, 1), LiquidHelper.getLiquid(Defaults.LIQUID_HONEY, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of the ore dictionary names if they exist.
|
||||
* Returns a list containing itemStack if there are no ore dictionary names.
|
||||
* Used for creating recipes that should accept equivalent itemStacks, based on the ore dictionary.
|
||||
*/
|
||||
public static List getOreDictRecipeEquivalents(ItemStack itemStack) {
|
||||
int[] oreDictIds = OreDictionary.getOreIDs(itemStack);
|
||||
List<String> oreDictNames = new ArrayList<String>(oreDictIds.length);
|
||||
for (int oreId : oreDictIds) {
|
||||
String oreDictName = OreDictionary.getOreName(oreId);
|
||||
oreDictNames.add(oreDictName);
|
||||
}
|
||||
if (oreDictNames.isEmpty())
|
||||
return Collections.singletonList(itemStack);
|
||||
return oreDictNames;
|
||||
}
|
||||
|
||||
public static Object[] getCraftingRecipeAsArray(Object rec) {
|
||||
|
||||
try {
|
||||
|
||||
@@ -263,9 +263,12 @@ public class PluginIC2 extends ForestryPlugin {
|
||||
@Optional.Method(modid = "IC2")
|
||||
protected void registerRecipes() {
|
||||
|
||||
if (rubber != null)
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 8),
|
||||
new Object[]{" X ", "#X#", "XXX", '#', Items.redstone, 'X', PluginIC2.rubber});
|
||||
if (rubber != null) {
|
||||
for (Object rubberOreDict : RecipeUtil.getOreDictRecipeEquivalents(rubber)) {
|
||||
RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 8),
|
||||
new Object[]{" X ", "#X#", "XXX", '#', Items.redstone, 'X', rubberOreDict});
|
||||
}
|
||||
}
|
||||
|
||||
if (plantBall != null && compressedPlantBall != null) {
|
||||
RecipeUtil.injectLeveledRecipe(plantBall, GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat") * 4, Defaults.LIQUID_BIOMASS);
|
||||
|
||||
Reference in new issue
Block a user