diff --git a/dependencies.gradle b/dependencies.gradle index 3140d8c..78796b5 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -2,4 +2,5 @@ dependencies { compile("com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev") + compileOnly("curse.maven:cofh-core-69162:2388751") } diff --git a/repositories.gradle b/repositories.gradle index 7d02b58..c58a9d1 100644 --- a/repositories.gradle +++ b/repositories.gradle @@ -1,6 +1,9 @@ // Add any additional repositiroes for your dependencies here repositories { + maven { + url "https://cursemaven.com" + } maven { url = "https://jitpack.io" } diff --git a/src/main/java/cofh/api/CoFHAPIProps.java b/src/main/java/cofh/api/CoFHAPIProps.java deleted file mode 100644 index 7f000d4..0000000 --- a/src/main/java/cofh/api/CoFHAPIProps.java +++ /dev/null @@ -1,11 +0,0 @@ -package cofh.api; - -public class CoFHAPIProps { - - private CoFHAPIProps() { - - } - - public static final String VERSION = "1.7.10R1.0.13"; - -} diff --git a/src/main/java/cofh/api/package-info.java b/src/main/java/cofh/api/package-info.java deleted file mode 100644 index 08ff5fc..0000000 --- a/src/main/java/cofh/api/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * (C) 2014 Team CoFH / CoFH / Cult of the Full Hub - * http://www.teamcofh.com - */ -@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHLib", provides = "CoFHAPI") -package cofh.api; - -import cpw.mods.fml.common.API; - diff --git a/src/main/java/cofh/api/transport/IEnderAttuned.java b/src/main/java/cofh/api/transport/IEnderAttuned.java deleted file mode 100644 index 4a453f5..0000000 --- a/src/main/java/cofh/api/transport/IEnderAttuned.java +++ /dev/null @@ -1,13 +0,0 @@ -package cofh.api.transport; - -interface IEnderAttuned { - - public String getChannelString(); - - public int getFrequency(); - - public boolean setFrequency(int frequency); - - public boolean clearFrequency(); - -} diff --git a/src/main/java/cofh/api/transport/IEnderDestination.java b/src/main/java/cofh/api/transport/IEnderDestination.java deleted file mode 100644 index f3042a7..0000000 --- a/src/main/java/cofh/api/transport/IEnderDestination.java +++ /dev/null @@ -1,21 +0,0 @@ -package cofh.api.transport; - -public interface IEnderDestination extends IEnderAttuned { - - public boolean isNotValid(); - - public int x(); - - public int y(); - - public int z(); - - public int dimension(); - - public int getDestination(); - - public boolean setDestination(int frequency); - - public boolean clearDestination(); - -} diff --git a/src/main/java/cofh/api/transport/IEnderEnergyHandler.java b/src/main/java/cofh/api/transport/IEnderEnergyHandler.java deleted file mode 100644 index 892a5c6..0000000 --- a/src/main/java/cofh/api/transport/IEnderEnergyHandler.java +++ /dev/null @@ -1,35 +0,0 @@ -package cofh.api.transport; - -/** - * This interface is implemented on Ender Attuned objects which can receive Energy (Redstone Flux). - * - * @author King Lemming - * - */ -public interface IEnderEnergyHandler extends IEnderAttuned { - - /** - * Return whether or not the Ender Attuned object can currently send energy (Redstone Flux). - */ - boolean canSendEnergy(); - - /** - * This should be checked to see if the Ender Attuned object can currently receive energy (Redstone Flux). - * - * Note: In practice, this can (and should) be used to ensure that something does not send to itself. - */ - boolean canReceiveEnergy(); - - /** - * This tells the Ender Attuned object to receive energy. This returns the amount remaining, *not* the amount received - a return of 0 means that all energy - * was received! - * - * @param energy - * Amount of energy to be received. - * @param simulate - * If TRUE, the result will only be simulated. - * @return Amount of energy that is remaining (or would be remaining, if simulated). - */ - int receiveEnergy(int energy, boolean simulate); - -} diff --git a/src/main/java/cofh/api/transport/IEnderFluidHandler.java b/src/main/java/cofh/api/transport/IEnderFluidHandler.java deleted file mode 100644 index 2f509e8..0000000 --- a/src/main/java/cofh/api/transport/IEnderFluidHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -package cofh.api.transport; - -import net.minecraftforge.fluids.FluidStack; - -/** - * This interface is implemented on Ender Attuned objects which can receive Fluid. - * - * @author King Lemming - * - */ -public interface IEnderFluidHandler extends IEnderAttuned { - - /** - * Return whether or not the Ender Attuned object can currently send FluidStacks. - */ - boolean canSendFluid(); - - /** - * This should be checked to see if the Ender Attuned object can currently receive a FluidStack. - * - * Note: In practice, this can (and should) be used to ensure that something does not send to itself. - */ - boolean canReceiveFluid(); - - /** - * This tells the Ender Attuned object to receive a FluidStack. This returns what remains of the original stack, *not* the amount received - a null return - * means that the entire stack was received! - * - * @param fluid - * FluidStack to be received. - * @param simulate - * If TRUE, the result will only be simulated. - * @return FluidStack representing how much fluid is remaining (or would be remaining, if simulated). - */ - FluidStack receiveFluid(FluidStack fluid, boolean simulate); - -} diff --git a/src/main/java/cofh/api/transport/IEnderItemHandler.java b/src/main/java/cofh/api/transport/IEnderItemHandler.java deleted file mode 100644 index d5dad8f..0000000 --- a/src/main/java/cofh/api/transport/IEnderItemHandler.java +++ /dev/null @@ -1,38 +0,0 @@ -package cofh.api.transport; - -import net.minecraft.item.ItemStack; - -/** - * This interface is implemented on Ender Attuned objects which can receive Items. - * - * @author King Lemming - * - */ -public interface IEnderItemHandler extends IEnderAttuned { - - /** - * Return whether or not the Ender Attuned object can currently send ItemStacks. - */ - boolean canSendItems(); - - /** - * This should be checked to see if the Ender Attuned object can currently receive an ItemStack. - * - * Note: In practice, this can (and should) be used to ensure that something does not send to itself. - */ - boolean canReceiveItems(); - - /** - * This tells the Ender Attuned object to receive an ItemStack. This returns what remains of the original stack, *not* the amount received - a null return - * means that the entire stack was received! - * - * This function does not support simulation because Inventory manipulation in Minecraft is an absolute mess and it would be a computational liability to do - * so. - * - * @param item - * ItemStack to be received. - * @return An ItemStack representing how much is remaining. - */ - ItemStack receiveItem(ItemStack item); - -} diff --git a/src/main/java/cofh/api/transport/IItemDuct.java b/src/main/java/cofh/api/transport/IItemDuct.java deleted file mode 100644 index 6733834..0000000 --- a/src/main/java/cofh/api/transport/IItemDuct.java +++ /dev/null @@ -1,26 +0,0 @@ -package cofh.api.transport; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * This interface is implemented on ItemDucts. Use it to attempt to eject items into an entry point. - * - * @author Zeldo Kavira, King Lemming - * - */ -public interface IItemDuct { - - /** - * Insert an ItemStack into the IItemDuct. Will only accept items if there is a valid destination. This returns what is remaining of the original stack - a - * null return means that the entire stack was accepted/routed! - * - * @param from - * Orientation the item is inserted from. - * @param item - * ItemStack to be inserted. The size of this stack corresponds to the maximum amount to insert. - * @return An ItemStack representing how much is remaining after the item was inserted into the Duct. - */ - public ItemStack insertItem(ForgeDirection from, ItemStack item); - -} diff --git a/src/main/java/cofh/api/transport/RegistryEnderAttuned.java b/src/main/java/cofh/api/transport/RegistryEnderAttuned.java deleted file mode 100644 index 9213d95..0000000 --- a/src/main/java/cofh/api/transport/RegistryEnderAttuned.java +++ /dev/null @@ -1,389 +0,0 @@ -package cofh.api.transport; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.WorldServer; -import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.common.config.Configuration; - -public final class RegistryEnderAttuned { - - public static Map>> inputItem = new HashMap>>(); - public static Map>> inputFluid = new HashMap>>(); - public static Map>> inputEnergy = new HashMap>>(); - - public static Map>> outputItem = new HashMap>>(); - public static Map>> outputFluid = new HashMap>>(); - public static Map>> outputEnergy = new HashMap>>(); - - public static Map> outputTeleport = new HashMap>(); - - public static Configuration linkConf; - - public static Map clientFrequencyNames = new LinkedHashMap(); - public static Map clientFrequencyNamesReversed = new LinkedHashMap(); - - private static class EnderDestination { - - private final int dimension; - private final int x, y, z; - private IEnderDestination output; - - public EnderDestination(IEnderDestination output) { - - x = output.x(); - y = output.y(); - z = output.z(); - dimension = output.dimension(); - this.output = output; - } - - public boolean hasOutput() { - - return DimensionManager.isDimensionRegistered(dimension); - } - - public IEnderDestination getOutput() { - - if (output == null || output.isNotValid()) { - output = null; - if (!DimensionManager.isDimensionRegistered(dimension)) { - return null; - } - WorldServer world = DimensionManager.getWorld(dimension); - if (world == null) { - DimensionManager.initDimension(dimension); - world = DimensionManager.getWorld(dimension); - } - TileEntity te = world.getTileEntity(x, y, z); - if (te instanceof IEnderDestination) { - output = (IEnderDestination) te; - } - } - return output; - } - } - - public static void clear() { - - inputItem.clear(); - inputFluid.clear(); - inputEnergy.clear(); - outputItem.clear(); - outputFluid.clear(); - outputEnergy.clear(); - } - - public static List getLinkedItemInputs(IEnderItemHandler theAttuned) { - - if (inputItem.get(theAttuned.getChannelString()) == null) { - return null; - } - return inputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()); - } - - public static List getLinkedItemOutputs(IEnderItemHandler theAttuned) { - - if (outputItem.get(theAttuned.getChannelString()) == null) { - return null; - } - return outputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()); - } - - public static List getLinkedFluidInputs(IEnderFluidHandler theAttuned) { - - if (inputFluid.get(theAttuned.getChannelString()) == null) { - return null; - } - return inputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()); - } - - public static List getLinkedFluidOutputs(IEnderFluidHandler theAttuned) { - - if (outputFluid.get(theAttuned.getChannelString()) == null) { - return null; - } - return outputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()); - } - - public static List getLinkedEnergyInputs(IEnderEnergyHandler theAttuned) { - - if (inputEnergy.get(theAttuned.getChannelString()) == null) { - return null; - } - return inputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()); - } - - public static List getLinkedEnergyOutputs(IEnderEnergyHandler theAttuned) { - - if (outputEnergy.get(theAttuned.getChannelString()) == null) { - return null; - } - return outputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()); - } - - public static boolean hasDestination(IEnderDestination theAttuned) { - - return hasDestination(theAttuned, true); - } - - public static boolean hasDestination(IEnderDestination theAttuned, boolean to) { - - Map map = outputTeleport.get(theAttuned.getChannelString()); - if (map == null) { - return false; - } - EnderDestination dest = map.get(to ? theAttuned.getDestination() : theAttuned.getFrequency()); - return dest == null ? false : dest.hasOutput(); - } - - public static IEnderDestination getDestination(IEnderDestination theAttuned) { - - Map map = outputTeleport.get(theAttuned.getChannelString()); - if (map == null) { - return null; - } - EnderDestination dest = map.get(theAttuned.getDestination()); - return dest == null ? null : dest.getOutput(); - } - - /* HELPER FUNCTIONS */ - public static void addItemHandler(IEnderItemHandler theAttuned) { - - if (theAttuned.canSendItems()) { - if (inputItem.get(theAttuned.getChannelString()) == null) { - inputItem.put(theAttuned.getChannelString(), new HashMap>()); - } - if (inputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) == null) { - inputItem.get(theAttuned.getChannelString()).put(theAttuned.getFrequency(), new ArrayList()); - } - if (!inputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).contains(theAttuned)) { - inputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).add(theAttuned); - } - } - if (theAttuned.canReceiveItems()) { - if (outputItem.get(theAttuned.getChannelString()) == null) { - outputItem.put(theAttuned.getChannelString(), new HashMap>()); - } - if (outputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) == null) { - outputItem.get(theAttuned.getChannelString()).put(theAttuned.getFrequency(), new ArrayList()); - } - if (!outputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).contains(theAttuned)) { - outputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).add(theAttuned); - } - } - } - - public static void addFluidHandler(IEnderFluidHandler theAttuned) { - - if (theAttuned.canSendFluid()) { - if (inputFluid.get(theAttuned.getChannelString()) == null) { - inputFluid.put(theAttuned.getChannelString(), new HashMap>()); - } - if (inputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) == null) { - inputFluid.get(theAttuned.getChannelString()).put(theAttuned.getFrequency(), new ArrayList()); - } - if (!inputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).contains(theAttuned)) { - inputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).add(theAttuned); - } - } - if (theAttuned.canReceiveFluid()) { - if (outputFluid.get(theAttuned.getChannelString()) == null) { - outputFluid.put(theAttuned.getChannelString(), new HashMap>()); - } - if (outputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) == null) { - outputFluid.get(theAttuned.getChannelString()).put(theAttuned.getFrequency(), new ArrayList()); - } - if (!outputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).contains(theAttuned)) { - outputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).add(theAttuned); - } - } - } - - public static void addEnergyHandler(IEnderEnergyHandler theAttuned) { - - if (theAttuned.canSendEnergy()) { - if (inputEnergy.get(theAttuned.getChannelString()) == null) { - inputEnergy.put(theAttuned.getChannelString(), new HashMap>()); - } - if (inputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) == null) { - inputEnergy.get(theAttuned.getChannelString()).put(theAttuned.getFrequency(), new ArrayList()); - } - if (!inputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).contains(theAttuned)) { - inputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).add(theAttuned); - } - } - if (theAttuned.canReceiveEnergy()) { - if (outputEnergy.get(theAttuned.getChannelString()) == null) { - outputEnergy.put(theAttuned.getChannelString(), new HashMap>()); - } - if (outputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) == null) { - outputEnergy.get(theAttuned.getChannelString()).put(theAttuned.getFrequency(), new ArrayList()); - } - if (!outputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).contains(theAttuned)) { - outputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).add(theAttuned); - } - } - } - - public static void addDestination(IEnderDestination theAttuned) { - - if (!hasDestination(theAttuned, false)) { - if (outputTeleport.get(theAttuned.getChannelString()) == null) { - outputTeleport.put(theAttuned.getChannelString(), new HashMap()); - } - outputTeleport.get(theAttuned.getChannelString()).put(theAttuned.getFrequency(), new EnderDestination(theAttuned)); - } - } - - public static void removeItemHandler(IEnderItemHandler theAttuned) { - - if (inputItem.get(theAttuned.getChannelString()) != null) { - if (inputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) != null) { - inputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).remove(theAttuned); - if (inputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).size() == 0) { - inputItem.get(theAttuned.getChannelString()).remove(theAttuned.getFrequency()); - } - } - } - if (outputItem.get(theAttuned.getChannelString()) != null) { - if (outputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) != null) { - outputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).remove(theAttuned); - if (outputItem.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).size() == 0) { - outputItem.get(theAttuned.getChannelString()).remove(theAttuned.getFrequency()); - } - } - } - } - - public static void removeFluidHandler(IEnderFluidHandler theAttuned) { - - if (inputFluid.get(theAttuned.getChannelString()) != null) { - if (inputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) != null) { - inputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).remove(theAttuned); - if (inputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).size() == 0) { - inputFluid.get(theAttuned.getChannelString()).remove(theAttuned.getFrequency()); - } - } - } - if (outputFluid.get(theAttuned.getChannelString()) != null) { - if (outputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) != null) { - outputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).remove(theAttuned); - if (outputFluid.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).size() == 0) { - outputFluid.get(theAttuned.getChannelString()).remove(theAttuned.getFrequency()); - } - } - } - } - - public static void removeEnergyHandler(IEnderEnergyHandler theAttuned) { - - if (inputEnergy.get(theAttuned.getChannelString()) != null) { - if (inputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) != null) { - inputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).remove(theAttuned); - if (inputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).size() == 0) { - inputEnergy.get(theAttuned.getChannelString()).remove(theAttuned.getFrequency()); - } - } - } - if (outputEnergy.get(theAttuned.getChannelString()) != null) { - if (outputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()) != null) { - outputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).remove(theAttuned); - if (outputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency()).size() == 0) { - outputEnergy.get(theAttuned.getChannelString()).remove(theAttuned.getFrequency()); - } - } - } - } - - public static void removeDestination(IEnderDestination theAttuned) { - - Map map = outputTeleport.get(theAttuned.getChannelString()); - if (map == null) { - return; - } - EnderDestination dest = map.get(theAttuned.getFrequency()); - if (dest == null) { - return; - } - if (dest.dimension == theAttuned.dimension()) { - if (dest.x == theAttuned.x() && dest.y == theAttuned.x() && dest.z == theAttuned.x()) { - map.remove(theAttuned.getFrequency()); - } - } - } - - public static void add(IEnderAttuned theAttuned) { - - if (theAttuned instanceof IEnderItemHandler) { - addItemHandler((IEnderItemHandler) theAttuned); - } - if (theAttuned instanceof IEnderFluidHandler) { - addFluidHandler((IEnderFluidHandler) theAttuned); - } - if (theAttuned instanceof IEnderEnergyHandler) { - addEnergyHandler((IEnderEnergyHandler) theAttuned); - } - if (theAttuned instanceof IEnderDestination) { - addDestination((IEnderDestination) theAttuned); - } - } - - public static void remove(IEnderAttuned theAttuned) { - - if (theAttuned instanceof IEnderItemHandler) { - removeItemHandler((IEnderItemHandler) theAttuned); - } - if (theAttuned instanceof IEnderFluidHandler) { - removeFluidHandler((IEnderFluidHandler) theAttuned); - } - if (theAttuned instanceof IEnderEnergyHandler) { - removeEnergyHandler((IEnderEnergyHandler) theAttuned); - } - if (theAttuned instanceof IEnderDestination) { - removeDestination((IEnderDestination) theAttuned); - } - } - - public static void sortClientNames() { - - List> list = new ArrayList>(clientFrequencyNames.entrySet()); - Collections.sort(list, new Comparator>() { - - @Override - public int compare(Map.Entry o1, Map.Entry o2) { - - int int1 = Integer.valueOf(clientFrequencyNamesReversed.get(o1.getValue())); - int int2 = Integer.valueOf(clientFrequencyNamesReversed.get(o2.getValue())); - return int1 > int2 ? 1 : int1 == int2 ? 0 : -1; - } - }); - Map result = new LinkedHashMap(); - for (Map.Entry entry : list) { - result.put(entry.getKey(), entry.getValue()); - } - clientFrequencyNames = result; - } - - public static void clearClientNames() { - - clientFrequencyNames.clear(); - clientFrequencyNamesReversed.clear(); - } - - public static void addClientNames(String owner, String name) { - - if (!owner.isEmpty()) { - clientFrequencyNames.put(owner, name); - clientFrequencyNamesReversed.put(name, owner); - } - } - -} diff --git a/src/main/java/cofh/api/transport/package-info.java b/src/main/java/cofh/api/transport/package-info.java deleted file mode 100644 index fae0150..0000000 --- a/src/main/java/cofh/api/transport/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * (C) 2014 Team CoFH / CoFH / Cult of the Full Hub - * http://www.teamcofh.com - */ -@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|transport") -package cofh.api.transport; - -import cofh.api.CoFHAPIProps; -import cpw.mods.fml.common.API; -