Fixed oredict issues with Solderer, fixes #1301
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
### 1.4.13
|
||||
- Fixed Portable Grid model (raoulvdberge, CyanideX)
|
||||
- Fixed ore dictionary causing problems with Solderer (raoulvdberge)
|
||||
- Fixed ore dictionary items not showing up in JEI for the Solderer (raoulvdberge)
|
||||
|
||||
### 1.4.12
|
||||
- Updated Forge to 2315 (raoulvdberge)
|
||||
|
||||
@@ -84,6 +84,8 @@ public final class RSUtils {
|
||||
private static final Map<Integer, List<ItemStack>> OREDICT_CACHE = new HashMap<>();
|
||||
private static final Map<Integer, Boolean> OREDICT_EQUIVALENCY_CACHE = new HashMap<>();
|
||||
|
||||
private static final NonNullList<Object> EMPTY_NON_NULL_LIST = NonNullList.create();
|
||||
|
||||
static {
|
||||
QUANTITY_FORMATTER.setRoundingMode(RoundingMode.DOWN);
|
||||
}
|
||||
@@ -211,6 +213,10 @@ public final class RSUtils {
|
||||
return other;
|
||||
}
|
||||
|
||||
public static <T> NonNullList<T> emptyNonNullList() {
|
||||
return (NonNullList<T>) EMPTY_NON_NULL_LIST;
|
||||
}
|
||||
|
||||
public static void writeItems(IItemHandler handler, int id, NBTTagCompound tag) {
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.raoulvdberge.refinedstorage.api.solderer;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -10,10 +11,10 @@ import javax.annotation.Nonnull;
|
||||
public interface ISoldererRecipe {
|
||||
/**
|
||||
* @param row the row in the solderer that we want the stack for (between 0 - 2)
|
||||
* @return a stack for the given row, or empty stack for no stack
|
||||
* @return possible stack(s) for the given row, or empty list for no stack
|
||||
*/
|
||||
@Nonnull
|
||||
ItemStack getRow(int row);
|
||||
NonNullList<ItemStack> getRow(int row);
|
||||
|
||||
/**
|
||||
* @return the stack that this recipe gives back
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.raoulvdberge.refinedstorage.api.solderer;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -37,18 +38,9 @@ public interface ISoldererRegistry {
|
||||
*
|
||||
* @param result the result
|
||||
* @param duration the duration in ticks
|
||||
* @param rows the rows of this recipe, has to be 3 rows (empty item stack for empty row)
|
||||
* @param rows the rows of this recipe, has to be 3 rows (empty list for empty row)
|
||||
* @return a solderer recipe
|
||||
*/
|
||||
@Nonnull
|
||||
ISoldererRecipe createSimpleRecipe(@Nonnull ItemStack result, int duration, ItemStack... rows);
|
||||
|
||||
/**
|
||||
* Remove existing recipes from the solderer
|
||||
*
|
||||
* @param result the result
|
||||
* @param rows none or the three rows that give the result
|
||||
* @return a list of removed {@link ISoldererRecipe}s
|
||||
*/
|
||||
List<ISoldererRecipe> removeRecipe(@Nonnull ItemStack result, ItemStack... rows);
|
||||
ISoldererRecipe createSimpleRecipe(@Nonnull ItemStack result, int duration, NonNullList<ItemStack>... rows);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||
import com.raoulvdberge.refinedstorage.api.solderer.ISoldererRecipe;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerNetworkNode;
|
||||
@@ -31,10 +30,12 @@ public class NetworkNodeSolderer extends NetworkNode {
|
||||
@Nonnull
|
||||
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
|
||||
for (ISoldererRecipe recipe : API.instance().getSoldererRegistry().getRecipes()) {
|
||||
if (API.instance().getComparer().isEqual(recipe.getRow(slot), stack, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT | IComparer.COMPARE_OREDICT | IComparer.COMPARE_STRIP_NBT)) {
|
||||
for (ItemStack possibility : recipe.getRow(slot)) {
|
||||
if (API.instance().getComparer().isEqualNoQuantity(possibility, stack)) {
|
||||
return super.insertItem(slot, stack, simulate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
@@ -112,7 +113,7 @@ public class NetworkNodeSolderer extends NetworkNode {
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (!recipe.getRow(i).isEmpty()) {
|
||||
ingredients.extractItem(i, recipe.getRow(i).getCount(), false);
|
||||
ingredients.extractItem(i, recipe.getRow(i).get(0).getCount(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ public class SoldererRecipeFluidStorage implements ISoldererRecipe {
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack getRow(int row) {
|
||||
return rows.get(row);
|
||||
public NonNullList<ItemStack> getRow(int row) {
|
||||
return NonNullList.withSize(1, rows.get(row));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.solderer;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RSItems;
|
||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
||||
import com.raoulvdberge.refinedstorage.api.solderer.ISoldererRecipe;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemProcessor;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -13,7 +14,7 @@ public class SoldererRecipePrintedProcessor implements ISoldererRecipe {
|
||||
private int type;
|
||||
private boolean fullBlock;
|
||||
private ItemStack result;
|
||||
private ItemStack requirement;
|
||||
private NonNullList<ItemStack> requirement;
|
||||
|
||||
public SoldererRecipePrintedProcessor(int type, boolean fullBlock) {
|
||||
this.type = type;
|
||||
@@ -22,28 +23,28 @@ public class SoldererRecipePrintedProcessor implements ISoldererRecipe {
|
||||
|
||||
switch (type) {
|
||||
case ItemProcessor.TYPE_PRINTED_BASIC:
|
||||
this.requirement = fullBlock ? new ItemStack(Blocks.IRON_BLOCK) : new ItemStack(Items.IRON_INGOT);
|
||||
this.requirement = fullBlock ? OreDictionary.getOres("blockIron") : OreDictionary.getOres("ingotIron");
|
||||
break;
|
||||
case ItemProcessor.TYPE_PRINTED_IMPROVED:
|
||||
this.requirement = fullBlock ? new ItemStack(Blocks.GOLD_BLOCK) : new ItemStack(Items.GOLD_INGOT);
|
||||
this.requirement = fullBlock ? OreDictionary.getOres("blockGold") : OreDictionary.getOres("ingotGold");
|
||||
break;
|
||||
case ItemProcessor.TYPE_PRINTED_ADVANCED:
|
||||
this.requirement = fullBlock ? new ItemStack(Blocks.DIAMOND_BLOCK) : new ItemStack(Items.DIAMOND);
|
||||
this.requirement = fullBlock ? OreDictionary.getOres("blockDiamond") : OreDictionary.getOres("gemDiamond");
|
||||
break;
|
||||
case ItemProcessor.TYPE_PRINTED_SILICON:
|
||||
if (fullBlock) {
|
||||
throw new IllegalArgumentException("Printed silicon can't be made from block form!");
|
||||
}
|
||||
|
||||
this.requirement = new ItemStack(RSItems.SILICON);
|
||||
this.requirement = OreDictionary.getOres("itemSilicon");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack getRow(int row) {
|
||||
return row == 1 ? requirement : ItemStack.EMPTY;
|
||||
public NonNullList<ItemStack> getRow(int row) {
|
||||
return row == 1 ? requirement : RSUtils.emptyNonNullList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,25 +3,27 @@ package com.raoulvdberge.refinedstorage.apiimpl.solderer;
|
||||
import com.raoulvdberge.refinedstorage.RSItems;
|
||||
import com.raoulvdberge.refinedstorage.api.solderer.ISoldererRecipe;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemProcessor;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SoldererRecipeProcessor implements ISoldererRecipe {
|
||||
private int type;
|
||||
private ItemStack result;
|
||||
private NonNullList<ItemStack> rows = NonNullList.create();
|
||||
private List<NonNullList<ItemStack>> rows = new ArrayList<>();
|
||||
|
||||
public SoldererRecipeProcessor(int type) {
|
||||
this.type = type;
|
||||
|
||||
this.result = new ItemStack(RSItems.PROCESSOR, 1, type);
|
||||
|
||||
this.rows.add(createPrintedProcessor());
|
||||
this.rows.add(new ItemStack(Items.REDSTONE));
|
||||
this.rows.add(new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_PRINTED_SILICON));
|
||||
this.rows.add(NonNullList.withSize(1, createPrintedProcessor()));
|
||||
this.rows.add(OreDictionary.getOres("dustRedstone"));
|
||||
this.rows.add(NonNullList.withSize(1, new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_PRINTED_SILICON)));
|
||||
}
|
||||
|
||||
private ItemStack createPrintedProcessor() {
|
||||
@@ -39,7 +41,7 @@ public class SoldererRecipeProcessor implements ISoldererRecipe {
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack getRow(int row) {
|
||||
public NonNullList<ItemStack> getRow(int row) {
|
||||
return rows.get(row);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ public class SoldererRecipeStorage implements ISoldererRecipe {
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack getRow(int row) {
|
||||
return rows.get(row);
|
||||
public NonNullList<ItemStack> getRow(int row) {
|
||||
return NonNullList.withSize(1, rows.get(row));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,35 +3,37 @@ package com.raoulvdberge.refinedstorage.apiimpl.solderer;
|
||||
import com.raoulvdberge.refinedstorage.RSItems;
|
||||
import com.raoulvdberge.refinedstorage.api.solderer.ISoldererRecipe;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SoldererRecipeUpgrade implements ISoldererRecipe {
|
||||
private ItemStack result;
|
||||
private NonNullList<ItemStack> rows = NonNullList.create();
|
||||
private List<NonNullList<ItemStack>> rows = new ArrayList<>();
|
||||
|
||||
public SoldererRecipeUpgrade(int type) {
|
||||
this.result = new ItemStack(RSItems.UPGRADE, 1, type);
|
||||
|
||||
this.rows.add(ItemUpgrade.getRequirement(result));
|
||||
this.rows.add(new ItemStack(Items.REDSTONE));
|
||||
this.rows.add(new ItemStack(RSItems.UPGRADE, 1, 0));
|
||||
this.rows.add(OreDictionary.getOres("dustRedstone"));
|
||||
this.rows.add(NonNullList.withSize(1, new ItemStack(RSItems.UPGRADE, 1, 0)));
|
||||
}
|
||||
|
||||
public SoldererRecipeUpgrade(ItemStack result) {
|
||||
this.result = result;
|
||||
|
||||
this.rows.add(ItemUpgrade.getRequirement(result));
|
||||
this.rows.add(new ItemStack(Items.REDSTONE));
|
||||
this.rows.add(new ItemStack(RSItems.UPGRADE, 1, 0));
|
||||
this.rows.add(OreDictionary.getOres("dustRedstone"));
|
||||
this.rows.add(NonNullList.withSize(1, new ItemStack(RSItems.UPGRADE, 1, 0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack getRow(int row) {
|
||||
public NonNullList<ItemStack> getRow(int row) {
|
||||
return rows.get(row);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,16 +2,14 @@ package com.raoulvdberge.refinedstorage.apiimpl.solderer;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.solderer.ISoldererRecipe;
|
||||
import com.raoulvdberge.refinedstorage.api.solderer.ISoldererRegistry;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class SoldererRegistry implements ISoldererRegistry {
|
||||
@@ -26,21 +24,27 @@ public class SoldererRegistry implements ISoldererRegistry {
|
||||
@Nullable
|
||||
public ISoldererRecipe getRecipe(@Nonnull IItemHandler ingredients) {
|
||||
for (ISoldererRecipe recipe : recipes) {
|
||||
boolean found = true;
|
||||
int rowsFound = 0;
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (!API.instance().getComparer().isEqual(recipe.getRow(i), ingredients.getStackInSlot(i), IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT | IComparer.COMPARE_OREDICT | IComparer.COMPARE_STRIP_NBT)) {
|
||||
found = false;
|
||||
NonNullList<ItemStack> possibilities = recipe.getRow(i);
|
||||
|
||||
if (possibilities.isEmpty() && ingredients.getStackInSlot(i).isEmpty()) {
|
||||
rowsFound++;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack row = recipe.getRow(i);
|
||||
|
||||
if (ingredients.getStackInSlot(i).getCount() < row.getCount()) {
|
||||
found = false;
|
||||
for (ItemStack possibility : possibilities) {
|
||||
if (API.instance().getComparer().isEqualNoQuantity(possibility, ingredients.getStackInSlot(i))) {
|
||||
if (ingredients.getStackInSlot(i).getCount() >= possibility.getCount()) {
|
||||
rowsFound++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
if (rowsFound == 3) {
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
@@ -55,21 +59,15 @@ public class SoldererRegistry implements ISoldererRegistry {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ISoldererRecipe createSimpleRecipe(@Nonnull ItemStack result, int duration, ItemStack... rows) {
|
||||
public ISoldererRecipe createSimpleRecipe(@Nonnull ItemStack result, int duration, NonNullList<ItemStack>... rows) {
|
||||
if (rows.length != 3) {
|
||||
throw new IllegalArgumentException("Solderer recipe expects 3 rows, got " + rows.length + " rows");
|
||||
}
|
||||
|
||||
for (ItemStack row : rows) {
|
||||
if (row == null) {
|
||||
throw new IllegalArgumentException("Found a null item stack in recipe creation!");
|
||||
}
|
||||
}
|
||||
|
||||
return new ISoldererRecipe() {
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getRow(int row) {
|
||||
public NonNullList<ItemStack> getRow(int row) {
|
||||
return rows[row];
|
||||
}
|
||||
|
||||
@@ -85,32 +83,4 @@ public class SoldererRegistry implements ISoldererRegistry {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ISoldererRecipe> removeRecipe(@Nonnull ItemStack result, ItemStack... rows) {
|
||||
if (!(rows.length == 0 || rows.length == 3)) {
|
||||
throw new IllegalArgumentException("Removing a recipe requires either no rows or 3 rows, got " + rows.length + " rows");
|
||||
}
|
||||
Iterator<ISoldererRecipe> itr = recipes.iterator();
|
||||
List<ISoldererRecipe> removed = new LinkedList<>();
|
||||
while (itr.hasNext()) {
|
||||
ISoldererRecipe recipe = itr.next();
|
||||
if (API.instance().getComparer().isEqualNoQuantity(result, recipe.getResult())) {
|
||||
if (rows.length == 0 || compareRows(recipe, rows)) {
|
||||
itr.remove();
|
||||
removed.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
private boolean compareRows(ISoldererRecipe recipe, ItemStack[] rows) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (!API.instance().getComparer().isEqualNoQuantity(recipe.getRow(i), rows[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public final class RecipeMakerSolderer {
|
||||
List<RecipeWrapperSolderer> recipes = new ArrayList<>();
|
||||
|
||||
for (ISoldererRecipe recipe : API.instance().getSoldererRegistry().getRecipes()) {
|
||||
List<ItemStack> inputs = new ArrayList<>();
|
||||
List<List<ItemStack>> inputs = new ArrayList<>();
|
||||
|
||||
inputs.add(recipe.getRow(0));
|
||||
inputs.add(recipe.getRow(1));
|
||||
|
||||
@@ -13,10 +13,10 @@ import java.util.List;
|
||||
public class RecipeWrapperSolderer extends BlankRecipeWrapper {
|
||||
private IDrawableAnimated progress;
|
||||
|
||||
private List<ItemStack> inputs;
|
||||
private List<List<ItemStack>> inputs;
|
||||
private ItemStack output;
|
||||
|
||||
public RecipeWrapperSolderer(IGuiHelper guiHelper, int duration, List<ItemStack> inputs, ItemStack output) {
|
||||
public RecipeWrapperSolderer(IGuiHelper guiHelper, int duration, List<List<ItemStack>> inputs, ItemStack output) {
|
||||
this.progress = guiHelper.createAnimatedDrawable(
|
||||
guiHelper.createDrawable(
|
||||
new ResourceLocation("refinedstorage", "textures/gui/solderer.png"),
|
||||
@@ -36,36 +36,14 @@ public class RecipeWrapperSolderer extends BlankRecipeWrapper {
|
||||
|
||||
@Override
|
||||
public void getIngredients(IIngredients ingredients) {
|
||||
ingredients.setInputs(ItemStack.class, inputs);
|
||||
ingredients.setInputLists(ItemStack.class, inputs);
|
||||
ingredients.setOutput(ItemStack.class, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof RecipeWrapperSolderer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RecipeWrapperSolderer other = (RecipeWrapperSolderer) obj;
|
||||
|
||||
for (int i = 0; i < inputs.size(); i++) {
|
||||
if (!ItemStack.areItemStacksEqual(inputs.get(i), other.inputs.get(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return ItemStack.areItemStacksEqual(output, other.output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
|
||||
|
||||
progress.draw(minecraft, 40, 18);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return inputs + " = " + output;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ package com.raoulvdberge.refinedstorage.item;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.RSItems;
|
||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentData;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -100,22 +101,22 @@ public class ItemUpgrade extends ItemBase {
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getRequirement(ItemStack stack) {
|
||||
public static NonNullList<ItemStack> getRequirement(ItemStack stack) {
|
||||
switch (stack.getItemDamage()) {
|
||||
case ItemUpgrade.TYPE_RANGE:
|
||||
return new ItemStack(Items.ENDER_PEARL);
|
||||
return OreDictionary.getOres("enderpearl");
|
||||
case ItemUpgrade.TYPE_SPEED:
|
||||
return new ItemStack(Items.SUGAR);
|
||||
return NonNullList.withSize(1, new ItemStack(Items.SUGAR));
|
||||
case ItemUpgrade.TYPE_CRAFTING:
|
||||
return new ItemStack(Blocks.CRAFTING_TABLE);
|
||||
return OreDictionary.getOres("workbench");
|
||||
case ItemUpgrade.TYPE_INTERDIMENSIONAL:
|
||||
return new ItemStack(Items.NETHER_STAR);
|
||||
return OreDictionary.getOres("netherStar");
|
||||
case ItemUpgrade.TYPE_SILK_TOUCH:
|
||||
return Items.ENCHANTED_BOOK.getEnchantedItemStack(new EnchantmentData(Enchantment.getEnchantmentByLocation("silk_touch"), 1));
|
||||
return NonNullList.withSize(1, Items.ENCHANTED_BOOK.getEnchantedItemStack(new EnchantmentData(Enchantment.getEnchantmentByLocation("silk_touch"), 1)));
|
||||
case ItemUpgrade.TYPE_FORTUNE:
|
||||
return Items.ENCHANTED_BOOK.getEnchantedItemStack(new EnchantmentData(Enchantment.getEnchantmentByLocation("fortune"), getFortuneLevel(stack)));
|
||||
return NonNullList.withSize(1, Items.ENCHANTED_BOOK.getEnchantedItemStack(new EnchantmentData(Enchantment.getEnchantmentByLocation("fortune"), getFortuneLevel(stack))));
|
||||
default:
|
||||
return null;
|
||||
return RSUtils.emptyNonNullList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent;
|
||||
@@ -212,9 +213,6 @@ public class ProxyCommon {
|
||||
|
||||
OreDictionary.registerOre("itemSilicon", RSItems.SILICON);
|
||||
|
||||
OreDictionary.registerOre("ingotQuartzEnrichedIron", RSItems.QUARTZ_ENRICHED_IRON);
|
||||
OreDictionary.registerOre("blockQuartzEnrichedIron", RSBlocks.QUARTZ_ENRICHED_IRON);
|
||||
|
||||
// Processors
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_BASIC, false));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_IMPROVED, false));
|
||||
@@ -345,27 +343,27 @@ public class ProxyCommon {
|
||||
API.instance().getSoldererRegistry().addRecipe(API.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.GRID, 1, GridType.CRAFTING.getId()),
|
||||
500,
|
||||
new ItemStack(Blocks.CRAFTING_TABLE),
|
||||
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
new ItemStack(RSBlocks.GRID, 1, GridType.NORMAL.getId())
|
||||
OreDictionary.getOres("workbench"),
|
||||
NonNullList.withSize(1, new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED)),
|
||||
NonNullList.withSize(1, new ItemStack(RSBlocks.GRID, 1, GridType.NORMAL.getId()))
|
||||
));
|
||||
|
||||
// Pattern Grid
|
||||
API.instance().getSoldererRegistry().addRecipe(API.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.GRID, 1, GridType.PATTERN.getId()),
|
||||
500,
|
||||
new ItemStack(RSItems.PATTERN),
|
||||
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
new ItemStack(RSBlocks.GRID, 1, GridType.NORMAL.getId())
|
||||
NonNullList.withSize(1, new ItemStack(RSItems.PATTERN)),
|
||||
NonNullList.withSize(1, new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED)),
|
||||
NonNullList.withSize(1, new ItemStack(RSBlocks.GRID, 1, GridType.NORMAL.getId()))
|
||||
));
|
||||
|
||||
// Fluid Grid
|
||||
API.instance().getSoldererRegistry().addRecipe(API.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.GRID, 1, GridType.FLUID.getId()),
|
||||
500,
|
||||
new ItemStack(Items.BUCKET),
|
||||
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
new ItemStack(RSBlocks.GRID, 1, GridType.NORMAL.getId())
|
||||
NonNullList.withSize(1, new ItemStack(Items.BUCKET)),
|
||||
NonNullList.withSize(1, new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED)),
|
||||
NonNullList.withSize(1, new ItemStack(RSBlocks.GRID, 1, GridType.NORMAL.getId()))
|
||||
));
|
||||
|
||||
// Wireless Grid
|
||||
@@ -718,18 +716,18 @@ public class ProxyCommon {
|
||||
API.instance().getSoldererRegistry().addRecipe(API.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.INTERFACE),
|
||||
200,
|
||||
new ItemStack(RSBlocks.IMPORTER),
|
||||
new ItemStack(RSBlocks.EXPORTER),
|
||||
new ItemStack(RSBlocks.MACHINE_CASING)
|
||||
NonNullList.withSize(1, new ItemStack(RSBlocks.IMPORTER)),
|
||||
NonNullList.withSize(1, new ItemStack(RSBlocks.EXPORTER)),
|
||||
NonNullList.withSize(1, new ItemStack(RSBlocks.MACHINE_CASING))
|
||||
));
|
||||
|
||||
// Fluid Interface
|
||||
API.instance().getSoldererRegistry().addRecipe(API.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.FLUID_INTERFACE),
|
||||
200,
|
||||
new ItemStack(Items.BUCKET),
|
||||
new ItemStack(Items.REDSTONE),
|
||||
new ItemStack(RSBlocks.INTERFACE)
|
||||
NonNullList.withSize(1, new ItemStack(Items.BUCKET)),
|
||||
OreDictionary.getOres("dustRedstone"),
|
||||
NonNullList.withSize(1, new ItemStack(RSBlocks.INTERFACE))
|
||||
));
|
||||
|
||||
// Grid Filter
|
||||
|
||||
Reference in New Issue
Block a user