Remove CompareUtils - it's now in IComparer

This commit is contained in:
Raoul Van den Berge
2016-10-07 02:46:59 +02:00
parent 57954276da
commit ae1117f8be
67 changed files with 588 additions and 554 deletions

View File

@@ -3,6 +3,7 @@ package refinedstorage.api;
import refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElementRegistry; import refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElementRegistry;
import refinedstorage.api.autocrafting.registry.ICraftingTaskRegistry; import refinedstorage.api.autocrafting.registry.ICraftingTaskRegistry;
import refinedstorage.api.solderer.ISoldererRegistry; import refinedstorage.api.solderer.ISoldererRegistry;
import refinedstorage.api.util.IComparer;
import refinedstorage.api.util.IItemStackList; import refinedstorage.api.util.IItemStackList;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@@ -11,6 +12,12 @@ import javax.annotation.Nonnull;
* Represents a Refined Storage API implementation. * Represents a Refined Storage API implementation.
*/ */
public interface IAPI { public interface IAPI {
/**
* @return the comparer
*/
@Nonnull
IComparer getComparer();
/** /**
* @return the solderer registry * @return the solderer registry
*/ */

View File

@@ -10,7 +10,6 @@ import refinedstorage.api.autocrafting.ICraftingPattern;
import refinedstorage.api.autocrafting.task.ICraftingTask; import refinedstorage.api.autocrafting.task.ICraftingTask;
import refinedstorage.api.network.grid.IFluidGridHandler; import refinedstorage.api.network.grid.IFluidGridHandler;
import refinedstorage.api.network.grid.IItemGridHandler; import refinedstorage.api.network.grid.IItemGridHandler;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.api.storage.fluid.IGroupedFluidStorage; import refinedstorage.api.storage.fluid.IGroupedFluidStorage;
import refinedstorage.api.storage.item.IGroupedItemStorage; import refinedstorage.api.storage.item.IGroupedItemStorage;

View File

@@ -16,7 +16,7 @@ import refinedstorage.api.autocrafting.ICraftingPatternContainer;
import refinedstorage.api.autocrafting.ICraftingPatternProvider; import refinedstorage.api.autocrafting.ICraftingPatternProvider;
import refinedstorage.api.autocrafting.registry.ICraftingTaskFactory; import refinedstorage.api.autocrafting.registry.ICraftingTaskFactory;
import refinedstorage.api.autocrafting.task.ICraftingTask; import refinedstorage.api.autocrafting.task.ICraftingTask;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -25,15 +25,15 @@ import javax.annotation.Nullable;
*/ */
public final class NetworkUtils { public final class NetworkUtils {
public static ItemStack extractItem(INetworkMaster network, ItemStack stack, int size) { public static ItemStack extractItem(INetworkMaster network, ItemStack stack, int size) {
return network.extractItem(stack, size, CompareUtils.COMPARE_DAMAGE | CompareUtils.COMPARE_NBT); return network.extractItem(stack, size, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT);
} }
public static FluidStack extractFluid(INetworkMaster network, FluidStack stack, int size) { public static FluidStack extractFluid(INetworkMaster network, FluidStack stack, int size) {
return network.extractFluid(stack, size, CompareUtils.COMPARE_NBT); return network.extractFluid(stack, size, IComparer.COMPARE_NBT);
} }
public static ICraftingPattern getPattern(INetworkMaster network, ItemStack stack) { public static ICraftingPattern getPattern(INetworkMaster network, ItemStack stack) {
return network.getPattern(stack, CompareUtils.COMPARE_DAMAGE | CompareUtils.COMPARE_NBT); return network.getPattern(stack, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT);
} }
public static ICraftingTask createCraftingTask(INetworkMaster network, @Nullable ItemStack stack, ICraftingPattern pattern, int quantity) { public static ICraftingTask createCraftingTask(INetworkMaster network, @Nullable ItemStack stack, ICraftingPattern pattern, int quantity) {
@@ -61,7 +61,7 @@ public final class NetworkUtils {
for (ICraftingTask task : network.getCraftingTasks()) { for (ICraftingTask task : network.getCraftingTasks()) {
for (ItemStack output : task.getPattern().getOutputs()) { for (ItemStack output : task.getPattern().getOutputs()) {
if (CompareUtils.compareStack(output, stack, compare)) { if (RSAPI.instance().getComparer().isEqual(output, stack, compare)) {
alreadyScheduled++; alreadyScheduled++;
} }
} }

View File

@@ -1,7 +1,6 @@
package refinedstorage.api.storage.fluid; package refinedstorage.api.storage.fluid;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import refinedstorage.api.storage.CompareUtils;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;

View File

@@ -2,14 +2,14 @@ package refinedstorage.api.storage.fluid;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import refinedstorage.api.network.INetworkMaster; import refinedstorage.api.network.INetworkMaster;
import refinedstorage.api.storage.CompareUtils;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
/**e /**
* e
* This holds all fluids from all the connected storages from a {@link INetworkMaster}. * This holds all fluids from all the connected storages from a {@link INetworkMaster}.
* <p> * <p>
* Refined Storage uses this class mainly for use in Grids and Detectors to avoid querying * Refined Storage uses this class mainly for use in Grids and Detectors to avoid querying

View File

@@ -1,7 +1,6 @@
package refinedstorage.api.storage.item; package refinedstorage.api.storage.item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import refinedstorage.api.storage.CompareUtils;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;

View File

@@ -0,0 +1,73 @@
package refinedstorage.api.util;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
/**
* Utilities for comparing item and fluid stacks.
*/
public interface IComparer {
int COMPARE_DAMAGE = 1;
int COMPARE_NBT = 2;
int COMPARE_QUANTITY = 4;
/**
* Compares two stacks by NBT, damage and quantity.
*
* @param left the left stack
* @param right the right stack
* @return true if the left and right stack are the same, false otherwise
*/
default boolean isEqual(ItemStack left, ItemStack right) {
return isEqual(left, right, COMPARE_NBT | COMPARE_DAMAGE | COMPARE_QUANTITY);
}
/**
* Compares two stacks by NBT and damage.
*
* @param left the left stack
* @param right the right stack
* @return true if the left and right stack are the same, false otherwise
*/
default boolean isEqualNoQuantity(ItemStack left, ItemStack right) {
return isEqual(left, right, COMPARE_NBT | COMPARE_DAMAGE);
}
/**
* Compares two stacks by the given flags.
*
* @param left the left stack
* @param right the right stack
* @param flags the flags to compare with
* @return true if the left and right stack are the same, false otherwise
*/
boolean isEqual(ItemStack left, ItemStack right, int flags);
/**
* Compares two stacks by the given flags.
*
* @param left the left stack
* @param right the right stack
* @param flags the flags to compare with
* @return true if the left and right stack are the same, false otherwise
*/
boolean isEqual(FluidStack left, FluidStack right, int flags);
/**
* Compares the NBT tags of two stacks.
*
* @param left the left stack
* @param right the right stack
* @return true if the NBT tags of the two stacks are the same, false otherwise
*/
boolean isEqualNBT(ItemStack left, ItemStack right);
/**
* Compares two stacks and checks if they share the same ore dictionary entry.
*
* @param left the left stack
* @param right the right stack
* @return true if the two stacks share the same ore dictionary entry
*/
boolean isEqualOredict(ItemStack left, ItemStack right);
}

View File

@@ -4,10 +4,12 @@ import refinedstorage.api.IAPI;
import refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElementRegistry; import refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElementRegistry;
import refinedstorage.api.autocrafting.registry.ICraftingTaskRegistry; import refinedstorage.api.autocrafting.registry.ICraftingTaskRegistry;
import refinedstorage.api.solderer.ISoldererRegistry; import refinedstorage.api.solderer.ISoldererRegistry;
import refinedstorage.api.util.IComparer;
import refinedstorage.api.util.IItemStackList; import refinedstorage.api.util.IItemStackList;
import refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementRegistry; import refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementRegistry;
import refinedstorage.apiimpl.autocrafting.registry.CraftingTaskRegistry; import refinedstorage.apiimpl.autocrafting.registry.CraftingTaskRegistry;
import refinedstorage.apiimpl.solderer.SoldererRegistry; import refinedstorage.apiimpl.solderer.SoldererRegistry;
import refinedstorage.apiimpl.util.Comparer;
import refinedstorage.apiimpl.util.ItemStackList; import refinedstorage.apiimpl.util.ItemStackList;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@@ -15,10 +17,17 @@ import javax.annotation.Nonnull;
public class API implements IAPI { public class API implements IAPI {
public static final IAPI INSTANCE = new API(); public static final IAPI INSTANCE = new API();
private IComparer comparer = new Comparer();
private ISoldererRegistry soldererRegistry = new SoldererRegistry(); private ISoldererRegistry soldererRegistry = new SoldererRegistry();
private ICraftingTaskRegistry craftingTaskRegistry = new CraftingTaskRegistry(); private ICraftingTaskRegistry craftingTaskRegistry = new CraftingTaskRegistry();
private ICraftingMonitorElementRegistry craftingMonitorElementRegistry = new CraftingMonitorElementRegistry(); private ICraftingMonitorElementRegistry craftingMonitorElementRegistry = new CraftingMonitorElementRegistry();
@Nonnull
@Override
public IComparer getComparer() {
return comparer;
}
@Override @Override
@Nonnull @Nonnull
public ISoldererRegistry getSoldererRegistry() { public ISoldererRegistry getSoldererRegistry() {

View File

@@ -7,9 +7,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemHandlerHelper;
import refinedstorage.api.RSAPI;
import refinedstorage.api.autocrafting.ICraftingPattern; import refinedstorage.api.autocrafting.ICraftingPattern;
import refinedstorage.api.autocrafting.ICraftingPatternContainer; import refinedstorage.api.autocrafting.ICraftingPatternContainer;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.apiimpl.autocrafting.registry.CraftingTaskFactoryNormal; import refinedstorage.apiimpl.autocrafting.registry.CraftingTaskFactoryNormal;
import refinedstorage.item.ItemPattern; import refinedstorage.item.ItemPattern;
@@ -108,7 +108,7 @@ public class CraftingPattern implements ICraftingPattern {
int quantity = 0; int quantity = 0;
for (ItemStack output : outputs) { for (ItemStack output : outputs) {
if (CompareUtils.compareStackNoQuantity(requested, output)) { if (RSAPI.instance().getComparer().isEqualNoQuantity(requested, output)) {
quantity += output.stackSize; quantity += output.stackSize;
if (!ItemPattern.isProcessing(stack)) { if (!ItemPattern.isProcessing(stack)) {
@@ -123,10 +123,10 @@ public class CraftingPattern implements ICraftingPattern {
@Override @Override
public String toString() { public String toString() {
return "CraftingPattern{" + return "CraftingPattern{" +
"container=" + container + "container=" + container +
", inputs=" + inputs + ", inputs=" + inputs +
", outputs=" + outputs + ", outputs=" + outputs +
", byproducts=" + byproducts + ", byproducts=" + byproducts +
'}'; '}';
} }
} }

View File

@@ -10,7 +10,7 @@ import refinedstorage.api.autocrafting.task.ICraftingTask;
import refinedstorage.api.autocrafting.task.IProcessable; import refinedstorage.api.autocrafting.task.IProcessable;
import refinedstorage.api.network.INetworkMaster; import refinedstorage.api.network.INetworkMaster;
import refinedstorage.api.network.NetworkUtils; import refinedstorage.api.network.NetworkUtils;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.api.util.IItemStackList; import refinedstorage.api.util.IItemStackList;
import refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementRoot; import refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementRoot;
import refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementToTake; import refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementToTake;
@@ -56,10 +56,10 @@ public class CraftingTaskNormal implements ICraftingTask {
} }
for (ItemStack input : pattern.getInputs()) { for (ItemStack input : pattern.getInputs()) {
ItemStack inputInNetwork = list.get(input, CompareUtils.COMPARE_DAMAGE | CompareUtils.COMPARE_NBT); ItemStack inputInNetwork = list.get(input, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT);
if (inputInNetwork == null || inputInNetwork.stackSize == 0) { if (inputInNetwork == null || inputInNetwork.stackSize == 0) {
if (extras.get(input, CompareUtils.COMPARE_DAMAGE | CompareUtils.COMPARE_NBT) != null) { if (extras.get(input, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT) != null) {
decrOrRemoveExtras(input); decrOrRemoveExtras(input);
} else { } else {
ICraftingPattern inputPattern = NetworkUtils.getPattern(network, input); ICraftingPattern inputPattern = NetworkUtils.getPattern(network, input);
@@ -95,11 +95,11 @@ public class CraftingTaskNormal implements ICraftingTask {
@Override @Override
public String toString() { public String toString() {
return "\nCraftingTask{quantity=" + quantity + return "\nCraftingTask{quantity=" + quantity +
"\n, toTake=" + toTake + "\n, toTake=" + toTake +
"\n, toCraft=" + toCraft + "\n, toCraft=" + toCraft +
"\n, toProcess=" + toProcess + "\n, toProcess=" + toProcess +
"\n, missing=" + missing + "\n, missing=" + missing +
'}'; '}';
} }
public boolean update() { public boolean update() {
@@ -155,9 +155,9 @@ public class CraftingTaskNormal implements ICraftingTask {
List<ICraftingMonitorElement> elements = new ArrayList<>(); List<ICraftingMonitorElement> elements = new ArrayList<>();
elements.add(new CraftingMonitorElementRoot( elements.add(new CraftingMonitorElementRoot(
network.getCraftingTasks().indexOf(this), network.getCraftingTasks().indexOf(this),
pattern.getOutputs().get(0), pattern.getOutputs().get(0),
quantity quantity
)); ));
if (!toTake.isEmpty()) { if (!toTake.isEmpty()) {
@@ -188,8 +188,8 @@ public class CraftingTaskNormal implements ICraftingTask {
private void addExtras(ICraftingPattern pattern) { private void addExtras(ICraftingPattern pattern) {
pattern.getOutputs().stream() pattern.getOutputs().stream()
.filter(o -> o.stackSize > 1) .filter(o -> o.stackSize > 1)
.forEach(o -> extras.add(ItemHandlerHelper.copyStackWithSize(o, o.stackSize - 1))); .forEach(o -> extras.add(ItemHandlerHelper.copyStackWithSize(o, o.stackSize - 1)));
} }
private void decrOrRemoveExtras(ItemStack stack) { private void decrOrRemoveExtras(ItemStack stack) {

View File

@@ -1,9 +1,9 @@
package refinedstorage.apiimpl.autocrafting.task; package refinedstorage.apiimpl.autocrafting.task;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import refinedstorage.api.RSAPI;
import refinedstorage.api.autocrafting.ICraftingPattern; import refinedstorage.api.autocrafting.ICraftingPattern;
import refinedstorage.api.autocrafting.task.IProcessable; import refinedstorage.api.autocrafting.task.IProcessable;
import refinedstorage.api.storage.CompareUtils;
public class Processable implements IProcessable { public class Processable implements IProcessable {
private ICraftingPattern pattern; private ICraftingPattern pattern;
@@ -51,7 +51,7 @@ public class Processable implements IProcessable {
if (!satisfied[i]) { if (!satisfied[i]) {
ItemStack item = pattern.getOutputs().get(i); ItemStack item = pattern.getOutputs().get(i);
if (CompareUtils.compareStackNoQuantity(stack, item)) { if (RSAPI.instance().getComparer().isEqualNoQuantity(stack, item)) {
satisfied[i] = true; satisfied[i] = true;
return true; return true;

View File

@@ -6,10 +6,10 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import refinedstorage.api.RSAPI;
import refinedstorage.api.network.INetworkMaster; import refinedstorage.api.network.INetworkMaster;
import refinedstorage.api.network.NetworkUtils; import refinedstorage.api.network.NetworkUtils;
import refinedstorage.api.network.grid.IFluidGridHandler; import refinedstorage.api.network.grid.IFluidGridHandler;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.apiimpl.storage.fluid.FluidUtils; import refinedstorage.apiimpl.storage.fluid.FluidUtils;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -32,7 +32,7 @@ public class FluidGridHandler implements IFluidGridHandler {
for (int i = 0; i < player.inventory.getSizeInventory(); ++i) { for (int i = 0; i < player.inventory.getSizeInventory(); ++i) {
ItemStack slot = player.inventory.getStackInSlot(i); ItemStack slot = player.inventory.getStackInSlot(i);
if (CompareUtils.compareStackNoQuantity(FluidUtils.EMPTY_BUCKET, slot)) { if (RSAPI.instance().getComparer().isEqualNoQuantity(FluidUtils.EMPTY_BUCKET, slot)) {
bucket = FluidUtils.EMPTY_BUCKET.copy(); bucket = FluidUtils.EMPTY_BUCKET.copy();
player.inventory.decrStackSize(i, 1); player.inventory.decrStackSize(i, 1);

View File

@@ -6,11 +6,11 @@ import net.minecraft.util.EnumFacing;
import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemHandlerHelper;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.api.RSAPI;
import refinedstorage.api.autocrafting.task.ICraftingTask; import refinedstorage.api.autocrafting.task.ICraftingTask;
import refinedstorage.api.network.INetworkMaster; import refinedstorage.api.network.INetworkMaster;
import refinedstorage.api.network.NetworkUtils; import refinedstorage.api.network.NetworkUtils;
import refinedstorage.api.network.grid.IItemGridHandler; import refinedstorage.api.network.grid.IItemGridHandler;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.apiimpl.autocrafting.task.CraftingTaskNormal; import refinedstorage.apiimpl.autocrafting.task.CraftingTaskNormal;
public class ItemGridHandler implements IItemGridHandler { public class ItemGridHandler implements IItemGridHandler {
@@ -35,7 +35,7 @@ public class ItemGridHandler implements IItemGridHandler {
ItemStack held = player.inventory.getItemStack(); ItemStack held = player.inventory.getItemStack();
if (single) { if (single) {
if (held != null && (!CompareUtils.compareStackNoQuantity(item, held) || held.stackSize + 1 > held.getMaxStackSize())) { if (held != null && (!RSAPI.instance().getComparer().isEqualNoQuantity(item, held) || held.stackSize + 1 > held.getMaxStackSize())) {
return; return;
} }
} else if (player.inventory.getItemStack() != null) { } else if (player.inventory.getItemStack() != null) {

View File

@@ -18,9 +18,9 @@ public class SoldererRecipeFluidStorage implements ISoldererRecipe {
public SoldererRecipeFluidStorage(EnumFluidStorageType type, int storagePart) { public SoldererRecipeFluidStorage(EnumFluidStorageType type, int storagePart) {
this.type = type; this.type = type;
this.rows = new ItemStack[]{ this.rows = new ItemStack[]{
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC), new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
new ItemStack(RSBlocks.MACHINE_CASING), new ItemStack(RSBlocks.MACHINE_CASING),
new ItemStack(RSItems.FLUID_STORAGE_PART, 1, storagePart) new ItemStack(RSItems.FLUID_STORAGE_PART, 1, storagePart)
}; };
} }

View File

@@ -35,7 +35,7 @@ public class SoldererRecipeProcessor implements ISoldererRecipe {
this.rows = new ItemStack[]{ this.rows = new ItemStack[]{
printedProcessor, printedProcessor,
new ItemStack(Items.REDSTONE), new ItemStack(Items.REDSTONE),
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_PRINTED_SILICON) new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_PRINTED_SILICON)
}; };
} }

View File

@@ -18,9 +18,9 @@ public class SoldererRecipeStorage implements ISoldererRecipe {
public SoldererRecipeStorage(EnumItemStorageType type, int storagePart) { public SoldererRecipeStorage(EnumItemStorageType type, int storagePart) {
this.type = type; this.type = type;
this.rows = new ItemStack[]{ this.rows = new ItemStack[]{
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC), new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
new ItemStack(RSBlocks.MACHINE_CASING), new ItemStack(RSBlocks.MACHINE_CASING),
new ItemStack(RSItems.STORAGE_PART, 1, storagePart) new ItemStack(RSItems.STORAGE_PART, 1, storagePart)
}; };
} }

View File

@@ -17,7 +17,7 @@ public class SoldererRecipeUpgrade implements ISoldererRecipe {
this.result = new ItemStack(RSItems.UPGRADE, 1, type); this.result = new ItemStack(RSItems.UPGRADE, 1, type);
this.rows = new ItemStack[]{ this.rows = new ItemStack[]{
ItemUpgrade.getRequirement(type), ItemUpgrade.getRequirement(type),
new ItemStack(RSItems.UPGRADE, 1, 0), new ItemStack(RSItems.UPGRADE, 1, 0),
new ItemStack(Items.REDSTONE) new ItemStack(Items.REDSTONE)
}; };
} }

View File

@@ -2,9 +2,9 @@ package refinedstorage.apiimpl.solderer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import refinedstorage.api.RSAPI;
import refinedstorage.api.solderer.ISoldererRecipe; import refinedstorage.api.solderer.ISoldererRecipe;
import refinedstorage.api.solderer.ISoldererRegistry; import refinedstorage.api.solderer.ISoldererRegistry;
import refinedstorage.api.storage.CompareUtils;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -26,7 +26,7 @@ public class SoldererRegistry implements ISoldererRegistry {
boolean found = true; boolean found = true;
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
if (!CompareUtils.compareStackNoQuantity(recipe.getRow(i), rows.getStackInSlot(i)) && !CompareUtils.compareStackOreDict(recipe.getRow(i), rows.getStackInSlot(i))) { if (!RSAPI.instance().getComparer().isEqualNoQuantity(recipe.getRow(i), rows.getStackInSlot(i)) && !RSAPI.instance().getComparer().isEqualOredict(recipe.getRow(i), rows.getStackInSlot(i))) {
found = false; found = false;
} }

View File

@@ -5,7 +5,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.RSAPI;
import refinedstorage.api.storage.fluid.IFluidStorage; import refinedstorage.api.storage.fluid.IFluidStorage;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -143,7 +143,7 @@ public abstract class FluidStorageNBT implements IFluidStorage {
@Override @Override
public synchronized FluidStack extractFluid(FluidStack stack, int size, int flags) { public synchronized FluidStack extractFluid(FluidStack stack, int size, int flags) {
for (FluidStack otherStack : stacks) { for (FluidStack otherStack : stacks) {
if (CompareUtils.compareStack(otherStack, stack, flags)) { if (RSAPI.instance().getComparer().isEqual(otherStack, stack, flags)) {
if (size > otherStack.amount) { if (size > otherStack.amount) {
size = otherStack.amount; size = otherStack.amount;
} }

View File

@@ -9,7 +9,7 @@ import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import refinedstorage.api.network.INetworkMaster; import refinedstorage.api.network.INetworkMaster;
import refinedstorage.api.network.NetworkUtils; import refinedstorage.api.network.NetworkUtils;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
public final class FluidUtils { public final class FluidUtils {
public static final ItemStack EMPTY_BUCKET = new ItemStack(Items.BUCKET); public static final ItemStack EMPTY_BUCKET = new ItemStack(Items.BUCKET);
@@ -51,7 +51,7 @@ public final class FluidUtils {
if (result != null) { if (result != null) {
result.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null).fill(NetworkUtils.extractFluid(network, fluidStack, Fluid.BUCKET_VOLUME), true); result.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null).fill(NetworkUtils.extractFluid(network, fluidStack, Fluid.BUCKET_VOLUME), true);
} else { } else {
NetworkUtils.scheduleCraftingTaskIfUnscheduled(network, EMPTY_BUCKET, 1, CompareUtils.COMPARE_DAMAGE | CompareUtils.COMPARE_NBT); NetworkUtils.scheduleCraftingTaskIfUnscheduled(network, EMPTY_BUCKET, 1, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT);
} }
} }
} }

View File

@@ -4,9 +4,9 @@ import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import refinedstorage.api.RSAPI;
import refinedstorage.api.network.INetworkMaster; import refinedstorage.api.network.INetworkMaster;
import refinedstorage.api.network.NetworkUtils; import refinedstorage.api.network.NetworkUtils;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.api.storage.fluid.IFluidStorage; import refinedstorage.api.storage.fluid.IFluidStorage;
import refinedstorage.api.storage.fluid.IFluidStorageProvider; import refinedstorage.api.storage.fluid.IFluidStorageProvider;
import refinedstorage.api.storage.fluid.IGroupedFluidStorage; import refinedstorage.api.storage.fluid.IGroupedFluidStorage;
@@ -87,7 +87,7 @@ public class GroupedFluidStorage implements IGroupedFluidStorage {
@Nullable @Nullable
public FluidStack get(@Nonnull FluidStack stack, int flags) { public FluidStack get(@Nonnull FluidStack stack, int flags) {
for (FluidStack otherStack : stacks.get(stack.getFluid())) { for (FluidStack otherStack : stacks.get(stack.getFluid())) {
if (CompareUtils.compareStack(otherStack, stack, flags)) { if (RSAPI.instance().getComparer().isEqual(otherStack, stack, flags)) {
return otherStack; return otherStack;
} }
} }

View File

@@ -6,7 +6,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemHandlerHelper;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.RSAPI;
import refinedstorage.api.storage.item.IItemStorage; import refinedstorage.api.storage.item.IItemStorage;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -124,7 +124,7 @@ public abstract class ItemStorageNBT implements IItemStorage {
@Override @Override
public synchronized ItemStack insertItem(ItemStack stack, int size, boolean simulate) { public synchronized ItemStack insertItem(ItemStack stack, int size, boolean simulate) {
for (ItemStack otherStack : stacks) { for (ItemStack otherStack : stacks) {
if (CompareUtils.compareStackNoQuantity(otherStack, stack)) { if (RSAPI.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
if (getCapacity() != -1 && getStored() + size > getCapacity()) { if (getCapacity() != -1 && getStored() + size > getCapacity()) {
int remainingSpace = getCapacity() - getStored(); int remainingSpace = getCapacity() - getStored();
@@ -187,7 +187,7 @@ public abstract class ItemStorageNBT implements IItemStorage {
@Override @Override
public synchronized ItemStack extractItem(ItemStack stack, int size, int flags) { public synchronized ItemStack extractItem(ItemStack stack, int size, int flags) {
for (ItemStack otherStack : stacks) { for (ItemStack otherStack : stacks) {
if (CompareUtils.compareStack(otherStack, stack, flags)) { if (RSAPI.instance().getComparer().isEqual(otherStack, stack, flags)) {
if (size > otherStack.stackSize) { if (size > otherStack.stackSize) {
size = otherStack.stackSize; size = otherStack.stackSize;
} }

View File

@@ -1,49 +1,14 @@
package refinedstorage.api.storage; package refinedstorage.apiimpl.util;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import refinedstorage.api.util.IComparer;
/** public class Comparer implements IComparer {
* Utilities for comparing item and fluid stacks. @Override
*/ public boolean isEqual(ItemStack left, ItemStack right, int flags) {
public final class CompareUtils {
public static final int COMPARE_DAMAGE = 1;
public static final int COMPARE_NBT = 2;
public static final int COMPARE_QUANTITY = 4;
/**
* Compares two stacks by NBT, damage and quantity.
*
* @param left the left stack
* @param right the right stack
* @return true if the left and right stack are the same, false otherwise
*/
public static boolean compareStack(ItemStack left, ItemStack right) {
return compareStack(left, right, COMPARE_NBT | COMPARE_DAMAGE | COMPARE_QUANTITY);
}
/**
* Compares two stacks by NBT and damage.
*
* @param left the left stack
* @param right the right stack
* @return true if the left and right stack are the same, false otherwise
*/
public static boolean compareStackNoQuantity(ItemStack left, ItemStack right) {
return compareStack(left, right, COMPARE_NBT | COMPARE_DAMAGE);
}
/**
* Compares two stacks by the given flags.
*
* @param left the left stack
* @param right the right stack
* @param flags the flags to compare with
* @return true if the left and right stack are the same, false otherwise
*/
public static boolean compareStack(ItemStack left, ItemStack right, int flags) {
if (left == null && right == null) { if (left == null && right == null) {
return true; return true;
} }
@@ -63,7 +28,7 @@ public final class CompareUtils {
} }
if ((flags & COMPARE_NBT) == COMPARE_NBT) { if ((flags & COMPARE_NBT) == COMPARE_NBT) {
if (!compareNbt(left, right)) { if (!isEqualNBT(left, right)) {
return false; return false;
} }
} }
@@ -77,15 +42,8 @@ public final class CompareUtils {
return true; return true;
} }
/** @Override
* Compares two stacks by the given flags. public boolean isEqual(FluidStack left, FluidStack right, int flags) {
*
* @param left the left stack
* @param right the right stack
* @param flags the flags to compare with
* @return true if the left and right stack are the same, false otherwise
*/
public static boolean compareStack(FluidStack left, FluidStack right, int flags) {
if (left == null && right == null) { if (left == null && right == null) {
return true; return true;
} }
@@ -113,14 +71,8 @@ public final class CompareUtils {
return true; return true;
} }
/** @Override
* Compares the NBT tags of two stacks. public boolean isEqualNBT(ItemStack left, ItemStack right) {
*
* @param left the left stack
* @param right the right stack
* @return true if the NBT tags of the two stacks are the same, false otherwise
*/
public static boolean compareNbt(ItemStack left, ItemStack right) {
if (!ItemStack.areItemStackTagsEqual(left, right)) { if (!ItemStack.areItemStackTagsEqual(left, right)) {
if (left.hasTagCompound() && !right.hasTagCompound() && left.getTagCompound().hasNoTags()) { if (left.hasTagCompound() && !right.hasTagCompound() && left.getTagCompound().hasNoTags()) {
return true; return true;
@@ -134,14 +86,8 @@ public final class CompareUtils {
return true; return true;
} }
/** @Override
* Compares two stacks and checks if they share the same ore dictionary entry. public boolean isEqualOredict(ItemStack left, ItemStack right) {
*
* @param left the left stack
* @param right the right stack
* @return true if the two stacks share the same ore dictionary entry
*/
public static boolean compareStackOreDict(ItemStack left, ItemStack right) {
if (left == null && right == null) { if (left == null && right == null) {
return true; return true;
} }

View File

@@ -4,8 +4,8 @@ import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import refinedstorage.api.RSAPI;
import refinedstorage.api.network.NetworkUtils; import refinedstorage.api.network.NetworkUtils;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.api.util.IItemStackList; import refinedstorage.api.util.IItemStackList;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@@ -17,7 +17,7 @@ public class ItemStackList implements IItemStackList {
public void add(ItemStack stack) { public void add(ItemStack stack) {
for (ItemStack otherStack : stacks.get(stack.getItem())) { for (ItemStack otherStack : stacks.get(stack.getItem())) {
if (CompareUtils.compareStackNoQuantity(otherStack, stack)) { if (RSAPI.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
otherStack.stackSize += stack.stackSize; otherStack.stackSize += stack.stackSize;
return; return;
@@ -29,7 +29,7 @@ public class ItemStackList implements IItemStackList {
public boolean remove(@Nonnull ItemStack stack, boolean removeIfReachedZero) { public boolean remove(@Nonnull ItemStack stack, boolean removeIfReachedZero) {
for (ItemStack otherStack : stacks.get(stack.getItem())) { for (ItemStack otherStack : stacks.get(stack.getItem())) {
if (CompareUtils.compareStackNoQuantity(otherStack, stack)) { if (RSAPI.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
otherStack.stackSize -= stack.stackSize; otherStack.stackSize -= stack.stackSize;
if (otherStack.stackSize == 0 && removeIfReachedZero) { if (otherStack.stackSize == 0 && removeIfReachedZero) {
@@ -46,7 +46,7 @@ public class ItemStackList implements IItemStackList {
@Nullable @Nullable
public ItemStack get(@Nonnull ItemStack stack, int flags) { public ItemStack get(@Nonnull ItemStack stack, int flags) {
for (ItemStack otherStack : stacks.get(stack.getItem())) { for (ItemStack otherStack : stacks.get(stack.getItem())) {
if (CompareUtils.compareStack(otherStack, stack, flags)) { if (RSAPI.instance().getComparer().isEqual(otherStack, stack, flags)) {
return otherStack; return otherStack;
} }
} }

View File

@@ -6,7 +6,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemHandlerHelper;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.RSAPI;
import refinedstorage.container.slot.*; import refinedstorage.container.slot.*;
import refinedstorage.tile.TileBase; import refinedstorage.tile.TileBase;
import refinedstorage.tile.grid.WirelessGrid; import refinedstorage.tile.grid.WirelessGrid;
@@ -107,7 +107,7 @@ public abstract class ContainerBase extends Container {
protected ItemStack mergeItemStackToSpecimen(ItemStack stack, int begin, int end) { protected ItemStack mergeItemStackToSpecimen(ItemStack stack, int begin, int end) {
for (int i = begin; i < end; ++i) { for (int i = begin; i < end; ++i) {
if (CompareUtils.compareStackNoQuantity(getStackFromSlot(getSlot(i)), stack)) { if (RSAPI.instance().getComparer().isEqualNoQuantity(getStackFromSlot(getSlot(i)), stack)) {
return null; return null;
} }
} }

View File

@@ -20,7 +20,7 @@ public class ContainerDiskManipulator extends ContainerBase {
} }
for (int i = 0; i < 6; ++i) { for (int i = 0; i < 6; ++i) {
addSlotToContainer(new SlotItemHandler(manipulator.getDisks(), 6 + i, 116 + (i%2 * 18), ((i / 2) * 18) + 57)); addSlotToContainer(new SlotItemHandler(manipulator.getDisks(), 6 + i, 116 + (i % 2 * 18), ((i / 2) * 18) + 57));
} }
for (int i = 0; i < 9; ++i) { for (int i = 0; i < 9; ++i) {

View File

@@ -76,7 +76,7 @@ public class ContainerProcessingPatternEncoder extends ContainerBase {
} }
public void setInputs(Collection<ItemStack> stacks) { public void setInputs(Collection<ItemStack> stacks) {
setSlots(stacks, 2 , 2 + 9); setSlots(stacks, 2, 2 + 9);
} }
public void setOutputs(Collection<ItemStack> stacks) { public void setOutputs(Collection<ItemStack> stacks) {

View File

@@ -1,6 +1,6 @@
package refinedstorage.gui; package refinedstorage.gui;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.container.ContainerConstructor; import refinedstorage.container.ContainerConstructor;
import refinedstorage.gui.sidebutton.SideButtonCompare; import refinedstorage.gui.sidebutton.SideButtonCompare;
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode; import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
@@ -18,8 +18,8 @@ public class GuiConstructor extends GuiBase {
addSideButton(new SideButtonType(this, TileConstructor.TYPE)); addSideButton(new SideButtonType(this, TileConstructor.TYPE));
addSideButton(new SideButtonCompare(this, TileConstructor.COMPARE, CompareUtils.COMPARE_DAMAGE)); addSideButton(new SideButtonCompare(this, TileConstructor.COMPARE, IComparer.COMPARE_DAMAGE));
addSideButton(new SideButtonCompare(this, TileConstructor.COMPARE, CompareUtils.COMPARE_NBT)); addSideButton(new SideButtonCompare(this, TileConstructor.COMPARE, IComparer.COMPARE_NBT));
} }
@Override @Override

View File

@@ -1,6 +1,6 @@
package refinedstorage.gui; package refinedstorage.gui;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.container.ContainerDestructor; import refinedstorage.container.ContainerDestructor;
import refinedstorage.gui.sidebutton.SideButtonCompare; import refinedstorage.gui.sidebutton.SideButtonCompare;
import refinedstorage.gui.sidebutton.SideButtonMode; import refinedstorage.gui.sidebutton.SideButtonMode;
@@ -21,8 +21,8 @@ public class GuiDestructor extends GuiBase {
addSideButton(new SideButtonMode(this, TileDestructor.MODE)); addSideButton(new SideButtonMode(this, TileDestructor.MODE));
addSideButton(new SideButtonCompare(this, TileDestructor.COMPARE, CompareUtils.COMPARE_DAMAGE)); addSideButton(new SideButtonCompare(this, TileDestructor.COMPARE, IComparer.COMPARE_DAMAGE));
addSideButton(new SideButtonCompare(this, TileDestructor.COMPARE, CompareUtils.COMPARE_NBT)); addSideButton(new SideButtonCompare(this, TileDestructor.COMPARE, IComparer.COMPARE_NBT));
} }
@Override @Override

View File

@@ -2,7 +2,7 @@ package refinedstorage.gui;
import com.google.common.primitives.Ints; import com.google.common.primitives.Ints;
import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.GuiTextField;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.container.ContainerDetector; import refinedstorage.container.ContainerDetector;
import refinedstorage.gui.sidebutton.SideButtonCompare; import refinedstorage.gui.sidebutton.SideButtonCompare;
import refinedstorage.gui.sidebutton.SideButtonDetectorMode; import refinedstorage.gui.sidebutton.SideButtonDetectorMode;
@@ -25,8 +25,8 @@ public class GuiDetector extends GuiBase {
addSideButton(new SideButtonDetectorMode(this)); addSideButton(new SideButtonDetectorMode(this));
addSideButton(new SideButtonCompare(this, TileDetector.COMPARE, CompareUtils.COMPARE_DAMAGE)); addSideButton(new SideButtonCompare(this, TileDetector.COMPARE, IComparer.COMPARE_DAMAGE));
addSideButton(new SideButtonCompare(this, TileDetector.COMPARE, CompareUtils.COMPARE_NBT)); addSideButton(new SideButtonCompare(this, TileDetector.COMPARE, IComparer.COMPARE_NBT));
AMOUNT = new GuiTextField(0, fontRendererObj, x + 62 + 1, y + 23 + 1, 29, fontRendererObj.FONT_HEIGHT); AMOUNT = new GuiTextField(0, fontRendererObj, x + 62 + 1, y + 23 + 1, 29, fontRendererObj.FONT_HEIGHT);
AMOUNT.setText(String.valueOf(TileDetector.AMOUNT.getValue())); AMOUNT.setText(String.valueOf(TileDetector.AMOUNT.getValue()));

View File

@@ -1,6 +1,6 @@
package refinedstorage.gui; package refinedstorage.gui;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.container.ContainerDiskManipulator; import refinedstorage.container.ContainerDiskManipulator;
import refinedstorage.gui.sidebutton.*; import refinedstorage.gui.sidebutton.*;
import refinedstorage.tile.TileDiskManipulator; import refinedstorage.tile.TileDiskManipulator;
@@ -16,8 +16,8 @@ public class GuiDiskManipulator extends GuiBase {
addSideButton(new SideButtonIOMode(this, TileDiskManipulator.IO_MODE)); addSideButton(new SideButtonIOMode(this, TileDiskManipulator.IO_MODE));
addSideButton(new SideButtonType(this, TileDiskManipulator.TYPE)); addSideButton(new SideButtonType(this, TileDiskManipulator.TYPE));
addSideButton(new SideButtonMode(this, TileDiskManipulator.MODE)); addSideButton(new SideButtonMode(this, TileDiskManipulator.MODE));
addSideButton(new SideButtonCompare(this, TileDiskManipulator.COMPARE, CompareUtils.COMPARE_DAMAGE)); addSideButton(new SideButtonCompare(this, TileDiskManipulator.COMPARE, IComparer.COMPARE_DAMAGE));
addSideButton(new SideButtonCompare(this, TileDiskManipulator.COMPARE, CompareUtils.COMPARE_NBT)); addSideButton(new SideButtonCompare(this, TileDiskManipulator.COMPARE, IComparer.COMPARE_NBT));
} }
@Override @Override

View File

@@ -1,6 +1,6 @@
package refinedstorage.gui; package refinedstorage.gui;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.container.ContainerExporter; import refinedstorage.container.ContainerExporter;
import refinedstorage.gui.sidebutton.SideButtonCompare; import refinedstorage.gui.sidebutton.SideButtonCompare;
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode; import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
@@ -18,8 +18,8 @@ public class GuiExporter extends GuiBase {
addSideButton(new SideButtonType(this, TileExporter.TYPE)); addSideButton(new SideButtonType(this, TileExporter.TYPE));
addSideButton(new SideButtonCompare(this, TileExporter.COMPARE, CompareUtils.COMPARE_DAMAGE)); addSideButton(new SideButtonCompare(this, TileExporter.COMPARE, IComparer.COMPARE_DAMAGE));
addSideButton(new SideButtonCompare(this, TileExporter.COMPARE, CompareUtils.COMPARE_NBT)); addSideButton(new SideButtonCompare(this, TileExporter.COMPARE, IComparer.COMPARE_NBT));
} }
@Override @Override

View File

@@ -1,6 +1,6 @@
package refinedstorage.gui; package refinedstorage.gui;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.apiimpl.storage.fluid.FluidRenderer; import refinedstorage.apiimpl.storage.fluid.FluidRenderer;
import refinedstorage.container.ContainerFluidInterface; import refinedstorage.container.ContainerFluidInterface;
import refinedstorage.gui.sidebutton.SideButtonCompare; import refinedstorage.gui.sidebutton.SideButtonCompare;
@@ -18,7 +18,7 @@ public class GuiFluidInterface extends GuiBase {
public void init(int x, int y) { public void init(int x, int y) {
addSideButton(new SideButtonRedstoneMode(this, TileFluidInterface.REDSTONE_MODE)); addSideButton(new SideButtonRedstoneMode(this, TileFluidInterface.REDSTONE_MODE));
addSideButton(new SideButtonCompare(this, TileFluidInterface.COMPARE, CompareUtils.COMPARE_NBT)); addSideButton(new SideButtonCompare(this, TileFluidInterface.COMPARE, IComparer.COMPARE_NBT));
} }
@Override @Override

View File

@@ -3,7 +3,7 @@ package refinedstorage.gui;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraftforge.fml.client.config.GuiCheckBox; import net.minecraftforge.fml.client.config.GuiCheckBox;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.container.ContainerGridFilter; import refinedstorage.container.ContainerGridFilter;
import refinedstorage.item.ItemGridFilter; import refinedstorage.item.ItemGridFilter;
import refinedstorage.network.MessageGridFilterUpdate; import refinedstorage.network.MessageGridFilterUpdate;
@@ -24,8 +24,8 @@ public class GuiGridFilter extends GuiBase {
@Override @Override
public void init(int x, int y) { public void init(int x, int y) {
compareDamage = addCheckBox(x + 7, y + 41, t("gui.refinedstorage:grid_filter.compare_damage"), (compare & CompareUtils.COMPARE_DAMAGE) == CompareUtils.COMPARE_DAMAGE); compareDamage = addCheckBox(x + 7, y + 41, t("gui.refinedstorage:grid_filter.compare_damage"), (compare & IComparer.COMPARE_DAMAGE) == IComparer.COMPARE_DAMAGE);
compareNBT = addCheckBox(x + 7 + compareDamage.getButtonWidth() + 4, y + 41, t("gui.refinedstorage:grid_filter.compare_nbt"), (compare & CompareUtils.COMPARE_NBT) == CompareUtils.COMPARE_NBT); compareNBT = addCheckBox(x + 7 + compareDamage.getButtonWidth() + 4, y + 41, t("gui.refinedstorage:grid_filter.compare_nbt"), (compare & IComparer.COMPARE_NBT) == IComparer.COMPARE_NBT);
} }
@Override @Override
@@ -50,9 +50,9 @@ public class GuiGridFilter extends GuiBase {
super.actionPerformed(button); super.actionPerformed(button);
if (button == compareDamage) { if (button == compareDamage) {
compare ^= CompareUtils.COMPARE_DAMAGE; compare ^= IComparer.COMPARE_DAMAGE;
} else if (button == compareNBT) { } else if (button == compareNBT) {
compare ^= CompareUtils.COMPARE_NBT; compare ^= IComparer.COMPARE_NBT;
} }
RS.INSTANCE.network.sendToServer(new MessageGridFilterUpdate(compare)); RS.INSTANCE.network.sendToServer(new MessageGridFilterUpdate(compare));

View File

@@ -1,6 +1,6 @@
package refinedstorage.gui; package refinedstorage.gui;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.container.ContainerImporter; import refinedstorage.container.ContainerImporter;
import refinedstorage.gui.sidebutton.SideButtonCompare; import refinedstorage.gui.sidebutton.SideButtonCompare;
import refinedstorage.gui.sidebutton.SideButtonMode; import refinedstorage.gui.sidebutton.SideButtonMode;
@@ -21,8 +21,8 @@ public class GuiImporter extends GuiBase {
addSideButton(new SideButtonMode(this, TileImporter.MODE)); addSideButton(new SideButtonMode(this, TileImporter.MODE));
addSideButton(new SideButtonCompare(this, TileImporter.COMPARE, CompareUtils.COMPARE_DAMAGE)); addSideButton(new SideButtonCompare(this, TileImporter.COMPARE, IComparer.COMPARE_DAMAGE));
addSideButton(new SideButtonCompare(this, TileImporter.COMPARE, CompareUtils.COMPARE_NBT)); addSideButton(new SideButtonCompare(this, TileImporter.COMPARE, IComparer.COMPARE_NBT));
} }
@Override @Override

View File

@@ -1,6 +1,6 @@
package refinedstorage.gui; package refinedstorage.gui;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.container.ContainerInterface; import refinedstorage.container.ContainerInterface;
import refinedstorage.gui.sidebutton.SideButtonCompare; import refinedstorage.gui.sidebutton.SideButtonCompare;
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode; import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
@@ -15,8 +15,8 @@ public class GuiInterface extends GuiBase {
public void init(int x, int y) { public void init(int x, int y) {
addSideButton(new SideButtonRedstoneMode(this, TileInterface.REDSTONE_MODE)); addSideButton(new SideButtonRedstoneMode(this, TileInterface.REDSTONE_MODE));
addSideButton(new SideButtonCompare(this, TileInterface.COMPARE, CompareUtils.COMPARE_DAMAGE)); addSideButton(new SideButtonCompare(this, TileInterface.COMPARE, IComparer.COMPARE_DAMAGE));
addSideButton(new SideButtonCompare(this, TileInterface.COMPARE, CompareUtils.COMPARE_NBT)); addSideButton(new SideButtonCompare(this, TileInterface.COMPARE, IComparer.COMPARE_NBT));
} }
@Override @Override

View File

@@ -2,7 +2,7 @@ package refinedstorage.gui;
import com.google.common.primitives.Ints; import com.google.common.primitives.Ints;
import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.GuiTextField;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.container.ContainerBase; import refinedstorage.container.ContainerBase;
import refinedstorage.gui.sidebutton.SideButtonCompare; import refinedstorage.gui.sidebutton.SideButtonCompare;
import refinedstorage.gui.sidebutton.SideButtonMode; import refinedstorage.gui.sidebutton.SideButtonMode;
@@ -50,8 +50,8 @@ public class GuiStorage extends GuiBase {
} }
if (gui.getCompareParameter() != null) { if (gui.getCompareParameter() != null) {
addSideButton(new SideButtonCompare(this, gui.getCompareParameter(), CompareUtils.COMPARE_DAMAGE)); addSideButton(new SideButtonCompare(this, gui.getCompareParameter(), IComparer.COMPARE_DAMAGE));
addSideButton(new SideButtonCompare(this, gui.getCompareParameter(), CompareUtils.COMPARE_NBT)); addSideButton(new SideButtonCompare(this, gui.getCompareParameter(), IComparer.COMPARE_NBT));
} }
priorityField = new GuiTextField(0, fontRendererObj, x + 98 + 1, y + 54 + 1, 29, fontRendererObj.FONT_HEIGHT); priorityField = new GuiTextField(0, fontRendererObj, x + 98 + 1, y + 54 + 1, 29, fontRendererObj.FONT_HEIGHT);

View File

@@ -8,10 +8,10 @@ public class ModGuiConfig extends GuiConfig {
public ModGuiConfig(GuiScreen guiScreen) { public ModGuiConfig(GuiScreen guiScreen) {
super(guiScreen, super(guiScreen,
RS.INSTANCE.config.getConfigElements(), RS.INSTANCE.config.getConfigElements(),
RS.ID, RS.ID,
false, false,
false, false,
GuiConfig.getAbridgedConfigPath(RS.INSTANCE.config.getConfig().toString())); GuiConfig.getAbridgedConfigPath(RS.INSTANCE.config.getConfig().toString()));
} }
} }

View File

@@ -15,8 +15,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLCommonHandler;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.api.RSAPI;
import refinedstorage.api.network.grid.IItemGridHandler; import refinedstorage.api.network.grid.IItemGridHandler;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.block.EnumGridType; import refinedstorage.block.EnumGridType;
import refinedstorage.container.ContainerGrid; import refinedstorage.container.ContainerGrid;
import refinedstorage.gui.GuiBase; import refinedstorage.gui.GuiBase;
@@ -128,7 +128,7 @@ public class GuiGrid extends GuiBase {
boolean found = filteredItems.isEmpty(); boolean found = filteredItems.isEmpty();
for (GridFilteredItem filteredItem : filteredItems) { for (GridFilteredItem filteredItem : filteredItems) {
if (CompareUtils.compareStack(((ClientStackItem) stack).getStack(), filteredItem.getStack(), filteredItem.getCompare())) { if (RSAPI.instance().getComparer().isEqual(((ClientStackItem) stack).getStack(), filteredItem.getStack(), filteredItem.getCompare())) {
found = true; found = true;
break; break;

View File

@@ -1,7 +1,7 @@
package refinedstorage.gui.sidebutton; package refinedstorage.gui.sidebutton;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.gui.GuiBase; import refinedstorage.gui.GuiBase;
import refinedstorage.tile.data.TileDataManager; import refinedstorage.tile.data.TileDataManager;
import refinedstorage.tile.data.TileDataParameter; import refinedstorage.tile.data.TileDataParameter;
@@ -34,9 +34,9 @@ public class SideButtonCompare extends SideButton {
protected void drawButtonIcon(int x, int y) { protected void drawButtonIcon(int x, int y) {
int ty = 0; int ty = 0;
if (mask == CompareUtils.COMPARE_DAMAGE) { if (mask == IComparer.COMPARE_DAMAGE) {
ty = 80; ty = 80;
} else if (mask == CompareUtils.COMPARE_NBT) { } else if (mask == IComparer.COMPARE_NBT) {
ty = 48; ty = 48;
} }

View File

@@ -10,7 +10,7 @@ import net.minecraft.world.World;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.RSGui; import refinedstorage.RSGui;
import refinedstorage.RSItems; import refinedstorage.RSItems;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.inventory.ItemHandlerGridFilter; import refinedstorage.inventory.ItemHandlerGridFilter;
import java.util.List; import java.util.List;
@@ -49,7 +49,7 @@ public class ItemGridFilter extends ItemBase {
} }
public static int getCompare(ItemStack stack) { public static int getCompare(ItemStack stack) {
return (stack.hasTagCompound() && stack.getTagCompound().hasKey(NBT_COMPARE)) ? stack.getTagCompound().getInteger(NBT_COMPARE) : (CompareUtils.COMPARE_DAMAGE | CompareUtils.COMPARE_NBT); return (stack.hasTagCompound() && stack.getTagCompound().hasKey(NBT_COMPARE)) ? stack.getTagCompound().getInteger(NBT_COMPARE) : (IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT);
} }
public static void setCompare(ItemStack stack, int compare) { public static void setCompare(ItemStack stack, int compare) {

View File

@@ -14,10 +14,10 @@ import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.Constants;
import refinedstorage.RSItems; import refinedstorage.RSItems;
import refinedstorage.api.RSAPI;
import refinedstorage.api.autocrafting.ICraftingPattern; import refinedstorage.api.autocrafting.ICraftingPattern;
import refinedstorage.api.autocrafting.ICraftingPatternContainer; import refinedstorage.api.autocrafting.ICraftingPatternContainer;
import refinedstorage.api.autocrafting.ICraftingPatternProvider; import refinedstorage.api.autocrafting.ICraftingPatternProvider;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.apiimpl.autocrafting.CraftingPattern; import refinedstorage.apiimpl.autocrafting.CraftingPattern;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@@ -158,7 +158,7 @@ public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
int amount = stacks[i].stackSize; int amount = stacks[i].stackSize;
for (int j = i + 1; j < stacks.length; ++j) { for (int j = i + 1; j < stacks.length; ++j) {
if (CompareUtils.compareStack(stacks[i], stacks[j])) { if (RSAPI.instance().getComparer().isEqual(stacks[i], stacks[j])) {
amount += stacks[j].stackSize; amount += stacks[j].stackSize;
combinedIndices.add(j); combinedIndices.add(j);

View File

@@ -148,56 +148,56 @@ public class ClientProxy extends CommonProxy {
// Item Variants // Item Variants
ModelBakery.registerItemVariants(RSItems.STORAGE_DISK, ModelBakery.registerItemVariants(RSItems.STORAGE_DISK,
new ResourceLocation("refinedstorage:1k_storage_disk"), new ResourceLocation("refinedstorage:1k_storage_disk"),
new ResourceLocation("refinedstorage:4k_storage_disk"), new ResourceLocation("refinedstorage:4k_storage_disk"),
new ResourceLocation("refinedstorage:16k_storage_disk"), new ResourceLocation("refinedstorage:16k_storage_disk"),
new ResourceLocation("refinedstorage:64k_storage_disk"), new ResourceLocation("refinedstorage:64k_storage_disk"),
new ResourceLocation("refinedstorage:creative_storage_disk") new ResourceLocation("refinedstorage:creative_storage_disk")
); );
ModelBakery.registerItemVariants(RSItems.STORAGE_PART, ModelBakery.registerItemVariants(RSItems.STORAGE_PART,
new ResourceLocation("refinedstorage:1k_storage_part"), new ResourceLocation("refinedstorage:1k_storage_part"),
new ResourceLocation("refinedstorage:4k_storage_part"), new ResourceLocation("refinedstorage:4k_storage_part"),
new ResourceLocation("refinedstorage:16k_storage_part"), new ResourceLocation("refinedstorage:16k_storage_part"),
new ResourceLocation("refinedstorage:64k_storage_part") new ResourceLocation("refinedstorage:64k_storage_part")
); );
ModelBakery.registerItemVariants(RSItems.FLUID_STORAGE_DISK, ModelBakery.registerItemVariants(RSItems.FLUID_STORAGE_DISK,
new ResourceLocation("refinedstorage:64k_fluid_storage_disk"), new ResourceLocation("refinedstorage:64k_fluid_storage_disk"),
new ResourceLocation("refinedstorage:128k_fluid_storage_disk"), new ResourceLocation("refinedstorage:128k_fluid_storage_disk"),
new ResourceLocation("refinedstorage:256k_fluid_storage_disk"), new ResourceLocation("refinedstorage:256k_fluid_storage_disk"),
new ResourceLocation("refinedstorage:512k_fluid_storage_disk"), new ResourceLocation("refinedstorage:512k_fluid_storage_disk"),
new ResourceLocation("refinedstorage:creative_fluid_storage_disk") new ResourceLocation("refinedstorage:creative_fluid_storage_disk")
); );
ModelBakery.registerItemVariants(RSItems.FLUID_STORAGE_PART, ModelBakery.registerItemVariants(RSItems.FLUID_STORAGE_PART,
new ResourceLocation("refinedstorage:64k_fluid_storage_part"), new ResourceLocation("refinedstorage:64k_fluid_storage_part"),
new ResourceLocation("refinedstorage:128k_fluid_storage_part"), new ResourceLocation("refinedstorage:128k_fluid_storage_part"),
new ResourceLocation("refinedstorage:256k_fluid_storage_part"), new ResourceLocation("refinedstorage:256k_fluid_storage_part"),
new ResourceLocation("refinedstorage:512k_fluid_storage_part") new ResourceLocation("refinedstorage:512k_fluid_storage_part")
); );
ModelBakery.registerItemVariants(RSItems.PROCESSOR, ModelBakery.registerItemVariants(RSItems.PROCESSOR,
new ResourceLocation("refinedstorage:basic_printed_processor"), new ResourceLocation("refinedstorage:basic_printed_processor"),
new ResourceLocation("refinedstorage:improved_printed_processor"), new ResourceLocation("refinedstorage:improved_printed_processor"),
new ResourceLocation("refinedstorage:advanced_printed_processor"), new ResourceLocation("refinedstorage:advanced_printed_processor"),
new ResourceLocation("refinedstorage:basic_processor"), new ResourceLocation("refinedstorage:basic_processor"),
new ResourceLocation("refinedstorage:improved_processor"), new ResourceLocation("refinedstorage:improved_processor"),
new ResourceLocation("refinedstorage:advanced_processor"), new ResourceLocation("refinedstorage:advanced_processor"),
new ResourceLocation("refinedstorage:printed_silicon") new ResourceLocation("refinedstorage:printed_silicon")
); );
ModelBakery.registerItemVariants(RSItems.CORE, ModelBakery.registerItemVariants(RSItems.CORE,
new ResourceLocation("refinedstorage:construction_core"), new ResourceLocation("refinedstorage:construction_core"),
new ResourceLocation("refinedstorage:destruction_core") new ResourceLocation("refinedstorage:destruction_core")
); );
ModelBakery.registerItemVariants(RSItems.UPGRADE, ModelBakery.registerItemVariants(RSItems.UPGRADE,
new ResourceLocation("refinedstorage:upgrade"), new ResourceLocation("refinedstorage:upgrade"),
new ResourceLocation("refinedstorage:range_upgrade"), new ResourceLocation("refinedstorage:range_upgrade"),
new ResourceLocation("refinedstorage:speed_upgrade"), new ResourceLocation("refinedstorage:speed_upgrade"),
new ResourceLocation("refinedstorage:stack_upgrade"), new ResourceLocation("refinedstorage:stack_upgrade"),
new ResourceLocation("refinedstorage:interdimensional_upgrade") new ResourceLocation("refinedstorage:interdimensional_upgrade")
); );
// Items // Items

View File

@@ -162,315 +162,315 @@ public class CommonProxy {
// Quartz Enriched Iron // Quartz Enriched Iron
GameRegistry.addRecipe(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON, 4), GameRegistry.addRecipe(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON, 4),
"II", "II",
"IQ", "IQ",
'I', new ItemStack(Items.IRON_INGOT), 'I', new ItemStack(Items.IRON_INGOT),
'Q', new ItemStack(Items.QUARTZ) 'Q', new ItemStack(Items.QUARTZ)
); );
// Machine Casing // Machine Casing
GameRegistry.addRecipe(new ItemStack(RSBlocks.MACHINE_CASING), GameRegistry.addRecipe(new ItemStack(RSBlocks.MACHINE_CASING),
"EEE", "EEE",
"E E", "E E",
"EEE", "EEE",
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON) 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)
); );
// Construction Core // Construction Core
GameRegistry.addShapelessRecipe(new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION), GameRegistry.addShapelessRecipe(new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC), new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
new ItemStack(Items.GLOWSTONE_DUST) new ItemStack(Items.GLOWSTONE_DUST)
); );
// Destruction Core // Destruction Core
GameRegistry.addShapelessRecipe(new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION), GameRegistry.addShapelessRecipe(new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC), new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
new ItemStack(Items.QUARTZ) new ItemStack(Items.QUARTZ)
); );
// Relay // Relay
GameRegistry.addShapelessRecipe(new ItemStack(RSBlocks.RELAY), GameRegistry.addShapelessRecipe(new ItemStack(RSBlocks.RELAY),
new ItemStack(RSBlocks.MACHINE_CASING), new ItemStack(RSBlocks.MACHINE_CASING),
new ItemStack(RSBlocks.CABLE), new ItemStack(RSBlocks.CABLE),
new ItemStack(Blocks.REDSTONE_TORCH) new ItemStack(Blocks.REDSTONE_TORCH)
); );
// Controller // Controller
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSBlocks.CONTROLLER, 1, EnumControllerType.NORMAL.getId()), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSBlocks.CONTROLLER, 1, EnumControllerType.NORMAL.getId()),
"EDE", "EDE",
"SMS", "SMS",
"ESE", "ESE",
'D', new ItemStack(Items.DIAMOND), 'D', new ItemStack(Items.DIAMOND),
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'M', new ItemStack(RSBlocks.MACHINE_CASING), 'M', new ItemStack(RSBlocks.MACHINE_CASING),
'S', "itemSilicon" 'S', "itemSilicon"
)); ));
// Solderer // Solderer
GameRegistry.addRecipe(new ItemStack(RSBlocks.SOLDERER), GameRegistry.addRecipe(new ItemStack(RSBlocks.SOLDERER),
"ESE", "ESE",
"E E", "E E",
"ESE", "ESE",
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'S', new ItemStack(Blocks.STICKY_PISTON) 'S', new ItemStack(Blocks.STICKY_PISTON)
); );
// Disk Drive // Disk Drive
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe( RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
new ItemStack(RSBlocks.DISK_DRIVE), new ItemStack(RSBlocks.DISK_DRIVE),
500, 500,
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED), new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
new ItemStack(RSBlocks.MACHINE_CASING), new ItemStack(RSBlocks.MACHINE_CASING),
new ItemStack(Blocks.CHEST) new ItemStack(Blocks.CHEST)
)); ));
// Cable // Cable
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSBlocks.CABLE, 12), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSBlocks.CABLE, 12),
"EEE", "EEE",
"GRG", "GRG",
"EEE", "EEE",
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'G', "blockGlass", 'G', "blockGlass",
'R', new ItemStack(Items.REDSTONE) 'R', new ItemStack(Items.REDSTONE)
)); ));
// Wireless Transmitter // Wireless Transmitter
GameRegistry.addRecipe(new ItemStack(RSBlocks.WIRELESS_TRANSMITTER), GameRegistry.addRecipe(new ItemStack(RSBlocks.WIRELESS_TRANSMITTER),
"EPE", "EPE",
"EME", "EME",
"EAE", "EAE",
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'A', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED), 'A', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
'P', new ItemStack(Items.ENDER_PEARL), 'P', new ItemStack(Items.ENDER_PEARL),
'M', new ItemStack(RSBlocks.MACHINE_CASING) 'M', new ItemStack(RSBlocks.MACHINE_CASING)
); );
// Grid // Grid
GameRegistry.addRecipe(new ItemStack(RSBlocks.GRID, 1, EnumGridType.NORMAL.getId()), GameRegistry.addRecipe(new ItemStack(RSBlocks.GRID, 1, EnumGridType.NORMAL.getId()),
"ECE", "ECE",
"PMP", "PMP",
"EDE", "EDE",
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED), 'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED),
'C', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION), 'C', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
'D', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION), 'D', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
'M', new ItemStack(RSBlocks.MACHINE_CASING) 'M', new ItemStack(RSBlocks.MACHINE_CASING)
); );
// Crafting Grid // Crafting Grid
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe( RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
new ItemStack(RSBlocks.GRID, 1, EnumGridType.CRAFTING.getId()), new ItemStack(RSBlocks.GRID, 1, EnumGridType.CRAFTING.getId()),
500, 500,
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED), new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
new ItemStack(RSBlocks.GRID, 1, EnumGridType.NORMAL.getId()), new ItemStack(RSBlocks.GRID, 1, EnumGridType.NORMAL.getId()),
new ItemStack(Blocks.CRAFTING_TABLE) new ItemStack(Blocks.CRAFTING_TABLE)
)); ));
// Pattern Grid // Pattern Grid
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe( RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
new ItemStack(RSBlocks.GRID, 1, EnumGridType.PATTERN.getId()), new ItemStack(RSBlocks.GRID, 1, EnumGridType.PATTERN.getId()),
500, 500,
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED), new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
new ItemStack(RSBlocks.GRID, 1, EnumGridType.NORMAL.getId()), new ItemStack(RSBlocks.GRID, 1, EnumGridType.NORMAL.getId()),
new ItemStack(RSItems.PATTERN) new ItemStack(RSItems.PATTERN)
)); ));
// Fluid Grid // Fluid Grid
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe( RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
new ItemStack(RSBlocks.GRID, 1, EnumGridType.FLUID.getId()), new ItemStack(RSBlocks.GRID, 1, EnumGridType.FLUID.getId()),
500, 500,
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED), new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
new ItemStack(RSBlocks.GRID, 1, EnumGridType.NORMAL.getId()), new ItemStack(RSBlocks.GRID, 1, EnumGridType.NORMAL.getId()),
new ItemStack(Items.BUCKET) new ItemStack(Items.BUCKET)
)); ));
// Wireless Grid // Wireless Grid
GameRegistry.addRecipe(new ItemStack(RSItems.WIRELESS_GRID, 1, ItemWirelessGrid.TYPE_NORMAL), GameRegistry.addRecipe(new ItemStack(RSItems.WIRELESS_GRID, 1, ItemWirelessGrid.TYPE_NORMAL),
"EPE", "EPE",
"EAE", "EAE",
"EEE", "EEE",
'P', new ItemStack(Items.ENDER_PEARL), 'P', new ItemStack(Items.ENDER_PEARL),
'A', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED), 'A', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON) 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)
); );
// Crafter // Crafter
GameRegistry.addRecipe(new ItemStack(RSBlocks.CRAFTER), GameRegistry.addRecipe(new ItemStack(RSBlocks.CRAFTER),
"ECE", "ECE",
"AMA", "AMA",
"EDE", "EDE",
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'A', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED), 'A', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
'C', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION), 'C', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
'D', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION), 'D', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
'M', new ItemStack(RSBlocks.MACHINE_CASING) 'M', new ItemStack(RSBlocks.MACHINE_CASING)
); );
// Processing Pattern Encoder // Processing Pattern Encoder
GameRegistry.addRecipe(new ItemStack(RSBlocks.PROCESSING_PATTERN_ENCODER), GameRegistry.addRecipe(new ItemStack(RSBlocks.PROCESSING_PATTERN_ENCODER),
"ECE", "ECE",
"PMP", "PMP",
"EFE", "EFE",
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'M', new ItemStack(RSBlocks.MACHINE_CASING), 'M', new ItemStack(RSBlocks.MACHINE_CASING),
'P', new ItemStack(RSItems.PATTERN), 'P', new ItemStack(RSItems.PATTERN),
'C', new ItemStack(Blocks.CRAFTING_TABLE), 'C', new ItemStack(Blocks.CRAFTING_TABLE),
'F', new ItemStack(Blocks.FURNACE) 'F', new ItemStack(Blocks.FURNACE)
); );
// External Storage // External Storage
GameRegistry.addRecipe(new ItemStack(RSBlocks.EXTERNAL_STORAGE), GameRegistry.addRecipe(new ItemStack(RSBlocks.EXTERNAL_STORAGE),
"CED", "CED",
"HMH", "HMH",
"EPE", "EPE",
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'H', new ItemStack(Blocks.CHEST), 'H', new ItemStack(Blocks.CHEST),
'C', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION), 'C', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
'D', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION), 'D', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
'M', new ItemStack(RSBlocks.CABLE), 'M', new ItemStack(RSBlocks.CABLE),
'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED) 'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
); );
// Importer // Importer
GameRegistry.addShapelessRecipe(new ItemStack(RSBlocks.IMPORTER), GameRegistry.addShapelessRecipe(new ItemStack(RSBlocks.IMPORTER),
new ItemStack(RSBlocks.CABLE), new ItemStack(RSBlocks.CABLE),
new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION), new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED) new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
); );
// Exporter // Exporter
GameRegistry.addShapelessRecipe(new ItemStack(RSBlocks.EXPORTER), GameRegistry.addShapelessRecipe(new ItemStack(RSBlocks.EXPORTER),
new ItemStack(RSBlocks.CABLE), new ItemStack(RSBlocks.CABLE),
new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION), new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED) new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
); );
// Destructor // Destructor
GameRegistry.addShapedRecipe(new ItemStack(RSBlocks.DESTRUCTOR), GameRegistry.addShapedRecipe(new ItemStack(RSBlocks.DESTRUCTOR),
"EDE", "EDE",
"RMR", "RMR",
"EIE", "EIE",
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'D', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION), 'D', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
'R', new ItemStack(Items.REDSTONE), 'R', new ItemStack(Items.REDSTONE),
'M', new ItemStack(RSBlocks.CABLE), 'M', new ItemStack(RSBlocks.CABLE),
'I', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED) 'I', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
); );
// Constructor // Constructor
GameRegistry.addShapedRecipe(new ItemStack(RSBlocks.CONSTRUCTOR), GameRegistry.addShapedRecipe(new ItemStack(RSBlocks.CONSTRUCTOR),
"ECE", "ECE",
"RMR", "RMR",
"EIE", "EIE",
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'C', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION), 'C', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
'R', new ItemStack(Items.REDSTONE), 'R', new ItemStack(Items.REDSTONE),
'M', new ItemStack(RSBlocks.CABLE), 'M', new ItemStack(RSBlocks.CABLE),
'I', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED) 'I', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
); );
// Detector // Detector
GameRegistry.addRecipe(new ItemStack(RSBlocks.DETECTOR), GameRegistry.addRecipe(new ItemStack(RSBlocks.DETECTOR),
"ECE", "ECE",
"RMR", "RMR",
"EPE", "EPE",
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'R', new ItemStack(Items.REDSTONE), 'R', new ItemStack(Items.REDSTONE),
'C', new ItemStack(Items.COMPARATOR), 'C', new ItemStack(Items.COMPARATOR),
'M', new ItemStack(RSBlocks.MACHINE_CASING), 'M', new ItemStack(RSBlocks.MACHINE_CASING),
'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED) 'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
); );
// Storage Parts // Storage Parts
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSItems.STORAGE_PART, 1, ItemStoragePart.TYPE_1K), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSItems.STORAGE_PART, 1, ItemStoragePart.TYPE_1K),
"SES", "SES",
"GRG", "GRG",
"SGS", "SGS",
'R', new ItemStack(Items.REDSTONE), 'R', new ItemStack(Items.REDSTONE),
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'S', "itemSilicon", 'S', "itemSilicon",
'G', "blockGlass" 'G', "blockGlass"
)); ));
GameRegistry.addRecipe(new ItemStack(RSItems.STORAGE_PART, 1, ItemStoragePart.TYPE_4K), GameRegistry.addRecipe(new ItemStack(RSItems.STORAGE_PART, 1, ItemStoragePart.TYPE_4K),
"PEP", "PEP",
"SRS", "SRS",
"PSP", "PSP",
'R', new ItemStack(Items.REDSTONE), 'R', new ItemStack(Items.REDSTONE),
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC), 'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
'S', new ItemStack(RSItems.STORAGE_PART, 1, ItemStoragePart.TYPE_1K) 'S', new ItemStack(RSItems.STORAGE_PART, 1, ItemStoragePart.TYPE_1K)
); );
GameRegistry.addRecipe(new ItemStack(RSItems.STORAGE_PART, 1, ItemStoragePart.TYPE_16K), GameRegistry.addRecipe(new ItemStack(RSItems.STORAGE_PART, 1, ItemStoragePart.TYPE_16K),
"PEP", "PEP",
"SRS", "SRS",
"PSP", "PSP",
'R', new ItemStack(Items.REDSTONE), 'R', new ItemStack(Items.REDSTONE),
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED), 'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED),
'S', new ItemStack(RSItems.STORAGE_PART, 1, ItemStoragePart.TYPE_4K) 'S', new ItemStack(RSItems.STORAGE_PART, 1, ItemStoragePart.TYPE_4K)
); );
GameRegistry.addRecipe(new ItemStack(RSItems.STORAGE_PART, 1, ItemStoragePart.TYPE_64K), GameRegistry.addRecipe(new ItemStack(RSItems.STORAGE_PART, 1, ItemStoragePart.TYPE_64K),
"PEP", "PEP",
"SRS", "SRS",
"PSP", "PSP",
'R', new ItemStack(Items.REDSTONE), 'R', new ItemStack(Items.REDSTONE),
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED), 'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
'S', new ItemStack(RSItems.STORAGE_PART, 1, ItemStoragePart.TYPE_16K) 'S', new ItemStack(RSItems.STORAGE_PART, 1, ItemStoragePart.TYPE_16K)
); );
// Fluid Storage Parts // Fluid Storage Parts
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_64K), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_64K),
"SES", "SES",
"GRG", "GRG",
"SGS", "SGS",
'R', new ItemStack(Items.BUCKET), 'R', new ItemStack(Items.BUCKET),
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'S', "itemSilicon", 'S', "itemSilicon",
'G', "blockGlass" 'G', "blockGlass"
)); ));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_128K), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_128K),
"PEP", "PEP",
"SRS", "SRS",
"PSP", "PSP",
'R', new ItemStack(Items.BUCKET), 'R', new ItemStack(Items.BUCKET),
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC), 'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
'S', new ItemStack(RSItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_64K) 'S', new ItemStack(RSItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_64K)
)); ));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_256K), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_256K),
"PEP", "PEP",
"SRS", "SRS",
"PSP", "PSP",
'R', new ItemStack(Items.BUCKET), 'R', new ItemStack(Items.BUCKET),
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED), 'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED),
'S', new ItemStack(RSItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_128K) 'S', new ItemStack(RSItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_128K)
)); ));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_512K), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_512K),
"PEP", "PEP",
"SRS", "SRS",
"PSP", "PSP",
'R', new ItemStack(Items.BUCKET), 'R', new ItemStack(Items.BUCKET),
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED), 'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
'S', new ItemStack(RSItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_256K) 'S', new ItemStack(RSItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_256K)
)); ));
// Storage Housing // Storage Housing
GameRegistry.addRecipe(new ShapedOreRecipe(ItemStorageNBT.createStackWithNBT(new ItemStack(RSItems.STORAGE_HOUSING)), GameRegistry.addRecipe(new ShapedOreRecipe(ItemStorageNBT.createStackWithNBT(new ItemStack(RSItems.STORAGE_HOUSING)),
"GRG", "GRG",
"R R", "R R",
"EEE", "EEE",
'G', "blockGlass", 'G', "blockGlass",
'R', new ItemStack(Items.REDSTONE), 'R', new ItemStack(Items.REDSTONE),
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON) 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)
)); ));
// Storage Disks // Storage Disks
@@ -478,18 +478,18 @@ public class CommonProxy {
ItemStack disk = ItemStorageNBT.createStackWithNBT(new ItemStack(RSItems.STORAGE_DISK, 1, type)); ItemStack disk = ItemStorageNBT.createStackWithNBT(new ItemStack(RSItems.STORAGE_DISK, 1, type));
GameRegistry.addRecipe(new ShapedOreRecipe(disk, GameRegistry.addRecipe(new ShapedOreRecipe(disk,
"GRG", "GRG",
"RPR", "RPR",
"EEE", "EEE",
'G', "blockGlass", 'G', "blockGlass",
'R', new ItemStack(Items.REDSTONE), 'R', new ItemStack(Items.REDSTONE),
'P', new ItemStack(RSItems.STORAGE_PART, 1, type), 'P', new ItemStack(RSItems.STORAGE_PART, 1, type),
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON) 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)
)); ));
GameRegistry.addShapelessRecipe(disk, GameRegistry.addShapelessRecipe(disk,
new ItemStack(RSItems.STORAGE_HOUSING), new ItemStack(RSItems.STORAGE_HOUSING),
new ItemStack(RSItems.STORAGE_PART, 1, type) new ItemStack(RSItems.STORAGE_PART, 1, type)
); );
} }
@@ -498,39 +498,39 @@ public class CommonProxy {
ItemStack disk = FluidStorageNBT.createStackWithNBT(new ItemStack(RSItems.FLUID_STORAGE_DISK, 1, type)); ItemStack disk = FluidStorageNBT.createStackWithNBT(new ItemStack(RSItems.FLUID_STORAGE_DISK, 1, type));
GameRegistry.addRecipe(new ShapedOreRecipe(disk, GameRegistry.addRecipe(new ShapedOreRecipe(disk,
"GRG", "GRG",
"RPR", "RPR",
"EEE", "EEE",
'G', "blockGlass", 'G', "blockGlass",
'R', new ItemStack(Items.REDSTONE), 'R', new ItemStack(Items.REDSTONE),
'P', new ItemStack(RSItems.FLUID_STORAGE_PART, 1, type), 'P', new ItemStack(RSItems.FLUID_STORAGE_PART, 1, type),
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON) 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)
)); ));
GameRegistry.addShapelessRecipe(disk, GameRegistry.addShapelessRecipe(disk,
new ItemStack(RSItems.STORAGE_HOUSING), new ItemStack(RSItems.STORAGE_HOUSING),
new ItemStack(RSItems.FLUID_STORAGE_PART, 1, type) new ItemStack(RSItems.FLUID_STORAGE_PART, 1, type)
); );
} }
// Pattern // Pattern
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSItems.PATTERN), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSItems.PATTERN),
"GRG", "GRG",
"RGR", "RGR",
"EEE", "EEE",
'G', "blockGlass", 'G', "blockGlass",
'R', new ItemStack(Items.REDSTONE), 'R', new ItemStack(Items.REDSTONE),
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON) 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)
)); ));
// Upgrade // Upgrade
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSItems.UPGRADE, 1, 0), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSItems.UPGRADE, 1, 0),
"EGE", "EGE",
"EPE", "EPE",
"EGE", "EGE",
'G', "blockGlass", 'G', "blockGlass",
'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED), 'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED),
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON) 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)
)); ));
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_RANGE)); RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_RANGE));
@@ -539,11 +539,11 @@ public class CommonProxy {
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_CRAFTING)); RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_CRAFTING));
GameRegistry.addShapedRecipe(new ItemStack(RSItems.UPGRADE, 1, ItemUpgrade.TYPE_STACK), GameRegistry.addShapedRecipe(new ItemStack(RSItems.UPGRADE, 1, ItemUpgrade.TYPE_STACK),
"USU", "USU",
"SUS", "SUS",
"USU", "USU",
'U', new ItemStack(Items.SUGAR), 'U', new ItemStack(Items.SUGAR),
'S', new ItemStack(RSItems.UPGRADE, 1, ItemUpgrade.TYPE_SPEED) 'S', new ItemStack(RSItems.UPGRADE, 1, ItemUpgrade.TYPE_SPEED)
); );
// Storage Blocks // Storage Blocks
@@ -560,87 +560,87 @@ public class CommonProxy {
// Crafting Monitor // Crafting Monitor
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSBlocks.CRAFTING_MONITOR), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSBlocks.CRAFTING_MONITOR),
"EGE", "EGE",
"GMG", "GMG",
"EPE", "EPE",
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'M', new ItemStack(RSBlocks.MACHINE_CASING), 'M', new ItemStack(RSBlocks.MACHINE_CASING),
'G', "blockGlass", 'G', "blockGlass",
'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED) 'P', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
)); ));
// Interface // Interface
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe( RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
new ItemStack(RSBlocks.INTERFACE), new ItemStack(RSBlocks.INTERFACE),
200, 200,
new ItemStack(RSBlocks.IMPORTER), new ItemStack(RSBlocks.IMPORTER),
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC), new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
new ItemStack(RSBlocks.EXPORTER) new ItemStack(RSBlocks.EXPORTER)
)); ));
// Fluid Interface // Fluid Interface
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe( RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
new ItemStack(RSBlocks.FLUID_INTERFACE), new ItemStack(RSBlocks.FLUID_INTERFACE),
200, 200,
new ItemStack(Items.BUCKET), new ItemStack(Items.BUCKET),
new ItemStack(RSBlocks.INTERFACE), new ItemStack(RSBlocks.INTERFACE),
new ItemStack(Items.BUCKET) new ItemStack(Items.BUCKET)
)); ));
// Grid Filter // Grid Filter
GameRegistry.addShapedRecipe(new ItemStack(RSItems.GRID_FILTER), GameRegistry.addShapedRecipe(new ItemStack(RSItems.GRID_FILTER),
"EPE", "EPE",
"PHP", "PHP",
"EPE", "EPE",
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'P', new ItemStack(Items.PAPER), 'P', new ItemStack(Items.PAPER),
'H', new ItemStack(Blocks.HOPPER) 'H', new ItemStack(Blocks.HOPPER)
); );
// Network Card // Network Card
GameRegistry.addShapedRecipe(new ItemStack(RSItems.NETWORK_CARD), GameRegistry.addShapedRecipe(new ItemStack(RSItems.NETWORK_CARD),
"EEE", "EEE",
"PAP", "PAP",
"EEE", "EEE",
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'P', new ItemStack(Items.PAPER), 'P', new ItemStack(Items.PAPER),
'A', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED) 'A', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED)
); );
// Network Transmitter // Network Transmitter
GameRegistry.addShapedRecipe(new ItemStack(RSBlocks.NETWORK_TRANSMITTER), GameRegistry.addShapedRecipe(new ItemStack(RSBlocks.NETWORK_TRANSMITTER),
"EEE", "EEE",
"CMD", "CMD",
"AAA", "AAA",
'E', new ItemStack(Items.ENDER_PEARL), 'E', new ItemStack(Items.ENDER_PEARL),
'C', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION), 'C', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
'M', new ItemStack(RSBlocks.MACHINE_CASING), 'M', new ItemStack(RSBlocks.MACHINE_CASING),
'D', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION), 'D', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
'A', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED) 'A', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED)
); );
// Network Receiver // Network Receiver
GameRegistry.addShapedRecipe(new ItemStack(RSBlocks.NETWORK_RECEIVER), GameRegistry.addShapedRecipe(new ItemStack(RSBlocks.NETWORK_RECEIVER),
"AAA", "AAA",
"CMD", "CMD",
"EEE", "EEE",
'E', new ItemStack(Items.ENDER_PEARL), 'E', new ItemStack(Items.ENDER_PEARL),
'C', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION), 'C', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
'M', new ItemStack(RSBlocks.MACHINE_CASING), 'M', new ItemStack(RSBlocks.MACHINE_CASING),
'D', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION), 'D', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
'A', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED) 'A', new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED)
); );
// Disk Manipulator // Disk Manipulator
GameRegistry.addShapedRecipe(new ItemStack(RSBlocks.DISK_MANIPULATOR), GameRegistry.addShapedRecipe(new ItemStack(RSBlocks.DISK_MANIPULATOR),
"ESE", "ESE",
"CMD", "CMD",
"ESE", "ESE",
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON), 'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON),
'S', new ItemStack(RSItems.STORAGE_HOUSING), 'S', new ItemStack(RSItems.STORAGE_HOUSING),
'C', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION), 'C', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
'M', new ItemStack(RSBlocks.MACHINE_CASING), 'M', new ItemStack(RSBlocks.MACHINE_CASING),
'D', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION) 'D', new ItemStack(RSItems.CORE, 1, ItemCore.TYPE_DESTRUCTION)
); );
} }

View File

@@ -1,7 +1,7 @@
package refinedstorage.tile; package refinedstorage.tile;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.RSAPI;
public class ClientNode { public class ClientNode {
private ItemStack stack; private ItemStack stack;
@@ -40,7 +40,7 @@ public class ClientNode {
return false; return false;
} }
return energyUsage == ((ClientNode) other).energyUsage && CompareUtils.compareStack(stack, ((ClientNode) other).stack); return energyUsage == ((ClientNode) other).energyUsage && RSAPI.instance().getComparer().isEqual(stack, ((ClientNode) other).stack);
} }
@Override @Override

View File

@@ -17,7 +17,7 @@ import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.api.network.NetworkUtils; import refinedstorage.api.network.NetworkUtils;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.container.slot.SlotSpecimen; import refinedstorage.container.slot.SlotSpecimen;
import refinedstorage.inventory.ItemHandlerBasic; import refinedstorage.inventory.ItemHandlerBasic;
import refinedstorage.inventory.ItemHandlerFluid; import refinedstorage.inventory.ItemHandlerFluid;
@@ -49,7 +49,7 @@ public class TileConstructor extends TileMultipartNode implements IComparable, I
private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, this, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_CRAFTING); private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, this, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_CRAFTING);
private int compare = CompareUtils.COMPARE_NBT | CompareUtils.COMPARE_DAMAGE; private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
private int type = IType.ITEMS; private int type = IType.ITEMS;
private IBlockState block; private IBlockState block;

View File

@@ -20,6 +20,7 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemHandlerHelper;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.RSBlocks; import refinedstorage.RSBlocks;
import refinedstorage.api.RSAPI;
import refinedstorage.api.autocrafting.ICraftingPattern; import refinedstorage.api.autocrafting.ICraftingPattern;
import refinedstorage.api.autocrafting.ICraftingPatternContainer; import refinedstorage.api.autocrafting.ICraftingPatternContainer;
import refinedstorage.api.autocrafting.task.ICraftingTask; import refinedstorage.api.autocrafting.task.ICraftingTask;
@@ -27,11 +28,11 @@ import refinedstorage.api.autocrafting.task.IProcessable;
import refinedstorage.api.network.*; import refinedstorage.api.network.*;
import refinedstorage.api.network.grid.IFluidGridHandler; import refinedstorage.api.network.grid.IFluidGridHandler;
import refinedstorage.api.network.grid.IItemGridHandler; import refinedstorage.api.network.grid.IItemGridHandler;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.api.storage.fluid.IFluidStorage; import refinedstorage.api.storage.fluid.IFluidStorage;
import refinedstorage.api.storage.fluid.IGroupedFluidStorage; import refinedstorage.api.storage.fluid.IGroupedFluidStorage;
import refinedstorage.api.storage.item.IGroupedItemStorage; import refinedstorage.api.storage.item.IGroupedItemStorage;
import refinedstorage.api.storage.item.IItemStorage; import refinedstorage.api.storage.item.IItemStorage;
import refinedstorage.api.util.IComparer;
import refinedstorage.apiimpl.network.NetworkNodeGraph; import refinedstorage.apiimpl.network.NetworkNodeGraph;
import refinedstorage.apiimpl.network.WirelessGridHandler; import refinedstorage.apiimpl.network.WirelessGridHandler;
import refinedstorage.apiimpl.network.grid.FluidGridHandler; import refinedstorage.apiimpl.network.grid.FluidGridHandler;
@@ -101,9 +102,9 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
IBlockState state = tile.worldObj.getBlockState(node.getPosition()); IBlockState state = tile.worldObj.getBlockState(node.getPosition());
ClientNode clientNode = new ClientNode( ClientNode clientNode = new ClientNode(
new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state)), new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state)),
1, 1,
node.getEnergyUsage() node.getEnergyUsage()
); );
if (clientNode.getStack().getItem() != null) { if (clientNode.getStack().getItem() != null) {
@@ -401,7 +402,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
for (ICraftingPattern craftingPattern : getPatterns()) { for (ICraftingPattern craftingPattern : getPatterns()) {
for (ItemStack output : craftingPattern.getOutputs()) { for (ItemStack output : craftingPattern.getOutputs()) {
if (CompareUtils.compareStack(output, pattern, flags)) { if (RSAPI.instance().getComparer().isEqual(output, pattern, flags)) {
patterns.add(craftingPattern); patterns.add(craftingPattern);
} }
} }
@@ -427,7 +428,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
int score = 0; int score = 0;
for (ItemStack input : patterns.get(i).getInputs()) { for (ItemStack input : patterns.get(i).getInputs()) {
ItemStack stored = itemStorage.getList().get(input, CompareUtils.COMPARE_DAMAGE | CompareUtils.COMPARE_NBT); ItemStack stored = itemStorage.getList().get(input, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT);
score += stored != null ? stored.stackSize : 0; score += stored != null ? stored.stackSize : 0;
} }
@@ -457,8 +458,8 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
@Override @Override
public void sendItemStorageToClient() { public void sendItemStorageToClient() {
worldObj.getMinecraftServer().getPlayerList().getPlayerList().stream() worldObj.getMinecraftServer().getPlayerList().getPlayerList().stream()
.filter(player -> isWatchingGrid(player, EnumGridType.NORMAL, EnumGridType.CRAFTING, EnumGridType.PATTERN)) .filter(player -> isWatchingGrid(player, EnumGridType.NORMAL, EnumGridType.CRAFTING, EnumGridType.PATTERN))
.forEach(this::sendItemStorageToClient); .forEach(this::sendItemStorageToClient);
} }
@Override @Override
@@ -469,15 +470,15 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
@Override @Override
public void sendItemStorageDeltaToClient(ItemStack stack, int delta) { public void sendItemStorageDeltaToClient(ItemStack stack, int delta) {
worldObj.getMinecraftServer().getPlayerList().getPlayerList().stream() worldObj.getMinecraftServer().getPlayerList().getPlayerList().stream()
.filter(player -> isWatchingGrid(player, EnumGridType.NORMAL, EnumGridType.CRAFTING, EnumGridType.PATTERN)) .filter(player -> isWatchingGrid(player, EnumGridType.NORMAL, EnumGridType.CRAFTING, EnumGridType.PATTERN))
.forEach(player -> RS.INSTANCE.network.sendTo(new MessageGridItemDelta(this, stack, delta), player)); .forEach(player -> RS.INSTANCE.network.sendTo(new MessageGridItemDelta(this, stack, delta), player));
} }
@Override @Override
public void sendFluidStorageToClient() { public void sendFluidStorageToClient() {
worldObj.getMinecraftServer().getPlayerList().getPlayerList().stream() worldObj.getMinecraftServer().getPlayerList().getPlayerList().stream()
.filter(player -> isWatchingGrid(player, EnumGridType.FLUID)) .filter(player -> isWatchingGrid(player, EnumGridType.FLUID))
.forEach(this::sendFluidStorageToClient); .forEach(this::sendFluidStorageToClient);
} }
@Override @Override
@@ -488,8 +489,8 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
@Override @Override
public void sendFluidStorageDeltaToClient(FluidStack stack, int delta) { public void sendFluidStorageDeltaToClient(FluidStack stack, int delta) {
worldObj.getMinecraftServer().getPlayerList().getPlayerList().stream() worldObj.getMinecraftServer().getPlayerList().getPlayerList().stream()
.filter(player -> isWatchingGrid(player, EnumGridType.FLUID)) .filter(player -> isWatchingGrid(player, EnumGridType.FLUID))
.forEach(player -> RS.INSTANCE.network.sendTo(new MessageGridFluidDelta(stack, delta), player)); .forEach(player -> RS.INSTANCE.network.sendTo(new MessageGridFluidDelta(stack, delta), player));
} }
private boolean isWatchingGrid(EntityPlayer player, EnumGridType... types) { private boolean isWatchingGrid(EntityPlayer player, EnumGridType... types) {
@@ -798,7 +799,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
@Override @Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) { public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
return capability == CapabilityEnergy.ENERGY return capability == CapabilityEnergy.ENERGY
|| (energyTesla != null && (capability == TeslaCapabilities.CAPABILITY_HOLDER || capability == TeslaCapabilities.CAPABILITY_CONSUMER)) || (energyTesla != null && (capability == TeslaCapabilities.CAPABILITY_HOLDER || capability == TeslaCapabilities.CAPABILITY_CONSUMER))
|| super.hasCapability(capability, facing); || super.hasCapability(capability, facing);
} }
} }

View File

@@ -14,7 +14,7 @@ import refinedstorage.api.autocrafting.ICraftingPatternContainer;
import refinedstorage.api.autocrafting.ICraftingPatternProvider; import refinedstorage.api.autocrafting.ICraftingPatternProvider;
import refinedstorage.api.network.INetworkMaster; import refinedstorage.api.network.INetworkMaster;
import refinedstorage.api.network.NetworkUtils; import refinedstorage.api.network.NetworkUtils;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.inventory.ItemHandlerBasic; import refinedstorage.inventory.ItemHandlerBasic;
import refinedstorage.inventory.ItemHandlerUpgrade; import refinedstorage.inventory.ItemHandlerUpgrade;
import refinedstorage.item.ItemUpgrade; import refinedstorage.item.ItemUpgrade;
@@ -110,7 +110,7 @@ public class TileCrafter extends TileNode implements ICraftingPatternContainer {
if (triggeredAutocrafting && worldObj.isBlockPowered(pos)) { if (triggeredAutocrafting && worldObj.isBlockPowered(pos)) {
for (ICraftingPattern pattern : actualPatterns) { for (ICraftingPattern pattern : actualPatterns) {
for (ItemStack output : pattern.getOutputs()) { for (ItemStack output : pattern.getOutputs()) {
NetworkUtils.scheduleCraftingTaskIfUnscheduled(network, output, 1, CompareUtils.COMPARE_DAMAGE | CompareUtils.COMPARE_NBT); NetworkUtils.scheduleCraftingTaskIfUnscheduled(network, output, 1, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT);
} }
} }
} }

View File

@@ -19,7 +19,7 @@ import net.minecraftforge.fluids.capability.wrappers.FluidBlockWrapper;
import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.inventory.ItemHandlerBasic; import refinedstorage.inventory.ItemHandlerBasic;
import refinedstorage.inventory.ItemHandlerFluid; import refinedstorage.inventory.ItemHandlerFluid;
import refinedstorage.inventory.ItemHandlerUpgrade; import refinedstorage.inventory.ItemHandlerUpgrade;
@@ -47,7 +47,7 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, this, ItemUpgrade.TYPE_SPEED); private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, this, ItemUpgrade.TYPE_SPEED);
private int compare = CompareUtils.COMPARE_NBT | CompareUtils.COMPARE_DAMAGE; private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
private int mode = IFilterable.WHITELIST; private int mode = IFilterable.WHITELIST;
private int type = IType.ITEMS; private int type = IType.ITEMS;

View File

@@ -11,9 +11,10 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.RSBlocks; import refinedstorage.RSBlocks;
import refinedstorage.api.RSAPI;
import refinedstorage.api.autocrafting.task.ICraftingTask; import refinedstorage.api.autocrafting.task.ICraftingTask;
import refinedstorage.api.network.INetworkMaster; import refinedstorage.api.network.INetworkMaster;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.gui.GuiDetector; import refinedstorage.gui.GuiDetector;
import refinedstorage.inventory.ItemHandlerBasic; import refinedstorage.inventory.ItemHandlerBasic;
import refinedstorage.inventory.ItemHandlerFluid; import refinedstorage.inventory.ItemHandlerFluid;
@@ -82,7 +83,7 @@ public class TileDetector extends TileNode implements IComparable, IType {
private ItemHandlerBasic itemFilters = new ItemHandlerBasic(1, this); private ItemHandlerBasic itemFilters = new ItemHandlerBasic(1, this);
private ItemHandlerFluid fluidFilters = new ItemHandlerFluid(1, this); private ItemHandlerFluid fluidFilters = new ItemHandlerFluid(1, this);
private int compare = CompareUtils.COMPARE_NBT | CompareUtils.COMPARE_DAMAGE; private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
private int type = IType.ITEMS; private int type = IType.ITEMS;
private int mode = MODE_EQUAL; private int mode = MODE_EQUAL;
private int amount = 0; private int amount = 0;
@@ -114,7 +115,7 @@ public class TileDetector extends TileNode implements IComparable, IType {
for (ICraftingTask task : network.getCraftingTasks()) { for (ICraftingTask task : network.getCraftingTasks()) {
for (ItemStack output : task.getPattern().getOutputs()) { for (ItemStack output : task.getPattern().getOutputs()) {
if (CompareUtils.compareStackNoQuantity(slot, output)) { if (RSAPI.instance().getComparer().isEqualNoQuantity(slot, output)) {
found = true; found = true;
break; break;

View File

@@ -13,11 +13,11 @@ import net.minecraftforge.items.ItemHandlerHelper;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.RSItems; import refinedstorage.RSItems;
import refinedstorage.api.network.INetworkMaster; import refinedstorage.api.network.INetworkMaster;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.api.storage.fluid.IFluidStorage; import refinedstorage.api.storage.fluid.IFluidStorage;
import refinedstorage.api.storage.fluid.IFluidStorageProvider; import refinedstorage.api.storage.fluid.IFluidStorageProvider;
import refinedstorage.api.storage.item.IItemStorage; import refinedstorage.api.storage.item.IItemStorage;
import refinedstorage.api.storage.item.IItemStorageProvider; import refinedstorage.api.storage.item.IItemStorageProvider;
import refinedstorage.api.util.IComparer;
import refinedstorage.apiimpl.storage.NBTStorage; import refinedstorage.apiimpl.storage.NBTStorage;
import refinedstorage.apiimpl.storage.fluid.FluidStorageNBT; import refinedstorage.apiimpl.storage.fluid.FluidStorageNBT;
import refinedstorage.apiimpl.storage.fluid.FluidUtils; import refinedstorage.apiimpl.storage.fluid.FluidUtils;
@@ -128,7 +128,7 @@ public class TileDiskDrive extends TileNode implements IItemStorageProvider, IFl
private FluidStorage fluidStorages[] = new FluidStorage[8]; private FluidStorage fluidStorages[] = new FluidStorage[8];
private int priority = 0; private int priority = 0;
private int compare = CompareUtils.COMPARE_NBT | CompareUtils.COMPARE_DAMAGE; private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
private int mode = IFilterable.WHITELIST; private int mode = IFilterable.WHITELIST;
private int type = IType.ITEMS; private int type = IType.ITEMS;

View File

@@ -12,7 +12,7 @@ import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemHandlerHelper;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.apiimpl.storage.NBTStorage; import refinedstorage.apiimpl.storage.NBTStorage;
import refinedstorage.apiimpl.storage.fluid.FluidStorageNBT; import refinedstorage.apiimpl.storage.fluid.FluidStorageNBT;
import refinedstorage.apiimpl.storage.fluid.FluidUtils; import refinedstorage.apiimpl.storage.fluid.FluidUtils;
@@ -59,7 +59,7 @@ public class TileDiskManipulator extends TileNode implements IComparable, IFilte
private static final String NBT_TYPE = "Type"; private static final String NBT_TYPE = "Type";
private static final String NBT_IO_MODE = "IOMode"; private static final String NBT_IO_MODE = "IOMode";
private int compare = CompareUtils.COMPARE_NBT | CompareUtils.COMPARE_DAMAGE; private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
private int mode = IFilterable.WHITELIST; private int mode = IFilterable.WHITELIST;
private int type = IType.ITEMS; private int type = IType.ITEMS;
private int ioMode = IO_MODE_INSERT; private int ioMode = IO_MODE_INSERT;

View File

@@ -13,7 +13,7 @@ import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemHandlerHelper;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.api.network.NetworkUtils; import refinedstorage.api.network.NetworkUtils;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.inventory.ItemHandlerBasic; import refinedstorage.inventory.ItemHandlerBasic;
import refinedstorage.inventory.ItemHandlerFluid; import refinedstorage.inventory.ItemHandlerFluid;
import refinedstorage.inventory.ItemHandlerUpgrade; import refinedstorage.inventory.ItemHandlerUpgrade;
@@ -34,7 +34,7 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, this, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_CRAFTING, ItemUpgrade.TYPE_STACK); private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, this, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_CRAFTING, ItemUpgrade.TYPE_STACK);
private int compare = CompareUtils.COMPARE_NBT | CompareUtils.COMPARE_DAMAGE; private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
private int type = IType.ITEMS; private int type = IType.ITEMS;
public TileExporter() { public TileExporter() {

View File

@@ -9,7 +9,7 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.apiimpl.storage.fluid.FluidUtils; import refinedstorage.apiimpl.storage.fluid.FluidUtils;
import refinedstorage.inventory.ItemHandlerBasic; import refinedstorage.inventory.ItemHandlerBasic;
import refinedstorage.inventory.ItemHandlerFluid; import refinedstorage.inventory.ItemHandlerFluid;
@@ -43,7 +43,7 @@ public class TileFluidInterface extends TileNode implements IComparable {
private static final String NBT_TANK_IN = "TankIn"; private static final String NBT_TANK_IN = "TankIn";
private static final String NBT_TANK_OUT = "TankOut"; private static final String NBT_TANK_OUT = "TankOut";
private int compare = CompareUtils.COMPARE_NBT; private int compare = IComparer.COMPARE_NBT;
private FluidTank tankIn = new FluidTank(TANK_CAPACITY) { private FluidTank tankIn = new FluidTank(TANK_CAPACITY) {
@Override @Override

View File

@@ -6,9 +6,9 @@ import net.minecraftforge.fluids.FluidStack;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.RSBlocks; import refinedstorage.RSBlocks;
import refinedstorage.api.network.INetworkMaster; import refinedstorage.api.network.INetworkMaster;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.api.storage.fluid.IFluidStorage; import refinedstorage.api.storage.fluid.IFluidStorage;
import refinedstorage.api.storage.fluid.IFluidStorageProvider; import refinedstorage.api.storage.fluid.IFluidStorageProvider;
import refinedstorage.api.util.IComparer;
import refinedstorage.apiimpl.storage.fluid.FluidStorageNBT; import refinedstorage.apiimpl.storage.fluid.FluidStorageNBT;
import refinedstorage.apiimpl.storage.fluid.FluidUtils; import refinedstorage.apiimpl.storage.fluid.FluidUtils;
import refinedstorage.block.BlockFluidStorage; import refinedstorage.block.BlockFluidStorage;
@@ -68,7 +68,7 @@ public class TileFluidStorage extends TileNode implements IFluidStorageProvider,
private EnumFluidStorageType type; private EnumFluidStorageType type;
private int priority = 0; private int priority = 0;
private int compare = CompareUtils.COMPARE_NBT; private int compare = IComparer.COMPARE_NBT;
private int mode = IFilterable.WHITELIST; private int mode = IFilterable.WHITELIST;
public TileFluidStorage() { public TileFluidStorage() {

View File

@@ -11,7 +11,7 @@ import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.inventory.ItemHandlerBasic; import refinedstorage.inventory.ItemHandlerBasic;
import refinedstorage.inventory.ItemHandlerFluid; import refinedstorage.inventory.ItemHandlerFluid;
import refinedstorage.inventory.ItemHandlerUpgrade; import refinedstorage.inventory.ItemHandlerUpgrade;
@@ -35,7 +35,7 @@ public class TileImporter extends TileMultipartNode implements IComparable, IFil
private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, this, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_STACK); private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, this, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_STACK);
private int compare = CompareUtils.COMPARE_NBT | CompareUtils.COMPARE_DAMAGE; private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
private int mode = IFilterable.WHITELIST; private int mode = IFilterable.WHITELIST;
private int type = IType.ITEMS; private int type = IType.ITEMS;

View File

@@ -9,7 +9,7 @@ import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.CombinedInvWrapper; import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.api.network.NetworkUtils; import refinedstorage.api.network.NetworkUtils;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.util.IComparer;
import refinedstorage.inventory.ItemHandlerBasic; import refinedstorage.inventory.ItemHandlerBasic;
import refinedstorage.inventory.ItemHandlerUpgrade; import refinedstorage.inventory.ItemHandlerUpgrade;
import refinedstorage.item.ItemUpgrade; import refinedstorage.item.ItemUpgrade;
@@ -26,7 +26,7 @@ public class TileInterface extends TileNode implements IComparable {
private ItemHandlerBasic exportItems = new ItemHandlerBasic(9, this); private ItemHandlerBasic exportItems = new ItemHandlerBasic(9, this);
private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, this, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_STACK, ItemUpgrade.TYPE_CRAFTING); private ItemHandlerUpgrade upgrades = new ItemHandlerUpgrade(4, this, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_STACK, ItemUpgrade.TYPE_CRAFTING);
private int compare = CompareUtils.COMPARE_NBT | CompareUtils.COMPARE_DAMAGE; private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
private int currentSlot = 0; private int currentSlot = 0;

View File

@@ -12,7 +12,6 @@ import refinedstorage.RS;
import refinedstorage.api.RSAPI; import refinedstorage.api.RSAPI;
import refinedstorage.api.network.INetworkMaster; import refinedstorage.api.network.INetworkMaster;
import refinedstorage.api.solderer.ISoldererRecipe; import refinedstorage.api.solderer.ISoldererRecipe;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.inventory.ItemHandlerBasic; import refinedstorage.inventory.ItemHandlerBasic;
import refinedstorage.inventory.ItemHandlerUpgrade; import refinedstorage.inventory.ItemHandlerUpgrade;
import refinedstorage.item.ItemUpgrade; import refinedstorage.item.ItemUpgrade;
@@ -54,7 +53,7 @@ public class TileSolderer extends TileNode {
for (ISoldererRecipe recipe : RSAPI.instance().getSoldererRegistry().getRecipes()) { for (ISoldererRecipe recipe : RSAPI.instance().getSoldererRegistry().getRecipes()) {
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
if (CompareUtils.compareStackNoQuantity(recipe.getRow(i), stack) || CompareUtils.compareStackOreDict(recipe.getRow(i), stack)) { if (RSAPI.instance().getComparer().isEqualNoQuantity(recipe.getRow(i), stack) || RSAPI.instance().getComparer().isEqualOredict(recipe.getRow(i), stack)) {
possibleSlots.add(i); possibleSlots.add(i);
} }
} }
@@ -97,7 +96,7 @@ public class TileSolderer extends TileNode {
if (newRecipe == null) { if (newRecipe == null) {
stop(); stop();
} else if (newRecipe != recipe) { } else if (newRecipe != recipe) {
boolean sameItem = result.getStackInSlot(0) != null ? CompareUtils.compareStackNoQuantity(result.getStackInSlot(0), newRecipe.getResult()) : false; boolean sameItem = result.getStackInSlot(0) != null ? RSAPI.instance().getComparer().isEqualNoQuantity(result.getStackInSlot(0), newRecipe.getResult()) : false;
if (result.getStackInSlot(0) == null || (sameItem && ((result.getStackInSlot(0).stackSize + newRecipe.getResult().stackSize) <= result.getStackInSlot(0).getMaxStackSize()))) { if (result.getStackInSlot(0) == null || (sameItem && ((result.getStackInSlot(0).stackSize + newRecipe.getResult().stackSize) <= result.getStackInSlot(0).getMaxStackSize()))) {
recipe = newRecipe; recipe = newRecipe;

View File

@@ -7,9 +7,9 @@ import net.minecraftforge.items.ItemHandlerHelper;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.RSBlocks; import refinedstorage.RSBlocks;
import refinedstorage.api.network.INetworkMaster; import refinedstorage.api.network.INetworkMaster;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.api.storage.item.IItemStorage; import refinedstorage.api.storage.item.IItemStorage;
import refinedstorage.api.storage.item.IItemStorageProvider; import refinedstorage.api.storage.item.IItemStorageProvider;
import refinedstorage.api.util.IComparer;
import refinedstorage.apiimpl.storage.item.ItemStorageNBT; import refinedstorage.apiimpl.storage.item.ItemStorageNBT;
import refinedstorage.block.BlockStorage; import refinedstorage.block.BlockStorage;
import refinedstorage.block.EnumItemStorageType; import refinedstorage.block.EnumItemStorageType;
@@ -68,7 +68,7 @@ public class TileStorage extends TileNode implements IItemStorageProvider, IStor
private EnumItemStorageType type; private EnumItemStorageType type;
private int priority = 0; private int priority = 0;
private int compare = CompareUtils.COMPARE_NBT | CompareUtils.COMPARE_DAMAGE; private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
private int mode = IFilterable.WHITELIST; private int mode = IFilterable.WHITELIST;
public TileStorage() { public TileStorage() {

View File

@@ -5,7 +5,7 @@ import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.RSAPI;
import refinedstorage.inventory.ItemHandlerFluid; import refinedstorage.inventory.ItemHandlerFluid;
import refinedstorage.tile.data.ITileDataConsumer; import refinedstorage.tile.data.ITileDataConsumer;
import refinedstorage.tile.data.ITileDataProducer; import refinedstorage.tile.data.ITileDataProducer;
@@ -41,7 +41,7 @@ public interface IFilterable {
if (slot != null) { if (slot != null) {
slots++; slots++;
if (CompareUtils.compareStack(slot, stack, compare)) { if (RSAPI.instance().getComparer().isEqual(slot, stack, compare)) {
return true; return true;
} }
} }
@@ -52,7 +52,7 @@ public interface IFilterable {
for (int i = 0; i < filters.getSlots(); ++i) { for (int i = 0; i < filters.getSlots(); ++i) {
ItemStack slot = filters.getStackInSlot(i); ItemStack slot = filters.getStackInSlot(i);
if (slot != null && CompareUtils.compareStack(slot, stack, compare)) { if (slot != null && RSAPI.instance().getComparer().isEqual(slot, stack, compare)) {
return false; return false;
} }
} }
@@ -73,7 +73,7 @@ public interface IFilterable {
if (slot != null) { if (slot != null) {
slots++; slots++;
if (CompareUtils.compareStack(slot, stack, compare)) { if (RSAPI.instance().getComparer().isEqual(slot, stack, compare)) {
return true; return true;
} }
} }
@@ -84,7 +84,7 @@ public interface IFilterable {
for (int i = 0; i < filters.getSlots(); ++i) { for (int i = 0; i < filters.getSlots(); ++i) {
FluidStack slot = filters.getFluidStackInSlot(i); FluidStack slot = filters.getFluidStackInSlot(i);
if (slot != null && CompareUtils.compareStack(slot, stack, compare)) { if (slot != null && RSAPI.instance().getComparer().isEqual(slot, stack, compare)) {
return false; return false;
} }
} }

View File

@@ -3,8 +3,9 @@ package refinedstorage.tile.externalstorage;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.IFluidTankProperties; import net.minecraftforge.fluids.capability.IFluidTankProperties;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.RSAPI;
import refinedstorage.api.storage.fluid.IFluidStorage; import refinedstorage.api.storage.fluid.IFluidStorage;
import refinedstorage.api.util.IComparer;
import refinedstorage.apiimpl.storage.fluid.FluidUtils; import refinedstorage.apiimpl.storage.fluid.FluidUtils;
import refinedstorage.tile.config.IFilterable; import refinedstorage.tile.config.IFilterable;
@@ -58,7 +59,7 @@ public class FluidStorageExternal implements IFluidStorage {
public FluidStack extractFluid(@Nonnull FluidStack stack, int size, int flags) { public FluidStack extractFluid(@Nonnull FluidStack stack, int size, int flags) {
FluidStack toDrain = FluidUtils.copyStackWithSize(stack, size); FluidStack toDrain = FluidUtils.copyStackWithSize(stack, size);
if (CompareUtils.compareStack(getContents(), toDrain, flags)) { if (RSAPI.instance().getComparer().isEqual(getContents(), toDrain, flags)) {
return handler.drain(toDrain, true); return handler.drain(toDrain, true);
} }
@@ -84,7 +85,7 @@ public class FluidStorageExternal implements IFluidStorage {
if (cache == null) { if (cache == null) {
cache = FluidUtils.copy(stack); cache = FluidUtils.copy(stack);
} else if (!CompareUtils.compareStack(stack, cache, CompareUtils.COMPARE_NBT | CompareUtils.COMPARE_QUANTITY)) { } else if (!RSAPI.instance().getComparer().isEqual(stack, cache, IComparer.COMPARE_NBT | RSAPI.instance().getComparer().COMPARE_QUANTITY)) {
cache = FluidUtils.copy(stack); cache = FluidUtils.copy(stack);
return true; return true;

View File

@@ -3,7 +3,7 @@ package refinedstorage.tile.externalstorage;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemHandlerHelper;
import powercrystals.minefactoryreloaded.api.IDeepStorageUnit; import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.RSAPI;
import refinedstorage.tile.config.IFilterable; import refinedstorage.tile.config.IFilterable;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@@ -37,7 +37,7 @@ public class ItemStorageDSU extends ItemStorageExternal {
public ItemStack insertItem(@Nonnull ItemStack stack, int size, boolean simulate) { public ItemStack insertItem(@Nonnull ItemStack stack, int size, boolean simulate) {
if (IFilterable.canTake(externalStorage.getItemFilters(), externalStorage.getMode(), externalStorage.getCompare(), stack)) { if (IFilterable.canTake(externalStorage.getItemFilters(), externalStorage.getMode(), externalStorage.getCompare(), stack)) {
if (unit.getStoredItemType() != null) { if (unit.getStoredItemType() != null) {
if (CompareUtils.compareStackNoQuantity(unit.getStoredItemType(), stack)) { if (RSAPI.instance().getComparer().isEqualNoQuantity(unit.getStoredItemType(), stack)) {
if (getStored() + size > unit.getMaxStoredCount()) { if (getStored() + size > unit.getMaxStoredCount()) {
int remainingSpace = getCapacity() - getStored(); int remainingSpace = getCapacity() - getStored();
@@ -86,7 +86,7 @@ public class ItemStorageDSU extends ItemStorageExternal {
@Override @Override
public ItemStack extractItem(@Nonnull ItemStack stack, int size, int flags) { public ItemStack extractItem(@Nonnull ItemStack stack, int size, int flags) {
if (CompareUtils.compareStack(stack, unit.getStoredItemType(), flags)) { if (RSAPI.instance().getComparer().isEqual(stack, unit.getStoredItemType(), flags)) {
if (size > unit.getStoredItemType().stackSize) { if (size > unit.getStoredItemType().stackSize) {
size = unit.getStoredItemType().stackSize; size = unit.getStoredItemType().stackSize;
} }

View File

@@ -4,7 +4,7 @@ import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.IVoidable; import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.IVoidable;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemHandlerHelper;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.RSAPI;
import refinedstorage.tile.config.IFilterable; import refinedstorage.tile.config.IFilterable;
import java.util.Collections; import java.util.Collections;
@@ -88,7 +88,7 @@ public class ItemStorageDrawer extends ItemStorageExternal {
@Override @Override
public ItemStack extractItem(ItemStack stack, int size, int flags) { public ItemStack extractItem(ItemStack stack, int size, int flags) {
if (CompareUtils.compareStack(stack, drawer.getStoredItemPrototype(), flags) && drawer.canItemBeExtracted(stack)) { if (RSAPI.instance().getComparer().isEqual(stack, drawer.getStoredItemPrototype(), flags) && drawer.canItemBeExtracted(stack)) {
if (size > drawer.getStoredItemCount()) { if (size > drawer.getStoredItemCount()) {
size = drawer.getStoredItemCount(); size = drawer.getStoredItemCount();
} }

View File

@@ -1,7 +1,7 @@
package refinedstorage.tile.externalstorage; package refinedstorage.tile.externalstorage;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.RSAPI;
import refinedstorage.api.storage.item.IItemStorage; import refinedstorage.api.storage.item.IItemStorage;
import java.util.List; import java.util.List;
@@ -22,7 +22,7 @@ public abstract class ItemStorageExternal implements IItemStorage {
return true; return true;
} else { } else {
for (int i = 0; i < items.size(); ++i) { for (int i = 0; i < items.size(); ++i) {
if (!CompareUtils.compareStack(items.get(i), cache.get(i))) { if (!RSAPI.instance().getComparer().isEqual(items.get(i), cache.get(i))) {
cache = items; cache = items;
return true; return true;

View File

@@ -3,7 +3,7 @@ package refinedstorage.tile.externalstorage;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemHandlerHelper;
import refinedstorage.api.storage.CompareUtils; import refinedstorage.api.RSAPI;
import refinedstorage.tile.config.IFilterable; import refinedstorage.tile.config.IFilterable;
import java.util.ArrayList; import java.util.ArrayList;
@@ -54,7 +54,7 @@ public class ItemStorageItemHandler extends ItemStorageExternal {
for (int i = 0; i < handler.getSlots(); ++i) { for (int i = 0; i < handler.getSlots(); ++i) {
ItemStack slot = handler.getStackInSlot(i); ItemStack slot = handler.getStackInSlot(i);
if (slot != null && CompareUtils.compareStack(slot, stack, flags)) { if (slot != null && RSAPI.instance().getComparer().isEqual(slot, stack, flags)) {
ItemStack got = handler.extractItem(i, remaining, false); ItemStack got = handler.extractItem(i, remaining, false);
if (got != null) { if (got != null) {

View File

@@ -12,11 +12,11 @@ import net.minecraftforge.items.IItemHandler;
import powercrystals.minefactoryreloaded.api.IDeepStorageUnit; import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.api.network.INetworkMaster; import refinedstorage.api.network.INetworkMaster;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.api.storage.fluid.IFluidStorage; import refinedstorage.api.storage.fluid.IFluidStorage;
import refinedstorage.api.storage.fluid.IFluidStorageProvider; import refinedstorage.api.storage.fluid.IFluidStorageProvider;
import refinedstorage.api.storage.item.IItemStorage; import refinedstorage.api.storage.item.IItemStorage;
import refinedstorage.api.storage.item.IItemStorageProvider; import refinedstorage.api.storage.item.IItemStorageProvider;
import refinedstorage.api.util.IComparer;
import refinedstorage.inventory.ItemHandlerBasic; import refinedstorage.inventory.ItemHandlerBasic;
import refinedstorage.inventory.ItemHandlerFluid; import refinedstorage.inventory.ItemHandlerFluid;
import refinedstorage.tile.IStorageGui; import refinedstorage.tile.IStorageGui;
@@ -80,7 +80,7 @@ public class TileExternalStorage extends TileMultipartNode implements IItemStora
private ItemHandlerFluid fluidFilters = new ItemHandlerFluid(9, this); private ItemHandlerFluid fluidFilters = new ItemHandlerFluid(9, this);
private int priority = 0; private int priority = 0;
private int compare = CompareUtils.COMPARE_NBT | CompareUtils.COMPARE_DAMAGE; private int compare = IComparer.COMPARE_NBT | IComparer.COMPARE_DAMAGE;
private int mode = IFilterable.WHITELIST; private int mode = IFilterable.WHITELIST;
private int type = IType.ITEMS; private int type = IType.ITEMS;

View File

@@ -16,10 +16,10 @@ import net.minecraftforge.items.wrapper.InvWrapper;
import refinedstorage.RS; import refinedstorage.RS;
import refinedstorage.RSBlocks; import refinedstorage.RSBlocks;
import refinedstorage.RSItems; import refinedstorage.RSItems;
import refinedstorage.api.RSAPI;
import refinedstorage.api.network.NetworkUtils; import refinedstorage.api.network.NetworkUtils;
import refinedstorage.api.network.grid.IFluidGridHandler; import refinedstorage.api.network.grid.IFluidGridHandler;
import refinedstorage.api.network.grid.IItemGridHandler; import refinedstorage.api.network.grid.IItemGridHandler;
import refinedstorage.api.storage.CompareUtils;
import refinedstorage.block.BlockGrid; import refinedstorage.block.BlockGrid;
import refinedstorage.block.EnumGridType; import refinedstorage.block.EnumGridType;
import refinedstorage.container.ContainerGrid; import refinedstorage.container.ContainerGrid;
@@ -287,7 +287,7 @@ public class TileGrid extends TileNode implements IGrid {
craftedItems += crafted.stackSize; craftedItems += crafted.stackSize;
if (!CompareUtils.compareStack(crafted, result.getStackInSlot(0)) || craftedItems + crafted.stackSize > crafted.getMaxStackSize()) { if (!RSAPI.instance().getComparer().isEqual(crafted, result.getStackInSlot(0)) || craftedItems + crafted.stackSize > crafted.getMaxStackSize()) {
break; break;
} }
} }
@@ -364,7 +364,7 @@ public class TileGrid extends TileNode implements IGrid {
if (!found) { if (!found) {
for (ItemStack possibility : possibilities) { for (ItemStack possibility : possibilities) {
for (int j = 0; j < player.inventory.getSizeInventory(); ++j) { for (int j = 0; j < player.inventory.getSizeInventory(); ++j) {
if (CompareUtils.compareStackNoQuantity(possibility, player.inventory.getStackInSlot(j))) { if (RSAPI.instance().getComparer().isEqualNoQuantity(possibility, player.inventory.getStackInSlot(j))) {
matrix.setInventorySlotContents(i, ItemHandlerHelper.copyStackWithSize(player.inventory.getStackInSlot(j), 1)); matrix.setInventorySlotContents(i, ItemHandlerHelper.copyStackWithSize(player.inventory.getStackInSlot(j), 1));
player.inventory.decrStackSize(j, 1); player.inventory.decrStackSize(j, 1);