Nei Handlers now show all ores

This commit is contained in:
modmuss50 2015-05-10 21:03:44 +01:00
parent 07be177c6c
commit 03cd665add
6 changed files with 27 additions and 8 deletions

View file

@ -6,6 +6,7 @@ import net.minecraftforge.oredict.OreDictionary;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.client.gui.GuiAlloySmelter;
import techreborn.client.gui.GuiImplosionCompressor;
import techreborn.util.ItemUtils;
import java.util.List;
@ -13,10 +14,10 @@ public class AlloySmelterRecipeHandler extends GenericRecipeHander implements IN
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
PositionedStack pStack = new PositionedStack(OreDictionary.getOres(OreDictionary.getOreName(OreDictionary.getOreID(recipeType.getInputs().get(0)))), 56 - offset, 25 - offset);
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 56 - offset, 25 - offset);
input.add(pStack);
PositionedStack pStack2 = new PositionedStack(OreDictionary.getOres(OreDictionary.getOreName(OreDictionary.getOreID(recipeType.getInputs().get(1)))), 56 - offset, 43 - offset);
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 56 - offset, 43 - offset);
input.add(pStack2);
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 116 - offset, 35 - offset);

View file

@ -5,6 +5,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.client.gui.GuiAssemblingMachine;
import techreborn.client.gui.GuiImplosionCompressor;
import techreborn.util.ItemUtils;
import java.util.List;
@ -12,10 +13,10 @@ public class AssemblingMachineRecipeHandler extends GenericRecipeHander implemen
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
PositionedStack pStack = new PositionedStack(recipeType.getInputs().get(0), 47 - offset, 17 - offset);
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 47 - offset, 17 - offset);
input.add(pStack);
PositionedStack pStack2 = new PositionedStack(recipeType.getInputs().get(1), 65 - offset, 17 - offset);
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 65 - offset, 17 - offset);
input.add(pStack2);
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 116 - offset, 35 - offset);

View file

@ -7,6 +7,7 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.client.gui.GuiImplosionCompressor;
import techreborn.util.ItemUtils;
import java.util.ArrayList;
import java.util.List;
@ -15,10 +16,10 @@ public class ImplosionCompressorRecipeHandler extends GenericRecipeHander implem
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
PositionedStack pStack = new PositionedStack(OreDictionary.getOres(OreDictionary.getOreName(OreDictionary.getOreID(recipeType.getInputs().get(0)))), 34 - offset, 16 - offset);
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 34 - offset, 16 - offset);
input.add(pStack);
PositionedStack pStack2 = new PositionedStack(OreDictionary.getOres(OreDictionary.getOreName(OreDictionary.getOreID(recipeType.getInputs().get(1)))), 34 - offset, 34 - offset);
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 34 - offset, 34 - offset);
input.add(pStack2);
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 86 - offset, 25 - offset);

View file

@ -6,6 +6,7 @@ import techreborn.api.recipe.IBaseRecipeType;
import techreborn.client.gui.GuiAlloySmelter;
import techreborn.client.gui.GuiImplosionCompressor;
import techreborn.client.gui.GuiLathe;
import techreborn.util.ItemUtils;
import java.util.List;
@ -13,7 +14,7 @@ public class LatheRecipeHandler extends GenericRecipeHander implements INeiBaseR
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
PositionedStack pStack = new PositionedStack(recipeType.getInputs().get(0), 56 - offset, 17 - offset);
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 56 - offset, 17 - offset);
input.add(pStack);
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 116 - offset, 35 - offset);

View file

@ -198,7 +198,7 @@ public class ModRecipes {
Blocks.cobblestone);
TechRebornAPI.registerBlastFurnaceRecipe(new BlastFurnaceRecipe(new ItemStack(Items.apple), new ItemStack(Items.ender_pearl), new ItemStack(Items.golden_apple), new ItemStack(Items.diamond), 120, 1000));
RecipeHanderer.addRecipe(new ImplosionCompressorRecipe(new ItemStack(Blocks.planks, 4), IC2Items.getItem("copperIngot"), new ItemStack(Items.brewing_stand), new ItemStack(Items.carrot), 120, 5));
RecipeHanderer.addRecipe(new ImplosionCompressorRecipe(new ItemStack(Blocks.end_stone, 4), IC2Items.getItem("copperIngot"), new ItemStack(Items.brewing_stand), new ItemStack(Items.carrot), 120, 5));
RecipeHanderer.addRecipe(new AlloySmelterRecipe(new ItemStack(Items.coal), new ItemStack(Blocks.sand), new ItemStack(Items.diamond), 120, 5));
RecipeHanderer.addRecipe(new AssemblingMachineRecipe(new ItemStack(Items.coal), new ItemStack(Blocks.sand), new ItemStack(Items.diamond), 120, 5));

View file

@ -1,11 +1,13 @@
package techreborn.util;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
import java.util.List;
/**
@ -110,4 +112,17 @@ public class ItemUtils {
{
return ItemStack.loadItemStackFromNBT(data);
}
public static List<ItemStack> getStackWithAllOre(ItemStack stack){
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
for (int oreID : OreDictionary.getOreIDs(stack)){
for(ItemStack ore : OreDictionary.getOres(OreDictionary.getOreName(oreID))){
list.add(ore);
}
}
if(list.isEmpty()){
list.add(stack);
}
return list;
}
}