Merge branch 'mc1.10' of https://github.com/raoulvdberge/refinedstorage into void_excess_storage_block
This commit is contained in:
@@ -15,8 +15,8 @@ import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import refinedstorage.proxy.CommonProxy;
|
||||
|
||||
@Mod(modid = RefinedStorage.ID, version = RefinedStorage.VERSION, guiFactory = RefinedStorage.GUI_FACTORY, dependencies = RefinedStorage.DEPENDENCIES)
|
||||
public final class RefinedStorage {
|
||||
@Mod(modid = RS.ID, version = RS.VERSION, guiFactory = RS.GUI_FACTORY, dependencies = RS.DEPENDENCIES)
|
||||
public final class RS {
|
||||
public static final String ID = "refinedstorage";
|
||||
public static final String VERSION = "1.2";
|
||||
public static final String DEPENDENCIES = "required-after:Forge@[12.18.1.2088,);required-after:mcmultipart@[1.2.1,);after:JEI@[3.12.0,);";
|
||||
@@ -26,16 +26,16 @@ public final class RefinedStorage {
|
||||
public static CommonProxy PROXY;
|
||||
|
||||
@Instance
|
||||
public static RefinedStorage INSTANCE;
|
||||
public static RS INSTANCE;
|
||||
|
||||
public RefinedStorageConfig config;
|
||||
public RSConfig config;
|
||||
|
||||
public final SimpleNetworkWrapper network = NetworkRegistry.INSTANCE.newSimpleChannel(ID);
|
||||
|
||||
public final CreativeTabs tab = new CreativeTabs(ID) {
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
return new ItemStack(RefinedStorageItems.STORAGE_HOUSING);
|
||||
return new ItemStack(RSItems.STORAGE_HOUSING);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,7 +50,7 @@ public final class RefinedStorage {
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent e) {
|
||||
config = new RefinedStorageConfig(e.getSuggestedConfigurationFile());
|
||||
config = new RSConfig(e.getSuggestedConfigurationFile());
|
||||
|
||||
PROXY.preInit(e);
|
||||
}
|
||||
@@ -1,30 +1,30 @@
|
||||
package refinedstorage;
|
||||
|
||||
import refinedstorage.block.*;
|
||||
|
||||
public final class RefinedStorageBlocks {
|
||||
public static final BlockController CONTROLLER = new BlockController();
|
||||
public static final BlockCable CABLE = new BlockCable();
|
||||
public static final BlockGrid GRID = new BlockGrid();
|
||||
public static final BlockDiskDrive DISK_DRIVE = new BlockDiskDrive();
|
||||
public static final BlockExternalStorage EXTERNAL_STORAGE = new BlockExternalStorage();
|
||||
public static final BlockImporter IMPORTER = new BlockImporter();
|
||||
public static final BlockExporter EXPORTER = new BlockExporter();
|
||||
public static final BlockDetector DETECTOR = new BlockDetector();
|
||||
public static final BlockMachineCasing MACHINE_CASING = new BlockMachineCasing();
|
||||
public static final BlockSolderer SOLDERER = new BlockSolderer();
|
||||
public static final BlockDestructor DESTRUCTOR = new BlockDestructor();
|
||||
public static final BlockConstructor CONSTRUCTOR = new BlockConstructor();
|
||||
public static final BlockStorage STORAGE = new BlockStorage();
|
||||
public static final BlockRelay RELAY = new BlockRelay();
|
||||
public static final BlockInterface INTERFACE = new BlockInterface();
|
||||
public static final BlockCraftingMonitor CRAFTING_MONITOR = new BlockCraftingMonitor();
|
||||
public static final BlockWirelessTransmitter WIRELESS_TRANSMITTER = new BlockWirelessTransmitter();
|
||||
public static final BlockCrafter CRAFTER = new BlockCrafter();
|
||||
public static final BlockProcessingPatternEncoder PROCESSING_PATTERN_ENCODER = new BlockProcessingPatternEncoder();
|
||||
public static final BlockNetworkTransmitter NETWORK_TRANSMITTER = new BlockNetworkTransmitter();
|
||||
public static final BlockNetworkReceiver NETWORK_RECEIVER = new BlockNetworkReceiver();
|
||||
public static final BlockFluidInterface FLUID_INTERFACE = new BlockFluidInterface();
|
||||
public static final BlockFluidStorage FLUID_STORAGE = new BlockFluidStorage();
|
||||
public static final BlockDiskManipulator DISK_MANIPULATOR = new BlockDiskManipulator();
|
||||
package refinedstorage;
|
||||
|
||||
import refinedstorage.block.*;
|
||||
|
||||
public final class RSBlocks {
|
||||
public static final BlockController CONTROLLER = new BlockController();
|
||||
public static final BlockCable CABLE = new BlockCable();
|
||||
public static final BlockGrid GRID = new BlockGrid();
|
||||
public static final BlockDiskDrive DISK_DRIVE = new BlockDiskDrive();
|
||||
public static final BlockExternalStorage EXTERNAL_STORAGE = new BlockExternalStorage();
|
||||
public static final BlockImporter IMPORTER = new BlockImporter();
|
||||
public static final BlockExporter EXPORTER = new BlockExporter();
|
||||
public static final BlockDetector DETECTOR = new BlockDetector();
|
||||
public static final BlockMachineCasing MACHINE_CASING = new BlockMachineCasing();
|
||||
public static final BlockSolderer SOLDERER = new BlockSolderer();
|
||||
public static final BlockDestructor DESTRUCTOR = new BlockDestructor();
|
||||
public static final BlockConstructor CONSTRUCTOR = new BlockConstructor();
|
||||
public static final BlockStorage STORAGE = new BlockStorage();
|
||||
public static final BlockRelay RELAY = new BlockRelay();
|
||||
public static final BlockInterface INTERFACE = new BlockInterface();
|
||||
public static final BlockCraftingMonitor CRAFTING_MONITOR = new BlockCraftingMonitor();
|
||||
public static final BlockWirelessTransmitter WIRELESS_TRANSMITTER = new BlockWirelessTransmitter();
|
||||
public static final BlockCrafter CRAFTER = new BlockCrafter();
|
||||
public static final BlockProcessingPatternEncoder PROCESSING_PATTERN_ENCODER = new BlockProcessingPatternEncoder();
|
||||
public static final BlockNetworkTransmitter NETWORK_TRANSMITTER = new BlockNetworkTransmitter();
|
||||
public static final BlockNetworkReceiver NETWORK_RECEIVER = new BlockNetworkReceiver();
|
||||
public static final BlockFluidInterface FLUID_INTERFACE = new BlockFluidInterface();
|
||||
public static final BlockFluidStorage FLUID_STORAGE = new BlockFluidStorage();
|
||||
public static final BlockDiskManipulator DISK_MANIPULATOR = new BlockDiskManipulator();
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class RefinedStorageConfig {
|
||||
public final class RSConfig {
|
||||
private Configuration config;
|
||||
|
||||
//region Energy
|
||||
@@ -80,7 +80,7 @@ public final class RefinedStorageConfig {
|
||||
private static final String MISC = "misc";
|
||||
//endregion
|
||||
|
||||
public RefinedStorageConfig(File configFile) {
|
||||
public RSConfig(File configFile) {
|
||||
config = new Configuration(configFile);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
@@ -94,7 +94,7 @@ public final class RefinedStorageConfig {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) {
|
||||
if (event.getModID().equalsIgnoreCase(RefinedStorage.ID)) {
|
||||
if (event.getModID().equalsIgnoreCase(RS.ID)) {
|
||||
loadConfig();
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,27 @@
|
||||
package refinedstorage;
|
||||
|
||||
public final class RefinedStorageGui {
|
||||
public static final int CONTROLLER = 0;
|
||||
public static final int GRID = 1;
|
||||
public static final int DISK_DRIVE = 2;
|
||||
public static final int IMPORTER = 3;
|
||||
public static final int EXPORTER = 4;
|
||||
public static final int DETECTOR = 5;
|
||||
public static final int SOLDERER = 6;
|
||||
public static final int DESTRUCTOR = 7;
|
||||
public static final int CONSTRUCTOR = 8;
|
||||
public static final int STORAGE = 9;
|
||||
public static final int RELAY = 10;
|
||||
public static final int INTERFACE = 11;
|
||||
public static final int WIRELESS_GRID = 12;
|
||||
public static final int CRAFTING_MONITOR = 13;
|
||||
public static final int WIRELESS_TRANSMITTER = 14;
|
||||
public static final int CRAFTER = 15;
|
||||
public static final int PROCESSING_PATTERN_ENCODER = 16;
|
||||
public static final int GRID_FILTER = 17;
|
||||
public static final int NETWORK_TRANSMITTER = 18;
|
||||
public static final int FLUID_INTERFACE = 19;
|
||||
public static final int EXTERNAL_STORAGE = 20;
|
||||
public static final int FLUID_STORAGE = 21;
|
||||
public static final int DISK_MANIPULATOR = 22;
|
||||
}
|
||||
package refinedstorage;
|
||||
|
||||
public final class RSGui {
|
||||
public static final int CONTROLLER = 0;
|
||||
public static final int GRID = 1;
|
||||
public static final int DISK_DRIVE = 2;
|
||||
public static final int IMPORTER = 3;
|
||||
public static final int EXPORTER = 4;
|
||||
public static final int DETECTOR = 5;
|
||||
public static final int SOLDERER = 6;
|
||||
public static final int DESTRUCTOR = 7;
|
||||
public static final int CONSTRUCTOR = 8;
|
||||
public static final int STORAGE = 9;
|
||||
public static final int RELAY = 10;
|
||||
public static final int INTERFACE = 11;
|
||||
public static final int WIRELESS_GRID = 12;
|
||||
public static final int CRAFTING_MONITOR = 13;
|
||||
public static final int WIRELESS_TRANSMITTER = 14;
|
||||
public static final int CRAFTER = 15;
|
||||
public static final int PROCESSING_PATTERN_ENCODER = 16;
|
||||
public static final int GRID_FILTER = 17;
|
||||
public static final int NETWORK_TRANSMITTER = 18;
|
||||
public static final int FLUID_INTERFACE = 19;
|
||||
public static final int EXTERNAL_STORAGE = 20;
|
||||
public static final int FLUID_STORAGE = 21;
|
||||
public static final int DISK_MANIPULATOR = 22;
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
package refinedstorage;
|
||||
|
||||
import refinedstorage.item.*;
|
||||
|
||||
public final class RefinedStorageItems {
|
||||
public static final ItemStorageDisk STORAGE_DISK = new ItemStorageDisk();
|
||||
public static final ItemWirelessGrid WIRELESS_GRID = new ItemWirelessGrid();
|
||||
public static final ItemQuartzEnrichedIron QUARTZ_ENRICHED_IRON = new ItemQuartzEnrichedIron();
|
||||
public static final ItemCore CORE = new ItemCore();
|
||||
public static final ItemSilicon SILICON = new ItemSilicon();
|
||||
public static final ItemProcessor PROCESSOR = new ItemProcessor();
|
||||
public static final ItemStoragePart STORAGE_PART = new ItemStoragePart();
|
||||
public static final ItemPattern PATTERN = new ItemPattern();
|
||||
public static final ItemUpgrade UPGRADE = new ItemUpgrade();
|
||||
public static final ItemStorageHousing STORAGE_HOUSING = new ItemStorageHousing();
|
||||
public static final ItemGridFilter GRID_FILTER = new ItemGridFilter();
|
||||
public static final ItemNetworkCard NETWORK_CARD = new ItemNetworkCard();
|
||||
public static final ItemFluidStorageDisk FLUID_STORAGE_DISK = new ItemFluidStorageDisk();
|
||||
public static final ItemFluidStoragePart FLUID_STORAGE_PART = new ItemFluidStoragePart();
|
||||
}
|
||||
package refinedstorage;
|
||||
|
||||
import refinedstorage.item.*;
|
||||
|
||||
public final class RSItems {
|
||||
public static final ItemStorageDisk STORAGE_DISK = new ItemStorageDisk();
|
||||
public static final ItemWirelessGrid WIRELESS_GRID = new ItemWirelessGrid();
|
||||
public static final ItemQuartzEnrichedIron QUARTZ_ENRICHED_IRON = new ItemQuartzEnrichedIron();
|
||||
public static final ItemCore CORE = new ItemCore();
|
||||
public static final ItemSilicon SILICON = new ItemSilicon();
|
||||
public static final ItemProcessor PROCESSOR = new ItemProcessor();
|
||||
public static final ItemStoragePart STORAGE_PART = new ItemStoragePart();
|
||||
public static final ItemPattern PATTERN = new ItemPattern();
|
||||
public static final ItemUpgrade UPGRADE = new ItemUpgrade();
|
||||
public static final ItemStorageHousing STORAGE_HOUSING = new ItemStorageHousing();
|
||||
public static final ItemGridFilter GRID_FILTER = new ItemGridFilter();
|
||||
public static final ItemNetworkCard NETWORK_CARD = new ItemNetworkCard();
|
||||
public static final ItemFluidStorageDisk FLUID_STORAGE_DISK = new ItemFluidStorageDisk();
|
||||
public static final ItemFluidStoragePart FLUID_STORAGE_PART = new ItemFluidStoragePart();
|
||||
}
|
||||
45
src/main/java/refinedstorage/RSUtils.java
Executable file
45
src/main/java/refinedstorage/RSUtils.java
Executable file
@@ -0,0 +1,45 @@
|
||||
package refinedstorage;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.item.Item;
|
||||
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.storage.fluid.FluidStorageNBT;
|
||||
import refinedstorage.apiimpl.storage.item.ItemStorageNBT;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public final class RSUtils {
|
||||
public static void writeItemStack(ByteBuf buf, INetworkMaster network, ItemStack stack) {
|
||||
buf.writeInt(Item.getIdFromItem(stack.getItem()));
|
||||
buf.writeInt(stack.stackSize);
|
||||
buf.writeInt(stack.getItemDamage());
|
||||
ByteBufUtils.writeTag(buf, stack.getTagCompound());
|
||||
buf.writeInt(RSAPI.instance().getItemStackHashCode(stack));
|
||||
buf.writeBoolean(network.hasPattern(stack));
|
||||
}
|
||||
|
||||
public static void writeFluidStack(ByteBuf buf, FluidStack stack) {
|
||||
buf.writeInt(RSAPI.instance().getFluidStackHashCode(stack));
|
||||
ByteBufUtils.writeUTF8String(buf, FluidRegistry.getFluidName(stack.getFluid()));
|
||||
buf.writeInt(stack.amount);
|
||||
ByteBufUtils.writeTag(buf, stack.tag);
|
||||
}
|
||||
|
||||
public static void constructFromDrive(ItemStack disk, int slot, ItemStorageNBT[] itemStorages, FluidStorageNBT[] fluidStorages, Function<ItemStack, ItemStorageNBT> itemStorageSupplier, Function<ItemStack, FluidStorageNBT> fluidStorageNBTSupplier) {
|
||||
if (disk == null) {
|
||||
itemStorages[slot] = null;
|
||||
fluidStorages[slot] = null;
|
||||
} else {
|
||||
if (disk.getItem() == RSItems.STORAGE_DISK) {
|
||||
itemStorages[slot] = itemStorageSupplier.apply(disk);
|
||||
} else if (disk.getItem() == RSItems.FLUID_STORAGE_DISK) {
|
||||
fluidStorages[slot] = fluidStorageNBTSupplier.apply(disk);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
package refinedstorage.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElementRegistry;
|
||||
import refinedstorage.api.autocrafting.registry.ICraftingTaskRegistry;
|
||||
import refinedstorage.api.solderer.ISoldererRegistry;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.api.util.IItemStackList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -10,6 +14,12 @@ import javax.annotation.Nonnull;
|
||||
* Represents a Refined Storage API implementation.
|
||||
*/
|
||||
public interface IAPI {
|
||||
/**
|
||||
* @return the comparer
|
||||
*/
|
||||
@Nonnull
|
||||
IComparer getComparer();
|
||||
|
||||
/**
|
||||
* @return the solderer registry
|
||||
*/
|
||||
@@ -27,4 +37,22 @@ public interface IAPI {
|
||||
*/
|
||||
@Nonnull
|
||||
ICraftingMonitorElementRegistry getCraftingMonitorElementRegistry();
|
||||
|
||||
/**
|
||||
* @return an empty item stack list
|
||||
*/
|
||||
@Nonnull
|
||||
IItemStackList createItemStackList();
|
||||
|
||||
/**
|
||||
* @param stack the stack
|
||||
* @return a hashcode for the given stack
|
||||
*/
|
||||
int getItemStackHashCode(ItemStack stack);
|
||||
|
||||
/**
|
||||
* @param stack the stack
|
||||
* @return a hashcode for the given stack
|
||||
*/
|
||||
int getFluidStackHashCode(FluidStack stack);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package refinedstorage.api;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public final class RefinedStorageAPI {
|
||||
public final class RSAPI {
|
||||
private static final String API_IMPL_CLASS = "refinedstorage.apiimpl.API";
|
||||
private static final String API_IMPL_FIELD = "INSTANCE";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package refinedstorage.api.autocrafting.registry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
@@ -19,11 +20,12 @@ public interface ICraftingTaskFactory {
|
||||
*
|
||||
* @param world the world
|
||||
* @param network the network
|
||||
* @param stack the stack to create task for
|
||||
* @param pattern the pattern
|
||||
* @param quantity the quantity
|
||||
* @param tag the NBT tag, if this is null it isn't reading from disk but is used for making a task on demand
|
||||
* @return the crafting task
|
||||
*/
|
||||
@Nonnull
|
||||
ICraftingTask create(World world, INetworkMaster network, ICraftingPattern pattern, int quantity, @Nullable NBTTagCompound tag);
|
||||
ICraftingTask create(World world, INetworkMaster network, @Nullable ItemStack stack, ICraftingPattern pattern, int quantity, @Nullable NBTTagCompound tag);
|
||||
}
|
||||
|
||||
@@ -6,13 +6,14 @@ 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;
|
||||
import refinedstorage.api.network.grid.IItemGridHandler;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.storage.fluid.IGroupedFluidStorage;
|
||||
import refinedstorage.api.storage.item.IGroupedItemStorage;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -123,6 +124,68 @@ public interface INetworkMaster {
|
||||
@Nullable
|
||||
ICraftingPattern getPattern(ItemStack pattern, int flags);
|
||||
|
||||
/**
|
||||
* Returns a crafting pattern for an item stack.
|
||||
* This returns a single crafting pattern, as opposed to {@link INetworkMaster#getPatterns(ItemStack, int)}.
|
||||
* Internally, this makes a selection out of the available patterns.
|
||||
* It makes this selection based on the item count of the pattern outputs in the system.
|
||||
*
|
||||
* @param pattern the stack to get a pattern for
|
||||
* @return the pattern, or null if the pattern is not found
|
||||
*/
|
||||
default ICraftingPattern getPattern(ItemStack pattern) {
|
||||
return getPattern(pattern, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if there is a pattern with a given stack as output.
|
||||
*
|
||||
* @param stack the stack
|
||||
* @return true if there is a pattern, false otherwise
|
||||
*/
|
||||
default boolean hasPattern(ItemStack stack) {
|
||||
return getPattern(stack) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a crafting task.
|
||||
*
|
||||
* @param stack the stack to create a task for
|
||||
* @param pattern the pattern
|
||||
* @param quantity the quantity
|
||||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules a crafting task if the task isn't scheduled yet.
|
||||
*
|
||||
* @param stack the stack
|
||||
* @param toSchedule the amount of tasks to schedule
|
||||
* @param compare the compare value to find patterns
|
||||
*/
|
||||
default void scheduleCraftingTaskIfUnscheduled(ItemStack stack, int toSchedule, int compare) {
|
||||
int alreadyScheduled = 0;
|
||||
|
||||
for (ICraftingTask task : getCraftingTasks()) {
|
||||
for (ItemStack output : task.getPattern().getOutputs()) {
|
||||
if (RSAPI.instance().getComparer().isEqual(output, stack, compare)) {
|
||||
alreadyScheduled++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < toSchedule - alreadyScheduled; ++i) {
|
||||
ICraftingPattern pattern = getPattern(stack, compare);
|
||||
|
||||
if (pattern != null) {
|
||||
addCraftingTask(createCraftingTask(stack, pattern, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a grid update packet with all the items to all clients that are watching a grid connected to this network.
|
||||
*/
|
||||
@@ -181,6 +244,17 @@ public interface INetworkMaster {
|
||||
@Nullable
|
||||
ItemStack extractItem(@Nonnull ItemStack stack, int size, int flags);
|
||||
|
||||
/**
|
||||
* Extracts an item from this network.
|
||||
*
|
||||
* @param stack the prototype of the stack to extract, do NOT modify
|
||||
* @param size the amount of that prototype that has to be extracted
|
||||
* @return null if we didn't extract anything, or a stack with the result
|
||||
*/
|
||||
default ItemStack extractItem(ItemStack stack, int size) {
|
||||
return extractItem(stack, size, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a fluid in this network.
|
||||
*
|
||||
@@ -203,6 +277,17 @@ public interface INetworkMaster {
|
||||
@Nullable
|
||||
FluidStack extractFluid(@Nonnull FluidStack stack, int size, int flags);
|
||||
|
||||
/**
|
||||
* Extracts a fluid from this network.
|
||||
*
|
||||
* @param stack the prototype of the stack to extract, do NOT modify
|
||||
* @param size the amount of that prototype that has to be extracted
|
||||
* @return null if we didn't extract anything, or a stack with the result
|
||||
*/
|
||||
default FluidStack extractFluid(FluidStack stack, int size) {
|
||||
return extractFluid(stack, size, IComparer.COMPARE_NBT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the world where this network is in
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,7 @@ package refinedstorage.api.network;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -11,10 +12,17 @@ public interface INetworkNodeGraph {
|
||||
/**
|
||||
* Rebuilds the node graph.
|
||||
*
|
||||
* @param start the starting position to start looking for nodes
|
||||
* @param start the starting position to start looking for nodes, or null to start at network begin position
|
||||
* @param notify true to notify the nodes of a connection change, false to not notify
|
||||
*/
|
||||
void rebuild(BlockPos start, boolean notify);
|
||||
void rebuild(@Nullable BlockPos start, boolean notify);
|
||||
|
||||
/**
|
||||
* Rebuilds the network graph.
|
||||
*/
|
||||
default void rebuild() {
|
||||
rebuild(null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a list of all connected nodes
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
package refinedstorage.api.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||
import refinedstorage.api.RefinedStorageAPI;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
||||
import refinedstorage.api.autocrafting.ICraftingPatternProvider;
|
||||
import refinedstorage.api.autocrafting.registry.ICraftingTaskFactory;
|
||||
import refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
|
||||
/**
|
||||
* Utilities for network manipulation.
|
||||
*/
|
||||
public final class NetworkUtils {
|
||||
public static ItemStack extractItem(INetworkMaster network, ItemStack stack, int size) {
|
||||
return network.extractItem(stack, size, CompareUtils.COMPARE_DAMAGE | CompareUtils.COMPARE_NBT);
|
||||
}
|
||||
|
||||
public static FluidStack extractFluid(INetworkMaster network, FluidStack stack, int size) {
|
||||
return network.extractFluid(stack, size, CompareUtils.COMPARE_NBT);
|
||||
}
|
||||
|
||||
public static ICraftingPattern getPattern(INetworkMaster network, ItemStack stack) {
|
||||
return network.getPattern(stack, CompareUtils.COMPARE_DAMAGE | CompareUtils.COMPARE_NBT);
|
||||
}
|
||||
|
||||
public static ICraftingTask createCraftingTask(INetworkMaster network, ICraftingPattern pattern, int quantity) {
|
||||
return RefinedStorageAPI.instance().getCraftingTaskRegistry().getFactory(pattern.getId()).create(network.getNetworkWorld(), network, pattern, quantity, null);
|
||||
}
|
||||
|
||||
public static boolean hasPattern(INetworkMaster network, ItemStack stack) {
|
||||
return getPattern(network, stack) != null;
|
||||
}
|
||||
|
||||
public static void rebuildGraph(INetworkMaster network) {
|
||||
network.getNodeGraph().rebuild(network.getPosition(), true);
|
||||
}
|
||||
|
||||
public static int getItemStackHashCode(ItemStack stack) {
|
||||
return stack.getItem().hashCode() * (stack.getItemDamage() + 1) * (stack.hasTagCompound() ? stack.getTagCompound().hashCode() : 1);
|
||||
}
|
||||
|
||||
public static int getFluidStackHashCode(FluidStack stack) {
|
||||
return stack.getFluid().hashCode() * (stack.tag != null ? stack.tag.hashCode() : 1);
|
||||
}
|
||||
|
||||
public static void scheduleCraftingTaskIfUnscheduled(INetworkMaster network, ItemStack stack, int toSchedule, int compare) {
|
||||
int alreadyScheduled = 0;
|
||||
|
||||
for (ICraftingTask task : network.getCraftingTasks()) {
|
||||
for (ItemStack output : task.getPattern().getOutputs()) {
|
||||
if (CompareUtils.compareStack(output, stack, compare)) {
|
||||
alreadyScheduled++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < toSchedule - alreadyScheduled; ++i) {
|
||||
ICraftingPattern pattern = network.getPattern(stack, compare);
|
||||
|
||||
if (pattern != null) {
|
||||
network.addCraftingTask(createCraftingTask(network, pattern, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ICraftingTask readCraftingTask(World world, INetworkMaster network, NBTTagCompound tag) {
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag(ICraftingTask.NBT_PATTERN_STACK));
|
||||
|
||||
if (stack != null && stack.getItem() instanceof ICraftingPatternProvider) {
|
||||
TileEntity container = world.getTileEntity(BlockPos.fromLong(tag.getLong(ICraftingTask.NBT_PATTERN_CONTAINER)));
|
||||
|
||||
if (container instanceof ICraftingPatternContainer) {
|
||||
ICraftingPattern pattern = ((ICraftingPatternProvider) stack.getItem()).create(world, stack, (ICraftingPatternContainer) container);
|
||||
|
||||
ICraftingTaskFactory factory = RefinedStorageAPI.instance().getCraftingTaskRegistry().getFactory(tag.getString(ICraftingTask.NBT_PATTERN_ID));
|
||||
|
||||
if (factory != null) {
|
||||
return factory.create(world, network, pattern, tag.getInteger(ICraftingTask.NBT_QUANTITY), tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void writeItemStack(ByteBuf buf, INetworkMaster network, ItemStack stack) {
|
||||
buf.writeInt(Item.getIdFromItem(stack.getItem()));
|
||||
buf.writeInt(stack.stackSize);
|
||||
buf.writeInt(stack.getItemDamage());
|
||||
ByteBufUtils.writeTag(buf, stack.getTagCompound());
|
||||
buf.writeInt(getItemStackHashCode(stack));
|
||||
buf.writeBoolean(hasPattern(network, stack));
|
||||
}
|
||||
|
||||
public static void writeFluidStack(ByteBuf buf, FluidStack stack) {
|
||||
buf.writeInt(getFluidStackHashCode(stack));
|
||||
ByteBufUtils.writeUTF8String(buf, FluidRegistry.getFluidName(stack.getFluid()));
|
||||
buf.writeInt(stack.amount);
|
||||
ByteBufUtils.writeTag(buf, stack.tag);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package refinedstorage.api.storage.fluid;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -2,14 +2,14 @@ package refinedstorage.api.storage.fluid;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**e
|
||||
/**
|
||||
* e
|
||||
* This holds all fluids from all the connected storages from a {@link INetworkMaster}.
|
||||
* <p>
|
||||
* Refined Storage uses this class mainly for use in Grids and Detectors to avoid querying
|
||||
|
||||
@@ -2,11 +2,9 @@ package refinedstorage.api.storage.item;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.util.IItemStackList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -47,34 +45,9 @@ public interface IGroupedItemStorage {
|
||||
void remove(@Nonnull ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets an item from the network.
|
||||
*
|
||||
* @param stack the stack to find
|
||||
* @param flags the flags to compare on, see {@link CompareUtils}
|
||||
* @return null if no item is found, or the stack, do NOT modify
|
||||
* @return the list behind this grouped storage
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack get(@Nonnull ItemStack stack, int flags);
|
||||
|
||||
/**
|
||||
* Gets an item from the network by hash, see {@link refinedstorage.api.network.NetworkUtils#getItemStackHashCode(ItemStack)}.
|
||||
*
|
||||
* @return null if no item is found matching the hash, or the stack, do NOT modify
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack get(int hash);
|
||||
|
||||
/**
|
||||
* Copies a grouped item storage.
|
||||
*
|
||||
* @return the storage
|
||||
*/
|
||||
IGroupedItemStorage copy();
|
||||
|
||||
/**
|
||||
* @return all items in this storage network
|
||||
*/
|
||||
Collection<ItemStack> getStacks();
|
||||
IItemStackList getList();
|
||||
|
||||
/**
|
||||
* @return the item storages connected to this network
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package refinedstorage.api.storage.item;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
73
src/main/java/refinedstorage/api/util/IComparer.java
Executable file
73
src/main/java/refinedstorage/api/util/IComparer.java
Executable 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);
|
||||
}
|
||||
80
src/main/java/refinedstorage/api/util/IItemStackList.java
Executable file
80
src/main/java/refinedstorage/api/util/IItemStackList.java
Executable file
@@ -0,0 +1,80 @@
|
||||
package refinedstorage.api.util;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* An item stack list.
|
||||
*/
|
||||
public interface IItemStackList {
|
||||
/**
|
||||
* Adds a stack to the list, will merge it with another stack if it already exists in the list.
|
||||
*
|
||||
* @param stack the stack
|
||||
*/
|
||||
void add(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Decrements the count of that stack in the list.
|
||||
*
|
||||
* @param stack the stack
|
||||
* @param removeIfReachedZero true to remove the stack if the count reaches 0, false otherwise
|
||||
* @return whether the remove was successful
|
||||
*/
|
||||
boolean remove(@Nonnull ItemStack stack, boolean removeIfReachedZero);
|
||||
|
||||
/**
|
||||
* Returns a stack.
|
||||
*
|
||||
* @param stack the stack to search for
|
||||
* @return the stack, or null if no stack was found
|
||||
*/
|
||||
@Nullable
|
||||
default ItemStack get(@Nonnull ItemStack stack) {
|
||||
return get(stack, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stack.
|
||||
*
|
||||
* @param stack the stack to search for
|
||||
* @param flags the flags to compare on, see {@link refinedstorage.api.storage.CompareUtils}
|
||||
* @return the stack, or null if no stack was found
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack get(@Nonnull ItemStack stack, int flags);
|
||||
|
||||
/**
|
||||
* Returns a stack.
|
||||
*
|
||||
* @param hash the hash of the stack to search for, see {@link refinedstorage.api.network.NetworkUtils#getItemStackHashCode(ItemStack)}
|
||||
* @return the stack, or null if no stack was found
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack get(int hash);
|
||||
|
||||
/**
|
||||
* Clears the list.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* @return true if the list is empty, false otherwise
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* @return a collection of stacks in this list
|
||||
*/
|
||||
@Nonnull
|
||||
Collection<ItemStack> getStacks();
|
||||
|
||||
/**
|
||||
* @return a new copy of this list, with the stacks in it copied as well
|
||||
*/
|
||||
@Nonnull
|
||||
IItemStackList copy();
|
||||
}
|
||||
@@ -1,22 +1,35 @@
|
||||
package refinedstorage.apiimpl;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import refinedstorage.api.IAPI;
|
||||
import refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElementRegistry;
|
||||
import refinedstorage.api.autocrafting.registry.ICraftingTaskRegistry;
|
||||
import refinedstorage.api.solderer.ISoldererRegistry;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.api.util.IItemStackList;
|
||||
import refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementRegistry;
|
||||
import refinedstorage.apiimpl.autocrafting.registry.CraftingTaskRegistry;
|
||||
import refinedstorage.apiimpl.solderer.SoldererRegistry;
|
||||
import refinedstorage.apiimpl.util.Comparer;
|
||||
import refinedstorage.apiimpl.util.ItemStackList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class API implements IAPI {
|
||||
public static final IAPI INSTANCE = new API();
|
||||
|
||||
private IComparer comparer = new Comparer();
|
||||
private ISoldererRegistry soldererRegistry = new SoldererRegistry();
|
||||
private ICraftingTaskRegistry craftingTaskRegistry = new CraftingTaskRegistry();
|
||||
private ICraftingMonitorElementRegistry craftingMonitorElementRegistry = new CraftingMonitorElementRegistry();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IComparer getComparer() {
|
||||
return comparer;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ISoldererRegistry getSoldererRegistry() {
|
||||
@@ -34,4 +47,20 @@ public class API implements IAPI {
|
||||
public ICraftingMonitorElementRegistry getCraftingMonitorElementRegistry() {
|
||||
return craftingMonitorElementRegistry;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IItemStackList createItemStackList() {
|
||||
return new ItemStackList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemStackHashCode(ItemStack stack) {
|
||||
return stack.getItem().hashCode() * (stack.getItemDamage() + 1) * (stack.hasTagCompound() ? stack.getTagCompound().hashCode() : 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidStackHashCode(FluidStack stack) {
|
||||
return stack.getFluid().hashCode() * (stack.tag != null ? stack.tag.hashCode() : 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.api.storage.CompareUtils;
|
||||
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 (CompareUtils.compareStackNoQuantity(requested, output)) {
|
||||
if (RSAPI.instance().getComparer().isEqualNoQuantity(requested, output)) {
|
||||
quantity += output.stackSize;
|
||||
|
||||
if (!ItemPattern.isProcessing(stack)) {
|
||||
@@ -123,10 +123,10 @@ public class CraftingPattern implements ICraftingPattern {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftingPattern{" +
|
||||
"container=" + container +
|
||||
", inputs=" + inputs +
|
||||
", outputs=" + outputs +
|
||||
", byproducts=" + byproducts +
|
||||
'}';
|
||||
"container=" + container +
|
||||
", inputs=" + inputs +
|
||||
", outputs=" + outputs +
|
||||
", byproducts=" + byproducts +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package refinedstorage.apiimpl.autocrafting.registry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
@@ -16,7 +17,7 @@ public class CraftingTaskFactoryNormal implements ICraftingTaskFactory {
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ICraftingTask create(World world, INetworkMaster network, ICraftingPattern pattern, int quantity, @Nullable NBTTagCompound tag) {
|
||||
return new CraftingTaskNormal(network, pattern, quantity);
|
||||
public ICraftingTask create(World world, INetworkMaster network, @Nullable ItemStack stack, ICraftingPattern pattern, int quantity, @Nullable NBTTagCompound tag) {
|
||||
return new CraftingTaskNormal(network, stack, pattern, quantity);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,15 @@
|
||||
package refinedstorage.apiimpl.autocrafting.task;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.item.Item;
|
||||
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.network.NetworkUtils;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.storage.item.IGroupedItemStorage;
|
||||
import refinedstorage.api.util.IItemStackList;
|
||||
import refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementRoot;
|
||||
import refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementToTake;
|
||||
|
||||
@@ -24,82 +20,90 @@ import java.util.List;
|
||||
|
||||
public class CraftingTaskNormal implements ICraftingTask {
|
||||
private INetworkMaster network;
|
||||
private ItemStack requested;
|
||||
private ICraftingPattern pattern;
|
||||
private int quantity;
|
||||
private Deque<ItemStack> toTake = new ArrayDeque<>();
|
||||
private List<IProcessable> toProcess = new ArrayList<>();
|
||||
private Multimap<Item, ItemStack> toCraft = ArrayListMultimap.create();
|
||||
private Multimap<Item, ItemStack> missing = ArrayListMultimap.create();
|
||||
private Multimap<Item, ItemStack> extras = ArrayListMultimap.create();
|
||||
private IItemStackList toCraft = RSAPI.instance().createItemStackList();
|
||||
private IItemStackList missing = RSAPI.instance().createItemStackList();
|
||||
private IItemStackList extras = RSAPI.instance().createItemStackList();
|
||||
|
||||
public CraftingTaskNormal(INetworkMaster network, ICraftingPattern pattern, int quantity) {
|
||||
public CraftingTaskNormal(INetworkMaster network, ItemStack requested, ICraftingPattern pattern, int quantity) {
|
||||
this.network = network;
|
||||
this.requested = requested;
|
||||
this.pattern = pattern;
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public void calculate() {
|
||||
calculate(network.getItemStorage().copy(), pattern, true);
|
||||
IItemStackList list = network.getItemStorage().getList().copy();
|
||||
|
||||
int newQuantity = quantity;
|
||||
|
||||
while (newQuantity > 0) {
|
||||
calculate(list, pattern, true);
|
||||
|
||||
newQuantity -= requested == null ? newQuantity : pattern.getQuantityPerRequest(requested);
|
||||
}
|
||||
}
|
||||
|
||||
private void calculate(IItemStackList list, ICraftingPattern pattern, boolean basePattern) {
|
||||
if (pattern.isProcessing()) {
|
||||
toProcess.add(new Processable(pattern));
|
||||
}
|
||||
|
||||
for (ItemStack input : pattern.getInputs()) {
|
||||
ItemStack inputInNetwork = list.get(input);
|
||||
|
||||
if (inputInNetwork == null || inputInNetwork.stackSize == 0) {
|
||||
if (extras.get(input) != null) {
|
||||
decrOrRemoveExtras(input);
|
||||
} else {
|
||||
ICraftingPattern inputPattern = network.getPattern(input);
|
||||
|
||||
if (inputPattern != null) {
|
||||
for (ItemStack output : inputPattern.getOutputs()) {
|
||||
toCraft.add(output);
|
||||
}
|
||||
|
||||
calculate(list, inputPattern, false);
|
||||
} else {
|
||||
missing.add(input);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!pattern.isProcessing()) {
|
||||
toTake.push(input);
|
||||
}
|
||||
|
||||
list.remove(input, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (!basePattern) {
|
||||
addExtras(pattern);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled() {
|
||||
}
|
||||
|
||||
private void calculate(IGroupedItemStorage storage, ICraftingPattern pattern, boolean basePattern) {
|
||||
for (int i = 0; i < quantity; ++i) {
|
||||
if (pattern.isProcessing()) {
|
||||
toProcess.add(new Processable(pattern));
|
||||
}
|
||||
|
||||
for (ItemStack input : pattern.getInputs()) {
|
||||
ItemStack inputInNetwork = storage.get(input, CompareUtils.COMPARE_DAMAGE | CompareUtils.COMPARE_NBT);
|
||||
|
||||
if (inputInNetwork == null || inputInNetwork.stackSize == 0) {
|
||||
if (getExtrasFor(input) != null) {
|
||||
decrOrRemoveExtras(input);
|
||||
} else {
|
||||
ICraftingPattern inputPattern = NetworkUtils.getPattern(network, input);
|
||||
|
||||
if (inputPattern != null) {
|
||||
for (ItemStack output : inputPattern.getOutputs()) {
|
||||
addToCraft(output);
|
||||
}
|
||||
|
||||
calculate(storage, inputPattern, false);
|
||||
} else {
|
||||
addMissing(input);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!pattern.isProcessing()) {
|
||||
toTake.push(input);
|
||||
}
|
||||
|
||||
storage.remove(input);
|
||||
}
|
||||
}
|
||||
|
||||
if (!basePattern) {
|
||||
addExtras(pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "\nCraftingTask{quantity=" + quantity +
|
||||
"\n, toTake=" + toTake +
|
||||
"\n, toCraft=" + toCraft +
|
||||
"\n, toProcess=" + toProcess +
|
||||
"\n, missing=" + missing +
|
||||
'}';
|
||||
"\n, toTake=" + toTake +
|
||||
"\n, toCraft=" + toCraft +
|
||||
"\n, toProcess=" + toProcess +
|
||||
"\n, missing=" + missing +
|
||||
'}';
|
||||
}
|
||||
|
||||
public boolean update() {
|
||||
for (IProcessable processable : toProcess) {
|
||||
if (processable.getPattern().getContainer().getFacingInventory() != null && processable.getStackToInsert() != null) {
|
||||
ItemStack toInsert = NetworkUtils.extractItem(network, processable.getStackToInsert(), 1);
|
||||
ItemStack toInsert = network.extractItem(processable.getStackToInsert(), 1);
|
||||
|
||||
if (ItemHandlerHelper.insertItem(processable.getPattern().getContainer().getFacingInventory(), toInsert, true) == null) {
|
||||
ItemHandlerHelper.insertItem(processable.getPattern().getContainer().getFacingInventory(), toInsert, false);
|
||||
@@ -110,7 +114,7 @@ public class CraftingTaskNormal implements ICraftingTask {
|
||||
}
|
||||
|
||||
if (!toTake.isEmpty()) {
|
||||
ItemStack took = NetworkUtils.extractItem(network, toTake.peek(), 1);
|
||||
ItemStack took = network.extractItem(toTake.peek(), 1);
|
||||
|
||||
if (took != null) {
|
||||
toTake.pop();
|
||||
@@ -149,19 +153,19 @@ public class CraftingTaskNormal implements ICraftingTask {
|
||||
List<ICraftingMonitorElement> elements = new ArrayList<>();
|
||||
|
||||
elements.add(new CraftingMonitorElementRoot(
|
||||
network.getCraftingTasks().indexOf(this),
|
||||
pattern.getOutputs().get(0),
|
||||
quantity
|
||||
network.getCraftingTasks().indexOf(this),
|
||||
pattern.getOutputs().get(0),
|
||||
quantity
|
||||
));
|
||||
|
||||
if (!toTake.isEmpty()) {
|
||||
Multimap<Item, ItemStack> toTake = ArrayListMultimap.create();
|
||||
IItemStackList toTake = RSAPI.instance().createItemStackList();
|
||||
|
||||
for (ItemStack stack : new ArrayList<>(this.toTake)) {
|
||||
add(toTake, stack);
|
||||
toTake.add(stack);
|
||||
}
|
||||
|
||||
for (ItemStack stack : toTake.values()) {
|
||||
for (ItemStack stack : toTake.getStacks()) {
|
||||
elements.add(new CraftingMonitorElementToTake(stack, stack.stackSize));
|
||||
}
|
||||
}
|
||||
@@ -174,62 +178,19 @@ public class CraftingTaskNormal implements ICraftingTask {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<IProcessable> getToProcess() {
|
||||
return toProcess;
|
||||
}
|
||||
|
||||
private void addMissing(ItemStack stack) {
|
||||
add(missing, stack);
|
||||
}
|
||||
|
||||
private void addToCraft(ItemStack stack) {
|
||||
add(toCraft, stack);
|
||||
}
|
||||
|
||||
private void add(Multimap<Item, ItemStack> map, ItemStack stack) {
|
||||
for (ItemStack m : map.get(stack.getItem())) {
|
||||
if (CompareUtils.compareStackNoQuantity(m, stack)) {
|
||||
m.stackSize += stack.stackSize;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
map.put(stack.getItem(), stack.copy());
|
||||
}
|
||||
|
||||
private void addExtras(ICraftingPattern pattern) {
|
||||
pattern.getOutputs().stream().filter(o -> o.stackSize > 1).forEach(o -> addExtras(ItemHandlerHelper.copyStackWithSize(o, o.stackSize - 1)));
|
||||
}
|
||||
|
||||
private void addExtras(ItemStack stack) {
|
||||
ItemStack extras = getExtrasFor(stack);
|
||||
|
||||
if (extras != null) {
|
||||
extras.stackSize += stack.stackSize;
|
||||
} else {
|
||||
this.extras.put(stack.getItem(), stack.copy());
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack getExtrasFor(ItemStack stack) {
|
||||
for (ItemStack m : extras.get(stack.getItem())) {
|
||||
if (CompareUtils.compareStackNoQuantity(m, stack)) {
|
||||
return m;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
pattern.getOutputs().stream()
|
||||
.filter(o -> o.stackSize > 1)
|
||||
.forEach(o -> extras.add(ItemHandlerHelper.copyStackWithSize(o, o.stackSize - 1)));
|
||||
}
|
||||
|
||||
private void decrOrRemoveExtras(ItemStack stack) {
|
||||
ItemStack extras = getExtrasFor(stack);
|
||||
|
||||
extras.stackSize--;
|
||||
|
||||
if (extras.stackSize == 0) {
|
||||
this.extras.remove(extras.getItem(), extras);
|
||||
}
|
||||
extras.remove(ItemHandlerHelper.copyStackWithSize(stack, 1), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.api.storage.CompareUtils;
|
||||
|
||||
public class Processable implements IProcessable {
|
||||
private ICraftingPattern pattern;
|
||||
@@ -51,7 +51,7 @@ public class Processable implements IProcessable {
|
||||
if (!satisfied[i]) {
|
||||
ItemStack item = pattern.getOutputs().get(i);
|
||||
|
||||
if (CompareUtils.compareStackNoQuantity(stack, item)) {
|
||||
if (RSAPI.instance().getComparer().isEqualNoQuantity(stack, item)) {
|
||||
satisfied[i] = true;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -26,6 +26,10 @@ public class NetworkNodeGraph implements INetworkNodeGraph {
|
||||
|
||||
@Override
|
||||
public void rebuild(BlockPos start, boolean notify) {
|
||||
if (start == null) {
|
||||
start = controller.getPosition();
|
||||
}
|
||||
|
||||
if (!controller.canRun()) {
|
||||
if (!nodes.isEmpty()) {
|
||||
disconnectAll();
|
||||
|
||||
@@ -5,9 +5,9 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.RSItems;
|
||||
import refinedstorage.api.network.*;
|
||||
import refinedstorage.item.ItemWirelessGrid;
|
||||
|
||||
@@ -55,17 +55,17 @@ public class WirelessGridHandler implements IWirelessGridHandler {
|
||||
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
|
||||
if (RefinedStorage.INSTANCE.config.wirelessGridUsesEnergy && stack.getItemDamage() != ItemWirelessGrid.TYPE_CREATIVE && RefinedStorageItems.WIRELESS_GRID.getEnergyStored(stack) <= RefinedStorage.INSTANCE.config.wirelessGridOpenUsage) {
|
||||
if (RS.INSTANCE.config.wirelessGridUsesEnergy && stack.getItemDamage() != ItemWirelessGrid.TYPE_CREATIVE && RSItems.WIRELESS_GRID.getEnergyStored(stack) <= RS.INSTANCE.config.wirelessGridOpenUsage) {
|
||||
return true;
|
||||
}
|
||||
|
||||
consumers.add(new WirelessGridConsumer(player, stack));
|
||||
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.WIRELESS_GRID, player.worldObj, hand.ordinal(), controllerWorld.provider.getDimension(), 0);
|
||||
player.openGui(RS.INSTANCE, RSGui.WIRELESS_GRID, player.worldObj, hand.ordinal(), controllerWorld.provider.getDimension(), 0);
|
||||
|
||||
network.sendItemStorageToClient((EntityPlayerMP) player);
|
||||
|
||||
drainEnergy(player, RefinedStorage.INSTANCE.config.wirelessGridOpenUsage);
|
||||
drainEnergy(player, RS.INSTANCE.config.wirelessGridOpenUsage);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -83,8 +83,8 @@ public class WirelessGridHandler implements IWirelessGridHandler {
|
||||
public void drainEnergy(EntityPlayer player, int energy) {
|
||||
IWirelessGridConsumer consumer = getConsumer(player);
|
||||
|
||||
if (consumer != null && RefinedStorage.INSTANCE.config.wirelessGridUsesEnergy) {
|
||||
ItemWirelessGrid item = RefinedStorageItems.WIRELESS_GRID;
|
||||
if (consumer != null && RS.INSTANCE.config.wirelessGridUsesEnergy) {
|
||||
ItemWirelessGrid item = RSItems.WIRELESS_GRID;
|
||||
|
||||
if (consumer.getStack().getItemDamage() != ItemWirelessGrid.TYPE_CREATIVE) {
|
||||
item.extractEnergy(consumer.getStack(), energy, false);
|
||||
|
||||
@@ -6,10 +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.NetworkUtils;
|
||||
import refinedstorage.api.network.grid.IFluidGridHandler;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.apiimpl.storage.fluid.FluidUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -32,7 +31,7 @@ public class FluidGridHandler implements IFluidGridHandler {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); ++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();
|
||||
|
||||
player.inventory.decrStackSize(i, 1);
|
||||
@@ -43,7 +42,7 @@ public class FluidGridHandler implements IFluidGridHandler {
|
||||
}
|
||||
|
||||
if (bucket != null) {
|
||||
bucket.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null).fill(NetworkUtils.extractFluid(network, stack, Fluid.BUCKET_VOLUME), true);
|
||||
bucket.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null).fill(network.extractFluid(stack, Fluid.BUCKET_VOLUME), true);
|
||||
|
||||
if (shift) {
|
||||
if (!player.inventory.addItemStackToInventory(bucket.copy())) {
|
||||
|
||||
@@ -5,12 +5,11 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.network.NetworkUtils;
|
||||
import refinedstorage.api.network.grid.IItemGridHandler;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.apiimpl.autocrafting.task.CraftingTaskNormal;
|
||||
|
||||
public class ItemGridHandler implements IItemGridHandler {
|
||||
@@ -22,7 +21,7 @@ public class ItemGridHandler implements IItemGridHandler {
|
||||
|
||||
@Override
|
||||
public void onExtract(int hash, int flags, EntityPlayerMP player) {
|
||||
ItemStack item = network.getItemStorage().get(hash);
|
||||
ItemStack item = network.getItemStorage().getList().get(hash);
|
||||
|
||||
if (item == null) {
|
||||
return;
|
||||
@@ -35,7 +34,7 @@ public class ItemGridHandler implements IItemGridHandler {
|
||||
ItemStack held = player.inventory.getItemStack();
|
||||
|
||||
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;
|
||||
}
|
||||
} else if (player.inventory.getItemStack() != null) {
|
||||
@@ -58,7 +57,7 @@ public class ItemGridHandler implements IItemGridHandler {
|
||||
|
||||
size = Math.min(size, item.getItem().getItemStackLimit(item));
|
||||
|
||||
ItemStack took = NetworkUtils.extractItem(network, item, size);
|
||||
ItemStack took = network.extractItem(item, size);
|
||||
|
||||
if (took != null) {
|
||||
if ((flags & EXTRACT_SHIFT) == EXTRACT_SHIFT) {
|
||||
@@ -77,7 +76,7 @@ public class ItemGridHandler implements IItemGridHandler {
|
||||
player.updateHeldItem();
|
||||
}
|
||||
|
||||
network.getWirelessGridHandler().drainEnergy(player, RefinedStorage.INSTANCE.config.wirelessGridExtractUsage);
|
||||
network.getWirelessGridHandler().drainEnergy(player, RS.INSTANCE.config.wirelessGridExtractUsage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +84,7 @@ public class ItemGridHandler implements IItemGridHandler {
|
||||
public ItemStack onInsert(EntityPlayerMP player, ItemStack stack) {
|
||||
ItemStack remainder = network.insertItem(stack, stack.stackSize, false);
|
||||
|
||||
network.getWirelessGridHandler().drainEnergy(player, RefinedStorage.INSTANCE.config.wirelessGridInsertUsage);
|
||||
network.getWirelessGridHandler().drainEnergy(player, RS.INSTANCE.config.wirelessGridInsertUsage);
|
||||
|
||||
return remainder;
|
||||
}
|
||||
@@ -115,15 +114,15 @@ public class ItemGridHandler implements IItemGridHandler {
|
||||
|
||||
player.updateHeldItem();
|
||||
|
||||
network.getWirelessGridHandler().drainEnergy(player, RefinedStorage.INSTANCE.config.wirelessGridInsertUsage);
|
||||
network.getWirelessGridHandler().drainEnergy(player, RS.INSTANCE.config.wirelessGridInsertUsage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftingPreviewRequested(EntityPlayerMP player, int hash, int quantity) {
|
||||
ItemStack stack = network.getItemStorage().get(hash);
|
||||
ItemStack stack = network.getItemStorage().getList().get(hash);
|
||||
|
||||
if (stack != null) {
|
||||
CraftingTaskNormal task = new CraftingTaskNormal(network, NetworkUtils.getPattern(network, stack), quantity);
|
||||
CraftingTaskNormal task = new CraftingTaskNormal(network, stack, network.getPattern(stack), quantity);
|
||||
|
||||
task.calculate();
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package refinedstorage.apiimpl.solderer;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.RSBlocks;
|
||||
import refinedstorage.RSItems;
|
||||
import refinedstorage.api.solderer.ISoldererRecipe;
|
||||
import refinedstorage.block.EnumFluidStorageType;
|
||||
import refinedstorage.item.ItemBlockFluidStorage;
|
||||
@@ -18,9 +18,9 @@ public class SoldererRecipeFluidStorage implements ISoldererRecipe {
|
||||
public SoldererRecipeFluidStorage(EnumFluidStorageType type, int storagePart) {
|
||||
this.type = type;
|
||||
this.rows = new ItemStack[]{
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
|
||||
new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
new ItemStack(RefinedStorageItems.FLUID_STORAGE_PART, 1, storagePart)
|
||||
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
|
||||
new ItemStack(RSBlocks.MACHINE_CASING),
|
||||
new ItemStack(RSItems.FLUID_STORAGE_PART, 1, storagePart)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class SoldererRecipeFluidStorage implements ISoldererRecipe {
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack getResult() {
|
||||
return ItemBlockFluidStorage.initNBT(new ItemStack(RefinedStorageBlocks.FLUID_STORAGE, 1, type.getId()));
|
||||
return ItemBlockFluidStorage.initNBT(new ItemStack(RSBlocks.FLUID_STORAGE, 1, type.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,7 @@ package refinedstorage.apiimpl.solderer;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.RSItems;
|
||||
import refinedstorage.api.solderer.ISoldererRecipe;
|
||||
import refinedstorage.item.ItemProcessor;
|
||||
|
||||
@@ -16,7 +16,7 @@ public class SoldererRecipePrintedProcessor implements ISoldererRecipe {
|
||||
|
||||
public SoldererRecipePrintedProcessor(int type) {
|
||||
this.type = type;
|
||||
this.result = new ItemStack(RefinedStorageItems.PROCESSOR, 1, type);
|
||||
this.result = new ItemStack(RSItems.PROCESSOR, 1, type);
|
||||
|
||||
switch (type) {
|
||||
case ItemProcessor.TYPE_PRINTED_BASIC:
|
||||
@@ -29,7 +29,7 @@ public class SoldererRecipePrintedProcessor implements ISoldererRecipe {
|
||||
this.requirement = new ItemStack(Items.DIAMOND);
|
||||
break;
|
||||
case ItemProcessor.TYPE_PRINTED_SILICON:
|
||||
this.requirement = new ItemStack(RefinedStorageItems.SILICON);
|
||||
this.requirement = new ItemStack(RSItems.SILICON);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package refinedstorage.apiimpl.solderer;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.RSItems;
|
||||
import refinedstorage.api.solderer.ISoldererRecipe;
|
||||
import refinedstorage.item.ItemProcessor;
|
||||
|
||||
@@ -21,21 +21,21 @@ public class SoldererRecipeProcessor implements ISoldererRecipe {
|
||||
|
||||
switch (type) {
|
||||
case ItemProcessor.TYPE_BASIC:
|
||||
printedProcessor = new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_PRINTED_BASIC);
|
||||
printedProcessor = new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_PRINTED_BASIC);
|
||||
break;
|
||||
case ItemProcessor.TYPE_IMPROVED:
|
||||
printedProcessor = new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_PRINTED_IMPROVED);
|
||||
printedProcessor = new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_PRINTED_IMPROVED);
|
||||
break;
|
||||
case ItemProcessor.TYPE_ADVANCED:
|
||||
printedProcessor = new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_PRINTED_ADVANCED);
|
||||
printedProcessor = new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_PRINTED_ADVANCED);
|
||||
break;
|
||||
}
|
||||
|
||||
this.result = new ItemStack(RefinedStorageItems.PROCESSOR, 1, type);
|
||||
this.result = new ItemStack(RSItems.PROCESSOR, 1, type);
|
||||
this.rows = new ItemStack[]{
|
||||
printedProcessor,
|
||||
new ItemStack(Items.REDSTONE),
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_PRINTED_SILICON)
|
||||
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_PRINTED_SILICON)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package refinedstorage.apiimpl.solderer;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.RSBlocks;
|
||||
import refinedstorage.RSItems;
|
||||
import refinedstorage.api.solderer.ISoldererRecipe;
|
||||
import refinedstorage.block.EnumItemStorageType;
|
||||
import refinedstorage.item.ItemBlockStorage;
|
||||
@@ -18,9 +18,9 @@ public class SoldererRecipeStorage implements ISoldererRecipe {
|
||||
public SoldererRecipeStorage(EnumItemStorageType type, int storagePart) {
|
||||
this.type = type;
|
||||
this.rows = new ItemStack[]{
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
|
||||
new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
new ItemStack(RefinedStorageItems.STORAGE_PART, 1, storagePart)
|
||||
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
|
||||
new ItemStack(RSBlocks.MACHINE_CASING),
|
||||
new ItemStack(RSItems.STORAGE_PART, 1, storagePart)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class SoldererRecipeStorage implements ISoldererRecipe {
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack getResult() {
|
||||
return ItemBlockStorage.initNBT(new ItemStack(RefinedStorageBlocks.STORAGE, 1, type.getId()));
|
||||
return ItemBlockStorage.initNBT(new ItemStack(RSBlocks.STORAGE, 1, type.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,7 @@ package refinedstorage.apiimpl.solderer;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.RSItems;
|
||||
import refinedstorage.api.solderer.ISoldererRecipe;
|
||||
import refinedstorage.item.ItemUpgrade;
|
||||
|
||||
@@ -14,10 +14,10 @@ public class SoldererRecipeUpgrade implements ISoldererRecipe {
|
||||
private ItemStack result;
|
||||
|
||||
public SoldererRecipeUpgrade(int type) {
|
||||
this.result = new ItemStack(RefinedStorageItems.UPGRADE, 1, type);
|
||||
this.result = new ItemStack(RSItems.UPGRADE, 1, type);
|
||||
this.rows = new ItemStack[]{
|
||||
ItemUpgrade.getRequirement(type),
|
||||
new ItemStack(RefinedStorageItems.UPGRADE, 1, 0),
|
||||
new ItemStack(RSItems.UPGRADE, 1, 0),
|
||||
new ItemStack(Items.REDSTONE)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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.api.storage.CompareUtils;
|
||||
|
||||
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 (!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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
package refinedstorage.apiimpl.storage;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.apiimpl.storage.fluid.FluidStorageNBT;
|
||||
import refinedstorage.apiimpl.storage.item.ItemStorageNBT;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public final class NBTStorage {
|
||||
public static void constructFromDrive(ItemStack disk, int slot, ItemStorageNBT[] itemStorages, FluidStorageNBT[] fluidStorages, Function<ItemStack, ItemStorageNBT> itemStorageSupplier, Function<ItemStack, FluidStorageNBT> fluidStorageNBTSupplier) {
|
||||
if (disk == null) {
|
||||
itemStorages[slot] = null;
|
||||
fluidStorages[slot] = null;
|
||||
} else {
|
||||
if (disk.getItem() == RefinedStorageItems.STORAGE_DISK) {
|
||||
itemStorages[slot] = itemStorageSupplier.apply(disk);
|
||||
} else if (disk.getItem() == RefinedStorageItems.FLUID_STORAGE_DISK) {
|
||||
fluidStorages[slot] = fluidStorageNBTSupplier.apply(disk);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.storage.fluid.IFluidStorage;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -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 (CompareUtils.compareStack(otherStack, stack, flags)) {
|
||||
if (RSAPI.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||
if (size > otherStack.amount) {
|
||||
size = otherStack.amount;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.network.NetworkUtils;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
|
||||
public final class FluidUtils {
|
||||
public static final ItemStack EMPTY_BUCKET = new ItemStack(Items.BUCKET);
|
||||
@@ -40,7 +39,7 @@ public final class FluidUtils {
|
||||
}
|
||||
|
||||
public static ItemStack extractItemOrIfBucketLookInFluids(INetworkMaster network, ItemStack stack, int size) {
|
||||
ItemStack result = NetworkUtils.extractItem(network, stack, size);
|
||||
ItemStack result = network.extractItem(stack, size);
|
||||
|
||||
if (result == null && stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null)) {
|
||||
FluidStack fluidStack = getFluidFromStack(stack, true);
|
||||
@@ -49,9 +48,9 @@ public final class FluidUtils {
|
||||
result = extractBucket(network);
|
||||
|
||||
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(network.extractFluid(fluidStack, Fluid.BUCKET_VOLUME), true);
|
||||
} else {
|
||||
NetworkUtils.scheduleCraftingTaskIfUnscheduled(network, EMPTY_BUCKET, 1, CompareUtils.COMPARE_DAMAGE | CompareUtils.COMPARE_NBT);
|
||||
network.scheduleCraftingTaskIfUnscheduled(EMPTY_BUCKET, 1, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,6 +59,6 @@ public final class FluidUtils {
|
||||
}
|
||||
|
||||
public static ItemStack extractBucket(INetworkMaster network) {
|
||||
return NetworkUtils.extractItem(network, EMPTY_BUCKET, 1);
|
||||
return network.extractItem(EMPTY_BUCKET, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,8 @@ 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.network.NetworkUtils;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.storage.fluid.IFluidStorage;
|
||||
import refinedstorage.api.storage.fluid.IFluidStorageProvider;
|
||||
import refinedstorage.api.storage.fluid.IGroupedFluidStorage;
|
||||
@@ -87,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 (CompareUtils.compareStack(otherStack, stack, flags)) {
|
||||
if (RSAPI.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||
return otherStack;
|
||||
}
|
||||
}
|
||||
@@ -99,7 +98,7 @@ public class GroupedFluidStorage implements IGroupedFluidStorage {
|
||||
@Nullable
|
||||
public FluidStack get(int hash) {
|
||||
for (FluidStack stack : this.stacks.values()) {
|
||||
if (NetworkUtils.getFluidStackHashCode(stack) == hash) {
|
||||
if (RSAPI.instance().getFluidStackHashCode(stack) == hash) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,22 @@
|
||||
package refinedstorage.apiimpl.storage.item;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.network.NetworkUtils;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.storage.item.IGroupedItemStorage;
|
||||
import refinedstorage.api.storage.item.IItemStorage;
|
||||
import refinedstorage.api.storage.item.IItemStorageProvider;
|
||||
import refinedstorage.api.util.IItemStackList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class GroupedItemStorage implements IGroupedItemStorage {
|
||||
private INetworkMaster network;
|
||||
private List<IItemStorage> storages = new ArrayList<>();
|
||||
private Multimap<Item, ItemStack> stacks = ArrayListMultimap.create();
|
||||
private IItemStackList list = RSAPI.instance().createItemStackList();
|
||||
|
||||
public GroupedItemStorage(INetworkMaster network) {
|
||||
this.network = network;
|
||||
@@ -35,7 +30,7 @@ public class GroupedItemStorage implements IGroupedItemStorage {
|
||||
.filter(node -> node.canUpdate() && node instanceof IItemStorageProvider)
|
||||
.forEach(node -> ((IItemStorageProvider) node).addItemStorages(storages));
|
||||
|
||||
stacks.clear();
|
||||
list.clear();
|
||||
|
||||
for (IItemStorage storage : storages) {
|
||||
for (ItemStack stack : storage.getItems()) {
|
||||
@@ -56,19 +51,7 @@ public class GroupedItemStorage implements IGroupedItemStorage {
|
||||
|
||||
@Override
|
||||
public void add(@Nonnull ItemStack stack, boolean rebuilding) {
|
||||
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
||||
if (CompareUtils.compareStackNoQuantity(otherStack, stack)) {
|
||||
otherStack.stackSize += stack.stackSize;
|
||||
|
||||
if (!rebuilding) {
|
||||
network.sendItemStorageDeltaToClient(stack, stack.stackSize);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
stacks.put(stack.getItem(), stack.copy());
|
||||
list.add(stack);
|
||||
|
||||
if (!rebuilding) {
|
||||
network.sendItemStorageDeltaToClient(stack, stack.stackSize);
|
||||
@@ -77,63 +60,14 @@ public class GroupedItemStorage implements IGroupedItemStorage {
|
||||
|
||||
@Override
|
||||
public void remove(@Nonnull ItemStack stack) {
|
||||
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
||||
if (CompareUtils.compareStackNoQuantity(otherStack, stack)) {
|
||||
otherStack.stackSize -= stack.stackSize;
|
||||
|
||||
if (otherStack.stackSize == 0) {
|
||||
if (!NetworkUtils.hasPattern(network, stack)) {
|
||||
stacks.remove(otherStack.getItem(), otherStack);
|
||||
}
|
||||
}
|
||||
|
||||
network.sendItemStorageDeltaToClient(stack, -stack.stackSize);
|
||||
|
||||
return;
|
||||
}
|
||||
if (list.remove(stack, !network.hasPattern(stack))) {
|
||||
network.sendItemStorageDeltaToClient(stack, -stack.stackSize);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack get(@Nonnull ItemStack stack, int flags) {
|
||||
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
||||
if (CompareUtils.compareStack(otherStack, stack, flags)) {
|
||||
return otherStack;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack get(int hash) {
|
||||
for (ItemStack stack : this.stacks.values()) {
|
||||
if (NetworkUtils.getItemStackHashCode(stack) == hash) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGroupedItemStorage copy() {
|
||||
GroupedItemStorage copy = new GroupedItemStorage(network);
|
||||
|
||||
copy.storages = storages;
|
||||
|
||||
for (ItemStack stack : stacks.values()) {
|
||||
copy.stacks.put(stack.getItem(), stack.copy());
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getStacks() {
|
||||
return stacks.values();
|
||||
public IItemStackList getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.storage.item.IItemStorage;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -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 (CompareUtils.compareStackNoQuantity(otherStack, stack)) {
|
||||
if (RSAPI.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 (CompareUtils.compareStack(otherStack, stack, flags)) {
|
||||
if (RSAPI.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||
if (size > otherStack.stackSize) {
|
||||
size = otherStack.stackSize;
|
||||
}
|
||||
|
||||
@@ -1,49 +1,14 @@
|
||||
package refinedstorage.api.storage;
|
||||
package refinedstorage.apiimpl.util;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
|
||||
/**
|
||||
* Utilities for comparing item and fluid stacks.
|
||||
*/
|
||||
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) {
|
||||
public class Comparer implements IComparer {
|
||||
@Override
|
||||
public boolean isEqual(ItemStack left, ItemStack right, int flags) {
|
||||
if (left == null && right == null) {
|
||||
return true;
|
||||
}
|
||||
@@ -63,7 +28,7 @@ public final class CompareUtils {
|
||||
}
|
||||
|
||||
if ((flags & COMPARE_NBT) == COMPARE_NBT) {
|
||||
if (!compareNbt(left, right)) {
|
||||
if (!isEqualNBT(left, right)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -77,15 +42,8 @@ public final class CompareUtils {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(FluidStack left, FluidStack right, int flags) {
|
||||
@Override
|
||||
public boolean isEqual(FluidStack left, FluidStack right, int flags) {
|
||||
if (left == null && right == null) {
|
||||
return true;
|
||||
}
|
||||
@@ -113,14 +71,8 @@ public final class CompareUtils {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public static boolean compareNbt(ItemStack left, ItemStack right) {
|
||||
@Override
|
||||
public boolean isEqualNBT(ItemStack left, ItemStack right) {
|
||||
if (!ItemStack.areItemStackTagsEqual(left, right)) {
|
||||
if (left.hasTagCompound() && !right.hasTagCompound() && left.getTagCompound().hasNoTags()) {
|
||||
return true;
|
||||
@@ -134,14 +86,8 @@ public final class CompareUtils {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public static boolean compareStackOreDict(ItemStack left, ItemStack right) {
|
||||
@Override
|
||||
public boolean isEqualOredict(ItemStack left, ItemStack right) {
|
||||
if (left == null && right == null) {
|
||||
return true;
|
||||
}
|
||||
94
src/main/java/refinedstorage/apiimpl/util/ItemStackList.java
Executable file
94
src/main/java/refinedstorage/apiimpl/util/ItemStackList.java
Executable file
@@ -0,0 +1,94 @@
|
||||
package refinedstorage.apiimpl.util;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.util.IItemStackList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
public class ItemStackList implements IItemStackList {
|
||||
private Multimap<Item, ItemStack> stacks = ArrayListMultimap.create();
|
||||
|
||||
public void add(ItemStack stack) {
|
||||
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
||||
if (RSAPI.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
||||
otherStack.stackSize += stack.stackSize;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
stacks.put(stack.getItem(), stack.copy());
|
||||
}
|
||||
|
||||
public boolean remove(@Nonnull ItemStack stack, boolean removeIfReachedZero) {
|
||||
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
||||
if (RSAPI.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
||||
otherStack.stackSize -= stack.stackSize;
|
||||
|
||||
if (otherStack.stackSize == 0 && removeIfReachedZero) {
|
||||
stacks.remove(otherStack.getItem(), otherStack);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ItemStack get(@Nonnull ItemStack stack, int flags) {
|
||||
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
||||
if (RSAPI.instance().getComparer().isEqual(otherStack, stack, flags)) {
|
||||
return otherStack;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ItemStack get(int hash) {
|
||||
for (ItemStack stack : this.stacks.values()) {
|
||||
if (RSAPI.instance().getItemStackHashCode(stack) == hash) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
stacks.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return stacks.isEmpty();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Collection<ItemStack> getStacks() {
|
||||
return stacks.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public IItemStackList copy() {
|
||||
ItemStackList list = new ItemStackList();
|
||||
|
||||
for (ItemStack stack : stacks.values()) {
|
||||
list.add(stack.copy());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.item.ItemBlockBase;
|
||||
import refinedstorage.tile.TileBase;
|
||||
|
||||
@@ -30,13 +30,13 @@ public abstract class BlockBase extends Block {
|
||||
this.name = name;
|
||||
|
||||
setHardness(1.9F);
|
||||
setRegistryName(RefinedStorage.ID, name);
|
||||
setCreativeTab(RefinedStorage.INSTANCE.tab);
|
||||
setRegistryName(RS.ID, name);
|
||||
setCreativeTab(RS.INSTANCE.tab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "block." + RefinedStorage.ID + ":" + name;
|
||||
return "block." + RS.ID + ":" + name;
|
||||
}
|
||||
|
||||
protected BlockStateContainer.Builder createBlockStateBuilder() {
|
||||
|
||||
@@ -22,10 +22,9 @@ import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.network.INetworkNode;
|
||||
import refinedstorage.api.network.NetworkUtils;
|
||||
import refinedstorage.tile.TileBase;
|
||||
import refinedstorage.tile.TileCable;
|
||||
import refinedstorage.tile.TileMultipartNode;
|
||||
@@ -66,8 +65,8 @@ public class BlockCable extends BlockCoverable {
|
||||
this.name = name;
|
||||
|
||||
setHardness(0.6F);
|
||||
setRegistryName(RefinedStorage.ID, name);
|
||||
setCreativeTab(RefinedStorage.INSTANCE.tab);
|
||||
setRegistryName(RS.ID, name);
|
||||
setCreativeTab(RS.INSTANCE.tab);
|
||||
}
|
||||
|
||||
public BlockCable() {
|
||||
@@ -76,7 +75,7 @@ public class BlockCable extends BlockCoverable {
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "block." + RefinedStorage.ID + ":" + name;
|
||||
return "block." + RS.ID + ":" + name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -281,7 +280,7 @@ public class BlockCable extends BlockCoverable {
|
||||
TileEntity tile = world.getTileEntity(pos.offset(facing));
|
||||
|
||||
if (tile instanceof TileNode && ((TileNode) tile).isConnected()) {
|
||||
NetworkUtils.rebuildGraph(((TileNode) tile).getNetwork());
|
||||
((TileNode) tile).getNetwork().getNodeGraph().rebuild();
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -314,7 +313,7 @@ public class BlockCable extends BlockCoverable {
|
||||
super.breakBlock(world, pos, state);
|
||||
|
||||
if (network != null) {
|
||||
NetworkUtils.rebuildGraph(network);
|
||||
network.getNodeGraph().rebuild();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.TileConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -85,7 +85,7 @@ public class BlockConstructor extends BlockCable {
|
||||
}
|
||||
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.CONSTRUCTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.CONSTRUCTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -17,10 +17,9 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.api.network.NetworkUtils;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSBlocks;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.item.ItemBlockController;
|
||||
import refinedstorage.tile.TileController;
|
||||
|
||||
@@ -82,7 +81,7 @@ public class BlockController extends BlockBase {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.CONTROLLER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.CONTROLLER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -118,7 +117,7 @@ public class BlockController extends BlockBase {
|
||||
super.neighborChanged(state, world, pos, block);
|
||||
|
||||
if (!world.isRemote) {
|
||||
NetworkUtils.rebuildGraph((TileController) world.getTileEntity(pos));
|
||||
((TileController) world.getTileEntity(pos)).getNodeGraph().rebuild();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +125,7 @@ public class BlockController extends BlockBase {
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
|
||||
ItemStack stack = new ItemStack(RefinedStorageBlocks.CONTROLLER, 1, RefinedStorageBlocks.CONTROLLER.getMetaFromState(state));
|
||||
ItemStack stack = new ItemStack(RSBlocks.CONTROLLER, 1, RSBlocks.CONTROLLER.getMetaFromState(state));
|
||||
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
stack.getTagCompound().setInteger(TileController.NBT_ENERGY, ((TileController) world.getTileEntity(pos)).getEnergy().getEnergyStored());
|
||||
|
||||
@@ -8,8 +8,8 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.TileCrafter;
|
||||
|
||||
public class BlockCrafter extends BlockNode {
|
||||
@@ -25,7 +25,7 @@ public class BlockCrafter extends BlockNode {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.CRAFTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.CRAFTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -8,8 +8,8 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.TileCraftingMonitor;
|
||||
|
||||
public class BlockCraftingMonitor extends BlockNode {
|
||||
@@ -25,7 +25,7 @@ public class BlockCraftingMonitor extends BlockNode {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.CRAFTING_MONITOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.CRAFTING_MONITOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -9,9 +9,9 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSBlocks;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.TileDestructor;
|
||||
|
||||
import java.util.List;
|
||||
@@ -32,7 +32,7 @@ public class BlockDestructor extends BlockCable {
|
||||
|
||||
@Override
|
||||
public List<AxisAlignedBB> getNonUnionizedCollisionBoxes(IBlockState state) {
|
||||
return RefinedStorageBlocks.CONSTRUCTOR.getNonUnionizedCollisionBoxes(state);
|
||||
return RSBlocks.CONSTRUCTOR.getNonUnionizedCollisionBoxes(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,7 +42,7 @@ public class BlockDestructor extends BlockCable {
|
||||
}
|
||||
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.DESTRUCTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.DESTRUCTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -13,8 +13,8 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.TileDetector;
|
||||
|
||||
public class BlockDetector extends BlockNode {
|
||||
@@ -71,7 +71,7 @@ public class BlockDetector extends BlockNode {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.DETECTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.DETECTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -12,8 +12,8 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.TileDiskDrive;
|
||||
|
||||
public class BlockDiskDrive extends BlockNode {
|
||||
@@ -73,7 +73,7 @@ public class BlockDiskDrive extends BlockNode {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.DISK_DRIVE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.DISK_DRIVE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -8,8 +8,8 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.TileDiskManipulator;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -27,7 +27,7 @@ public class BlockDiskManipulator extends BlockNode {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.DISK_MANIPULATOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.DISK_MANIPULATOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -9,8 +9,8 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.TileExporter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -92,7 +92,7 @@ public class BlockExporter extends BlockCable {
|
||||
}
|
||||
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.EXPORTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.EXPORTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -10,8 +10,8 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.externalstorage.TileExternalStorage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -75,7 +75,7 @@ public class BlockExternalStorage extends BlockCable {
|
||||
}
|
||||
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.EXTERNAL_STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.EXTERNAL_STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -8,8 +8,8 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.TileFluidInterface;
|
||||
|
||||
public class BlockFluidInterface extends BlockNode {
|
||||
@@ -25,7 +25,7 @@ public class BlockFluidInterface extends BlockNode {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.FLUID_INTERFACE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.FLUID_INTERFACE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -15,9 +15,9 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSBlocks;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.item.ItemBlockFluidStorage;
|
||||
import refinedstorage.tile.TileFluidStorage;
|
||||
|
||||
@@ -65,7 +65,7 @@ public class BlockFluidStorage extends BlockNode {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.FLUID_STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.FLUID_STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -93,7 +93,7 @@ public class BlockFluidStorage extends BlockNode {
|
||||
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
|
||||
ItemStack stack = new ItemStack(RefinedStorageBlocks.FLUID_STORAGE, 1, getMetaFromState(state));
|
||||
ItemStack stack = new ItemStack(RSBlocks.FLUID_STORAGE, 1, getMetaFromState(state));
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
stack.getTagCompound().setTag(TileFluidStorage.NBT_STORAGE, storage.getStorageTag());
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.item.ItemBlockBase;
|
||||
import refinedstorage.tile.grid.TileGrid;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class BlockGrid extends BlockNode {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.GRID, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.GRID, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
((TileGrid) world.getTileEntity(pos)).onGridOpened(player);
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.TileImporter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -96,7 +96,7 @@ public class BlockImporter extends BlockCable {
|
||||
}
|
||||
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.IMPORTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.IMPORTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -8,8 +8,8 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.TileInterface;
|
||||
|
||||
public class BlockInterface extends BlockNode {
|
||||
@@ -25,7 +25,7 @@ public class BlockInterface extends BlockNode {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.INTERFACE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.INTERFACE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -8,8 +8,8 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.TileNetworkTransmitter;
|
||||
|
||||
public class BlockNetworkTransmitter extends BlockNode {
|
||||
@@ -20,7 +20,7 @@ public class BlockNetworkTransmitter extends BlockNode {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.NETWORK_TRANSMITTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.NETWORK_TRANSMITTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -11,7 +11,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.network.NetworkUtils;
|
||||
import refinedstorage.tile.TileNode;
|
||||
|
||||
public abstract class BlockNode extends BlockBase {
|
||||
@@ -60,7 +59,7 @@ public abstract class BlockNode extends BlockBase {
|
||||
TileEntity tile = world.getTileEntity(pos.offset(facing));
|
||||
|
||||
if (tile instanceof TileNode && ((TileNode) tile).isConnected()) {
|
||||
NetworkUtils.rebuildGraph(((TileNode) tile).getNetwork());
|
||||
((TileNode) tile).getNetwork().getNodeGraph().rebuild();
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -83,7 +82,7 @@ public abstract class BlockNode extends BlockBase {
|
||||
super.breakBlock(world, pos, state);
|
||||
|
||||
if (network != null) {
|
||||
NetworkUtils.rebuildGraph(network);
|
||||
network.getNodeGraph().rebuild();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.TileProcessingPatternEncoder;
|
||||
|
||||
import java.util.List;
|
||||
@@ -42,7 +42,7 @@ public class BlockProcessingPatternEncoder extends BlockBase {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.PROCESSING_PATTERN_ENCODER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.PROCESSING_PATTERN_ENCODER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -8,8 +8,8 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.TileRelay;
|
||||
|
||||
public class BlockRelay extends BlockNode {
|
||||
@@ -25,7 +25,7 @@ public class BlockRelay extends BlockNode {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.RELAY, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.RELAY, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -10,8 +10,8 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.TileSolderer;
|
||||
|
||||
import java.util.List;
|
||||
@@ -40,7 +40,7 @@ public class BlockSolderer extends BlockNode {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.SOLDERER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.SOLDERER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -15,9 +15,9 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSBlocks;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.item.ItemBlockStorage;
|
||||
import refinedstorage.tile.TileStorage;
|
||||
|
||||
@@ -65,7 +65,7 @@ public class BlockStorage extends BlockNode {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -93,7 +93,7 @@ public class BlockStorage extends BlockNode {
|
||||
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
|
||||
ItemStack stack = new ItemStack(RefinedStorageBlocks.STORAGE, 1, getMetaFromState(state));
|
||||
ItemStack stack = new ItemStack(RSBlocks.STORAGE, 1, getMetaFromState(state));
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
stack.getTagCompound().setTag(TileStorage.NBT_STORAGE, storage.getStorageTag());
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.tile.TileWirelessTransmitter;
|
||||
|
||||
public class BlockWirelessTransmitter extends BlockNode {
|
||||
@@ -33,7 +33,7 @@ public class BlockWirelessTransmitter extends BlockNode {
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.WIRELESS_TRANSMITTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
player.openGui(RS.INSTANCE, RSGui.WIRELESS_TRANSMITTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -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.storage.CompareUtils;
|
||||
import refinedstorage.api.RSAPI;
|
||||
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 (CompareUtils.compareStackNoQuantity(getStackFromSlot(getSlot(i)), stack)) {
|
||||
if (RSAPI.instance().getComparer().isEqualNoQuantity(getStackFromSlot(getSlot(i)), stack)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
2
src/main/java/refinedstorage/container/ContainerDiskManipulator.java
Normal file → Executable file
2
src/main/java/refinedstorage/container/ContainerDiskManipulator.java
Normal file → Executable file
@@ -20,7 +20,7 @@ public class ContainerDiskManipulator extends ContainerBase {
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ContainerProcessingPatternEncoder extends ContainerBase {
|
||||
}
|
||||
|
||||
public void setInputs(Collection<ItemStack> stacks) {
|
||||
setSlots(stacks, 2 , 2 + 9);
|
||||
setSlots(stacks, 2, 2 + 9);
|
||||
}
|
||||
|
||||
public void setOutputs(Collection<ItemStack> stacks) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.RSItems;
|
||||
import refinedstorage.container.slot.SlotOutput;
|
||||
import refinedstorage.tile.TileSolderer;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ContainerSolderer extends ContainerBase {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if (stack.getItem() != RefinedStorageItems.UPGRADE || !mergeItemStack(stack, 4, 4 + 4, false)) {
|
||||
if (stack.getItem() != RSItems.UPGRADE || !mergeItemStack(stack, 4, 4 + 4, false)) {
|
||||
if (!mergeItemStack(stack, 0, 3, false)) { // 0 - 3 because we can't shift click to output slot
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.client.config.GuiCheckBox;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.apiimpl.storage.fluid.FluidRenderer;
|
||||
import refinedstorage.gui.sidebutton.SideButton;
|
||||
import refinedstorage.inventory.ItemHandlerFluid;
|
||||
@@ -180,7 +180,7 @@ public abstract class GuiBase extends GuiContainer {
|
||||
}
|
||||
|
||||
public void bindTexture(String file) {
|
||||
bindTexture(RefinedStorage.ID, file);
|
||||
bindTexture(RS.ID, file);
|
||||
}
|
||||
|
||||
public void bindTexture(String base, String file) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package refinedstorage.gui;
|
||||
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.container.ContainerConstructor;
|
||||
import refinedstorage.gui.sidebutton.SideButtonCompare;
|
||||
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
||||
@@ -18,8 +18,8 @@ public class GuiConstructor extends GuiBase {
|
||||
|
||||
addSideButton(new SideButtonType(this, TileConstructor.TYPE));
|
||||
|
||||
addSideButton(new SideButtonCompare(this, TileConstructor.COMPARE, CompareUtils.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileConstructor.COMPARE, CompareUtils.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, TileConstructor.COMPARE, IComparer.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileConstructor.COMPARE, IComparer.COMPARE_NBT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,7 @@ package refinedstorage.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
|
||||
import refinedstorage.container.ContainerCraftingMonitor;
|
||||
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
||||
@@ -121,10 +121,10 @@ public class GuiCraftingMonitor extends GuiBase {
|
||||
ICraftingMonitorElement element = getElements().get(itemSelected);
|
||||
|
||||
if (element.getTaskId() != -1) {
|
||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageCraftingMonitorCancel(craftingMonitor, element.getTaskId()));
|
||||
RS.INSTANCE.network.sendToServer(new MessageCraftingMonitorCancel(craftingMonitor, element.getTaskId()));
|
||||
}
|
||||
} else if (button == cancelAllButton && getElements().size() > 0) {
|
||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageCraftingMonitorCancel(craftingMonitor, -1));
|
||||
RS.INSTANCE.network.sendToServer(new MessageCraftingMonitorCancel(craftingMonitor, -1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.network.MessageGridCraftingStart;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -181,7 +181,7 @@ public class GuiCraftingPreview extends GuiBase {
|
||||
}
|
||||
|
||||
private void startRequest() {
|
||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridCraftingStart(hash, quantity));
|
||||
RS.INSTANCE.network.sendToServer(new MessageGridCraftingStart(hash, quantity));
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package refinedstorage.gui;
|
||||
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.container.ContainerDestructor;
|
||||
import refinedstorage.gui.sidebutton.SideButtonCompare;
|
||||
import refinedstorage.gui.sidebutton.SideButtonMode;
|
||||
@@ -21,8 +21,8 @@ public class GuiDestructor extends GuiBase {
|
||||
|
||||
addSideButton(new SideButtonMode(this, TileDestructor.MODE));
|
||||
|
||||
addSideButton(new SideButtonCompare(this, TileDestructor.COMPARE, CompareUtils.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileDestructor.COMPARE, CompareUtils.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, TileDestructor.COMPARE, IComparer.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileDestructor.COMPARE, IComparer.COMPARE_NBT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,7 @@ package refinedstorage.gui;
|
||||
|
||||
import com.google.common.primitives.Ints;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.container.ContainerDetector;
|
||||
import refinedstorage.gui.sidebutton.SideButtonCompare;
|
||||
import refinedstorage.gui.sidebutton.SideButtonDetectorMode;
|
||||
@@ -25,8 +25,8 @@ public class GuiDetector extends GuiBase {
|
||||
|
||||
addSideButton(new SideButtonDetectorMode(this));
|
||||
|
||||
addSideButton(new SideButtonCompare(this, TileDetector.COMPARE, CompareUtils.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileDetector.COMPARE, CompareUtils.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, TileDetector.COMPARE, IComparer.COMPARE_DAMAGE));
|
||||
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.setText(String.valueOf(TileDetector.AMOUNT.getValue()));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package refinedstorage.gui;
|
||||
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.container.ContainerDiskManipulator;
|
||||
import refinedstorage.gui.sidebutton.*;
|
||||
import refinedstorage.tile.TileDiskManipulator;
|
||||
@@ -16,8 +16,8 @@ public class GuiDiskManipulator extends GuiBase {
|
||||
addSideButton(new SideButtonIOMode(this, TileDiskManipulator.IO_MODE));
|
||||
addSideButton(new SideButtonType(this, TileDiskManipulator.TYPE));
|
||||
addSideButton(new SideButtonMode(this, TileDiskManipulator.MODE));
|
||||
addSideButton(new SideButtonCompare(this, TileDiskManipulator.COMPARE, CompareUtils.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileDiskManipulator.COMPARE, CompareUtils.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, TileDiskManipulator.COMPARE, IComparer.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileDiskManipulator.COMPARE, IComparer.COMPARE_NBT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package refinedstorage.gui;
|
||||
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.container.ContainerExporter;
|
||||
import refinedstorage.gui.sidebutton.SideButtonCompare;
|
||||
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
||||
@@ -18,8 +18,8 @@ public class GuiExporter extends GuiBase {
|
||||
|
||||
addSideButton(new SideButtonType(this, TileExporter.TYPE));
|
||||
|
||||
addSideButton(new SideButtonCompare(this, TileExporter.COMPARE, CompareUtils.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileExporter.COMPARE, CompareUtils.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, TileExporter.COMPARE, IComparer.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileExporter.COMPARE, IComparer.COMPARE_NBT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package refinedstorage.gui;
|
||||
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.apiimpl.storage.fluid.FluidRenderer;
|
||||
import refinedstorage.container.ContainerFluidInterface;
|
||||
import refinedstorage.gui.sidebutton.SideButtonCompare;
|
||||
@@ -18,7 +18,7 @@ public class GuiFluidInterface extends GuiBase {
|
||||
public void init(int x, int y) {
|
||||
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
|
||||
|
||||
@@ -2,8 +2,8 @@ package refinedstorage.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraftforge.fml.client.config.GuiCheckBox;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.container.ContainerGridFilter;
|
||||
import refinedstorage.item.ItemGridFilter;
|
||||
import refinedstorage.network.MessageGridFilterUpdate;
|
||||
@@ -24,8 +24,8 @@ public class GuiGridFilter extends GuiBase {
|
||||
|
||||
@Override
|
||||
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);
|
||||
compareNBT = addCheckBox(x + 7 + compareDamage.getButtonWidth() + 4, y + 41, t("gui.refinedstorage:grid_filter.compare_nbt"), (compare & CompareUtils.COMPARE_NBT) == CompareUtils.COMPARE_NBT);
|
||||
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 & IComparer.COMPARE_NBT) == IComparer.COMPARE_NBT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,11 +50,11 @@ public class GuiGridFilter extends GuiBase {
|
||||
super.actionPerformed(button);
|
||||
|
||||
if (button == compareDamage) {
|
||||
compare ^= CompareUtils.COMPARE_DAMAGE;
|
||||
compare ^= IComparer.COMPARE_DAMAGE;
|
||||
} else if (button == compareNBT) {
|
||||
compare ^= CompareUtils.COMPARE_NBT;
|
||||
compare ^= IComparer.COMPARE_NBT;
|
||||
}
|
||||
|
||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridFilterUpdate(compare));
|
||||
RS.INSTANCE.network.sendToServer(new MessageGridFilterUpdate(compare));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.network.IGuiHandler;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.RSGui;
|
||||
import refinedstorage.container.*;
|
||||
import refinedstorage.gui.grid.GuiGrid;
|
||||
import refinedstorage.tile.*;
|
||||
@@ -18,47 +18,47 @@ import refinedstorage.tile.grid.WirelessGrid;
|
||||
public class GuiHandler implements IGuiHandler {
|
||||
private Container getContainer(int ID, EntityPlayer player, TileEntity tile) {
|
||||
switch (ID) {
|
||||
case RefinedStorageGui.CONTROLLER:
|
||||
case RSGui.CONTROLLER:
|
||||
return new ContainerController((TileController) tile, player);
|
||||
case RefinedStorageGui.GRID:
|
||||
case RSGui.GRID:
|
||||
return new ContainerGrid((TileGrid) tile, player);
|
||||
case RefinedStorageGui.DISK_DRIVE:
|
||||
case RSGui.DISK_DRIVE:
|
||||
return new ContainerDiskDrive((TileDiskDrive) tile, player);
|
||||
case RefinedStorageGui.IMPORTER:
|
||||
case RSGui.IMPORTER:
|
||||
return new ContainerImporter((TileImporter) tile, player);
|
||||
case RefinedStorageGui.EXPORTER:
|
||||
case RSGui.EXPORTER:
|
||||
return new ContainerExporter((TileExporter) tile, player);
|
||||
case RefinedStorageGui.DETECTOR:
|
||||
case RSGui.DETECTOR:
|
||||
return new ContainerDetector((TileDetector) tile, player);
|
||||
case RefinedStorageGui.SOLDERER:
|
||||
case RSGui.SOLDERER:
|
||||
return new ContainerSolderer((TileSolderer) tile, player);
|
||||
case RefinedStorageGui.DESTRUCTOR:
|
||||
case RSGui.DESTRUCTOR:
|
||||
return new ContainerDestructor((TileDestructor) tile, player);
|
||||
case RefinedStorageGui.CONSTRUCTOR:
|
||||
case RSGui.CONSTRUCTOR:
|
||||
return new ContainerConstructor((TileConstructor) tile, player);
|
||||
case RefinedStorageGui.STORAGE:
|
||||
case RSGui.STORAGE:
|
||||
return new ContainerStorage((TileStorage) tile, player);
|
||||
case RefinedStorageGui.EXTERNAL_STORAGE:
|
||||
case RSGui.EXTERNAL_STORAGE:
|
||||
return new ContainerExternalStorage((TileExternalStorage) tile, player);
|
||||
case RefinedStorageGui.RELAY:
|
||||
case RSGui.RELAY:
|
||||
return new ContainerRelay((TileRelay) tile, player);
|
||||
case RefinedStorageGui.INTERFACE:
|
||||
case RSGui.INTERFACE:
|
||||
return new ContainerInterface((TileInterface) tile, player);
|
||||
case RefinedStorageGui.CRAFTING_MONITOR:
|
||||
case RSGui.CRAFTING_MONITOR:
|
||||
return new ContainerCraftingMonitor((TileCraftingMonitor) tile, player);
|
||||
case RefinedStorageGui.WIRELESS_TRANSMITTER:
|
||||
case RSGui.WIRELESS_TRANSMITTER:
|
||||
return new ContainerWirelessTransmitter((TileWirelessTransmitter) tile, player);
|
||||
case RefinedStorageGui.CRAFTER:
|
||||
case RSGui.CRAFTER:
|
||||
return new ContainerCrafter((TileCrafter) tile, player);
|
||||
case RefinedStorageGui.PROCESSING_PATTERN_ENCODER:
|
||||
case RSGui.PROCESSING_PATTERN_ENCODER:
|
||||
return new ContainerProcessingPatternEncoder((TileProcessingPatternEncoder) tile, player);
|
||||
case RefinedStorageGui.NETWORK_TRANSMITTER:
|
||||
case RSGui.NETWORK_TRANSMITTER:
|
||||
return new ContainerNetworkTransmitter((TileNetworkTransmitter) tile, player);
|
||||
case RefinedStorageGui.FLUID_INTERFACE:
|
||||
case RSGui.FLUID_INTERFACE:
|
||||
return new ContainerFluidInterface((TileFluidInterface) tile, player);
|
||||
case RefinedStorageGui.FLUID_STORAGE:
|
||||
case RSGui.FLUID_STORAGE:
|
||||
return new ContainerFluidStorage((TileFluidStorage) tile, player);
|
||||
case RefinedStorageGui.DISK_MANIPULATOR:
|
||||
case RSGui.DISK_MANIPULATOR:
|
||||
return new ContainerDiskManipulator((TileDiskManipulator) tile, player);
|
||||
default:
|
||||
return null;
|
||||
@@ -79,9 +79,9 @@ public class GuiHandler implements IGuiHandler {
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
if (ID == RefinedStorageGui.WIRELESS_GRID) {
|
||||
if (ID == RSGui.WIRELESS_GRID) {
|
||||
return getWirelessGridContainer(player, x, y);
|
||||
} else if (ID == RefinedStorageGui.GRID_FILTER) {
|
||||
} else if (ID == RSGui.GRID_FILTER) {
|
||||
return getGridFilterContainer(player, x);
|
||||
}
|
||||
|
||||
@@ -93,51 +93,51 @@ public class GuiHandler implements IGuiHandler {
|
||||
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
|
||||
|
||||
switch (ID) {
|
||||
case RefinedStorageGui.CONTROLLER:
|
||||
case RSGui.CONTROLLER:
|
||||
return new GuiController((ContainerController) getContainer(ID, player, tile), (TileController) tile);
|
||||
case RefinedStorageGui.GRID:
|
||||
case RSGui.GRID:
|
||||
return new GuiGrid((ContainerGrid) getContainer(ID, player, tile), (TileGrid) tile);
|
||||
case RefinedStorageGui.WIRELESS_GRID:
|
||||
case RSGui.WIRELESS_GRID:
|
||||
return getWirelessGridGui(player, x, y);
|
||||
case RefinedStorageGui.DISK_DRIVE:
|
||||
case RSGui.DISK_DRIVE:
|
||||
return new GuiStorage((ContainerDiskDrive) getContainer(ID, player, tile), (IStorageGui) tile, "gui/disk_drive.png");
|
||||
case RefinedStorageGui.IMPORTER:
|
||||
case RSGui.IMPORTER:
|
||||
return new GuiImporter((ContainerImporter) getContainer(ID, player, tile));
|
||||
case RefinedStorageGui.EXPORTER:
|
||||
case RSGui.EXPORTER:
|
||||
return new GuiExporter((ContainerExporter) getContainer(ID, player, tile));
|
||||
case RefinedStorageGui.DETECTOR:
|
||||
case RSGui.DETECTOR:
|
||||
return new GuiDetector((ContainerDetector) getContainer(ID, player, tile));
|
||||
case RefinedStorageGui.SOLDERER:
|
||||
case RSGui.SOLDERER:
|
||||
return new GuiSolderer((ContainerSolderer) getContainer(ID, player, tile), (TileSolderer) tile);
|
||||
case RefinedStorageGui.DESTRUCTOR:
|
||||
case RSGui.DESTRUCTOR:
|
||||
return new GuiDestructor((ContainerDestructor) getContainer(ID, player, tile));
|
||||
case RefinedStorageGui.CONSTRUCTOR:
|
||||
case RSGui.CONSTRUCTOR:
|
||||
return new GuiConstructor((ContainerConstructor) getContainer(ID, player, tile));
|
||||
case RefinedStorageGui.STORAGE:
|
||||
case RSGui.STORAGE:
|
||||
return new GuiStorage((ContainerStorage) getContainer(ID, player, tile), (TileStorage) tile);
|
||||
case RefinedStorageGui.EXTERNAL_STORAGE:
|
||||
case RSGui.EXTERNAL_STORAGE:
|
||||
return new GuiStorage((ContainerExternalStorage) getContainer(ID, player, tile), (TileExternalStorage) tile);
|
||||
case RefinedStorageGui.RELAY:
|
||||
case RSGui.RELAY:
|
||||
return new GuiRelay((ContainerRelay) getContainer(ID, player, tile));
|
||||
case RefinedStorageGui.INTERFACE:
|
||||
case RSGui.INTERFACE:
|
||||
return new GuiInterface((ContainerInterface) getContainer(ID, player, tile));
|
||||
case RefinedStorageGui.CRAFTING_MONITOR:
|
||||
case RSGui.CRAFTING_MONITOR:
|
||||
return new GuiCraftingMonitor((ContainerCraftingMonitor) getContainer(ID, player, tile), (TileCraftingMonitor) tile);
|
||||
case RefinedStorageGui.WIRELESS_TRANSMITTER:
|
||||
case RSGui.WIRELESS_TRANSMITTER:
|
||||
return new GuiWirelessTransmitter((ContainerWirelessTransmitter) getContainer(ID, player, tile));
|
||||
case RefinedStorageGui.CRAFTER:
|
||||
case RSGui.CRAFTER:
|
||||
return new GuiCrafter((ContainerCrafter) getContainer(ID, player, tile));
|
||||
case RefinedStorageGui.PROCESSING_PATTERN_ENCODER:
|
||||
case RSGui.PROCESSING_PATTERN_ENCODER:
|
||||
return new GuiProcessingPatternEncoder((ContainerProcessingPatternEncoder) getContainer(ID, player, tile), (TileProcessingPatternEncoder) tile);
|
||||
case RefinedStorageGui.GRID_FILTER:
|
||||
case RSGui.GRID_FILTER:
|
||||
return new GuiGridFilter(getGridFilterContainer(player, x));
|
||||
case RefinedStorageGui.NETWORK_TRANSMITTER:
|
||||
case RSGui.NETWORK_TRANSMITTER:
|
||||
return new GuiNetworkTransmitter((ContainerNetworkTransmitter) getContainer(ID, player, tile), (TileNetworkTransmitter) tile);
|
||||
case RefinedStorageGui.FLUID_INTERFACE:
|
||||
case RSGui.FLUID_INTERFACE:
|
||||
return new GuiFluidInterface((ContainerFluidInterface) getContainer(ID, player, tile));
|
||||
case RefinedStorageGui.FLUID_STORAGE:
|
||||
case RSGui.FLUID_STORAGE:
|
||||
return new GuiStorage((ContainerFluidStorage) getContainer(ID, player, tile), (TileFluidStorage) tile);
|
||||
case RefinedStorageGui.DISK_MANIPULATOR:
|
||||
case RSGui.DISK_MANIPULATOR:
|
||||
return new GuiDiskManipulator((ContainerDiskManipulator) getContainer(ID, player, tile));
|
||||
default:
|
||||
return null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package refinedstorage.gui;
|
||||
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.container.ContainerImporter;
|
||||
import refinedstorage.gui.sidebutton.SideButtonCompare;
|
||||
import refinedstorage.gui.sidebutton.SideButtonMode;
|
||||
@@ -21,8 +21,8 @@ public class GuiImporter extends GuiBase {
|
||||
|
||||
addSideButton(new SideButtonMode(this, TileImporter.MODE));
|
||||
|
||||
addSideButton(new SideButtonCompare(this, TileImporter.COMPARE, CompareUtils.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileImporter.COMPARE, CompareUtils.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, TileImporter.COMPARE, IComparer.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileImporter.COMPARE, IComparer.COMPARE_NBT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package refinedstorage.gui;
|
||||
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.container.ContainerInterface;
|
||||
import refinedstorage.gui.sidebutton.SideButtonCompare;
|
||||
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
||||
@@ -15,8 +15,8 @@ public class GuiInterface extends GuiBase {
|
||||
public void init(int x, int y) {
|
||||
addSideButton(new SideButtonRedstoneMode(this, TileInterface.REDSTONE_MODE));
|
||||
|
||||
addSideButton(new SideButtonCompare(this, TileInterface.COMPARE, CompareUtils.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileInterface.COMPARE, CompareUtils.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, TileInterface.COMPARE, IComparer.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, TileInterface.COMPARE, IComparer.COMPARE_NBT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,7 @@ package refinedstorage.gui;
|
||||
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.container.ContainerProcessingPatternEncoder;
|
||||
import refinedstorage.network.MessageGridPatternCreate;
|
||||
import refinedstorage.network.MessageProcessingPatternEncoderClear;
|
||||
@@ -73,11 +73,11 @@ public class GuiProcessingPatternEncoder extends GuiBase {
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
if (isOverCreatePattern(mouseX - guiLeft, mouseY - guiTop)) {
|
||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridPatternCreate(encoder.getPos().getX(), encoder.getPos().getY(), encoder.getPos().getZ()));
|
||||
RS.INSTANCE.network.sendToServer(new MessageGridPatternCreate(encoder.getPos().getX(), encoder.getPos().getY(), encoder.getPos().getZ()));
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
||||
} else if (isOverClear(mouseX - guiLeft, mouseY - guiTop)) {
|
||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageProcessingPatternEncoderClear(encoder));
|
||||
RS.INSTANCE.network.sendToServer(new MessageProcessingPatternEncoderClear(encoder));
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package refinedstorage.gui;
|
||||
|
||||
import com.google.common.primitives.Ints;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.container.ContainerBase;
|
||||
import refinedstorage.gui.sidebutton.SideButtonCompare;
|
||||
import refinedstorage.gui.sidebutton.SideButtonMode;
|
||||
@@ -51,8 +51,8 @@ public class GuiStorage extends GuiBase {
|
||||
}
|
||||
|
||||
if (gui.getCompareParameter() != null) {
|
||||
addSideButton(new SideButtonCompare(this, gui.getCompareParameter(), CompareUtils.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, gui.getCompareParameter(), CompareUtils.COMPARE_NBT));
|
||||
addSideButton(new SideButtonCompare(this, gui.getCompareParameter(), IComparer.COMPARE_DAMAGE));
|
||||
addSideButton(new SideButtonCompare(this, gui.getCompareParameter(), IComparer.COMPARE_NBT));
|
||||
}
|
||||
|
||||
if(gui.getVoidExcessParameter() != null) {
|
||||
|
||||
12
src/main/java/refinedstorage/gui/config/ModGuiConfig.java
Normal file → Executable file
12
src/main/java/refinedstorage/gui/config/ModGuiConfig.java
Normal file → Executable file
@@ -2,16 +2,16 @@ package refinedstorage.gui.config;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.fml.client.config.GuiConfig;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RS;
|
||||
|
||||
public class ModGuiConfig extends GuiConfig {
|
||||
|
||||
public ModGuiConfig(GuiScreen guiScreen) {
|
||||
super(guiScreen,
|
||||
RefinedStorage.INSTANCE.config.getConfigElements(),
|
||||
RefinedStorage.ID,
|
||||
false,
|
||||
false,
|
||||
GuiConfig.getAbridgedConfigPath(RefinedStorage.INSTANCE.config.getConfig().toString()));
|
||||
RS.INSTANCE.config.getConfigElements(),
|
||||
RS.ID,
|
||||
false,
|
||||
false,
|
||||
GuiConfig.getAbridgedConfigPath(RS.INSTANCE.config.getConfig().toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.container.ContainerCraftingSettings;
|
||||
import refinedstorage.gui.GuiBase;
|
||||
import refinedstorage.gui.grid.stack.ClientStackItem;
|
||||
@@ -124,7 +124,7 @@ public class GuiCraftingStart extends GuiBase {
|
||||
Integer quantity = Ints.tryParse(amountField.getText());
|
||||
|
||||
if (quantity != null && quantity > 0) {
|
||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridCraftingPreview(stack.getHash(), quantity));
|
||||
RS.INSTANCE.network.sendToServer(new MessageGridCraftingPreview(stack.getHash(), quantity));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.network.grid.IItemGridHandler;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.block.EnumGridType;
|
||||
import refinedstorage.container.ContainerGrid;
|
||||
import refinedstorage.gui.GuiBase;
|
||||
@@ -28,7 +28,7 @@ import refinedstorage.gui.grid.stack.ClientStackItem;
|
||||
import refinedstorage.gui.grid.stack.IClientStack;
|
||||
import refinedstorage.gui.sidebutton.*;
|
||||
import refinedstorage.integration.jei.IntegrationJEI;
|
||||
import refinedstorage.integration.jei.RefinedStorageJEIPlugin;
|
||||
import refinedstorage.integration.jei.RSJEIPlugin;
|
||||
import refinedstorage.network.*;
|
||||
import refinedstorage.tile.grid.IGrid;
|
||||
import refinedstorage.tile.grid.TileGrid;
|
||||
@@ -128,7 +128,7 @@ public class GuiGrid extends GuiBase {
|
||||
boolean found = filteredItems.isEmpty();
|
||||
|
||||
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;
|
||||
|
||||
break;
|
||||
@@ -356,16 +356,16 @@ public class GuiGrid extends GuiBase {
|
||||
if (clickedCreatePattern) {
|
||||
BlockPos gridPos = ((TileGrid) grid).getPos();
|
||||
|
||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridPatternCreate(gridPos.getX(), gridPos.getY(), gridPos.getZ()));
|
||||
RS.INSTANCE.network.sendToServer(new MessageGridPatternCreate(gridPos.getX(), gridPos.getY(), gridPos.getZ()));
|
||||
} else if (grid.isConnected()) {
|
||||
if (clickedClear) {
|
||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridCraftingClear((TileGrid) grid));
|
||||
RS.INSTANCE.network.sendToServer(new MessageGridCraftingClear((TileGrid) grid));
|
||||
}
|
||||
|
||||
ItemStack held = container.getPlayer().inventory.getItemStack();
|
||||
|
||||
if (isOverSlotArea(mouseX - guiLeft, mouseY - guiTop) && held != null && (clickedButton == 0 || clickedButton == 1)) {
|
||||
RefinedStorage.INSTANCE.network.sendToServer(grid.getType() == EnumGridType.FLUID ? new MessageGridFluidInsertHeld() : new MessageGridItemInsertHeld(clickedButton == 1));
|
||||
RS.INSTANCE.network.sendToServer(grid.getType() == EnumGridType.FLUID ? new MessageGridFluidInsertHeld() : new MessageGridItemInsertHeld(clickedButton == 1));
|
||||
}
|
||||
|
||||
if (isOverSlotWithItem()) {
|
||||
@@ -389,10 +389,10 @@ public class GuiGrid extends GuiBase {
|
||||
flags |= IItemGridHandler.EXTRACT_SINGLE;
|
||||
}
|
||||
|
||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridItemPull(stack.getHash(), flags));
|
||||
RS.INSTANCE.network.sendToServer(new MessageGridItemPull(stack.getHash(), flags));
|
||||
}
|
||||
} else if (grid.getType() == EnumGridType.FLUID && held == null) {
|
||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridFluidPull(STACKS.get(slotNumber).getHash(), GuiScreen.isShiftKeyDown()));
|
||||
RS.INSTANCE.network.sendToServer(new MessageGridFluidPull(STACKS.get(slotNumber).getHash(), GuiScreen.isShiftKeyDown()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -417,7 +417,7 @@ public class GuiGrid extends GuiBase {
|
||||
|
||||
private void updateJEI() {
|
||||
if (IntegrationJEI.isLoaded() && (grid.getSearchBoxMode() == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED || grid.getSearchBoxMode() == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED)) {
|
||||
RefinedStorageJEIPlugin.INSTANCE.getRuntime().getItemListOverlay().setFilterText(searchField.getText());
|
||||
RSJEIPlugin.INSTANCE.getRuntime().getItemListOverlay().setFilterText(searchField.getText());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package refinedstorage.gui.sidebutton;
|
||||
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
import refinedstorage.gui.GuiBase;
|
||||
import refinedstorage.tile.data.TileDataManager;
|
||||
import refinedstorage.tile.data.TileDataParameter;
|
||||
@@ -34,9 +34,9 @@ public class SideButtonCompare extends SideButton {
|
||||
protected void drawButtonIcon(int x, int y) {
|
||||
int ty = 0;
|
||||
|
||||
if (mask == CompareUtils.COMPARE_DAMAGE) {
|
||||
if (mask == IComparer.COMPARE_DAMAGE) {
|
||||
ty = 80;
|
||||
} else if (mask == CompareUtils.COMPARE_NBT) {
|
||||
} else if (mask == IComparer.COMPARE_NBT) {
|
||||
ty = 48;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package refinedstorage.integration.forgeenergy;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.RSItems;
|
||||
|
||||
public class WirelessGridEnergyForge implements IEnergyStorage {
|
||||
private ItemStack stack;
|
||||
@@ -13,22 +13,22 @@ public class WirelessGridEnergyForge implements IEnergyStorage {
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(int maxReceive, boolean simulate) {
|
||||
return RefinedStorageItems.WIRELESS_GRID.receiveEnergy(stack, maxReceive, simulate);
|
||||
return RSItems.WIRELESS_GRID.receiveEnergy(stack, maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(int maxExtract, boolean simulate) {
|
||||
return RefinedStorageItems.WIRELESS_GRID.extractEnergy(stack, maxExtract, simulate);
|
||||
return RSItems.WIRELESS_GRID.extractEnergy(stack, maxExtract, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored() {
|
||||
return RefinedStorageItems.WIRELESS_GRID.getEnergyStored(stack);
|
||||
return RSItems.WIRELESS_GRID.getEnergyStored(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored() {
|
||||
return RefinedStorageItems.WIRELESS_GRID.getMaxEnergyStored(stack);
|
||||
return RSItems.WIRELESS_GRID.getMaxEnergyStored(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package refinedstorage.integration.jei;
|
||||
|
||||
import mezz.jei.api.*;
|
||||
import mezz.jei.api.BlankModPlugin;
|
||||
import mezz.jei.api.IJeiRuntime;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
import refinedstorage.RSBlocks;
|
||||
import refinedstorage.container.ContainerSolderer;
|
||||
|
||||
@JEIPlugin
|
||||
public class RefinedStorageJEIPlugin extends BlankModPlugin {
|
||||
public static RefinedStorageJEIPlugin INSTANCE;
|
||||
public class RSJEIPlugin extends BlankModPlugin {
|
||||
public static RSJEIPlugin INSTANCE;
|
||||
|
||||
private IJeiRuntime runtime;
|
||||
|
||||
@@ -25,7 +28,7 @@ public class RefinedStorageJEIPlugin extends BlankModPlugin {
|
||||
|
||||
registry.addRecipes(RecipeMakerSolderer.getRecipes());
|
||||
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(RefinedStorageBlocks.SOLDERER), RecipeCategorySolderer.ID);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(RSBlocks.SOLDERER), RecipeCategorySolderer.ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,7 +1,7 @@
|
||||
package refinedstorage.integration.jei;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.api.RefinedStorageAPI;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.solderer.ISoldererRecipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -11,7 +11,7 @@ public final class RecipeMakerSolderer {
|
||||
public static List<RecipeWrapperSolderer> getRecipes() {
|
||||
List<RecipeWrapperSolderer> recipes = new ArrayList<>();
|
||||
|
||||
for (ISoldererRecipe recipe : RefinedStorageAPI.instance().getSoldererRegistry().getRecipes()) {
|
||||
for (ISoldererRecipe recipe : RSAPI.instance().getSoldererRegistry().getRecipes()) {
|
||||
List<ItemStack> inputs = new ArrayList<>();
|
||||
|
||||
inputs.add(recipe.getRow(0));
|
||||
|
||||
@@ -11,7 +11,7 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.container.ContainerGrid;
|
||||
import refinedstorage.network.MessageGridCraftingTransfer;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class RecipeTransferHandlerGrid implements IRecipeTransferHandler {
|
||||
}
|
||||
}
|
||||
|
||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridCraftingTransfer(recipe));
|
||||
RS.INSTANCE.network.sendToServer(new MessageGridCraftingTransfer(recipe));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -6,8 +6,8 @@ import mezz.jei.api.recipe.transfer.IRecipeTransferError;
|
||||
import mezz.jei.api.recipe.transfer.IRecipeTransferHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.api.network.NetworkUtils;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.api.RSAPI;
|
||||
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 = NetworkUtils.getItemStackHashCode(ingredient);
|
||||
int hash = RSAPI.instance().getItemStackHashCode(ingredient);
|
||||
|
||||
if (guiIngredient.isInput()) {
|
||||
if (inputs.containsKey(hash)) {
|
||||
@@ -55,7 +55,7 @@ public class RecipeTransferHandlerPattern implements IRecipeTransferHandler<Cont
|
||||
}
|
||||
}
|
||||
|
||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageProcessingPatternEncoderTransfer(inputs.values(), outputs.values()));
|
||||
RS.INSTANCE.network.sendToServer(new MessageProcessingPatternEncoderTransfer(inputs.values(), outputs.values()));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -3,7 +3,7 @@ package refinedstorage.integration.tesla;
|
||||
import net.darkhax.tesla.api.ITeslaConsumer;
|
||||
import net.darkhax.tesla.api.ITeslaHolder;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.RSItems;
|
||||
|
||||
public class WirelessGridEnergyTesla implements ITeslaHolder, ITeslaConsumer {
|
||||
private ItemStack stack;
|
||||
@@ -14,16 +14,16 @@ public class WirelessGridEnergyTesla implements ITeslaHolder, ITeslaConsumer {
|
||||
|
||||
@Override
|
||||
public long getStoredPower() {
|
||||
return RefinedStorageItems.WIRELESS_GRID.getEnergyStored(stack);
|
||||
return RSItems.WIRELESS_GRID.getEnergyStored(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCapacity() {
|
||||
return RefinedStorageItems.WIRELESS_GRID.getMaxEnergyStored(stack);
|
||||
return RSItems.WIRELESS_GRID.getMaxEnergyStored(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long givePower(long power, boolean simulated) {
|
||||
return RefinedStorageItems.WIRELESS_GRID.receiveEnergy(stack, (int) power, simulated);
|
||||
return RSItems.WIRELESS_GRID.receiveEnergy(stack, (int) power, simulated);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package refinedstorage.inventory;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.RSItems;
|
||||
import refinedstorage.apiimpl.storage.fluid.FluidStorageNBT;
|
||||
import refinedstorage.apiimpl.storage.item.ItemStorageNBT;
|
||||
|
||||
public interface IItemValidator {
|
||||
IItemValidator ITEM_STORAGE_DISK = new ItemValidatorBasic(RefinedStorageItems.STORAGE_DISK) {
|
||||
IItemValidator ITEM_STORAGE_DISK = new ItemValidatorBasic(RSItems.STORAGE_DISK) {
|
||||
@Override
|
||||
public boolean isValid(ItemStack disk) {
|
||||
return super.isValid(disk) && ItemStorageNBT.isValid(disk);
|
||||
}
|
||||
};
|
||||
IItemValidator FLUID_STORAGE_DISK = new ItemValidatorBasic(RefinedStorageItems.FLUID_STORAGE_DISK) {
|
||||
IItemValidator FLUID_STORAGE_DISK = new ItemValidatorBasic(RSItems.FLUID_STORAGE_DISK) {
|
||||
@Override
|
||||
public boolean isValid(ItemStack disk) {
|
||||
return super.isValid(disk) && FluidStorageNBT.isValid(disk);
|
||||
|
||||
@@ -3,7 +3,7 @@ package refinedstorage.inventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.RSItems;
|
||||
import refinedstorage.gui.grid.GridFilteredItem;
|
||||
import refinedstorage.gui.grid.GuiGrid;
|
||||
import refinedstorage.item.ItemGridFilter;
|
||||
@@ -14,7 +14,7 @@ public class ItemHandlerGridFilterInGrid extends ItemHandlerBasic {
|
||||
private List<GridFilteredItem> filteredItems;
|
||||
|
||||
public ItemHandlerGridFilterInGrid(List<GridFilteredItem> filteredItems) {
|
||||
super(4, new ItemValidatorBasic(RefinedStorageItems.GRID_FILTER));
|
||||
super(4, new ItemValidatorBasic(RSItems.GRID_FILTER));
|
||||
|
||||
this.filteredItems = filteredItems;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package refinedstorage.inventory;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.RSItems;
|
||||
import refinedstorage.item.ItemUpgrade;
|
||||
|
||||
public class ItemHandlerUpgrade extends ItemHandlerBasic {
|
||||
@@ -9,7 +9,7 @@ public class ItemHandlerUpgrade extends ItemHandlerBasic {
|
||||
super(size, tile, new IItemValidator[supportedUpgrades.length]);
|
||||
|
||||
for (int i = 0; i < supportedUpgrades.length; ++i) {
|
||||
this.validators[i] = new ItemValidatorBasic(RefinedStorageItems.UPGRADE, supportedUpgrades[i]);
|
||||
this.validators[i] = new ItemValidatorBasic(RSItems.UPGRADE, supportedUpgrades[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package refinedstorage.item;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RS;
|
||||
|
||||
public abstract class ItemBase extends Item {
|
||||
private String name;
|
||||
@@ -10,13 +10,13 @@ public abstract class ItemBase extends Item {
|
||||
public ItemBase(String name) {
|
||||
this.name = name;
|
||||
|
||||
setRegistryName(RefinedStorage.ID, name);
|
||||
setCreativeTab(RefinedStorage.INSTANCE.tab);
|
||||
setRegistryName(RS.ID, name);
|
||||
setCreativeTab(RS.INSTANCE.tab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "item." + RefinedStorage.ID + ":" + name;
|
||||
return "item." + RS.ID + ":" + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,8 +5,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
import refinedstorage.RS;
|
||||
import refinedstorage.RSBlocks;
|
||||
import refinedstorage.block.EnumControllerType;
|
||||
import refinedstorage.tile.TileController;
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
|
||||
public class ItemBlockController extends ItemBlockBase {
|
||||
public ItemBlockController() {
|
||||
super(RefinedStorageBlocks.CONTROLLER, RefinedStorageBlocks.CONTROLLER.getPlacementType(), true);
|
||||
super(RSBlocks.CONTROLLER, RSBlocks.CONTROLLER.getPlacementType(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -29,7 +29,7 @@ public class ItemBlockController extends ItemBlockBase {
|
||||
}
|
||||
|
||||
public static int getEnergyCapacity(ItemStack stack) {
|
||||
return (stack.hasTagCompound() && stack.getTagCompound().hasKey(TileController.NBT_ENERGY_CAPACITY)) ? stack.getTagCompound().getInteger(TileController.NBT_ENERGY_CAPACITY) : RefinedStorage.INSTANCE.config.controllerCapacity;
|
||||
return (stack.hasTagCompound() && stack.getTagCompound().hasKey(TileController.NBT_ENERGY_CAPACITY)) ? stack.getTagCompound().getInteger(TileController.NBT_ENERGY_CAPACITY) : RS.INSTANCE.config.controllerCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,7 +46,7 @@ public class ItemBlockController extends ItemBlockBase {
|
||||
tag = new NBTTagCompound();
|
||||
}
|
||||
|
||||
tag.setInteger(TileController.NBT_ENERGY, stack.getMetadata() == EnumControllerType.CREATIVE.getId() ? RefinedStorage.INSTANCE.config.controllerCapacity : 0);
|
||||
tag.setInteger(TileController.NBT_ENERGY, stack.getMetadata() == EnumControllerType.CREATIVE.getId() ? RS.INSTANCE.config.controllerCapacity : 0);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.RSBlocks;
|
||||
import refinedstorage.RSItems;
|
||||
import refinedstorage.apiimpl.storage.fluid.FluidStorageNBT;
|
||||
import refinedstorage.block.EnumFluidStorageType;
|
||||
import refinedstorage.tile.TileFluidStorage;
|
||||
@@ -20,7 +20,7 @@ import java.util.List;
|
||||
|
||||
public class ItemBlockFluidStorage extends ItemBlockBase {
|
||||
public ItemBlockFluidStorage() {
|
||||
super(RefinedStorageBlocks.FLUID_STORAGE, RefinedStorageBlocks.FLUID_STORAGE.getPlacementType(), true);
|
||||
super(RSBlocks.FLUID_STORAGE, RSBlocks.FLUID_STORAGE.getPlacementType(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,19 +43,19 @@ public class ItemBlockFluidStorage extends ItemBlockBase {
|
||||
EnumFluidStorageType type = EnumFluidStorageType.getById(stack.getMetadata());
|
||||
|
||||
if (type != null && stack.stackSize == 1 && isValid(stack) && FluidStorageNBT.getStoredFromNBT(stack.getTagCompound().getCompoundTag(TileFluidStorage.NBT_STORAGE)) == 0 && stack.getMetadata() != ItemFluidStorageDisk.TYPE_CREATIVE && !world.isRemote && player.isSneaking()) {
|
||||
ItemStack storagePart = new ItemStack(RefinedStorageItems.FLUID_STORAGE_PART, 1, stack.getMetadata());
|
||||
ItemStack storagePart = new ItemStack(RSItems.FLUID_STORAGE_PART, 1, stack.getMetadata());
|
||||
|
||||
if (!player.inventory.addItemStackToInventory(storagePart.copy())) {
|
||||
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), storagePart);
|
||||
}
|
||||
|
||||
ItemStack processor = new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC);
|
||||
ItemStack processor = new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC);
|
||||
|
||||
if (!player.inventory.addItemStackToInventory(processor.copy())) {
|
||||
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), processor);
|
||||
}
|
||||
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, new ItemStack(RefinedStorageBlocks.MACHINE_CASING));
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, new ItemStack(RSBlocks.MACHINE_CASING));
|
||||
}
|
||||
|
||||
return new ActionResult<>(EnumActionResult.PASS, stack);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user