More progress

This commit is contained in:
Nicholas Ignoffo 2017-01-01 21:43:34 -08:00
parent 00d6f8eb46
commit d80afb18f0
64 changed files with 410 additions and 976 deletions

View file

@ -25,9 +25,9 @@ public class AlchemyTableCustomRecipe extends AlchemyTableRecipe
@Override
protected ItemStack getContainerItem(ItemStack stack)
{
if (stack == null)
if (stack.isEmpty())
{
return null;
return ItemStack.EMPTY;
}
ItemStack copyStack = stack.copy();
@ -42,10 +42,10 @@ public class AlchemyTableCustomRecipe extends AlchemyTableRecipe
return copyStack.getItem().getContainerItem(copyStack);
}
copyStack.stackSize--;
if (copyStack.stackSize <= 0)
copyStack.shrink(1);
if (copyStack.isEmpty())
{
return null;
return ItemStack.EMPTY;
}
return copyStack;

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.google.common.collect.ImmutableList;
import lombok.Getter;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
@ -15,7 +16,7 @@ import net.minecraftforge.oredict.OreDictionary;
public class AlchemyTableRecipe
{
protected ItemStack output = null;
protected ArrayList<ItemStack> input = new ArrayList<ItemStack>();
protected ArrayList<Object> input = new ArrayList<Object>();
@Getter
protected int lpDrained;
@Getter
@ -103,13 +104,12 @@ public class AlchemyTableRecipe
if (slot != null)
{
boolean inRecipe = false;
Iterator<Object> req = required.iterator();
while (req.hasNext())
for (Object aRequired : required)
{
boolean match = false;
Object next = req.next();
Object next = aRequired;
if (next instanceof ItemStack)
{
@ -148,9 +148,9 @@ public class AlchemyTableRecipe
*
* @return The recipes input vales.
*/
public ArrayList<ItemStack> getInput()
public List<Object> getInput()
{
return this.input;
return ImmutableList.copyOf(input);
}
public ItemStack[] getRemainingItems(ItemStack[] inventory)
@ -166,9 +166,9 @@ public class AlchemyTableRecipe
protected ItemStack getContainerItem(ItemStack stack)
{
if (stack == null)
if (stack.isEmpty())
{
return null;
return ItemStack.EMPTY;
}
ItemStack copyStack = stack.copy();
@ -178,10 +178,10 @@ public class AlchemyTableRecipe
return copyStack.getItem().getContainerItem(copyStack);
}
copyStack.stackSize--;
if (copyStack.stackSize <= 0)
copyStack.shrink(1);
if (copyStack.isEmpty())
{
return null;
return ItemStack.EMPTY;
}
return copyStack;

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -17,7 +18,7 @@ public class LivingArmourDowngradeRecipe
{
protected LivingArmourUpgrade upgrade = null;
protected ItemStack keyStack = null;
protected ArrayList<Object> input = new ArrayList<Object>();
protected List<Object> input = new ArrayList<Object>();
public LivingArmourDowngradeRecipe(LivingArmourUpgrade upgrade, ItemStack keyStack, Object... recipe)
{
@ -77,20 +78,17 @@ public class LivingArmourDowngradeRecipe
ArrayList<Object> required = new ArrayList<Object>(input);
for (int x = 0; x < checkedList.size(); x++)
for (ItemStack slot : checkedList)
{
ItemStack slot = checkedList.get(x);
if (slot != null)
{
boolean inRecipe = false;
Iterator<Object> req = required.iterator();
while (req.hasNext())
for (Object aRequired : required)
{
boolean match = false;
Object next = req.next();
Object next = aRequired;
if (next instanceof ItemStack)
{
@ -129,9 +127,9 @@ public class LivingArmourDowngradeRecipe
*
* @return The recipes input vales.
*/
public ArrayList<Object> getInput()
public List<Object> getInput()
{
return this.input;
return ImmutableList.copyOf(input);
}
public ItemStack getKey()
@ -144,14 +142,14 @@ public class LivingArmourDowngradeRecipe
for (int i = 0; i < inv.getSlots(); i++)
{
ItemStack stack = inv.getStackInSlot(i);
if (stack == null)
if (stack.isEmpty())
{
continue;
}
if (stack.getItem().hasContainerItem(stack))
{
inv.extractItem(i, stack.stackSize, false);
inv.extractItem(i, stack.getCount(), false);
inv.insertItem(i, stack.getItem().getContainerItem(stack), false);
} else
{
@ -162,9 +160,9 @@ public class LivingArmourDowngradeRecipe
protected ItemStack getContainerItem(ItemStack stack)
{
if (stack == null)
if (stack.isEmpty())
{
return null;
return ItemStack.EMPTY;
}
ItemStack copyStack = stack.copy();
@ -174,10 +172,10 @@ public class LivingArmourDowngradeRecipe
return copyStack.getItem().getContainerItem(copyStack);
}
copyStack.stackSize--;
if (copyStack.stackSize <= 0)
copyStack.shrink(1);
if (copyStack.isEmpty())
{
return null;
return ItemStack.EMPTY;
}
return copyStack;

View file

@ -7,6 +7,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.oredict.OreDictionary;
@ -242,7 +243,7 @@ public class ShapedBloodOrbRecipe implements IRecipe
// value of the item instead
if (target instanceof Integer)
{
if (slot != null && slot.getItem() instanceof IBloodOrb)
if (!slot.isEmpty() && slot.getItem() instanceof IBloodOrb)
{
IBloodOrb orb = (IBloodOrb) slot.getItem();
if (orb.getOrbLevel(slot.getItemDamage()) < (Integer) target)
@ -271,7 +272,7 @@ public class ShapedBloodOrbRecipe implements IRecipe
{
return false;
}
} else if (target == null && slot != null)
} else if (target == null && !slot.isEmpty())
{
return false;
}
@ -292,7 +293,7 @@ public class ShapedBloodOrbRecipe implements IRecipe
return this.input;
}
public ItemStack[] getRemainingItems(InventoryCrafting inv)
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
}

View file

@ -7,7 +7,9 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
@ -83,7 +85,7 @@ public class ShapelessBloodOrbRecipe implements IRecipe
{
output = recipe.getRecipeOutput();
for (ItemStack ingred : ((List<ItemStack>) recipe.recipeItems))
for (ItemStack ingred : recipe.recipeItems)
{
Object finalObj = ingred;
for (Entry<ItemStack, String> replace : replacements.entrySet())
@ -126,7 +128,7 @@ public class ShapelessBloodOrbRecipe implements IRecipe
{
ItemStack slot = var1.getStackInSlot(x);
if (slot != null)
if (!slot.isEmpty())
{
boolean inRecipe = false;
Iterator<Object> req = required.iterator();
@ -187,17 +189,9 @@ public class ShapelessBloodOrbRecipe implements IRecipe
}
@Override
public ItemStack[] getRemainingItems(InventoryCrafting inv)
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
for (int i = 0; i < aitemstack.length; ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack);
}
return aitemstack;
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
}
public int getTier()