mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Fix OreDict
This commit is contained in:
parent
4163643299
commit
1ba09afab6
7 changed files with 27 additions and 25 deletions
|
@ -19,7 +19,7 @@ import ellpeck.actuallyadditions.util.Util;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class PageCrusherRecipe extends BookletPage{
|
||||
|
@ -75,7 +75,7 @@ public class PageCrusherRecipe extends BookletPage{
|
|||
stack = this.recipe.getRecipeOutputOnes().get(Math.min(this.recipe.getRecipeOutputOnes().size()-1, this.recipePos));
|
||||
break;
|
||||
default:
|
||||
ArrayList<ItemStack> outputTwos = this.recipe.getRecipeOutputTwos();
|
||||
List<ItemStack> outputTwos = this.recipe.getRecipeOutputTwos();
|
||||
stack = outputTwos == null ? null : outputTwos.get(Math.min(outputTwos.size()-1, this.recipePos));
|
||||
break;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public class PageCrusherRecipe extends BookletPage{
|
|||
@Override
|
||||
public void updateScreen(int ticksElapsed){
|
||||
if(ticksElapsed%10 == 0){
|
||||
ArrayList<ItemStack> outputTwos = this.recipe.getRecipeOutputTwos();
|
||||
List<ItemStack> outputTwos = this.recipe.getRecipeOutputTwos();
|
||||
if(this.recipePos+1 >= Math.max(this.recipe.getRecipeInputs().size(), Math.max(this.recipe.getRecipeOutputOnes().size(), outputTwos == null ? 0 : outputTwos.size()))){
|
||||
this.recipePos = 0;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PageReconstructor extends BookletPage{
|
||||
|
||||
|
@ -96,10 +96,10 @@ public class PageReconstructor extends BookletPage{
|
|||
|
||||
private ItemStack getInputForOutput(ItemStack output){
|
||||
for(ReconstructorRecipeHandler.Recipe recipe : ReconstructorRecipeHandler.recipes){
|
||||
ArrayList<ItemStack> stacks = OreDictionary.getOres(recipe.output);
|
||||
List<ItemStack> stacks = OreDictionary.getOres(recipe.output, false);
|
||||
for(ItemStack stack : stacks){
|
||||
if(output.isItemEqual(stack)){
|
||||
ArrayList<ItemStack> inputs = OreDictionary.getOres(recipe.input);
|
||||
List<ItemStack> inputs = OreDictionary.getOres(recipe.input, false);
|
||||
if(inputs != null && !inputs.isEmpty() && inputs.get(0) != null){
|
||||
ItemStack input = inputs.get(0).copy();
|
||||
input.stackSize = 1;
|
||||
|
|
|
@ -69,7 +69,7 @@ public class AtomicReconstructorRecipeHandler extends TemplateRecipeHandler impl
|
|||
public void loadCraftingRecipes(ItemStack result){
|
||||
ArrayList<ReconstructorRecipeHandler.Recipe> recipes = ReconstructorRecipeHandler.recipes;
|
||||
for(ReconstructorRecipeHandler.Recipe recipe : recipes){
|
||||
if(ItemUtil.contains(OreDictionary.getOres(recipe.output), result, true)){
|
||||
if(ItemUtil.contains(OreDictionary.getOres(recipe.output, false), result, true)){
|
||||
arecipes.add(new CachedReconstructorRecipe(recipe.input, recipe.output));
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class AtomicReconstructorRecipeHandler extends TemplateRecipeHandler impl
|
|||
public void loadUsageRecipes(ItemStack ingredient){
|
||||
ArrayList<ReconstructorRecipeHandler.Recipe> recipes = ReconstructorRecipeHandler.recipes;
|
||||
for(ReconstructorRecipeHandler.Recipe recipe : recipes){
|
||||
if(ItemUtil.contains(OreDictionary.getOres(recipe.input), ingredient, true)){
|
||||
if(ItemUtil.contains(OreDictionary.getOres(recipe.input, false), ingredient, true)){
|
||||
CachedReconstructorRecipe theRecipe = new CachedReconstructorRecipe(recipe.input, recipe.output);
|
||||
theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.input), ingredient);
|
||||
arecipes.add(theRecipe);
|
||||
|
@ -120,8 +120,8 @@ public class AtomicReconstructorRecipeHandler extends TemplateRecipeHandler impl
|
|||
public PositionedStack input;
|
||||
|
||||
public CachedReconstructorRecipe(String input, String result){
|
||||
this.result = new PositionedStack(OreDictionary.getOres(result), 67+32, 19);
|
||||
this.input = new PositionedStack(OreDictionary.getOres(input), 5+32, 19);
|
||||
this.result = new PositionedStack(OreDictionary.getOres(result, false), 67+32, 19);
|
||||
this.input = new PositionedStack(OreDictionary.getOres(input, false), 5+32, 19);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -172,7 +172,7 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler implements INeiR
|
|||
public PositionedStack resultTwo;
|
||||
public int secondChance;
|
||||
|
||||
public CachedCrush(ArrayList<ItemStack> in, ArrayList<ItemStack> outOne, ArrayList<ItemStack> outTwo, int secondChance, CrusherRecipeHandler handler){
|
||||
public CachedCrush(List<ItemStack> in, List<ItemStack> outOne, List<ItemStack> outTwo, int secondChance, CrusherRecipeHandler handler){
|
||||
boolean isDouble = handler instanceof CrusherDoubleRecipeHandler;
|
||||
this.ingredient = new PositionedStack(in, isDouble ? 51 : 80, 21);
|
||||
this.resultOne = new PositionedStack(outOne, isDouble ? 38 : 66, 69);
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class CrusherRecipeRegistry{
|
||||
|
@ -88,7 +89,7 @@ public class CrusherRecipeRegistry{
|
|||
recipes.add(new CrusherRecipe(input, outputOne, outputOneAmount, "", 0, 0));
|
||||
}
|
||||
|
||||
public static ArrayList<ItemStack> getOutputOnes(ItemStack input){
|
||||
public static List<ItemStack> getOutputOnes(ItemStack input){
|
||||
CrusherRecipe recipe = getRecipeFromInput(input);
|
||||
return recipe == null ? null : recipe.getRecipeOutputOnes();
|
||||
}
|
||||
|
@ -102,7 +103,7 @@ public class CrusherRecipeRegistry{
|
|||
return null;
|
||||
}
|
||||
|
||||
public static ArrayList<ItemStack> getOutputTwos(ItemStack input){
|
||||
public static List<ItemStack> getOutputTwos(ItemStack input){
|
||||
CrusherRecipe recipe = getRecipeFromInput(input);
|
||||
return recipe == null ? null : recipe.getRecipeOutputTwos();
|
||||
}
|
||||
|
@ -132,36 +133,36 @@ public class CrusherRecipeRegistry{
|
|||
this.outputTwoChance = outputTwoChance;
|
||||
}
|
||||
|
||||
public ArrayList<ItemStack> getRecipeOutputOnes(){
|
||||
public List<ItemStack> getRecipeOutputOnes(){
|
||||
if(this.outputOne == null || this.outputOne.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList<ItemStack> stacks = OreDictionary.getOres(this.outputOne);
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.outputOne, false);
|
||||
for(ItemStack stack : stacks){
|
||||
stack.stackSize = this.outputOneAmount;
|
||||
}
|
||||
return stacks;
|
||||
}
|
||||
|
||||
public ArrayList<ItemStack> getRecipeOutputTwos(){
|
||||
public List<ItemStack> getRecipeOutputTwos(){
|
||||
if(this.outputTwo == null || this.outputTwo.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList<ItemStack> stacks = OreDictionary.getOres(this.outputTwo);
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.outputTwo, false);
|
||||
for(ItemStack stack : stacks){
|
||||
stack.stackSize = this.outputTwoAmount;
|
||||
}
|
||||
return stacks;
|
||||
}
|
||||
|
||||
public ArrayList<ItemStack> getRecipeInputs(){
|
||||
public List<ItemStack> getRecipeInputs(){
|
||||
if(this.input == null || this.input.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList<ItemStack> stacks = OreDictionary.getOres(this.input);
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.input, false);
|
||||
for(ItemStack stack : stacks){
|
||||
stack.stackSize = 1;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ReconstructorRecipeHandler{
|
||||
|
@ -63,7 +64,7 @@ public class ReconstructorRecipeHandler{
|
|||
}
|
||||
|
||||
public ItemStack getFirstOutput(){
|
||||
ArrayList<ItemStack> stacks = OreDictionary.getOres(this.output);
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.output, false);
|
||||
if(stacks != null && !stacks.isEmpty()){
|
||||
return stacks.get(0);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TileEntityGrinder extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||
|
||||
|
@ -136,10 +136,10 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
|
||||
public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput){
|
||||
if(this.slots[theInput] != null){
|
||||
ArrayList<ItemStack> outputOnes = CrusherRecipeRegistry.getOutputOnes(this.slots[theInput]);
|
||||
List<ItemStack> outputOnes = CrusherRecipeRegistry.getOutputOnes(this.slots[theInput]);
|
||||
if(outputOnes != null && !outputOnes.isEmpty()){
|
||||
ItemStack outputOne = outputOnes.get(0);
|
||||
ArrayList<ItemStack> outputTwos = CrusherRecipeRegistry.getOutputTwos(this.slots[theInput]);
|
||||
List<ItemStack> outputTwos = CrusherRecipeRegistry.getOutputTwos(this.slots[theInput]);
|
||||
ItemStack outputTwo = outputTwos == null ? null : outputTwos.get(0);
|
||||
if(outputOne != null){
|
||||
if((this.slots[theFirstOutput] == null || (this.slots[theFirstOutput].isItemEqual(outputOne) && this.slots[theFirstOutput].stackSize <= this.slots[theFirstOutput].getMaxStackSize()-outputOne.stackSize)) && (outputTwo == null || (this.slots[theSecondOutput] == null || (this.slots[theSecondOutput].isItemEqual(outputTwo) && this.slots[theSecondOutput].stackSize <= this.slots[theSecondOutput].getMaxStackSize()-outputTwo.stackSize)))){
|
||||
|
@ -160,7 +160,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
}
|
||||
|
||||
public void finishCrushing(int theInput, int theFirstOutput, int theSecondOutput){
|
||||
ArrayList<ItemStack> outputOnes = CrusherRecipeRegistry.getOutputOnes(this.slots[theInput]);
|
||||
List<ItemStack> outputOnes = CrusherRecipeRegistry.getOutputOnes(this.slots[theInput]);
|
||||
if(outputOnes != null){
|
||||
ItemStack outputOne = outputOnes.get(0);
|
||||
if(outputOne != null){
|
||||
|
@ -173,7 +173,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
}
|
||||
}
|
||||
|
||||
ArrayList<ItemStack> outputTwos = CrusherRecipeRegistry.getOutputTwos(this.slots[theInput]);
|
||||
List<ItemStack> outputTwos = CrusherRecipeRegistry.getOutputTwos(this.slots[theInput]);
|
||||
if(outputTwos != null){
|
||||
ItemStack outputTwo = outputTwos.get(0);
|
||||
if(outputTwo != null){
|
||||
|
|
Loading…
Reference in a new issue