Merge pull request #441 from way2muchnoise/mc1.10
add API deliver based on an annotation
This commit is contained in:
@@ -6,8 +6,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.apiimpl.storage.fluid.FluidStorageNBT;
|
||||
import refinedstorage.apiimpl.storage.item.ItemStorageNBT;
|
||||
|
||||
@@ -19,12 +19,12 @@ public final class RSUtils {
|
||||
buf.writeInt(stack.stackSize);
|
||||
buf.writeInt(stack.getItemDamage());
|
||||
ByteBufUtils.writeTag(buf, stack.getTagCompound());
|
||||
buf.writeInt(RSAPI.instance().getItemStackHashCode(stack));
|
||||
buf.writeInt(API.instance().getItemStackHashCode(stack));
|
||||
buf.writeBoolean(network.hasPattern(stack));
|
||||
}
|
||||
|
||||
public static void writeFluidStack(ByteBuf buf, FluidStack stack) {
|
||||
buf.writeInt(RSAPI.instance().getFluidStackHashCode(stack));
|
||||
buf.writeInt(API.instance().getFluidStackHashCode(stack));
|
||||
ByteBufUtils.writeUTF8String(buf, FluidRegistry.getFluidName(stack.getFluid()));
|
||||
buf.writeInt(stack.amount);
|
||||
ByteBufUtils.writeTag(buf, stack.tag);
|
||||
|
3
src/main/java/refinedstorage/api/IAPI.java → src/main/java/refinedstorage/api/IRSAPI.java
Executable file → Normal file
3
src/main/java/refinedstorage/api/IAPI.java → src/main/java/refinedstorage/api/IRSAPI.java
Executable file → Normal file
@@ -12,8 +12,9 @@ import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Represents a Refined Storage API implementation.
|
||||
* Delivered by the {@link RSAPI} annotation
|
||||
*/
|
||||
public interface IAPI {
|
||||
public interface IRSAPI {
|
||||
/**
|
||||
* @return the comparer
|
||||
*/
|
31
src/main/java/refinedstorage/api/RSAPI.java
Executable file → Normal file
31
src/main/java/refinedstorage/api/RSAPI.java
Executable file → Normal file
@@ -1,28 +1,11 @@
|
||||
package refinedstorage.api;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
public final class RSAPI {
|
||||
private static final String API_IMPL_CLASS = "refinedstorage.apiimpl.API";
|
||||
private static final String API_IMPL_FIELD = "INSTANCE";
|
||||
|
||||
private static final IAPI API;
|
||||
|
||||
static {
|
||||
try {
|
||||
Class<?> apiClass = Class.forName(API_IMPL_CLASS);
|
||||
Field apiField = apiClass.getField(API_IMPL_FIELD);
|
||||
|
||||
API = (IAPI) apiField.get(apiClass);
|
||||
} catch (Exception e) {
|
||||
throw new Error("The Refined Storage API implementation is unavailable, make sure Refined Storage is installed", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Refined Storage API
|
||||
*/
|
||||
public static IAPI instance() {
|
||||
return API;
|
||||
}
|
||||
/**
|
||||
* Needs to implemented on a public static {@link IRSAPI} field
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface RSAPI {
|
||||
}
|
||||
|
@@ -6,7 +6,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||
import refinedstorage.api.network.grid.IFluidGridHandler;
|
||||
@@ -14,6 +13,7 @@ import refinedstorage.api.network.grid.IItemGridHandler;
|
||||
import refinedstorage.api.storage.fluid.IGroupedFluidStorage;
|
||||
import refinedstorage.api.storage.item.IGroupedItemStorage;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.apiimpl.API;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -156,7 +156,7 @@ public interface INetworkMaster {
|
||||
* @return the crafting task
|
||||
*/
|
||||
default ICraftingTask createCraftingTask(@Nullable ItemStack stack, ICraftingPattern pattern, int quantity) {
|
||||
return RSAPI.instance().getCraftingTaskRegistry().getFactory(pattern.getId()).create(getNetworkWorld(), this, stack, pattern, quantity, null);
|
||||
return API.instance().getCraftingTaskRegistry().getFactory(pattern.getId()).create(getNetworkWorld(), this, stack, pattern, quantity, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,7 +171,7 @@ public interface INetworkMaster {
|
||||
|
||||
for (ICraftingTask task : getCraftingTasks()) {
|
||||
for (ItemStack output : task.getPattern().getOutputs()) {
|
||||
if (RSAPI.instance().getComparer().isEqual(output, stack, compare)) {
|
||||
if (API.instance().getComparer().isEqual(output, stack, compare)) {
|
||||
alreadyScheduled++;
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,9 @@ package refinedstorage.apiimpl;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import refinedstorage.api.IAPI;
|
||||
import net.minecraftforge.fml.common.discovery.ASMDataTable;
|
||||
import refinedstorage.api.IRSAPI;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElementRegistry;
|
||||
import refinedstorage.api.autocrafting.registry.ICraftingTaskRegistry;
|
||||
import refinedstorage.api.solderer.ISoldererRegistry;
|
||||
@@ -15,9 +17,11 @@ import refinedstorage.apiimpl.util.Comparer;
|
||||
import refinedstorage.apiimpl.util.ItemStackList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Set;
|
||||
|
||||
public class API implements IAPI {
|
||||
public static final IAPI INSTANCE = new API();
|
||||
public class API implements IRSAPI {
|
||||
private static final IRSAPI INSTANCE = new API();
|
||||
|
||||
private IComparer comparer = new Comparer();
|
||||
private ISoldererRegistry soldererRegistry = new SoldererRegistry();
|
||||
@@ -63,4 +67,23 @@ public class API implements IAPI {
|
||||
public int getFluidStackHashCode(FluidStack stack) {
|
||||
return stack.getFluid().hashCode() * (stack.tag != null ? stack.tag.hashCode() : 1);
|
||||
}
|
||||
|
||||
public static IRSAPI instance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public static void deliver(ASMDataTable asmDataTable) {
|
||||
String annotationClassName = RSAPI.class.getCanonicalName();
|
||||
Set<ASMDataTable.ASMData> asmDataSet = asmDataTable.getAll(annotationClassName);
|
||||
for (ASMDataTable.ASMData asmData : asmDataSet) {
|
||||
try {
|
||||
Class clazz = Class.forName(asmData.getClassName());
|
||||
Field field = clazz.getField(asmData.getObjectName());
|
||||
if (field.getType() == IRSAPI.class)
|
||||
field.set(null, INSTANCE);
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
|
||||
throw new RuntimeException("Failed to set: {}" + asmData.getClassName() + "." + asmData.getObjectName(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7,9 +7,9 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.apiimpl.autocrafting.registry.CraftingTaskFactoryNormal;
|
||||
import refinedstorage.item.ItemPattern;
|
||||
|
||||
@@ -108,7 +108,7 @@ public class CraftingPattern implements ICraftingPattern {
|
||||
int quantity = 0;
|
||||
|
||||
for (ItemStack output : outputs) {
|
||||
if (RSAPI.instance().getComparer().isEqualNoQuantity(requested, output)) {
|
||||
if (API.instance().getComparer().isEqualNoQuantity(requested, output)) {
|
||||
quantity += output.stackSize;
|
||||
|
||||
if (!ItemPattern.isProcessing(stack)) {
|
||||
|
@@ -3,13 +3,13 @@ package refinedstorage.apiimpl.autocrafting.task;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
|
||||
import refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||
import refinedstorage.api.autocrafting.task.IProcessable;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.util.IItemStackList;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementItemRender;
|
||||
import refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementText;
|
||||
|
||||
@@ -23,10 +23,10 @@ public class CraftingTaskNormal implements ICraftingTask {
|
||||
private ICraftingPattern pattern;
|
||||
private int quantity;
|
||||
private List<IProcessable> toProcess = new ArrayList<>();
|
||||
private IItemStackList toTake = RSAPI.instance().createItemStackList();
|
||||
private IItemStackList toCraft = RSAPI.instance().createItemStackList();
|
||||
private IItemStackList missing = RSAPI.instance().createItemStackList();
|
||||
private IItemStackList extras = RSAPI.instance().createItemStackList();
|
||||
private IItemStackList toTake = API.instance().createItemStackList();
|
||||
private IItemStackList toCraft = API.instance().createItemStackList();
|
||||
private IItemStackList missing = API.instance().createItemStackList();
|
||||
private IItemStackList extras = API.instance().createItemStackList();
|
||||
|
||||
public CraftingTaskNormal(INetworkMaster network, ItemStack requested, ICraftingPattern pattern, int quantity) {
|
||||
this.network = network;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package refinedstorage.apiimpl.autocrafting.task;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.task.IProcessable;
|
||||
import refinedstorage.apiimpl.API;
|
||||
|
||||
public class Processable implements IProcessable {
|
||||
private ICraftingPattern pattern;
|
||||
@@ -56,7 +56,7 @@ public class Processable implements IProcessable {
|
||||
if (!satisfied[i]) {
|
||||
ItemStack item = pattern.getOutputs().get(i);
|
||||
|
||||
if (RSAPI.instance().getComparer().isEqualNoQuantity(stack, item)) {
|
||||
if (API.instance().getComparer().isEqualNoQuantity(stack, item)) {
|
||||
satisfied[i] = true;
|
||||
|
||||
return true;
|
||||
|
@@ -6,9 +6,9 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.network.grid.IFluidGridHandler;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.apiimpl.storage.fluid.FluidUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -31,7 +31,7 @@ public class FluidGridHandler implements IFluidGridHandler {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); ++i) {
|
||||
ItemStack slot = player.inventory.getStackInSlot(i);
|
||||
|
||||
if (RSAPI.instance().getComparer().isEqualNoQuantity(FluidUtils.EMPTY_BUCKET, slot)) {
|
||||
if (API.instance().getComparer().isEqualNoQuantity(FluidUtils.EMPTY_BUCKET, slot)) {
|
||||
bucket = FluidUtils.EMPTY_BUCKET.copy();
|
||||
|
||||
player.inventory.decrStackSize(i, 1);
|
||||
|
@@ -6,10 +6,10 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.network.grid.IItemGridHandler;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.apiimpl.autocrafting.task.CraftingTaskNormal;
|
||||
|
||||
public class ItemGridHandler implements IItemGridHandler {
|
||||
@@ -34,7 +34,7 @@ public class ItemGridHandler implements IItemGridHandler {
|
||||
ItemStack held = player.inventory.getItemStack();
|
||||
|
||||
if (single) {
|
||||
if (held != null && (!RSAPI.instance().getComparer().isEqualNoQuantity(item, held) || held.stackSize + 1 > held.getMaxStackSize())) {
|
||||
if (held != null && (!API.instance().getComparer().isEqualNoQuantity(item, held) || held.stackSize + 1 > held.getMaxStackSize())) {
|
||||
return;
|
||||
}
|
||||
} else if (player.inventory.getItemStack() != null) {
|
||||
|
@@ -2,9 +2,9 @@ package refinedstorage.apiimpl.solderer;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.solderer.ISoldererRecipe;
|
||||
import refinedstorage.api.solderer.ISoldererRegistry;
|
||||
import refinedstorage.apiimpl.API;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -26,7 +26,7 @@ public class SoldererRegistry implements ISoldererRegistry {
|
||||
boolean found = true;
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (!RSAPI.instance().getComparer().isEqualNoQuantity(recipe.getRow(i), rows.getStackInSlot(i)) && !RSAPI.instance().getComparer().isEqualOredict(recipe.getRow(i), rows.getStackInSlot(i))) {
|
||||
if (!API.instance().getComparer().isEqualNoQuantity(recipe.getRow(i), rows.getStackInSlot(i)) && !API.instance().getComparer().isEqualOredict(recipe.getRow(i), rows.getStackInSlot(i))) {
|
||||
found = false;
|
||||
}
|
||||
|
||||
|
@@ -5,8 +5,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.storage.fluid.IFluidStorage;
|
||||
import refinedstorage.apiimpl.API;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
@@ -143,7 +143,7 @@ public abstract class FluidStorageNBT implements IFluidStorage {
|
||||
@Override
|
||||
public synchronized FluidStack extractFluid(FluidStack stack, int size, int flags) {
|
||||
for (FluidStack otherStack : stacks) {
|
||||
if (RSAPI.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||
if (API.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||
if (size > otherStack.amount) {
|
||||
size = otherStack.amount;
|
||||
}
|
||||
|
@@ -4,11 +4,11 @@ import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.storage.fluid.IFluidStorage;
|
||||
import refinedstorage.api.storage.fluid.IFluidStorageProvider;
|
||||
import refinedstorage.api.storage.fluid.IGroupedFluidStorage;
|
||||
import refinedstorage.apiimpl.API;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -86,7 +86,7 @@ public class GroupedFluidStorage implements IGroupedFluidStorage {
|
||||
@Nullable
|
||||
public FluidStack get(@Nonnull FluidStack stack, int flags) {
|
||||
for (FluidStack otherStack : stacks.get(stack.getFluid())) {
|
||||
if (RSAPI.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||
if (API.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||
return otherStack;
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public class GroupedFluidStorage implements IGroupedFluidStorage {
|
||||
@Nullable
|
||||
public FluidStack get(int hash) {
|
||||
for (FluidStack stack : this.stacks.values()) {
|
||||
if (RSAPI.instance().getFluidStackHashCode(stack) == hash) {
|
||||
if (API.instance().getFluidStackHashCode(stack) == hash) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +1,13 @@
|
||||
package refinedstorage.apiimpl.storage.item;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.storage.item.IGroupedItemStorage;
|
||||
import refinedstorage.api.storage.item.IItemStorage;
|
||||
import refinedstorage.api.storage.item.IItemStorageProvider;
|
||||
import refinedstorage.api.util.IItemStackList;
|
||||
import refinedstorage.apiimpl.API;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
public class GroupedItemStorage implements IGroupedItemStorage {
|
||||
private INetworkMaster network;
|
||||
private List<IItemStorage> storages = new ArrayList<>();
|
||||
private IItemStackList list = RSAPI.instance().createItemStackList();
|
||||
private IItemStackList list = API.instance().createItemStackList();
|
||||
|
||||
public GroupedItemStorage(INetworkMaster network) {
|
||||
this.network = network;
|
||||
|
@@ -6,8 +6,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.storage.item.IItemStorage;
|
||||
import refinedstorage.apiimpl.API;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
@@ -124,7 +124,7 @@ public abstract class ItemStorageNBT implements IItemStorage {
|
||||
@Override
|
||||
public synchronized ItemStack insertItem(ItemStack stack, int size, boolean simulate) {
|
||||
for (ItemStack otherStack : stacks) {
|
||||
if (RSAPI.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
||||
if (API.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
||||
if (getCapacity() != -1 && getStored() + size > getCapacity()) {
|
||||
int remainingSpace = getCapacity() - getStored();
|
||||
|
||||
@@ -187,7 +187,7 @@ public abstract class ItemStorageNBT implements IItemStorage {
|
||||
@Override
|
||||
public synchronized ItemStack extractItem(ItemStack stack, int size, int flags) {
|
||||
for (ItemStack otherStack : stacks) {
|
||||
if (RSAPI.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||
if (API.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||
if (size > otherStack.stackSize) {
|
||||
size = otherStack.stackSize;
|
||||
}
|
||||
|
@@ -3,8 +3,8 @@ package refinedstorage.apiimpl.util;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.util.IItemStackList;
|
||||
import refinedstorage.apiimpl.API;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -16,7 +16,7 @@ public class ItemStackList implements IItemStackList {
|
||||
@Override
|
||||
public void add(ItemStack stack) {
|
||||
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
||||
if (RSAPI.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
||||
if (API.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
||||
otherStack.stackSize += stack.stackSize;
|
||||
|
||||
return;
|
||||
@@ -29,7 +29,7 @@ public class ItemStackList implements IItemStackList {
|
||||
@Override
|
||||
public boolean remove(@Nonnull ItemStack stack, int size, boolean removeIfReachedZero) {
|
||||
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
||||
if (RSAPI.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
||||
if (API.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
||||
otherStack.stackSize -= size;
|
||||
|
||||
if (otherStack.stackSize <= 0 && removeIfReachedZero) {
|
||||
@@ -47,7 +47,7 @@ public class ItemStackList implements IItemStackList {
|
||||
@Nullable
|
||||
public ItemStack get(@Nonnull ItemStack stack, int flags) {
|
||||
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
||||
if (RSAPI.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||
if (API.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||
return otherStack;
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class ItemStackList implements IItemStackList {
|
||||
@Nullable
|
||||
public ItemStack get(int hash) {
|
||||
for (ItemStack stack : this.stacks.values()) {
|
||||
if (RSAPI.instance().getItemStackHashCode(stack) == hash) {
|
||||
if (API.instance().getItemStackHashCode(stack) == hash) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.container.slot.*;
|
||||
import refinedstorage.tile.TileBase;
|
||||
import refinedstorage.tile.grid.WirelessGrid;
|
||||
@@ -107,7 +107,7 @@ public abstract class ContainerBase extends Container {
|
||||
|
||||
protected ItemStack mergeItemStackToSpecimen(ItemStack stack, int begin, int end) {
|
||||
for (int i = begin; i < end; ++i) {
|
||||
if (RSAPI.instance().getComparer().isEqualNoQuantity(getStackFromSlot(getSlot(i)), stack)) {
|
||||
if (API.instance().getComparer().isEqualNoQuantity(getStackFromSlot(getSlot(i)), stack)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -15,8 +15,8 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.network.grid.IItemGridHandler;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.block.EnumGridType;
|
||||
import refinedstorage.container.ContainerGrid;
|
||||
import refinedstorage.gui.GuiBase;
|
||||
@@ -128,7 +128,7 @@ public class GuiGrid extends GuiBase {
|
||||
boolean found = filteredItems.isEmpty();
|
||||
|
||||
for (GridFilteredItem filteredItem : filteredItems) {
|
||||
if (RSAPI.instance().getComparer().isEqual(((ClientStackItem) stack).getStack(), filteredItem.getStack(), filteredItem.getCompare())) {
|
||||
if (API.instance().getComparer().isEqual(((ClientStackItem) stack).getStack(), filteredItem.getStack(), filteredItem.getCompare())) {
|
||||
found = true;
|
||||
|
||||
break;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package refinedstorage.integration.jei;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.solderer.ISoldererRecipe;
|
||||
import refinedstorage.apiimpl.API;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -11,7 +11,7 @@ public final class RecipeMakerSolderer {
|
||||
public static List<RecipeWrapperSolderer> getRecipes() {
|
||||
List<RecipeWrapperSolderer> recipes = new ArrayList<>();
|
||||
|
||||
for (ISoldererRecipe recipe : RSAPI.instance().getSoldererRegistry().getRecipes()) {
|
||||
for (ISoldererRecipe recipe : API.instance().getSoldererRegistry().getRecipes()) {
|
||||
List<ItemStack> inputs = new ArrayList<>();
|
||||
|
||||
inputs.add(recipe.getRow(0));
|
||||
|
@@ -7,7 +7,7 @@ import mezz.jei.api.recipe.transfer.IRecipeTransferHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.container.ContainerProcessingPatternEncoder;
|
||||
import refinedstorage.network.MessageProcessingPatternEncoderTransfer;
|
||||
|
||||
@@ -37,7 +37,7 @@ public class RecipeTransferHandlerPattern implements IRecipeTransferHandler<Cont
|
||||
if (guiIngredient != null && guiIngredient.getDisplayedIngredient() != null) {
|
||||
ItemStack ingredient = guiIngredient.getDisplayedIngredient().copy();
|
||||
|
||||
int hash = RSAPI.instance().getItemStackHashCode(ingredient);
|
||||
int hash = API.instance().getItemStackHashCode(ingredient);
|
||||
|
||||
if (guiIngredient.isInput()) {
|
||||
if (inputs.containsKey(hash)) {
|
||||
|
@@ -14,10 +14,10 @@ import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import refinedstorage.RSItems;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
||||
import refinedstorage.api.autocrafting.ICraftingPatternProvider;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.apiimpl.autocrafting.CraftingPattern;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -158,7 +158,7 @@ public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
|
||||
int amount = stacks[i].stackSize;
|
||||
|
||||
for (int j = i + 1; j < stacks.length; ++j) {
|
||||
if (RSAPI.instance().getComparer().isEqual(stacks[i], stacks[j])) {
|
||||
if (API.instance().getComparer().isEqual(stacks[i], stacks[j])) {
|
||||
amount += stacks[j].stackSize;
|
||||
|
||||
combinedIndices.add(j);
|
||||
|
@@ -18,7 +18,7 @@ import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSBlocks;
|
||||
import refinedstorage.RSItems;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementItemRender;
|
||||
import refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementText;
|
||||
import refinedstorage.apiimpl.autocrafting.registry.CraftingTaskFactoryNormal;
|
||||
@@ -47,10 +47,12 @@ public class CommonProxy {
|
||||
IntegrationCraftingTweaks.register();
|
||||
}
|
||||
|
||||
RSAPI.instance().getCraftingTaskRegistry().addFactory(CraftingTaskFactoryNormal.ID, new CraftingTaskFactoryNormal());
|
||||
API.deliver(e.getAsmData());
|
||||
|
||||
RSAPI.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementItemRender.ID, buf -> new CraftingMonitorElementItemRender(buf.readInt(), ByteBufUtils.readItemStack(buf), buf.readInt(), buf.readInt()));
|
||||
RSAPI.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementText.ID, buf -> new CraftingMonitorElementText(ByteBufUtils.readUTF8String(buf), buf.readInt()));
|
||||
API.instance().getCraftingTaskRegistry().addFactory(CraftingTaskFactoryNormal.ID, new CraftingTaskFactoryNormal());
|
||||
|
||||
API.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementItemRender.ID, buf -> new CraftingMonitorElementItemRender(buf.readInt(), ByteBufUtils.readItemStack(buf), buf.readInt(), buf.readInt()));
|
||||
API.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementText.ID, buf -> new CraftingMonitorElementText(ByteBufUtils.readUTF8String(buf), buf.readInt()));
|
||||
|
||||
int id = 0;
|
||||
|
||||
@@ -147,14 +149,14 @@ public class CommonProxy {
|
||||
OreDictionary.registerOre("itemSilicon", RSItems.SILICON);
|
||||
|
||||
// Processors
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_BASIC));
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_IMPROVED));
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_ADVANCED));
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_SILICON));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_BASIC));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_IMPROVED));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_ADVANCED));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_SILICON));
|
||||
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeProcessor(ItemProcessor.TYPE_BASIC));
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeProcessor(ItemProcessor.TYPE_IMPROVED));
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeProcessor(ItemProcessor.TYPE_ADVANCED));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeProcessor(ItemProcessor.TYPE_BASIC));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeProcessor(ItemProcessor.TYPE_IMPROVED));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeProcessor(ItemProcessor.TYPE_ADVANCED));
|
||||
|
||||
// Silicon
|
||||
GameRegistry.addSmelting(Items.QUARTZ, new ItemStack(RSItems.SILICON), 0.5f);
|
||||
@@ -215,7 +217,7 @@ public class CommonProxy {
|
||||
);
|
||||
|
||||
// Disk Drive
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(RSAPI.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
API.instance().getSoldererRegistry().addRecipe(API.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.DISK_DRIVE),
|
||||
500,
|
||||
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
@@ -257,7 +259,7 @@ public class CommonProxy {
|
||||
);
|
||||
|
||||
// Crafting Grid
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(RSAPI.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
API.instance().getSoldererRegistry().addRecipe(API.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.GRID, 1, EnumGridType.CRAFTING.getId()),
|
||||
500,
|
||||
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
@@ -266,7 +268,7 @@ public class CommonProxy {
|
||||
));
|
||||
|
||||
// Pattern Grid
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(RSAPI.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
API.instance().getSoldererRegistry().addRecipe(API.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.GRID, 1, EnumGridType.PATTERN.getId()),
|
||||
500,
|
||||
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
@@ -275,7 +277,7 @@ public class CommonProxy {
|
||||
));
|
||||
|
||||
// Fluid Grid
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(RSAPI.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
API.instance().getSoldererRegistry().addRecipe(API.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.GRID, 1, EnumGridType.FLUID.getId()),
|
||||
500,
|
||||
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
@@ -532,10 +534,10 @@ public class CommonProxy {
|
||||
'E', new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)
|
||||
));
|
||||
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_RANGE));
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_SPEED));
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_INTERDIMENSIONAL));
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_CRAFTING));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_RANGE));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_SPEED));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_INTERDIMENSIONAL));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_CRAFTING));
|
||||
|
||||
GameRegistry.addShapedRecipe(new ItemStack(RSItems.UPGRADE, 1, ItemUpgrade.TYPE_STACK),
|
||||
"USU",
|
||||
@@ -546,16 +548,16 @@ public class CommonProxy {
|
||||
);
|
||||
|
||||
// Storage Blocks
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeStorage(EnumItemStorageType.TYPE_1K, ItemStoragePart.TYPE_1K));
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeStorage(EnumItemStorageType.TYPE_4K, ItemStoragePart.TYPE_4K));
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeStorage(EnumItemStorageType.TYPE_16K, ItemStoragePart.TYPE_16K));
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeStorage(EnumItemStorageType.TYPE_64K, ItemStoragePart.TYPE_64K));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeStorage(EnumItemStorageType.TYPE_1K, ItemStoragePart.TYPE_1K));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeStorage(EnumItemStorageType.TYPE_4K, ItemStoragePart.TYPE_4K));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeStorage(EnumItemStorageType.TYPE_16K, ItemStoragePart.TYPE_16K));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeStorage(EnumItemStorageType.TYPE_64K, ItemStoragePart.TYPE_64K));
|
||||
|
||||
// Fluid Storage Blocks
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeFluidStorage(EnumFluidStorageType.TYPE_64K, ItemFluidStoragePart.TYPE_64K));
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeFluidStorage(EnumFluidStorageType.TYPE_128K, ItemFluidStoragePart.TYPE_128K));
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeFluidStorage(EnumFluidStorageType.TYPE_256K, ItemFluidStoragePart.TYPE_256K));
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeFluidStorage(EnumFluidStorageType.TYPE_512K, ItemFluidStoragePart.TYPE_512K));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeFluidStorage(EnumFluidStorageType.TYPE_64K, ItemFluidStoragePart.TYPE_64K));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeFluidStorage(EnumFluidStorageType.TYPE_128K, ItemFluidStoragePart.TYPE_128K));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeFluidStorage(EnumFluidStorageType.TYPE_256K, ItemFluidStoragePart.TYPE_256K));
|
||||
API.instance().getSoldererRegistry().addRecipe(new SoldererRecipeFluidStorage(EnumFluidStorageType.TYPE_512K, ItemFluidStoragePart.TYPE_512K));
|
||||
|
||||
// Crafting Monitor
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RSBlocks.CRAFTING_MONITOR),
|
||||
@@ -569,7 +571,7 @@ public class CommonProxy {
|
||||
));
|
||||
|
||||
// Interface
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(RSAPI.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
API.instance().getSoldererRegistry().addRecipe(API.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.INTERFACE),
|
||||
200,
|
||||
new ItemStack(RSBlocks.IMPORTER),
|
||||
@@ -578,7 +580,7 @@ public class CommonProxy {
|
||||
));
|
||||
|
||||
// Fluid Interface
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(RSAPI.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
API.instance().getSoldererRegistry().addRecipe(API.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.FLUID_INTERFACE),
|
||||
200,
|
||||
new ItemStack(Items.BUCKET),
|
||||
|
@@ -2,6 +2,7 @@ package refinedstorage.tile;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.apiimpl.API;
|
||||
|
||||
public class ClientNode {
|
||||
private ItemStack stack;
|
||||
@@ -40,7 +41,7 @@ public class ClientNode {
|
||||
return false;
|
||||
}
|
||||
|
||||
return energyUsage == ((ClientNode) other).energyUsage && RSAPI.instance().getComparer().isEqual(stack, ((ClientNode) other).stack);
|
||||
return energyUsage == ((ClientNode) other).energyUsage && API.instance().getComparer().isEqual(stack, ((ClientNode) other).stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -21,7 +21,6 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSBlocks;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
||||
import refinedstorage.api.autocrafting.ICraftingPatternProvider;
|
||||
@@ -39,6 +38,7 @@ import refinedstorage.api.storage.fluid.IGroupedFluidStorage;
|
||||
import refinedstorage.api.storage.item.IGroupedItemStorage;
|
||||
import refinedstorage.api.storage.item.IItemStorage;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.apiimpl.network.NetworkNodeGraph;
|
||||
import refinedstorage.apiimpl.network.WirelessGridHandler;
|
||||
import refinedstorage.apiimpl.network.grid.FluidGridHandler;
|
||||
@@ -408,7 +408,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
|
||||
for (ICraftingPattern craftingPattern : getPatterns()) {
|
||||
for (ItemStack output : craftingPattern.getOutputs()) {
|
||||
if (RSAPI.instance().getComparer().isEqual(output, pattern, flags)) {
|
||||
if (API.instance().getComparer().isEqual(output, pattern, flags)) {
|
||||
patterns.add(craftingPattern);
|
||||
}
|
||||
}
|
||||
@@ -692,7 +692,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
if (container instanceof ICraftingPatternContainer) {
|
||||
ICraftingPattern pattern = ((ICraftingPatternProvider) stack.getItem()).create(world, stack, (ICraftingPatternContainer) container);
|
||||
|
||||
ICraftingTaskFactory factory = RSAPI.instance().getCraftingTaskRegistry().getFactory(tag.getString(ICraftingTask.NBT_PATTERN_ID));
|
||||
ICraftingTaskFactory factory = API.instance().getCraftingTaskRegistry().getFactory(tag.getString(ICraftingTask.NBT_PATTERN_ID));
|
||||
|
||||
if (factory != null) {
|
||||
return factory.create(world, network, null, pattern, tag.getInteger(ICraftingTask.NBT_QUANTITY), tag);
|
||||
|
@@ -11,10 +11,10 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSBlocks;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.gui.GuiDetector;
|
||||
import refinedstorage.inventory.ItemHandlerBasic;
|
||||
import refinedstorage.inventory.ItemHandlerFluid;
|
||||
@@ -115,7 +115,7 @@ public class TileDetector extends TileNode implements IComparable, IType {
|
||||
|
||||
for (ICraftingTask task : network.getCraftingTasks()) {
|
||||
for (ItemStack output : task.getPattern().getOutputs()) {
|
||||
if (RSAPI.instance().getComparer().isEqualNoQuantity(slot, output)) {
|
||||
if (API.instance().getComparer().isEqualNoQuantity(slot, output)) {
|
||||
found = true;
|
||||
|
||||
break;
|
||||
|
@@ -9,9 +9,9 @@ import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.solderer.ISoldererRecipe;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.inventory.ItemHandlerBasic;
|
||||
import refinedstorage.inventory.ItemHandlerUpgrade;
|
||||
import refinedstorage.item.ItemUpgrade;
|
||||
@@ -51,9 +51,9 @@ public class TileSolderer extends TileNode {
|
||||
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
|
||||
Set<Integer> possibleSlots = new HashSet<>();
|
||||
|
||||
for (ISoldererRecipe recipe : RSAPI.instance().getSoldererRegistry().getRecipes()) {
|
||||
for (ISoldererRecipe recipe : API.instance().getSoldererRegistry().getRecipes()) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (RSAPI.instance().getComparer().isEqualNoQuantity(recipe.getRow(i), stack) || RSAPI.instance().getComparer().isEqualOredict(recipe.getRow(i), stack)) {
|
||||
if (API.instance().getComparer().isEqualNoQuantity(recipe.getRow(i), stack) || API.instance().getComparer().isEqualOredict(recipe.getRow(i), stack)) {
|
||||
possibleSlots.add(i);
|
||||
}
|
||||
}
|
||||
@@ -91,12 +91,12 @@ public class TileSolderer extends TileNode {
|
||||
if (items.getStackInSlot(1) == null && items.getStackInSlot(2) == null && result.getStackInSlot(0) == null) {
|
||||
stop();
|
||||
} else {
|
||||
ISoldererRecipe newRecipe = RSAPI.instance().getSoldererRegistry().getRecipe(items);
|
||||
ISoldererRecipe newRecipe = API.instance().getSoldererRegistry().getRecipe(items);
|
||||
|
||||
if (newRecipe == null) {
|
||||
stop();
|
||||
} else if (newRecipe != recipe) {
|
||||
boolean sameItem = result.getStackInSlot(0) != null ? RSAPI.instance().getComparer().isEqualNoQuantity(result.getStackInSlot(0), newRecipe.getResult()) : false;
|
||||
boolean sameItem = result.getStackInSlot(0) != null ? API.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()))) {
|
||||
recipe = newRecipe;
|
||||
@@ -156,7 +156,7 @@ public class TileSolderer extends TileNode {
|
||||
readItems(upgrades, 1, tag);
|
||||
readItems(result, 2, tag);
|
||||
|
||||
recipe = RSAPI.instance().getSoldererRegistry().getRecipe(items);
|
||||
recipe = API.instance().getSoldererRegistry().getRecipe(items);
|
||||
|
||||
if (tag.hasKey(NBT_WORKING)) {
|
||||
working = tag.getBoolean(NBT_WORKING);
|
||||
|
@@ -5,7 +5,7 @@ import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.inventory.ItemHandlerFluid;
|
||||
import refinedstorage.tile.data.ITileDataConsumer;
|
||||
import refinedstorage.tile.data.ITileDataProducer;
|
||||
@@ -41,7 +41,7 @@ public interface IFilterable {
|
||||
if (slot != null) {
|
||||
slots++;
|
||||
|
||||
if (RSAPI.instance().getComparer().isEqual(slot, stack, compare)) {
|
||||
if (API.instance().getComparer().isEqual(slot, stack, compare)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public interface IFilterable {
|
||||
for (int i = 0; i < filters.getSlots(); ++i) {
|
||||
ItemStack slot = filters.getStackInSlot(i);
|
||||
|
||||
if (slot != null && RSAPI.instance().getComparer().isEqual(slot, stack, compare)) {
|
||||
if (slot != null && API.instance().getComparer().isEqual(slot, stack, compare)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public interface IFilterable {
|
||||
if (slot != null) {
|
||||
slots++;
|
||||
|
||||
if (RSAPI.instance().getComparer().isEqual(slot, stack, compare)) {
|
||||
if (API.instance().getComparer().isEqual(slot, stack, compare)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public interface IFilterable {
|
||||
for (int i = 0; i < filters.getSlots(); ++i) {
|
||||
FluidStack slot = filters.getFluidStackInSlot(i);
|
||||
|
||||
if (slot != null && RSAPI.instance().getComparer().isEqual(slot, stack, compare)) {
|
||||
if (slot != null && API.instance().getComparer().isEqual(slot, stack, compare)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -7,8 +7,8 @@ import net.minecraft.network.datasync.DataSerializer;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.tile.ClientNode;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -67,7 +67,7 @@ public final class RSSerializers {
|
||||
int size = buf.readInt();
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
Function<ByteBuf, ICraftingMonitorElement> factory = RSAPI.instance().getCraftingMonitorElementRegistry().getFactory(ByteBufUtils.readUTF8String(buf));
|
||||
Function<ByteBuf, ICraftingMonitorElement> factory = API.instance().getCraftingMonitorElementRegistry().getFactory(ByteBufUtils.readUTF8String(buf));
|
||||
|
||||
if (factory != null) {
|
||||
elements.add(factory.apply(buf));
|
||||
|
@@ -3,9 +3,9 @@ package refinedstorage.tile.externalstorage;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.storage.fluid.IFluidStorage;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.apiimpl.storage.fluid.FluidUtils;
|
||||
import refinedstorage.tile.config.IFilterable;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class FluidStorageExternal implements IFluidStorage {
|
||||
public FluidStack extractFluid(@Nonnull FluidStack stack, int size, int flags) {
|
||||
FluidStack toDrain = FluidUtils.copyStackWithSize(stack, size);
|
||||
|
||||
if (RSAPI.instance().getComparer().isEqual(getContents(), toDrain, flags)) {
|
||||
if (API.instance().getComparer().isEqual(getContents(), toDrain, flags)) {
|
||||
return handler.drain(toDrain, true);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class FluidStorageExternal implements IFluidStorage {
|
||||
|
||||
if (cache == null) {
|
||||
cache = FluidUtils.copy(stack);
|
||||
} else if (!RSAPI.instance().getComparer().isEqual(stack, cache, IComparer.COMPARE_NBT | RSAPI.instance().getComparer().COMPARE_QUANTITY)) {
|
||||
} else if (!API.instance().getComparer().isEqual(stack, cache, IComparer.COMPARE_NBT | API.instance().getComparer().COMPARE_QUANTITY)) {
|
||||
cache = FluidUtils.copy(stack);
|
||||
|
||||
return true;
|
||||
|
@@ -3,7 +3,7 @@ package refinedstorage.tile.externalstorage;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.tile.config.IFilterable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -37,7 +37,7 @@ public class ItemStorageDSU extends ItemStorageExternal {
|
||||
public ItemStack insertItem(@Nonnull ItemStack stack, int size, boolean simulate) {
|
||||
if (IFilterable.canTake(externalStorage.getItemFilters(), externalStorage.getMode(), externalStorage.getCompare(), stack)) {
|
||||
if (unit.getStoredItemType() != null) {
|
||||
if (RSAPI.instance().getComparer().isEqualNoQuantity(unit.getStoredItemType(), stack)) {
|
||||
if (API.instance().getComparer().isEqualNoQuantity(unit.getStoredItemType(), stack)) {
|
||||
if (getStored() + size > unit.getMaxStoredCount()) {
|
||||
int remainingSpace = getCapacity() - getStored();
|
||||
|
||||
@@ -86,7 +86,7 @@ public class ItemStorageDSU extends ItemStorageExternal {
|
||||
|
||||
@Override
|
||||
public ItemStack extractItem(@Nonnull ItemStack stack, int size, int flags) {
|
||||
if (RSAPI.instance().getComparer().isEqual(stack, unit.getStoredItemType(), flags)) {
|
||||
if (API.instance().getComparer().isEqual(stack, unit.getStoredItemType(), flags)) {
|
||||
if (size > unit.getStoredItemType().stackSize) {
|
||||
size = unit.getStoredItemType().stackSize;
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.IVoidable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.tile.config.IFilterable;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -88,7 +88,7 @@ public class ItemStorageDrawer extends ItemStorageExternal {
|
||||
|
||||
@Override
|
||||
public ItemStack extractItem(ItemStack stack, int size, int flags) {
|
||||
if (RSAPI.instance().getComparer().isEqual(stack, drawer.getStoredItemPrototype(), flags) && drawer.canItemBeExtracted(stack)) {
|
||||
if (API.instance().getComparer().isEqual(stack, drawer.getStoredItemPrototype(), flags) && drawer.canItemBeExtracted(stack)) {
|
||||
if (size > drawer.getStoredItemCount()) {
|
||||
size = drawer.getStoredItemCount();
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package refinedstorage.tile.externalstorage;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.storage.item.IItemStorage;
|
||||
import refinedstorage.apiimpl.API;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -22,7 +22,7 @@ public abstract class ItemStorageExternal implements IItemStorage {
|
||||
return true;
|
||||
} else {
|
||||
for (int i = 0; i < items.size(); ++i) {
|
||||
if (!RSAPI.instance().getComparer().isEqual(items.get(i), cache.get(i))) {
|
||||
if (!API.instance().getComparer().isEqual(items.get(i), cache.get(i))) {
|
||||
cache = items;
|
||||
|
||||
return true;
|
||||
|
@@ -3,7 +3,7 @@ package refinedstorage.tile.externalstorage;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.tile.config.IFilterable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -54,7 +54,7 @@ public class ItemStorageItemHandler extends ItemStorageExternal {
|
||||
for (int i = 0; i < handler.getSlots(); ++i) {
|
||||
ItemStack slot = handler.getStackInSlot(i);
|
||||
|
||||
if (slot != null && RSAPI.instance().getComparer().isEqual(slot, stack, flags)) {
|
||||
if (slot != null && API.instance().getComparer().isEqual(slot, stack, flags)) {
|
||||
ItemStack got = handler.extractItem(i, remaining, false);
|
||||
|
||||
if (got != null) {
|
||||
|
@@ -16,9 +16,9 @@ import net.minecraftforge.items.wrapper.InvWrapper;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSBlocks;
|
||||
import refinedstorage.RSItems;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.network.grid.IFluidGridHandler;
|
||||
import refinedstorage.api.network.grid.IItemGridHandler;
|
||||
import refinedstorage.apiimpl.API;
|
||||
import refinedstorage.block.BlockGrid;
|
||||
import refinedstorage.block.EnumGridType;
|
||||
import refinedstorage.container.ContainerGrid;
|
||||
@@ -286,7 +286,7 @@ public class TileGrid extends TileNode implements IGrid {
|
||||
|
||||
craftedItems += crafted.stackSize;
|
||||
|
||||
if (!RSAPI.instance().getComparer().isEqual(crafted, result.getStackInSlot(0)) || craftedItems + crafted.stackSize > crafted.getMaxStackSize()) {
|
||||
if (!API.instance().getComparer().isEqual(crafted, result.getStackInSlot(0)) || craftedItems + crafted.stackSize > crafted.getMaxStackSize()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -363,7 +363,7 @@ public class TileGrid extends TileNode implements IGrid {
|
||||
if (!found) {
|
||||
for (ItemStack possibility : possibilities) {
|
||||
for (int j = 0; j < player.inventory.getSizeInventory(); ++j) {
|
||||
if (RSAPI.instance().getComparer().isEqualNoQuantity(possibility, player.inventory.getStackInSlot(j))) {
|
||||
if (API.instance().getComparer().isEqualNoQuantity(possibility, player.inventory.getStackInSlot(j))) {
|
||||
matrix.setInventorySlotContents(i, ItemHandlerHelper.copyStackWithSize(player.inventory.getStackInSlot(j), 1));
|
||||
|
||||
player.inventory.decrStackSize(j, 1);
|
||||
|
Reference in New Issue
Block a user