diff --git a/build.gradle b/build.gradle index c436530f8..8a0863e28 100644 --- a/build.gradle +++ b/build.gradle @@ -58,6 +58,9 @@ dependencies { compile "codechicken:ForgeMultipart:${config.minecraft_version}-${config.FMP_version}:dev" compile "codechicken:NotEnoughItems:${config.minecraft_version}-${config.NEI_version}:dev" compile "codechicken:CodeChickenCore:${config.minecraft_version}-${config.CCC_version}:dev" + compile "inventorytweaks:inventory-tweaks:1.7.10-1.60.0:api" + compile "net.industrial-craft:industrialcraft-2:2.2.828-experimental:api" + compile "mcp.mobius.waila:Waila:1.5.10_1.7.10:dev" } version = "${config.minecraft_version}-${config.mod_version}" diff --git a/libs/CoFHCore-[1.7.10]3.1.4-329.jar b/libs/CoFHCore-[1.7.10]3.1.4-329.jar new file mode 100644 index 000000000..25a65e710 Binary files /dev/null and b/libs/CoFHCore-[1.7.10]3.1.4-329.jar differ diff --git a/libs/ComputerCraft1.75.jar b/libs/ComputerCraft1.75.jar new file mode 100644 index 000000000..304bc9cc2 Binary files /dev/null and b/libs/ComputerCraft1.75.jar differ diff --git a/libs/GalacticraftCore-1.7-3.0.12.504.jar b/libs/GalacticraftCore-1.7-3.0.12.504.jar new file mode 100644 index 000000000..c176092ef Binary files /dev/null and b/libs/GalacticraftCore-1.7-3.0.12.504.jar differ diff --git a/libs/MineFactoryReloaded-[1.7.10]2.8.1-174.jar b/libs/MineFactoryReloaded-[1.7.10]2.8.1-174.jar new file mode 100644 index 000000000..a27b2f113 Binary files /dev/null and b/libs/MineFactoryReloaded-[1.7.10]2.8.1-174.jar differ diff --git a/libs/OpenComputers-MC1.7.10-1.7.6+e84596e-api.jar b/libs/OpenComputers-MC1.7.10-1.7.6+e84596e-api.jar new file mode 100644 index 000000000..78eaf8f23 Binary files /dev/null and b/libs/OpenComputers-MC1.7.10-1.7.6+e84596e-api.jar differ diff --git a/libs/buildcraft-7.1.24-api.jar b/libs/buildcraft-7.1.24-api.jar new file mode 100644 index 000000000..47ffa65e6 Binary files /dev/null and b/libs/buildcraft-7.1.24-api.jar differ diff --git a/src/api/java/buildcraft/api/core/BCLog.java b/src/api/java/buildcraft/api/core/BCLog.java deleted file mode 100755 index cbf66453a..000000000 --- a/src/api/java/buildcraft/api/core/BCLog.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.core; - -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public final class BCLog { - public static final Logger logger = LogManager.getLogger("BuildCraft"); - - private BCLog() { - } - - @Deprecated - public static void logErrorAPI(String mod, Throwable error, Class classFile) { - logErrorAPI(error, classFile); - } - - public static void logErrorAPI(Throwable error, Class classFile) { - StringBuilder msg = new StringBuilder("API error! Please update your mods. Error: "); - msg.append(error); - StackTraceElement[] stackTrace = error.getStackTrace(); - if (stackTrace.length > 0) { - msg.append(", ").append(stackTrace[0]); - } - - logger.log(Level.ERROR, msg.toString()); - - if (classFile != null) { - msg.append("API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation()); - logger.log(Level.ERROR, msg.toString()); - } - } - - @Deprecated - public static String getVersion() { - return BuildCraftAPI.getVersion(); - } -} diff --git a/src/api/java/buildcraft/api/core/BlockIndex.java b/src/api/java/buildcraft/api/core/BlockIndex.java deleted file mode 100755 index 4553a2cf6..000000000 --- a/src/api/java/buildcraft/api/core/BlockIndex.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.core; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -/** - * This class is a comparable container for integer block positions. - */ -public class BlockIndex implements Comparable { - public int x; - public int y; - public int z; - - public BlockIndex() { - - } - - /** - * Creates an index for a block located on x, y. z - */ - public BlockIndex(int x, int y, int z) { - this.x = x; - this.y = y; - this.z = z; - } - - public BlockIndex(NBTTagCompound c) { - this.x = c.getInteger("i"); - this.y = c.getInteger("j"); - this.z = c.getInteger("k"); - } - - public BlockIndex(Entity entity) { - x = (int) Math.floor(entity.posX); - y = (int) Math.floor(entity.posY); - z = (int) Math.floor(entity.posZ); - } - - public BlockIndex(TileEntity entity) { - this(entity.xCoord, entity.yCoord, entity.zCoord); - } - - /** - * Provides a deterministic and complete ordering of block positions. - */ - @Override - public int compareTo(BlockIndex o) { - if (o.x < x) { - return 1; - } else if (o.x > x) { - return -1; - } else if (o.z < z) { - return 1; - } else if (o.z > z) { - return -1; - } else if (o.y < y) { - return 1; - } else if (o.y > y) { - return -1; - } else { - return 0; - } - } - - public void writeTo(NBTTagCompound c) { - c.setInteger("i", x); - c.setInteger("j", y); - c.setInteger("k", z); - } - - public Block getBlock(World world) { - return world.getBlock(x, y, z); - } - - @Override - public String toString() { - return "{" + x + ", " + y + ", " + z + "}"; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof BlockIndex) { - BlockIndex b = (BlockIndex) obj; - - return b.x == x && b.y == y && b.z == z; - } - - return false; - } - - @Override - public int hashCode() { - return (x * 37 + y) * 37 + z; - } - - public boolean nextTo(BlockIndex blockIndex) { - return (Math.abs(blockIndex.x - x) <= 1 && blockIndex.y == y && blockIndex.z == z) - || (blockIndex.x == x && Math.abs(blockIndex.y - y) <= 1 && blockIndex.z == z) - || (blockIndex.x == x && blockIndex.y == y && Math.abs(blockIndex.z - z) <= 1); - } -} diff --git a/src/api/java/buildcraft/api/core/BuildCraftAPI.java b/src/api/java/buildcraft/api/core/BuildCraftAPI.java deleted file mode 100755 index c7300aef5..000000000 --- a/src/api/java/buildcraft/api/core/BuildCraftAPI.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.core; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Set; - -import net.minecraft.block.Block; -import net.minecraft.world.World; - -public final class BuildCraftAPI { - - public static ICoreProxy proxy; - - public static final Set softBlocks = new HashSet(); - public static final HashMap worldProperties = new HashMap(); - - /** - * Deactivate constructor - */ - private BuildCraftAPI() { - } - - public static String getVersion() { - try { - Class clazz = Class.forName("buildcraft.core.Version"); - Method method = clazz.getDeclaredMethod("getVersion"); - return String.valueOf(method.invoke(null)); - } catch (Exception e) { - return "UNKNOWN VERSION"; - } - } - - public static IWorldProperty getWorldProperty(String name) { - return worldProperties.get(name); - } - - public static void registerWorldProperty(String name, IWorldProperty property) { - if (worldProperties.containsKey(name)) { - BCLog.logger.warn("The WorldProperty key '" + name + "' is being overidden with " + property.getClass().getSimpleName() + "!"); - } - worldProperties.put(name, property); - } - - public static boolean isSoftBlock(World world, int x, int y, int z) { - return worldProperties.get("soft").get(world, x, y, z); - } -} diff --git a/src/api/java/buildcraft/api/core/EnumColor.java b/src/api/java/buildcraft/api/core/EnumColor.java deleted file mode 100755 index 2147e7261..000000000 --- a/src/api/java/buildcraft/api/core/EnumColor.java +++ /dev/null @@ -1,201 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.core; - -import java.util.Locale; -import java.util.Random; - -import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public enum EnumColor { - - BLACK, - RED, - GREEN, - BROWN, - BLUE, - PURPLE, - CYAN, - LIGHT_GRAY, - GRAY, - PINK, - LIME, - YELLOW, - LIGHT_BLUE, - MAGENTA, - ORANGE, - WHITE; - - public static final EnumColor[] VALUES = values(); - public static final String[] DYES = { - "dyeBlack", - "dyeRed", - "dyeGreen", - "dyeBrown", - "dyeBlue", - "dyePurple", - "dyeCyan", - "dyeLightGray", - "dyeGray", - "dyePink", - "dyeLime", - "dyeYellow", - "dyeLightBlue", - "dyeMagenta", - "dyeOrange", - "dyeWhite"}; - public static final String[] NAMES = { - "Black", - "Red", - "Green", - "Brown", - "Blue", - "Purple", - "Cyan", - "LightGray", - "Gray", - "Pink", - "Lime", - "Yellow", - "LightBlue", - "Magenta", - "Orange", - "White"}; - public static final int[] DARK_HEX = { - 0x2D2D2D, - 0xA33835, - 0x394C1E, - 0x5C3A24, - 0x3441A2, - 0x843FBF, - 0x36809E, - 0x888888, - 0x444444, - 0xE585A0, - 0x3FAA36, - 0xCFC231, - 0x7F9AD1, - 0xFF64FF, - 0xFF6A00, - 0xFFFFFF}; - public static final int[] LIGHT_HEX = { - 0x181414, - 0xBE2B27, - 0x007F0E, - 0x89502D, - 0x253193, - 0x7e34bf, - 0x299799, - 0xa0a7a7, - 0x7A7A7A, - 0xD97199, - 0x39D52E, - 0xFFD91C, - 0x66AAFF, - 0xD943C6, - 0xEA7835, - 0xe4e4e4}; - - @SideOnly(Side.CLIENT) - private static IIcon[] brushIcons; - - public int getDarkHex() { - return DARK_HEX[ordinal()]; - } - - public int getLightHex() { - return LIGHT_HEX[ordinal()]; - } - - public static EnumColor fromId(int id) { - if (id < 0 || id >= VALUES.length) { - return WHITE; - } - return VALUES[id]; - } - - public static EnumColor fromDye(String dyeTag) { - for (int id = 0; id < DYES.length; id++) { - if (DYES[id].equals(dyeTag)) { - return VALUES[id]; - } - } - return null; - } - - public static EnumColor fromName(String name) { - for (int id = 0; id < NAMES.length; id++) { - if (NAMES[id].equals(name)) { - return VALUES[id]; - } - } - return null; - } - - public static EnumColor getRand() { - return VALUES[new Random().nextInt(VALUES.length)]; - } - - public EnumColor getNext() { - EnumColor next = VALUES[(ordinal() + 1) % VALUES.length]; - return next; - } - - public EnumColor getPrevious() { - EnumColor previous = VALUES[(ordinal() + VALUES.length - 1) % VALUES.length]; - return previous; - } - - public EnumColor inverse() { - return EnumColor.VALUES[15 - ordinal()]; - } - - public String getTag() { - return "color." + name().replace("_", ".").toLowerCase(Locale.ENGLISH); - } - - public String getBasicTag() { - return name().replace("_", ".").toLowerCase(Locale.ENGLISH); - } - - public String getName() { - return NAMES[ordinal()]; - } - - public String getLocalizedName() { - return StatCollector.translateToLocal(getTag()); - } - - public String getDye() { - return DYES[ordinal()]; - } - - @Override - public String toString() { - String s = name().replace("_", " "); - String[] words = s.split(" "); - StringBuilder b = new StringBuilder(); - for (String word : words) { - b.append(word.charAt(0)).append(word.substring(1).toLowerCase(Locale.ENGLISH)).append(" "); - } - return b.toString().trim(); - } - - public static void setIconArray(IIcon[] icons) { - brushIcons = icons; - } - - @SideOnly(Side.CLIENT) - public IIcon getIcon() { - return brushIcons [ordinal()]; - } -} diff --git a/src/api/java/buildcraft/api/core/IAreaProvider.java b/src/api/java/buildcraft/api/core/IAreaProvider.java deleted file mode 100755 index 4abcf6e95..000000000 --- a/src/api/java/buildcraft/api/core/IAreaProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.core; - -/** - * To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers. - */ -public interface IAreaProvider { - int xMin(); - - int yMin(); - - int zMin(); - - int xMax(); - - int yMax(); - - int zMax(); - - /** - * Remove from the world all objects used to define the area. - */ - void removeFromWorld(); -} diff --git a/src/api/java/buildcraft/api/core/IBox.java b/src/api/java/buildcraft/api/core/IBox.java deleted file mode 100755 index e1e6f7d80..000000000 --- a/src/api/java/buildcraft/api/core/IBox.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.core; - -public interface IBox extends IZone { - - IBox expand(int amount); - - IBox contract(int amount); - - Position pMin(); - - Position pMax(); - - void createLaserData(); - -} diff --git a/src/api/java/buildcraft/api/core/ICoreProxy.java b/src/api/java/buildcraft/api/core/ICoreProxy.java deleted file mode 100755 index 272faebfd..000000000 --- a/src/api/java/buildcraft/api/core/ICoreProxy.java +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.core; - -import java.lang.ref.WeakReference; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.WorldServer; - -public interface ICoreProxy { - WeakReference getBuildCraftPlayer(WorldServer world); -} diff --git a/src/api/java/buildcraft/api/core/IIconProvider.java b/src/api/java/buildcraft/api/core/IIconProvider.java deleted file mode 100755 index fa8657e64..000000000 --- a/src/api/java/buildcraft/api/core/IIconProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.core; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.util.IIcon; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public interface IIconProvider { - - /** - * @param iconIndex - */ - @SideOnly(Side.CLIENT) - IIcon getIcon(int iconIndex); - - /** - * A call for the provider to register its Icons. This may be called multiple times but should only be executed once per provider - * @param iconRegister - */ - @SideOnly(Side.CLIENT) - void registerIcons(IIconRegister iconRegister); - -} diff --git a/src/api/java/buildcraft/api/core/IInvSlot.java b/src/api/java/buildcraft/api/core/IInvSlot.java deleted file mode 100755 index ea7a7fa30..000000000 --- a/src/api/java/buildcraft/api/core/IInvSlot.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.core; - -import net.minecraft.item.ItemStack; - -public interface IInvSlot { - /** - * Returns the slot number of the underlying Inventory. - * - * @return the slot number - */ - int getIndex(); - - boolean canPutStackInSlot(ItemStack stack); - - boolean canTakeStackFromSlot(ItemStack stack); - - boolean isItemValidForSlot(ItemStack stack); - - ItemStack decreaseStackInSlot(int amount); - - ItemStack getStackInSlot(); - - void setStackInSlot(ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/core/INBTStoreable.java b/src/api/java/buildcraft/api/core/INBTStoreable.java deleted file mode 100755 index 669eed33c..000000000 --- a/src/api/java/buildcraft/api/core/INBTStoreable.java +++ /dev/null @@ -1,8 +0,0 @@ -package buildcraft.api.core; - -import net.minecraft.nbt.NBTTagCompound; - -public interface INBTStoreable { - void readFromNBT(NBTTagCompound tag); - void writeToNBT(NBTTagCompound tag); -} diff --git a/src/api/java/buildcraft/api/core/IPathProvider.java b/src/api/java/buildcraft/api/core/IPathProvider.java deleted file mode 100755 index 32001925f..000000000 --- a/src/api/java/buildcraft/api/core/IPathProvider.java +++ /dev/null @@ -1,15 +0,0 @@ -package buildcraft.api.core; - -import java.util.List; - -/** - * To be implemented by TileEntities able to provide a path on the world, typically BuildCraft path markers. - */ -public interface IPathProvider { - List getPath(); - - /** - * Remove from the world all objects used to define the path. - */ - void removeFromWorld(); -} diff --git a/src/api/java/buildcraft/api/core/ISerializable.java b/src/api/java/buildcraft/api/core/ISerializable.java deleted file mode 100755 index a7d011ebb..000000000 --- a/src/api/java/buildcraft/api/core/ISerializable.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public - * License 1.0, or MMPL. Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - */ -package buildcraft.api.core; - -import io.netty.buffer.ByteBuf; - -/** - * Implemented by classes representing serializable packet state - */ -public interface ISerializable { - /** - * Serializes the state to the stream - * - * @param data - */ - void writeData(ByteBuf data); - - /** - * Deserializes the state from the stream - * - * @param data - */ - void readData(ByteBuf data); -} diff --git a/src/api/java/buildcraft/api/core/IWorldProperty.java b/src/api/java/buildcraft/api/core/IWorldProperty.java deleted file mode 100755 index a55bef1fc..000000000 --- a/src/api/java/buildcraft/api/core/IWorldProperty.java +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.core; - -import net.minecraft.world.World; - -public interface IWorldProperty { - boolean get(World world, int x, int y, int z); - - void clear(); -} diff --git a/src/api/java/buildcraft/api/core/IZone.java b/src/api/java/buildcraft/api/core/IZone.java deleted file mode 100755 index 55ef4f80e..000000000 --- a/src/api/java/buildcraft/api/core/IZone.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.core; - -import java.util.Random; - -public interface IZone { - - double distanceTo(BlockIndex index); - - double distanceToSquared(BlockIndex index); - - boolean contains(double x, double y, double z); - - BlockIndex getRandomBlockIndex(Random rand); - -} diff --git a/src/api/java/buildcraft/api/core/JavaTools.java b/src/api/java/buildcraft/api/core/JavaTools.java deleted file mode 100755 index e8dd4d898..000000000 --- a/src/api/java/buildcraft/api/core/JavaTools.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.core; - -import java.util.Arrays; - -public final class JavaTools { - private JavaTools(){ - - } - - public static T[] concat(T[] first, T[] second) { - T[] result = Arrays.copyOf(first, first.length + second.length); - System.arraycopy(second, 0, result, first.length, second.length); - return result; - } - - public static int[] concat(int[] first, int[] second) { - int[] result = Arrays.copyOf(first, first.length + second.length); - System.arraycopy(second, 0, result, first.length, second.length); - return result; - } - - public static float[] concat(float[] first, float[] second) { - float[] result = Arrays.copyOf(first, first.length + second.length); - System.arraycopy(second, 0, result, first.length, second.length); - return result; - } - - public static String surroundWithQuotes(String stringToSurroundWithQuotes) { - return String.format("\"%s\"", stringToSurroundWithQuotes); - } - - public static String stripSurroundingQuotes(String stringToStripQuotes) { - return stringToStripQuotes.replaceAll("^\"|\"$", ""); - } -} diff --git a/src/api/java/buildcraft/api/core/Position.java b/src/api/java/buildcraft/api/core/Position.java deleted file mode 100755 index 6fa0abbe7..000000000 --- a/src/api/java/buildcraft/api/core/Position.java +++ /dev/null @@ -1,199 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.core; - -import io.netty.buffer.ByteBuf; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -public class Position implements ISerializable { - public double x, y, z; - public ForgeDirection orientation; - - public Position() { - x = 0; - y = 0; - z = 0; - orientation = ForgeDirection.UNKNOWN; - } - - public Position(double ci, double cj, double ck) { - x = ci; - y = cj; - z = ck; - orientation = ForgeDirection.UNKNOWN; - } - - public Position(double ci, double cj, double ck, ForgeDirection corientation) { - x = ci; - y = cj; - z = ck; - orientation = corientation; - - if (orientation == null) { - orientation = ForgeDirection.UNKNOWN; - } - } - - public Position(Position p) { - x = p.x; - y = p.y; - z = p.z; - orientation = p.orientation; - } - - public Position(NBTTagCompound nbttagcompound) { - readFromNBT(nbttagcompound); - } - - public Position(TileEntity tile) { - x = tile.xCoord; - y = tile.yCoord; - z = tile.zCoord; - orientation = ForgeDirection.UNKNOWN; - } - - public Position(BlockIndex index) { - x = index.x; - y = index.y; - z = index.z; - orientation = ForgeDirection.UNKNOWN; - } - - public void moveRight(double step) { - switch (orientation) { - case SOUTH: - x = x - step; - break; - case NORTH: - x = x + step; - break; - case EAST: - z = z + step; - break; - case WEST: - z = z - step; - break; - default: - } - } - - public void moveLeft(double step) { - moveRight(-step); - } - - public void moveForwards(double step) { - switch (orientation) { - case UP: - y = y + step; - break; - case DOWN: - y = y - step; - break; - case SOUTH: - z = z + step; - break; - case NORTH: - z = z - step; - break; - case EAST: - x = x + step; - break; - case WEST: - x = x - step; - break; - default: - } - } - - public void moveBackwards(double step) { - moveForwards(-step); - } - - public void moveUp(double step) { - switch (orientation) { - case SOUTH: - case NORTH: - case EAST: - case WEST: - y = y + step; - break; - default: - } - - } - - public void moveDown(double step) { - moveUp(-step); - } - - public void writeToNBT(NBTTagCompound nbttagcompound) { - if (orientation == null) { - orientation = ForgeDirection.UNKNOWN; - } - - nbttagcompound.setDouble("i", x); - nbttagcompound.setDouble("j", y); - nbttagcompound.setDouble("k", z); - nbttagcompound.setByte("orientation", (byte) orientation.ordinal()); - } - - public void readFromNBT(NBTTagCompound nbttagcompound) { - x = nbttagcompound.getDouble("i"); - y = nbttagcompound.getDouble("j"); - z = nbttagcompound.getDouble("k"); - orientation = ForgeDirection.values() [nbttagcompound.getByte("orientation")]; - } - - @Override - public String toString() { - return "{" + x + ", " + y + ", " + z + "}"; - } - - public Position min(Position p) { - return new Position(p.x > x ? x : p.x, p.y > y ? y : p.y, p.z > z ? z : p.z); - } - - public Position max(Position p) { - return new Position(p.x < x ? x : p.x, p.y < y ? y : p.y, p.z < z ? z : p.z); - } - - public boolean isClose(Position newPosition, float f) { - double dx = x - newPosition.x; - double dy = y - newPosition.y; - double dz = z - newPosition.z; - - double sqrDis = dx * dx + dy * dy + dz * dz; - - return !(sqrDis > f * f); - } - - @Override - public void readData(ByteBuf stream) { - x = stream.readDouble(); - y = stream.readDouble(); - z = stream.readDouble(); - orientation = ForgeDirection.getOrientation(stream.readByte()); - } - - @Override - public void writeData(ByteBuf stream) { - stream.writeDouble(x); - stream.writeDouble(y); - stream.writeDouble(z); - stream.writeByte(orientation.ordinal()); - } - - @Override - public int hashCode() { - return (51 * (int) x) + (13 * (int) y) + (int) z; - } -} diff --git a/src/api/java/buildcraft/api/core/SafeTimeTracker.java b/src/api/java/buildcraft/api/core/SafeTimeTracker.java deleted file mode 100755 index 3e56ee989..000000000 --- a/src/api/java/buildcraft/api/core/SafeTimeTracker.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.core; - -import net.minecraft.world.World; - -public class SafeTimeTracker { - - private long lastMark = Long.MIN_VALUE; - private long duration = -1; - private long randomRange = 0; - private long lastRandomDelay = 0; - private long internalDelay = 1; - - /** - * @deprecated should use constructors with parameters instead - */ - public SafeTimeTracker () { - - } - - public SafeTimeTracker (long delay) { - internalDelay = delay; - } - - /** - * In many situations, it is a bad idea to have all objects of the same - * kind to be waiting for the exact same amount of time, as that can lead - * to some situation where they're all synchronized and got to work all - * at the same time. When created with a random range, the mark that is set - * when reaching the expect delay will be added with a random number - * between [0, range[, meaning that the event will take between 0 and range - * more tick to run. - */ - public SafeTimeTracker (long delay, long random) { - internalDelay = delay; - randomRange = random; - } - - public boolean markTimeIfDelay(World world) { - return markTimeIfDelay(world, internalDelay); - } - - /** - * Return true if a given delay has passed since last time marked was called - * successfully. - * - * @deprecated should use the constructor with a delay instead, and call - * this function without a parameter - */ - public boolean markTimeIfDelay(World world, long delay) { - if (world == null) { - return false; - } - - long currentTime = world.getTotalWorldTime(); - - if (currentTime < lastMark) { - lastMark = currentTime; - return false; - } else if (lastMark + delay + lastRandomDelay <= currentTime) { - duration = currentTime - lastMark; - lastMark = currentTime; - lastRandomDelay = (int) (Math.random() * randomRange); - - return true; - } else { - return false; - } - } - - public long durationOfLastDelay() { - return duration > 0 ? duration : 0; - } - - public void markTime(World world) { - lastMark = world.getTotalWorldTime(); - } -} \ No newline at end of file diff --git a/src/api/java/buildcraft/api/core/StackKey.java b/src/api/java/buildcraft/api/core/StackKey.java deleted file mode 100755 index 776aaafdf..000000000 --- a/src/api/java/buildcraft/api/core/StackKey.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.core; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; - -/** - * This class is used whenever stacks needs to be stored as keys. - */ -public final class StackKey { - public final ItemStack stack; - public final FluidStack fluidStack; - - public StackKey(FluidStack fluidStack) { - this(null, fluidStack); - } - - public StackKey(ItemStack stack) { - this(stack, null); - } - - public StackKey(ItemStack stack, FluidStack fluidStack) { - this.stack = stack; - this.fluidStack = fluidStack; - } - - public static StackKey stack(Item item, int amount, int damage) { - return new StackKey(new ItemStack(item, amount, damage)); - } - - public static StackKey stack(Block block, int amount, int damage) { - return new StackKey(new ItemStack(block, amount, damage)); - } - - public static StackKey stack(Item item) { - return new StackKey(new ItemStack(item, 1, 0)); - } - - public static StackKey stack(Block block) { - return new StackKey(new ItemStack(block, 1, 0)); - } - - public static StackKey stack(ItemStack itemStack) { - return new StackKey(itemStack); - } - - public static StackKey fluid(Fluid fluid, int amount) { - return new StackKey(new FluidStack(fluid, amount)); - } - - public static StackKey fluid(Fluid fluid) { - return new StackKey(new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME)); - } - - public static StackKey fluid(FluidStack fluidStack) { - return new StackKey(fluidStack); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || o.getClass() != StackKey.class) { - return false; - } - StackKey k = (StackKey) o; - if ((stack == null ^ k.stack == null) || (fluidStack == null ^ k.fluidStack == null)) { - return false; - } - if (stack != null) { - if (stack.getItem() != k.stack.getItem() || - stack.getHasSubtypes() && stack.getItemDamage() != k.stack.getItemDamage() || - !objectsEqual(stack.getTagCompound(), k.stack.getTagCompound())) { - return false; - } - } - if (fluidStack != null) { - if (fluidStack.getFluid().getID() != k.fluidStack.getFluid().getID() || - fluidStack.amount != k.fluidStack.amount || - !objectsEqual(fluidStack.tag, k.fluidStack.tag)) { - return false; - } - } - return true; - } - - @Override - public int hashCode() { - int result = 7; - if (stack != null) { - result = 31 * result + stack.getItem().hashCode(); - result = 31 * result + stack.getItemDamage(); - result = 31 * result + objectHashCode(stack.getTagCompound()); - } - result = 31 * result + 7; - if (fluidStack != null) { - result = 31 * result + fluidStack.getFluid().getID(); - result = 31 * result + fluidStack.amount; - result = 31 * result + objectHashCode(fluidStack.tag); - } - return result; - } - - private boolean objectsEqual(Object o1, Object o2) { - if (o1 == null && o2 == null) { - return true; - } else if (o1 == null || o2 == null) { - return false; - } else { - return o1.equals(o2); - } - } - - private int objectHashCode(Object o) { - return o != null ? o.hashCode() : 0; - } - - public StackKey copy() { - return new StackKey(stack != null ? stack.copy() : null, - fluidStack != null ? fluidStack.copy() : null); - } -} diff --git a/src/api/java/buildcraft/api/core/package-info.java b/src/api/java/buildcraft/api/core/package-info.java deleted file mode 100755 index 39784d31f..000000000 --- a/src/api/java/buildcraft/api/core/package-info.java +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -@API(apiVersion = "2.0", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core") -package buildcraft.api.core; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/buildcraft/api/core/render/ICullable.java b/src/api/java/buildcraft/api/core/render/ICullable.java deleted file mode 100755 index b800c0851..000000000 --- a/src/api/java/buildcraft/api/core/render/ICullable.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public - * License 1.0, or MMPL. Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - */ -package buildcraft.api.core.render; - -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.util.ForgeDirection; - -/* - * This interface designates a block as a state machine responsible for culling - * For implementation details look into FakeBlock implementation - */ -public interface ICullable { - - //Side Rendering States - //They are used to effectively cull obstructed sides while processing facades. - //Make sure your implementation is correct otherwise expect FPS drop - - void setRenderSide(ForgeDirection side, boolean render); - - void setRenderAllSides(); - - boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int side); - - void setRenderMask(int mask); - -} diff --git a/src/api/java/buildcraft/api/core/render/ITextureStateManager.java b/src/api/java/buildcraft/api/core/render/ITextureStateManager.java deleted file mode 100755 index 8161d6b93..000000000 --- a/src/api/java/buildcraft/api/core/render/ITextureStateManager.java +++ /dev/null @@ -1,7 +0,0 @@ -package buildcraft.api.core.render; - -import net.minecraft.util.IIcon; - -public interface ITextureStateManager { - void set(IIcon icon); -} diff --git a/src/api/java/buildcraft/api/core/render/ITextureStates.java b/src/api/java/buildcraft/api/core/render/ITextureStates.java deleted file mode 100755 index 835caf7fe..000000000 --- a/src/api/java/buildcraft/api/core/render/ITextureStates.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public - * License 1.0, or MMPL. Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - */ -package buildcraft.api.core.render; - -import net.minecraft.block.Block; -import net.minecraft.util.IIcon; - -public interface ITextureStates extends ICullable { - - ITextureStateManager getTextureState(); - - IIcon getIcon(int side, int meta); - - Block getBlock(); - -} diff --git a/src/api/java/buildcraft/api/fuels/BuildcraftFuelRegistry.java b/src/api/java/buildcraft/api/fuels/BuildcraftFuelRegistry.java deleted file mode 100755 index 873f93768..000000000 --- a/src/api/java/buildcraft/api/fuels/BuildcraftFuelRegistry.java +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.fuels; - -public final class BuildcraftFuelRegistry { - public static IFuelManager fuel; - public static ICoolantManager coolant; - - private BuildcraftFuelRegistry() { - } -} diff --git a/src/api/java/buildcraft/api/fuels/ICoolant.java b/src/api/java/buildcraft/api/fuels/ICoolant.java deleted file mode 100755 index 17fdf09f2..000000000 --- a/src/api/java/buildcraft/api/fuels/ICoolant.java +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.fuels; - -import net.minecraftforge.fluids.Fluid; - -public interface ICoolant { - Fluid getFluid(); - - float getDegreesCoolingPerMB(float heat); -} diff --git a/src/api/java/buildcraft/api/fuels/ICoolantManager.java b/src/api/java/buildcraft/api/fuels/ICoolantManager.java deleted file mode 100755 index ccf98798d..000000000 --- a/src/api/java/buildcraft/api/fuels/ICoolantManager.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.fuels; - -import java.util.Collection; - -import net.minecraftforge.fluids.Fluid; - -import buildcraft.api.core.StackKey; - -public interface ICoolantManager { - ICoolant addCoolant(ICoolant coolant); - - ICoolant addCoolant(Fluid fluid, float degreesCoolingPerMB); - - ISolidCoolant addSolidCoolant(ISolidCoolant solidCoolant); - - ISolidCoolant addSolidCoolant(StackKey solid, StackKey liquid, float multiplier); - - Collection getCoolants(); - - Collection getSolidCoolants(); - - ICoolant getCoolant(Fluid fluid); - - ISolidCoolant getSolidCoolant(StackKey solid); -} diff --git a/src/api/java/buildcraft/api/fuels/IFuel.java b/src/api/java/buildcraft/api/fuels/IFuel.java deleted file mode 100755 index 6bb018bec..000000000 --- a/src/api/java/buildcraft/api/fuels/IFuel.java +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.fuels; - -import net.minecraftforge.fluids.Fluid; - -public interface IFuel { - Fluid getFluid(); - - int getTotalBurningTime(); - - int getPowerPerCycle(); -} diff --git a/src/api/java/buildcraft/api/fuels/IFuelManager.java b/src/api/java/buildcraft/api/fuels/IFuelManager.java deleted file mode 100755 index c280885fd..000000000 --- a/src/api/java/buildcraft/api/fuels/IFuelManager.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.fuels; - -import java.util.Collection; - -import net.minecraftforge.fluids.Fluid; - -public interface IFuelManager { - IFuel addFuel(IFuel fuel); - - IFuel addFuel(Fluid fluid, int powerPerCycle, int totalBurningTime); - - Collection getFuels(); - - IFuel getFuel(Fluid fluid); -} diff --git a/src/api/java/buildcraft/api/fuels/ISolidCoolant.java b/src/api/java/buildcraft/api/fuels/ISolidCoolant.java deleted file mode 100755 index d8fd2d45d..000000000 --- a/src/api/java/buildcraft/api/fuels/ISolidCoolant.java +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.fuels; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -public interface ISolidCoolant { - FluidStack getFluidFromSolidCoolant(ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/fuels/package-info.java b/src/api/java/buildcraft/api/fuels/package-info.java deleted file mode 100755 index eca72994c..000000000 --- a/src/api/java/buildcraft/api/fuels/package-info.java +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -@API(apiVersion = "2.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|fuels") -package buildcraft.api.fuels; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/buildcraft/api/package-info.java b/src/api/java/buildcraft/api/package-info.java deleted file mode 100755 index 81c35570f..000000000 --- a/src/api/java/buildcraft/api/package-info.java +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -@API(apiVersion = "1.0", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core") -package buildcraft.api; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/buildcraft/api/tools/IToolWrench.java b/src/api/java/buildcraft/api/tools/IToolWrench.java deleted file mode 100755 index c5c9d86f4..000000000 --- a/src/api/java/buildcraft/api/tools/IToolWrench.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -package buildcraft.api.tools; - -import net.minecraft.entity.player.EntityPlayer; - -/*** - * Implement this interface on subclasses of Item to have that item work as a wrench for buildcraft - */ -public interface IToolWrench { - - /*** - * Called to ensure that the wrench can be used. To get the ItemStack that is used, check player.inventory.getCurrentItem() - * - * @param player - * - The player doing the wrenching - * @param x - * ,y,z - The coordinates for the block being wrenched - * - * @return true if wrenching is allowed, false if not - */ - boolean canWrench(EntityPlayer player, int x, int y, int z); - - /*** - * Callback after the wrench has been used. This can be used to decrease durability or for other purposes. To get the ItemStack that was used, check - * player.inventory.getCurrentItem() - * - * @param player - * - The player doing the wrenching - * @param x - * ,y,z - The coordinates of the block being wrenched - */ - void wrenchUsed(EntityPlayer player, int x, int y, int z); -} diff --git a/src/api/java/buildcraft/api/tools/package-info.java b/src/api/java/buildcraft/api/tools/package-info.java deleted file mode 100755 index 538e11eae..000000000 --- a/src/api/java/buildcraft/api/tools/package-info.java +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. - * Please check the contents of the license, which should be located - * as "LICENSE.API" in the BuildCraft source code distribution. - */ -@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|tools") -package buildcraft.api.tools; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/dan200/computercraft/api/ComputerCraftAPI.java b/src/api/java/dan200/computercraft/api/ComputerCraftAPI.java deleted file mode 100644 index 9b8833d2b..000000000 --- a/src/api/java/dan200/computercraft/api/ComputerCraftAPI.java +++ /dev/null @@ -1,265 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api; - -import dan200.computercraft.api.filesystem.IMount; -import dan200.computercraft.api.filesystem.IWritableMount; -import dan200.computercraft.api.media.IMediaProvider; -import dan200.computercraft.api.peripheral.IPeripheralProvider; -import dan200.computercraft.api.redstone.IBundledRedstoneProvider; -import dan200.computercraft.api.turtle.ITurtleUpgrade; -import net.minecraft.world.World; - -import java.lang.reflect.Method; - -/** - * The static entry point to the ComputerCraft API. - * Members in this class must be called after mod_ComputerCraft has been initialised, - * but may be called before it is fully loaded. - */ -public final class ComputerCraftAPI -{ - /** - * Creates a numbered directory in a subfolder of the save directory for a given world, and returns that number.
- * Use in conjuction with createSaveDirMount() to create a unique place for your peripherals or media items to store files.
- * @param world The world for which the save dir should be created. This should be the serverside world object. - * @param parentSubPath The folder path within the save directory where the new directory should be created. eg: "computercraft/disk" - * @return The numerical value of the name of the new folder, or -1 if the folder could not be created for some reason.
- * eg: if createUniqueNumberedSaveDir( world, "computer/disk" ) was called returns 42, then "computer/disk/42" is now available for writing. - * @see #createSaveDirMount(World, String, long) - */ - public static int createUniqueNumberedSaveDir( World world, String parentSubPath ) - { - findCC(); - if( computerCraft_createUniqueNumberedSaveDir != null ) - { - try { - return ((Integer)computerCraft_createUniqueNumberedSaveDir.invoke( null, world, parentSubPath )).intValue(); - } catch (Exception e){ - // It failed - } - } - return -1; - } - - /** - * Creates a file system mount that maps to a subfolder of the save directory for a given world, and returns it.
- * Use in conjuction with IComputerAccess.mount() or IComputerAccess.mountWritable() to mount a folder from the - * users save directory onto a computers file system.
- * @param world The world for which the save dir can be found. This should be the serverside world object. - * @param subPath The folder path within the save directory that the mount should map to. eg: "computer/disk/42".
- * Use createUniqueNumberedSaveDir() to create a new numbered folder to use. - * @param capacity The ammount of data that can be stored in the directory before it fills up, in bytes. - * @return The mount, or null if it could be created for some reason. Use IComputerAccess.mount() or IComputerAccess.mountWritable() - * to mount this on a Computers' file system. - * @see #createUniqueNumberedSaveDir(World, String) - * @see dan200.computercraft.api.peripheral.IComputerAccess#mount(String, dan200.computercraft.api.filesystem.IMount) - * @see dan200.computercraft.api.peripheral.IComputerAccess#mountWritable(String, dan200.computercraft.api.filesystem.IWritableMount) - * @see dan200.computercraft.api.filesystem.IMount - * @see IWritableMount - */ - public static IWritableMount createSaveDirMount( World world, String subPath, long capacity ) - { - findCC(); - if( computerCraft_createSaveDirMount != null ) - { - try { - return (IWritableMount)computerCraft_createSaveDirMount.invoke( null, world, subPath, capacity ); - } catch (Exception e){ - // It failed - } - } - return null; - } - - /** - * Creates a file system mount to a resource folder, and returns it.
- * Use in conjuction with IComputerAccess.mount() or IComputerAccess.mountWritable() to mount a resource folder onto a computers file system.
- * The files in this mount will be a combination of files in the specified mod jar, and resource packs that contain resources with the same domain and path.
- * @param modClass A class in whose jar to look first for the resources to mount. Using your main mod class is recommended. eg: MyMod.class - * @param domain The domain under which to look for resources. eg: "mymod" - * @param subPath The domain under which to look for resources. eg: "mymod/lua/myfiles" - * @return The mount, or null if it could be created for some reason. Use IComputerAccess.mount() or IComputerAccess.mountWritable() - * to mount this on a Computers' file system. - * @see dan200.computercraft.api.peripheral.IComputerAccess#mount(String, dan200.computercraft.api.filesystem.IMount) - * @see dan200.computercraft.api.peripheral.IComputerAccess#mountWritable(String, IWritableMount) - * @see dan200.computercraft.api.filesystem.IMount - */ - public static IMount createResourceMount( Class modClass, String domain, String subPath ) - { - findCC(); - if( computerCraft_createResourceMount != null ) - { - try { - return (IMount)computerCraft_createResourceMount.invoke( null, modClass, domain, subPath ); - } catch (Exception e){ - // It failed - } - } - return null; - } - - /** - * Registers a peripheral handler to convert blocks into IPeripheral implementations. - * @see dan200.computercraft.api.peripheral.IPeripheral - * @see dan200.computercraft.api.peripheral.IPeripheralProvider - */ - public static void registerPeripheralProvider( IPeripheralProvider handler ) - { - findCC(); - if ( computerCraft_registerPeripheralProvider != null) - { - try { - computerCraft_registerPeripheralProvider.invoke( null, handler ); - } catch (Exception e){ - // It failed - } - } - } - - /** - * Registers a new turtle turtle for use in ComputerCraft. After calling this, - * users should be able to craft Turtles with your new turtle. It is recommended to call - * this during the load() method of your mod. - * @see dan200.computercraft.api.turtle.ITurtleUpgrade - */ - public static void registerTurtleUpgrade( ITurtleUpgrade upgrade ) - { - if( upgrade != null ) - { - findCC(); - if( computerCraft_registerTurtleUpgrade != null ) - { - try { - computerCraft_registerTurtleUpgrade.invoke( null, upgrade ); - } catch( Exception e ) { - // It failed - } - } - } - } - - /** - * Registers a bundled redstone handler to provide bundled redstone output for blocks - * @see dan200.computercraft.api.redstone.IBundledRedstoneProvider - */ - public static void registerBundledRedstoneProvider( IBundledRedstoneProvider handler ) - { - findCC(); - if( computerCraft_registerBundledRedstoneProvider != null ) - { - try { - computerCraft_registerBundledRedstoneProvider.invoke( null, handler ); - } catch (Exception e) { - // It failed - } - } - } - - /** - * If there is a Computer or Turtle at a certain position in the world, get it's bundled redstone output. - * @see dan200.computercraft.api.redstone.IBundledRedstoneProvider - * @return If there is a block capable of emitting bundled redstone at the location, it's signal (0-65535) will be returned. - * If there is no block capable of emitting bundled redstone at the location, -1 will be returned. - */ - public static int getBundledRedstoneOutput( World world, int x, int y, int z, int side ) - { - findCC(); - if( computerCraft_getDefaultBundledRedstoneOutput != null ) - { - try { - return ((Integer)computerCraft_getDefaultBundledRedstoneOutput.invoke( null, world, x, y, z, side )).intValue(); - } catch (Exception e){ - // It failed - } - } - return -1; - } - - /** - * Registers a media handler to provide IMedia implementations for Items - * @see dan200.computercraft.api.media.IMediaProvider - */ - public static void registerMediaProvider( IMediaProvider handler ) - { - findCC(); - if( computerCraft_registerMediaProvider != null ) - { - try { - computerCraft_registerMediaProvider.invoke( null, handler ); - } catch (Exception e){ - // It failed - } - } - } - - // The functions below here are private, and are used to interface with the non-API ComputerCraft classes. - // Reflection is used here so you can develop your mod in MCP without decompiling ComputerCraft and including - // it in your solution. - - private static void findCC() - { - if( !ccSearched ) { - try { - computerCraft = Class.forName( "dan200.computercraft.ComputerCraft" ); - computerCraft_createUniqueNumberedSaveDir = findCCMethod( "createUniqueNumberedSaveDir", new Class[]{ - World.class, String.class - } ); - computerCraft_createSaveDirMount = findCCMethod( "createSaveDirMount", new Class[] { - World.class, String.class, Long.TYPE - } ); - computerCraft_createResourceMount = findCCMethod( "createResourceMount", new Class[] { - Class.class, String.class, String.class - } ); - computerCraft_registerPeripheralProvider = findCCMethod( "registerPeripheralProvider", new Class[] { - IPeripheralProvider.class - } ); - computerCraft_registerTurtleUpgrade = findCCMethod( "registerTurtleUpgrade", new Class[] { - ITurtleUpgrade.class - } ); - computerCraft_registerBundledRedstoneProvider = findCCMethod( "registerBundledRedstoneProvider", new Class[] { - IBundledRedstoneProvider.class - } ); - computerCraft_getDefaultBundledRedstoneOutput = findCCMethod( "getDefaultBundledRedstoneOutput", new Class[] { - World.class, Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE - } ); - computerCraft_registerMediaProvider = findCCMethod( "registerMediaProvider", new Class[] { - IMediaProvider.class - } ); - } catch( Exception e ) { - System.out.println( "ComputerCraftAPI: ComputerCraft not found." ); - } finally { - ccSearched = true; - } - } - } - - private static Method findCCMethod( String name, Class[] args ) - { - try { - if( computerCraft != null ) - { - return computerCraft.getMethod( name, args ); - } - return null; - } catch( NoSuchMethodException e ) { - System.out.println( "ComputerCraftAPI: ComputerCraft method " + name + " not found." ); - return null; - } - } - - private static boolean ccSearched = false; - private static Class computerCraft = null; - private static Method computerCraft_createUniqueNumberedSaveDir = null; - private static Method computerCraft_createSaveDirMount = null; - private static Method computerCraft_createResourceMount = null; - private static Method computerCraft_registerPeripheralProvider = null; - private static Method computerCraft_registerTurtleUpgrade = null; - private static Method computerCraft_registerBundledRedstoneProvider = null; - private static Method computerCraft_getDefaultBundledRedstoneOutput = null; - private static Method computerCraft_registerMediaProvider = null; -} diff --git a/src/api/java/dan200/computercraft/api/filesystem/IMount.java b/src/api/java/dan200/computercraft/api/filesystem/IMount.java deleted file mode 100644 index e340496be..000000000 --- a/src/api/java/dan200/computercraft/api/filesystem/IMount.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.filesystem; - -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - -/** - * Represents a read only part of a virtual filesystem that can be mounted onto a computercraft using IComputerAccess.mount(). - * Ready made implementations of this interface can be created using ComputerCraftAPI.createSaveDirMount() or ComputerCraftAPI.createResourceMount(), or you're free to implement it yourselves! - * @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String) - * @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(Class, String, String) - * @see dan200.computercraft.api.peripheral.IComputerAccess#mount(String, IMount) - * @see IWritableMount - */ -public interface IMount -{ - /** - * Returns whether a file with a given path exists or not. - * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram" - * @return true if the file exists, false otherwise - */ - public boolean exists( String path ) throws IOException; - - /** - * Returns whether a file with a given path is a directory or not. - * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprograms" - * @return true if the file exists and is a directory, false otherwise - */ - public boolean isDirectory( String path ) throws IOException; - - /** - * Returns the file names of all the files in a directory. - * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprograms" - * @param contents A list of strings. Add all the file names to this list - */ - public void list( String path, List contents ) throws IOException; - - /** - * Returns the size of a file with a given path, in bytes - * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram" - * @return the size of the file, in bytes - */ - public long getSize( String path ) throws IOException; - - /** - * Opens a file with a given path, and returns an inputstream representing it's contents. - * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram" - * @return a stream representing the contents of the file - */ - public InputStream openForRead( String path ) throws IOException; -} diff --git a/src/api/java/dan200/computercraft/api/filesystem/IWritableMount.java b/src/api/java/dan200/computercraft/api/filesystem/IWritableMount.java deleted file mode 100644 index 9c3bb43d5..000000000 --- a/src/api/java/dan200/computercraft/api/filesystem/IWritableMount.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.filesystem; - -import java.io.IOException; -import java.io.OutputStream; - -/** - * Represents a part of a virtual filesystem that can be mounted onto a computercraft using IComputerAccess.mount() or IComputerAccess.mountWritable(), that can also be written to. - * Ready made implementations of this interface can be created using ComputerCraftAPI.createSaveDirMount(), or you're free to implement it yourselves! - * @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String) - * @see dan200.computercraft.api.peripheral.IComputerAccess#mountWritable(String, dan200.computercraft.api.filesystem.IMount) - * @see dan200.computercraft.api.filesystem.IMount - */ -public interface IWritableMount extends IMount -{ - /** - * Creates a directory at a given path inside the virtual file system. - * @param path A file path in normalised format, relative to the mount location. ie: "programs/mynewprograms" - */ - public void makeDirectory( String path ) throws IOException; - - /** - * Deletes a directory at a given path inside the virtual file system. - * @param path A file path in normalised format, relative to the mount location. ie: "programs/myoldprograms" - */ - public void delete( String path ) throws IOException; - - /** - * Opens a file with a given path, and returns an outputstream for writing to it. - * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram" - * @return a stream for writing to - */ - public OutputStream openForWrite( String path ) throws IOException; - - /** - * Opens a file with a given path, and returns an outputstream for appending to it. - * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram" - * @return a stream for writing to - */ - public OutputStream openForAppend( String path ) throws IOException; - - /** - * Get the ammount of free space on the mount, in bytes. You should decrease this value as the user writes to the mount, and write operations should fail once it reaches zero. - * @return The ammount of free space, in bytes. - */ - public long getRemainingSpace() throws IOException; -} diff --git a/src/api/java/dan200/computercraft/api/filesystem/package-info.java b/src/api/java/dan200/computercraft/api/filesystem/package-info.java deleted file mode 100644 index 02bb7ea62..000000000 --- a/src/api/java/dan200/computercraft/api/filesystem/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -@API( owner="ComputerCraft", provides="ComputerCraft|API|FileSystem", apiVersion="1.65" ) -package dan200.computercraft.api.filesystem; - -import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/api/java/dan200/computercraft/api/lua/ILuaContext.java b/src/api/java/dan200/computercraft/api/lua/ILuaContext.java deleted file mode 100644 index 787a93d48..000000000 --- a/src/api/java/dan200/computercraft/api/lua/ILuaContext.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.lua; - -/** - * An interface passed to peripherals and ILuaObjects' by computers or turtles, providing methods - * that allow the peripheral call to wait for events before returning, just like in lua. - * This is very useful if you need to signal work to be performed on the main thread, and don't want to return - * until the work has been completed. - */ -public interface ILuaContext -{ - /** - * Wait for an event to occur on the computercraft, suspending the thread until it arises. This method is exactly equivalent to os.pullEvent() in lua. - * @param filter A specific event to wait for, or null to wait for any event - * @return An object array containing the name of the event that occurred, and any event parameters - * @throws Exception If the user presses CTRL+T to terminate the current program while pullEvent() is waiting for an event, a "Terminated" exception will be thrown here. - * Do not attempt to common this exception, unless you wish to prevent termination, which is not recommended. - * @throws InterruptedException If the user shuts down or reboots the computercraft while pullEvent() is waiting for an event, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state. - */ - public Object[] pullEvent( String filter ) throws LuaException, InterruptedException; - - /** - * The same as pullEvent(), except "terminated" events are ignored. Only use this if you want to prevent program termination, which is not recommended. This method is exactly equivalent to os.pullEventRaw() in lua. - * @param filter A specific event to wait for, or null to wait for any event - * @return An object array containing the name of the event that occurred, and any event parameters - * @throws InterruptedException If the user shuts down or reboots the computercraft while pullEventRaw() is waiting for an event, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state. - * @see #pullEvent(String) - */ - public Object[] pullEventRaw( String filter ) throws InterruptedException; - - /** - * Yield the current coroutine with some arguments until it is resumed. This method is exactly equivalent to coroutine.yield() in lua. Use pullEvent() if you wish to wait for events. - * @param arguments An object array containing the arguments to pass to coroutine.yield() - * @return An object array containing the return values from coroutine.yield() - * @throws InterruptedException If the user shuts down or reboots the computercraft the coroutine is suspended, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state. - * @see #pullEvent(String) - */ - public Object[] yield( Object[] arguments ) throws InterruptedException; -} diff --git a/src/api/java/dan200/computercraft/api/lua/ILuaObject.java b/src/api/java/dan200/computercraft/api/lua/ILuaObject.java deleted file mode 100644 index 4005bbf85..000000000 --- a/src/api/java/dan200/computercraft/api/lua/ILuaObject.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.lua; - -/** - * An interface for representing custom objects returned by IPeripheral.callMethod() calls. - * Return objects implementing this interface to expose objects with methods to lua. - */ -public interface ILuaObject -{ - /** - * Get the names of the methods that this object implements. This works the same as IPeripheral.getMethodNames(). See that method for detailed documentation. - * @see dan200.computercraft.api.peripheral.IPeripheral#getMethodNames() - */ - public String[] getMethodNames(); - - /** - * Called when a user calls one of the methods that this object implements. This works the same as IPeripheral.callMethod(). See that method for detailed documentation. - * @see dan200.computercraft.api.peripheral.IPeripheral#callMethod(dan200.computercraft.api.peripheral.IComputerAccess, ILuaContext, int, Object[]) - */ - public Object[] callMethod( ILuaContext context, int method, Object[] arguments ) throws LuaException, InterruptedException; -} diff --git a/src/api/java/dan200/computercraft/api/lua/LuaException.java b/src/api/java/dan200/computercraft/api/lua/LuaException.java deleted file mode 100644 index 29874bdcf..000000000 --- a/src/api/java/dan200/computercraft/api/lua/LuaException.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.lua; - -/** - * An exception representing an error in Lua, like that raised by the error() function - */ -public class LuaException extends Exception -{ - private final int m_level; - - public LuaException( String message ) - { - this( message, 1 ); - } - - public LuaException( String message, int level ) - { - super( message ); - m_level = level; - } - - public int getLevel() - { - return m_level; - } -} diff --git a/src/api/java/dan200/computercraft/api/lua/package-info.java b/src/api/java/dan200/computercraft/api/lua/package-info.java deleted file mode 100644 index 9ea59b6fa..000000000 --- a/src/api/java/dan200/computercraft/api/lua/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -@API( owner="ComputerCraft", provides="ComputerCraft|API|Lua", apiVersion="1.65" ) -package dan200.computercraft.api.lua; - -import cpw.mods.fml.common.API; diff --git a/src/api/java/dan200/computercraft/api/media/IMedia.java b/src/api/java/dan200/computercraft/api/media/IMedia.java deleted file mode 100644 index 637a29708..000000000 --- a/src/api/java/dan200/computercraft/api/media/IMedia.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.media; - -import dan200.computercraft.api.filesystem.IMount; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * Represents an item that can be placed in a disk drive and used by a Computer. - * Implement this interface on your Item class to allow it to be used in the drive. - */ -public interface IMedia -{ - /** - * Get a string representing the label of this item. Will be called vi disk.getLabel() in lua. - * @param stack The itemstack to inspect - * @return The label. ie: "Dan's Programs" - */ - public String getLabel( ItemStack stack ); - - /** - * Set a string representing the label of this item. Will be called vi disk.setLabel() in lua. - * @param stack The itemstack to modify. - * @param label The string to set the label to. - * @return true if the label was updated, false if the label may not be modified. - */ - public boolean setLabel( ItemStack stack, String label ); - - /** - * If this disk represents an item with audio (like a record), get the readable name of the audio track. ie: "Jonathon Coulton - Still Alive" - * @param stack The itemstack to inspect. - * @return The name, or null if this item does not represent an item with audio. - */ - public String getAudioTitle( ItemStack stack ); - - /** - * If this disk represents an item with audio (like a record), get the resource name of the audio track to play. - * @param stack The itemstack to inspect. - * @return The name, or null if this item does not represent an item with audio. - */ - public String getAudioRecordName( ItemStack stack ); - - /** - * If this disk represents an item with data (like a floppy disk), get a mount representing it's contents. This will be mounted onto the filesystem of the computercraft while the media is in the disk drive. - * @param stack The itemstack to inspect. - * @param world The world in which the item and disk drive reside. - * @return The mount, or null if this item does not represent an item with data. If the IMount returned also implements IWritableMount, it will mounted using mountWritable() - * @see dan200.computercraft.api.filesystem.IMount - * @see dan200.computercraft.api.filesystem.IWritableMount - * @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String, long) - * @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(Class, String, String) - */ - public IMount createDataMount( ItemStack stack, World world ); -} diff --git a/src/api/java/dan200/computercraft/api/media/IMediaProvider.java b/src/api/java/dan200/computercraft/api/media/IMediaProvider.java deleted file mode 100644 index 33e53ed4b..000000000 --- a/src/api/java/dan200/computercraft/api/media/IMediaProvider.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.media; - -import net.minecraft.item.ItemStack; - -/** - * This interface is used to provide IMedia implementations for ItemStack - * @see dan200.computercraft.api.ComputerCraftAPI#registerMediaProvider(IMediaProvider) - */ -public interface IMediaProvider -{ - /** - * Produce an IMedia implementation from an ItemStack. - * @see dan200.computercraft.api.ComputerCraftAPI#registerMediaProvider(IMediaProvider) - * @return an IMedia implementation, or null if the item is not something you wish to handle - */ - public IMedia getMedia( ItemStack stack ); -} diff --git a/src/api/java/dan200/computercraft/api/media/package-info.java b/src/api/java/dan200/computercraft/api/media/package-info.java deleted file mode 100644 index ec0695fbb..000000000 --- a/src/api/java/dan200/computercraft/api/media/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -@API( owner="ComputerCraft", provides="ComputerCraft|API|Media", apiVersion="1.65" ) -package dan200.computercraft.api.media; - -import cpw.mods.fml.common.API; diff --git a/src/api/java/dan200/computercraft/api/package-info.java b/src/api/java/dan200/computercraft/api/package-info.java deleted file mode 100644 index 5c16faf4c..000000000 --- a/src/api/java/dan200/computercraft/api/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -@API( owner="ComputerCraft", provides="ComputerCraft|API", apiVersion="1.65" ) -package dan200.computercraft.api; - -import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/api/java/dan200/computercraft/api/peripheral/IComputerAccess.java b/src/api/java/dan200/computercraft/api/peripheral/IComputerAccess.java deleted file mode 100644 index 1c9327d2c..000000000 --- a/src/api/java/dan200/computercraft/api/peripheral/IComputerAccess.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.peripheral; - -import dan200.computercraft.api.filesystem.IMount; -import dan200.computercraft.api.filesystem.IWritableMount; - -/** - * The interface passed to peripherals by computers or turtles, providing methods - * that they can call. This should not be implemented by your classes. Do not interact - * with computers except via this interface. - */ -public interface IComputerAccess -{ - /** - * Mount a mount onto the computers' file system in a read only mode.
- * @param desiredLocation The location on the computercraft's file system where you would like the mount to be mounted. - * @param mount The mount object to mount on the computercraft. These can be obtained by calling ComputerCraftAPI.createSaveDirMount(), ComputerCraftAPI.createResourceMount() or by creating your own objects that implement the IMount interface. - * @return The location on the computercraft's file system where you the mount mounted, or null if there was already a file in the desired location. Store this value if you wish to unmount the mount later. - * @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String) - * @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(Class, String, String) - * @see #mountWritable(String, dan200.computercraft.api.filesystem.IWritableMount) - * @see #unmount(String) - * @see dan200.computercraft.api.filesystem.IMount - */ - public String mount( String desiredLocation, IMount mount ); - - /** - * TODO: Document me - */ - public String mount( String desiredLocation, IMount mount, String driveName ); - - /** - * Mount a mount onto the computers' file system in a writable mode.
- * @param desiredLocation The location on the computercraft's file system where you would like the mount to be mounted. - * @param mount The mount object to mount on the computercraft. These can be obtained by calling ComputerCraftAPI.createSaveDirMount() or by creating your own objects that implement the IWritableMount interface. - * @return The location on the computercraft's file system where you the mount mounted, or null if there was already a file in the desired location. Store this value if you wish to unmount the mount later. - * @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String) - * @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(Class, String, String) - * @see #mount(String, IMount) - * @see #unmount(String) - * @see IMount - */ - public String mountWritable( String desiredLocation, IWritableMount mount ); - - /** - * TODO: Document me - */ - public String mountWritable( String desiredLocation, IWritableMount mount, String driveName ); - - /** - * Unmounts a directory previously mounted onto the computers file system by mount() or mountWritable().
- * When a directory is unmounted, it will disappear from the computers file system, and the user will no longer be able to - * access it. All directories mounted by a mount or mountWritable are automatically unmounted when the peripheral - * is attached if they have not been explicitly unmounted. - * @param location The desired location in the computers file system of the directory to unmount. - * This must be the location of a directory previously mounted by mount() or mountWritable(), as - * indicated by their return value. - * @see #mount(String, IMount) - * @see #mountWritable(String, IWritableMount) - */ - public void unmount( String location ); - - /** - * Returns the numerical ID of this computercraft.
- * This is the same number obtained by calling os.getComputerID() or running the "id" program from lua, - * and is guarunteed unique. This number will be positive. - * @return The identifier. - */ - public int getID(); - - /** - * Causes an event to be raised on this computercraft, which the computercraft can respond to by calling - * os.pullEvent(). This can be used to notify the computercraft when things happen in the world or to - * this peripheral. - * @param event A string identifying the type of event that has occurred, this will be - * returned as the first value from os.pullEvent(). It is recommended that you - * you choose a name that is unique, and recognisable as originating from your - * peripheral. eg: If your peripheral type is "button", a suitable event would be - * "button_pressed". - * @param arguments In addition to a name, you may pass an array of extra arguments to the event, that will - * be supplied as extra return values to os.pullEvent(). Objects in the array will be converted - * to lua data types in the same fashion as the return values of IPeripheral.callMethod().
- * You may supply null to indicate that no arguments are to be supplied. - * @see dan200.computercraft.api.peripheral.IPeripheral#callMethod - */ - public void queueEvent( String event, Object[] arguments ); - - /** - * Get a string, unique to the computercraft, by which the computercraft refers to this peripheral. - * For directly attached peripherals this will be "left","right","front","back",etc, but - * for peripherals attached remotely it will be different. It is good practice to supply - * this string when raising events to the computercraft, so that the computercraft knows from - * which peripheral the event came. - * @return A string unique to the computercraft, but not globally. - */ - public String getAttachmentName(); -} diff --git a/src/api/java/dan200/computercraft/api/peripheral/IPeripheral.java b/src/api/java/dan200/computercraft/api/peripheral/IPeripheral.java deleted file mode 100644 index 99396dd95..000000000 --- a/src/api/java/dan200/computercraft/api/peripheral/IPeripheral.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.peripheral; - -import dan200.computercraft.api.lua.ILuaContext; -import dan200.computercraft.api.lua.LuaException; - -/** - * The interface that defines a peripheral. This should be implemented by the - * TileEntity of any common that you wish to be interacted with by - * computercraft or turtle. - */ -public interface IPeripheral -{ - /** - * Should return a string that uniquely identifies this type of peripheral. - * This can be queried from lua by calling peripheral.getType() - * @return A string identifying the type of peripheral. - */ - public String getType(); - - /** - * Should return an array of strings that identify the methods that this - * peripheral exposes to Lua. This will be called once before each attachment, - * and should not change when called multiple times. - * @return An array of strings representing method names. - * @see #callMethod - */ - public String[] getMethodNames(); - - /** - * This is called when a lua program on an attached computercraft calls peripheral.call() with - * one of the methods exposed by getMethodNames().
- *
- * Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe - * when interacting with minecraft objects. - * @param computer The interface to the computercraft that is making the call. Remember that multiple - * computers can be attached to a peripheral at once. - * @param context The context of the currently running lua thread. This can be used to wait for events - * or otherwise yield. - * @param method An integer identifying which of the methods from getMethodNames() the computercraft - * wishes to call. The integer indicates the index into the getMethodNames() table - * that corresponds to the string passed into peripheral.call() - * @param arguments An array of objects, representing the arguments passed into peripheral.call().
- * Lua values of type "string" will be represented by Object type String.
- * Lua values of type "number" will be represented by Object type Double.
- * Lua values of type "boolean" will be represented by Object type Boolean.
- * Lua values of any other type will be represented by a null object.
- * This array will be empty if no arguments are passed. - * @return An array of objects, representing values you wish to return to the lua program.
- * Integers, Doubles, Floats, Strings, Booleans and null be converted to their corresponding lua type.
- * All other types will be converted to nil.
- * You may return null to indicate no values should be returned. - * @throws Exception If you throw any exception from this function, a lua error will be raised with the - * same message as your exception. Use this to throw appropriate errors if the wrong - * arguments are supplied to your method. - * @see #getMethodNames - */ - public Object[] callMethod( IComputerAccess computer, ILuaContext context, int method, Object[] arguments ) throws LuaException, InterruptedException; - - /** - * Is called when canAttachToSide has returned true, and a computercraft is attaching to the peripheral. - * This will occur when a peripheral is placed next to an active computercraft, when a computercraft is turned on next to a peripheral, - * or when a turtle travels into a square next to a peripheral. - * Between calls to attach() and detach(), the attached computercraft can make method calls on the peripheral using peripheral.call(). - * This method can be used to keep track of which computers are attached to the peripheral, or to take action when attachment - * occurs.
- *
- * Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe - * when interacting with minecraft objects. - * @param computer The interface to the computercraft that is being attached. Remember that multiple - * computers can be attached to a peripheral at once. - * @see #detach - */ - public void attach( IComputerAccess computer ); - - /** - * Is called when a computercraft is detaching from the peripheral. - * This will occur when a computercraft shuts down, when the peripheral is removed while attached to computers, - * or when a turtle moves away from a square attached to a peripheral. - * This method can be used to keep track of which computers are attached to the peripheral, or to take action when detachment - * occurs.
- *
- * Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe - * when interacting with minecraft objects. - * @param computer The interface to the computercraft that is being detached. Remember that multiple - * computers can be attached to a peripheral at once. - * @see #detach - */ - public void detach( IComputerAccess computer ); - - /** - * TODO: Document me - */ - public boolean equals( IPeripheral other ); -} diff --git a/src/api/java/dan200/computercraft/api/peripheral/IPeripheralProvider.java b/src/api/java/dan200/computercraft/api/peripheral/IPeripheralProvider.java deleted file mode 100644 index aeb354f3b..000000000 --- a/src/api/java/dan200/computercraft/api/peripheral/IPeripheralProvider.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.peripheral; - -import net.minecraft.world.World; - -/** - * This interface is used to create peripheral implementations for blocks - * @see dan200.computercraft.api.ComputerCraftAPI#registerPeripheralProvider(IPeripheralProvider) - */ -public interface IPeripheralProvider -{ - /** - * Produce an peripheral implementation from a block location. - * @see dan200.computercraft.api.ComputerCraftAPI#registerPeripheralProvider(IPeripheralProvider) - * @return a peripheral, or null if there is not a peripheral here you'd like to handle. - */ - public IPeripheral getPeripheral( World world, int x, int y, int z, int side ); -} diff --git a/src/api/java/dan200/computercraft/api/peripheral/package-info.java b/src/api/java/dan200/computercraft/api/peripheral/package-info.java deleted file mode 100644 index c3ee64845..000000000 --- a/src/api/java/dan200/computercraft/api/peripheral/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -@API( owner="ComputerCraft", provides="ComputerCraft|API|Peripheral", apiVersion="1.65" ) -package dan200.computercraft.api.peripheral; - -import cpw.mods.fml.common.API; diff --git a/src/api/java/dan200/computercraft/api/redstone/IBundledRedstoneProvider.java b/src/api/java/dan200/computercraft/api/redstone/IBundledRedstoneProvider.java deleted file mode 100644 index 6d5d400dd..000000000 --- a/src/api/java/dan200/computercraft/api/redstone/IBundledRedstoneProvider.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.redstone; - -import net.minecraft.world.World; - -/** - * This interface is used to provide bundled redstone output for blocks - * @see dan200.computercraft.api.ComputerCraftAPI#registerBundledRedstoneProvider(IBundledRedstoneProvider) - */ -public interface IBundledRedstoneProvider -{ - /** - * Produce an bundled redstone output from a block location. - * @see dan200.computercraft.api.ComputerCraftAPI#registerBundledRedstoneProvider(IBundledRedstoneProvider) - * @return a number in the range 0-65535 to indicate this block is providing output, or -1 if you do not wish to handle this block - */ - public int getBundledRedstoneOutput( World world, int x, int y, int z, int side ); -} diff --git a/src/api/java/dan200/computercraft/api/redstone/package-info.java b/src/api/java/dan200/computercraft/api/redstone/package-info.java deleted file mode 100644 index fa59ad32b..000000000 --- a/src/api/java/dan200/computercraft/api/redstone/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -@API( owner="ComputerCraft", provides="ComputerCraft|API|Redstone", apiVersion="1.65" ) -package dan200.computercraft.api.redstone; - -import cpw.mods.fml.common.API; diff --git a/src/api/java/dan200/computercraft/api/turtle/ITurtleAccess.java b/src/api/java/dan200/computercraft/api/turtle/ITurtleAccess.java deleted file mode 100644 index e7e96810a..000000000 --- a/src/api/java/dan200/computercraft/api/turtle/ITurtleAccess.java +++ /dev/null @@ -1,156 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.turtle; - -import dan200.computercraft.api.lua.ILuaContext; -import dan200.computercraft.api.lua.LuaException; -import dan200.computercraft.api.peripheral.IPeripheral; -import net.minecraft.inventory.IInventory; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; - -/** - * The interface passed to turtle by turtles, providing methods that they can call. - * This should not be implemented by your classes. Do not interact with turtles except via this interface and ITurtleUpgrade. - */ -public interface ITurtleAccess -{ - /** - * Returns the world in which the turtle resides. - * @return the world in which the turtle resides. - */ - public World getWorld(); - - /** - * Returns a vector containing the integer co-ordinates at which the turtle resides. - * @return a vector containing the integer co-ordinates at which the turtle resides. - */ - public ChunkCoordinates getPosition(); - - /** - * TODO: Document me - */ - public boolean teleportTo( World world, int x, int y, int z ); - - /** - * Returns a vector containing the floating point co-ordinates at which the turtle is rendered. - * This will shift when the turtle is moving. - * @param f The subframe fraction - * @return a vector containing the floating point co-ordinates at which the turtle resides. - */ - public Vec3 getVisualPosition( float f ); - - /** - * TODO: Document me - */ - public float getVisualYaw( float f ); - - /** - * Returns the world direction the turtle is currently facing. - * @return the world direction the turtle is currently facing. - */ - public int getDirection(); - - /** - * TODO: Document me - */ - public void setDirection( int dir ); - - /** - * TODO: Document me - */ - public int getSelectedSlot(); - - /** - * TODO: Document me - */ - public void setSelectedSlot( int slot ); - - /** - * TODO: Document me - */ - public IInventory getInventory(); - - /** - * TODO: Document me - */ - public boolean isFuelNeeded(); - - /** - * TODO: Document me - */ - public int getFuelLevel(); - - /** - * TODO: Document me - */ - public void setFuelLevel( int fuel ); - - /** - * TODO: Document me - */ - public int getFuelLimit(); - - /** - * Removes some fuel from the turtles fuel supply. Negative numbers can be passed in to INCREASE the fuel level of the turtle. - * @return Whether the turtle was able to consume the ammount of fuel specified. Will return false if you supply a number - * greater than the current fuel level of the turtle. - */ - public boolean consumeFuel( int fuel ); - - /** - * TODO: Document me - */ - public void addFuel( int fuel ); - - /** - * Adds a custom command to the turtles command queue. Unlike peripheral methods, these custom commands will be executed - * on the main thread, so are guaranteed to be able to access Minecraft objects safely, and will be queued up - * with the turtles standard movement and tool commands. An issued command will return an unique integer, which will - * be supplied as a parameter to a "turtle_response" event issued to the turtle after the command has completed. Look at the - * lua source code for "rom/apis/turtle" for how to build a lua wrapper around this functionality. - * @param command an object which will execute the custom command when its point in the queue is reached - * @return the objects the command returned when executed. you should probably return these to the player - * unchanged if called from a peripheral method. - * @see ITurtleCommand - */ - public Object[] executeCommand( ILuaContext context, ITurtleCommand command ) throws LuaException, InterruptedException; - - /** - * TODO: Document me - */ - public void playAnimation( TurtleAnimation animation ); - - /** - * Returns the turtle on the specified side of the turtle, if there is one. - * @return the turtle on the specified side of the turtle, if there is one. - */ - public ITurtleUpgrade getUpgrade( TurtleSide side ); - - /** - * TODO: Document me - */ - public void setUpgrade( TurtleSide side, ITurtleUpgrade upgrade ); - - /** - * Returns the peripheral created by the upgrade on the specified side of the turtle, if there is one. - * @return the peripheral created by the upgrade on the specified side of the turtle, if there is one. - */ - public IPeripheral getPeripheral( TurtleSide side ); - - /** - * TODO: Document me - */ - public NBTTagCompound getUpgradeNBTData( TurtleSide side ); - - /** - * TODO: Document me - */ - public void updateUpgradeNBTData( TurtleSide side ); -} diff --git a/src/api/java/dan200/computercraft/api/turtle/ITurtleCommand.java b/src/api/java/dan200/computercraft/api/turtle/ITurtleCommand.java deleted file mode 100644 index a551b649b..000000000 --- a/src/api/java/dan200/computercraft/api/turtle/ITurtleCommand.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.turtle; - -/** - * An interface for objects executing custom turtle commands, used with ITurtleAccess.issueCommand - * @see ITurtleAccess#executeCommand(dan200.computercraft.api.lua.ILuaContext,ITurtleCommand) - */ -public interface ITurtleCommand -{ - /** - * Will be called by the turtle on the main thread when it is time to execute the custom command. - * The handler should either perform the work of the command, and return success, or return - * failure with an error message to indicate the command cannot be executed at this time. - * @param turtle access to the turtle for whom the command was issued - * @return TurtleCommandResult.success() or TurtleCommandResult.failure( errorMessage ) - * @see ITurtleAccess#executeCommand(dan200.computercraft.api.lua.ILuaContext,ITurtleCommand) - * @see dan200.computercraft.api.turtle.TurtleCommandResult - */ - public TurtleCommandResult execute( ITurtleAccess turtle ); -} diff --git a/src/api/java/dan200/computercraft/api/turtle/ITurtleUpgrade.java b/src/api/java/dan200/computercraft/api/turtle/ITurtleUpgrade.java deleted file mode 100644 index 461d6e2bc..000000000 --- a/src/api/java/dan200/computercraft/api/turtle/ITurtleUpgrade.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.turtle; - -import dan200.computercraft.api.peripheral.IPeripheral; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -/** - * The primary interface for defining an turtle for Turtles. A turtle turtle - * can either be a new tool, or a new peripheral. - * @see dan200.computercraft.api.ComputerCraftAPI#registerTurtleUpgrade( dan200.computercraft.api.turtle.ITurtleUpgrade ) - */ -public interface ITurtleUpgrade -{ - /** - * Gets a unique numerical identifier representing this type of turtle turtle. - * Like Minecraft common and item IDs, you should strive to make this number unique - * among all turtle turtle that have been released for ComputerCraft. - * The ID must be in the range 64 to 255, as the ID is stored as an 8-bit value, - * and 0-64 is reserved for future use by ComputerCraft. The turtle will - * fail registration if an already used ID is specified. - * @see dan200.computercraft.api.ComputerCraftAPI#registerTurtleUpgrade( dan200.computercraft.api.turtle.ITurtleUpgrade ) - */ - public int getUpgradeID(); - - /** - * Return a String to describe this type of turtle in turtle item names. - * Examples of built-in adjectives are "Wireless", "Mining" and "Crafty". - */ - public String getUnlocalisedAdjective(); - - /** - * Return whether this turtle adds a tool or a peripheral to the turtle. - * Currently, turtle crafting is restricted to one tool & one peripheral per turtle. - * @see TurtleUpgradeType for the differences between the two. - */ - public TurtleUpgradeType getType(); - - /** - * Return an item stack representing the type of item that a turtle must be crafted - * with to create a turtle which holds this turtle. - * Currently, turtle crafting is restricted to one tool & one peripheral per turtle. - */ - public ItemStack getCraftingItem(); - - /** - * Will only be called for Peripheral turtle. Creates a peripheral for a turtle - * being placed using this turtle. The peripheral created will be stored - * for the lifetime of the turtle, will have update() called once-per-tick, and will be - * attach'd detach'd and have methods called in the same manner as a Computer peripheral. - * - * @param turtle Access to the turtle that the peripheral is being created for. - * @param side Which side of the turtle (left or right) that the turtle resides on. - * @return The newly created peripheral. You may return null if this turtle is a Tool - * and this method is not expected to be called. - */ - public IPeripheral createPeripheral( ITurtleAccess turtle, TurtleSide side ); - - /** - * Will only be called for Tool turtle. Called when turtle.dig() or turtle.attack() is called - * by the turtle, and the tool is required to do some work. - * @param turtle Access to the turtle that the tool resides on. - * @param side Which side of the turtle (left or right) the tool resides on. - * @param verb Which action (dig or attack) the turtle is being called on to perform. - * @param direction Which world direction the action should be performed in, relative to the turtles - * position. This will either be up, down, or the direction the turtle is facing, depending on - * whether dig, digUp or digDown was called. - * @return Whether the turtle was able to perform the action, and hence whether the turtle.dig() - * or turtle.attack() lua method should return true. If true is returned, the tool will perform - * a swinging animation. You may return null if this turtle is a Peripheral - * and this method is not expected to be called. - */ - public TurtleCommandResult useTool( ITurtleAccess turtle, TurtleSide side, TurtleVerb verb, int direction ); - - /** - * Called to obtain the IIcon to be used when rendering a turtle peripheral. Needs to be a "common" - * type IIcon for now, as there is no way to determine which texture sheet an IIcon is from by the - * IIcon itself. - * @param turtle Access to the turtle that the peripheral resides on. - * @param side Which side of the turtle (left or right) the peripheral resides on. - * @return The IIcon that you wish to be used to render your turtle peripheral. - */ - public IIcon getIcon( ITurtleAccess turtle, TurtleSide side ); - - /** - * TODO: Document me - */ - public void update( ITurtleAccess turtle, TurtleSide side ); -} diff --git a/src/api/java/dan200/computercraft/api/turtle/TurtleAnimation.java b/src/api/java/dan200/computercraft/api/turtle/TurtleAnimation.java deleted file mode 100644 index b907e6247..000000000 --- a/src/api/java/dan200/computercraft/api/turtle/TurtleAnimation.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.turtle; - -public enum TurtleAnimation -{ - None, - MoveForward, - MoveBack, - MoveUp, - MoveDown, - TurnLeft, - TurnRight, - SwingLeftTool, - SwingRightTool, - Wait, -} diff --git a/src/api/java/dan200/computercraft/api/turtle/TurtleCommandResult.java b/src/api/java/dan200/computercraft/api/turtle/TurtleCommandResult.java deleted file mode 100644 index f0f26fd0a..000000000 --- a/src/api/java/dan200/computercraft/api/turtle/TurtleCommandResult.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.turtle; - -public final class TurtleCommandResult -{ - private static final TurtleCommandResult s_success = new TurtleCommandResult( true, null, null ); - private static final TurtleCommandResult s_emptyFailure = new TurtleCommandResult( false, null, null ); - - public static TurtleCommandResult success() - { - return success( null ); - } - - public static TurtleCommandResult success( Object[] results ) - { - if( results == null || results.length == 0 ) - { - return s_success; - } - else - { - return new TurtleCommandResult( true, null, results ); - } - } - - public static TurtleCommandResult failure() - { - return failure( null ); - } - - public static TurtleCommandResult failure( String errorMessage ) - { - if( errorMessage == null ) - { - return s_emptyFailure; - } - else - { - return new TurtleCommandResult( false, errorMessage, null ); - } - } - - private final boolean m_success; - private final String m_errorMessage; - private final Object[] m_results; - - private TurtleCommandResult( boolean success, String errorMessage, Object[] results ) - { - m_success = success; - m_errorMessage = errorMessage; - m_results = results; - } - - public boolean isSuccess() - { - return m_success; - } - - public String getErrorMessage() - { - return m_errorMessage; - } - - public Object[] getResults() - { - return m_results; - } -} diff --git a/src/api/java/dan200/computercraft/api/turtle/TurtleSide.java b/src/api/java/dan200/computercraft/api/turtle/TurtleSide.java deleted file mode 100644 index e125d8010..000000000 --- a/src/api/java/dan200/computercraft/api/turtle/TurtleSide.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.turtle; - -/** - * An enum representing the two sides of the turtle that a turtle turtle might reside. - */ -public enum TurtleSide -{ - /** - * The turtles left side (where the pickaxe usually is on a Wireless Mining Turtle) - */ - Left, - - /** - * The turtles right side (where the modem usually is on a Wireless Mining Turtle) - */ - Right, -} diff --git a/src/api/java/dan200/computercraft/api/turtle/TurtleUpgradeType.java b/src/api/java/dan200/computercraft/api/turtle/TurtleUpgradeType.java deleted file mode 100644 index ef84ee9b1..000000000 --- a/src/api/java/dan200/computercraft/api/turtle/TurtleUpgradeType.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.turtle; - -/** - * An enum representing the two different types of turtle that an ITurtleUpgrade - * implementation can add to a turtle. - * @see ITurtleUpgrade - */ -public enum TurtleUpgradeType -{ - /** - * A tool is rendered as an item on the side of the turtle, and responds to the turtle.dig() - * and turtle.attack() methods (Such as pickaxe or sword on Mining and Melee turtles). - */ - Tool, - - /** - * A peripheral adds a special peripheral which is attached to the side of the turtle, - * and can be interacted with the peripheral API (Such as the modem on Wireless Turtles). - */ - Peripheral, -} diff --git a/src/api/java/dan200/computercraft/api/turtle/TurtleVerb.java b/src/api/java/dan200/computercraft/api/turtle/TurtleVerb.java deleted file mode 100644 index 3a8fb092e..000000000 --- a/src/api/java/dan200/computercraft/api/turtle/TurtleVerb.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2014. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computercraft.api.turtle; - -/** - * An enum representing the two different actions that an ITurtleUpgrade of type - * Tool may be called on to perform by a turtle. - * @see ITurtleUpgrade - * @see ITurtleUpgrade#useTool - */ -public enum TurtleVerb -{ - /** - * The turtle called turtle.dig(), turtle.digUp() or turtle.digDown() - */ - Dig, - - /** - * The turtle called turtle.attack(), turtle.attackUp() or turtle.attackDown() - */ - Attack, -} diff --git a/src/api/java/dan200/computercraft/api/turtle/package-info.java b/src/api/java/dan200/computercraft/api/turtle/package-info.java deleted file mode 100644 index 13a832fcc..000000000 --- a/src/api/java/dan200/computercraft/api/turtle/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API( owner="ComputerCraft", provides="ComputerCraft|API|Turtle", apiVersion="1.65" ) -package dan200.computercraft.api.turtle; - -import cpw.mods.fml.common.API; diff --git a/src/api/java/ic2/api/Direction.class b/src/api/java/ic2/api/Direction.class deleted file mode 100644 index 15cd477fc..000000000 Binary files a/src/api/java/ic2/api/Direction.class and /dev/null differ diff --git a/src/api/java/ic2/api/Direction.java b/src/api/java/ic2/api/Direction.java deleted file mode 100644 index b550ca311..000000000 --- a/src/api/java/ic2/api/Direction.java +++ /dev/null @@ -1,135 +0,0 @@ -package ic2.api; - -import java.util.EnumSet; -import java.util.Set; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Represents the 6 possible directions along the axis of a block. - */ -public enum Direction { - /** - * -X - */ - XN, - /** - * +X - */ - XP, - - /** - * -Y - */ - YN, //MC-Code starts with 0 here - /** - * +Y - */ - YP, // 1... - - /** - * -Z - */ - ZN, - /** - * +Z - */ - ZP; - - private Direction() { - int side = ordinal() / 2; - int sign = getSign(); - - xOffset = side == 0 ? sign : 0; - yOffset = side == 1 ? sign : 0; - zOffset = side == 2 ? sign : 0; - } - - public static Direction fromSideValue(int side) { - return directions[(side + 2) % 6]; - } - - public static Direction fromForgeDirection(ForgeDirection dir) { - if (dir == ForgeDirection.UNKNOWN) return null; - - return fromSideValue(dir.ordinal()); - } - - /** - * Get the tile entity next to a tile entity following this direction. - * - * @param tileEntity tile entity to check - * @return Adjacent tile entity or null if none exists - */ - public TileEntity applyToTileEntity(TileEntity te) { - return applyTo(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord); - } - - /** - * Get the tile entity next to a position following this direction. - * - * @param world World to check - * @param x X coordinate to check from - * @param y Y coordinate to check from - * @param z Z coordinate to check from - * @return Adjacent tile entity or null if none exists - */ - public TileEntity applyTo(World world, int x, int y, int z) { - int coords[] = { x, y, z }; - - coords[ordinal() / 2] += getSign(); - - if (world != null && world.blockExists(coords[0], coords[1], coords[2])) { - try { - return world.getTileEntity(coords[0], coords[1], coords[2]); - } catch (Exception e) { - throw new RuntimeException("error getting TileEntity at dim "+world.provider.dimensionId+" "+coords[0]+"/"+coords[1]+"/"+coords[2]); - } - } - - return null; - } - - /** - * Get the inverse of this direction (XN -> XP, XP -> XN, etc.) - * - * @return Inverse direction - */ - public Direction getInverse() { - return directions[ordinal() ^ 1]; - } - - /** - * Convert this direction to a Minecraft side value. - * - * @return Minecraft side value - */ - public int toSideValue() { - return (ordinal() + 4) % 6; - } - - /** - * Determine direction sign (N for negative or P for positive). - * - * @return -1 if the direction is negative, +1 if the direction is positive - */ - private int getSign() { - return (ordinal() % 2) * 2 - 1; - } - - public ForgeDirection toForgeDirection() { - return ForgeDirection.getOrientation(toSideValue()); - } - - public final int xOffset; - public final int yOffset; - public final int zOffset; - - public static final Direction[] directions = Direction.values(); - public static final Set noDirections = EnumSet.noneOf(Direction.class); - public static final Set allDirections = EnumSet.allOf(Direction.class); -} - diff --git a/src/api/java/ic2/api/crops/BaseSeed.class b/src/api/java/ic2/api/crops/BaseSeed.class deleted file mode 100644 index fd4b77b55..000000000 Binary files a/src/api/java/ic2/api/crops/BaseSeed.class and /dev/null differ diff --git a/src/api/java/ic2/api/crops/BaseSeed.java b/src/api/java/ic2/api/crops/BaseSeed.java deleted file mode 100644 index 89e7865fa..000000000 --- a/src/api/java/ic2/api/crops/BaseSeed.java +++ /dev/null @@ -1,82 +0,0 @@ -package ic2.api.crops; - -/** - * Base agriculture seed. Used to determine the state of a plant once it is planted from an item. - */ -public class BaseSeed { - /** - * Create a BaseSeed object. - * - * @param crop plant - * @param size plant size - * @param statGrowth1 plant growth stat - * @param statGain1 plant gain stat - * @param statResistance1 plant resistance stat - * @param stackSize1 for internal usage only - */ - @SuppressWarnings("deprecation") - public BaseSeed(CropCard crop, int size, int statGrowth, int statGain, int statResistance, int stackSize) { - super(); - this.crop = crop; - this.id = Crops.instance.getIdFor(crop); - this.size = size; - this.statGrowth = statGrowth; - this.statGain = statGain; - this.statResistance = statResistance; - this.stackSize = stackSize; - } - - /** - * @deprecated Use the CropCard version. - */ - @Deprecated - public BaseSeed(int id, int size, int statGrowth, int statGain, int statResistance, int stackSize) { - this(getCropFromId(id), size, statGrowth, statGain, statResistance, stackSize); - } - - @SuppressWarnings("deprecation") - private static CropCard getCropFromId(int id) { - CropCard[] crops = Crops.instance.getCropList(); - - if (id < 0 || id >= crops.length) return null; - - return crops[id]; - } - - - /** - * Plant. - */ - public final CropCard crop; - - /** - * @deprecated IDs aren't used anymore. - */ - @Deprecated - public int id; - - /** - * Plant size. - */ - public int size; - - /** - * Plant growth stat. - */ - public int statGrowth; - - /** - * Plant gain stat. - */ - public int statGain; - - /** - * Plant resistance stat. - */ - public int statResistance; - - /** - * For internal usage only. - */ - public int stackSize; -} diff --git a/src/api/java/ic2/api/crops/CropCard.class b/src/api/java/ic2/api/crops/CropCard.class deleted file mode 100644 index b4c31b252..000000000 Binary files a/src/api/java/ic2/api/crops/CropCard.class and /dev/null differ diff --git a/src/api/java/ic2/api/crops/CropCard.java b/src/api/java/ic2/api/crops/CropCard.java deleted file mode 100644 index 1d2b6406a..000000000 --- a/src/api/java/ic2/api/crops/CropCard.java +++ /dev/null @@ -1,435 +0,0 @@ -package ic2.api.crops; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.ModContainer; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -/** - * Base agriculture crop. - * - * Any crop extending this can be registered using registerCrop to be added into the game. - */ -public abstract class CropCard { - public CropCard() { - modId = getModId(); // initialize mod id while we should be in the real owner's init event - } - - /** - * Plant name for identifying this crop within your mod. - * - * The name has to be unique within the mod and is used for saving. - * By default this name will be also used to determine displayKey() and registerSprites(). - * - * @note changing name or owner will cause existing crops in users' worlds to disappear. - * - * @return Plant name - */ - public abstract String name(); - - /** - * Determine the mod id owning this crop. - * - * The owner serves as a name space. With every mod using a different owner, a mod only has to - * make sure it doesn't have conflicts with name() in itself. - * It's recommended to hard code this to your mod id as specified in the @Mod annotation. - * Do not use IC2's mod id here. - * - * @note changing name or owner will cause existing crops in users' worlds to disappear. - * - * @return Mod id. - */ - public String owner() { // TODO: make abstract - return modId; - } - - /** - * Translation key for display to the player. - * - * It's highly recommended to specify a valid key from your language file here, e.g. add - * "yourmod.crop.yourCropName = Your crop's name" to the language file, override name() to - * return "yourCropName" and override displayName() to return "yourmod.crop."+name(). - * - * @return Unlocalized name. - */ - public String displayName() { - return name(); // return the raw name for backwards compatibility - } - - /** - * Your name here, will be shown in "Discovered by:" when analyzing seeds. - * - * @return Your name - */ - public String discoveredBy() { - return "unknown"; - } - - /** - * Description of your plant. Keep it short, a few characters per line for up to two lines. - * Default is showing attributes of your plant, 2 per line. - * - * @param i line to get, starting from 0 - * @return The line - */ - public String desc(int i) { - String[] att = attributes(); - - if (att == null || att.length == 0) return ""; - - if (i == 0) { - String s = att[0]; - if (att.length >= 2) { - s+=", "+att[1]; - if (att.length >= 3) s+=","; - } - return s; - } - if (att.length < 3) return ""; - String s = att[2]; - if (att.length >= 4) s+=", "+att[3]; - return s; - } - - /** - * * - * @param crop reference to ICropTile - * @return roots lengt use in isBlockBelow - */ - public int getrootslength(ICropTile crop) { // TODO: camel case - return 1; - } - - /** - * Tier of the plant. Ranges from 1 to 16, 0 is Weed. - * Valuable and powerful crops have higher tiers, useless and weak ones have lower tiers. - * - * @return Tier - */ - public abstract int tier(); - - /** - * Describe the plant through a set of stats, influencing breeding. - * Plants sharing stats and attributes will tend to cross-breed more often. - * - * Stats: - * - 0: Chemistry (Industrial uses based on chemical plant components) - * - 1: Consumable (Food, potion ingredients, stuff meant to be eaten or similarly used) - * - 2: Defensive (Plants with defense capabilities (damaging, explosive, chemical) or special abilities in general) - * - 3: Colorful (How colorful/aesthetically/beautiful is the plant, like dye-plants or plants without actual effects) - * - 4: Weed (Is this plant weed-like and rather unwanted/quick-spreading? Rare super-breed plants should have low values here) - * - * @param n index of the requested stat - * @return The requested value of the stats - */ - public abstract int stat(int n); // TODO: change to fixed property object or builder with other attributes like tier - - /** - * Additional attributes of the plant, also influencing breeding. - * Plants sharing stats and attributes will tend to cross-breed more often. - * - * @return Attributes as an array of strings - */ - public abstract String[] attributes(); // TODO: default to none - - /** - * Determine the max crop size. - * - * Currently only used for texture allocation. - */ - public abstract int maxSize(); - - /** - * Instantiate your Icons here. - * - * This method will get called by IC2, don't call it yourself. - * - * It's highly recommended to use your own assert domain here, e.g. yourmod:crop/* instead of - * ic2:crop/*, which will then read assets/yourmod/textures/blocks/crop/*.png. - */ - @SideOnly(Side.CLIENT) - public void registerSprites(IIconRegister iconRegister) { - textures = new IIcon[maxSize()]; - - for (int i = 1; i <= textures.length; i++) { - // ic2:crop/blockCrop.NAME.n is the legacy name for backwards compatiblity - textures[i - 1] = iconRegister.registerIcon("ic2:crop/blockCrop."+name()+"."+i); - } - } - - /** - * Sprite the crop is meant to be rendered with. - * - * @param crop reference to ICropTile - * @return 0-255, representing the sprite index on the crop's spritesheet. - */ - @SideOnly(Side.CLIENT) - public IIcon getSprite(ICropTile crop) { - if (crop.getSize() <= 0 || crop.getSize() > textures.length) return null; - - return textures[crop.getSize() - 1]; - } - - /** - * Amount of growth points needed to increase the plant's size. - * Default is 200 * tier. - */ - public int growthDuration(ICropTile crop) { - return tier() * 200; - } - - /** - * Check whether the plant can grow further. - * - * Consider: - * - Humidity, nutrients and air quality - * - Current size - * - Light level - * - Special biomes or conditions, accessible through crop.worldObj - * - * This method will be called upon empty upgraded crops to check whether a neighboring plant can cross onto it! Don't check if the size is greater than 0 and if the ID is real. - * - * @param crop reference to ICropTile - * @return Whether the crop can grow - */ - public abstract boolean canGrow(ICropTile crop); - - /** - * Calculate the influence for the plant to grow based on humidity, nutrients and air. - * Normal behavior is rating the three stats "normal", with each of them ranging from 0-30. - * Basic rule: Assume everything returns 10. All together must equal 30. Add the factors to your likings, for example (humidity*0.7)+(nutrients*0.9)+(air*1.4) - * - * Default is humidity + nutrients + air (no factors). - * - * @param crop reference to ICropTile - * @param humidity ground humidity, influenced by hydration - * @param nutrients nutrient quality in ground, based on fertilizers - * @param air air quality, influences by open gardens and less crops surrounding this one - * @return 0-30 - */ - public int weightInfluences(ICropTile crop, float humidity, float nutrients, float air) { - return (int) (humidity + nutrients + air); - } - - /** - * Used to determine whether the plant can crossbreed with another crop. - * Default is allow crossbreeding if the size is greater or equal than 3. - * - * @param crop crop to crossbreed with - */ - public boolean canCross(ICropTile crop) { - return crop.getSize() >= 3; - } - - - /** - * Called when the plant is rightclicked by a player. - * Default action is harvesting. - * - * Only called Serverside. - * - * @param crop reference to ICropTile - * @param player player rightclicking the crop - * @return Whether the plant has changed - */ - public boolean rightclick(ICropTile crop, EntityPlayer player) { - return crop.harvest(true); - } - - /** - * Use in Crop Havester with insert Cropnalyzer to get best Output. - * - * @param crop reference to ICropTile - * @return need crop size for best output. - */ - - public abstract int getOptimalHavestSize(ICropTile crop); // TODO: default to maxSize - - /** - * Check whether the crop can be harvested. - * - * @param crop reference to ICropTile - * @return Whether the crop can be harvested in its current state. - */ - public abstract boolean canBeHarvested(ICropTile crop); // TODO: default to maxSize check - - /** - * Base chance for dropping the plant's gains, specify values greater than 1 for multiple drops. - * Default is 0.95^tier. - * - * @return Chance to drop the gains - */ - public float dropGainChance() { // TODO: change to double - return (float) Math.pow(0.95, tier()); - } - - /** - * Item obtained from harvesting the plant. - * - * @param crop reference to ICropTile - * @return Item obtained - */ - public abstract ItemStack getGain(ICropTile crop); - - /** - * Get the size of the plant after harvesting. - * Default is 1. - * - * @param crop reference to ICropTile - * @return Plant size after harvesting - */ - public byte getSizeAfterHarvest(ICropTile crop) {return 1;} // TODO: change to int - - - /** - * Called when the plant is left clicked by a player. - * Default action is picking the plant. - * - * Only called server side. - * - * @param crop reference to ICropTile - * @param player player left clicked the crop - * @return Whether the plant has changed - */ - public boolean leftclick(ICropTile crop, EntityPlayer player) { // TODO: camel case - return crop.pick(true); - } - - /** - * Base chance for dropping seeds when the plant is picked. - * Default is 0.5*0.8^tier with a bigger chance for sizes greater than 2 and absolutely no chance for size 0. - * - * @param crop reference to ICropTile - * @return Chance to drop the seeds - */ - public float dropSeedChance(ICropTile crop) { - if (crop.getSize() == 1) return 0; - float base = 0.5F; - if (crop.getSize() == 2) base/=2F; - for (int i = 0; i < tier(); i++) {base*=0.8;} - return base; - } - - /** - * Obtain seeds dropped when the plant is picked. - * Multiple drops of the returned ItemStack can occur. - * Default action is generating a seed from this crop. - * - * @param crop reference to ICropTile - * @return Seeds - */ - public ItemStack getSeeds(ICropTile crop) { - return crop.generateSeeds(crop.getCrop(), crop.getGrowth(), crop.getGain(), crop.getResistance(), crop.getScanLevel()); - } - - /** - * Called when a neighbor block to the crop has changed. - * - * @param crop reference to ICropTile - */ - public void onNeighbourChange(ICropTile crop) { - // - } - - /** - * Check if the crop should emit redstone. - * - * @return Whether the crop should emit redstone - */ - public int emitRedstone(ICropTile crop) {return 0;} - - /** - * Called when the crop is destroyed. - * - * @param crop reference to ICropTile - */ - public void onBlockDestroyed(ICropTile crop) { - // - } - - /** - * Get the light value emitted by the plant. - * - * @param crop reference to ICropTile - * @return Light value emitted - */ - public int getEmittedLight(ICropTile crop) { - return 0; - } - - /** - * Default is true if the entity is an EntityLiving in jumping or sprinting state. - * - * @param crop reference to ICropTile - * @param entity entity colliding - * @return Whether trampling calculation should happen, return false if the plant is no longer valid. - */ - public boolean onEntityCollision(ICropTile crop, Entity entity) { - if (entity instanceof EntityLivingBase) { - return ((EntityLivingBase) entity).isSprinting(); - } - - return false; - } - - - /** - * Called every time the crop ticks. - * Should be called every 256 ticks or around 13 seconds. - * - * @param crop reference to ICropTile - */ - public void tick(ICropTile crop) { - // nothing by default - } - - /** - * Check whether this plant spreads weed to surrounding tiles. - * Default is true if the plant has a high growth stat (or is weeds) and size greater or equal than 2. - * - * @param crop reference to ICropTile - * @return Whether the plant spreads weed - */ - public boolean isWeed(ICropTile crop) { - return crop.getSize() >= 2 && - (crop.getCrop() == Crops.weed || crop.getGrowth() >= 24); - } - - - /** - * Get this plant's ID. - * - * @return ID of this CropCard or -1 if it's not registered - * @deprecated IDs aren't used anymore. - */ - @Deprecated - public final int getId() { - return Crops.instance.getIdFor(this); - } - - private static String getModId() { - ModContainer modContainer = Loader.instance().activeModContainer(); - - if (modContainer != null) { - return modContainer.getModId(); - } else { - // this is bad if you are not actually IC2 - assert false; - - return "unknown"; - } - } - - @SideOnly(Side.CLIENT) - protected IIcon textures[]; - - private final String modId; // TODO: make owner abstract, remove modId auto detection - // TODO: add a clean way to obtain world reference and position -} diff --git a/src/api/java/ic2/api/crops/Crops.class b/src/api/java/ic2/api/crops/Crops.class deleted file mode 100644 index 1844fa959..000000000 Binary files a/src/api/java/ic2/api/crops/Crops.class and /dev/null differ diff --git a/src/api/java/ic2/api/crops/Crops.java b/src/api/java/ic2/api/crops/Crops.java deleted file mode 100644 index a11059a91..000000000 --- a/src/api/java/ic2/api/crops/Crops.java +++ /dev/null @@ -1,151 +0,0 @@ -package ic2.api.crops; - -import java.util.Collection; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.world.biome.BiomeGenBase; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraftforge.common.BiomeDictionary.Type; - -/** - * General management of the crop system. - */ -public abstract class Crops { - public static Crops instance; - - public static CropCard weed; // weed has special properties, thus it's exposed here - - /** - * Adds a crop nutrient biome bonus. - * - * +10/-10 0 indicates no bonus and negative values indicate a penalty. - * - * @param type Forge biome type to apply the bonus in - * @param nutrientsBonus Nutrient stat bonus - */ - public abstract void addBiomenutrientsBonus(Type type, int nutrientsBonus); - - /** - * Adds a crop humidity biome bonus. - * - * +10/-10 0 indicates no bonus and negative values indicate a penalty. - * - * @param type Forge biome type to apply the bonus in - * @param humidityBonus Humidity stat bonus - */ - public abstract void addBiomehumidityBonus(Type type, int humidityBonus); - - - /** - * Gets the humidity bonus for a biome. - * - * @param biome Biome to check - * @return Humidity bonus or 0 if none - */ - public abstract int getHumidityBiomeBonus(BiomeGenBase biome); - - /** - * Gets the nutrient bonus for a biome. - * - * @param biome Biome to check - * @return Nutrient bonus or 0 if none - */ - public abstract int getNutrientBiomeBonus(BiomeGenBase biome); - - /** - * Get the crop card for the specified owner and name. - * - * @param owner CropCard owner mod id. - * @param name CropCard name. - * @return Matching CropCard. - */ - public abstract CropCard getCropCard(String owner, String name); - - /** - * Get the crop card for the specified seed item stack. - * - * @param stack ItemStack containing seeds for the crop. - * @return Matching CropCard. - */ - public abstract CropCard getCropCard(ItemStack stack); - - /** - * Returns a list of all crops. - * - * @return All registered crops. - */ - public abstract Collection getCrops(); - - /** - * Returns the list of registered crops. - * - * @return Registered crops by ID - */ - @Deprecated - public abstract CropCard[] getCropList(); - - /** - * Register a plant. - * - * @param crop Plant to register. - * @return Autoassigned id for legacy compatibility, TODO: change to void. - */ - public abstract short registerCrop(CropCard crop); - - /** - * Register a plant and provide a legacy id for migration. - * - * @param crop Plant to register. - * @param legacyId ID previously used for this crop. - * @return true, TODO: change to void. - */ - public abstract boolean registerCrop(CropCard crop, int legacyId); - - /** - * @deprecated use the CropCard version. - */ - @Deprecated - public abstract boolean registerBaseSeed(ItemStack stack, int id, int size, int growth, int gain, int resistance); - - /** - * Registers a base seed, an item used to plant a crop. - * - * @param stack item - * @param id plant ID - * @param size initial size - * @param growth initial growth stat - * @param gain initial gain stat - * @param resistance initial resistance stat - * @return True if successful - */ - public abstract boolean registerBaseSeed(ItemStack stack, CropCard crop, int size, int growth, int gain, int resistance); - - /** - * Finds a base seed from the given item. - * - * @return Base seed or null if none found - */ - public abstract BaseSeed getBaseSeed(ItemStack stack); - - /** - * Execute registerSprites for all registered crop cards. - * - * This method will get called by IC2, don't call it yourself. - */ - @SideOnly(Side.CLIENT) - public abstract void startSpriteRegistration(IIconRegister iconRegister); - - /** - * Returns the ID for the given crop. - * - * @param crop Crop to look up - * @return ID, or -1 if not found - * @deprecated IDs aren't used anymore. - */ - @Deprecated - public abstract int getIdFor(CropCard crop); -} diff --git a/src/api/java/ic2/api/crops/ICropTile.class b/src/api/java/ic2/api/crops/ICropTile.class deleted file mode 100644 index aafb6de2c..000000000 Binary files a/src/api/java/ic2/api/crops/ICropTile.class and /dev/null differ diff --git a/src/api/java/ic2/api/crops/ICropTile.java b/src/api/java/ic2/api/crops/ICropTile.java deleted file mode 100644 index dadf691d5..000000000 --- a/src/api/java/ic2/api/crops/ICropTile.java +++ /dev/null @@ -1,289 +0,0 @@ -package ic2.api.crops; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.World; - -/** - * Interface implemented by the crop tile entity. - */ -public interface ICropTile { - /** - * Get the crop. - * - * @return CropCard, or null if there is no plant currently on the crop - */ - public CropCard getCrop(); - - /** - * Set the crop. - * - * @param cropCard CropCard or null for no plant - */ - public void setCrop(CropCard cropCard); - - /** - * @deprecated IDs have been removed. - */ - @Deprecated - public short getID(); - - /** - * @deprecated IDs have been removed. - */ - @Deprecated - public void setID(short id); - - /** - * Get the crop's plant size. - * - * @return Plant size, starting with 1 and maximum varies depending on plant - */ - public byte getSize(); - - /** - * Set the crop's plant size. - * - * @param size Plant size - */ - public void setSize(byte size); - - /** - * Get the crop's plant growth stat. - * Higher values indicate faster growth. - * - * @return Plant growth stat - */ - public byte getGrowth(); - - /** - * Set the crop's plant growth stat. - * - * @param growth Plant growth stat - */ - public void setGrowth(byte growth); - - /** - * Get the crop's plant gain stat. - * Higher values indicate more drops. - * - * @return Plant gain stat - */ - public byte getGain(); - - /** - * Set the crop's plant gain stat. - * - * @param gain Plant gain stat - */ - public void setGain(byte gain); - - /** - * Get the crop's plant resistance stat. - * Higher values indicate more resistance against trampling. - * - * @return Plant resistance stat - */ - public byte getResistance(); - - /** - * Set the crop's plant resistance stat. - * - * @param resistance Plant resistance stat - */ - public void setResistance(byte resistance); - - /** - * Get the crop's plant scan level. - * Increases every time the seed is analyzed. - * - * @return Plant scan level - */ - public byte getScanLevel(); - - /** - * Set the crop's plant scan level. - * - * @param scanLevel Plant scan level - */ - public void setScanLevel(byte scanLevel); - - /** - * Get the crop's plant custom data, stored alongside the crop. - * Can be modified in place. - * - * @return Plant custom data - */ - public NBTTagCompound getCustomData(); - - /** - * Get the crop's nutrient storage. - * Ranges from 0 to 100. - * - * @return Crop nutrient storage - */ - public int getNutrientStorage(); - - /** - * Set the crop's nutrient storage. - * - * @param nutrientStorage Crop nutrient storage - */ - public void setNutrientStorage(int nutrientStorage); - - /** - * Get the crop's hydration storage. - * 0 indicates nothing, 1-10 indicate water hydration and 11-100 for hydration cells. - * - * @return Crop hydration storage - */ - public int getHydrationStorage(); - - /** - * Set the crop's hydration storage. - * - * @param hydrationStorage Crop hydration storage - */ - public void setHydrationStorage(int hydrationStorage); - - /** - * Get the crop's Weed-Ex storage. - * - * @return Crop Weed-Ex storage - */ - public int getWeedExStorage(); - - /** - * Set the crop's Weed-Ex storage. - * - * @param weedExStorage Crop Weed-Ex storage - */ - public void setWeedExStorage(int weedExStorage); - - /** - * Get the crop's humidity. - * Ranges from 0 (dry) to 10 (humid). - * Updates every couple of seconds or when an update is requested. - * - * @see #updateState() - * - * @return Crop humidity level - */ - public byte getHumidity(); - - /** - * Get the crop's nutrient level. - * Ranges from 0 (empty) to 10 (full). - * Updates every couple of seconds or when an update is requested. - * - * @see #updateState() - * - * @return Crop nutrient level - */ - public byte getNutrients(); - - /** - * Get the crop's air quality. - * Ranges from 0 (cluttered) to 10 (fresh). - * Updates every couple of seconds or when an update is requested. - * - * @see #updateState() - * - * @return Crop air quality - */ - public byte getAirQuality(); - - /** - * Get the crop's world. - * - * @return Crop world - */ - public World getWorld(); - - /** - * Get the crop's location. - * - * @return Crop location - */ - public ChunkCoordinates getLocation(); - - /** - * Get the crop's light level. - * - * @return Crop light level - */ - public int getLightLevel(); - - /** - * Pick the crop, removing and giving seeds for the plant. - * - * @param manual whether it was done by hand (not automated) - * @return true if successfully picked - */ - public boolean pick(boolean manual); - - /** - * Harvest the crop, turning it into gain and resetting its size. - * drop output on ground - * @param manual - * @return true if successfully harvested - */ - public boolean harvest(boolean manual); - - /** - * Harvest the crop, turning it into gain and resetting its size. - * drop output on ground - * @param Optimal force check getOptimalHavestSize() for harvest - * @return ItemStack[] of harvest output - */ - - ItemStack[] harvest_automated(boolean Optimal); - - /** - * Fully clears the crop without dropping anything. - */ - public void reset(); - - /** - * Request a texture and lighting update. - */ - public void updateState(); - - /** - * Check if a block is under the farmland containing the crop. - * Searches up to 2 blocks below the farmland or an air space, whichever appears first. - * - * @param block block to search - * @return Whether the block was found - */ - public boolean isBlockBelow(Block block); - - /** - * Check if a block is under the farmland containing the crop. - * Searches up to 2 blocks below the farmland or an air space, whichever appears first. - * - * @param oreDictionaryName blocks to search - * @return Whether the blocks were found - */ - public boolean isBlockBelow(String oreDictionaryName); - - /** - * Generate plant seeds with the given parameters. - * - * @param crop plant - * @param growth plant growth stat - * @param gain plant gain stat - * @param resis plant resistance stat - * @param scan plant scan level - * @return Plant seed item - */ - public ItemStack generateSeeds(CropCard crop, byte growth, byte gain, byte resis, byte scan); - - /** - * @deprecated Use the CropCard version instead. - */ - @Deprecated - public ItemStack generateSeeds(short plant, byte growth, byte gain, byte resis, byte scan); -} diff --git a/src/api/java/ic2/api/crops/package-info.class b/src/api/java/ic2/api/crops/package-info.class deleted file mode 100644 index 1c2c0e119..000000000 Binary files a/src/api/java/ic2/api/crops/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/crops/package-info.java b/src/api/java/ic2/api/crops/package-info.java deleted file mode 100644 index 04b825392..000000000 --- a/src/api/java/ic2/api/crops/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.crops; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/ic2/api/energy/EnergyNet.class b/src/api/java/ic2/api/energy/EnergyNet.class deleted file mode 100644 index 197104654..000000000 Binary files a/src/api/java/ic2/api/energy/EnergyNet.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/EnergyNet.java b/src/api/java/ic2/api/energy/EnergyNet.java deleted file mode 100644 index 822bfc297..000000000 --- a/src/api/java/ic2/api/energy/EnergyNet.java +++ /dev/null @@ -1,18 +0,0 @@ -package ic2.api.energy; - - -/** - * Provides access to the energy network. - * - * The old EnergyNet methods missing in IEnergyNet have been migrated to events (load, unload) or - * removed (tiles no longer emit energy actively, the energy net implementation requests it). - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public final class EnergyNet { - /** - * Instance of the global EnergyNet class. - */ - public static IEnergyNet instance; -} - diff --git a/src/api/java/ic2/api/energy/IEnergyNet.class b/src/api/java/ic2/api/energy/IEnergyNet.class deleted file mode 100644 index 76b574630..000000000 Binary files a/src/api/java/ic2/api/energy/IEnergyNet.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/IEnergyNet.java b/src/api/java/ic2/api/energy/IEnergyNet.java deleted file mode 100644 index 8f656e505..000000000 --- a/src/api/java/ic2/api/energy/IEnergyNet.java +++ /dev/null @@ -1,86 +0,0 @@ -package ic2.api.energy; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Interface representing the methods provided by the global EnergyNet class. - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public interface IEnergyNet { - /** - * Get the EnergyNet-registered tile entity at the specified position. - * - * This is not the same as World.getTileEntity(), it's possible to register delegate tile - * entities with the energy net which are different from what's actually in the world. Those - * delegates allow to use separate TileEntity objects just for the EnergyNet interfaces, - * simplifying cross-mod dependencies and multi-blocks. - * - * @param world World containing the tile entity - * @param x x-coordinate - * @param y y-coordinate - * @param z z-coordinate - * @return tile entity registered to the energy net or null if none is registered - */ - TileEntity getTileEntity(World world, int x, int y, int z); - - /** - * Get the EnergyNet-registered neighbor tile entity at the specified position. - * - * @param te TileEntity indicating the world and position to search from - * @param dir direction the neighbor is to be found - * @return neighbor tile entity registered to the energy net or null if none is registered - */ - TileEntity getNeighbor(TileEntity te, ForgeDirection dir); - - /** - * determine how much energy has been emitted by the EnergyEmitter specified - * - * @note call this twice with x ticks delay to get the avg. emitted power p = (call2 - call1) / x EU/tick - * - * @param tileEntity energy emitter - * @deprecated Discontinued, use getNodeStats instead. - */ - @Deprecated - double getTotalEnergyEmitted(TileEntity tileEntity); - - /** - * determine how much energy has been sunken by the EnergySink specified - * - * @note call this twice with x ticks delay to get the avg. sunken power p = (call2 - call1) / x EU/tick - * - * @param tileEntity energy emitter - * @deprecated Discontinued, use getNodeStats instead. - */ - @Deprecated - double getTotalEnergySunken(TileEntity tileEntity); - - /** - * Retrieve statistics for the tile entity specified. - * - * The statistics apply to the last simulated tick. - * - * @param te Tile entity to check. - * @return Statistics for the tile entity. - */ - NodeStats getNodeStats(TileEntity te); - - /** - * Determine the typical power used by the specific tier, e.g. 128 eu/t for tier 2. - * - * @param tier tier - * @return power in eu/t - */ - double getPowerFromTier(int tier); - - /** - * Determine minimum tier required to handle the specified power, e.g. tier 2 for 128 eu/t. - * - * @param power in eu/t - * @return tier - */ - int getTierFromPower(double power); -} diff --git a/src/api/java/ic2/api/energy/NodeStats.class b/src/api/java/ic2/api/energy/NodeStats.class deleted file mode 100644 index eceb34029..000000000 Binary files a/src/api/java/ic2/api/energy/NodeStats.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/NodeStats.java b/src/api/java/ic2/api/energy/NodeStats.java deleted file mode 100644 index db33da7df..000000000 --- a/src/api/java/ic2/api/energy/NodeStats.java +++ /dev/null @@ -1,25 +0,0 @@ -package ic2.api.energy; - -public class NodeStats { - public NodeStats(double energyIn, double energyOut, double voltage) { - this.energyIn = energyIn; - this.energyOut = energyOut; - this.voltage = voltage; - } - - public double getEnergyIn() { - return energyIn; - } - - public double getEnergyOut() { - return energyOut; - } - - public double getVoltage() { - return voltage; - } - - protected double energyIn; - protected double energyOut; - protected double voltage; -} diff --git a/src/api/java/ic2/api/energy/event/EnergyTileEvent.class b/src/api/java/ic2/api/energy/event/EnergyTileEvent.class deleted file mode 100644 index 25e3e25e4..000000000 Binary files a/src/api/java/ic2/api/energy/event/EnergyTileEvent.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/event/EnergyTileEvent.java b/src/api/java/ic2/api/energy/event/EnergyTileEvent.java deleted file mode 100644 index 86b8dc2b1..000000000 --- a/src/api/java/ic2/api/energy/event/EnergyTileEvent.java +++ /dev/null @@ -1,25 +0,0 @@ -package ic2.api.energy.event; - -import net.minecraft.tileentity.TileEntity; - -import net.minecraftforge.event.world.WorldEvent; - -import ic2.api.energy.tile.IEnergyTile; - -/** - * Base class for energy net events, don't use it directly. - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public class EnergyTileEvent extends WorldEvent { - public final IEnergyTile energyTile; - - public EnergyTileEvent(IEnergyTile energyTile1) { - super(((TileEntity) energyTile1).getWorldObj()); - - if (world == null) throw new NullPointerException("world is null"); - - this.energyTile = energyTile1; - } -} - diff --git a/src/api/java/ic2/api/energy/event/EnergyTileLoadEvent.class b/src/api/java/ic2/api/energy/event/EnergyTileLoadEvent.class deleted file mode 100644 index 9ccd40e3e..000000000 Binary files a/src/api/java/ic2/api/energy/event/EnergyTileLoadEvent.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/event/EnergyTileLoadEvent.java b/src/api/java/ic2/api/energy/event/EnergyTileLoadEvent.java deleted file mode 100644 index bf019ae34..000000000 --- a/src/api/java/ic2/api/energy/event/EnergyTileLoadEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -package ic2.api.energy.event; - -import ic2.api.energy.tile.IEnergyTile; - -/** - * Event announcing new energy tiles. - * - * This event notifies subscribers of loaded energy tiles, e.g. after getting - * loaded through the chunk they are in or after being placed down by the - * player or another deployer mechanism. - * - * Every energy tile which wants to get connected to the IC2 Energy Network has - * to either post this event or alternatively call EnergyNet.addTileEntity(). - * - * You may use this event to build a static representation of energy tiles for - * your own energy grid implementation if you need to. It's not required if you - * always lookup energy paths on demand. - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public class EnergyTileLoadEvent extends EnergyTileEvent { - public EnergyTileLoadEvent(IEnergyTile energyTile1) { - super(energyTile1); - } -} - diff --git a/src/api/java/ic2/api/energy/event/EnergyTileUnloadEvent.class b/src/api/java/ic2/api/energy/event/EnergyTileUnloadEvent.class deleted file mode 100644 index f5e53ae50..000000000 Binary files a/src/api/java/ic2/api/energy/event/EnergyTileUnloadEvent.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/event/EnergyTileUnloadEvent.java b/src/api/java/ic2/api/energy/event/EnergyTileUnloadEvent.java deleted file mode 100644 index 2b22ae31c..000000000 --- a/src/api/java/ic2/api/energy/event/EnergyTileUnloadEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -package ic2.api.energy.event; - -import ic2.api.energy.tile.IEnergyTile; - -/** - * Event announcing terminated energy tiles. - * - * This event notifies subscribers of unloaded energy tiles, e.g. after getting - * unloaded through the chunk they are in or after being destroyed by the - * player or another block pick/destruction mechanism. - * - * Every energy tile which wants to get disconnected from the IC2 Energy - * Network has to either post this event or alternatively call - * EnergyNet.removeTileEntity(). - * - * You may use this event to build a static representation of energy tiles for - * your own energy grid implementation if you need to. It's not required if you - * always lookup energy paths on demand. - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public class EnergyTileUnloadEvent extends EnergyTileEvent { - public EnergyTileUnloadEvent(IEnergyTile energyTile1) { - super(energyTile1); - } -} - diff --git a/src/api/java/ic2/api/energy/event/package-info.class b/src/api/java/ic2/api/energy/event/package-info.class deleted file mode 100644 index fc279ec0f..000000000 Binary files a/src/api/java/ic2/api/energy/event/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/event/package-info.java b/src/api/java/ic2/api/energy/event/package-info.java deleted file mode 100644 index 40db6f8a1..000000000 --- a/src/api/java/ic2/api/energy/event/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.energy.event; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/ic2/api/energy/package-info.class b/src/api/java/ic2/api/energy/package-info.class deleted file mode 100644 index baaed208f..000000000 Binary files a/src/api/java/ic2/api/energy/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/package-info.java b/src/api/java/ic2/api/energy/package-info.java deleted file mode 100644 index 81d0bfeda..000000000 --- a/src/api/java/ic2/api/energy/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.energy; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/ic2/api/energy/prefab/BasicSink.class b/src/api/java/ic2/api/energy/prefab/BasicSink.class deleted file mode 100644 index 426e0908d..000000000 Binary files a/src/api/java/ic2/api/energy/prefab/BasicSink.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/prefab/BasicSink.java b/src/api/java/ic2/api/energy/prefab/BasicSink.java deleted file mode 100644 index 48de06135..000000000 --- a/src/api/java/ic2/api/energy/prefab/BasicSink.java +++ /dev/null @@ -1,373 +0,0 @@ -package ic2.api.energy.prefab; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -import cpw.mods.fml.common.FMLCommonHandler; - -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.util.ForgeDirection; - -import ic2.api.energy.event.EnergyTileLoadEvent; -import ic2.api.energy.event.EnergyTileUnloadEvent; -import ic2.api.energy.tile.IEnergySink; -import ic2.api.info.Info; -import ic2.api.item.ElectricItem; - -/** - * BasicSink is a simple adapter to provide an ic2 energy sink. - * - * It's designed to be attached to a tile entity as a delegate. Functionally BasicSink acts as a - * one-time configurable input energy buffer, thus providing a common use case for machines. - * - * Sub-classing BasicSink instead of using it as a delegate works as well, but isn't recommended. - * The delegate can be extended with additional functionality through a sub class though. - * - * The constraints set by BasicSink like the strict tank-like energy buffering should provide a - * more easy to use and stable interface than using IEnergySink directly while aiming for - * optimal performance. - * - * Using BasicSink involves the following steps: - * - create a BasicSink instance in your TileEntity, typically in a field - * - forward invalidate, onChunkUnload, readFromNBT, writeToNBT and updateEntity to the BasicSink - * instance. - * If you have other means of determining when the tile entity is fully loaded, notify onLoaded - * that way instead of forwarding updateEntity. - * - call useEnergy whenever appropriate. canUseEnergy determines if enough energy is available - * without consuming the energy. - * - optionally use getEnergyStored to display the output buffer charge level - * - optionally use setEnergyStored to sync the stored energy to the client (e.g. in the Container) - * - * Example implementation code: - * @code{.java} - * public class SomeTileEntity extends TileEntity { - * // new basic energy sink, 1000 EU buffer, tier 1 (32 EU/t, LV) - * private BasicSink ic2EnergySink = new BasicSink(this, 1000, 1); - * - * @Override - * public void invalidate() { - * ic2EnergySink.invalidate(); // notify the energy sink - * ... - * super.invalidate(); // this is important for mc! - * } - * - * @Override - * public void onChunkUnload() { - * ic2EnergySink.onChunkUnload(); // notify the energy sink - * ... - * } - * - * @Override - * public void readFromNBT(NBTTagCompound tag) { - * super.readFromNBT(tag); - * - * ic2EnergySink.readFromNBT(tag); - * ... - * } - * - * @Override - * public void writeToNBT(NBTTagCompound tag) { - * super.writeToNBT(tag); - * - * ic2EnergySink.writeToNBT(tag); - * ... - * } - * - * @Override - * public void updateEntity() { - * ic2EnergySink.updateEntity(); // notify the energy sink - * ... - * if (ic2EnergySink.useEnergy(5)) { // use 5 eu from the sink's buffer this tick - * ... // do something with the energy - * } - * ... - * } - * - * ... - * } - * @endcode - */ -public class BasicSink extends TileEntity implements IEnergySink { - // ********************************** - // *** Methods for use by the mod *** - // ********************************** - - /** - * Constructor for a new BasicSink delegate. - * - * @param parent1 TileEntity represented by this energy sink. - * @param capacity1 Maximum amount of eu to store. - * @param tier1 IC2 tier, 1 = LV, 2 = MV, ... - */ - public BasicSink(TileEntity parent1, int capacity1, int tier1) { - this.parent = parent1; - this.capacity = capacity1; - this.tier = tier1; - } - - // in-world te forwards >> - - /** - * Forward for the base TileEntity's updateEntity(), used for creating the energy net link. - * Either updateEntity or onLoaded have to be used. - */ - @Override - public void updateEntity() { - if (!addedToEnet) onLoaded(); - } - - /** - * Notification that the base TileEntity finished loaded, for advanced uses. - * Either updateEntity or onLoaded have to be used. - */ - public void onLoaded() { - if (!addedToEnet && - !FMLCommonHandler.instance().getEffectiveSide().isClient() && - Info.isIc2Available()) { - worldObj = parent.getWorldObj(); - xCoord = parent.xCoord; - yCoord = parent.yCoord; - zCoord = parent.zCoord; - - MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); - - addedToEnet = true; - } - } - - /** - * Forward for the base TileEntity's invalidate(), used for destroying the energy net link. - * Both invalidate and onChunkUnload have to be used. - */ - @Override - public void invalidate() { - super.invalidate(); - - onChunkUnload(); - } - - /** - * Forward for the base TileEntity's onChunkUnload(), used for destroying the energy net link. - * Both invalidate and onChunkUnload have to be used. - */ - @Override - public void onChunkUnload() { - if (addedToEnet && - Info.isIc2Available()) { - MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); - - addedToEnet = false; - } - } - - /** - * Forward for the base TileEntity's readFromNBT(), used for loading the state. - * - * @param tag Compound tag as supplied by TileEntity.readFromNBT() - */ - @Override - public void readFromNBT(NBTTagCompound tag) { - super.readFromNBT(tag); - - NBTTagCompound data = tag.getCompoundTag("IC2BasicSink"); - - energyStored = data.getDouble("energy"); - } - - /** - * Forward for the base TileEntity's writeToNBT(), used for saving the state. - * - * @param tag Compound tag as supplied by TileEntity.writeToNBT() - */ - @Override - public void writeToNBT(NBTTagCompound tag) { - try { - super.writeToNBT(tag); - } catch (RuntimeException e) { - // happens if this is a delegate, ignore - } - - NBTTagCompound data = new NBTTagCompound(); - - data.setDouble("energy", energyStored); - - tag.setTag("IC2BasicSink", data); - } - - // << in-world te forwards - // methods for using this adapter >> - - /** - * Get the maximum amount of energy this sink can hold in its buffer. - * - * @return Capacity in EU. - */ - public int getCapacity() { - return capacity; - } - - /** - * Set the maximum amount of energy this sink can hold in its buffer. - * - * @param capacity1 Capacity in EU. - */ - public void setCapacity(int capacity1) { - this.capacity = capacity1; - } - - /** - * Get the IC2 energy tier for this sink. - * - * @return IC2 Tier. - */ - public int getTier() { - return tier; - } - - /** - * Set the IC2 energy tier for this sink. - * - * @param tier1 IC2 Tier. - */ - public void setTier(int tier1) { - this.tier = tier1; - } - - /** - * Determine the energy stored in the sink's input buffer. - * - * @return amount in EU, may be above capacity - */ - public double getEnergyStored() { - return energyStored; - } - - /** - * Set the stored energy to the specified amount. - * - * This is intended for server -> client synchronization, e.g. to display the stored energy in - * a GUI through getEnergyStored(). - * - * @param amount - */ - public void setEnergyStored(double amount) { - energyStored = amount; - } - - /** - * Determine if the specified amount of energy is available. - * - * @param amount in EU - * @return true if the amount is available - */ - public boolean canUseEnergy(double amount) { - return energyStored >= amount; - } - - /** - * Use the specified amount of energy, if available. - * - * @param amount amount to use - * @return true if the amount was available - */ - public boolean useEnergy(double amount) { - if (canUseEnergy(amount) && !FMLCommonHandler.instance().getEffectiveSide().isClient()) { - energyStored -= amount; - - return true; - } - return false; - } - - /** - * Discharge the supplied ItemStack into this sink's energy buffer. - * - * @param stack ItemStack to discharge (null is ignored) - * @param limit Transfer limit, values <= 0 will use the battery's limit - * @return true if energy was transferred - */ - public boolean discharge(ItemStack stack, int limit) { - if (stack == null || !Info.isIc2Available()) return false; - - double amount = capacity - energyStored; - if (amount <= 0) return false; - - if (limit > 0 && limit < amount) amount = limit; - - amount = ElectricItem.manager.discharge(stack, amount, tier, limit > 0, true, false); - - energyStored += amount; - - return amount > 0; - } - - // << methods for using this adapter - - // backwards compatibility (ignore these) >> - - @Deprecated - public void onUpdateEntity() { - updateEntity(); - } - - @Deprecated - public void onInvalidate() { - invalidate(); - } - - @Deprecated - public void onOnChunkUnload() { - onChunkUnload(); - } - - @Deprecated - public void onReadFromNbt(NBTTagCompound tag) { - readFromNBT(tag); - } - - @Deprecated - public void onWriteToNbt(NBTTagCompound tag) { - writeToNBT(tag); - } - - // << backwards compatibility - - // ****************************** - // *** Methods for use by ic2 *** - // ****************************** - - // energy net interface >> - - @Override - public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) { - return true; - } - - @Override - public double getDemandedEnergy() { - return Math.max(0, capacity - energyStored); - } - - @Override - public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) { - energyStored += amount; - - return 0; - } - - @Override - public int getSinkTier() { - return tier; - } - - // << energy net interface - - - public final TileEntity parent; - - protected int capacity; - protected int tier; - protected double energyStored; - protected boolean addedToEnet; -} diff --git a/src/api/java/ic2/api/energy/prefab/BasicSource.class b/src/api/java/ic2/api/energy/prefab/BasicSource.class deleted file mode 100644 index afe8e25bc..000000000 Binary files a/src/api/java/ic2/api/energy/prefab/BasicSource.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/prefab/BasicSource.java b/src/api/java/ic2/api/energy/prefab/BasicSource.java deleted file mode 100644 index 011e8cd39..000000000 --- a/src/api/java/ic2/api/energy/prefab/BasicSource.java +++ /dev/null @@ -1,375 +0,0 @@ -package ic2.api.energy.prefab; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -import cpw.mods.fml.common.FMLCommonHandler; - -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.util.ForgeDirection; - -import ic2.api.energy.EnergyNet; -import ic2.api.energy.event.EnergyTileLoadEvent; -import ic2.api.energy.event.EnergyTileUnloadEvent; -import ic2.api.energy.tile.IEnergySource; -import ic2.api.info.Info; -import ic2.api.item.ElectricItem; - -/** - * BasicSource is a simple adapter to provide an ic2 energy source. - * - * It's designed to be attached to a tile entity as a delegate. Functionally BasicSource acts as a - * one-time configurable output energy buffer, thus providing a common use case for generators. - * - * Sub-classing BasicSource instead of using it as a delegate works as well, but isn't recommended. - * The delegate can be extended with additional functionality through a sub class though. - * - * The constraints set by BasicSource like the strict tank-like energy buffering should provide a - * more easy to use and stable interface than using IEnergySource directly while aiming for - * optimal performance. - * - * Using BasicSource involves the following steps: - * - create a BasicSource instance in your TileEntity, typically in a field - * - forward invalidate, onChunkUnload, readFromNBT, writeToNBT and updateEntity to the BasicSource - * instance. - * If you have other means of determining when the tile entity is fully loaded, notify onLoaded - * that way instead of forwarding updateEntity. - * - call addEnergy whenever appropriate, using getFreeCapacity may determine if e.g. the generator - * should run - * - optionally use getEnergyStored to display the output buffer charge level - * - optionally use setEnergyStored to sync the stored energy to the client (e.g. in the Container) - * - * Example implementation code: - * @code{.java} - * public class SomeTileEntity extends TileEntity { - * // new basic energy source, 1000 EU buffer, tier 1 (32 EU/t, LV) - * private BasicSource ic2EnergySource = new BasicSource(this, 1000, 1); - * - * @Override - * public void invalidate() { - * ic2EnergySource.invalidate(); // notify the energy source - * ... - * super.invalidate(); // this is important for mc! - * } - * - * @Override - * public void onChunkUnload() { - * ic2EnergySource.onChunkUnload(); // notify the energy source - * ... - * } - * - * @Override - * public void readFromNBT(NBTTagCompound tag) { - * super.readFromNBT(tag); - * - * ic2EnergySource.readFromNBT(tag); - * ... - * } - * - * @Override - * public void writeToNBT(NBTTagCompound tag) { - * super.writeToNBT(tag); - * - * ic2EnergySource.writeToNBT(tag); - * ... - * } - * - * @Override - * public void updateEntity() { - * ic2EnergySource.updateEntity(); // notify the energy source - * ... - * ic2EnergySource.addEnergy(5); // add 5 eu to the source's buffer this tick - * ... - * } - * - * ... - * } - * @endcode - */ -public class BasicSource extends TileEntity implements IEnergySource { - // ********************************** - // *** Methods for use by the mod *** - // ********************************** - - /** - * Constructor for a new BasicSource delegate. - * - * @param parent1 Base TileEntity represented by this energy source. - * @param capacity1 Maximum amount of eu to store. - * @param tier1 IC2 tier, 1 = LV, 2 = MV, ... - */ - public BasicSource(TileEntity parent1, double capacity1, int tier1) { - double power = EnergyNet.instance.getPowerFromTier(tier1); - - this.parent = parent1; - this.capacity = capacity1 < power ? power : capacity1; - this.tier = tier1; - this.power = power; - } - - // in-world te forwards >> - - /** - * Forward for the base TileEntity's updateEntity(), used for creating the energy net link. - * Either updateEntity or onLoaded have to be used. - */ - @Override - public void updateEntity() { - if (!addedToEnet) onLoaded(); - } - - /** - * Notification that the base TileEntity finished loading, for advanced uses. - * Either updateEntity or onLoaded have to be used. - */ - public void onLoaded() { - if (!addedToEnet && - !FMLCommonHandler.instance().getEffectiveSide().isClient() && - Info.isIc2Available()) { - worldObj = parent.getWorldObj(); - xCoord = parent.xCoord; - yCoord = parent.yCoord; - zCoord = parent.zCoord; - - MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); - - addedToEnet = true; - } - } - - /** - * Forward for the base TileEntity's invalidate(), used for destroying the energy net link. - * Both invalidate and onChunkUnload have to be used. - */ - @Override - public void invalidate() { - super.invalidate(); - - onChunkUnload(); - } - - /** - * Forward for the base TileEntity's onChunkUnload(), used for destroying the energy net link. - * Both invalidate and onChunkUnload have to be used. - */ - @Override - public void onChunkUnload() { - if (addedToEnet && - Info.isIc2Available()) { - MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); - - addedToEnet = false; - } - } - - /** - * Forward for the base TileEntity's readFromNBT(), used for loading the state. - * - * @param tag Compound tag as supplied by TileEntity.readFromNBT() - */ - @Override - public void readFromNBT(NBTTagCompound tag) { - super.readFromNBT(tag); - - NBTTagCompound data = tag.getCompoundTag("IC2BasicSource"); - - energyStored = data.getDouble("energy"); - } - - /** - * Forward for the base TileEntity's writeToNBT(), used for saving the state. - * - * @param tag Compound tag as supplied by TileEntity.writeToNBT() - */ - @Override - public void writeToNBT(NBTTagCompound tag) { - try { - super.writeToNBT(tag); - } catch (RuntimeException e) { - // happens if this is a delegate, ignore - } - - NBTTagCompound data = new NBTTagCompound(); - - data.setDouble("energy", energyStored); - - tag.setTag("IC2BasicSource", data); - } - - // << in-world te forwards - // methods for using this adapter >> - - /** - * Get the maximum amount of energy this source can hold in its buffer. - * - * @return Capacity in EU. - */ - public double getCapacity() { - return capacity; - } - - /** - * Set the maximum amount of energy this source can hold in its buffer. - * - * @param capacity1 Capacity in EU. - */ - public void setCapacity(double capacity1) { - if (capacity1 < power) capacity1 = power; - - this.capacity = capacity1; - } - - /** - * Get the IC2 energy tier for this source. - * - * @return IC2 Tier. - */ - public int getTier() { - return tier; - } - - /** - * Set the IC2 energy tier for this source. - * - * @param tier1 IC2 Tier. - */ - public void setTier(int tier1) { - double power = EnergyNet.instance.getPowerFromTier(tier1); - - if (capacity < power) capacity = power; - - this.tier = tier1; - this.power = power; - } - - - /** - * Determine the energy stored in the source's output buffer. - * - * @return amount in EU - */ - public double getEnergyStored() { - return energyStored; - } - - /** - * Set the stored energy to the specified amount. - * - * This is intended for server -> client synchronization, e.g. to display the stored energy in - * a GUI through getEnergyStored(). - * - * @param amount - */ - public void setEnergyStored(double amount) { - energyStored = amount; - } - - /** - * Determine the free capacity in the source's output buffer. - * - * @return amount in EU - */ - public double getFreeCapacity() { - return capacity - energyStored; - } - - /** - * Add some energy to the output buffer. - * - * @param amount maximum amount of energy to add - * @return amount added/used, NOT remaining - */ - public double addEnergy(double amount) { - if (FMLCommonHandler.instance().getEffectiveSide().isClient()) return 0; - if (amount > capacity - energyStored) amount = capacity - energyStored; - - energyStored += amount; - - return amount; - } - - /** - * Charge the supplied ItemStack from this source's energy buffer. - * - * @param stack ItemStack to charge (null is ignored) - * @return true if energy was transferred - */ - public boolean charge(ItemStack stack) { - if (stack == null || !Info.isIc2Available()) return false; - - double amount = ElectricItem.manager.charge(stack, energyStored, tier, false, false); - - energyStored -= amount; - - return amount > 0; - } - - // << methods for using this adapter - - // backwards compatibility (ignore these) >> - - @Deprecated - public void onUpdateEntity() { - updateEntity(); - } - - @Deprecated - public void onInvalidate() { - invalidate(); - } - - @Deprecated - public void onOnChunkUnload() { - onChunkUnload(); - } - - @Deprecated - public void onReadFromNbt(NBTTagCompound tag) { - readFromNBT(tag); - } - - @Deprecated - public void onWriteToNbt(NBTTagCompound tag) { - writeToNBT(tag); - } - - // << backwards compatibility - - // ****************************** - // *** Methods for use by ic2 *** - // ****************************** - - // energy net interface >> - - @Override - public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction) { - return true; - } - - @Override - public double getOfferedEnergy() { - return Math.min(energyStored, power); - } - - @Override - public void drawEnergy(double amount) { - energyStored -= amount; - } - - @Override - public int getSourceTier() { - return tier; - } - - // << energy net interface - - - public final TileEntity parent; - - protected double capacity; - protected int tier; - protected double power; - protected double energyStored; - protected boolean addedToEnet; -} diff --git a/src/api/java/ic2/api/energy/prefab/package-info.class b/src/api/java/ic2/api/energy/prefab/package-info.class deleted file mode 100644 index 52651b15a..000000000 Binary files a/src/api/java/ic2/api/energy/prefab/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/prefab/package-info.java b/src/api/java/ic2/api/energy/prefab/package-info.java deleted file mode 100644 index c38f7e0e6..000000000 --- a/src/api/java/ic2/api/energy/prefab/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.energy.prefab; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/ic2/api/energy/tile/IEnergyAcceptor.class b/src/api/java/ic2/api/energy/tile/IEnergyAcceptor.class deleted file mode 100644 index ddc8f3af2..000000000 Binary files a/src/api/java/ic2/api/energy/tile/IEnergyAcceptor.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/tile/IEnergyAcceptor.java b/src/api/java/ic2/api/energy/tile/IEnergyAcceptor.java deleted file mode 100644 index 1735ff5e4..000000000 --- a/src/api/java/ic2/api/energy/tile/IEnergyAcceptor.java +++ /dev/null @@ -1,27 +0,0 @@ -package ic2.api.energy.tile; - -import net.minecraft.tileentity.TileEntity; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * For internal/multi-block usage only. - * - * @see IEnergySink - * @see IEnergyConductor - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public interface IEnergyAcceptor extends IEnergyTile { - /** - * Determine if this acceptor can accept current from an adjacent emitter in a direction. - * - * The TileEntity in the emitter parameter is what was originally added to the energy net, - * which may be normal in-world TileEntity, a delegate or an IMetaDelegate. - * - * @param emitter energy emitter, may also be null or an IMetaDelegate - * @param direction direction the energy is being received from - */ - boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction); -} - diff --git a/src/api/java/ic2/api/energy/tile/IEnergyConductor.class b/src/api/java/ic2/api/energy/tile/IEnergyConductor.class deleted file mode 100644 index 4b2c8f5af..000000000 Binary files a/src/api/java/ic2/api/energy/tile/IEnergyConductor.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/tile/IEnergyConductor.java b/src/api/java/ic2/api/energy/tile/IEnergyConductor.java deleted file mode 100644 index 08dab8896..000000000 --- a/src/api/java/ic2/api/energy/tile/IEnergyConductor.java +++ /dev/null @@ -1,53 +0,0 @@ -package ic2.api.energy.tile; - -/** - * Tile entities which conduct energy pulses without buffering (mostly cables) have to implement this - * interface. - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public interface IEnergyConductor extends IEnergyAcceptor, IEnergyEmitter { - /** - * Energy loss for the conductor in EU per block. - * - * @return Energy loss - */ - double getConductionLoss(); - - /** - * Amount of energy the insulation will handle before shocking nearby players and mobs. - * - * @return Insulation energy absorption in EU - */ - double getInsulationEnergyAbsorption(); - - /** - * Amount of energy the insulation will handle before it is destroyed. - * Ensure that this value is greater than the insulation energy absorption + 64. - * - * @return Insulation-destroying energy in EU - */ - double getInsulationBreakdownEnergy(); - - /** - * Amount of energy the conductor will handle before it melts. - * - * @return Conductor-destroying energy in EU - */ - double getConductorBreakdownEnergy(); - - /** - * Remove the conductor's insulation if the insulation breakdown energy was exceeded. - * - * @see #getInsulationBreakdownEnergy() - */ - void removeInsulation(); - - /** - * Remove the conductor if the conductor breakdown energy was exceeded. - * - * @see #getConductorBreakdownEnergy() - */ - void removeConductor(); -} - diff --git a/src/api/java/ic2/api/energy/tile/IEnergyEmitter.class b/src/api/java/ic2/api/energy/tile/IEnergyEmitter.class deleted file mode 100644 index eab917d66..000000000 Binary files a/src/api/java/ic2/api/energy/tile/IEnergyEmitter.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/tile/IEnergyEmitter.java b/src/api/java/ic2/api/energy/tile/IEnergyEmitter.java deleted file mode 100644 index 013865e31..000000000 --- a/src/api/java/ic2/api/energy/tile/IEnergyEmitter.java +++ /dev/null @@ -1,28 +0,0 @@ -package ic2.api.energy.tile; - -import net.minecraft.tileentity.TileEntity; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * For internal/multi-block usage only. - * - * @see IEnergySource - * @see IEnergyConductor - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public interface IEnergyEmitter extends IEnergyTile { - /** - * Determine if this emitter can emit energy to an adjacent receiver. - * - * The TileEntity in the receiver parameter is what was originally added to the energy net, - * which may be normal in-world TileEntity, a delegate or an IMetaDelegate. - * - * @param receiver receiver, may also be null or an IMetaDelegate - * @param direction direction the receiver is from the emitter - * @return Whether energy should be emitted - */ - boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction); -} - diff --git a/src/api/java/ic2/api/energy/tile/IEnergySink.class b/src/api/java/ic2/api/energy/tile/IEnergySink.class deleted file mode 100644 index bcb05cee7..000000000 Binary files a/src/api/java/ic2/api/energy/tile/IEnergySink.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/tile/IEnergySink.java b/src/api/java/ic2/api/energy/tile/IEnergySink.java deleted file mode 100644 index 4ae8e7954..000000000 --- a/src/api/java/ic2/api/energy/tile/IEnergySink.java +++ /dev/null @@ -1,45 +0,0 @@ -package ic2.api.energy.tile; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Allows a tile entity (mostly a machine) to receive energy. - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public interface IEnergySink extends IEnergyAcceptor { - /** - * Determine how much energy the sink accepts. - * - * Make sure that injectEnergy() does accepts energy if demandsEnergy() returns anything > 0. - * - * @note Modifying the energy net from this method is disallowed. - * - * @return max accepted input in eu - */ - double getDemandedEnergy(); - - /** - * Determine the tier of this energy sink. - * 1 = LV, 2 = MV, 3 = HV, 4 = EV etc. - * - * @note Modifying the energy net from this method is disallowed. - * @note Return Integer.MAX_VALUE to allow any voltage. - * - * @return tier of this energy sink - */ - int getSinkTier(); - - /** - * Transfer energy to the sink. - * - * It's highly recommended to accept all energy by letting the internal buffer overflow to - * increase the performance and accuracy of the distribution simulation. - * - * @param directionFrom direction from which the energy comes from - * @param amount energy to be transferred - * @return Energy not consumed (leftover) - */ - double injectEnergy(ForgeDirection directionFrom, double amount, double voltage); -} - diff --git a/src/api/java/ic2/api/energy/tile/IEnergySource.class b/src/api/java/ic2/api/energy/tile/IEnergySource.class deleted file mode 100644 index 41ca6cff4..000000000 Binary files a/src/api/java/ic2/api/energy/tile/IEnergySource.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/tile/IEnergySource.java b/src/api/java/ic2/api/energy/tile/IEnergySource.java deleted file mode 100644 index 44b952a56..000000000 --- a/src/api/java/ic2/api/energy/tile/IEnergySource.java +++ /dev/null @@ -1,38 +0,0 @@ -package ic2.api.energy.tile; - -/** - * Allows a tile entity (mostly a generator) to emit energy. - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public interface IEnergySource extends IEnergyEmitter { - /** - * Energy output provided by the source this tick. - * This is typically Math.min(stored energy, max output/tick). - * - * @note Modifying the energy net from this method is disallowed. - * - * @return Energy offered this tick - */ - double getOfferedEnergy(); - - /** - * Draw energy from this source's buffer. - * - * If the source doesn't have a buffer, this is a no-op. - * - * @param amount amount of EU to draw, may be negative - */ - void drawEnergy(double amount); - - /** - * Determine the tier of this energy source. - * 1 = LV, 2 = MV, 3 = HV, 4 = EV etc. - * - * @note Modifying the energy net from this method is disallowed. - * - * @return tier of this energy source - */ - int getSourceTier(); -} - diff --git a/src/api/java/ic2/api/energy/tile/IEnergyTile.class b/src/api/java/ic2/api/energy/tile/IEnergyTile.class deleted file mode 100644 index 087633b0f..000000000 Binary files a/src/api/java/ic2/api/energy/tile/IEnergyTile.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/tile/IEnergyTile.java b/src/api/java/ic2/api/energy/tile/IEnergyTile.java deleted file mode 100644 index 3938190a4..000000000 --- a/src/api/java/ic2/api/energy/tile/IEnergyTile.java +++ /dev/null @@ -1,15 +0,0 @@ -package ic2.api.energy.tile; - -/** - * For internal usage only, base class for all energy tiles. - * - * @see IEnergySink - * @see IEnergySource - * @see IEnergyConductor - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public interface IEnergyTile { - // -} - diff --git a/src/api/java/ic2/api/energy/tile/IHeatSource.class b/src/api/java/ic2/api/energy/tile/IHeatSource.class deleted file mode 100644 index 4b24af949..000000000 Binary files a/src/api/java/ic2/api/energy/tile/IHeatSource.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/tile/IHeatSource.java b/src/api/java/ic2/api/energy/tile/IHeatSource.java deleted file mode 100644 index 2e5db4111..000000000 --- a/src/api/java/ic2/api/energy/tile/IHeatSource.java +++ /dev/null @@ -1,23 +0,0 @@ -package ic2.api.energy.tile; - -import net.minecraftforge.common.util.ForgeDirection; - -public interface IHeatSource { - - /* - * Return max heat transmission peer Tick (only theoretical bandwidth not available amount) - */ - int maxrequestHeatTick(ForgeDirection directionFrom); - - /* - * @param requested amount of heat to transfer - * - * @return transmitted amount of heat - * - * example: You Request 100 units of heat but the Source have only 50 units left - * - * requestHeat(100) : return 50 : so 50 units of heat remove from HeatSource - */ - - int requestHeat(ForgeDirection directionFrom, int requestheat); -} diff --git a/src/api/java/ic2/api/energy/tile/IKineticSource.class b/src/api/java/ic2/api/energy/tile/IKineticSource.class deleted file mode 100644 index 225191cc3..000000000 Binary files a/src/api/java/ic2/api/energy/tile/IKineticSource.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/tile/IKineticSource.java b/src/api/java/ic2/api/energy/tile/IKineticSource.java deleted file mode 100644 index a65140876..000000000 --- a/src/api/java/ic2/api/energy/tile/IKineticSource.java +++ /dev/null @@ -1,22 +0,0 @@ -package ic2.api.energy.tile; - -import net.minecraftforge.common.util.ForgeDirection; - -public interface IKineticSource { - /* - * Return max kinetic energy transmission peer Tick (only theoretical bandwidth not available amount) - */ - int maxrequestkineticenergyTick(ForgeDirection directionFrom); - - /* - * @param requested amount of kinetic energy to transfer - * - * @return transmitted amount of kineticenergy - * - * example: You Request 100 units of kinetic energy but the Source have only 50 units left - * - * requestkineticenergy(100) : return 50 : so 50 units of kinetic energy remove from KineticSource - */ - - int requestkineticenergy(ForgeDirection directionFrom, int requestkineticenergy); -} diff --git a/src/api/java/ic2/api/energy/tile/IMetaDelegate.class b/src/api/java/ic2/api/energy/tile/IMetaDelegate.class deleted file mode 100644 index 98228465c..000000000 Binary files a/src/api/java/ic2/api/energy/tile/IMetaDelegate.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/tile/IMetaDelegate.java b/src/api/java/ic2/api/energy/tile/IMetaDelegate.java deleted file mode 100644 index f7319d0e1..000000000 --- a/src/api/java/ic2/api/energy/tile/IMetaDelegate.java +++ /dev/null @@ -1,36 +0,0 @@ -package ic2.api.energy.tile; - -import java.util.List; - -import net.minecraft.tileentity.TileEntity; - -/** - * Interface for grouping multi-block structures to a single energy net delegate. - * - * The energy net uses TileEntity to refer to a specific xyz+world position. If multiple of those - * positions should belong to the same functional structure, i.e. they consume or produce energy - * only once for the whole multi-block instead of once per every single block, this interface - * allows to do so. - * - * The tile entity implementing IMetaDelegate has to be added/removed to/from the energy net - * instead of every single sub-TileEntity. The energy net interaction will be handled by the - * IMetaDelegate TileEntity as well. - * - * The sub tile array TileEntity[] just provides optional connectivity (IEnergyAcceptor, - * IEnergyEmitter) and mandatory position (x, y, z, World) data. - * If the connectivity data on the sub tile is missing, the meta delegate is queried instead. - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public interface IMetaDelegate extends IEnergyTile { - /** - * Get the sub-TileEntities belonging to this Meta TileEntity. - * - * @note The list has to be consistent between the EnergyNet Load and Unload events. - * @note The list must have at least 1 element. - * @note The parent te implementing IMetaDelegate isn't automatically included. - * - * @return sub-TileEntity array - */ - List getSubTiles(); -} diff --git a/src/api/java/ic2/api/energy/tile/package-info.class b/src/api/java/ic2/api/energy/tile/package-info.class deleted file mode 100644 index fdee4a772..000000000 Binary files a/src/api/java/ic2/api/energy/tile/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/tile/package-info.java b/src/api/java/ic2/api/energy/tile/package-info.java deleted file mode 100644 index 3c60323ae..000000000 --- a/src/api/java/ic2/api/energy/tile/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.energy.tile; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/ic2/api/energy/usage.txt b/src/api/java/ic2/api/energy/usage.txt deleted file mode 100644 index 49bd9955e..000000000 --- a/src/api/java/ic2/api/energy/usage.txt +++ /dev/null @@ -1,144 +0,0 @@ --------------------------------- --- Energy Network Description -- --------------------------------- - -There are currently three different types of energy network blocks: -- energy sources, e.g. generators or the output side of a storage block/transformer -- energy sinks, e.g. machines or the input side of a storage block/transformer -- conductors, e.g. cables - -Note that storage blocks or transformers are both sources and sinks. - -All those blocks have to have a tile entity which has to implement the interface corresponding to -its function and also post events to the Forge event bus. - -The energy generation, distribution and consumption is strictly limited to the simulating (server) -side, use the proper side checks before posting the related events. One possibility is to check for -FMLCommonHandler.instance().getEffectiveSide().isClient() being false. - -The energy network works by calculating the energy flow between the sources which offer energy -through getOfferedEnergy() and the sinks which request energy through demandedEnergyUnits(). -Conductors will carry the energy over a distance. Once the energy distribution is calculated, the -energy net will update the sources and sinks through drawEnergy() and injectEnergyUnits() respectively. - - ---------------------------- --- Energy Network Events -- ---------------------------- - -The energy network currently requires 2 events to manage its internal representation of the grids: - --- EnergyTileLoadEvent -- - -For all energy network tiles (sources, sinks, conductors) you have to post an EnergyTileLoadEvent. - -The event has to be posted as soon as the implementing tile entity is fully loaded, usually after -loading the chunk which contains it or after the user placing the block. - -The energy net implementation will use the event to add it to its energy grid map, taking it into -account for further energy transfers. - -You can detect the loading by either using the 1st iteration of updateEntity() or by waiting for -the next world tick after TileEntity.validate(). The 2nd approach is obviously more sophisticated -and requires to use some tick queuing mechanism. - -The event can by posted as following: - MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); - --- EnergyTileUnloadEvent -- - -Another event every energy tile has to post is the EnergyTileUnloadEvent. - -The event has to be posted as soon as the implementing tile entity is being unloaded, either by -unloading the containing chunk or by destroying the block containing it. - -It's possible to detect the unloading by triggering on both the beginning of -TileEntity.invalidate() and the beginning of TileEntity.onChunkUnload(). - -It is important that the tile entity is still properly linked to the world while posting the unload -event, otherwise the energy net can't find all affected connections. - - --------------------------------------- --- Participating Block Requirements -- --------------------------------------- - -The energy net blocks have to do the following to work properly: - --- energy source -- - -An energy source has to post the following events: - - EnergyTileLoadEvent on load - - EnergyTileUnloadEvent on unload - -Additionally the interface IEnergySource has to be implemented. - --- energy sink -- - -An energy sink has to post the following events: - - EnergyTileLoadEvent on load - - EnergyTileUnloadEvent on unload - -Additionally the interface IEnergySink has to be implemented. - --- energy conductor -- - -An energy conductor has to post the following events: - - EnergyTileLoadEvent on load - - EnergyTileUnloadEvent on unload - -Additionally the interface IEnergyConductor has to be implemented. - - ------------------------------- --- Energy Network Delegates -- ------------------------------- - -A delegate is a separate object which performs tasks for the original object, in this case handling -the energy net interaction. - -The TileEntity instances used by the events don't have to be the same as the in-world TileEntity -instance for the corresponding position, it can be delegated to a separate TileEntity instance. -This separate instance (delegate) needs to have its world and xyz coordinate fields set to match -the in-world instance. The delegate implements the energy net interfaces and is added and removed -to/from the energy net through EnergyTileLoadEvent and EnergyTileUnloadEvent. - -Separating the interfaces through a delegate allows to isolate the IC2 API usage into separate -classes an potentially share common code like an input buffer with battery discharging outside the -class hierarchy. -It's even possible to use an ic2 energy net delegate alongside an in-world TileEntity which isn't -designed to work with ic2 energy at all, like making a furnace electric by receiving energy through -a delegate and adding the corresponding fuel amount to the in-world furnace TileEntity. - -Getting the in-world TileEntity for a delegate involves calling World.getBlockTileEntity() with the -delegate's world and xyz coordinate information. - - ------------------- --- Multi Blocks -- ------------------- - -Multi blocks are a group of blocks which act as one functional entity. - -The IMetaDelegate interface groups multiple TileEntity instances (=sub tiles) representing the -individual blocks to a single Energy Net relevant node. The sub tiles may be normal in-world or -delegate TileEntity instances. - -The meta delegate is added to energy net once for the whole multi block structure and implements -the energy net interfaces as well. The sub tiles may optionally implement IEnergyEmitter and/or -IEnergyAcceptor to specify their connectivity rules independently, otherwise the meta delegate will -be queried. - - --------------------------------------------------- --- How to implement/add your own energy network -- --------------------------------------------------- - -If you want to create an alternative way of distributing energy, e.g. to have different -distribution rules or to use energy networks provided by other mods, you can register to the energy -tile events and use the interfaces to handle the energy distribution yourself. It's no longer -required to use conversion blocks. - -IC2's EnergyNet itself is built on top of the api events and interfaces, providing their default -use case. - diff --git a/src/api/java/ic2/api/event/ExplosionEvent.class b/src/api/java/ic2/api/event/ExplosionEvent.class deleted file mode 100644 index 68a268d87..000000000 Binary files a/src/api/java/ic2/api/event/ExplosionEvent.class and /dev/null differ diff --git a/src/api/java/ic2/api/event/ExplosionEvent.java b/src/api/java/ic2/api/event/ExplosionEvent.java deleted file mode 100644 index c2df41952..000000000 --- a/src/api/java/ic2/api/event/ExplosionEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -package ic2.api.event; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.world.World; - -import cpw.mods.fml.common.eventhandler.Cancelable; - -import net.minecraftforge.event.world.WorldEvent; - -@Cancelable -public class ExplosionEvent extends WorldEvent { - public ExplosionEvent(World world, Entity entity, - double x, double y, double z, - double power, - EntityLivingBase igniter, - int radiationRange, double rangeLimit) { - super(world); - - this.entity = entity; - this.x = x; - this.y = y; - this.z = z; - this.power = power; - this.igniter = igniter; - this.radiationRange = radiationRange; - this.rangeLimit = rangeLimit; - } - - /** - * Entity representing the explosive, may be null. - */ - public final Entity entity; - public double x; - public double y; - public double z; - public double power; - /** - * Entity causing the explosion, may be null. - */ - public final EntityLivingBase igniter; - public final int radiationRange; - public final double rangeLimit; -} diff --git a/src/api/java/ic2/api/event/LaserEvent$LaserExplodesEvent.class b/src/api/java/ic2/api/event/LaserEvent$LaserExplodesEvent.class deleted file mode 100644 index 27664e99d..000000000 Binary files a/src/api/java/ic2/api/event/LaserEvent$LaserExplodesEvent.class and /dev/null differ diff --git a/src/api/java/ic2/api/event/LaserEvent$LaserHitsBlockEvent.class b/src/api/java/ic2/api/event/LaserEvent$LaserHitsBlockEvent.class deleted file mode 100644 index a41b7f28b..000000000 Binary files a/src/api/java/ic2/api/event/LaserEvent$LaserHitsBlockEvent.class and /dev/null differ diff --git a/src/api/java/ic2/api/event/LaserEvent$LaserHitsEntityEvent.class b/src/api/java/ic2/api/event/LaserEvent$LaserHitsEntityEvent.class deleted file mode 100644 index 627a8ea49..000000000 Binary files a/src/api/java/ic2/api/event/LaserEvent$LaserHitsEntityEvent.class and /dev/null differ diff --git a/src/api/java/ic2/api/event/LaserEvent$LaserShootEvent.class b/src/api/java/ic2/api/event/LaserEvent$LaserShootEvent.class deleted file mode 100644 index 368dc061c..000000000 Binary files a/src/api/java/ic2/api/event/LaserEvent$LaserShootEvent.class and /dev/null differ diff --git a/src/api/java/ic2/api/event/LaserEvent.class b/src/api/java/ic2/api/event/LaserEvent.class deleted file mode 100644 index fa1a1b08e..000000000 Binary files a/src/api/java/ic2/api/event/LaserEvent.class and /dev/null differ diff --git a/src/api/java/ic2/api/event/LaserEvent.java b/src/api/java/ic2/api/event/LaserEvent.java deleted file mode 100644 index 6d5ea2804..000000000 --- a/src/api/java/ic2/api/event/LaserEvent.java +++ /dev/null @@ -1,114 +0,0 @@ -package ic2.api.event; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import cpw.mods.fml.common.eventhandler.Cancelable; - -import net.minecraftforge.event.world.WorldEvent; - -/** - * A bunch of Events to handle the power of the Mining Laser. - */ -@Cancelable -public class LaserEvent extends WorldEvent { - // the Laser Entity - public final Entity lasershot; - - // the following variables can be changed and the Laser will adjust to them - - // the Player firing the Laser. If the Laser gets "reflected" the Player could change. - public EntityLivingBase owner; - // Range of the Laser Shot. Determine the amount of broken blocks, as well, as each broken block will subtract ~1F from range. - public float range, power; - public int blockBreaks; - // Determines whether the laser will explode upon hitting something - public boolean explosive, smelt; - - public LaserEvent(World world1, Entity lasershot1, EntityLivingBase owner1, float range1, float power1, int blockBreaks1, boolean explosive1, boolean smelt1) { - super(world1); - this.lasershot = lasershot1; - this.owner = owner1; - this.range = range1; - this.power = power1; - this.blockBreaks = blockBreaks1; - this.explosive = explosive1; - this.smelt = smelt1; - } - - /** - * Event when the Laser is getting shot by a Player. - * - * The Item is the Laser Gun which the "Player" has shot - */ - public static class LaserShootEvent extends LaserEvent { - ItemStack laseritem; - - public LaserShootEvent(World world1, Entity lasershot1, EntityLivingBase owner1, float range1, float power1, int blockBreaks1, boolean explosive1, boolean smelt1, ItemStack laseritem1) { - super(world1, lasershot1, owner1, range1, power1, blockBreaks1, explosive1, smelt1); - this.laseritem = laseritem1; - } - } - - /** - * Event when the Laser is exploding for some Reason. - * - * The Laser will no longer exist after this Event is posted as it either Explodes or despawns after the Event is fired. - */ - public static class LaserExplodesEvent extends LaserEvent { - // explosion strength, even that can be changed! - public float explosionpower, explosiondroprate, explosionentitydamage; - - public LaserExplodesEvent(World world1, Entity lasershot1, EntityLivingBase owner1, float range1, float power1, int blockBreaks1, boolean explosive1, boolean smelt1, float explosionpower1, float explosiondroprate1, float explosionentitydamage1) { - super(world1, lasershot1, owner1, range1, power1, blockBreaks1, explosive1, smelt1); - this.explosionpower = explosionpower1; - this.explosiondroprate = explosiondroprate1; - this.explosionentitydamage = explosionentitydamage1; - } - } - - /** - * Event when the Laser is hitting a Block - * x, y and z are the Coords of the Block. - * - * Canceling this Event stops the Laser from attempting to break the Block, what is very useful for Glass. - * Use lasershot.setDead() to remove the Shot entirely. - */ - public static class LaserHitsBlockEvent extends LaserEvent { - // targeted block, even that can be changed! - public int x, y, z; - public int side; - // removeBlock determines if the Block will be removed. dropBlock determines if the Block should drop something. - public boolean removeBlock, dropBlock; - public float dropChance; - - public LaserHitsBlockEvent(World world1, Entity lasershot1, EntityLivingBase owner1, float range1, float power1, int blockBreaks1, boolean explosive1, boolean smelt1, int x1, int y1, int z1, int side1, float dropChance1, boolean removeBlock1, boolean dropBlock1) { - super(world1, lasershot1, owner1, range1, power1, blockBreaks1, explosive1, smelt1); - this.x = x1; - this.y = y1; - this.z = z1; - this.side = side1; - this.removeBlock = removeBlock1; - this.dropBlock = dropBlock1; - this.dropChance = dropChance1; - } - } - - /** - * Event when the Laser is getting at a Living Entity - * - * Canceling this Event ignores the Entity - * Use lasershot.setDead() to remove the Shot entirely. - */ - public static class LaserHitsEntityEvent extends LaserEvent { - // the Entity which the Laser has shot at, even the target can be changed! - public Entity hitentity; - - public LaserHitsEntityEvent(World world1, Entity lasershot1, EntityLivingBase owner1, float range1, float power1, int blockBreaks1, boolean explosive1, boolean smelt1, Entity hitentity1) { - super(world1, lasershot1, owner1, range1, power1, blockBreaks1, explosive1, smelt1); - this.hitentity = hitentity1; - } - } -} diff --git a/src/api/java/ic2/api/event/PaintEvent.class b/src/api/java/ic2/api/event/PaintEvent.class deleted file mode 100644 index 0a4c1aab4..000000000 Binary files a/src/api/java/ic2/api/event/PaintEvent.class and /dev/null differ diff --git a/src/api/java/ic2/api/event/PaintEvent.java b/src/api/java/ic2/api/event/PaintEvent.java deleted file mode 100644 index c6565c229..000000000 --- a/src/api/java/ic2/api/event/PaintEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -package ic2.api.event; - -import net.minecraft.world.World; - -import cpw.mods.fml.common.eventhandler.Cancelable; - -import net.minecraftforge.event.world.WorldEvent; - -@Cancelable -public class PaintEvent extends WorldEvent { - // target block - public final int x; - public final int y; - public final int z; - public final int side; - - // color to paint the block - public final int color; - - // set to true to confirm the operation - public boolean painted = false; - - public PaintEvent(World world1, int x1, int y1, int z1, int side1, int color1) { - super(world1); - - this.x = x1; - this.y = y1; - this.z = z1; - this.side = side1; - this.color = color1; - } -} diff --git a/src/api/java/ic2/api/event/RetextureEvent.class b/src/api/java/ic2/api/event/RetextureEvent.class deleted file mode 100644 index e3df863a4..000000000 Binary files a/src/api/java/ic2/api/event/RetextureEvent.class and /dev/null differ diff --git a/src/api/java/ic2/api/event/RetextureEvent.java b/src/api/java/ic2/api/event/RetextureEvent.java deleted file mode 100644 index d530578c8..000000000 --- a/src/api/java/ic2/api/event/RetextureEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -package ic2.api.event; - -import net.minecraft.block.Block; -import net.minecraft.world.World; - -import cpw.mods.fml.common.eventhandler.Cancelable; - -import net.minecraftforge.event.world.WorldEvent; - -@Cancelable -public class RetextureEvent extends WorldEvent { - // target block - public final int x; - public final int y; - public final int z; - public final int side; - - // referenced block (to grab the texture from) - public final Block referencedBlock; - public final int referencedMeta; - public final int referencedSide; - - // set to true to confirm the operation - public boolean applied = false; - - public RetextureEvent(World world1, int x1, int y1, int z1, int side1, Block referencedBlock, int referencedMeta1, int referencedSide1) { - super(world1); - - this.x = x1; - this.y = y1; - this.z = z1; - this.side = side1; - this.referencedBlock = referencedBlock; - this.referencedMeta = referencedMeta1; - this.referencedSide = referencedSide1; - } -} diff --git a/src/api/java/ic2/api/event/package-info.class b/src/api/java/ic2/api/event/package-info.class deleted file mode 100644 index 718d8f14c..000000000 Binary files a/src/api/java/ic2/api/event/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/event/package-info.java b/src/api/java/ic2/api/event/package-info.java deleted file mode 100644 index d331b924d..000000000 --- a/src/api/java/ic2/api/event/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.event; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/ic2/api/info/IEnergyValueProvider.class b/src/api/java/ic2/api/info/IEnergyValueProvider.class deleted file mode 100644 index abe05e1c2..000000000 Binary files a/src/api/java/ic2/api/info/IEnergyValueProvider.class and /dev/null differ diff --git a/src/api/java/ic2/api/info/IEnergyValueProvider.java b/src/api/java/ic2/api/info/IEnergyValueProvider.java deleted file mode 100644 index 1e7b2cc57..000000000 --- a/src/api/java/ic2/api/info/IEnergyValueProvider.java +++ /dev/null @@ -1,17 +0,0 @@ -package ic2.api.info; - -import net.minecraft.item.ItemStack; - -public interface IEnergyValueProvider { - /** - * Determine the energy value for a single item in the supplied stack. - * The value is used by most machines in the discharge slot. - * - * This only applies to basic single use items, others are to be queried - * through e.g. ElectricItem.manager.getCharge(). - * - * @param itemStack ItemStack containing the item to evaluate. - * @return energy in EU - */ - double getEnergyValue(ItemStack itemStack); -} diff --git a/src/api/java/ic2/api/info/IFuelValueProvider.class b/src/api/java/ic2/api/info/IFuelValueProvider.class deleted file mode 100644 index 57f9f4bfc..000000000 Binary files a/src/api/java/ic2/api/info/IFuelValueProvider.class and /dev/null differ diff --git a/src/api/java/ic2/api/info/IFuelValueProvider.java b/src/api/java/ic2/api/info/IFuelValueProvider.java deleted file mode 100644 index 7c7fe0f4c..000000000 --- a/src/api/java/ic2/api/info/IFuelValueProvider.java +++ /dev/null @@ -1,15 +0,0 @@ -package ic2.api.info; - -import net.minecraft.item.ItemStack; - -public interface IFuelValueProvider { - /** - * Determine the fuel value for a single item in the supplied stack. - * The information currently applies to Generators and the Iron Furnace. - * - * @param itemStack ItemStack containing the item to evaluate. - * @param allowLava Determine if lava has a fuel value, currently only true for the Iron Furnace. - * @return fuel value - */ - int getFuelValue(ItemStack itemStack, boolean allowLava); -} diff --git a/src/api/java/ic2/api/info/Info.class b/src/api/java/ic2/api/info/Info.class deleted file mode 100644 index 7e50751d5..000000000 Binary files a/src/api/java/ic2/api/info/Info.class and /dev/null differ diff --git a/src/api/java/ic2/api/info/Info.java b/src/api/java/ic2/api/info/Info.java deleted file mode 100644 index f8e30ad25..000000000 --- a/src/api/java/ic2/api/info/Info.java +++ /dev/null @@ -1,39 +0,0 @@ -package ic2.api.info; - -import net.minecraft.potion.Potion; -import net.minecraft.util.DamageSource; - -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.LoaderState; - -public class Info { - public static IEnergyValueProvider itemEnergy; - public static IFuelValueProvider itemFuel; - public static Object ic2ModInstance; - - /** - * Damage Sources used by IC2. - * Getting assigned in preload. - */ - public static DamageSource DMG_ELECTRIC, DMG_NUKE_EXPLOSION, DMG_RADIATION; - - /** - * Potions used by IC2. - * Getting assigned in preload. - */ - public static Potion POTION_RADIATION; - - public static boolean isIc2Available() { - if (ic2Available != null) return ic2Available; - - boolean loaded = Loader.isModLoaded("IC2"); - - if (Loader.instance().hasReachedState(LoaderState.CONSTRUCTING)) { - ic2Available = loaded; - } - - return loaded; - } - - private static Boolean ic2Available = null; -} \ No newline at end of file diff --git a/src/api/java/ic2/api/info/package-info.class b/src/api/java/ic2/api/info/package-info.class deleted file mode 100644 index 96b88b7d9..000000000 Binary files a/src/api/java/ic2/api/info/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/info/package-info.java b/src/api/java/ic2/api/info/package-info.java deleted file mode 100644 index 59936e5e6..000000000 --- a/src/api/java/ic2/api/info/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.info; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/ic2/api/item/ElectricItem.class b/src/api/java/ic2/api/item/ElectricItem.class deleted file mode 100644 index ad45f925c..000000000 Binary files a/src/api/java/ic2/api/item/ElectricItem.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/ElectricItem.java b/src/api/java/ic2/api/item/ElectricItem.java deleted file mode 100644 index 19e5fc1b9..000000000 --- a/src/api/java/ic2/api/item/ElectricItem.java +++ /dev/null @@ -1,59 +0,0 @@ -package ic2.api.item; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.item.ItemStack; - -/** - * Allows for charging, discharging and using electric items (IElectricItem). - */ -public final class ElectricItem { - /** - * IElectricItemManager to use for interacting with IElectricItem ItemStacks. - * - * This manager will act as a gateway and delegate the tasks to the final implementation - * (rawManager or a custom one) as necessary. - */ - public static IElectricItemManager manager; - - /** - * Standard IElectricItemManager implementation, only call it directly from another - * IElectricItemManager. Use manager instead. - */ - public static IElectricItemManager rawManager; - - /** - * Register an electric item manager for items not implementing IElectricItem. - * - * This method is only designed for special purposes, implementing IElectricItem or - * ISpecialElectricItem instead of using this is faster. - * - * Managers used with ISpecialElectricItem shouldn't be registered. - * - * @param manager Manager to register. - */ - public static void registerBackupManager(IBackupElectricItemManager manager) { - backupManagers.add(manager); - } - - /** - * Get the electric item manager suitable for the supplied item stack. - * - * This method is for internal use only. - * - * @param stack ItemStack to be handled. - * @return First suitable electric item manager. - */ - public static IBackupElectricItemManager getBackupManager(ItemStack stack) { - for (IBackupElectricItemManager manager : backupManagers) { - if (manager.handles(stack)) return manager; - } - - return null; - } - - - private static final List backupManagers = new ArrayList(); -} - diff --git a/src/api/java/ic2/api/item/IBackupElectricItemManager.class b/src/api/java/ic2/api/item/IBackupElectricItemManager.class deleted file mode 100644 index fc7f1ad23..000000000 Binary files a/src/api/java/ic2/api/item/IBackupElectricItemManager.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/IBackupElectricItemManager.java b/src/api/java/ic2/api/item/IBackupElectricItemManager.java deleted file mode 100644 index 2ae254acd..000000000 --- a/src/api/java/ic2/api/item/IBackupElectricItemManager.java +++ /dev/null @@ -1,12 +0,0 @@ -package ic2.api.item; - -import net.minecraft.item.ItemStack; - -/** - * This interface specifies a manager applicable to items not implementing IElectricItem. - * - * The manager implementing this has to be registered with ElectricItem.registerBackupManager(). - */ -public interface IBackupElectricItemManager extends IElectricItemManager { - boolean handles(ItemStack stack); -} diff --git a/src/api/java/ic2/api/item/IBlockCuttingBlade.class b/src/api/java/ic2/api/item/IBlockCuttingBlade.class deleted file mode 100644 index 8654649e7..000000000 Binary files a/src/api/java/ic2/api/item/IBlockCuttingBlade.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/IBlockCuttingBlade.java b/src/api/java/ic2/api/item/IBlockCuttingBlade.java deleted file mode 100644 index 24a8f00d4..000000000 --- a/src/api/java/ic2/api/item/IBlockCuttingBlade.java +++ /dev/null @@ -1,6 +0,0 @@ -package ic2.api.item; - - -public interface IBlockCuttingBlade { - int gethardness(); -} diff --git a/src/api/java/ic2/api/item/IBoxable.class b/src/api/java/ic2/api/item/IBoxable.class deleted file mode 100644 index e28c75435..000000000 Binary files a/src/api/java/ic2/api/item/IBoxable.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/IBoxable.java b/src/api/java/ic2/api/item/IBoxable.java deleted file mode 100644 index bca2cc0dc..000000000 --- a/src/api/java/ic2/api/item/IBoxable.java +++ /dev/null @@ -1,14 +0,0 @@ -package ic2.api.item; - -import net.minecraft.item.ItemStack; - - -public interface IBoxable { - /** - * Determine whether an item can be stored in a toolbox or not. - * - * @param itemstack item to be stored - * @return Whether to store the item in the toolbox or not - */ - public abstract boolean canBeStoredInToolbox(ItemStack itemstack); -} diff --git a/src/api/java/ic2/api/item/IC2Items.class b/src/api/java/ic2/api/item/IC2Items.class deleted file mode 100644 index 609995182..000000000 Binary files a/src/api/java/ic2/api/item/IC2Items.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/IC2Items.java b/src/api/java/ic2/api/item/IC2Items.java deleted file mode 100644 index 9b8c7df3a..000000000 --- a/src/api/java/ic2/api/item/IC2Items.java +++ /dev/null @@ -1,598 +0,0 @@ -package ic2.api.item; - -import net.minecraft.item.ItemStack; - -/** - * Provides access to IC2 blocks and items. - * - * Some items can be acquired through the ore dictionary which is the recommended way. - * The items are initialized while IC2 is being loaded - try to use ModsLoaded() or load your mod after IC2. - * Some blocks/items can be disabled by a config setting, so it's recommended to check if they're null first. - * - * Getting the associated Block/Item for an ItemStack x: - * Blocks: Block.blocksList[x.itemID] - * Items: x.getItem() - */ -public final class IC2Items { - /** - * Get an ItemStack for a specific item name, example: Items.getItem("resin") - * See the list below for item names. - * Make sure to copy() the ItemStack if you want to modify it. - * - * @param name item name - * @return The item or null if the item does not exist or an error occurred - */ - public static ItemStack getItem(String name) { - try { - if (Ic2Items == null) Ic2Items = Class.forName(getPackage() + ".core.Ic2Items"); - - Object ret = Ic2Items.getField(name).get(null); - - if (ret instanceof ItemStack) { - return (ItemStack) ret; - } - return null; - } catch (Exception e) { - System.out.println("IC2 API: Call getItem failed for "+name); - - return null; - } - } - - /* Possible values: - - // ores - copperOre; // Copper Ore block, currently not meta sensitive, meta in ItemStack set to 0, ore dictionary: oreCopper, null with enableWorldGenOreCopper = false - tinOre; // Tin Ore block, currently not meta sensitive, meta in ItemStack set to 0, ore dictionary: oreTin, null with enableWorldGenOreTin = false - uraniumOre; // Tin Ore block, currently not meta sensitive, meta in ItemStack set to 0, ore dictionary: oreUranium, null with enableWorldGenOreUranium = false - leadOre; // Lead Ore Block, currently not meta sensitive, meta in ItemStack set to 0, ore dictionary: oreLead, null with enableWorldGenOreLead = false - - // rubber related - - Rubber wood block, meta reflects the state, meta in ItemStack set to 0, ore dictionary: woodRubber (with meta 0), null with enableWorldGenTreeRubber = false - dropped (as an item) -> metadata 0 - block, no resin spot -> metadata 0 or 1 - block, wet resin spot -> metadata 2-5 (according to the side) - block, dry resin spot -> metadata 8-11 (wet state + 6) - - rubberWood; - rubberLeaves; // Rubber Leaves block, currently not meta sensitive, meta in ItemStack set to 0, null with enableWorldGenTreeRubber = false - rubberSapling; // Rubber Sapling block, currently not meta sensitive, meta in ItemStack set to 0, null with enableWorldGenTreeRubber = false - resinSheet; // Resin Sheet block, currently not meta sensitive - rubberTrampoline; // Rubber Trampoline block, meta reflects internal state, meta in ItemStack set to 0 - - // building/storage - ironFence; // Iron Fence block, currently not meta sensitive - - reinforcedStone; // Reinforced Stone block, currently not meta sensitive - reinforcedGlass; // Reinforced Glass block, currently not meta sensitive - reinforcedDoorBlock; // Reinforced Door block, meta reflects the state (see vanilla doors), meta in ItemStack set to 0 - - constructionreinforcedFoam; // Construction Reinforced Foam block, currently not meta sensitive - constructionFoam; // Construction Foam block, currently not meta sensitive - constructionFoamWall; // Construction Foam Wall block, meta = color, implements IPaintableBlock - scaffold; // Scaffold block, meta reflects internal physical model data - ironScaffold; // Scaffold block, meta reflects internal physical model data - - bronzeBlock; // Bronze block, meta sensitive - copperBlock; // Copper block, meta sensitive - tinBlock; // Tin block, meta sensitive - uraniumBlock; // Uranium block, meta sensitive - leadBlock; // Uranium block, meta sensitive - - // cables (when placed as a block, inventory items are different; TE implements IEnergyConductor) - - copperCableBlock; // Copper Cable block, meta sensitive - insulatedCopperCableBlock; // Insulated Copper Cable block, meta sensitive - - goldCableBlock; // Gold Cable block, meta sensitive - insulatedGoldCableBlock; // Insulated Gold Cable block, meta sensitive - doubleInsulatedGoldCableBlock; // Double Insulated Gold Cable block, meta sensitive - - ironCableBlock; // Iron Cable block, meta sensitive - insulatedIronCableBlock; // Insulated Iron Cable block, meta sensitive - doubleInsulatedIronCableBlock; // Double Insulated Iron Cable block, meta sensitive - trippleInsulatedIronCableBlock; // Tripple Insulated Iron Cable block, meta sensitive - - glassFiberCableBlock; // Glass Fiber Cable block, meta sensitive - - tinCableBlock; // Tin Cable block, meta sensitive - insulatedtinCableBlock; // Insulated Tin Cable item, meta sensitive - detectorCableBlock; // Detector Cable block, meta sensitive - splitterCableBlock; // Splitter Cable block, meta sensitive - - // generators + related (TE implements IEnergySource ex. reactorChamber) - - generator; // Generator block, meta sensitive - geothermalGenerator; // Geothermal Generator block, meta sensitive - waterMill; // Water Mill block, meta sensitive - solarPanel; // Solar Panel block, meta sensitive - windMill; // Wind Mill block, meta sensitive - nuclearReactor; // Nuclear Reactor block, meta sensitive - reactorChamber; // Reactor Chamber block, currently not meta sensitive - RTGenerator; // Radioisotope Thermoelectric Generator block, meta sensitive - semifluidGenerator; // Semifluid Generator block, meta sensitive - - - // energy storages (TE implements IEnergySource and IEnergyConductor) - - batBox; // BatBox block, meta sensitive - cesuUnit; // CESU Unit block, meta sensitive - mfeUnit; // MFE Unit block, meta sensitive - mfsUnit; // MFS Unit block, meta sensitive - - // transformers (TE implements IEnergySource and IEnergyConductor) - - lvTransformer; // LV Transformer block, meta sensitive - mvTransformer; // MV Transformer block, meta sensitive - hvTransformer; // HV Transformer block, meta sensitive - evTransformer; // EV Transformer block, meta sensitive - - // machines + related (TE implements IEnergySink ex. machine, miningPipe, miningPipeTip) - - machine; // Machine block, meta sensitive - advancedMachine; // Advanced Machine block, meta sensitive - - ironFurnace; // Iron Furnace block, meta sensitive - electroFurnace; // Electro Furnace block, meta sensitive - macerator; // Macerator block, meta sensitive - extractor; // Extractor block, meta sensitive - compressor; // Compressor block, meta sensitive - canner; // Canner block, meta sensitive - miner; // Miner block, meta sensitive - pump; // Pump block, meta sensitive - magnetizer; // Magnetizer block, meta sensitive - electrolyzer; // Electrolyzer block, meta sensitive - recycler; // Recycler block, meta sensitive - inductionFurnace; // Induction Furnace block, meta sensitive - massFabricator; // Mass Fabricator block, meta sensitive - terraformer; // Terraformer block, meta sensitive - teleporter; // Teleporter block, meta sensitive - teslaCoil; // Tesla Coil block, meta sensitive - luminator; // Passive (dark) Luminator block, meta = facing - activeLuminator; // Active (bright) Luminator block, meta = facing - centrifuge; // Centrifuge block, meta sensitive - metalformer; // MetalFormer block , meta sensitive - orewashingplant; // Ore Wasching Plant, Meta sensitive - patternstorage; // Pattern Storage, Meta sensitive - scanner; // Scanner, Meta sensitive - replicator; // Replicator, Meta sensitive - - miningPipe; // Mining Pipe block, currently not meta sensitive, meta in ItemStack set to 0 - miningPipeTip; // Mining Pipe Tip block, currently not meta sensitive, meta in ItemStack set to 0 - - - // personal blocks - - personalSafe; // Personal Safe block, meta sensitive - tradeOMat; // Trade-O-Mat block, meta sensitive - energyOMat; // Energy-O-Mat block, meta sensitive - - // explosives - - industrialTnt; // Industrial TNT block, currently not meta sensitive - nuke; // Nuke block, currently not meta sensitive - dynamiteStick; // Dynamite Stick block, meta = placement, meta in ItemStack set to 0 - dynamiteStickWithRemote; // Dynamite Stick with Remote block, meta = placement, meta in ItemStack set to 0 - - // Agriculture Stuff - - crop; // Crop Block, empty, not meta sensitive - cropmatron; // Cropmatron machien block, meta sensititve - - // ----- items ----- - - // rubber + related - resin; // Resin item, currently not meta sensitive - rubber; // Rubber item, currently not meta sensitive, ore dictionary: itemRubber - - FluidCell; - - // Lithium -> Tritium - - reactorLithiumCell; // LithiumCell use in Reaktor, , meta = damage value - TritiumCell; // Tritium, currently not meta sensitive - - // Nuclear Fuel - - UranFuel; // , currently not meta sensitive - MOXFuel; // , currently not meta sensitive - Plutonium; // , currently not meta sensitive - smallPlutonium; // , currently not meta sensitive - Uran235; // , currently not meta sensitive - smallUran235; // , currently not meta sensitive - Uran238; // , currently not meta sensitive - - reactorDepletedUraniumSimple; // Depleted Uranium Cell items, currently not meta sensitive - reactorDepletedUraniumDual; - reactorDepletedUraniumQuad; - reactorDepletedMOXSimple; // Depleted MOX Cell items, currently not meta sensitive - reactorDepletedMOXDual; - reactorDepletedMOXQuad; - reactorMOXSimple; // Depleted MOX Cell items, currently not meta sensitive - reactorMOXDual; - reactorMOXQuad; - RTGPellets; - - - // Recipe Parts - - coil; // Coil, meta sensitive - elemotor; // electric motor, meta sensitive - powerunit; // Item Power Unit, meta sensitive - powerunitsmall; // Item Power Unit, meta sensitive - - - // ItemCasing - - casingcopper; // Copper ItemCasing, meta sensitive - casingtin; // Tin ItemCasing, meta sensitive - casingbronze; // Bronze ItemCasing, meta sensitive - casinggold; // Gold ItemCasing, meta sensitive - casingiron; // Iron ItemCasing, meta sensitive - @Deprecated - casingadviron; // Refined Iron ItemCasing, meta sensitive - casinglead; // Lead ItemCasing, meta sensitive - - // Crushed Ore - crushedIronOre; // Crushed Iron Ore, meta sensitive - crushedCopperOre; // Crushed Copper Ore, meta sensitive - crushedGoldOre; // Crushed Gold Ore, meta sensitive - crushedTinOre; // Crushed Tin Ore, meta sensitive - crushedUraniumOre; // Crushed Uranium Ore, meta sensitive - crushedSilverOre; // Crushed Silver Ore, meta sensitive - crushedLeadOre; // Crushed Lead Ore, meta sensitive - - - //Purify Crushed Ore - purifiedCrushedIronOre; // Purify Crushed Iron Ore, meta sensitive - purifiedCrushedCopperOre; // Purify Crushed Copper Ore, meta sensitive - purifiedCrushedGoldOre; // Purify Crushed Gold Ore, meta sensitive - purifiedCrushedTinOre; // Purify Crushed Tin Ore, meta sensitive - purifiedCrushedUraniumOre; // Purify Crushed Uranium Ore, meta sensitive - purifiedCrushedSilverOre; // Purify Crushed Silver Ore, meta sensitive - purifiedCrushedLeadOre; // Purify Crushed Lead Ore, meta sensitive - - // dusts - stoneDust; - bronzeDust; // Bronze Dust item, meta sensitive, ore dictionary: dustBronze - clayDust; // Clay Dust item, meta sensitive, ore dictionary: dustClay - coalDust; // Coal Dust item, meta sensitive, ore dictionary: dustCoal - copperDust; // Copper Dust item, meta sensitive, ore dictionary: dustCopper - goldDust; // Gold Dust item, meta sensitive, ore dictionary: dustGold - ironDust; // Iron Dust item, meta sensitive, ore dictionary: dustIron - silverDust; // Silver Dust item, meta sensitive, ore dictionary: dustSilver - tinDust; // Tin Dust item, meta sensitive, ore dictionary: dustTin - hydratedCoalDust; // Hydrated Coal Dust item, meta sensitive - leadDust; // Lead Dust item, meta sensitive, ore dictionary: dustLead - obsidianDust; // Obsidian Dust item, meta sensitive, ore dictionary: dustObsidian - lapiDust; // Lapi Dust item, meta sensitive, ore dictionary: dustLapi - sulfurDust; // Sulfur Dust item, meta sensitive, ore dictionary: dustSulfur - lithiumDust; // Lithium dust, meta sensitive, ore dictionary: dustLithium - - // small dusts - - smallIronDust; // Small Iron Dust item, meta sensitive - smallCopperDust; // Small Copper Dust item, meta sensitive - smallGoldDust; // Small Gold Dust item, meta sensitive - smallTinDust; // Small Tin Dust item, meta sensitive - smallSilverDust; // Small Silver Dust item, meta sensitive - smallLeadDust; // Small Lead Dust item, meta sensitive - smallSulfurDust; // Small Sulfur Dust item, meta sensitive - smallLithiumDust; // Small Lithium Dust item, meta sensitive - - - // ingots - @Deprecated - refinedIronIngot; // Refined Iron Ingot item, currently not meta sensitive, ore dictionary: ingotRefinedIron - copperIngot; // Copper Ingot item, currently not meta sensitive, ore dictionary: ingotCopper - tinIngot; // Tin Ingot item, currently not meta sensitive, ore dictionary: ingotTin - bronzeIngot; // Bronze Ingot item, currently not meta sensitive, ore dictionary: ingotBronze - mixedMetalIngot; // Mixed Metal Ingot item, currently not meta sensitive - leadIngot; // Lead Ingot item, currently not meta sensitive - - - // tools/weapons (without electric tools) - treetap; // Treetap item, meta = damage value - wrench; // Wrench item, meta = damage value - cutter; // Insulation Cutter item, meta = damage value - constructionFoamSprayer; // Construction Foam Sprayer item, meta = charges (as of v1.45) - - bronzePickaxe; // Bronze Pickaxe item, meta = damage value - bronzeAxe; // Bronze Axe item, meta = damage value - bronzeSword; // Bronze Sword item, meta = damage value - bronzeShovel; // Bronze Shovel item, meta = damage value - bronzeHoe; // Bronze Hoe item, meta = damage value - - ForgeHammer; // Refine Iron Hammer item, meta = damage value - - // el. tools/devices/weapons - miningDrill; // Mining Drill item, meta = damage value for charge level - diamondDrill; // Diamond Tipped Mining Drill item, meta = damage value for charge level - iridiumDrill; // Iridium Tipped Mining Drill item, meta = damage value for charge level - chainsaw; // Chainsaw item, meta = damage value for charge level - electricWrench; // Electric Wrench item, meta = damage value for charge level - electricTreetap; // Electric Treetap item, meta = damage value for charge level - miningLaser; // Mining Laser item, meta = damage value for charge level - - ecMeter; // EC-Mater item, meta = itemdata db index (as of v1.45) - odScanner; // Ore Density Scanner item, meta = damage value for charge level - ovScanner; // Ore Value Scanner item, meta = damage value for charge level - obscurator; // Obscurator item, meta = damage value for charge level - - frequencyTransmitter; // Frequency Transmitter item, meta = itemdata db index (as of v1.45) - - nanoSaber; // Idle Nano Saber item, meta = damage value for charge level - enabledNanoSaber; // Enabled Nano Saber item, meta = damage value for charge level - - toolbox; // Open/Empty toolbox, meta = Open (0) / Closed (1) - - // armor/wearable - hazmatHelmet; // Hazmat Helmet item, meta = damage value - hazmatChestplate; // Hazmat Chestplate item, meta = damage value - hazmatLeggings; // Hazmat Leggings item, meta = damage value - hazmatBoots; // Hazmat Boots item, meta = damage value - - bronzeHelmet; // Bronze Helmet Armor item, meta = damage value - bronzeChestplate; // Bronze Chestplate Armor item, meta = damage value - bronzeLeggings; // Bronze Leggings Armor item, meta = damage value - bronzeBoots; // Bronze Boots Armor item, meta = damage value - - compositeArmor; // Composite Armor item, meta = damage value for charge level - - nanoHelmet; // Nano Helmet Armor item, meta = damage value for charge level - nanoBodyarmor; // Nano Bodyarmor item, meta = damage value for charge level - nanoLeggings; // Nano Leggings Armor item, meta = damage value for charge level - nanoBoots; // Nano Boots Armor item, meta = damage value for charge level - - quantumHelmet; // Quantum Helmet Armor item, meta = damage value for charge level - quantumBodyarmor; // Quantum Bodyarmor item, meta = damage value for charge level - quantumLeggings; // Quantum Leggings Armor item, meta = damage value for charge level - quantumBoots; // Quantum Boots Armor item, meta = damage value for charge level - - jetpack; // Jetpack item, meta = damage value for fuel level - electricJetpack; // Electric Jetpack item, meta = damage value for charge level - - batPack; // BatPack item, meta = damage value for charge level - advbatPack; // Adv.BatPack item, meta = damage value for charge level - lapPack; // LapPack item, meta = damage value for charge level - energyPack; // EnergyPack item, meta = damage value for charge level - - cfPack; // CF Pack item, meta = charges (as of v1.45) - solarHelmet; // Solar Helmet, currently not meta sensitive - staticBoots; // Static Boots, currently not meta sensitive - nightvisionGoggles; // Nightvision Goggles, meta = damage value for charge level - - // batteries - reBattery; // Empty RE Battery item, currently not meta sensitive - chargedReBattery; // RE Battery item, meta = damage value for charge level - advBattery; // Adv Batteryitem, meta = damage value for charge level - energyCrystal; // Energy Crystal item, meta = damage value for charge level - lapotronCrystal; // Lapotron Crystal item, meta = damage value for charge level - suBattery; // SU Battery item, meta = damage value for charge level - - // cables - copperCableItem; // Copper Cable item, meta sensitive - insulatedCopperCableItem; // Insulated Copper Cable item, meta sensitive - - goldCableItem; // Gold Cable item, meta sensitive - insulatedGoldCableItem; // Insulated Gold Cable item, meta sensitive - - @Deprecated - doubleInsulatedGoldCableItem; // Double Insulated Gold Cable item, meta sensitive - - ironCableItem; // Iron Cable item, meta sensitive - insulatedIronCableItem; // Insulated Iron Cable item, meta sensitive - - @Deprecated - doubleInsulatedIronCableItem; // Double Insulated Iron Cable item, meta sensitive - @Deprecated - trippleInsulatedIronCableItem; // Tripple Insulated Iron Cable item, meta sensitive - insulatedTinCableItem; - glassFiberCableItem; // Glass Fiber Cable item, meta sensitive - tinCableItem; // Tin Cable item, meta sensitive - - - detectorCableItem; // Detector Cable item, meta sensitive - splitterCableItem; // Splitter Cable item, meta sensitive - - // cells/containers (without reactor components) - - cell; // Empty Cell item, meta sensitive - lavaCell; // Lava Cell item, meta sensitive - waterCell; // Water Cell item, meta sensitive - UuMatterCell; // UUMatter Cell item, meta sensitive - CFCell; // constructionFoam Cell item, meta sensitive - - - fuelRod; // Empy Fuel Rod item, currently not meta sensitive - hydratedCoalCell; // Hydrated Coal Cell item, currently not meta sensitive - bioCell; // Bio Cell item, currently not meta sensitive - coalfuelCell; // Coalfuel Cell item, currently not meta sensitive - biofuelCell; // Biofuel Cell item, currently not meta sensitive - electrolyzedWaterCell; // Electrolyzed Water Cell item, currently not meta sensitive - airCell; // Compressed Air item, currently not meta sensitive - - fuelCan; // Empty Fuel Can item, currently not meta sensitive - filledFuelCan; // Fuel Can item, meta = fuel value (as of v1.45) - - tinCan; // Empty Tin Can item, currently not meta sensitive - filledTinCan; // Filled Tin Can item, currently not meta sensitive - - // reactor components - reactorUraniumSimple; // Uranium Cell items, meta = consumed uranium ticks - reactorUraniumDual; - reactorUraniumQuad; - - reactorCoolantSimple; - reactorCoolantTriple ; // Coolant Cell item, NBT for heat-storage, meta is 0-10000 for display - reactorCoolantSix; - - reactorPlating; // Integrated Reactor Plating item, currently not meta sensitive - reactorPlatingHeat; - reactorPlatingExplosive; - - reactorHeatSwitch; // Integrated Heat Disperser item, NBT for heat-storage, meta is 0-10000 for display - reactorHeatSwitchCore; - reactorHeatSwitchSpread; - reactorHeatSwitchDiamond; - - reactorVent; // Heat Venting component, NBT for heat-storage, meta is 0-10000 for display - reactorVentCore; - reactorVentGold; - reactorVentSpread;// Special: Does not store heat - reactorVentDiamond; - - reactorReflector; // Increase efficiency without additional ticks, NBT for heat-storage, meta is 0-10000 for display - reactorReflectorThick; // Increase efficiency without additional ticks, NBT for heat-storage, meta is 0-10000 for display - reactorCondensator; // Consumes redstone to absorb heat, NBT for storage, meta is 0-10000 for display - reactorCondensatorLap; // Consumes redstone/lapis to absorb heat, mNBT for storage, meta is 0-10000 for display - - // terraformer blueprints - terraformerBlueprint; // Empty Terraformer Blueprint item, currently not meta sensitive - cultivationTerraformerBlueprint; // Cultivation Terraformer Blueprint item, currently not meta sensitive - irrigationTerraformerBlueprint; // Irrigation Terraformer Blueprint item, currently not meta sensitive - chillingTerraformerBlueprint; // Chilling Terraformer Blueprint item, currently not meta sensitive - desertificationTerraformerBlueprint; // Desertification Terraformer Blueprint item, currently not meta sensitive - flatificatorTerraformerBlueprint; // Flatificator Terraformer Blueprint item, currently not meta sensitive - mushroomTerraformerBlueprint; // Mushroom Terraformer Blueprint item, currently not meta sensitive - - // diamond chain - coalBall; // Coal Ball item, currently not meta sensitive - compressedCoalBall; // Compressed Coal Ball item, currently not meta sensitive - coalChunk; // Coal Chunk item, currently not meta sensitive - industrialDiamond; // Industrial Diamond item, currently not meta sensitive, DEPRECATED - - // recycler chain - scrap; // Scrap item, currently not meta sensitive - scrapBox; // Scrap Box item, currently not meta sensitive - - // fuel production chain - hydratedCoalClump; // Hydrated Coal Clump item, currently not meta sensitive - plantBall; // Plant Ball item, currently not meta sensitive - compressedPlantBall; // Compressed Plant Ball item, currently not meta sensitive - - // painting - painter; // Painter item, currently not meta sensitive - - blackPainter; // Black Painter item, meta = damage value - redPainter; // Red Painter item, meta = damage value - greenPainter; // Green Painter item, meta = damage value - brownPainter; // Brown Painter item, meta = damage value - bluePainter; // Blue Painter item, meta = damage value - purplePainter; // Purple Painter item, meta = damage value - cyanPainter; // Cyan Painter item, meta = damage value - lightGreyPainter; // Light Grey Painter item, meta = damage value - darkGreyPainter; // Dark Grey Painter item, meta = damage value - pinkPainter; // Pink Painter item, meta = damage value - limePainter; // Lime Painter item, meta = damage value - yellowPainter; // Yellow Painter item, meta = damage value - cloudPainter; // Cloud Painter item, meta = damage value - magentaPainter; // Magenta Painter item, meta = damage value - orangePainter; // Orange Painter item, meta = damage value - whitePainter; // White Painter item, meta = damage value - - // explosives + related - dynamite; // Throwable Dynamite item, currently not meta sensitive - stickyDynamite; // Throwable Sticky Dynamite item, currently not meta sensitive - - remote; // Dynamite Remote item, currently not meta sensitive - - // misc intermediate recipe ingredients - electronicCircuit; // Electronic Circuit item, currently not meta sensitive - advancedCircuit; // Advanced Circuit item, currently not meta sensitive - - advancedAlloy; // Advanced Alloy item, currently not meta sensitive - - carbonFiber; // Raw Carbon Fiber item, currently not meta sensitive - carbonMesh; // Raw Carbon Mesh item, currently not meta sensitive - carbonPlate; // Carbon Plate item, currently not meta sensitive - - matter; // UUA item, currently not meta sensitive - iridiumOre; // Iridium Ore item, currently not meta sensitive - iridiumPlate; // Iridium Plate item, currently not meta sensitive - - - // Metal Plates - - platecopper; // Metal plate item, meta sensitive - platetin; // Metal plate item, meta sensitive - platebronze; // Metal plate item, meta sensitive - plategold; // Metal plate item, meta sensitive - plateiron; // Metal plate item, meta sensitive - platelead; // Metal plate item, meta sensitive - platelapi; // Metal plate item, meta sensitive - plateobsidian; // Metal plate item, meta sensitive - plateadviron; // Metal plate item, meta sensitive - - // Metal Dense Plates - denseplatecopper; // Metal dense plate item, meta sensitive - denseplatetin; // Metal dense plate item, meta sensitive - denseplatebronze; // Metal dense plate item, meta sensitive - denseplategold; // Metal dense plate item, meta sensitive - denseplateiron; // Metal dense plate item, meta sensitive - @Deprecated - denseplateadviron; // Metal dense plate item, meta sensitive - denseplatelead; // Metal dense plate item, meta sensitive - denseplatelapi; // Metal dense plate item, meta sensitive - denseplateobsidian; // Metal dense plate item, meta sensitive - - - // upgrade modules - overclockerUpgrade; // overclocker upgrade item, meta sensitive - transformerUpgrade; // transformer upgrade item, meta sensitive - energyStorageUpgrade; // energy storage upgrade item, meta sensitive - ejectorUpgrade; // ejector upgrade item, meta sensitive - - // misc - coin; // Coin item, currently not meta sensitive - reinforcedDoor; // Reinforced Door item, currently not meta sensitive - constructionFoamPowder; // Construction Foam Powder item, currently not meta sensitive - grinPowder; // Poisonous ingrident, currently not meta sensitive - debug; // Debug item, currently not meta sensitive - boatCarbon; // Carbon Fiber Canoe item, meta sensitive - boatRubber; // Rubber Dinghy item, meta sensitive - boatRubberBroken; // Damaged Rubber Dinghy item, meta sensitive - boatElectric; // Electric Boat item, meta sensitive - - //Agriculture - cropSeed; // Crop seeds, stuff stored in NBT, don't use for crafting recipes! - cropnalyzer; // Cropnalyzer handheld device - fertilizer; // Basic IC2Item, used to provide nutrients toCropBlocks - hydratingCell; // Cell used to hydrate Crops, meta = Content, 0= Full, 9999 = Near empty - electricHoe; // Electric Hoe, Metadata indicates charge level - terraWart; // Mystic opposite of NEtherWart, cures StatusEffects, simply consumeable - weedEx; // Spraying can of WEED-EX, meta indicates usages left - - //Boozeception - mugEmpty; // Simple stone mug - coffeeBeans; // Harvested CoffeeBeans - coffeePowder; // Processed Coffee Beans, used to craft drinkable Coffee - mugCoffee; // Mug of Coffee, Meta indicates status 0 = cold, 1 = Normal, 2 = Sugar'd - hops; // Hops, harvested freshly from crop - barrel; // Carried Barrel, metadata encrypts the information about the liquid inside - blockBarrel; // Unobtainable "placed barrel", TileEntity controlling the Fermentation process - mugBooze; // Mug filled with booze, metadata encrypts the information about the liquid inside - - */ - - /** - * Get the base IC2 package name, used internally. - * - * @return IC2 package name, if unable to be determined defaults to ic2 - */ - private static String getPackage() { - Package pkg = IC2Items.class.getPackage(); - - if (pkg != null) { - String packageName = pkg.getName(); - - return packageName.substring(0, packageName.length() - ".api.item".length()); - } - - return "ic2"; - } - - private static Class Ic2Items; -} - diff --git a/src/api/java/ic2/api/item/ICustomDamageItem.class b/src/api/java/ic2/api/item/ICustomDamageItem.class deleted file mode 100644 index 80020b849..000000000 Binary files a/src/api/java/ic2/api/item/ICustomDamageItem.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/ICustomDamageItem.java b/src/api/java/ic2/api/item/ICustomDamageItem.java deleted file mode 100644 index 4470fa0db..000000000 --- a/src/api/java/ic2/api/item/ICustomDamageItem.java +++ /dev/null @@ -1,56 +0,0 @@ -package ic2.api.item; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; - -/** - * ICustomDamageItem allows items to have custom damage handling without the massive overhead of - * Item.getDamage() / Item.setDamage(), which turn ItemStack.getItemDamage into virtual calls. - * - * The custom damage value is typically stored in the item stacks nbt data. - * - * If an Item implements ICusomDamageItem, the normal ItemStack damage won't be changed by IC2. - * It's up to the implementer to potentially manipulate it for suitable visual effect on the - * rendered damage bar or to provide a suitable item renderer. - * - * Item.isDamageable() still applies. - * - * @author Player - */ -public interface ICustomDamageItem { - /** - * Retrieve the custom damage value for the supplied item stack. - * - * @param stack ItemStack to be queried. - * @return Custom damage value. - */ - int getCustomDamage(ItemStack stack); - - /** - * Retrieve the maximum custom damage value for the supplied item stack. - * @param stack ItemStack to be queried. - * @return Custom damage value limit. - */ - int getMaxCustomDamage(ItemStack stack); - - /** - * Set the custom damage value for the supplied item stack. - * - * @param stack ItemStack to be manipulated. - * @param damage New damage value. - */ - void setCustomDamage(ItemStack stack, int damage); - - /** - * Increase the custom damage value for the supplied item stack. - * - * It's up to the implementation to not apply any damage, e.g. based on some randomness or - * properties of src. - * - * @param stack ItemStack to be manipulated. - * @param damage Extra damage to be applied. - * @param src Entity damaging the item, may be null. - * @return true if damage was applied. - */ - boolean applyCustomDamage(ItemStack stack, int damage, EntityLivingBase src); -} diff --git a/src/api/java/ic2/api/item/IDebuggable.class b/src/api/java/ic2/api/item/IDebuggable.class deleted file mode 100644 index 13c992baf..000000000 Binary files a/src/api/java/ic2/api/item/IDebuggable.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/IDebuggable.java b/src/api/java/ic2/api/item/IDebuggable.java deleted file mode 100644 index 404c7eb72..000000000 --- a/src/api/java/ic2/api/item/IDebuggable.java +++ /dev/null @@ -1,22 +0,0 @@ -package ic2.api.item; - - -/** - * Allows a tile entity to output a debug message when the debugItem is used on it. - * Suggestions by Myrathi - */ -public abstract interface IDebuggable { - /** - * Checks if the tile entity is in a state that can be debugged. - * - * @return True if the tile entity can be debugged - */ - public abstract boolean isDebuggable(); - - /** - * Gets the debug text for the tile entity. - * - * @return The text that the debugItem should show - */ - public abstract String getDebugText(); -} diff --git a/src/api/java/ic2/api/item/IElectricItem.class b/src/api/java/ic2/api/item/IElectricItem.class deleted file mode 100644 index a49d1839e..000000000 Binary files a/src/api/java/ic2/api/item/IElectricItem.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/IElectricItem.java b/src/api/java/ic2/api/item/IElectricItem.java deleted file mode 100644 index 4f546d575..000000000 --- a/src/api/java/ic2/api/item/IElectricItem.java +++ /dev/null @@ -1,57 +0,0 @@ -package ic2.api.item; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -/** - * Provides the ability to store energy on the implementing item. - * - * The item should have a maximum damage of 13. - */ -public interface IElectricItem { - /** - * Determine if the item can be used in a machine or as an armor part to supply energy. - * - * @return Whether the item can supply energy - */ - boolean canProvideEnergy(ItemStack itemStack); - - /** - * Get the item ID to use for a charge energy greater than 0. - * - * @return Item ID to use - */ - Item getChargedItem(ItemStack itemStack); - - /** - * Get the item ID to use for a charge energy of 0. - * - * @return Item ID to use - */ - Item getEmptyItem(ItemStack itemStack); - - /** - * Get the item's maximum charge energy in EU. - * - * @return Maximum charge energy - */ - double getMaxCharge(ItemStack itemStack); - - /** - * Get the item's tier, lower tiers can't send energy to higher ones. - * - * Batteries are Tier 1, Advanced Batteries are Tier 2, Energy Crystals are Tier 3, Lapotron - * Crystals are Tier 4. - * - * @return Item's tier - */ - int getTier(ItemStack itemStack); - - /** - * Get the item's transfer limit in EU per transfer operation. - * - * @return Transfer limit - */ - double getTransferLimit(ItemStack itemStack); -} - diff --git a/src/api/java/ic2/api/item/IElectricItemManager.class b/src/api/java/ic2/api/item/IElectricItemManager.class deleted file mode 100644 index 978eb9147..000000000 Binary files a/src/api/java/ic2/api/item/IElectricItemManager.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/IElectricItemManager.java b/src/api/java/ic2/api/item/IElectricItemManager.java deleted file mode 100644 index 5de43d773..000000000 --- a/src/api/java/ic2/api/item/IElectricItemManager.java +++ /dev/null @@ -1,95 +0,0 @@ -package ic2.api.item; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; - -/** - * This interface specifies a manager to handle the various tasks for electric items. - * - * The default implementation does the following: - * - store and retrieve the charge - * - handle charging, taking amount, tier, transfer limit, canProvideEnergy and simulate into account - * - replace item IDs if appropriate (getChargedItemId() and getEmptyItemId()) - * - update and manage the damage value for the visual charge indicator - * - * @note If you're implementing your own variant (ISpecialElectricItem), you can delegate to the - * default implementations through ElectricItem.rawManager. The default implementation is designed - * to minimize its dependency on its own constraints/structure and delegates most work back to the - * more atomic features in the gateway manager. - */ -public interface IElectricItemManager { - /** - * Charge an item with a specified amount of energy. - * - * @param itemStack electric item's stack - * @param amount amount of energy to charge in EU - * @param tier tier of the charging device, has to be at least as high as the item to charge - * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() - * @param simulate don't actually change the item, just determine the return value - * @return Energy transferred into the electric item - */ - double charge(ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean simulate); - - /** - * Discharge an item by a specified amount of energy - * - * @param itemStack electric item's stack - * @param amount amount of energy to discharge in EU - * @param tier tier of the discharging device, has to be at least as high as the item to discharge - * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() - * @param externally use the supplied item externally, i.e. to power something else as if it was a battery - * @param simulate don't actually discharge the item, just determine the return value - * @return Energy retrieved from the electric item - */ - double discharge(ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate); - - /** - * Determine the charge level for the specified item. - * - * @param itemStack ItemStack containing the electric item - * @return charge level in EU - */ - double getCharge(ItemStack stack); - - /** - * Determine if the specified electric item has at least a specific amount of EU. - * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. - * BatPacks are not taken into account. - * - * @param itemStack electric item's stack - * @param amount minimum amount of energy required - * @return true if there's enough energy - */ - boolean canUse(ItemStack stack, double amount); - - /** - * Try to retrieve a specific amount of energy from an Item, and if applicable, a BatPack. - * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. - * - * @param itemStack electric item's stack - * @param amount amount of energy to discharge in EU - * @param entity entity holding the item - * @return true if the operation succeeded - */ - boolean use(ItemStack stack, double amount, EntityLivingBase entity); - - /** - * Charge an item from the BatPack a player is wearing. - * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. - * use() already contains this functionality. - * - * @param itemStack electric item's stack - * @param entity entity holding the item - */ - void chargeFromArmor(ItemStack stack, EntityLivingBase entity); - - /** - * Get the tool tip to display for electric items. - * - * @param itemStack ItemStack to determine the tooltip for - * @return tool tip string or null for none - */ - String getToolTip(ItemStack stack); - - // TODO: add tier getter -} diff --git a/src/api/java/ic2/api/item/IItemHudInfo.class b/src/api/java/ic2/api/item/IItemHudInfo.class deleted file mode 100644 index 82e7f8297..000000000 Binary files a/src/api/java/ic2/api/item/IItemHudInfo.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/IItemHudInfo.java b/src/api/java/ic2/api/item/IItemHudInfo.java deleted file mode 100644 index da9731876..000000000 --- a/src/api/java/ic2/api/item/IItemHudInfo.java +++ /dev/null @@ -1,24 +0,0 @@ -package ic2.api.item; - -import java.util.List; - -import net.minecraft.item.ItemStack; - -public interface IItemHudInfo { - /* - Add Info to Nano- and Quantum-Suit Helm Hud - for itemStack - - @Override - public List getHudInfo(ItemStack itemStack) { - List info = new LinkedList(); - info.add("i am a Cool Item"); - info.add("and have Cool info"); - return info; - } - - - */ - - public List getHudInfo(ItemStack itemStack); -} diff --git a/src/api/java/ic2/api/item/IKineticRotor$GearboxType.class b/src/api/java/ic2/api/item/IKineticRotor$GearboxType.class deleted file mode 100644 index 4c6ab9db6..000000000 Binary files a/src/api/java/ic2/api/item/IKineticRotor$GearboxType.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/IKineticRotor.class b/src/api/java/ic2/api/item/IKineticRotor.class deleted file mode 100644 index 4bba1ebde..000000000 Binary files a/src/api/java/ic2/api/item/IKineticRotor.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/IKineticRotor.java b/src/api/java/ic2/api/item/IKineticRotor.java deleted file mode 100644 index a61d1622c..000000000 --- a/src/api/java/ic2/api/item/IKineticRotor.java +++ /dev/null @@ -1,23 +0,0 @@ -package ic2.api.item; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -public interface IKineticRotor { - int getDiameter(ItemStack stack); - - ResourceLocation getRotorRenderTexture(ItemStack stack); - - float getEfficiency(ItemStack stack); - - int getMinWindStrength(ItemStack stack); - - int getMaxWindStrength(ItemStack stack); - - boolean isAcceptedType(ItemStack stack, GearboxType type); - - public static enum GearboxType { - WATER, - WIND, - } -} diff --git a/src/api/java/ic2/api/item/ILatheItem$ILatheTool.class b/src/api/java/ic2/api/item/ILatheItem$ILatheTool.class deleted file mode 100644 index 46efc5019..000000000 Binary files a/src/api/java/ic2/api/item/ILatheItem$ILatheTool.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/ILatheItem.class b/src/api/java/ic2/api/item/ILatheItem.class deleted file mode 100644 index b6a25ef0f..000000000 Binary files a/src/api/java/ic2/api/item/ILatheItem.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/ILatheItem.java b/src/api/java/ic2/api/item/ILatheItem.java deleted file mode 100644 index 45988c42b..000000000 --- a/src/api/java/ic2/api/item/ILatheItem.java +++ /dev/null @@ -1,70 +0,0 @@ -package ic2.api.item; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -/** - * Interface used for Items that can be processed in the Turning Table - */ -public interface ILatheItem { - - /** - * Returns the radius of this Lathe Item - * Should be no more than 15 to still be able to display it properly. - */ - int getWidth(ItemStack stack); - - /** - * Returns the current state of this Lathe Item - * The length of the array should be 5 - * The value should be the current size of the item at this time. - * It should also not be greater than getWidth() - */ - int[] getCurrentState(ItemStack stack); - - /** - * This will set the current state of the Item on that position to that value. - */ - void setState(ItemStack stack, int position, int value); - - /** - * Returns the output Item (normally dust) when you lathe on this position. - */ - ItemStack getOutputItem(ItemStack stack, int position); - - /** - * How common it is if the above item will be put into the output slot. - * 1.0 means it will always be outputted, 0.0 means it will never be outputted. - */ - float getOutputChance(ItemStack stack, int position); - - /** - * Returns the ResourceLocation of the texture used to display the item inside of the Lathe GUI - */ - @SideOnly(Side.CLIENT) - ResourceLocation getTexture(ItemStack stack); - - /** - * This is similar to the Block HarvestLevel. Requires a different tool for a different hardness - * for ex. the Iron Turning Blank has a Hardness of 2 (Like Iron Ore (Harvest Level)). - * In this case however it requires a Tool hardness of one above (3) - */ - int getHardness(ItemStack stack); - - /** - * Interface used for Tools that can be used to modify {@link ILatheItem} - */ - public static interface ILatheTool extends ICustomDamageItem { - - /** - * This is similar to the Tool HarvestLevel. Requires a different tool for a different hardness - * for ex. the Iron Turning Blank has a Hardness of 2 (Like Iron Ore (Harvest Level)). - * The tool requires a hardness of one level above (in this case 3) - */ - int getHardness(ItemStack stack); - } - -} diff --git a/src/api/java/ic2/api/item/IMetalArmor.class b/src/api/java/ic2/api/item/IMetalArmor.class deleted file mode 100644 index 426278ae3..000000000 Binary files a/src/api/java/ic2/api/item/IMetalArmor.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/IMetalArmor.java b/src/api/java/ic2/api/item/IMetalArmor.java deleted file mode 100644 index 16ffd24e5..000000000 --- a/src/api/java/ic2/api/item/IMetalArmor.java +++ /dev/null @@ -1,20 +0,0 @@ -package ic2.api.item; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; - -/** - * Armor items implementing this can be considered metal armor. - * - * Currently used for determining which boots can be used to slide up a magnetic pole. - */ -public interface IMetalArmor { - /** - * Determine if the given armor piece is metal armor. - * - * @param itemstack Armor piece as worn by the player - * @param player The player - * @return Whether the armor piece is metal armor - */ - public boolean isMetalArmor(ItemStack itemstack, EntityPlayer player); -} diff --git a/src/api/java/ic2/api/item/ISpecialElectricItem.class b/src/api/java/ic2/api/item/ISpecialElectricItem.class deleted file mode 100644 index ca93ed277..000000000 Binary files a/src/api/java/ic2/api/item/ISpecialElectricItem.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/ISpecialElectricItem.java b/src/api/java/ic2/api/item/ISpecialElectricItem.java deleted file mode 100644 index a7302f530..000000000 --- a/src/api/java/ic2/api/item/ISpecialElectricItem.java +++ /dev/null @@ -1,13 +0,0 @@ -package ic2.api.item; - -import net.minecraft.item.ItemStack; - -public interface ISpecialElectricItem extends IElectricItem { - /** - * Supply a custom IElectricItemManager. - * - * @param itemStack ItemStack to get the manager for - * @return IElectricItemManager instance - */ - IElectricItemManager getManager(ItemStack itemStack); -} diff --git a/src/api/java/ic2/api/item/ITerraformingBP.class b/src/api/java/ic2/api/item/ITerraformingBP.class deleted file mode 100644 index 3242ee063..000000000 Binary files a/src/api/java/ic2/api/item/ITerraformingBP.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/ITerraformingBP.java b/src/api/java/ic2/api/item/ITerraformingBP.java deleted file mode 100644 index 59b46baec..000000000 --- a/src/api/java/ic2/api/item/ITerraformingBP.java +++ /dev/null @@ -1,34 +0,0 @@ -package ic2.api.item; - -import net.minecraft.world.World; - -/** - * Allows an item to act as a terraformer blueprint. - */ -public interface ITerraformingBP { - /** - * Get the energy consumption per operation of the blueprint. - * - * @return Energy consumption in EU - */ - public abstract int getConsume(); - - /** - * Get the maximum range of the blueprint. - * Should be a divisor of 5. - * - * @return Maximum range in blocks - */ - public abstract int getRange(); - - /** - * Perform the terraforming operation. - * - * @param world world to terraform - * @param x X position to terraform - * @param z Z position to terraform - * @param yCoord Y position of the terraformer - * @return Whether the operation was successful and the terraformer should consume energy. - */ - public abstract boolean terraform(World world, int x, int z, int yCoord); -} diff --git a/src/api/java/ic2/api/item/ItemWrapper.class b/src/api/java/ic2/api/item/ItemWrapper.class deleted file mode 100644 index 5454f5eff..000000000 Binary files a/src/api/java/ic2/api/item/ItemWrapper.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/ItemWrapper.java b/src/api/java/ic2/api/item/ItemWrapper.java deleted file mode 100644 index 58f807340..000000000 --- a/src/api/java/ic2/api/item/ItemWrapper.java +++ /dev/null @@ -1,50 +0,0 @@ -package ic2.api.item; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.Multimap; - -/** - * Wrapper for inserting interfaces into items you don't own. - * - * @author Richard - */ -public class ItemWrapper { - private static final Multimap boxableItems = ArrayListMultimap.create(); - private static final Multimap metalArmorItems = ArrayListMultimap.create(); - - public static void registerBoxable(Item item, IBoxable boxable) { - boxableItems.put(item, boxable); - } - - public static boolean canBeStoredInToolbox(ItemStack stack) { - Item item = stack.getItem(); - // use customs first to allow for overriding behavior - for (IBoxable boxable : boxableItems.get(item)) { - if (boxable.canBeStoredInToolbox(stack)) return true; - } - - if (item instanceof IBoxable && ((IBoxable) item).canBeStoredInToolbox(stack)) return true; - - return false; - } - - public static void registerMetalArmor(Item item, IMetalArmor armor) { - metalArmorItems.put(item, armor); - } - - public static boolean isMetalArmor(ItemStack stack, EntityPlayer player) { - Item item = stack.getItem(); - // use customs first to allow for overriding behavior - for (IMetalArmor metalArmor : metalArmorItems.get(item)) { - if (metalArmor.isMetalArmor(stack, player)) return true; - } - - if (item instanceof IMetalArmor && ((IMetalArmor) item).isMetalArmor(stack, player)) return true; - - return false; - } -} diff --git a/src/api/java/ic2/api/item/package-info.class b/src/api/java/ic2/api/item/package-info.class deleted file mode 100644 index 222a18333..000000000 Binary files a/src/api/java/ic2/api/item/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/package-info.java b/src/api/java/ic2/api/item/package-info.java deleted file mode 100644 index 44ecdce97..000000000 --- a/src/api/java/ic2/api/item/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.item; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/ic2/api/network/INetworkClientTileEntityEventListener.class b/src/api/java/ic2/api/network/INetworkClientTileEntityEventListener.class deleted file mode 100644 index 3234025c1..000000000 Binary files a/src/api/java/ic2/api/network/INetworkClientTileEntityEventListener.class and /dev/null differ diff --git a/src/api/java/ic2/api/network/INetworkClientTileEntityEventListener.java b/src/api/java/ic2/api/network/INetworkClientTileEntityEventListener.java deleted file mode 100644 index ed3ea38fe..000000000 --- a/src/api/java/ic2/api/network/INetworkClientTileEntityEventListener.java +++ /dev/null @@ -1,17 +0,0 @@ -package ic2.api.network; - -import net.minecraft.entity.player.EntityPlayer; - -/** - * Allows a tile entity to receive network events received from clients. - */ -public interface INetworkClientTileEntityEventListener { - /** - * Called when a network event is received. - * - * @param player client which sent the event - * @param event event ID - */ - void onNetworkEvent(EntityPlayer player, int event); -} - diff --git a/src/api/java/ic2/api/network/INetworkDataProvider.class b/src/api/java/ic2/api/network/INetworkDataProvider.class deleted file mode 100644 index e0773c476..000000000 Binary files a/src/api/java/ic2/api/network/INetworkDataProvider.class and /dev/null differ diff --git a/src/api/java/ic2/api/network/INetworkDataProvider.java b/src/api/java/ic2/api/network/INetworkDataProvider.java deleted file mode 100644 index c3f283e5f..000000000 --- a/src/api/java/ic2/api/network/INetworkDataProvider.java +++ /dev/null @@ -1,18 +0,0 @@ -package ic2.api.network; - -import java.util.List; - -/** - * Tile entities which want to synchronized specific fields between client and server have to implement this. - * - * The fields don't update themselves, a field update must be sent every time a synchronized field changes. - */ -public interface INetworkDataProvider { - /** - * Get the list of synchronized fields. - * - * @return Names of the synchronized fields - */ - List getNetworkedFields(); -} - diff --git a/src/api/java/ic2/api/network/INetworkItemEventListener.class b/src/api/java/ic2/api/network/INetworkItemEventListener.class deleted file mode 100644 index 30dcc22e0..000000000 Binary files a/src/api/java/ic2/api/network/INetworkItemEventListener.class and /dev/null differ diff --git a/src/api/java/ic2/api/network/INetworkItemEventListener.java b/src/api/java/ic2/api/network/INetworkItemEventListener.java deleted file mode 100644 index 5f3228cec..000000000 --- a/src/api/java/ic2/api/network/INetworkItemEventListener.java +++ /dev/null @@ -1,19 +0,0 @@ -package ic2.api.network; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; - -/** - * Allows an item to receive network events received from the server. - */ -public interface INetworkItemEventListener { - /** - * Called when a network event is received. - * - * @param itemStack item stack - * @param player player containing the item - * @param event event ID - */ - void onNetworkEvent(ItemStack stack, EntityPlayer player, int event); -} - diff --git a/src/api/java/ic2/api/network/INetworkTileEntityEventListener.class b/src/api/java/ic2/api/network/INetworkTileEntityEventListener.class deleted file mode 100644 index d7f438676..000000000 Binary files a/src/api/java/ic2/api/network/INetworkTileEntityEventListener.class and /dev/null differ diff --git a/src/api/java/ic2/api/network/INetworkTileEntityEventListener.java b/src/api/java/ic2/api/network/INetworkTileEntityEventListener.java deleted file mode 100644 index fbb4753c5..000000000 --- a/src/api/java/ic2/api/network/INetworkTileEntityEventListener.java +++ /dev/null @@ -1,14 +0,0 @@ -package ic2.api.network; - -/** - * Allows a tile entity to receive network events received from the server. - */ -public interface INetworkTileEntityEventListener { - /** - * Called when a network event is received. - * - * @param event Event ID - */ - void onNetworkEvent(int event); -} - diff --git a/src/api/java/ic2/api/network/INetworkUpdateListener.class b/src/api/java/ic2/api/network/INetworkUpdateListener.class deleted file mode 100644 index db801296f..000000000 Binary files a/src/api/java/ic2/api/network/INetworkUpdateListener.class and /dev/null differ diff --git a/src/api/java/ic2/api/network/INetworkUpdateListener.java b/src/api/java/ic2/api/network/INetworkUpdateListener.java deleted file mode 100644 index 09414ae38..000000000 --- a/src/api/java/ic2/api/network/INetworkUpdateListener.java +++ /dev/null @@ -1,14 +0,0 @@ -package ic2.api.network; - -/** - * Allows a tile entity to receive field sync updates received from the server. - */ -public interface INetworkUpdateListener { - /** - * Called when a field is synchronized. - * - * @param field field synchronized - */ - void onNetworkUpdate(String field); -} - diff --git a/src/api/java/ic2/api/network/NetworkHelper.class b/src/api/java/ic2/api/network/NetworkHelper.class deleted file mode 100644 index 887d3a387..000000000 Binary files a/src/api/java/ic2/api/network/NetworkHelper.class and /dev/null differ diff --git a/src/api/java/ic2/api/network/NetworkHelper.java b/src/api/java/ic2/api/network/NetworkHelper.java deleted file mode 100644 index a91d03a64..000000000 --- a/src/api/java/ic2/api/network/NetworkHelper.java +++ /dev/null @@ -1,194 +0,0 @@ -package ic2.api.network; - -import java.lang.reflect.Method; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -/** - * Provides methods to initiate events and synchronize tile entity fields in SMP. - * - * The methods are transparent between singleplayer and multiplayer - if a method is called in - * singleplayer, the associated callback will be locally executed. The implementation is different - * between the client and server versions of IC2. - * - * You'll usually want to use the server->client methods defined here to synchronize information - * which is needed by the clients outside the GUI, such as rendering the block, playing sounds or - * producing effects. Anything which is only visible inside the GUI should be synchronized through - * the Container class associated to the GUI in Container.updateProgressBar(). - */ -public final class NetworkHelper { - // server -> client - - - /** - * Schedule a TileEntity's field to be updated to the clients in range. - * - * The updater will query the field's value during the next update, updates happen usually - * every 2 ticks. If low latency is important use initiateTileEntityEvent instead. - * - * IC2's network updates have to get triggered every time, it doesn't continuously poll/send - * the field value. Just call updateTileEntityField after every change to a field which needs - * network synchronization. - * - * The following field data types are currently supported: - * - int, int[], short, short[], byte, byte[], long, long[] - * - float, float[], double, double[] - * - boolean, boolean[] - * - String, String[] - * - ItemStack - * - NBTBase (includes NBTTagCompound) - * - Block, Item, Achievement, Potion, Enchantment - * - ChunkCoordinates, ChunkCoordIntPair - * - TileEntity (does not sync the actual tile entity, instead looks up the tile entity by its position in the client world) - * - World (does not sync the actual world, instead looks up the world by its dimension ID) - * - * Once the update has been processed by the client, it'll call onNetworkUpdate on the client- - * side TileEntity if it implements INetworkUpdateListener. - * - * If this method is being executed on the client (i.e. Singleplayer), it'll just call - * INetworkUpdateListener.onNetworkUpdate (if implemented by the te). - * - * @param te TileEntity to update - * @param field Name of the field to update - */ - public static void updateTileEntityField(TileEntity te, String field) { - try { - if (NetworkManager_updateTileEntityField == null) NetworkManager_updateTileEntityField = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("updateTileEntityField", TileEntity.class, String.class); - if (instance == null) instance = getInstance(); - - NetworkManager_updateTileEntityField.invoke(instance, te, field); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /** - * Immediately send an event for the specified TileEntity to the clients in range. - * - * If this method is being executed on the client (i.e. Singleplayer), it'll just call - * INetworkTileEntityEventListener.onNetworkEvent (if implemented by the te). - * - * @param te TileEntity to notify, should implement INetworkTileEntityEventListener - * @param event Arbitrary integer to represent the event, choosing the values is up to you - * @param limitRange Limit the notification range to (currently) 20 blocks instead of the - * tracking distance if true - */ - public static void initiateTileEntityEvent(TileEntity te, int event, boolean limitRange) { - try { - if (NetworkManager_initiateTileEntityEvent == null) NetworkManager_initiateTileEntityEvent = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("initiateTileEntityEvent", TileEntity.class, Integer.TYPE, Boolean.TYPE); - if (instance == null) instance = getInstance(); - - NetworkManager_initiateTileEntityEvent.invoke(instance, te, event, limitRange); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /** - * Immediately send an event for the specified Item to the clients in range. - * - * The item should implement INetworkItemEventListener to receive the event. - * - * If this method is being executed on the client (i.e. Singleplayer), it'll just call - * INetworkItemEventListener.onNetworkEvent (if implemented by the item). - * - * @param player EntityPlayer holding the item - * @param itemStack ItemStack containing the item - * @param event Arbitrary integer to represent the event, choosing the values is up to you - * @param limitRange Limit the notification range to (currently) 20 blocks instead of the - * tracking distance if true - */ - public static void initiateItemEvent(EntityPlayer player, ItemStack itemStack, int event, boolean limitRange) { - try { - if (NetworkManager_initiateItemEvent == null) NetworkManager_initiateItemEvent = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("initiateItemEvent", EntityPlayer.class, ItemStack.class, Integer.TYPE, Boolean.TYPE); - if (instance == null) instance = getInstance(); - - NetworkManager_initiateItemEvent.invoke(instance, player, itemStack, event, limitRange); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - - // client -> server - - /** - * Immediately send an event for the specified TileEntity to the server. - * - * This method doesn't do anything if executed on the server. - * - * @param te TileEntity to notify, should implement INetworkClientTileEntityEventListener - * @param event Arbitrary integer to represent the event, choosing the values is up to you - */ - public static void initiateClientTileEntityEvent(TileEntity te, int event) { - try { - if (NetworkManager_initiateClientTileEntityEvent == null) NetworkManager_initiateClientTileEntityEvent = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("initiateClientTileEntityEvent", TileEntity.class, Integer.TYPE); - if (instance == null) instance = getInstance(); - - NetworkManager_initiateClientTileEntityEvent.invoke(instance, te, event); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /** - * Immediately send an event for the specified Item to the clients in range. - * - * The item should implement INetworkItemEventListener to receive the event. - * - * This method doesn't do anything if executed on the server. - * - * @param itemStack ItemStack containing the item - * @param event Arbitrary integer to represent the event, choosing the values is up to you - */ - public static void initiateClientItemEvent(ItemStack itemStack, int event) { - try { - if (NetworkManager_initiateClientItemEvent == null) NetworkManager_initiateClientItemEvent = Class.forName(getPackage() + ".core.network.NetworkManager").getMethod("initiateClientItemEvent", ItemStack.class, Integer.TYPE); - if (instance == null) instance = getInstance(); - - NetworkManager_initiateClientItemEvent.invoke(instance, itemStack, event); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /** - * Get the base IC2 package name, used internally. - * - * @return IC2 package name, if unable to be determined defaults to ic2 - */ - private static String getPackage() { - Package pkg = NetworkHelper.class.getPackage(); - - if (pkg != null) { - String packageName = pkg.getName(); - - return packageName.substring(0, packageName.length() - ".api.network".length()); - } - - return "ic2"; - } - - /** - * Get the NetworkManager instance, used internally. - * - * @return NetworkManager instance - */ - private static Object getInstance() { - try { - return Class.forName(getPackage() + ".core.util.SideGateway").getMethod("get").invoke(Class.forName(getPackage() + ".core.IC2").getDeclaredField("network").get(null)); - } catch (Throwable e) { - throw new RuntimeException(e); - } - } - - private static Object instance; - private static Method NetworkManager_updateTileEntityField; - private static Method NetworkManager_initiateTileEntityEvent; - private static Method NetworkManager_initiateItemEvent; - private static Method NetworkManager_initiateClientTileEntityEvent; - private static Method NetworkManager_initiateClientItemEvent; -} - diff --git a/src/api/java/ic2/api/network/package-info.class b/src/api/java/ic2/api/network/package-info.class deleted file mode 100644 index f4f18429e..000000000 Binary files a/src/api/java/ic2/api/network/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/network/package-info.java b/src/api/java/ic2/api/network/package-info.java deleted file mode 100644 index 25ea29e1e..000000000 --- a/src/api/java/ic2/api/network/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.network; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/ic2/api/package-info.class b/src/api/java/ic2/api/package-info.class deleted file mode 100644 index 7caf69978..000000000 Binary files a/src/api/java/ic2/api/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/package-info.java b/src/api/java/ic2/api/package-info.java deleted file mode 100644 index e6f15228a..000000000 --- a/src/api/java/ic2/api/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/ic2/api/reactor/IReactor.class b/src/api/java/ic2/api/reactor/IReactor.class deleted file mode 100644 index 06917a9da..000000000 Binary files a/src/api/java/ic2/api/reactor/IReactor.class and /dev/null differ diff --git a/src/api/java/ic2/api/reactor/IReactor.java b/src/api/java/ic2/api/reactor/IReactor.java deleted file mode 100644 index 55191ccf3..000000000 --- a/src/api/java/ic2/api/reactor/IReactor.java +++ /dev/null @@ -1,158 +0,0 @@ -package ic2.api.reactor; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.World; - -/** - * Interface implemented by the tile entity of nuclear reactors. - */ -public interface IReactor { - /** - * Get the reactor's position in the world. - * - * @return Position of the reactor - */ - public ChunkCoordinates getPosition(); - - /** - * Get the reactor's corresponding world. - * - * @return The reactor's world - */ - public World getWorld(); - - /** - * Get the reactor's heat. - * - * @return The reactor's heat - */ - public int getHeat(); - - /** - * Set the reactor's heat. - * - * @param heat reactor heat - */ - public void setHeat(int heat); - - /** - * Increase the reactor's heat. - * - * Use negative values to decrease. - * - * @param amount amount of heat to add - * @return The reactor's heat after adding the specified amount - */ - public int addHeat(int amount); - - /** - * Get the reactor's maximum heat before exploding. - * - * @return Maximum heat value - */ - public int getMaxHeat(); - - /** - * Set the reactor's stored maxHeat variable. - * Used by plating to increase the reactors MaxHeat capacity. - * Needs to be called during each cycle process. - */ - public void setMaxHeat(int newMaxHeat); - - /** - * add Heat to a EmitHeat Buffer - * for use in Reactor operation.. need to be use - * for all Componetents with self-cooling - * no more magic heat disappear - */ - - - public void addEmitHeat(int heat); - - /** - * Get's the reactor's HEM (Heat Effect Modifier) - * Basic value is 1.0F. - * Reducing the value causes a weakening/reduction of the heat-based sideeffects of reactors - * (F.e. water evaporation, melting, damaging entitys, etc) - * - * @return HEM - */ - public float getHeatEffectModifier(); - - /** - * Set's the reactor's HEM - * Needs to be called during each cycle process. - */ - public void setHeatEffectModifier(float newHEM); - - /** - * Get the reactor's energy output. - * - * @return Energy output, not multiplied by the base EU/t value - */ - public float getReactorEnergyOutput(); - - /** - * Get the reactor's energy output. - * - * @return Energy output, multiplied with base EU/t value and MainConfig.get().getFloat("balance/energy/generator/nuclear") - */ - public double getReactorEUEnergyOutput(); - - /** - * Add's the given amount of energy to the Reactor's output. - * - * @return Energy output after adding the value, not multiplied by the base EU/t value - */ - public float addOutput(float energy); - - /** - * Get the item at the specified grid coordinates. - * - * @param x X position of the item, out of bounds returns null - * @param y Y position of the item, out of bounds returns null - * @return The item or null if there is no item - */ - public ItemStack getItemAt(int x, int y); - - /** - * Set the item at the specified grid coordinates. - * - * @param x X position of the item, out of bounds is a no-op - * @param y Y position of the item, out of bounds is a no-op - * @param item The item to set. - */ - public void setItemAt(int x, int y, ItemStack item); - - /** - * Explode the reactor. - */ - public void explode(); - - /** - * Get the reactor's tick rate (game ticks per reactor tick). - * - * @return Tick rate - */ - public int getTickRate(); - - /** - * Get whether the reactor is active and supposed to produce energy - * @return Whether the reactor is active - */ - public boolean produceEnergy(); - - /** - * Set Redstone Signal without direct contact - * - */ - - public void setRedstoneSignal(boolean redstone); - - /** - * @return true if the reactor is FluidCooled - */ - - public boolean isFluidCooled(); -} diff --git a/src/api/java/ic2/api/reactor/IReactorChamber.class b/src/api/java/ic2/api/reactor/IReactorChamber.class deleted file mode 100644 index e0e206c46..000000000 Binary files a/src/api/java/ic2/api/reactor/IReactorChamber.class and /dev/null differ diff --git a/src/api/java/ic2/api/reactor/IReactorChamber.java b/src/api/java/ic2/api/reactor/IReactorChamber.java deleted file mode 100644 index 4611a6af5..000000000 --- a/src/api/java/ic2/api/reactor/IReactorChamber.java +++ /dev/null @@ -1,20 +0,0 @@ -package ic2.api.reactor; - -/** - * Interface implemented by the reactor chamber tile entity. - */ -public interface IReactorChamber { - /** - * Get the chamber's reactor. - * - * @return The reactor - */ - public IReactor getReactor(); - - /** - * Set Redstone Signal without direct contact - * - */ - - public void setRedstoneSignal(boolean redstone); -} diff --git a/src/api/java/ic2/api/reactor/IReactorComponent.class b/src/api/java/ic2/api/reactor/IReactorComponent.class deleted file mode 100644 index beacfceaf..000000000 Binary files a/src/api/java/ic2/api/reactor/IReactorComponent.class and /dev/null differ diff --git a/src/api/java/ic2/api/reactor/IReactorComponent.java b/src/api/java/ic2/api/reactor/IReactorComponent.java deleted file mode 100644 index 84e011c75..000000000 --- a/src/api/java/ic2/api/reactor/IReactorComponent.java +++ /dev/null @@ -1,98 +0,0 @@ -package ic2.api.reactor; - -import net.minecraft.item.ItemStack; - -/** - * Design custom Reactor components by implementing this Interface - * Items implementing the interface will not be ejected from Reactors in their clean-up - * and can/will be interacted with by other elements, f.e. Uranium Cells. - * - * All IC2 ReactorComponents implement and use this Interface - * - */ -public interface IReactorComponent { - /** - * Called by reactor upon iterating through it's inventory (every cycle). - * Perform all necessary calculation/interaction here - * - * @param reactor Reference to the Reactor - * @param yourStack Reference to the specific instance of iterated ItemStack - * @param x X-coordinate of the stack in the grid - * @param y Y-coordinate of the stack in the grid - * @param heatrun every Stack will cycle 2 time (true, false) first run for heat, sec for Eu calculation - */ - public void processChamber(IReactor reactor, ItemStack yourStack, int x, int y, boolean heatrun); - - /** - * Can be called by Uranium-Components who attempt to generate energy by pulsing to other components. - * Uranium-Uranium interaction (f.e.) uses this method. - * @param reactor Reference to the Reactor - * @param yourStack Reference to the specific instance of called ItemStack - * @param pulsingStack Reference to the specific instance of pulsing ItemStack - * @param youX X-coordinate of your stack in the grid - * @param youY Y-coordinate of your stack in the grid - * @param pulseX X-coordinate of pulsing stack in the grid - * @param pulseY Y-coordinate of pulsing stack in the grid - * @param heatrun true for only create heat not EU, false for only EU not heat - * @return true if this component reacts to the pulse (and pulse is therefore meant to produce heat) - */ - public boolean acceptUraniumPulse(IReactor reactor, ItemStack yourStack, ItemStack pulsingStack, int youX, int youY, int pulseX, int pulseY, boolean heatrun); - - /** - * Called by components to determine whether your component can be heated. - * @param reactor Reference to the Reactor - * @param yourStack Reference to the specific instance of iterated ItemStack - * @param x X-coordinate of the stack in the grid - * @param y Y-coordinate of the stack in the grid - * @return true if your component can take heat - */ - public boolean canStoreHeat(IReactor reactor, ItemStack yourStack, int x, int y); - - /** - * Called by heat-switches to determine how much heat to distribute into which direction. - * Please return the maximum capacity of your heat-containing component here. - * @param reactor Reference to the Reactor - * @param yourStack Reference to the specific instance of iterated ItemStack - * @param x X-coordinate of the stack in the grid - * @param y Y-coordinate of the stack in the grid - * @return Maximum heat - */ - public int getMaxHeat(IReactor reactor, ItemStack yourStack, int x, int y); - - /** - * Called by heat-switches to determine how much heat to distribute into which direction. - * Please return the current amount of heat stored in this component - * @param reactor Reference to the Reactor - * @param yourStack Reference to the specific instance of iterated ItemStack - * @param x X-coordinate of the stack in the grid - * @param y Y-coordinate of the stack in the grid - * @return Current Heat - */ - public int getCurrentHeat(IReactor reactor, ItemStack yourStack, int x, int y); - - /** - * Called by components to distribute heat to your component. - * Perform heating-calculations and increase your heat (dmg) level accordingly. - * This method will as well be called to REDUCE heat, by providing a negative amount. - * - * @param reactor Reference to the Reactor - * @param yourStack Reference to the specific instance of iterated ItemStack - * @param x X-coordinate of the stack in the grid - * @param y Y-coordinate of the stack in the grid - * @param heat Amount of heat to be added (may be negative to subtract heat) - * @return 0 if the 'order' was accepted, return >0 to indicate the 'remaining' heat which couldn't be absorbed (and vice versa for <0) - */ - public int alterHeat(IReactor reactor, ItemStack yourStack, int x, int y, int heat); - - /** - * Called upon reactor explosion - * Alter the explosion size. - * Returning a float 0 < f < 1 will be counted as multiplier. - * Anything else will be counted as a flat addition (in case of <0 = reduction). - * - * @param reactor Reference to the Reactor - * @param yourStack Reference to the specific instance of iterated ItemStack - * @return your explosion modifier - */ - public float influenceExplosion(IReactor reactor, ItemStack yourStack); -} diff --git a/src/api/java/ic2/api/reactor/package-info.class b/src/api/java/ic2/api/reactor/package-info.class deleted file mode 100644 index a94d26ff4..000000000 Binary files a/src/api/java/ic2/api/reactor/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/reactor/package-info.java b/src/api/java/ic2/api/reactor/package-info.java deleted file mode 100644 index 5194aee03..000000000 --- a/src/api/java/ic2/api/reactor/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.reactor; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$Input.class b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$Input.class deleted file mode 100644 index 89a9b2f17..000000000 Binary files a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$Input.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.class b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.class deleted file mode 100644 index 7372a12c7..000000000 Binary files a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java deleted file mode 100644 index 415b3c38c..000000000 --- a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java +++ /dev/null @@ -1,51 +0,0 @@ -package ic2.api.recipe; - -import java.util.Map; - -import net.minecraft.item.ItemStack; - -public interface ICannerBottleRecipeManager { - /** - * Adds a recipe to the machine. - * - * @param container Container to be filled - * @param fill Item to fill into the container - * @param output Filled container - */ - public void addRecipe(IRecipeInput container, IRecipeInput fill, ItemStack output); - - /** - * Gets the recipe output for the given input. - * - * @param container Container to be filled - * @param fill Item to fill into the container - * @param adjustInput modify the input according to the recipe's requirements - * @param acceptTest allow either container or fill to be null to see if either of them is part of a recipe - * @return Recipe output, or null if none - */ - public RecipeOutput getOutputFor(ItemStack container, ItemStack fill, boolean adjustInput, boolean acceptTest); - - /** - * Gets a list of recipes. - * - * You're a mad evil scientist if you ever modify this. - * - * @return List of recipes - */ - public Map getRecipes(); - - - public static class Input { - public Input(IRecipeInput container1, IRecipeInput fill1) { - this.container = container1; - this.fill = fill1; - } - - public boolean matches(ItemStack container1, ItemStack fill1) { - return this.container.matches(container1) && this.fill.matches(fill1); - } - - public final IRecipeInput container; - public final IRecipeInput fill; - } -} diff --git a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$Input.class b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$Input.class deleted file mode 100644 index 309dd5d11..000000000 Binary files a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$Input.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.class b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.class deleted file mode 100644 index f32226dce..000000000 Binary files a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.java b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.java deleted file mode 100644 index 5eba1b68e..000000000 --- a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.java +++ /dev/null @@ -1,54 +0,0 @@ -package ic2.api.recipe; - -import java.util.Map; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fluids.FluidStack; - -public interface ICannerEnrichRecipeManager { - /** - * Adds a recipe to the machine. - * - * @param input Fluid input - * @param additive Item to enrich the fluid with - * @param output Output fluid - */ - public void addRecipe(FluidStack input, IRecipeInput additive, FluidStack output); - - /** - * Gets the recipe output for the given input. - * - * @param input Fluid input - * @param additive Item to enrich the fluid with - * @param adjustInput modify the input according to the recipe's requirements - * @param acceptTest allow input or additive to be null to see if either of them is part of a recipe - * @return Recipe output, or null if none, output fluid in nbt - */ - public RecipeOutput getOutputFor(FluidStack input, ItemStack additive, boolean adjustInput, boolean acceptTest); - - /** - * Gets a list of recipes. - * - * You're a mad evil scientist if you ever modify this. - * - * @return List of recipes - */ - public Map getRecipes(); - - - public static class Input { - public Input(FluidStack fluid1, IRecipeInput additive1) { - this.fluid = fluid1; - this.additive = additive1; - } - - public boolean matches(FluidStack fluid1, ItemStack additive1) { - return (this.fluid == null || this.fluid.isFluidEqual(fluid1)) && - this.additive.matches(additive1); - } - - public final FluidStack fluid; - public final IRecipeInput additive; - } -} diff --git a/src/api/java/ic2/api/recipe/ICraftingRecipeManager.class b/src/api/java/ic2/api/recipe/ICraftingRecipeManager.class deleted file mode 100644 index 877dcf4e7..000000000 Binary files a/src/api/java/ic2/api/recipe/ICraftingRecipeManager.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java b/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java deleted file mode 100644 index 756eaf634..000000000 --- a/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java +++ /dev/null @@ -1,26 +0,0 @@ -package ic2.api.recipe; - -import net.minecraft.item.ItemStack; - -/** - * Recipe manager interface for crafting recipes. - * - * @author Richard - */ -public interface ICraftingRecipeManager { - /** - * Adds a shaped crafting recipe. - * - * @param output Recipe output - * @param input Recipe input format - */ - public void addRecipe(ItemStack output, Object... input); - - /** - * Adds a shapeless crafting recipe. - * - * @param output Recipe output - * @param input Recipe input - */ - public void addShapelessRecipe(ItemStack output, Object... input); -} diff --git a/src/api/java/ic2/api/recipe/IFluidHeatManager$BurnProperty.class b/src/api/java/ic2/api/recipe/IFluidHeatManager$BurnProperty.class deleted file mode 100644 index 6367f30bf..000000000 Binary files a/src/api/java/ic2/api/recipe/IFluidHeatManager$BurnProperty.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/IFluidHeatManager.class b/src/api/java/ic2/api/recipe/IFluidHeatManager.class deleted file mode 100644 index 30a7fee0d..000000000 Binary files a/src/api/java/ic2/api/recipe/IFluidHeatManager.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/IFluidHeatManager.java b/src/api/java/ic2/api/recipe/IFluidHeatManager.java deleted file mode 100644 index 7ddecdce4..000000000 --- a/src/api/java/ic2/api/recipe/IFluidHeatManager.java +++ /dev/null @@ -1,32 +0,0 @@ -package ic2.api.recipe; - -import java.util.Map; - -import net.minecraftforge.fluids.Fluid; - - -public interface IFluidHeatManager extends ILiquidAcceptManager { - /** - * Add a new fluid to the Fluid Heat Generator. - * - * @param fluidName the fluid to burn - * @param amount amount of fluid to consume per tick - * @param heat amount of heat generated per tick - */ - void addFluid(String fluidName, int amount, int heat); - - BurnProperty getBurnProperty(Fluid fluid); - - Map getBurnProperties(); - - - public static class BurnProperty { - public BurnProperty(int amount1, int heat1) { - this.amount = amount1; - this.heat = heat1; - } - - public final int amount; - public final int heat; - } -} diff --git a/src/api/java/ic2/api/recipe/ILiquidAcceptManager.class b/src/api/java/ic2/api/recipe/ILiquidAcceptManager.class deleted file mode 100644 index 2ccadae70..000000000 Binary files a/src/api/java/ic2/api/recipe/ILiquidAcceptManager.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/ILiquidAcceptManager.java b/src/api/java/ic2/api/recipe/ILiquidAcceptManager.java deleted file mode 100644 index 4f377b904..000000000 --- a/src/api/java/ic2/api/recipe/ILiquidAcceptManager.java +++ /dev/null @@ -1,10 +0,0 @@ -package ic2.api.recipe; - -import java.util.Set; - -import net.minecraftforge.fluids.Fluid; - -public interface ILiquidAcceptManager { - boolean acceptsFluid(Fluid fluid); - Set getAcceptedFluids(); -} diff --git a/src/api/java/ic2/api/recipe/ILiquidHeatExchangerManager$HeatExchangeProperty.class b/src/api/java/ic2/api/recipe/ILiquidHeatExchangerManager$HeatExchangeProperty.class deleted file mode 100644 index 374f186d7..000000000 Binary files a/src/api/java/ic2/api/recipe/ILiquidHeatExchangerManager$HeatExchangeProperty.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/ILiquidHeatExchangerManager.class b/src/api/java/ic2/api/recipe/ILiquidHeatExchangerManager.class deleted file mode 100644 index b58008d86..000000000 Binary files a/src/api/java/ic2/api/recipe/ILiquidHeatExchangerManager.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/ILiquidHeatExchangerManager.java b/src/api/java/ic2/api/recipe/ILiquidHeatExchangerManager.java deleted file mode 100644 index 68decbb39..000000000 --- a/src/api/java/ic2/api/recipe/ILiquidHeatExchangerManager.java +++ /dev/null @@ -1,39 +0,0 @@ -package ic2.api.recipe; - -import java.util.Map; - -import net.minecraftforge.fluids.Fluid; - -public interface ILiquidHeatExchangerManager extends ILiquidAcceptManager { - - /** - * Add a new fluid heatup/cooldown recipe. - * - * @param fluidName the fluid to heat up/cool down - * @param fluidOutput the fluid the above fluid turns into - * @param huPerMB the Thermal Energy difference in hU for the conversion of one mB fluid - */ - void addFluid(String fluidName, String fluidOutput, int huPerMB); - - HeatExchangeProperty getHeatExchangeProperty(Fluid fluid); - - Map getHeatExchangeProperties(); - - /** - * This returns an ILiquidAcceptManager that only accepts fluids, that can be heated up / cooled down, but not both. - * You can basically use this to check if the liquid resulting from this conversion can be reprocessed into the first one. - * @return Returns the SingleDirectionManager. - */ - ILiquidAcceptManager getSingleDirectionLiquidManager(); - - public static class HeatExchangeProperty { - public HeatExchangeProperty(Fluid outputFluid, int huPerMB) { - this.outputFluid = outputFluid; - this.huPerMB = huPerMB; - } - - public final Fluid outputFluid; - public final int huPerMB; - } - -} diff --git a/src/api/java/ic2/api/recipe/IListRecipeManager.class b/src/api/java/ic2/api/recipe/IListRecipeManager.class deleted file mode 100644 index 77f1a930a..000000000 Binary files a/src/api/java/ic2/api/recipe/IListRecipeManager.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/IListRecipeManager.java b/src/api/java/ic2/api/recipe/IListRecipeManager.java deleted file mode 100644 index adc22912a..000000000 --- a/src/api/java/ic2/api/recipe/IListRecipeManager.java +++ /dev/null @@ -1,41 +0,0 @@ -package ic2.api.recipe; - -import java.util.List; - -import net.minecraft.item.ItemStack; - -/** - * Recipe manager interface for basic lists. - * - * @author Richard - */ -public interface IListRecipeManager extends Iterable { - /** - * Adds a stack to the list. - * - * @param stack Stack to add - */ - public void add(IRecipeInput input); - - /** - * Checks whether the specified stack is in the list. - * - * @param stack Stack to check - * @return Whether the stack is in the list - */ - public boolean contains(ItemStack stack); - - /** - * @return if the List is Empty - */ - public boolean isEmpty(); - - /** - * Gets the list of stacks. - * - * You're a mad evil scientist if you ever modify this. - * - * @return List of stacks - */ - public List getInputs(); -} diff --git a/src/api/java/ic2/api/recipe/IMachineRecipeManager.class b/src/api/java/ic2/api/recipe/IMachineRecipeManager.class deleted file mode 100644 index 5476c9df2..000000000 Binary files a/src/api/java/ic2/api/recipe/IMachineRecipeManager.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/IMachineRecipeManager.java b/src/api/java/ic2/api/recipe/IMachineRecipeManager.java deleted file mode 100644 index d2d4382b7..000000000 --- a/src/api/java/ic2/api/recipe/IMachineRecipeManager.java +++ /dev/null @@ -1,44 +0,0 @@ -package ic2.api.recipe; - -import java.util.Map; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -/** - * Recipe manager interface for basic machines. - * - * @author RichardG, Player - */ -public interface IMachineRecipeManager { // TODO: merge with IMachineRecipeManagerExt - /** - * Adds a recipe to the machine. - * - * @param input Recipe input - * @param metadata meta data for additional recipe properties, may be null - * @param outputs Recipe outputs, zero or more depending on the machine - * - * For the thermal centrifuge @param metadata meta data {"minHeat": 1-xxx} - * For the ore washing plant @param metadata meta data {"amount": 1-8000} - * - */ - public void addRecipe(IRecipeInput input, NBTTagCompound metadata, ItemStack... outputs); - - /** - * Gets the recipe output for the given input. - * - * @param input Recipe input - * @param adjustInput modify the input according to the recipe's requirements - * @return Recipe output, or null if none - */ - public RecipeOutput getOutputFor(ItemStack input, boolean adjustInput); - - /** - * Gets a list of recipes. - * - * You're a mad evil scientist if you ever modify this. - * - * @return List of recipes - */ - public Map getRecipes(); // TODO: Change to iterable/collection/list -} diff --git a/src/api/java/ic2/api/recipe/IMachineRecipeManagerExt.class b/src/api/java/ic2/api/recipe/IMachineRecipeManagerExt.class deleted file mode 100644 index b6f9bac0e..000000000 Binary files a/src/api/java/ic2/api/recipe/IMachineRecipeManagerExt.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/IMachineRecipeManagerExt.java b/src/api/java/ic2/api/recipe/IMachineRecipeManagerExt.java deleted file mode 100644 index 9c68706d9..000000000 --- a/src/api/java/ic2/api/recipe/IMachineRecipeManagerExt.java +++ /dev/null @@ -1,22 +0,0 @@ -package ic2.api.recipe; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public interface IMachineRecipeManagerExt extends IMachineRecipeManager { - /** - * Adds a recipe to the machine. - * - * @note Overwrite is only as reliable as IRecipeInput.getInputs(). - * - * @param input Recipe input - * @param metadata Meta data for additional recipe properties, may be null. - * @param overwrite Replace an existing recipe, not recommended, may be ignored. - * @param outputs Recipe outputs, zero or more depending on the machine. - * @return true on success, false otherwise, e.g. on conflicts. - * - * For the thermal centrifuge @param metadata meta data {"minHeat": 1-xxx} - * For the ore washing plant @param metadata meta data {"amount": 1-8000} - */ - public boolean addRecipe(IRecipeInput input, NBTTagCompound metadata, boolean overwrite, ItemStack... outputs); -} diff --git a/src/api/java/ic2/api/recipe/IPatternStorage.class b/src/api/java/ic2/api/recipe/IPatternStorage.class deleted file mode 100644 index 5b7210064..000000000 Binary files a/src/api/java/ic2/api/recipe/IPatternStorage.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/IPatternStorage.java b/src/api/java/ic2/api/recipe/IPatternStorage.java deleted file mode 100644 index c9dbd8d73..000000000 --- a/src/api/java/ic2/api/recipe/IPatternStorage.java +++ /dev/null @@ -1,11 +0,0 @@ -package ic2.api.recipe; - -import java.util.List; - -import net.minecraft.item.ItemStack; - -public interface IPatternStorage { - boolean addPattern(ItemStack itemstack); - - List getPatterns(); -} diff --git a/src/api/java/ic2/api/recipe/IRecipeInput.class b/src/api/java/ic2/api/recipe/IRecipeInput.class deleted file mode 100644 index 6d159b49b..000000000 Binary files a/src/api/java/ic2/api/recipe/IRecipeInput.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/IRecipeInput.java b/src/api/java/ic2/api/recipe/IRecipeInput.java deleted file mode 100644 index 0c842d639..000000000 --- a/src/api/java/ic2/api/recipe/IRecipeInput.java +++ /dev/null @@ -1,31 +0,0 @@ -package ic2.api.recipe; - -import java.util.List; - -import net.minecraft.item.ItemStack; - -public interface IRecipeInput { - /** - * Check if subject matches this recipe input, ignoring the amount. - * - * @param subject ItemStack to check - * @return true if it matches the requirement - */ - boolean matches(ItemStack subject); - - /** - * Determine the minimum input stack size. - * - * @return input amount required - */ - int getAmount(); - - /** - * List all possible inputs (best effort). - * - * The stack size is undefined, use getAmount to get the correct one. - * - * @return list of inputs, may be incomplete - */ - List getInputs(); -} diff --git a/src/api/java/ic2/api/recipe/IScrapboxManager.class b/src/api/java/ic2/api/recipe/IScrapboxManager.class deleted file mode 100644 index 2aa3304f1..000000000 Binary files a/src/api/java/ic2/api/recipe/IScrapboxManager.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/IScrapboxManager.java b/src/api/java/ic2/api/recipe/IScrapboxManager.java deleted file mode 100644 index 41b694dcc..000000000 --- a/src/api/java/ic2/api/recipe/IScrapboxManager.java +++ /dev/null @@ -1,13 +0,0 @@ -package ic2.api.recipe; - -import java.util.Map; - -import net.minecraft.item.ItemStack; - -public interface IScrapboxManager { - void addDrop(ItemStack drop, float rawChance); - - ItemStack getDrop(ItemStack input, boolean adjustInput); - - Map getDrops(); -} diff --git a/src/api/java/ic2/api/recipe/ISemiFluidFuelManager$BurnProperty.class b/src/api/java/ic2/api/recipe/ISemiFluidFuelManager$BurnProperty.class deleted file mode 100644 index e1aba6db9..000000000 Binary files a/src/api/java/ic2/api/recipe/ISemiFluidFuelManager$BurnProperty.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.class b/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.class deleted file mode 100644 index 562181cd5..000000000 Binary files a/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.java b/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.java deleted file mode 100644 index 87c34270d..000000000 --- a/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.java +++ /dev/null @@ -1,32 +0,0 @@ -package ic2.api.recipe; - -import java.util.Map; - -import net.minecraftforge.fluids.Fluid; - - -public interface ISemiFluidFuelManager extends ILiquidAcceptManager { - /** - * Add a new fluid to the semi fluid generator. - * - * @param fluidName the fluid to burn - * @param amount amount of fluid to consume per tick - * @param power amount of energy generated per tick - */ - void addFluid(String fluidName, int amount, double power); - - BurnProperty getBurnProperty(Fluid fluid); - - Map getBurnProperties(); - - - public static class BurnProperty { - public BurnProperty(int amount1, double power1) { - this.amount = amount1; - this.power = power1; - } - - public final int amount; - public final double power; - } -} diff --git a/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.class b/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.class deleted file mode 100644 index 703455eb6..000000000 Binary files a/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.java b/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.java deleted file mode 100644 index 103d293e2..000000000 --- a/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.java +++ /dev/null @@ -1,54 +0,0 @@ -package ic2.api.recipe; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData; -import net.minecraftforge.fluids.FluidStack; - -public class RecipeInputFluidContainer implements IRecipeInput { - public RecipeInputFluidContainer(Fluid fluid) { - this(fluid, FluidContainerRegistry.BUCKET_VOLUME); - } - - public RecipeInputFluidContainer(Fluid fluid, int amount) { - this.fluid = fluid; - this.amount = amount; - } - - @Override - public boolean matches(ItemStack subject) { - FluidStack fs = FluidContainerRegistry.getFluidForFilledItem(subject); - if (fs == null) return false; - - return fs.getFluid() == fluid; - } - - @Override - public int getAmount() { - return amount; - } - - @Override - public List getInputs() { - List ret = new ArrayList(); - - for (FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (data.fluid.getFluid() == fluid) ret.add(data.filledContainer); - } - - return ret; - } - - @Override - public String toString() { - return "RInputFluidContainer<"+amount+"x"+fluid.getName()+">"; - } - - public final Fluid fluid; - public final int amount; -} diff --git a/src/api/java/ic2/api/recipe/RecipeInputItemStack.class b/src/api/java/ic2/api/recipe/RecipeInputItemStack.class deleted file mode 100644 index c956c06d8..000000000 Binary files a/src/api/java/ic2/api/recipe/RecipeInputItemStack.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/RecipeInputItemStack.java b/src/api/java/ic2/api/recipe/RecipeInputItemStack.java deleted file mode 100644 index 84f86ea12..000000000 --- a/src/api/java/ic2/api/recipe/RecipeInputItemStack.java +++ /dev/null @@ -1,47 +0,0 @@ -package ic2.api.recipe; - -import java.util.Arrays; -import java.util.List; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.oredict.OreDictionary; - -public class RecipeInputItemStack implements IRecipeInput { - public RecipeInputItemStack(ItemStack aInput) { - this(aInput, aInput.stackSize); - } - - public RecipeInputItemStack(ItemStack aInput, int aAmount) { - if (aInput.getItem() == null) throw new IllegalArgumentException("Invalid item stack specfied"); - - input = aInput.copy(); // Never forget to copy. - amount = aAmount; - } - - @Override - public boolean matches(ItemStack subject) { - return subject.getItem() == input.getItem() && - (subject.getItemDamage() == input.getItemDamage() || input.getItemDamage() == OreDictionary.WILDCARD_VALUE); - } - - @Override - public int getAmount() { - return amount; - } - - @Override - public List getInputs() { - return Arrays.asList(input); - } - - @Override - public String toString() { - ItemStack stack = input.copy(); - input.stackSize = amount; - return "RInputItemStack<"+stack+">"; - } - - public final ItemStack input; - public final int amount; -} diff --git a/src/api/java/ic2/api/recipe/RecipeInputOreDict.class b/src/api/java/ic2/api/recipe/RecipeInputOreDict.class deleted file mode 100644 index 476e53666..000000000 Binary files a/src/api/java/ic2/api/recipe/RecipeInputOreDict.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/RecipeInputOreDict.java b/src/api/java/ic2/api/recipe/RecipeInputOreDict.java deleted file mode 100644 index e6e4695d0..000000000 --- a/src/api/java/ic2/api/recipe/RecipeInputOreDict.java +++ /dev/null @@ -1,104 +0,0 @@ -package ic2.api.recipe; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import net.minecraftforge.oredict.OreDictionary; - -public class RecipeInputOreDict implements IRecipeInput { - public RecipeInputOreDict(String input1) { - this(input1, 1); - } - - public RecipeInputOreDict(String input1, int amount1) { - this(input1, amount1, null); - } - - public RecipeInputOreDict(String input1, int amount1, Integer meta) { - this.input = input1; - this.amount = amount1; - this.meta = meta; - } - - @Override - public boolean matches(ItemStack subject) { - List inputs = getOres(); - boolean useOreStackMeta = (meta == null); - Item subjectItem = subject.getItem(); - int subjectMeta = subject.getItemDamage(); - - for (ItemStack oreStack : inputs) { - Item oreItem = oreStack.getItem(); - if (oreItem == null) continue; // ignore invalid - - int metaRequired = useOreStackMeta ? oreStack.getItemDamage() : meta; - - if (subjectItem == oreItem && - (subjectMeta == metaRequired || metaRequired == OreDictionary.WILDCARD_VALUE)) { - return true; - } - } - - return false; - } - - @Override - public int getAmount() { - return amount; - } - - @Override - public List getInputs() { - List ores = getOres(); - - // check if we have to filter the list first - boolean hasInvalidEntries = false; - - for (ItemStack stack : ores) { - if (stack.getItem() == null) { - hasInvalidEntries = true; - break; - } - } - - if (!hasInvalidEntries) return ores; - - List ret = new ArrayList(ores.size()); - - for (ItemStack stack : ores) { - if (stack.getItem() != null) ret.add(stack); // ignore invalid - } - - return Collections.unmodifiableList(ret); - } - - @Override - public String toString() { - if (meta == null) { - return "RInputOreDict<"+amount+"x"+input+">"; - } else { - return "RInputOreDict<"+amount+"x"+input+"@"+meta+">"; - } - } - - private List getOres() { - if (ores != null) return ores; - - // cache the ore list by making use of the fact that forge always uses the same list, - // unless it's EMPTY_LIST, which should never happen. - List ret = OreDictionary.getOres(input); - - if (ret != OreDictionary.EMPTY_LIST) ores = ret; - - return ret; - } - - public final String input; - public final int amount; - public final Integer meta; - private List ores; -} diff --git a/src/api/java/ic2/api/recipe/RecipeOutput.class b/src/api/java/ic2/api/recipe/RecipeOutput.class deleted file mode 100644 index a2a19b3b1..000000000 Binary files a/src/api/java/ic2/api/recipe/RecipeOutput.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/RecipeOutput.java b/src/api/java/ic2/api/recipe/RecipeOutput.java deleted file mode 100644 index 80ad5fb5c..000000000 --- a/src/api/java/ic2/api/recipe/RecipeOutput.java +++ /dev/null @@ -1,53 +0,0 @@ -package ic2.api.recipe; - -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public final class RecipeOutput { - public RecipeOutput(NBTTagCompound metadata1, List items1) { - assert !items1.contains(null); - - this.metadata = metadata1; - this.items = items1; - } - - public RecipeOutput(NBTTagCompound metadata1, ItemStack... items1) { - this(metadata1, Arrays.asList(items1)); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof RecipeOutput) { - RecipeOutput ro = (RecipeOutput) obj; - - if (items.size() == ro.items.size() && - (metadata == null && ro.metadata == null || metadata != null && ro.metadata != null && metadata.equals(ro.metadata))) { - Iterator itA = items.iterator(); - Iterator itB = ro.items.iterator(); - - while (itA.hasNext() && itB.hasNext()) { - ItemStack stackA = itA.next(); - ItemStack stackB = itB.next(); - - if (ItemStack.areItemStacksEqual(stackA, stackB)) return false; - } - - return true; - } - } - - return false; - } - - @Override - public String toString() { - return "ROutput<"+items+","+metadata+">"; - } - - public final List items; - public final NBTTagCompound metadata; -} diff --git a/src/api/java/ic2/api/recipe/Recipes.class b/src/api/java/ic2/api/recipe/Recipes.class deleted file mode 100644 index 11854efef..000000000 Binary files a/src/api/java/ic2/api/recipe/Recipes.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/Recipes.java b/src/api/java/ic2/api/recipe/Recipes.java deleted file mode 100644 index 0aa0b75a5..000000000 --- a/src/api/java/ic2/api/recipe/Recipes.java +++ /dev/null @@ -1,68 +0,0 @@ -package ic2.api.recipe; - - -/** - * General recipe registry. - * - * @author Richard - */ -public class Recipes { - public static IMachineRecipeManager macerator; - public static IMachineRecipeManager extractor; - public static IMachineRecipeManager compressor; - public static IMachineRecipeManager centrifuge; - public static IMachineRecipeManager blockcutter; - public static IMachineRecipeManager blastfurance; - public static IMachineRecipeManager recycler; - public static IMachineRecipeManager metalformerExtruding; - public static IMachineRecipeManager metalformerCutting; - public static IMachineRecipeManager metalformerRolling; - public static IMachineRecipeManager oreWashing; - public static ICannerBottleRecipeManager cannerBottle; - public static ICannerEnrichRecipeManager cannerEnrich; - - /** - * Reference amplifier values: - * - * 5000: Scrap - * 45000: Scrapbox - * - * As Parameter for the Amplification Value you have to use the NBTTagCompound - * - * NBTTagCompound nbt = new NBTTagCompound(); - * nbt.setInteger("amplification", aValue); - * matterAmplifier.addRecipe(yourStack, nbt); - */ - public static IMachineRecipeManager matterAmplifier; - /** - * Reference scrap box chance values: - * - * 0.1: Diamond - * 0.5: Cake, Gold Helmet, Iron Ore, Gold Ore - * 1.0: Wooden tools, Soul Sand, Sign, Leather, Feather, Bone - * 1.5: Apple, Bread - * 2.0: Netherrack, Rotten Flesh - * 3.0: Grass, Gravel - * 4.0: Stick - * 5.0: Dirt, Wooden Hoe - */ - public static IScrapboxManager scrapboxDrops; - public static IListRecipeManager recyclerBlacklist; - /** - * Do not add anything to this Whitelist. This is for Configuration only. - * You may need this if you have an own Recycler in your Mod, just to check if something can be recycled. but don't add anything to this List - */ - public static IListRecipeManager recyclerWhitelist; - public static ICraftingRecipeManager advRecipes; - - public static ISemiFluidFuelManager semiFluidGenerator; - public static IFluidHeatManager FluidHeatGenerator; - /** - * Used by the Liquid Heat Exchanger to cool down liquids and determine the amount of hu generated for every mb. - */ - public static ILiquidHeatExchangerManager liquidCooldownManager; - /** - * Opposite of {@link #liquidCooldownManager}. This is for Liquids that can be heated up again. - */ - public static ILiquidHeatExchangerManager liquidHeatupManager; -} diff --git a/src/api/java/ic2/api/recipe/package-info.class b/src/api/java/ic2/api/recipe/package-info.class deleted file mode 100644 index f30b57f78..000000000 Binary files a/src/api/java/ic2/api/recipe/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/package-info.java b/src/api/java/ic2/api/recipe/package-info.java deleted file mode 100644 index 44e70e79a..000000000 --- a/src/api/java/ic2/api/recipe/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.recipe; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/ic2/api/tile/ExplosionWhitelist.class b/src/api/java/ic2/api/tile/ExplosionWhitelist.class deleted file mode 100644 index 0fbd082df..000000000 Binary files a/src/api/java/ic2/api/tile/ExplosionWhitelist.class and /dev/null differ diff --git a/src/api/java/ic2/api/tile/ExplosionWhitelist.java b/src/api/java/ic2/api/tile/ExplosionWhitelist.java deleted file mode 100644 index fa4a474a5..000000000 --- a/src/api/java/ic2/api/tile/ExplosionWhitelist.java +++ /dev/null @@ -1,47 +0,0 @@ -package ic2.api.tile; - -import java.util.HashSet; -import java.util.Set; - -import net.minecraft.block.Block; - -/** - * Blocks on this whitelist will not resist an explosion but won't be destroyed. - * - * The explosion code by default ignores blocks which absorb more than 1000 explosion power to - * prevent abusing personal safes, Trade-O-Mats and other blocks to serve as a cheap and - * invulnerable reactor chambers. Said blocks will not shield the explosion and won't get - * destroyed. - */ -public final class ExplosionWhitelist { - /** - * Add a block to the whitelist. - * - * @param block block to add - */ - public static void addWhitelistedBlock(Block block) { - whitelist.add(block); - } - - /** - * Remove a block from the whitelist. - * - * @param block block to remove - */ - public static void removeWhitelistedBlock(Block block) { - whitelist.remove(block); - } - - /** - * Check if a block is on the whitelist. - * - * @param block block to check if whitelisted - * @return Whether the block is whitelisted - */ - public static boolean isBlockWhitelisted(Block block) { - return whitelist.contains(block); - } - - private static Set whitelist = new HashSet(); -} - diff --git a/src/api/java/ic2/api/tile/IEnergyStorage.class b/src/api/java/ic2/api/tile/IEnergyStorage.class deleted file mode 100644 index e03e23fce..000000000 Binary files a/src/api/java/ic2/api/tile/IEnergyStorage.class and /dev/null differ diff --git a/src/api/java/ic2/api/tile/IEnergyStorage.java b/src/api/java/ic2/api/tile/IEnergyStorage.java deleted file mode 100644 index 68f42703b..000000000 --- a/src/api/java/ic2/api/tile/IEnergyStorage.java +++ /dev/null @@ -1,61 +0,0 @@ -package ic2.api.tile; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Interface implemented by the tile entity of energy storage blocks. - */ -public interface IEnergyStorage { - /** - * Get the amount of energy currently stored in the block. - * - * @return Energy stored in the block - */ - public int getStored(); - - /** - * Set the amount of energy currently stored in the block. - * - * @param energy stored energy - */ - public void setStored(int energy); - - /** - * Add the specified amount of energy. - * - * Use negative values to decrease. - * - * @param amount of energy to add - * @return Energy stored in the block after adding the specified amount - */ - public int addEnergy(int amount); - - /** - * Get the maximum amount of energy the block can store. - * - * @return Maximum energy stored - */ - public int getCapacity(); - - /** - * Get the block's energy output. - * - * @return Energy output in EU/t - */ - public int getOutput(); - - /** - * Get the block's energy output. - * - * @return Energy output in EU/t - */ - public double getOutputEnergyUnitsPerTick(); - - /** - * Get whether this block can have its energy used by an adjacent teleporter. - * - * @param side side the teleporter is draining energy from - * @return Whether the block is teleporter compatible - */ - public boolean isTeleporterCompatible(ForgeDirection side); -} diff --git a/src/api/java/ic2/api/tile/IWrenchable.class b/src/api/java/ic2/api/tile/IWrenchable.class deleted file mode 100644 index 3bc6fff8c..000000000 Binary files a/src/api/java/ic2/api/tile/IWrenchable.class and /dev/null differ diff --git a/src/api/java/ic2/api/tile/IWrenchable.java b/src/api/java/ic2/api/tile/IWrenchable.java deleted file mode 100644 index 8fcbea59e..000000000 --- a/src/api/java/ic2/api/tile/IWrenchable.java +++ /dev/null @@ -1,61 +0,0 @@ -package ic2.api.tile; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; - -/** - * Allows a tile entity to make use of the wrench's removal and rotation functions. - */ -public interface IWrenchable { - /** - * Determine if the wrench can be used to set the block's facing. - * Called before wrenchCanRemove(). - * - * @param entityPlayer player using the wrench, may be null - * @param side block's side the wrench was clicked on - * @return Whether the wrenching was done and the wrench should be damaged - */ - boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side); - - /** - * Get the block's facing. - * - * @return Block facing - */ - short getFacing(); - - /** - * Set the block's facing - * - * @param facing facing to set the block to - */ - void setFacing(short facing); - - /** - * Determine if the wrench can be used to remove the block. - * Called if wrenchSetFacing fails. - * - * @param entityPlayer player using the wrench, may be null - * @return Whether the wrenching was done and the wrench should be damaged - */ - boolean wrenchCanRemove(EntityPlayer entityPlayer); - - /** - * Determine the probability to drop the block as it is. - * The first entry in getDrops will be replaced by blockid:meta if the drop is successful. - * - * @return Probability from 0 to 1 - */ - float getWrenchDropRate(); - - /** - * Determine the item the block will drop when the wrenching is successful. - * - * The ItemStack will be copied before creating the EntityItem. - * - * @param entityPlayer player using the wrench, may be null - * @return ItemStack to drop, may be null - */ - ItemStack getWrenchDrop(EntityPlayer entityPlayer); -} - diff --git a/src/api/java/ic2/api/tile/package-info.class b/src/api/java/ic2/api/tile/package-info.class deleted file mode 100644 index 226d45541..000000000 Binary files a/src/api/java/ic2/api/tile/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/tile/package-info.java b/src/api/java/ic2/api/tile/package-info.java deleted file mode 100644 index 5ebc76e24..000000000 --- a/src/api/java/ic2/api/tile/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.tile; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/ic2/api/util/IKeyboard.class b/src/api/java/ic2/api/util/IKeyboard.class deleted file mode 100644 index 1e52c66c8..000000000 Binary files a/src/api/java/ic2/api/util/IKeyboard.class and /dev/null differ diff --git a/src/api/java/ic2/api/util/IKeyboard.java b/src/api/java/ic2/api/util/IKeyboard.java deleted file mode 100644 index ff6eaea5e..000000000 --- a/src/api/java/ic2/api/util/IKeyboard.java +++ /dev/null @@ -1,14 +0,0 @@ -package ic2.api.util; - -import net.minecraft.entity.player.EntityPlayer; - -public interface IKeyboard { - boolean isAltKeyDown(EntityPlayer player); - boolean isBoostKeyDown(EntityPlayer player); - boolean isForwardKeyDown(EntityPlayer player); - boolean isJumpKeyDown(EntityPlayer player); - boolean isModeSwitchKeyDown(EntityPlayer player); - boolean isSideinventoryKeyDown(EntityPlayer player); - boolean isHudModeKeyDown(EntityPlayer player); - boolean isSneakKeyDown(EntityPlayer player); -} diff --git a/src/api/java/ic2/api/util/Keys.class b/src/api/java/ic2/api/util/Keys.class deleted file mode 100644 index 0e5ff7fba..000000000 Binary files a/src/api/java/ic2/api/util/Keys.class and /dev/null differ diff --git a/src/api/java/ic2/api/util/Keys.java b/src/api/java/ic2/api/util/Keys.java deleted file mode 100644 index 84d175676..000000000 --- a/src/api/java/ic2/api/util/Keys.java +++ /dev/null @@ -1,6 +0,0 @@ -package ic2.api.util; - - -public class Keys { - public static IKeyboard instance; -} \ No newline at end of file diff --git a/src/api/java/ic2/api/util/package-info.class b/src/api/java/ic2/api/util/package-info.class deleted file mode 100644 index 4c91d9186..000000000 Binary files a/src/api/java/ic2/api/util/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/util/package-info.java b/src/api/java/ic2/api/util/package-info.java deleted file mode 100644 index 4dd2d93b1..000000000 --- a/src/api/java/ic2/api/util/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.util; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/invtweaks/api/IItemTree.java b/src/api/java/invtweaks/api/IItemTree.java deleted file mode 100755 index 5b6c0a805..000000000 --- a/src/api/java/invtweaks/api/IItemTree.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -import java.util.Collection; -import java.util.List; -import java.util.Random; - -public interface IItemTree { - public void registerOre(String category, String name, String oreName, int order); - - boolean matches(List items, String keyword); - - boolean isKeywordValid(String keyword); - - Collection getAllCategories(); - - IItemTreeCategory getRootCategory(); - - IItemTreeCategory getCategory(String keyword); - - boolean isItemUnknown(String id, int damage); - - List getItems(String id, int damage); - - List getItems(String name); - - IItemTreeItem getRandomItem(Random r); - - boolean containsItem(String name); - - boolean containsCategory(String name); - - void setRootCategory(IItemTreeCategory category); - - IItemTreeCategory addCategory(String parentCategory, String newCategory) throws NullPointerException; - - void addCategory(String parentCategory, IItemTreeCategory newCategory) throws NullPointerException; - - IItemTreeItem addItem(String parentCategory, String name, String id, int damage, int order) - throws NullPointerException; - - void addItem(String parentCategory, IItemTreeItem newItem) throws NullPointerException; - - int getKeywordDepth(String keyword); - - int getKeywordOrder(String keyword); -} diff --git a/src/api/java/invtweaks/api/IItemTreeCategory.java b/src/api/java/invtweaks/api/IItemTreeCategory.java deleted file mode 100755 index f1b5e9554..000000000 --- a/src/api/java/invtweaks/api/IItemTreeCategory.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -import java.util.Collection; -import java.util.List; - -public interface IItemTreeCategory { - boolean contains(IItemTreeItem item); - - void addCategory(IItemTreeCategory category); - - void addItem(IItemTreeItem item); - - Collection getSubCategories(); - - Collection> getItems(); - - String getName(); - - int getCategoryOrder(); - - int findCategoryOrder(String keyword); - - int findKeywordDepth(String keyword); -} diff --git a/src/api/java/invtweaks/api/IItemTreeItem.java b/src/api/java/invtweaks/api/IItemTreeItem.java deleted file mode 100755 index 2b6ae2db5..000000000 --- a/src/api/java/invtweaks/api/IItemTreeItem.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -public interface IItemTreeItem extends Comparable { - String getName(); - - String getId(); - - int getDamage(); - - int getOrder(); -} diff --git a/src/api/java/invtweaks/api/IItemTreeListener.java b/src/api/java/invtweaks/api/IItemTreeListener.java deleted file mode 100755 index 73a5815d5..000000000 --- a/src/api/java/invtweaks/api/IItemTreeListener.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -import java.util.EventListener; - -public interface IItemTreeListener extends EventListener { - void onTreeLoaded(IItemTree tree); -} diff --git a/src/api/java/invtweaks/api/InvTweaksAPI.java b/src/api/java/invtweaks/api/InvTweaksAPI.java deleted file mode 100755 index 33f259e4d..000000000 --- a/src/api/java/invtweaks/api/InvTweaksAPI.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -import invtweaks.api.container.ContainerSection; -import net.minecraft.item.ItemStack; - -/** - * Interface to access functions exposed by Inventory Tweaks - *

- * The main @Mod instance of the mod implements this interface, so a refernce to it can - * be obtained via @Instance("inventorytweaks") or methods in cpw.mods.fml.common.Loader - *

- * All of these functions currently have no effect if called on a dedicated server. - */ -public interface InvTweaksAPI { - /** - * Add a listener for ItemTree load events - * - * @param listener - */ - void addOnLoadListener(IItemTreeListener listener); - - /** - * Remove a listener for ItemTree load events - * - * @param listener - * @return true if the listener was previously added - */ - boolean removeOnLoadListener(IItemTreeListener listener); - - /** - * Toggle sorting shortcut state. - * - * @param enabled - */ - void setSortKeyEnabled(boolean enabled); - - /** - * Toggle sorting shortcut supression. - * Unlike setSortKeyEnabled, this flag is automatically cleared when GUIs are closed. - * - * @param enabled - */ - void setTextboxMode(boolean enabled); - - /** - * Compare two items using the default (non-rule based) algorithm, - * sutable for an implementation of Comparator<ItemStack>. - * - * @param i - * @param j - * @return A value with a sign representing the relative order of the item stacks - */ - int compareItems(ItemStack i, ItemStack j); - - /** - * Initiate a sort as if the player had clicked on a sorting button or pressed the sort key. - * - * @param section - * @param method - */ - void sort(ContainerSection section, SortingMethod method); -} diff --git a/src/api/java/invtweaks/api/SortingMethod.java b/src/api/java/invtweaks/api/SortingMethod.java deleted file mode 100755 index 895b1713d..000000000 --- a/src/api/java/invtweaks/api/SortingMethod.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -public enum SortingMethod { - /** Standard 'r' sorting for generic inventories */ - DEFAULT, - /** Sort method creating vertical columns of items. - * Used for chests only, requires container to have a valid row size for correct results. - */ - VERTICAL, - /** Sort method creating horizontal rows of items. - * Used for chests only, requires container to have a valid row size for correct results. - */ - HORIZONTAL, - /** Sort method for player inventory. - * Applies to extra player-specified sorting rules for the main inventory. - * Will always operate on main inventory. - */ - INVENTORY, - /** Attempts to even the number of items in each stack of the same type of item, without moving full stacks. - * Used in crafting grid sorting. - */ - EVEN_STACKS, -} diff --git a/src/api/java/invtweaks/api/container/ChestContainer.java b/src/api/java/invtweaks/api/container/ChestContainer.java deleted file mode 100755 index e505829c1..000000000 --- a/src/api/java/invtweaks/api/container/ChestContainer.java +++ /dev/null @@ -1,38 +0,0 @@ -package invtweaks.api.container; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * A marker for containers that have a chest-like persistant storage component. Enables the Inventroy Tweaks sorting - * buttons for this container. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface ChestContainer { - // Set to true if the Inventory Tweaks sorting buttons should be shown for this container. - boolean showButtons() default true; - - // Size of a chest row - int rowSize() default 9; - - // Uses 'large chest' mode for sorting buttons - // (Renders buttons vertically down the right side of the GUI) - boolean isLargeChest() default false; - - // Annotation for method to get size of a chest row if it is not a fixed size for this container class - // Signature int func() - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.METHOD) - public @interface RowSizeCallback { - } - - // Annotation for method to get size of a chest row if it is not a fixed size for this container class - // Signature int func() - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.METHOD) - public @interface IsLargeCallback { - } -} diff --git a/src/api/java/invtweaks/api/container/ContainerSection.java b/src/api/java/invtweaks/api/container/ContainerSection.java deleted file mode 100755 index 83c2e08a4..000000000 --- a/src/api/java/invtweaks/api/container/ContainerSection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api.container; - -/** - * Names for specific parts of containers. For unknown container types (such as mod containers), only INVENTORY and - * CHEST sections are available. - */ -public enum ContainerSection { - /** - * The player's inventory - */ - INVENTORY, - /** - * The player's inventory (only the hotbar) - */ - INVENTORY_HOTBAR, - /** - * The player's inventory (all except the hotbar) - */ - INVENTORY_NOT_HOTBAR, - /** - * The chest or dispenser contents. Also used for unknown container contents. - */ - CHEST, - /** - * The crafting input - */ - CRAFTING_IN, - /** - * The crafting input, for containters that store it internally - */ - CRAFTING_IN_PERSISTENT, - /** - * The crafting output - */ - CRAFTING_OUT, - /** - * The armor slots - */ - ARMOR, - /** - * The furnace input - */ - FURNACE_IN, - /** - * The furnace output - */ - FURNACE_OUT, - /** - * The furnace fuel - */ - FURNACE_FUEL, - /** - * The enchantment table slot - */ - ENCHANTMENT, - /** - * The three bottles slots in brewing tables - * NOTE: Do not use without also using BREWING_INGREDIENT. - */ - BREWING_BOTTLES, - /** - * The top slot in brewing tables - * NOTE: Do not use without also using BREWING_BOTTLES. - */ - BREWING_INGREDIENT -} diff --git a/src/api/java/invtweaks/api/container/ContainerSectionCallback.java b/src/api/java/invtweaks/api/container/ContainerSectionCallback.java deleted file mode 100755 index 379206b37..000000000 --- a/src/api/java/invtweaks/api/container/ContainerSectionCallback.java +++ /dev/null @@ -1,16 +0,0 @@ -package invtweaks.api.container; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * A marker for a method to call which returns the set of ContainerSections for this container. - *

- * Signature of the method should be Map> func() - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface ContainerSectionCallback { -} diff --git a/src/api/java/invtweaks/api/container/IgnoreContainer.java b/src/api/java/invtweaks/api/container/IgnoreContainer.java deleted file mode 100755 index 86e8aea12..000000000 --- a/src/api/java/invtweaks/api/container/IgnoreContainer.java +++ /dev/null @@ -1,15 +0,0 @@ -package invtweaks.api.container; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Use this annotation to override inherited annotation properties and mark a Container as unsortable. - * This effect is inherited as well. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface IgnoreContainer { -} diff --git a/src/api/java/invtweaks/api/container/InventoryContainer.java b/src/api/java/invtweaks/api/container/InventoryContainer.java deleted file mode 100755 index d5a45b912..000000000 --- a/src/api/java/invtweaks/api/container/InventoryContainer.java +++ /dev/null @@ -1,20 +0,0 @@ -package invtweaks.api.container; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * A marker for containers that need special treatment, such as crafting inputs or alternate player inventory positions, - * but do not have a chest-like component. - *

- * Does not enable the Inventory Tweaks sorting buttons for this container. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface InventoryContainer { - // Set to true if the Inventory Tweaks options button should be shown for this container. - // (For instance, if you are replacing a vanilla container such as the player's inventory) - boolean showOptions() default true; -} diff --git a/src/api/java/li/cil/oc/api/API.java b/src/api/java/li/cil/oc/api/API.java deleted file mode 100755 index 051bcb5d8..000000000 --- a/src/api/java/li/cil/oc/api/API.java +++ /dev/null @@ -1,25 +0,0 @@ -package li.cil.oc.api; - -import com.typesafe.config.Config; -import li.cil.oc.api.detail.*; - -/** - * Central reference for the API. - *

- * Don't use this class directly, prefer using the other classes in this - * package instead. This class is initialized by OpenComputers in the - * pre-init phase, so it should not be used before the init phase. - */ -public class API { - public static final String ID_OWNER = "OpenComputers|Core"; - public static final String VERSION = "5.5.3"; - - public static DriverAPI driver = null; - public static FileSystemAPI fileSystem = null; - public static ItemAPI items = null; - public static MachineAPI machine = null; - public static ManualAPI manual = null; - public static NetworkAPI network = null; - - public static Config config = null; -} diff --git a/src/api/java/li/cil/oc/api/CreativeTab.java b/src/api/java/li/cil/oc/api/CreativeTab.java deleted file mode 100755 index fcc395666..000000000 --- a/src/api/java/li/cil/oc/api/CreativeTab.java +++ /dev/null @@ -1,20 +0,0 @@ -package li.cil.oc.api; - -import net.minecraft.creativetab.CreativeTabs; - -/** - * Allows access to the creative tab used by OpenComputers. - */ -public final class CreativeTab { - /** - * The creative tab used by OpenComputers. - *

- * Changed to the actual tab if OC is present. Preferably you do - * not try to access this anyway when OpenComputers isn't - * present (don't ship the API in your mod), so don't rely on this! - */ - public static CreativeTabs instance = CreativeTabs.tabRedstone; - - private CreativeTab() { - } -} diff --git a/src/api/java/li/cil/oc/api/Driver.java b/src/api/java/li/cil/oc/api/Driver.java deleted file mode 100755 index eaa457729..000000000 --- a/src/api/java/li/cil/oc/api/Driver.java +++ /dev/null @@ -1,174 +0,0 @@ -package li.cil.oc.api; - -import li.cil.oc.api.driver.Block; -import li.cil.oc.api.driver.Converter; -import li.cil.oc.api.driver.EnvironmentHost; -import li.cil.oc.api.driver.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import java.util.Collection; - -/** - * This API allows registering new drivers with the mod. - *

- * Drivers are used to make items and third-party blocks available in the mod's - * component network, and optionally to user programs. If you implement a new - * block that should interact with the mod's component network it is enough to - * have it implement {@link li.cil.oc.api.network.Environment} - no driver is - * needed in that case. - *

- * Note that these methods should not be called in the pre-init phase, - * since the {@link API#driver} may not have been initialized - * at that time. Only start calling these methods in the init phase or later. - * - * @see Network - * @see Block - * @see Item - */ -public final class Driver { - /** - * Registers a new block driver. - *

- * Whenever the neighboring blocks of an Adapter block change, it checks if - * there exists a driver for the changed block, and if it is configured to - * interface that block type connects it to the component network. - *

- * This must be called in the init phase, not the pre- or post-init - * phases. - * - * @param driver the driver to register. - */ - public static void add(final Block driver) { - if (API.driver != null) - API.driver.add(driver); - } - - /** - * Registers a new item driver. - *

- * Item components can inserted into a computers component slots. They have - * to specify their type, to determine into which slots they can fit. - *

- * This must be called in the init phase, not the pre- or post-init - * phases. - * - * @param driver the driver to register. - */ - public static void add(final Item driver) { - if (API.driver != null) - API.driver.add(driver); - } - - /** - * Registers a new type converter. - *

- * Type converters are used to automatically convert values returned from - * callbacks to a "simple" format that can be pushed to any architecture. - *

- * This must be called in the init phase, not the pre- or post-init - * phases. - * - * @param converter the converter to register. - */ - public static void add(final Converter converter) { - if (API.driver != null) - API.driver.add(converter); - } - - /** - * Looks up a driver for the block at the specified position in the - * specified world. - *

- * Note that several drivers for a single block can exist. Because of this - * block drivers are always encapsulated in a 'compound' driver, which is - * what will be returned here. In other words, you should will not - * get actual instances of drivers registered via {@link #add(Block)}. - * - * @param world the world containing the block. - * @param x the X coordinate of the block. - * @param y the Y coordinate of the block. - * @param z the Z coordinate of the block. - * @return a driver for the block, or null if there is none. - */ - public static Block driverFor(World world, int x, int y, int z) { - if (API.driver != null) - return API.driver.driverFor(world, x, y, z); - return null; - } - - /** - * Looks up a driver for the specified item stack. - *

- * Note that unlike for blocks, there can always only be one item driver - * per item. If there are multiple ones, the first one that was registered - * will be used. - * - * @param stack the item stack to get a driver for. - * @param host the type that will host the environment created by returned driver. - * @return a driver for the item, or null if there is none. - */ - public static Item driverFor(ItemStack stack, Class host) { - if (API.driver != null) - return API.driver.driverFor(stack, host); - return null; - } - - /** - * Looks up a driver for the specified item stack. - *

- * Note that unlike for blocks, there can always only be one item driver - * per item. If there are multiple ones, the first one that was registered - * will be used. - *

- * This is a context-agnostic variant used mostly for "house-keeping" - * stuff, such as querying slot types and tier. - * - * @param stack the item stack to get a driver for. - * @return a driver for the item, or null if there is none. - */ - public static Item driverFor(ItemStack stack) { - if (API.driver != null) - return API.driver.driverFor(stack); - return null; - } - - /** - * Get a list of all registered block drivers. - *

- * This is intended to allow checking for particular drivers using more - * customized logic, and in particular to check for drivers with the - * {@link li.cil.oc.api.driver.EnvironmentAware} interface. - *

- * The returned collection is read-only. - * - * @return the list of all registered block drivers. - */ - public static Collection blockDrivers() { - if (API.driver != null) - return API.driver.blockDrivers(); - return null; - } - - /** - * Get a list of all registered item drivers. - *

- * This is intended to allow checking for particular drivers using more - * customized logic, and in particular to check for drivers with the - * {@link li.cil.oc.api.driver.EnvironmentAware} interface. - *

- * The returned collection is read-only. - * - * @return the list of all registered item drivers. - */ - public static Collection itemDrivers() { - if (API.driver != null) - return API.driver.itemDrivers(); - return null; - } - - // ----------------------------------------------------------------------- // - - private Driver() { - } -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/FileSystem.java b/src/api/java/li/cil/oc/api/FileSystem.java deleted file mode 100755 index c1be1020d..000000000 --- a/src/api/java/li/cil/oc/api/FileSystem.java +++ /dev/null @@ -1,297 +0,0 @@ -package li.cil.oc.api; - -import li.cil.oc.api.driver.EnvironmentHost; -import li.cil.oc.api.fs.Label; -import li.cil.oc.api.network.ManagedEnvironment; - -/** - * This class provides factory methods for creating file systems that are - * compatible with the built-in file system driver. - *

- * File systems created this way and wrapped in a managed environment via - * {@link #asManagedEnvironment} or its overloads will appear as - * filesystem components in the component network. Note that the - * component's visibility is set to Neighbors per default. If you wish - * to change the file system's visibility (e.g. like the disk drive does) you - * must cast the environment's node to {@link li.cil.oc.api.network.Component} - * and set the visibility to the desired value. - *

- * Note that these methods should not be called in the pre-init phase, - * since the {@link API#fileSystem} may not have been initialized - * at that time. Only start calling these methods in the init phase or later. - */ -public final class FileSystem { - /** - * Creates a new file system based on the location of a class. - *

- * This can be used to wrap a folder in the assets folder of your mod's JAR. - * The actual path is built like this: - *

"/assets/" + domain + "/" + root
- *

- * If the class is located in a JAR file, this will create a read-only file - * system based on that JAR file. If the class file is located in the native - * file system, this will create a read-only file system first trying from - * the actual location of the class file, and failing that by searching the - * class path (i.e. it'll look for a path constructed as described above). - *

- * If the specified path cannot be located, the creation fails and this - * returns null. - * - * @param clazz the class whose containing JAR to wrap. - * @param domain the domain, usually your mod's ID. - * @param root an optional subdirectory. - * @return a file system wrapping the specified folder. - */ - public static li.cil.oc.api.fs.FileSystem fromClass(final Class clazz, final String domain, final String root) { - if (API.fileSystem != null) - return API.fileSystem.fromClass(clazz, domain, root); - return null; - } - - /** - * Creates a new writable file system in the save folder. - *

- * This will create a folder, if necessary, and create a writable virtual - * file system based in that folder. The actual path is based in a sub- - * folder of the save folder. The actual path is built like this: - *

"saves/" + WORLD_NAME + "/opencomputers/" + root
- * The first part may differ, in particular for servers. - *

- * Usually the name will be the address of the node used to represent the - * file system. - *

- * Note that by default file systems are "buffered", meaning that any - * changes made to them are only saved to disk when the world is saved. This - * ensured that the file system contents do not go "out of sync" when the - * game crashes, but introduces additional memory overhead, since all files - * in the file system have to be kept in memory. - * - * @param root the name of the file system. - * @param capacity the amount of space in bytes to allow being used. - * @param buffered whether data should only be written to disk when saving. - * @return a file system wrapping the specified folder. - */ - public static li.cil.oc.api.fs.FileSystem fromSaveDirectory(final String root, final long capacity, final boolean buffered) { - if (API.fileSystem != null) - return API.fileSystem.fromSaveDirectory(root, capacity, buffered); - return null; - } - - /** - * Same as {@link #fromSaveDirectory(String, long, boolean)} with the - * buffered parameter being true, i.e. will always create a - * buffered file system. - * - * @param root the name of the file system. - * @param capacity the amount of space in bytes to allow being used. - * @return a file system wrapping the specified folder. - */ - public static li.cil.oc.api.fs.FileSystem fromSaveDirectory(final String root, final long capacity) { - return fromSaveDirectory(root, capacity, true); - } - - /** - * Creates a new writable file system that resides in memory. - *

- * Any contents created and written on this file system will be lost when - * the node is removed from the network. - *

- * This is used for computers' /tmp mount, for example. - * - * @param capacity the capacity of the file system. - * @return a file system residing in memory. - */ - public static li.cil.oc.api.fs.FileSystem fromMemory(final long capacity) { - if (API.fileSystem != null) - return API.fileSystem.fromMemory(capacity); - return null; - } - - /** - * Creates a new file system based on a ComputerCraft mount. - *

- * This supports read-only and writable mounts from either CC 1.5x or - * CC 1.6x. The argument is kept untyped to avoid having the OC API - * depend on the CC API. - *

- * If the passed type is unsupported, this will throw an exception. - * - * @param mount the mount to wrap with a file system. - * @return a file system wrapping the specified mount. - */ - public static li.cil.oc.api.fs.FileSystem fromComputerCraft(final Object mount) { - if (API.fileSystem != null) - return API.fileSystem.fromComputerCraft(mount); - return null; - } - - /** - * Wrap a file system retrieved via one of the from??? methods to - * make it read-only. - * - * @param fileSystem the file system to wrap. - * @return the specified file system wrapped to be read-only. - */ - public static li.cil.oc.api.fs.FileSystem asReadOnly(final li.cil.oc.api.fs.FileSystem fileSystem) { - if (API.fileSystem != null) - return API.fileSystem.asReadOnly(fileSystem); - return null; - } - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * This can be useful for providing some data if you don't wish to implement - * your own driver. Which will probably be most of the time. If you need - * more control over the node, implement your own, and connect this one to - * it. In that case you will have to forward any disk driver messages to the - * node, though. - *

- * The container parameter is used to give the file system some physical - * relation to the world, for example this is used by hard drives to send - * the disk event notifications to the client that are used to play disk - * access sounds. - *

- * The container may be null, if no such context can be provided. - *

- * The access sound is the name of the sound effect to play when the file - * system is accessed, for example by listing a directory or reading from - * a file. It may be null to create a silent file system. - *

- * The speed multiplier controls how fast read and write operations on the - * file system are. It must be a value in [1,6], and controls the access - * speed, with the default being one. - * For reference, floppies are using the default, hard drives scale with - * their tiers, i.e. a tier one hard drive uses speed two, tier three uses - * speed four. - * - * @param fileSystem the file system to wrap. - * @param label the label of the file system. - * @param host the tile entity containing the file system. - * @param accessSound the name of the sound effect to play when the file - * system is accessed. This has to be the fully - * qualified resource name, e.g. - * opencomputers:floppy_access. - * @param speed the speed multiplier for this file system. - * @return the network node wrapping the file system. - */ - public static ManagedEnvironment asManagedEnvironment(final li.cil.oc.api.fs.FileSystem fileSystem, final Label label, final EnvironmentHost host, final String accessSound, int speed) { - if (API.fileSystem != null) - return API.fileSystem.asManagedEnvironment(fileSystem, label, host, accessSound, speed); - return null; - } - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * Creates a file system with the a read-only label and the specified - * access sound and file system speed. - * - * @param fileSystem the file system to wrap. - * @param label the label of the file system. - * @param host the tile entity containing the file system. - * @param accessSound the name of the sound effect to play when the file - * system is accessed. This has to be the fully - * qualified resource name, e.g. - * opencomputers:floppy_access. - * @param speed the speed multiplier for this file system. - * @return the network node wrapping the file system. - */ - public static ManagedEnvironment asManagedEnvironment(final li.cil.oc.api.fs.FileSystem fileSystem, final String label, final EnvironmentHost host, final String accessSound, int speed) { - if (API.fileSystem != null) - return API.fileSystem.asManagedEnvironment(fileSystem, label, host, accessSound, speed); - return null; - } - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * Creates a file system with the specified label and the specified access - * sound, using the default file system speed. - * - * @param fileSystem the file system to wrap. - * @param label the label of the file system. - * @param host the tile entity containing the file system. - * @param accessSound the name of the sound effect to play when the file - * system is accessed. This has to be the fully - * qualified resource name, e.g. - * opencomputers:floppy_access. - * @return the network node wrapping the file system. - */ - public static ManagedEnvironment asManagedEnvironment(final li.cil.oc.api.fs.FileSystem fileSystem, final Label label, final EnvironmentHost host, final String accessSound) { - return asManagedEnvironment(fileSystem, label, host, accessSound, 1); - } - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * Creates a file system with a read-only label and the specified access - * sound, using the default file system speed. - * - * @param fileSystem the file system to wrap. - * @param label the read-only label of the file system. - * @param host the tile entity containing the file system. - * @param accessSound the name of the sound effect to play when the file - * system is accessed. This has to be the fully - * qualified resource name, e.g. - * opencomputers:floppy_access. - * @return the network node wrapping the file system. - */ - public static ManagedEnvironment asManagedEnvironment(final li.cil.oc.api.fs.FileSystem fileSystem, final String label, final EnvironmentHost host, final String accessSound) { - return asManagedEnvironment(fileSystem, label, host, accessSound, 1); - } - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * Creates a file system with the specified label, without an environment - * and access sound, using the default file system speed. - * - * @param fileSystem the file system to wrap. - * @param label the label of the file system. - * @return the network node wrapping the file system. - */ - public static ManagedEnvironment asManagedEnvironment(final li.cil.oc.api.fs.FileSystem fileSystem, final Label label) { - return asManagedEnvironment(fileSystem, label, null, null, 1); - } - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * Creates a file system with a read-only label, without an environment and - * access sound, using the default file system speed. - * - * @param fileSystem the file system to wrap. - * @param label the read-only label of the file system. - * @return the network node wrapping the file system. - */ - public static ManagedEnvironment asManagedEnvironment(final li.cil.oc.api.fs.FileSystem fileSystem, final String label) { - return asManagedEnvironment(fileSystem, label, null, null, 1); - } - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * Creates an unlabeled file system (i.e. the label can neither be read nor - * written), without an environment and access sound, using the default - * file system speed. - * - * @param fileSystem the file system to wrap. - * @return the network node wrapping the file system. - */ - public static ManagedEnvironment asManagedEnvironment(final li.cil.oc.api.fs.FileSystem fileSystem) { - return asManagedEnvironment(fileSystem, (Label) null, null, null, 1); - } - - // ----------------------------------------------------------------------- // - - private FileSystem() { - } -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/IMC.java b/src/api/java/li/cil/oc/api/IMC.java deleted file mode 100755 index 39beb10e3..000000000 --- a/src/api/java/li/cil/oc/api/IMC.java +++ /dev/null @@ -1,339 +0,0 @@ -package li.cil.oc.api; - -import cpw.mods.fml.common.event.FMLInterModComms; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import org.apache.commons.lang3.tuple.Pair; - -/** - * This is a pure utility class to more comfortably register things that can - * only be registered using IMC. - *

- * Use this if you have some kind of abstraction layer in place anyway, and can - * safely use the API without class not found exceptions and such, and don't - * want to put together the IMC messages manually. - *

- * This also servers to document of all IMC messages OpenComputers handles. - *

- * Feel free to copy these functions into your own code, just please don't - * copy this class while keeping the package name, to avoid conflicts if this - * class gets updated. - */ -public final class IMC { - /** - * Register a callback that is used as a filter for assembler templates. - * Any templates that require a base item that is rejected by any - * registered filter will be disabled. For example, if a filter rejects the - * computer case item stacks, robots can not be assembled. - *

- * Signature of callbacks must be: - *

-     * boolean callback(ItemStack stack)
-     * 
- *

- * Callbacks must be declared as packagePath.className.methodName. - * For example: com.example.Integration.callbackMethod. - * - * @param callback the callback to register as a filtering method. - */ - public static void registerAssemblerFilter(String callback) { - FMLInterModComms.sendMessage(MOD_ID, "registerAssemblerFilter", callback); - } - - /** - * Register a new template for the assembler. - *

- * Signature of callbacks must be: - *

-     * boolean select(ItemStack stack)
-     * Object[] validate(IInventory inventory)
-     * Object[] assemble(IInventory inventory)
-     * 
- * Values in the array returned by validate must be one of the following: - *
-     * // Valid or not.
-     * new Object[]{Boolean}
-     * // Valid or not, text for progess bar.
-     * new Object[]{Boolean, IChatComponent}
-     * // Valid or not, text for progess bar, warnings for start button tooltip (one per line).
-     * new Object[]{Boolean, IChatComponent, IChatComponent[]}
-     * 
- * Values in the array returned by assemble must be one of the following: - *
-     * // The assembled device.
-     * new Object[]{ItemStack}
-     * // The assembled device and energy cost (which also determines assembly duration).
-     * new Object[]{ItemStack, Number}
-     * 
- *

- * Callbacks must be declared as packagePath.className.methodName. - * For example: com.example.Integration.callbackMethod. - * - * @param name the name of the device created using the - * template. Optional, only used in logging. - * @param select callback used to determine if the template - * applies to a base item. For example, the robot - * template returns true from this if the passed - * item stack is a computer case. - * @param validate callback used to determine if the template - * configuration is valid. Once a template is - * valid assembly can be started, but not before. - * @param assemble callback used to apply a template and create a - * device from it. - * @param host the class of the device being assembled, i.e. - * the host class for the components being - * installed in the device. Used for filtering - * eligible components. See {@link #blacklistHost}. - * @param containerTiers the tiers of the container slots provided by the - * template. The length determines the number of - * containers. Maximum number is three. - * @param upgradeTiers the tiers of the upgrade slots provided by the - * template. The length determines the number of - * upgrades. Maximum number is nine. - * @param componentSlots the types and tiers of component slots provided by - * this template. May contain null entries - * to skip slots (slots are ordered top-to-bottom, - * left-to-right). For example, a robot template - * with only two card slots will pass null - * for the third component slot. Up to nine. - */ - public static void registerAssemblerTemplate(String name, String select, String validate, String assemble, Class host, int[] containerTiers, int[] upgradeTiers, Iterable> componentSlots) { - final NBTTagCompound nbt = new NBTTagCompound(); - if (name != null) { - nbt.setString("name", name); - } - nbt.setString("select", select); - nbt.setString("validate", validate); - nbt.setString("assemble", assemble); - if (host != null) { - nbt.setString("hostClass", host.getName()); - } - - final NBTTagList containersNbt = new NBTTagList(); - if (containerTiers != null) { - for (int tier : containerTiers) { - final NBTTagCompound slotNbt = new NBTTagCompound(); - slotNbt.setInteger("tier", tier); - containersNbt.appendTag(slotNbt); - } - } - if (containersNbt.tagCount() > 0) { - nbt.setTag("containerSlots", containersNbt); - } - - final NBTTagList upgradesNbt = new NBTTagList(); - if (upgradeTiers != null) { - for (int tier : upgradeTiers) { - final NBTTagCompound slotNbt = new NBTTagCompound(); - slotNbt.setInteger("tier", tier); - upgradesNbt.appendTag(slotNbt); - } - } - if (upgradesNbt.tagCount() > 0) { - nbt.setTag("upgradeSlots", upgradesNbt); - } - - final NBTTagList componentsNbt = new NBTTagList(); - if (componentSlots != null) { - for (Pair slot : componentSlots) { - if (slot == null) { - componentsNbt.appendTag(new NBTTagCompound()); - } else { - final NBTTagCompound slotNbt = new NBTTagCompound(); - slotNbt.setString("type", slot.getLeft()); - slotNbt.setInteger("tier", slot.getRight()); - componentsNbt.appendTag(slotNbt); - } - } - } - if (componentsNbt.tagCount() > 0) { - nbt.setTag("componentSlots", componentsNbt); - } - - FMLInterModComms.sendMessage(MOD_ID, "registerAssemblerTemplate", nbt); - } - - /** - * Register a new template for the disassembler. - *

- * The disassemble callback gets passed the item stack to - * disassemble, and a list of inferred ingredients (based on crafting - * recipes). This is useful for not having to compute those yourself when - * you just want to add a number of items from an internal inventory to - * the output (e.g. for servers it's the components in the server). - *

- * Signature of callbacks must be: - *

-     * boolean select(ItemStack stack)
-     * ItemStack[] disassemble(ItemStack stack, ItemStack[] ingredients)
-     * 
- *

- * Callbacks must be declared as packagePath.className.methodName. - * For example: com.example.Integration.callbackMethod. - * - * @param name the name of the handler (e.g. name of the item - * being handled). Optional, only used in logging. - * @param select callback used to determine if the template - * applies to an item. - * @param disassemble callback used to apply a template and extract - * ingredients from an item. - */ - public static void registerDisassemblerTemplate(String name, String select, String disassemble) { - final NBTTagCompound nbt = new NBTTagCompound(); - if (name != null) { - nbt.setString("name", name); - } - nbt.setString("select", select); - nbt.setString("disassemble", disassemble); - - FMLInterModComms.sendMessage(MOD_ID, "registerDisassemblerTemplate", nbt); - } - - /** - * Register a callback for providing tool durability information. - *

- * If your provider does not handle a tool/item, return Double.NaN - * to indicate that another provider should be queried. The first value - * that isn't NaN will be used as the durability. - *

- * The returned value must be the relative durability of the tool, - * in a range of [0,1], with 0 being broken, 1 being new/fully repaired. - *

- * Signature of callbacks must be: - *

-     * double callback(ItemStack stack)
-     * 
- *

- * Callbacks must be declared as packagePath.className.methodName. - * For example: com.example.Integration.callbackMethod. - * - * @param callback the callback to register as a durability provider. - */ - public static void registerToolDurabilityProvider(String callback) { - FMLInterModComms.sendMessage(MOD_ID, "registerToolDurabilityProvider", callback); - } - - /** - * Register a callback handling a wrench tool. - *

- * These are used when determining whether an item is a wrench tool, when - * interacting with certain blocks while the player is holding such an item, - * for example to avoid rotating blocks when opening their GUI. - *

- * The returned value must be true if the wrench was used/usable, - * false otherwise. - *

- * Signature of callbacks must be: - *

-     * boolean callback(EntityPlayer player, int x, int y, int z, boolean changeDurability)
-     * 
- *

- * Callbacks must be declared as packagePath.className.methodName. - * For example: com.example.Integration.callbackMethod. - * - * @param callback the callback to register as a wrench tool handler. - */ - public static void registerWrenchTool(String callback) { - FMLInterModComms.sendMessage(MOD_ID, "registerWrenchTool", callback); - } - - /** - * Register a handler for items that can be charged. - *

- * This is used by the charger to determine whether items can be charged - * by it (canCharge) and to actually charge them (charge). - *

- * Note that OpenComputers comes with a few built-in handlers for third- - * party charged items, such as Redstone Flux and IndustrialCraft 2. - *

- * Signature of callbacks must be: - *

-     * boolean canCharge(ItemStack stack)
-     * double charge(ItemStack stack, double amount, boolean simulate)
-     * 
- *

- * Callbacks must be declared as packagePath.className.methodName. - * For example: com.example.Integration.callbackMethod. - * - * @param name the name of the energy system/item type handled. - * @param canCharge the callback to register for checking chargeability. - * @param charge the callback to register for charging items. - */ - public static void registerItemCharge(String name, String canCharge, String charge) { - final NBTTagCompound nbt = new NBTTagCompound(); - nbt.setString("name", name); - nbt.setString("canCharge", canCharge); - nbt.setString("charge", charge); - FMLInterModComms.sendMessage(MOD_ID, "registerItemCharge", nbt); - } - - /** - * Register a provider for ink usable in the 3D printer. - *

- * Default providers in OpenComputers are one for the ink cartridges as - * well as one for arbitrary dyes (via the OreDictionary). - *

- * Use this to make other items usable as ink in the 3D printer. Return a - * value larger than zero to indicate you handled the provided item stack, - * with the value being the amount of ink provided by the stack. - *

- * Signature of callbacks must be: - *

-     * int callback(ItemStack stack)
-     * 
- *

- * Callbacks must be declared as packagePath.className.methodName. - * For example: com.example.Integration.callbackMethod. - * - * @param callback the callback to register as an ink provider. - */ - public static void registerInkProvider(String callback) { - FMLInterModComms.sendMessage(MOD_ID, "registerInkProvider", callback); - } - - /** - * Blacklist a ComputerCraft peripheral from being wrapped by OpenComputers' - * built-in driver for ComputerCraft peripherals. - *

- * Use this if you provide a driver for something that is a peripheral and - * wish to avoid conflicts in the registered callbacks, for example. - * - * @param peripheral the class of the peripheral to blacklist. - */ - public static void blacklistPeripheral(Class peripheral) { - FMLInterModComms.sendMessage(MOD_ID, "blacklistPeripheral", peripheral.getName()); - } - - /** - * Blacklist an item for a specified host. - *

- * This can be used to prevent certain components to be installed in select - * devices, via the devices class. For example, this is used to prevent - * components that would not be functional in certain devices to be - * installed in those devices, such as graphics cards in micro-controllers. - *

- * The host class is the class of the environment the component would be - * installed in, e.g. {@link li.cil.oc.api.internal.Tablet}. - * - * @param name the name of the component being blacklisted. - * @param host the class of the host to blacklist the component for. - * @param stack the item stack representing the blacklisted component. - */ - public static void blacklistHost(String name, Class host, ItemStack stack) { - final NBTTagCompound nbt = new NBTTagCompound(); - nbt.setString("name", name); - nbt.setString("host", host.getName()); - final NBTTagCompound stackNbt = new NBTTagCompound(); - stack.writeToNBT(stackNbt); - nbt.setTag("item", stackNbt); - FMLInterModComms.sendMessage(MOD_ID, "blacklistHost", nbt); - } - - // ----------------------------------------------------------------------- // - - private static final String MOD_ID = "OpenComputers"; - - private IMC() { - } -} diff --git a/src/api/java/li/cil/oc/api/Items.java b/src/api/java/li/cil/oc/api/Items.java deleted file mode 100755 index 97d976d9b..000000000 --- a/src/api/java/li/cil/oc/api/Items.java +++ /dev/null @@ -1,101 +0,0 @@ -package li.cil.oc.api; - -import li.cil.oc.api.detail.ItemInfo; -import net.minecraft.item.ItemStack; - -import java.util.concurrent.Callable; - -/** - * Access to item definitions for all blocks and items provided by - * OpenComputers. - */ -public final class Items { - /** - * Get a descriptor object for the block or item with the specified name. - *

- * The names are the same as the ones used in the recipe files. An info - * object can be used to retrieve both the block and item instance of the - * item, if available. It can also be used to create a new item stack of - * the item. - *

- * Note that these methods should not be called in the pre-init phase, - * since the {@link API#items} may not have been initialized - * at that time. Only start calling these methods in the init phase or later. - * - * @param name the name of the item to get the descriptor for. - * @return the descriptor for the item with the specified name, or - * null if there is no such item. - */ - public static ItemInfo get(String name) { - if (API.items != null) - return API.items.get(name); - return null; - } - - /** - * Get a descriptor object for the block or item represented by the - * specified item stack. - * - * @param stack the stack to get the descriptor for. - * @return the descriptor for the specified item stack, or null - * if the stack is not a valid OpenComputers item or block. - */ - public static ItemInfo get(ItemStack stack) { - if (API.items != null) - return API.items.get(stack); - return null; - } - - /** - * Register a single loot floppy disk. - *

- * The disk will be listed in the creative tab of OpenComputers. - *

- * The specified factory callable will be used to generate a new file - * system when the loot disk is used as a component. The specified name - * will be used as the label for the loot disk, as well as the identifier - * to select the corresponding factory method, so choose wisely. - *

- * To use some directory in your mod JAR as the directory provided by the - * loot disk, use {@link FileSystem#fromClass} in your callable. - * - * @param name the label and identifier to use for the loot disk. - * @param color the color of the disk, as a Minecraft color (so 0-15, - * with 0 being black, 1 red and so on). - * @param factory the callable to call for creating file system instances. - * @return an item stack representing the registered loot disk, to allow - * adding a recipe for your loot disk, for example. - */ - public static ItemStack registerFloppy(String name, int color, Callable factory) { - if (API.items != null) - return API.items.registerFloppy(name, color, factory); - return null; - } - - /** - * Register a single custom EEPROM. - *

- * The EEPROM will be listed in the creative tab of OpenComputers. - *

- * The EEPROM will be initialized with the specified code and data byte - * arrays. For script code (e.g. a Lua script) use String.getBytes("UTF-8"). - * You can omit any of the arguments by passing null. - * - * @param name the label of the EEPROM. - * @param code the code section of the EEPROM. - * @param data the data section of the EEPROM. - * @param readonly whether the code section is read-only. - * @return an item stack representing the registered EEPROM, to allow - * adding a recipe for your custom BIOS, for example. - */ - public static ItemStack registerEEPROM(String name, byte[] code, byte[] data, boolean readonly) { - if (API.items != null) - return API.items.registerEEPROM(name, code, data, readonly); - return null; - } - - // ----------------------------------------------------------------------- // - - private Items() { - } -} diff --git a/src/api/java/li/cil/oc/api/Machine.java b/src/api/java/li/cil/oc/api/Machine.java deleted file mode 100755 index 7647a659b..000000000 --- a/src/api/java/li/cil/oc/api/Machine.java +++ /dev/null @@ -1,73 +0,0 @@ -package li.cil.oc.api; - -import li.cil.oc.api.machine.Architecture; -import li.cil.oc.api.machine.MachineHost; - -import java.util.Collection; -import java.util.Collections; - -/** - * This API is intended for people who would like to implement custom computer - * blocks or anything else hosting a computer. - *

- * It also allows registering new {@link Architecture}s, - * which are implementations of specific languages (e.g. assembler). The built- - * in ones are available as static fields in this class. - *

- * Note that registration of architectures is optional and only intended as a - * convenience feature to make architectures usable via the built-in CPUs. - *

- * Note that these methods should not be called in the pre-init phase, - * since the {@link API#machine} may not have been initialized - * at that time. Only start calling these methods in the init phase or later. - */ -public final class Machine { - /** - * Register an architecture that can be used to create new machines. - *

- * Registering an architecture will make it possible to configure CPUs to - * run that architecture. This allows providing architectures without - * implementing a custom CPU item. - * - * @param architecture the architecture to register. - */ - public static void add(Class architecture) { - if (API.machine != null) - API.machine.add(architecture); - } - - /** - * A list of all registered architectures. - */ - public static Collection> architectures() { - if (API.machine != null) - return API.machine.architectures(); - return Collections.emptyList(); - } - - /** - * Creates a new machine for the specified host. - *

- * You are responsible for calling update and save / load functions on the - * machine for it to work correctly. - * - * @param host the owner object of the machine, providing context. - * @return the newly created machine. - */ - public static li.cil.oc.api.machine.Machine create(MachineHost host) { - if (API.machine != null) - return API.machine.create(host); - return null; - } - - // ----------------------------------------------------------------------- // - - private Machine() { - } - - /** - * The built-in Lua architecture. This will be set to the native Lua - * implementation when possible, to the LuaJ fallback, otherwise. - */ - public static Class LuaArchitecture = null; -} diff --git a/src/api/java/li/cil/oc/api/Manual.java b/src/api/java/li/cil/oc/api/Manual.java deleted file mode 100755 index 581bfa457..000000000 --- a/src/api/java/li/cil/oc/api/Manual.java +++ /dev/null @@ -1,184 +0,0 @@ -package li.cil.oc.api; - -import li.cil.oc.api.manual.ContentProvider; -import li.cil.oc.api.manual.ImageProvider; -import li.cil.oc.api.manual.ImageRenderer; -import li.cil.oc.api.manual.PathProvider; -import li.cil.oc.api.manual.TabIconRenderer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * This API allows interfacing with the in-game manual of OpenComputers. - *

- * It allows opening the manual at a desired specific page, as well as - * registering custom tabs and content callback handlers. - *

- * Note: this is a client side only API. It will do nothing on - * dedicated servers (i.e. API.manual will be null). - */ -public class Manual { - /** - * Register a tab to be displayed next to the manual. - *

- * These are intended to link to index pages, and for the time being there - * a relatively low number of tabs that can be displayed, so I'd ask you to - * only register as many tabs as actually, technically *needed*. Which will - * usually be one, for your main index page. - * - * @param renderer the renderer used to render the icon on your tab. - * @param tooltip the unlocalized tooltip of the tab, or null. - * @param path the path to the page to open when the tab is clicked. - */ - public static void addTab(TabIconRenderer renderer, String tooltip, String path) { - if (API.manual != null) - API.manual.addTab(renderer, tooltip, path); - } - - /** - * Register a path provider. - *

- * Path providers are used to find documentation entries for item stacks - * and blocks in the world. - * - * @param provider the provider to register. - */ - public static void addProvider(PathProvider provider) { - if (API.manual != null) - API.manual.addProvider(provider); - } - - /** - * Register a content provider. - *

- * Content providers are used to resolve paths to page content, if the - * standard system (using Minecraft's resource loading facilities) fails. - *

- * This can be useful for providing dynamic content, for example. - * - * @param provider the provider to register. - */ - public static void addProvider(ContentProvider provider) { - if (API.manual != null) - API.manual.addProvider(provider); - } - - /** - * Register an image provider. - *

- * Image providers are used to render custom content in a page. These are - * selected via the standard image tag of Markdown, based on the prefix of - * the image URL, i.e. ![tooltip](prefix:data) will select the - * image provider registered for the prefix prefix, and pass to - * it the argument data, then use the returned renderer to draw - * an element in the place of the tag. The provided prefix is expected to - * be without the colon (:). - *

- * Custom providers are only selected if a prefix is matched, otherwise - * it'll treat it as a relative path to an image to load via Minecraft's - * resource providing facilities, and display that. - * - * @param prefix the prefix on which to use the provider. - * @param provider the provider to register. - */ - public static void addProvider(String prefix, ImageProvider provider) { - if (API.manual != null) - API.manual.addProvider(prefix, provider); - } - - /** - * Get the image renderer for the specified image path. - *

- * This will look for {@link ImageProvider}s registered for a prefix in the - * specified path. If there is no match, or the matched content provider - * does not provide a renderer, this will return null. - * - * @param path the path to the image to get the renderer for. - * @return the custom renderer for that path. - */ - public static ImageRenderer imageFor(String path) { - if (API.manual != null) - return API.manual.imageFor(path); - return null; - } - - // ----------------------------------------------------------------------- // - - /** - * Look up the documentation path for the specified item stack. - * - * @param stack the stack to find the documentation path for. - * @return the path to the page, null if none is known. - */ - public static String pathFor(ItemStack stack) { - if (API.manual != null) - return API.manual.pathFor(stack); - return null; - } - - /** - * Look up the documentation for the specified block in the world. - * - * @param world the world containing the block. - * @param x the X coordinate of the block. - * @param y the Y coordinate of the block. - * @param z the Z coordinate of the block. - * @return the path to the page, null if none is known. - */ - public static String pathFor(World world, int x, int y, int z) { - if (API.manual != null) - return API.manual.pathFor(world, x, y, z); - return null; - } - - /** - * Get the content of the documentation page at the specified location. - * - * @param path the path of the page to get the content of. - * @return the content of the page, or null if none exists. - */ - public static Iterable contentFor(String path) { - if (API.manual != null) - return API.manual.contentFor(path); - return null; - } - - // ----------------------------------------------------------------------- // - - /** - * Open the manual for the specified player. - *

- * If you wish to display a specific page, call {@link #navigate(String)} - * after this function returns, with the path to the page to show. - * - * @param player the player to open the manual for. - */ - public static void openFor(EntityPlayer player) { - if (API.manual != null) - API.manual.openFor(player); - } - - /** - * Reset the history of the manual. - */ - public static void reset() { - if (API.manual != null) - API.manual.reset(); - } - - /** - * Navigate to a page in the manual. - * - * @param path the path to navigate to. - */ - public static void navigate(String path) { - if (API.manual != null) - API.manual.navigate(path); - } - - // ----------------------------------------------------------------------- // - - private Manual() { - } -} diff --git a/src/api/java/li/cil/oc/api/Network.java b/src/api/java/li/cil/oc/api/Network.java deleted file mode 100755 index f87c2ded1..000000000 --- a/src/api/java/li/cil/oc/api/Network.java +++ /dev/null @@ -1,217 +0,0 @@ -package li.cil.oc.api; - -import li.cil.oc.api.detail.Builder; -import li.cil.oc.api.network.Environment; -import li.cil.oc.api.network.Node; -import li.cil.oc.api.network.Packet; -import li.cil.oc.api.network.Visibility; -import li.cil.oc.api.network.WirelessEndpoint; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -/** - * This class provides factories for networks and nodes. - *

- * The first two functions provided provided by this API are to allow existing - * environments - implemented in a tile entity for example - to join an existing - * network or create new ones. The third one is used to create nodes that may - * then be connected to an existing network. It is not possible to create - * networks that do not belong to at least one tile entity or node. - *

- * It is important to understand that component networks only exist on the - * server side. It is impossible to create nodes, and therefore networks, on - * the client side. This is to enforce a clear distinction of where the actual - * logic lies - since user code only runs on the server. - *

- * Note that these methods should not be called in the pre-init phase, - * since the {@link API#network} may not have been initialized - * at that time. Only start calling these methods in the init phase or later. - */ -public final class Network { - /** - * Tries to add a tile entity's network node(s) at the specified coordinates - * to adjacent networks. - *

- * If the tile entity implements {@link Environment} its one node will be - * connected to any existing adjacent tile entity nodes. If none exist a - * new network with the specified tile entity's node as its sole entry. - *

- * If the tile entity is a {@link li.cil.oc.api.network.SidedEnvironment} - * the same rules as for simple environments apply, except that the - * respective for each side is used when connecting, and each side's node - * is added to its own new network, if necessary. - * - * @param tileEntity the tile entity to initialize. - */ - public static void joinOrCreateNetwork(final TileEntity tileEntity) { - if (API.network != null) - API.network.joinOrCreateNetwork(tileEntity); - } - - /** - * Creates a new network with the specified node as its initial node. - *

- * This can be used to create networks that are not bound to any tile - * entity. For example, this is used to create the internal networks of - * robots. - * - * @param node the node to create the network for. - * @throws IllegalArgumentException if the node already is in a network. - */ - public static void joinNewNetwork(final Node node) { - if (API.network != null) - API.network.joinNewNetwork(node); - } - - // ----------------------------------------------------------------------- // - - /** - * Makes a wireless endpoint join the wireless network defined by the mod. - *

- * OpenComputers tracks endpoints to which to send wireless packets sent - * via the {@link #sendWirelessPacket(WirelessEndpoint, double, Packet)} - * method. The packets will only be sent to endpoints registered - * with the network. - *

- * Important: when your endpoint is removed from the world, - * you must ensure it is also removed from the network! - * - * @param endpoint the endpoint to register with the network. - */ - public static void joinWirelessNetwork(final WirelessEndpoint endpoint) { - if (API.network != null) - API.network.joinWirelessNetwork(endpoint); - } - - /** - * Updates a wireless endpoint in the wireless network. - *

- * This is more efficient than removing and then adding the node again, as - * it only performs the update if the position significantly changed since - * the last time the position was updated (more than 0.5 along any axis). - *

- * Calling this for an endpoint that was not added before does nothing. - * - * @param endpoint the endpoint for which to update the position. - */ - public static void updateWirelessNetwork(final WirelessEndpoint endpoint) { - if (API.network != null) - API.network.updateWirelessNetwork(endpoint); - } - - /** - * Removes a wireless endpoint from the wireless network. - *

- * This must be called when an endpoint becomes invalid, otherwise it will - * remain in the network! - *

- * Calling this for an endpoint that was not added before does nothing. - * - * @param endpoint the endpoint to remove from the wireless network. - */ - public static void leaveWirelessNetwork(final WirelessEndpoint endpoint) { - if (API.network != null) - API.network.leaveWirelessNetwork(endpoint); - } - - /** - * Sends a packet via the wireless network. - *

- * This will look for all other registered wireless endpoints in range of - * the sender and submit the packets to them. Whether another end point is - * reached depends on the distance and potential obstacles between the - * sender and the receiver (harder blocks require a stronger signal to be - * penetrated). - * - * @param source the endpoint that is sending the message. - * @param strength the signal strength with which to send the packet. - * @param packet the packet to send. - */ - public static void sendWirelessPacket(final WirelessEndpoint source, final double strength, final Packet packet) { - if (API.network != null) - API.network.sendWirelessPacket(source, strength, packet); - } - - // ----------------------------------------------------------------------- // - - /** - * Factory function for creating new nodes. - *

- * Use this to create a node for your environment (e.g. tile entity). This - * will return a builder that can be used to further specialize the node, - * making it either a component node (for callbacks), a connector node - * (for power interaction) or both. - *

- * Example use: - *

-     * class YourThing extends TileEntity implements Environment {
-     *     private ComponentConnector node_ =
-     *         api.Network.newNode(this, Visibility.Network).
-     *             withComponent("your_thing").
-     *             withConnector(32).
-     *             create();
-     *
-     *     public Node node() { return node_; }
-     *
-     *     // ...
-     * }
-     * 
- *

- * Note that the reachability specified here is the general - * availability of the created node to other nodes in the network. Special - * rules apply to components, which have a visibility that is used - * to control how they can be reached from computers. For example, network - * cards have a reachability of Visibility.Network, to - * allow them to communicate with each other, but a visibility of - * Visibility.Neighbors to avoid other computers in the network - * to see the card (i.e. only the user programs running on the computer the - * card installed in can see interact with it). - * - * @param host the environment the node is created for. - * @param reachability the reachability of the node. - * @return a new node builder. - */ - public static Builder.NodeBuilder newNode(final Environment host, final Visibility reachability) { - if (API.network != null) - return API.network.newNode(host, reachability); - return null; - } - - /** - * Creates a new network packet as it would be sent or received by a - * network card. - *

- * These packets can be forwarded by switches and access points. For wired - * transmission they must be sent over a node's send method, with the - * message name being network.message. - * - * @param source the address of the sending node. - * @param destination the address of the destination, or null - * for a broadcast. - * @param port the port to send the packet to. - * @param data the payload of the packet. - * @return the new packet. - */ - public static Packet newPacket(final String source, final String destination, final int port, final Object[] data) { - if (API.network != null) - return API.network.newPacket(source, destination, port, data); - return null; - } - - /** - * Re-creates a network packet from a previously stored state. - * - * @param nbt the tag to load the packet from. - * @return the loaded packet. - */ - public static Packet newPacket(final NBTTagCompound nbt) { - if (API.network != null) - return API.network.newPacket(nbt); - return null; - } - - // ----------------------------------------------------------------------- // - - private Network() { - } -} diff --git a/src/api/java/li/cil/oc/api/Persistable.java b/src/api/java/li/cil/oc/api/Persistable.java deleted file mode 100755 index 8ad2b2a45..000000000 --- a/src/api/java/li/cil/oc/api/Persistable.java +++ /dev/null @@ -1,25 +0,0 @@ -package li.cil.oc.api; - -import net.minecraft.nbt.NBTTagCompound; - -/** - * An object that can be persisted to an NBT tag and restored back from it. - */ -public interface Persistable { - /** - * Restores a previous state of the object from the specified NBT tag. - * - * @param nbt the tag to read the state from. - */ - void load(NBTTagCompound nbt); - - /** - * Saves the current state of the object into the specified NBT tag. - *

- * This should write the state in such a way that it can be restored when - * {@link #load} is called with that tag. - * - * @param nbt the tag to save the state to. - */ - void save(NBTTagCompound nbt); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/README.md b/src/api/java/li/cil/oc/api/README.md deleted file mode 100755 index f6a454afa..000000000 --- a/src/api/java/li/cil/oc/api/README.md +++ /dev/null @@ -1,85 +0,0 @@ -The API can be used to either interact with existing implementations in OpenComputers or to implement your own extensions for OpenComputers. - -Extending OpenComputers -======================== - -Making a tile entity available as a component / peripheral --------------------------------------------------- -If you simply wish to expose a couple of methods that can be called from a computer if your tile entity's block is 'connected' to the computer, you can use the `SimpleComponent` interface. This interface serves as a marker for OpenComputers to know it has to inject code that converts your tile entity into a component using its class transformer. It is an interface instead of an annotation to allow stripping it, removing any dependencies on OpenComputers. Here is an example implementation: -```java -@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers") -public class TileEntityMyFancyThing extends TileEntity - implements SimpleComponent -{ - @Override - public String getComponentName() { - return "fancy_thing"; - } - - @Callback - @Optional.Method(modid = "OpenComputers") - public Object[] greet(Context context, Arguments args) { - return new Object[]{String.format("Hello, %s!", args.checkString(0))}; - } -} -``` - -The `getComponentName` determines with which name the tile entity will be available to computers. The `Callback` annotation tells OpenComputers to make the annotated method available to the computer. See the documentation on the `Callback` annotation for more information, in particular how it can be used to manipulate the call behavior (synchronized to the main thread vs. in the thread driving the calling computer). - -So to call the greeter method, in Lua you'd do this: -```lua -print(component.fancy_thing.greet("Steve")) -- prints "Hello, Steve!" -```` - -More control ------------- -If you really need more control over how how your tile entity interacts with OpenComputer's internal network, you will have to implement the `Environment` interface on your tile entity. There's a basic implementation in the prefab package, named `TileEntityEnvironment`. Doing so will give you access to the `Node` that connects to the component network, and you must take care of the construction of the node itself (using the factory method in `api.Network`). This allows you to make the node a `Connector` node, which will allow you to draw internal power from OpenComputers or feed energy into it. You will also be able to send messages over the component network, see the `send...` methods in the `Node` interface. See the documentation on those interfaces to get a better idea on how they work together. - -Making a third-party block available as component / peripheral --------------------------------------------------------------- -Blocks from other mods, i.e. blocks where you have no control over the tile entity implementation, can be accessed using the Adapter block as long as there is a driver available that supports the block. If there are multiple drivers they are automatically merged. Please see the [integration][] package for examples, and consider contributing any block drivers you write. Thank you! - -Making items available as components ------------------------------------- -To make items usable as components in computers, such as cards or hard drives, you have to provide a driver for that item. This means you have to implement the `driver.Item` interface on a class and register an instance of it via the `api.Driver` registry. You can base your item drivers on the `DriverItem` prefab. Please see the example project on Github for a working example, and read the documentation of the driver interface for more information. - -FileSystem API -============== -If you'd like to make some files/scripts you ship with your mod available to a computer, you can do so by wrapping those files using an OpenComputers file system. Use the factory methods in `api.FileSystem` to wrap the location your files are stored at in a file system, use the `asManagedEnvironment` methods to wrap it in a node that can be attached to the component network. For example, in an environment of a tile entity or created by an item driver you could do this in the `onConnect` method whenever a computer is connected (i.e. `node.host() instanceof Context`). Code-wise it may look something like this: -```java -public class TileEntityWithFileSystem extends TileEntityEnvironment { - private final Node fileSystem; - - public TileEntityWithFileSystem() { - node = Network.newNode(this, Visibility.Network).create(); - fileSystem = FileSystem.asManagedEnvironment(FileSystem.fromClass(getClass, "yourmodid/lua"), "my_files"); - } - - @Override - public void onConnect(final Node node) { - if (node.host() instanceof Context) { - // Attach our file system to new computers we get connected to. - // Note that this is also called for all already present computers - // when we're added to an already existing network, so we don't - // have to loop through the existing nodes manually. - node.connect(fileSystem); - } - } - - @Override - public void onDisconnect(final Node node) { - if (node.host() instanceof Context) { - // Remove our file systems when we get disconnected from a - // computer. - node.disconnect(fileSystem); - } else if (node == this.node) { - // Remove the file system if we are disconnected, because in that - // case this method is only called once. - fileSystem.node.remove(); - } - } -} -``` - - -[integration]: https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/scala/li/cil/oc/integration \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/component/Keyboard.java b/src/api/java/li/cil/oc/api/component/Keyboard.java deleted file mode 100755 index 1f793df0d..000000000 --- a/src/api/java/li/cil/oc/api/component/Keyboard.java +++ /dev/null @@ -1,47 +0,0 @@ -package li.cil.oc.api.component; - -import li.cil.oc.api.Persistable; -import li.cil.oc.api.network.Environment; -import net.minecraft.entity.player.EntityPlayer; - -/** - * This interface is implemented by the keyboard component, to allow more - * flexible use of it. - *

- * You can obtain an instance of the keyboard component via the item driver - * of the keyboard block, for example: - *

- *     final ItemStack stack = li.cil.oc.api.Items.get("keyboard").createItemStack(1);
- *     final Keyboard keyboard = (Keyboard) li.cil.oc.api.Driver.driverFor(stack).createEnvironment(stack, this);
- * 
- */ -public interface Keyboard extends Environment, Persistable { - /** - * Sets a custom usability override. - *

- * Instead of the default check, which is based on the component's owner's - * position, the specified callback will be queried for usability checks - * instead. - *

- * Pass null here to unset a previously set override. - * - * @param callback the usability checker to use. - */ - void setUsableOverride(UsabilityChecker callback); - - /** - * Contract interface that has to implemented for usability check overrides. - * - * @see #setUsableOverride(UsabilityChecker) - */ - interface UsabilityChecker { - /** - * Whether the specified keyboard is usable by the specified player. - * - * @param keyboard the keyboard to check for. - * @param player the player to check for. - * @return whether the keyboard is usable by the player. - */ - boolean isUsableByPlayer(Keyboard keyboard, EntityPlayer player); - } -} diff --git a/src/api/java/li/cil/oc/api/component/TextBuffer.java b/src/api/java/li/cil/oc/api/component/TextBuffer.java deleted file mode 100755 index 3104c90ae..000000000 --- a/src/api/java/li/cil/oc/api/component/TextBuffer.java +++ /dev/null @@ -1,582 +0,0 @@ -package li.cil.oc.api.component; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import li.cil.oc.api.Persistable; -import li.cil.oc.api.network.ManagedEnvironment; -import net.minecraft.entity.player.EntityPlayer; - -/** - * This interface implements functionality for displaying and manipulating - * text, like screens and robots. An implementation can be obtained via the - * screens' item driver. - *

- * This allows re-using the built-in screen logic in third-party code without - * access to the internals of OC. - *

- * To get an instance of the buffer component, use its item driver, e.g.: - *

- *     final ItemStack stack = li.cil.oc.api.Items.get("screen1").createItemStack(1);
- *     final TextBuffer buffer = (TextBuffer) li.cil.oc.api.Driver.driverFor(stack).createEnvironment(stack, this);
- * 
- */ -public interface TextBuffer extends ManagedEnvironment, Persistable { - /** - * Controls how much energy the buffer will consume per tick. - *

- * This is not necessarily the actual amount consumed per tick, - * instead it is a base value that cost is based on, incorporating a few - * other factors. This is the cost a tier one screen will consume if every - * character is lit (non-black). Larger buffers (i.e. buffers with a higher - * maximum resolution) cost proportionally more. - *

- * Note that this amount of energy is not necessarily subtracted each tick, - * instead every n ticks, n times the amount of energy it costs to run the - * buffer will be consumed, where n is configurable in the OC config. - *

- * This defaults to OC's built-in default value. - * - * @param value the base energy cost per tick. - * @see #getEnergyCostPerTick() - */ - void setEnergyCostPerTick(double value); - - /** - * Get the energy cost per tick. - * - * @return the base energy cost per tick. - * @see #setEnergyCostPerTick(double) - */ - double getEnergyCostPerTick(); - - /** - * Set whether the buffer is powered on. - *

- * For example, screens can be powered on and off by sending a redstone - * pulse into them, in addition to their component API. - * - * @param value whether the buffer should be on or not. - * @see #getPowerState() - */ - void setPowerState(boolean value); - - /** - * Get the current power state. - * - * @return whether the buffer is powered on. - * @see #setPowerState(boolean) - */ - boolean getPowerState(); - - /** - * Sets the maximum resolution supported by this buffer. - * - * @param width the maximum horizontal resolution, in characters. - * @param height the maximum vertical resolution, in characters. - */ - void setMaximumResolution(int width, int height); - - /** - * Get the maximum horizontal size of the buffer. - */ - int getMaximumWidth(); - - /** - * Get the maximum vertical size of the buffer. - */ - int getMaximumHeight(); - - /** - * Set the 'aspect ratio' of the buffer. - *

- * Not to be confused with the maximum resolution of the buffer, this - * refers to the 'physical' size of the buffer's container. For multi- - * block screens, for example, this is the number of horizontal and - * vertical blocks. - * - * @param width the horizontal size of the physical representation. - * @param height the vertical size of the physical representation. - */ - void setAspectRatio(double width, double height); - - /** - * Get the aspect ratio of the buffer. - *

- * Note that this is in fact width / height. - * - * @see #setAspectRatio(double, double) - */ - double getAspectRatio(); - - /** - * Set the buffer's active resolution. - * - * @param width the horizontal resolution. - * @param height the vertical resolution. - * @return true if the resolution changed. - */ - boolean setResolution(int width, int height); - - /** - * Get the current horizontal resolution. - * - * @see #setResolution(int, int) - */ - int getWidth(); - - /** - * Get the current vertical resolution. - * - * @see #setResolution(int, int) - */ - int getHeight(); - - /** - * Sets the maximum color depth supported by this buffer. - *

- * Note that this is the maximum supported depth, lower depths - * will be supported, too. So when setting this to four bit, one bit will - * be supported, too. When setting this to eight bit, four and one bit - * will be supported, also. - * - * @param depth the maximum color depth of the buffer. - */ - void setMaximumColorDepth(ColorDepth depth); - - /** - * Get the maximum color depth supported. - */ - ColorDepth getMaximumColorDepth(); - - /** - * Set the active color depth for this buffer. - * - * @param depth the new color depth. - * @return true if the color depth changed. - */ - boolean setColorDepth(ColorDepth depth); - - /** - * Get the active color depth of this buffer. - */ - ColorDepth getColorDepth(); - - /** - * Set the color of the active color palette at the specified index. - *

- * This will error if the current depth does not have a palette (one bit). - * - * @param index the index at which to set the color. - * @param color the color to set for the specified index. - */ - void setPaletteColor(int index, int color); - - /** - * Get the color in the active color palette at the specified index. - *

- * This will error if the current depth does not have a palette (one bit). - * - * @param index the index at which to get the color. - * @return the color in the active palette at the specified index. - */ - int getPaletteColor(int index); - - /** - * Set the active foreground color, not using a palette. - * - * @param color the new foreground color. - * @see #setForegroundColor(int, boolean) - */ - void setForegroundColor(int color); - - /** - * Set the active foreground color. - *

- * If the value is not from the palette, the actually stored value may - * differ from the specified one, as it is converted to the buffer's - * current color depth. - *

- * For palette-only color formats (four bit) the best fit from the palette - * is chosen, if the value is not from the palette. - * - * @param color the color or palette index. - * @param isFromPalette trueif color specifies a palette index. - */ - void setForegroundColor(int color, boolean isFromPalette); - - /** - * The active foreground color. - */ - int getForegroundColor(); - - /** - * true if the foreground color is from the color palette, meaning - * the value returned from {@link #getForegroundColor()} is the color - * palette index. - */ - boolean isForegroundFromPalette(); - - /** - * Set the active background color, not using a palette. - * - * @param color the new background color. - * @see #setBackgroundColor(int, boolean) - */ - void setBackgroundColor(int color); - - /** - * Set the active background color. - *

- * If the value is not from the palette, the actually stored value may - * differ from the specified one, as it is converted to the buffer's - * current color depth. - *

- * For palette-only color formats (four bit) the best fit from the palette - * is chosen, if the value is not from the palette. - * - * @param color the color or palette index. - * @param isFromPalette trueif color specifies a palette index. - */ - void setBackgroundColor(int color, boolean isFromPalette); - - /** - * The active background color. - */ - int getBackgroundColor(); - - /** - * true if the background color is from the color palette, meaning - * the value returned from {@link #getBackgroundColor()} is the color - * palette index. - */ - boolean isBackgroundFromPalette(); - - /** - * Copy a portion of the text buffer. - *

- * This will copy the area's text and colors. - * - * @param column the starting horizontal index of the area to copy. - * @param row the starting vertical index of the area to copy. - * @param width the width of the area to copy. - * @param height the height of the area to copy. - * @param horizontalTranslation the horizontal offset, relative to the starting column to copy the are to. - * @param verticalTranslation the vertical offset, relative to the starting row to copy the are to. - */ - void copy(int column, int row, int width, int height, int horizontalTranslation, int verticalTranslation); - - /** - * Fill a portion of the text buffer. - *

- * This will set the area's colors to the currently active ones. - * - * @param column the starting horizontal index of the area to fill. - * @param row the starting vertical index of the area to fill. - * @param width the width of the area to fill. - * @param height the height of the area to fill. - * @param value the character to fill the area with. - */ - void fill(int column, int row, int width, int height, char value); - - /** - * Write a string into the text buffer. - *

- * This will apply the currently active colors to the changed area. - * - * @param column the starting horizontal index to write at. - * @param row the starting vertical index to write at. - * @param value the string to write. - * @param vertical true if the string should be written vertically instead of horizontally. - */ - void set(int column, int row, String value, boolean vertical); - - /** - * Get the character in the text buffer at the specified location. - * - * @param column the horizontal index. - * @param row the vertical index. - * @return the character at that index. - */ - char get(int column, int row); - - /** - * Get the foreground color of the text buffer at the specified location. - *

- * Important: this may be a palette index. - * - * @param column the horizontal index. - * @param row the vertical index. - * @return the foreground color at that index. - */ - int getForegroundColor(int column, int row); - - /** - * Whether the foreground color of the text buffer at the specified - * location if from the color palette. - * - * @param column the horizontal index. - * @param row the vertical index. - * @return whether the foreground at that index is from the palette. - */ - boolean isForegroundFromPalette(int column, int row); - - /** - * Get the background color of the text buffer at the specified location. - *

- * Important: this may be a palette index. - * - * @param column the horizontal index. - * @param row the vertical index. - * @return the background color at that index. - */ - int getBackgroundColor(int column, int row); - - /** - * Whether the background color of the text buffer at the specified - * location if from the color palette. - * - * @param column the horizontal index. - * @param row the vertical index. - * @return whether the background at that index is from the palette. - */ - boolean isBackgroundFromPalette(int column, int row); - - /** - * Overwrites a portion of the text in raw mode. - *

- * This will copy the given char array into the buffer, starting at the - * specified column and row. The array is expected to be indexed row- - * first, i.e. the first dimension is the vertical axis, the second - * the horizontal. - *

- * Important: this performs no checks as to whether something - * actually changed. It will always send the changed patch to clients. - * It will also not crop the specified array to the actually used range. - * In other words, this is not intended to be exposed as-is to user code, - * it should always be called with validated, and, as necessary, cropped - * values. - * - * @param column the horizontal index. - * @param row the vertical index. - * @param text the text to write. - */ - void rawSetText(int column, int row, char[][] text); - - /** - * Overwrites a portion of the foreground color information in raw mode. - *

- * This will convert the specified RGB data (in 0xRRGGBB format) - * to the internal, packed representation and copy it into the buffer, - * starting at the specified column and row. The array is expected to be - * indexed row-first, i.e. the first dimension is the vertical axis, the - * second the horizontal. - *

- * Important: this performs no checks as to whether something - * actually changed. It will always send the changed patch to clients. - * It will also not crop the specified array to the actually used range. - * In other words, this is not intended to be exposed as-is to user code, - * it should always be called with validated, and, as necessary, cropped - * values. - * - * @param column the horizontal index. - * @param row the vertical index. - * @param color the foreground color data to write. - */ - void rawSetForeground(int column, int row, int[][] color); - - /** - * Overwrites a portion of the background color information in raw mode. - *

- * This will convert the specified RGB data (in 0xRRGGBB format) - * to the internal, packed representation and copy it into the buffer, - * starting at the specified column and row. The array is expected to be - * indexed row-first, i.e. the first dimension is the vertical axis, the - * second the horizontal. - *

- * Important: this performs no checks as to whether something - * actually changed. It will always send the changed patch to clients. - * It will also not crop the specified array to the actually used range. - * In other words, this is not intended to be exposed as-is to user code, - * it should always be called with validated, and, as necessary, cropped - * values. - * - * @param column the horizontal index. - * @param row the vertical index. - * @param color the background color data to write. - */ - void rawSetBackground(int column, int row, int[][] color); - - // ----------------------------------------------------------------------- // - - /** - * Renders the text displayed on the buffer. - *

- * You are responsible for setting up the actual context and applying any - * transformations necessary to properly position and scale the text before - * calling this. The text should be rendered on a black background. - *

- * You can use this to either render the text in a GUI or in the world. - * - * @return true if the displayed content changed since the last - * call to this method. - */ - @SideOnly(Side.CLIENT) - boolean renderText(); - - /** - * The natural width of the rendered text. - *

- * This is the width of the complete text buffer, in pixels. In other - * words, this is the width of the buffer in chars times the actual width - * of a single char in pixels. - * - * @return the total width of the rendered buffer, in pixels. - */ - @SideOnly(Side.CLIENT) - int renderWidth(); - - /** - * The natural height of the rendered text. - *

- * This is the height of the complete text buffer, in pixels. In other - * words, this is the height of the buffer in chars times the actual height - * of a single char in pixels. - * - * @return the total height of the rendered buffer, in pixels. - */ - @SideOnly(Side.CLIENT) - int renderHeight(); - - /** - * Set whether the contents of the buffer should currently be rendered. - *

- * Note that this is automatically overwritten when the buffer's power - * state changes, i.e. when it runs out of power or gets back power. - * - * @param enabled whether the text buffer should be rendered. - */ - @SideOnly(Side.CLIENT) - void setRenderingEnabled(boolean enabled); - - /** - * Gets whether the contents of the buffer should currently be rendered. - * - * @see #setRenderingEnabled(boolean) - */ - @SideOnly(Side.CLIENT) - boolean isRenderingEnabled(); - - // ----------------------------------------------------------------------- // - - /** - * Signals a key down event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will trigger a message that will be picked up by - * keyboards, which will then cause a signal in attached machines. - * - * @param character the character of the pressed key. - * @param code the key code of the pressed key. - * @param player the player that pressed the key. Pass null on the client side. - */ - void keyDown(char character, int code, EntityPlayer player); - - /** - * Signals a key up event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will trigger a message that will be picked up by - * keyboards, which will then cause a signal in attached machines. - * - * @param character the character of the released key. - * @param code the key code of the released key. - * @param player the player that released the key. Pass null on the client side. - */ - void keyUp(char character, int code, EntityPlayer player); - - /** - * Signals a clipboard paste event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will trigger a message that will be picked up by - * keyboards, which will then cause a signal in attached machines. - * - * @param value the text that was pasted. - * @param player the player that pasted the text. Pass null on the client side. - */ - void clipboard(String value, EntityPlayer player); - - /** - * Signals a mouse button down event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will cause a signal in attached machines. - * - * @param x the horizontal coordinate of the mouse, in characters. - * @param y the vertical coordinate of the mouse, in characters. - * @param button the button of the mouse that was pressed. - * @param player the player that pressed the mouse button. Pass null on the client side. - */ - void mouseDown(double x, double y, int button, EntityPlayer player); - - /** - * Signals a mouse drag event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will cause a signal in attached machines. - * - * @param x the horizontal coordinate of the mouse, in characters. - * @param y the vertical coordinate of the mouse, in characters. - * @param button the button of the mouse that is pressed. - * @param player the player that moved the mouse. Pass null on the client side. - */ - void mouseDrag(double x, double y, int button, EntityPlayer player); - - /** - * Signals a mouse button release event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will cause a signal in attached machines. - * - * @param x the horizontal coordinate of the mouse, in characters. - * @param y the vertical coordinate of the mouse, in characters. - * @param button the button of the mouse that was released. - * @param player the player that released the mouse button. Pass null on the client side. - */ - void mouseUp(double x, double y, int button, EntityPlayer player); - - /** - * Signals a mouse wheel scroll event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will cause a signal in attached machines. - * - * @param x the horizontal coordinate of the mouse, in characters. - * @param y the vertical coordinate of the mouse, in characters. - * @param delta indicates the direction of the mouse scroll. - * @param player the player that scrolled the mouse wheel. Pass null on the client side. - */ - void mouseScroll(double x, double y, int delta, EntityPlayer player); - - // ----------------------------------------------------------------------- // - - /** - * Used when setting a buffer's maximum color depth. - */ - enum ColorDepth { - /** - * Monochrome color, black and white. - */ - OneBit, - - /** - * 16 color palette, defaults to Minecraft colors. - */ - FourBit, - - /** - * 240 colors, 16 color palette, defaults to grayscale. - */ - EightBit - } -} diff --git a/src/api/java/li/cil/oc/api/component/package-info.java b/src/api/java/li/cil/oc/api/component/package-info.java deleted file mode 100755 index 615dd621d..000000000 --- a/src/api/java/li/cil/oc/api/component/package-info.java +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This package provides interfaces to allow interacting with some components. - *

- * These interfaces allow more specific interaction with some of OpenComputers' - * components, which would otherwise require reflection or linking against the - * mod itself. - */ -@cpw.mods.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Component", - apiVersion = API.VERSION) -package li.cil.oc.api.component; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/detail/Builder.java b/src/api/java/li/cil/oc/api/detail/Builder.java deleted file mode 100755 index 10affbbac..000000000 --- a/src/api/java/li/cil/oc/api/detail/Builder.java +++ /dev/null @@ -1,150 +0,0 @@ -package li.cil.oc.api.detail; - -import li.cil.oc.api.network.Component; -import li.cil.oc.api.network.ComponentConnector; -import li.cil.oc.api.network.Connector; -import li.cil.oc.api.network.Node; -import li.cil.oc.api.network.Visibility; - -/** - * Used for building {@link Node}s via {@link li.cil.oc.api.Network#newNode}. - * - * @param the type of the node created by this builder. - */ -public interface Builder { - /** - * Finalizes the construction of the node. - *

- * This performs the actual creation of the node, initializes it to the - * settings defined by the current builder and returns it. - * - * @return the final node. - */ - T create(); - - /** - * Builder for basic nodes. These nodes merely allow network access and - * take on no special role. - */ - public static interface NodeBuilder extends Builder { - /** - * Makes the node a component. - *

- * Nodes that are components can be accessed from computers, methods - * declared in them marked using the {@link li.cil.oc.api.machine.Callback} annotation can - * be invoked from computers that can see the component. - * - * @param name the name of the component. - * @param visibility the visibility of the component. - * @return a builder for a node that is also a component. - * @see li.cil.oc.api.network.Component - */ - ComponentBuilder withComponent(String name, Visibility visibility); - - /** - * Makes the node a component. - *

- * Like {@link #withComponent(String, Visibility)}, but with a default - * visibility set to the reachability of the node. - * - * @param name the name of the component. - * @return a builder for a node that is also a component. - * @see li.cil.oc.api.network.Component - */ - ComponentBuilder withComponent(String name); - - /** - * Makes the node a connector. - *

- * A connector node can feed power into the network and extract power - * from the network. This is used both for passive energy drain (such - * as running screens and computers) and for active power consumption - * (such as wireless message sending or robot actions). - * - * @param bufferSize the size of the local energy buffer. - * @return a builder for a node that is also a connector. - * @see li.cil.oc.api.network.Connector - */ - ConnectorBuilder withConnector(double bufferSize); - - /** - * Makes the node a connector. - *

- * Like {@link #withConnector(double)}, but with a default buffer size - * of zero. - * - * @return a builder for a node that is also a connector. - * @see li.cil.oc.api.network.Connector - */ - ConnectorBuilder withConnector(); - } - - /** - * Builder for component nodes. These node can be interacted with from - * computers in the same network, that can see the component. - */ - public static interface ComponentBuilder extends Builder { - /** - * Makes the node a connector. - *

- * A connector node can feed power into the network and extract power - * from the network. This is used both for passive energy drain (such - * as running screens and computers) and for active power consumption - * (such as wireless message sending or robot actions). - * - * @param bufferSize the size of the local energy buffer. - * @return a builder for a node that is also a connector. - * @see li.cil.oc.api.network.Connector - */ - ComponentConnectorBuilder withConnector(double bufferSize); - - /** - * Makes the node a connector. - *

- * Like {@link #withConnector(double)}, but with a default buffer size - * of zero. - * - * @return a builder for a node that is also a connector. - * @see li.cil.oc.api.network.Connector - */ - ComponentConnectorBuilder withConnector(); - } - - /** - * Builder for connector nodes. These nodes can interact with the energy - * stored in the network, i.e. increase or reduce it. - */ - public static interface ConnectorBuilder extends Builder { - /** - * Makes the node a component. - *

- * Nodes that are components can be accessed from computers, methods - * declared in them marked using the {@link li.cil.oc.api.machine.Callback} annotation can - * be invoked from computers that can see the component. - * - * @param name the name of the component. - * @param visibility the visibility of the component. - * @return a builder for a node that is also a component. - * @see li.cil.oc.api.network.Component - */ - ComponentConnectorBuilder withComponent(String name, Visibility visibility); - - /** - * Makes the node a component. - *

- * Like {@link #withComponent(String, Visibility)}, but with a default - * visibility set to the reachability of the node. - * - * @param name the name of the component. - * @return a builder for a node that is also a component. - * @see li.cil.oc.api.network.Component - */ - ComponentConnectorBuilder withComponent(String name); - } - - /** - * Builder for nodes that are both component and connector node. - */ - public static interface ComponentConnectorBuilder extends Builder { - } -} diff --git a/src/api/java/li/cil/oc/api/detail/DriverAPI.java b/src/api/java/li/cil/oc/api/detail/DriverAPI.java deleted file mode 100755 index 1a0d1c470..000000000 --- a/src/api/java/li/cil/oc/api/detail/DriverAPI.java +++ /dev/null @@ -1,119 +0,0 @@ -package li.cil.oc.api.detail; - -import li.cil.oc.api.driver.Block; -import li.cil.oc.api.driver.Converter; -import li.cil.oc.api.driver.EnvironmentHost; -import li.cil.oc.api.driver.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import java.util.Collection; - -public interface DriverAPI { - /** - * Registers a new driver for a block component. - *

- * Whenever the neighboring blocks of an Adapter block change, it checks if - * there exists a driver for the changed block, and if it is configured to - * interface that block type connects it to the component network. - *

- * This must be called in the init phase, not the pre- or post-init - * phases. - * - * @param driver the driver for a block component. - */ - void add(Block driver); - - /** - * Registers a new driver for an item component. - *

- * Item components can inserted into a computers component slots. They have - * to specify their type, to determine into which slots they can fit. - *

- * This must be called in the init phase, not the pre- or post-init - * phases. - * - * @param driver the driver for an item component. - */ - void add(Item driver); - - /** - * Registers a new type converter. - *

- * Type converters are used to automatically convert values returned from - * callbacks to a "simple" format that can be pushed to any architecture. - *

- * This must be called in the init phase, not the pre- or post-init - * phases. - * - * @param converter the converter to register. - */ - void add(Converter converter); - - /** - * Looks up a driver for the block at the specified position in the - * specified world. - *

- * Note that several drivers for a single block can exist. Because of this - * block drivers are always encapsulated in a 'compound' driver, which is - * what will be returned here. In other words, you should will not - * get actual instances of drivers registered via {@link #add(li.cil.oc.api.driver.Block)}. - * - * @param world the world containing the block. - * @param x the X coordinate of the block. - * @param y the Y coordinate of the block. - * @param z the Z coordinate of the block. - * @return a driver for the block, or null if there is none. - */ - Block driverFor(World world, int x, int y, int z); - - /** - * Looks up a driver for the specified item stack. - *

- * Note that unlike for blocks, there can always only be one item driver - * per item. If there are multiple ones, the first one that was registered - * will be used. - * - * @param stack the item stack to get a driver for. - * @param host the type that will host the environment created by returned driver. - * @return a driver for the item, or null if there is none. - */ - Item driverFor(ItemStack stack, Class host); - - /** - * Looks up a driver for the specified item stack. - *

- * Note that unlike for blocks, there can always only be one item driver - * per item. If there are multiple ones, the first one that was registered - * will be used. - *

- * This is a context-agnostic variant used mostly for "house-keeping" - * stuff, such as querying slot types and tier. - * - * @param stack the item stack to get a driver for. - * @return a driver for the item, or null if there is none. - */ - Item driverFor(ItemStack stack); - - /** - * Get a list of all registered block drivers. - *

- * This is intended to allow checking for particular drivers using more - * customized logic, and in particular to check for drivers with the - * {@link li.cil.oc.api.driver.EnvironmentAware} interface. - * - * @return the list of all registered block drivers. - */ - Collection blockDrivers(); - - /** - * Get a list of all registered item drivers. - *

- * This is intended to allow checking for particular drivers using more - * customized logic, and in particular to check for drivers with the - * {@link li.cil.oc.api.driver.EnvironmentAware} interface. - * - * @return the list of all registered item drivers. - */ - Collection itemDrivers(); -} diff --git a/src/api/java/li/cil/oc/api/detail/FileSystemAPI.java b/src/api/java/li/cil/oc/api/detail/FileSystemAPI.java deleted file mode 100755 index 69f06e633..000000000 --- a/src/api/java/li/cil/oc/api/detail/FileSystemAPI.java +++ /dev/null @@ -1,181 +0,0 @@ -package li.cil.oc.api.detail; - -import li.cil.oc.api.driver.EnvironmentHost; -import li.cil.oc.api.fs.FileSystem; -import li.cil.oc.api.fs.Label; -import li.cil.oc.api.network.ManagedEnvironment; - -public interface FileSystemAPI { - /** - * Creates a new file system based on the location of a class. - *

- * This can be used to wrap a folder in the assets folder of your mod's JAR. - * The actual path is built like this: - *

"/assets/" + domain + "/" + root
- *

- * If the class is located in a JAR file, this will create a read-only file - * system based on that JAR file. If the class file is located in the native - * file system, this will create a read-only file system first trying from - * the actual location of the class file, and failing that by searching the - * class path (i.e. it'll look for a path constructed as described above). - *

- * If the specified path cannot be located, the creation fails and this - * returns null. - * - * @param clazz the class whose containing JAR to wrap. - * @param domain the domain, usually your mod's ID. - * @param root an optional subdirectory. - * @return a file system wrapping the specified folder. - */ - FileSystem fromClass(Class clazz, String domain, String root); - - /** - * Creates a new writable file system in the save folder. - *

- * This will create a folder, if necessary, and create a writable virtual - * file system based in that folder. The actual path is based in a sub- - * folder of the save folder. The actual path is built like this: - *

"saves/" + WORLD_NAME + "/opencomputers/" + root
- * The first part may differ, in particular for servers. - *

- * Usually the name will be the address of the node used to represent the - * file system. - *

- * Note that by default file systems are "buffered", meaning that any - * changes made to them are only saved to disk when the world is saved. This - * ensured that the file system contents do not go "out of sync" when the - * game crashes, but introduces additional memory overhead, since all files - * in the file system have to be kept in memory. - * - * @param root the name of the file system. - * @param capacity the amount of space in bytes to allow being used. - * @param buffered whether data should only be written to disk when saving. - * @return a file system wrapping the specified folder. - */ - FileSystem fromSaveDirectory(String root, long capacity, boolean buffered); - - /** - * Creates a new writable file system that resides in memory. - *

- * Any contents created and written on this file system will be lost when - * the node is removed from the network. - *

- * This is used for computers' /tmp mount, for example. - * - * @param capacity the capacity of the file system. - * @return a file system residing in memory. - */ - FileSystem fromMemory(long capacity); - - /** - * Creates a new file system based on a read-only ComputerCraft mount. - *

- * This supports read-only and writable mounts from either CC 1.5x or - * CC 1.6x. The argument is kept untyped to avoid having the OC API - * depend on the CC API. - *

- * If the passed type is unsupported, this will return null. - * - * @param mount the mount to wrap with a file system. - * @return a file system wrapping the specified mount. - */ - FileSystem fromComputerCraft(Object mount); - - /** - * Wrap a file system retrieved via one of the from??? methods to - * make it read-only. - * - * @param fileSystem the file system to wrap. - * @return the specified file system wrapped to be read-only. - */ - FileSystem asReadOnly(final FileSystem fileSystem); - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * This can be useful for providing some data if you don't wish to implement - * your own driver. Which will probably be most of the time. If you need - * more control over the node, implement your own, and connect this one to - * it. In that case you will have to forward any disk driver messages to the - * node, though. - *

- * The container parameter is used to give the file system some physical - * relation to the world, for example this is used by hard drives to send - * the disk event notifications to the client that are used to play disk - * access sounds. - *

- * The container may be null, if no such context can be provided. - *

- * The access sound is the name of the sound effect to play when the file - * system is accessed, for example by listing a directory or reading from - * a file. It may be null to create a silent file system. - *

- * The speed multiplier controls how fast read and write operations on the - * file system are. It must be a value in [1,6], and controls the access - * speed, with the default being one. - * For reference, floppies are using the default, hard drives scale with - * their tiers, i.e. a tier one hard drive uses speed two, tier three uses - * speed four. - * - * @param fileSystem the file system to wrap. - * @param label the label of the file system. - * @param host the tile entity containing the file system. - * @param accessSound the name of the sound effect to play when the file - * system is accessed. This has to be the fully - * qualified resource name, e.g. - * opencomputers:floppy_access. - * @param speed the speed multiplier for this file system. - * @return the network node wrapping the file system. - */ - ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, Label label, EnvironmentHost host, String accessSound, int speed); - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * Creates a file system with the a read-only label and the specified - * access sound and file system speed. - * - * @param fileSystem the file system to wrap. - * @param label the read-only label of the file system. - * @param host the tile entity containing the file system. - * @param accessSound the name of the sound effect to play when the file - * system is accessed. This has to be the fully - * qualified resource name, e.g. - * opencomputers:floppy_access. - * @param speed the speed multiplier for this file system. - * @return the network node wrapping the file system. - */ - ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, String label, EnvironmentHost host, String accessSound, int speed); - - /** - * @deprecated Don't use this directly, use the wrapper in {@link li.cil.oc.api.FileSystem}. - */ - @Deprecated - ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, Label label, EnvironmentHost host, String accessSound); - - /** - * @deprecated Don't use this directly, use the wrapper in {@link li.cil.oc.api.FileSystem}. - */ - @Deprecated - ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, String label, EnvironmentHost host, String accessSound); - - /** - * @deprecated Don't use this directly, use the wrapper in {@link li.cil.oc.api.FileSystem}. - */ - @Deprecated - ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, Label label); - - /** - * @deprecated Don't use this directly, use the wrapper in {@link li.cil.oc.api.FileSystem}. - */ - @Deprecated - ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, String label); - - /** - * @deprecated Don't use this directly, use the wrapper in {@link li.cil.oc.api.FileSystem}. - */ - @Deprecated - ManagedEnvironment asManagedEnvironment(FileSystem fileSystem); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/detail/ItemAPI.java b/src/api/java/li/cil/oc/api/detail/ItemAPI.java deleted file mode 100755 index 0de2b2f3d..000000000 --- a/src/api/java/li/cil/oc/api/detail/ItemAPI.java +++ /dev/null @@ -1,76 +0,0 @@ -package li.cil.oc.api.detail; - -import li.cil.oc.api.FileSystem; -import net.minecraft.item.ItemStack; - -import java.util.concurrent.Callable; - -public interface ItemAPI { - /** - * Get a descriptor object for the block or item with the specified name. - *

- * The names are the same as the ones used in the recipe files. An info - * object can be used to retrieve both the block and item instance of the - * item, if available. It can also be used to create a new item stack of - * the item. - * - * @param name the name of the item to get the descriptor for. - * @return the descriptor for the item with the specified name, or - * null if there is no such item. - */ - ItemInfo get(String name); - - /** - * Get a descriptor object for the block or item represented by the - * specified item stack. - * - * @param stack the stack to get the descriptor for. - * @return the descriptor for the specified item stack, or null - * if the stack is not a valid OpenComputers item or block. - */ - ItemInfo get(ItemStack stack); - - /** - * Register a single loot floppy disk. - *

- * The disk will be listed in the creative tab of OpenComputers. - *

- * The specified factory callable will be used to generate a new file - * system when the loot disk is used as a component. The specified name - * will be used as the label for the loot disk, as well as the identifier - * to select the corresponding factory method, so choose wisely. - *

- * To use some directory in your mod JAR as the directory provided by the - * loot disk, use {@link FileSystem#fromClass} in your callable. - *

- * Call this in the init phase or later, not in pre-init. - * - * @param name the label and identifier to use for the loot disk. - * @param color the color of the disk, as a Minecraft color (so 0-15, - * with 0 being black, 1 red and so on). - * @param factory the callable to call for creating file system instances. - * @return an item stack representing the registered loot disk, to allow - * adding a recipe for your loot disk, for example. - */ - ItemStack registerFloppy(String name, int color, Callable factory); - - /** - * Register a single custom EEPROM. - *

- * The EEPROM will be listed in the creative tab of OpenComputers. - *

- * The EEPROM will be initialized with the specified code and data byte - * arrays. For script code (e.g. a Lua script) use String.getBytes("UTF-8"). - * You can omit any of the arguments by passing null. - *

- * Call this in the init phase or later, not in pre-init. - * - * @param name the label of the EEPROM. - * @param code the code section of the EEPROM. - * @param data the data section of the EEPROM. - * @param readonly whether the code section is read-only. - * @return an item stack representing the registered EEPROM, to allow - * adding a recipe for your custom BIOS, for example. - */ - ItemStack registerEEPROM(String name, byte[] code, byte[] data, boolean readonly); -} diff --git a/src/api/java/li/cil/oc/api/detail/ItemInfo.java b/src/api/java/li/cil/oc/api/detail/ItemInfo.java deleted file mode 100755 index 4decd85a5..000000000 --- a/src/api/java/li/cil/oc/api/detail/ItemInfo.java +++ /dev/null @@ -1,50 +0,0 @@ -package li.cil.oc.api.detail; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public interface ItemInfo { - /** - * The name of this item descriptor. - *

- * This is the name that yields this instance when passed to - * {@link li.cil.oc.api.Items#get(String)}. Useful for reverse-lookup when - * retrieving the descriptor via an item stack. - * - * @return the name of this item descriptor. - */ - String name(); - - /** - * Returns the block type of the represented item. In case the item is not - * a block this will return null. - *

- * Note that OpenComputers represents most of its items using just a few - * actual Block instances, so descriptors for different blocks may - * return the same object here. - * - * @return the block type of the represented block. - */ - Block block(); - - /** - * Returns the item type of the represented item. In case the item is a - * blocks this will return null. - *

- * Note that OpenComputers represents most of its items using just a few - * actual Item instances, so descriptors for different items may - * return the same object here. - * - * @return the item type of the represented item. - */ - Item item(); - - /** - * Creates a new item stack of the item represended by this descriptor. - * - * @param size the size of the item stack to create. - * @return the created item stack. - */ - ItemStack createItemStack(int size); -} diff --git a/src/api/java/li/cil/oc/api/detail/MachineAPI.java b/src/api/java/li/cil/oc/api/detail/MachineAPI.java deleted file mode 100755 index 282291c1a..000000000 --- a/src/api/java/li/cil/oc/api/detail/MachineAPI.java +++ /dev/null @@ -1,43 +0,0 @@ -package li.cil.oc.api.detail; - -import li.cil.oc.api.machine.Architecture; -import li.cil.oc.api.machine.Machine; -import li.cil.oc.api.machine.MachineHost; - -import java.util.Collection; - -public interface MachineAPI { - /** - * Register an architecture that can be used to create new machines. - *

- * Note that although registration is optional, it is strongly recommended - * to allow {@link #architectures()} to be useful. - * - * @param architecture the architecture to register. - * @throws IllegalArgumentException if the specified architecture is invalid. - */ - void add(Class architecture); - - /** - * A list of all registered architectures. - *

- * Note that registration is optional, although automatic when calling - * {@link #create(li.cil.oc.api.machine.MachineHost)} with a not yet - * registered architecture. What this means is that unless a mod providing - * a custom architecture also registers it, you may not see it in this list - * until it also created a new machine using that architecture. - */ - Collection> architectures(); - - /** - * Creates a new machine for the specified host. - *

- * You are responsible for calling update and save / load functions on the - * machine for it to work correctly. - * - * @param host the owner object of the machine, providing context. - * @return the newly created machine. - * @throws IllegalArgumentException if the specified architecture is invalid. - */ - Machine create(MachineHost host); -} diff --git a/src/api/java/li/cil/oc/api/detail/ManualAPI.java b/src/api/java/li/cil/oc/api/detail/ManualAPI.java deleted file mode 100755 index 0b2532c39..000000000 --- a/src/api/java/li/cil/oc/api/detail/ManualAPI.java +++ /dev/null @@ -1,136 +0,0 @@ -package li.cil.oc.api.detail; - -import li.cil.oc.api.manual.ContentProvider; -import li.cil.oc.api.manual.ImageProvider; -import li.cil.oc.api.manual.ImageRenderer; -import li.cil.oc.api.manual.PathProvider; -import li.cil.oc.api.manual.TabIconRenderer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public interface ManualAPI { - /** - * Register a tab to be displayed next to the manual. - *

- * These are intended to link to index pages, and for the time being there - * a relatively low number of tabs that can be displayed, so I'd ask you to - * only register as many tabs as actually, technically *needed*. Which will - * usually be one, for your main index page. - * - * @param renderer the renderer used to render the icon on your tab. - * @param tooltip the unlocalized tooltip of the tab, or null. - * @param path the path to the page to open when the tab is clicked. - */ - void addTab(TabIconRenderer renderer, String tooltip, String path); - - /** - * Register a path provider. - *

- * Path providers are used to find documentation entries for item stacks - * and blocks in the world. - * - * @param provider the provider to register. - */ - void addProvider(PathProvider provider); - - /** - * Register a content provider. - *

- * Content providers are used to resolve paths to page content, if the - * standard system (using Minecraft's resource loading facilities) fails. - *

- * This can be useful for providing dynamic content, for example. - * - * @param provider the provider to register. - */ - void addProvider(ContentProvider provider); - - /** - * Register an image provider. - *

- * Image providers are used to render custom content in a page. These are - * selected via the standard image tag of Markdown, based on the prefix of - * the image URL, i.e. ![tooltip](prefix:data) will select the - * image provider registered for the prefix prefix, and pass to - * it the argument data, then use the returned renderer to draw - * an element in the place of the tag. - *

- * Custom providers are only selected if a prefix is matched, otherwise - * it'll treat it as a relative path to an image to load via Minecraft's - * resource providing facilities, and display that. - * - * @param prefix the prefix on which to use the provider. - * @param provider the provider to register. - */ - void addProvider(String prefix, ImageProvider provider); - - // ----------------------------------------------------------------------- // - - /** - * Look up the documentation path for the specified item stack. - * - * @param stack the stack to find the documentation path for. - * @return the path to the page, null if none is known. - */ - String pathFor(ItemStack stack); - - /** - * Look up the documentation for the specified block in the world. - * - * @param world the world containing the block. - * @param x the X coordinate of the block. - * @param y the Y coordinate of the block. - * @param z the Z coordinate of the block. - * @return the path to the page, null if none is known. - */ - String pathFor(World world, int x, int y, int z); - - /** - * Get the content of the documentation page at the specified location. - *

- * The provided path may contain the special variable %LANGUAGE%, - * which will be resolved to the currently set language, falling back to - * en_US. - * - * @param path the path of the page to get the content of. - * @return the content of the page, or null if none exists. - */ - Iterable contentFor(String path); - - /** - * Get the image renderer for the specified image path. - *

- * This will look for {@link ImageProvider}s registered for a prefix in the - * specified path. If there is no match, or the matched content provider - * does not provide a renderer, this will return null. - * - * @param path the path to the image to get the renderer for. - * @return the custom renderer for that path. - */ - ImageRenderer imageFor(String path); - - // ----------------------------------------------------------------------- // - - /** - * Open the manual for the specified player. - *

- * If you wish to display a specific page, call {@link #navigate(String)} - * after this function returns, with the path to the page to show. - * - * @param player the player to open the manual for. - */ - void openFor(EntityPlayer player); - - /** - * Reset the history of the manual. - */ - void reset(); - - /** - * Navigate to a page in the manual. - * - * @param path the path to navigate to. - */ - void navigate(String path); -} diff --git a/src/api/java/li/cil/oc/api/detail/NetworkAPI.java b/src/api/java/li/cil/oc/api/detail/NetworkAPI.java deleted file mode 100755 index b28b82e42..000000000 --- a/src/api/java/li/cil/oc/api/detail/NetworkAPI.java +++ /dev/null @@ -1,163 +0,0 @@ -package li.cil.oc.api.detail; - -import li.cil.oc.api.network.Environment; -import li.cil.oc.api.network.Node; -import li.cil.oc.api.network.Packet; -import li.cil.oc.api.network.Visibility; -import li.cil.oc.api.network.WirelessEndpoint; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -public interface NetworkAPI { - /** - * Tries to add a tile entity's network node(s) at the specified coordinates - * to adjacent networks. - *

- * If the tile entity implements {@link Environment} its one node will be - * connected to any existing adjacent tile entity nodes. If none exist a - * new network with the specified tile entity's node as its sole entry. - *

- * If the tile entity is a {@link li.cil.oc.api.network.SidedEnvironment} - * the same rules as for simple environments apply, except that the - * respective for each side is used when connecting, and each side's node - * is added to its own new network, if necessary. - * - * @param tileEntity the tile entity to initialize. - */ - void joinOrCreateNetwork(TileEntity tileEntity); - - /** - * Creates a new network with the specified node as its initial node. - *

- * This can be used to create networks that are not bound to any tile - * entity. For example, this is used to create the internal networks of - * robots. - * - * @param node the node to create the network for. - * @throws IllegalArgumentException if the node already is in a network. - */ - void joinNewNetwork(Node node); - - // ----------------------------------------------------------------------- // - - /** - * Makes a wireless endpoint join the wireless network defined by the mod. - *

- * OpenComputers tracks endpoints to which to send wireless packets sent - * via the {@link #sendWirelessPacket(WirelessEndpoint, double, Packet)} - * method. The packets will only be sent to endpoints registered - * with the network. - *

- * Important: when your endpoint is removed from the world, - * you must ensure it is also removed from the network! - * - * @param endpoint the endpoint to register with the network. - */ - void joinWirelessNetwork(WirelessEndpoint endpoint); - - /** - * Updates a wireless endpoint in the wireless network. - *

- * This is more efficient than removing and then adding the node again, as - * it only performs the update if the position significantly changed since - * the last time the position was updated (more than 0.5 along any axis). - *

- * Calling this for an endpoint that was not added before does nothing. - * - * @param endpoint the endpoint for which to update the position. - */ - void updateWirelessNetwork(WirelessEndpoint endpoint); - - /** - * Removes a wireless endpoint from the wireless network. - *

- * This must be called when an endpoint becomes invalid, otherwise it will - * remain in the network! - *

- * Calling this for an endpoint that was not added before does nothing. - * - * @param endpoint the endpoint to remove from the wireless network. - */ - void leaveWirelessNetwork(WirelessEndpoint endpoint); - - /** - * Sends a packet via the wireless network. - *

- * This will look for all other registered wireless endpoints in range of - * the sender and submit the packets to them. Whether another end point is - * reached depends on the distance and potential obstacles between the - * sender and the receiver (harder blocks require a stronger signal to be - * penetrated). - * - * @param source the endpoint that is sending the message. - * @param strength the signal strength with which to send the packet. - * @param packet the packet to send. - */ - void sendWirelessPacket(WirelessEndpoint source, double strength, Packet packet); - - // ----------------------------------------------------------------------- // - - /** - * Factory function for creating new nodes. - *

- * Use this to create a node for your environment (e.g. tile entity). This - * will return a builder that can be used to further specialize the node, - * making it either a component node (for callbacks), a connector node - * (for power interaction) or both. - *

- * Example use: - *

-     * class YourThing extends TileEntity implements Environment {
-     *     private ComponentConnector node_ =
-     *         api.Network.newNode(this, Visibility.Network).
-     *             withComponent("your_thing").
-     *             withConnector(32).
-     *             create();
-     *
-     *     public Node node() { return node_; }
-     *
-     *     // ...
-     * }
-     * 
- *

- * Note that the reachability specified here is the general - * availability of the created node to other nodes in the network. Special - * rules apply to components, which have a visibility that is used - * to control how they can be reached from computers. For example, network - * cards have a reachability of Visibility.Network, to - * allow them to communicate with each other, but a visibility of - * Visibility.Neighbors to avoid other computers in the network - * to see the card (i.e. only the user programs running on the computer the - * card installed in can see interact with it). - * - * @param host the environment the node is created for. - * @param reachability the reachability of the node. - * @return a new node builder. - */ - Builder.NodeBuilder newNode(Environment host, Visibility reachability); - - /** - * Creates a new network packet as it would be sent or received by a - * network card. - *

- * These packets can be forwarded by switches and access points. For wired - * transmission they must be sent over a node's send method, with the - * message name being network.message. - * - * @param source the address of the sending node. - * @param destination the address of the destination, or null - * for a broadcast. - * @param port the port to send the packet to. - * @param data the payload of the packet. - * @return the new packet. - */ - Packet newPacket(String source, String destination, int port, Object[] data); - - /** - * Re-creates a network packet from a previously stored state. - * - * @param nbt the tag to load the packet from. - * @return the loaded packet. - */ - Packet newPacket(NBTTagCompound nbt); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/detail/package-info.java b/src/api/java/li/cil/oc/api/detail/package-info.java deleted file mode 100755 index d33ae2f40..000000000 --- a/src/api/java/li/cil/oc/api/detail/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * This package contains implementation detail interfaces. You will not have to - * interact with these interfaces directly (except for the Builder), - * and you particularly should not implement these interfaces yourself. - */ -package li.cil.oc.api.detail; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/driver/Block.java b/src/api/java/li/cil/oc/api/driver/Block.java deleted file mode 100755 index 895a629bf..000000000 --- a/src/api/java/li/cil/oc/api/driver/Block.java +++ /dev/null @@ -1,62 +0,0 @@ -package li.cil.oc.api.driver; - -import li.cil.oc.api.network.ManagedEnvironment; -import net.minecraft.world.World; - -/** - * Interface for block component drivers. - *

- * This driver type is used for components that are blocks, i.e. that can be - * placed in the world, but cannot be modified to or don't want to have their - * {@link net.minecraft.tileentity.TileEntity} implement one of the interfaces - * for environments ({@link li.cil.oc.api.network.Environment} or - * {@link li.cil.oc.api.network.SidedEnvironment}). - *

- * A block driver is used by Adapter blocks to check its neighbors and - * whether those neighbors should be treated as components or not. If a driver - * is present, it will be used to create a {@link ManagedEnvironment} that is - * managed by the adapter. - *

- * Note that it is possible to write one driver that supports as many different - * blocks as you wish. I'd recommend writing one per device (type), though, to - * keep things modular. - */ -public interface Block { - /** - * Used to determine the block types this driver handles. - *

- * This is used to determine which driver to use for a block placed next to - * an Adapter block. Note that the return value should not change - * over time; if it does, though, an already installed component will not - * be removed, since this value is only checked when scanning blocks. You - * can force this by sending a neighbor block change notification. - * - * @param world the world in which the block to check lives. - * @param x the X coordinate of the block to check. - * @param y the Y coordinate of the block to check. - * @param z the Z coordinate of the block to check. - * @return true if the block is supported; false otherwise. - */ - boolean worksWith(World world, int x, int y, int z); - - /** - * Create a new managed environment interfacing the specified block. - *

- * This is used to connect the component to the component network when it - * is detected next to an Adapter. Components that are not part of - * the component network probably don't make much sense (can't think of any - * uses at this time), but you may still opt to not implement this - i.e. - * it is safe to return null here. - *

- * This is expected to return a new instance each time it is - * called. The created instance's life cycle is managed by the - * Adapter block that caused its creation. - * - * @param world the world containing the block to get the environment for. - * @param x the X coordinate of the block to get the environment for. - * @param y the Y coordinate of the block to get the environment for. - * @param z the Z coordinate of the block to get the environment for. - * @return the environment for the block at that location. - */ - ManagedEnvironment createEnvironment(World world, int x, int y, int z); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/driver/Converter.java b/src/api/java/li/cil/oc/api/driver/Converter.java deleted file mode 100755 index 8eccc321c..000000000 --- a/src/api/java/li/cil/oc/api/driver/Converter.java +++ /dev/null @@ -1,30 +0,0 @@ -package li.cil.oc.api.driver; - -import java.util.Map; - -/** - * A converter is a callback that can be used to transparently convert Java - * types to something that can be pushed to a machine's architecture. - *

- * Note that converters operating on the same object type may override each - * other when using the same keys in the resulting Map. The order in - * which converters are called depends on the order they were registered in. - */ -public interface Converter { - /** - * Converts a type to a Map. - *

- * The keys and values in the resulting map will be converted in turn. - * If after those conversions the map still contains unsupported values, - * they will not be retained. - *

- * The conversion result should be placed into the the passed map, i.e. the - * map will represent the original object. For example, if the value had a - * field name, add a key name to the map with the value - * of that field. - * - * @param value the value to convert. - * @param output the map conversion results are accumulated into. - */ - void convert(Object value, Map output); -} diff --git a/src/api/java/li/cil/oc/api/driver/EnvironmentAware.java b/src/api/java/li/cil/oc/api/driver/EnvironmentAware.java deleted file mode 100755 index 340d8a73e..000000000 --- a/src/api/java/li/cil/oc/api/driver/EnvironmentAware.java +++ /dev/null @@ -1,37 +0,0 @@ -package li.cil.oc.api.driver; - -import li.cil.oc.api.network.Environment; -import net.minecraft.item.ItemStack; - -/** - * This interface can be added to either item or block drivers. - *

- * It is used to statically query the type of environment that would be created - * for the block or item represented by an item stack. This is used to provide - * automatically generated ingame help in the NEI usage screen, for example. - *

- * For item drivers this will usually be pretty simple to implement, assuming - * the driver only ever generates one type of environment - just return the - * class of it and you're done. - *

- * For block drivers there is a bit more work involved, since you have to check - * if the item is the item block that corresponds to the supported block type. - * This should usually not be an issue either, though. - */ -public interface EnvironmentAware { - /** - * Get the type of environment that would be created for the specified - * block or item. - *

- * Note that for block drivers this is called for any type of item stack. - *

- * For item drivers this is only called if {@link Item#worksWith(ItemStack)} - * returns true. - * - * @param stack the item stack representing a block or item to get the - * related environment type for. - * @return the type of environment this driver would produce, or - * null if the block or item is not supported. - */ - Class providedEnvironment(ItemStack stack); -} diff --git a/src/api/java/li/cil/oc/api/driver/EnvironmentHost.java b/src/api/java/li/cil/oc/api/driver/EnvironmentHost.java deleted file mode 100755 index 505068131..000000000 --- a/src/api/java/li/cil/oc/api/driver/EnvironmentHost.java +++ /dev/null @@ -1,52 +0,0 @@ -package li.cil.oc.api.driver; - -import net.minecraft.world.World; - -/** - * To be implemented by 'hosts' of components. - *

- * This is what's passed to drivers as the host when creating an environment. - * It is generally used to represent the components' location in the world. - *

- * You will only need to implement this if you intend to host components, e.g. - * by providing a custom computer case or such. In OpenComputers this interface - * is usually implemented directly by the tile entities acting as the host, so - * in most cases you should be able to cast this to TileEntity for - * more options, if necessary. - */ -public interface EnvironmentHost { - /** - * The world the container lives in. - */ - World world(); - - /** - * The container's X position in the world. - *

- * For tile entities this is the centered position. For example, - * if the tile entity is located at (0, 2, 3) this will be 0.5. - */ - double xPosition(); - - /** - * The container's Y position in the world. - *

- * For tile entities this is the centered position. For example, - * if the tile entity is located at (0, 2, 3) this will be 2.5. - */ - double yPosition(); - - /** - * The container's Z position in the world. - *

- * For tile entities this is the centered position. For example, - * if the tile entity is located at (0, 2, 3) this will be 3.5. - */ - double zPosition(); - - /** - * Marks the container as "changed" so that it knows it has to be saved - * again in the next world save. - */ - void markChanged(); -} diff --git a/src/api/java/li/cil/oc/api/driver/Item.java b/src/api/java/li/cil/oc/api/driver/Item.java deleted file mode 100755 index 6ad94678e..000000000 --- a/src/api/java/li/cil/oc/api/driver/Item.java +++ /dev/null @@ -1,114 +0,0 @@ -package li.cil.oc.api.driver; - -import li.cil.oc.api.network.ManagedEnvironment; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -/** - * Interface for item component drivers. - *

- * This driver type is used for components that are items, i.e. that can be - * inserted into computers and robots. An example for this are internal drives, - * memory and graphic cards. - *

- * When trying to add an item to a computer the list of registered drivers is - * queried using the drivers' worksWith functions. The first driver - * that replies positively and whose check against the slot type is successful, - * i.e. for which the slot matches the slot it should be inserted into, - * will be used as the component's driver and the component will be added. If no - * driver is found the item will be rejected and cannot be installed. - *

- * Note that it is possible to write one driver that supports as many different - * items as you wish. I'd recommend writing one per device (type), though, to - * keep things modular. - */ -public interface Item { - /** - * Used to determine the item types this driver handles. - *

- * This is used to determine which driver to use for an item when it should - * be installed in a computer. Note that the return value should not change - * over time; if it does, though, an already installed component will not - * be ejected, since this value is only checked when adding components. - *

- * This is a context-agnostic variant used mostly for "house-keeping" - * stuff, such as querying slot types and tier. - * - * @param stack the item to check. - * @return true if the item is supported; false otherwise. - */ - boolean worksWith(ItemStack stack); - - /** - * Create a new managed environment interfacing the specified item. - *

- * This is used to connect the component to the component network when it is - * added to a computer, for example. The only kind of component that does - * not need to be connected to the component network is probably memory, and - * there's a built-in driver for that. You may still opt to not implement - * this - i.e. it is safe to return null here. - *

- * Keep in mind that the host's location may change if the owner is - * a robot. This is important if you cache the location somewhere. For - * example, the wireless network card checks in a robot movement event - * handler for position changes to update the index structure used for - * receiver look-up. - *

- * This is expected to return a new instance each time it is - * called. The created instance's life cycle is managed by the host - * that caused its creation. - * - * @param stack the item stack for which to get the environment. - * @param host the host the environment will be managed by. - * @return the environment for that item. - */ - ManagedEnvironment createEnvironment(ItemStack stack, EnvironmentHost host); - - /** - * The slot type of the specified item this driver supports. - *

- * This is used to determine into which slot of a computer the components - * this driver supports may go. This will only be called if a previous call - * to {@link #worksWith} with the same stack returned true. - * - * @param stack the item stack to get the slot type for. - * @return the slot type of the specified item. - * @see li.cil.oc.api.driver.item.Slot - */ - String slot(ItemStack stack); - - /** - * The tier of the specified item this driver supports. - *

- * This is used to determine into which slot of a computer the components - * this driver supports may go. This will only be called if a previous call - * to {@link #worksWith} with the same stack returned true. - *

- * Important: tiers are zero-indexed. - * - * @param stack the item stack to get the tier for. - * @return the tier of the specified item. - */ - int tier(ItemStack stack); - - /** - * Get the tag compound based on the item stack to use for persisting the - * environment associated with the specified item stack. - *

- * This is only used if the item has an environment. This must always be a - * child tag of the item stack's own tag compound, it will not be saved - * otherwise. Use this in the unlikely case that the default name collides - * with something. The built-in components use a child tag-compound with - * the name oc:data, which will also be used if this returns - * null. - *

- * This tag will be passed to the environment's save and - * load methods when appropriate (world save / load and when - * removed from their hosting inventory). - * - * @param stack the item to get the child tag from. - * @return the tag to use for saving and loading, or null to use - * the default tag oc:data. - */ - NBTTagCompound dataTag(ItemStack stack); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/driver/MethodWhitelist.java b/src/api/java/li/cil/oc/api/driver/MethodWhitelist.java deleted file mode 100755 index 0bb8814c5..000000000 --- a/src/api/java/li/cil/oc/api/driver/MethodWhitelist.java +++ /dev/null @@ -1,34 +0,0 @@ -package li.cil.oc.api.driver; - -/** - * This interface can be implemented by environments to enforce a method - * whitelist. - *

- * When drivers are collected for a block, they are combined into a compound - * driver. This compound driver will in turn generate a compound environment - * that wraps the contributing environments. Which in turn results in the - * block's component containing the list of methods from all drivers that apply - * to the block. - *

- * In some scenarios you may not want this to happen. Instead, only a select - * list of methods should be shown for a block - for example, you may want to - * suppress inventory functionality if your TileEntity implements IInventory. - *

- * To do so, implement this interface in the environment that you - * return from your driver's {@link Block#createEnvironment(net.minecraft.world.World, int, int, int)} - * method, and provide the names of the allowed methods from {@link #whitelistedMethods()}. - *

- * Important: if multiple drivers apply to a single block that each - * provide a whitelist, the list of allowed methods is the intersection of the - * different whitelists! - */ -public interface MethodWhitelist { - /** - * The list of methods allowed to be exposed for blocks this driver is used - * for. Note that the names must exactly match the names of the - * methods they allow. - * - * @return the list of allowed methods. - */ - String[] whitelistedMethods(); -} diff --git a/src/api/java/li/cil/oc/api/driver/NamedBlock.java b/src/api/java/li/cil/oc/api/driver/NamedBlock.java deleted file mode 100755 index f604c7683..000000000 --- a/src/api/java/li/cil/oc/api/driver/NamedBlock.java +++ /dev/null @@ -1,36 +0,0 @@ -package li.cil.oc.api.driver; - -/** - * This interface can be added to environments generated by block - * drivers to provide a 'preferred name' in case the driver is merged with - * other block drivers (interface based drivers such as for IInventory). - *

- * This was previously to be implemented on the driver itself, but that has been - * deprecated. Implement it in the environment returned from the block driver's - * {@link Block#createEnvironment(net.minecraft.world.World, int, int, int)} - * method instead. - */ -public interface NamedBlock { - /** - * The preferred name, in case the driver is merged with others. - * - * @return the preferred name. - */ - String preferredName(); - - /** - * This is used to determine which name to use in case multiple - * environments with this interface are merged. - *

- * If multiple named environments are merged the name of the environment - * with the highest priority is selected. Negative values are - * allowed. The recommended default value is therefore zero. - *

- * If multiple environments with the same priority exist, the - * result is unspecified. It will usually result in the environment - * of the driver that was registered first. - * - * @return the priority with which to use this name. - */ - int priority(); -} diff --git a/src/api/java/li/cil/oc/api/driver/item/Chargeable.java b/src/api/java/li/cil/oc/api/driver/item/Chargeable.java deleted file mode 100755 index 38e7cbe61..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/Chargeable.java +++ /dev/null @@ -1,36 +0,0 @@ -package li.cil.oc.api.driver.item; - -import net.minecraft.item.ItemStack; - -/** - * This interface can be implemented on items that go into a charger. - *

- * This provides a generic way of charging items, even such that are not - * components. Doing it this way enables items to provide another environment, - * that is unrelated to charging, such as tablets providing their file system, - * while in the charger. - */ -public interface Chargeable { - /** - * Whether the specified item stack can be charged. - *

- * This is primarily meant to filter meta item subitems that are not meant - * to be chargeable. - * - * @param stack the stack to check for. - * @return whether the specified item stack is chargeable. - */ - boolean canCharge(ItemStack stack); - - /** - * Called when checking if an item can be charged or should be charged. - *

- * To discharge an item, pass a negative value. - * - * @param stack the item to charge. - * @param amount the amount to inject into the item. - * @param simulate whether to only simulate injection. - * @return the remainder of the energy that could not be injected/extracted. - */ - double charge(ItemStack stack, double amount, boolean simulate); -} diff --git a/src/api/java/li/cil/oc/api/driver/item/Container.java b/src/api/java/li/cil/oc/api/driver/item/Container.java deleted file mode 100755 index dae5b8e00..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/Container.java +++ /dev/null @@ -1,39 +0,0 @@ -package li.cil.oc.api.driver.item; - -import li.cil.oc.api.driver.Item; -import net.minecraft.item.ItemStack; - -/** - * May be implemented by drivers for robot upgrades that act as hotswap bays, - * i.e. which can be installed into the 'dynamic' slots, and provide on-the-fly - * changeable upgrade slots (i.e. which can be changed in the robot GUI, - * without disassembling and re-assembling the robot). - *

- * These drivers will not be queried for environments. The reported tier is the - * maximum tier supported in the dynamic slot they provide. - */ -public interface Container extends Item { - /** - * The type of slot provided as the dynamic slot. This will usually be - * for other upgrades, but may be for any type of item component. - *

- * While the driver's own type implicitly has to be 'Container' and could - * therefore be used instead, this makes the intention more clear. - * - * @param stack the item stack to get the provided slot type for. - * @return the slot type provided by that dynamic slot upgrade. - * @see Slot - */ - String providedSlot(ItemStack stack); - - /** - * The maximum item tier of the items that can be placed into the slot - * provided by the specified container. - *

- * This will usually be equal to the container's tier. - * - * @param stack the item stack to the the supported tier for. - * @return the maximum tier supported by that dynamic slot upgrade. - */ - int providedTier(ItemStack stack); -} diff --git a/src/api/java/li/cil/oc/api/driver/item/HostAware.java b/src/api/java/li/cil/oc/api/driver/item/HostAware.java deleted file mode 100755 index 2a47a2b15..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/HostAware.java +++ /dev/null @@ -1,28 +0,0 @@ -package li.cil.oc.api.driver.item; - -import li.cil.oc.api.driver.EnvironmentHost; -import li.cil.oc.api.driver.Item; -import net.minecraft.item.ItemStack; - -/** - * This interface can be added to item drivers to allow them to be picky - * about their supported host environment. - *

- * This is useful for drivers for components that should only go into certain - * environments, such as robot specific upgrades. - */ -public interface HostAware extends Item { - /** - * Used to determine the item types this driver handles. - *

- * This is used to determine which driver to use for an item when it should - * be installed in a computer. Note that the return value should not change - * over time; if it does, though, an already installed component will not - * be ejected, since this value is only checked when adding components. - * - * @param stack the item to check. - * @param host the type of host the environment would live in. - * @return true if the item is supported; false otherwise. - */ - boolean worksWith(ItemStack stack, Class host); -} diff --git a/src/api/java/li/cil/oc/api/driver/item/Inventory.java b/src/api/java/li/cil/oc/api/driver/item/Inventory.java deleted file mode 100755 index 2e0eff061..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/Inventory.java +++ /dev/null @@ -1,21 +0,0 @@ -package li.cil.oc.api.driver.item; - -import li.cil.oc.api.driver.Item; -import net.minecraft.item.ItemStack; - -/** - * This interface marks drivers for robot upgrades that provide inventory - * space to the robot. Note that this is only queried upon robot assembly, - * after that the inventory is fixed! This in particular means that there - * can be no hot-swappable inventories - at least none that are represented - * in the GUI. - */ -public interface Inventory extends Item { - /** - * The additional amount of inventory space the specified item provides. - * - * @param stack the item to get the provided inventory space for. - * @return the provided inventory space. - */ - int inventoryCapacity(ItemStack stack); -} diff --git a/src/api/java/li/cil/oc/api/driver/item/Memory.java b/src/api/java/li/cil/oc/api/driver/item/Memory.java deleted file mode 100755 index 638971e40..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/Memory.java +++ /dev/null @@ -1,26 +0,0 @@ -package li.cil.oc.api.driver.item; - -import li.cil.oc.api.driver.Item; -import net.minecraft.item.ItemStack; - -/** - * Use this interface to implement item drivers extending the memory of a computer. - *

- * Note that the item must be installed in the actual computer's inventory to - * work. If it is installed in an external inventory the computer will not - * recognize the memory. - */ -public interface Memory extends Item { - /** - * The amount of RAM this component provides, as a generic scaling factor. - *

- * This factor has to be interpreted by each individual architecture to fit - * its own memory needs. The actual values returned here should roughly be - * equivalent to the item's tier. For example, the built-in memory modules - * provide 1 for tier one, 2 for tier 1.5, 3 for tier 2, etc. - * - * @param stack the item to get the provided memory for. - * @return the amount of memory the specified component provides. - */ - double amount(ItemStack stack); -} diff --git a/src/api/java/li/cil/oc/api/driver/item/Processor.java b/src/api/java/li/cil/oc/api/driver/item/Processor.java deleted file mode 100755 index f222b66cc..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/Processor.java +++ /dev/null @@ -1,37 +0,0 @@ -package li.cil.oc.api.driver.item; - -import li.cil.oc.api.driver.Item; -import li.cil.oc.api.machine.Architecture; -import net.minecraft.item.ItemStack; - -/** - * Use this interface to implement item drivers extending the number of - * components a server can control. - *

- * Note that the item must be installed in the actual server's inventory to - * work. If it is installed in an external inventory the server will not - * recognize the memory. - */ -public interface Processor extends Item { - /** - * The additional number of components supported if this processor is - * installed in the server. - * - * @param stack the processor to get the number of supported components for. - * @return the number of additionally supported components. - */ - int supportedComponents(ItemStack stack); - - /** - * The architecture of this CPU. - *

- * This usually controls which architecture is created for a machine the - * CPU is installed in (this is true for all computers built into OC, such - * as computer cases, server racks and robots, it my not be true for third- - * party computers). - * - * @param stack the stack representing the CPU to get the architecture for. - * @return the type of this CPU's architecture. - */ - Class architecture(ItemStack stack); -} diff --git a/src/api/java/li/cil/oc/api/driver/item/Slot.java b/src/api/java/li/cil/oc/api/driver/item/Slot.java deleted file mode 100755 index 3e19fc805..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/Slot.java +++ /dev/null @@ -1,22 +0,0 @@ -package li.cil.oc.api.driver.item; - -/** - * Reference list of slot types in OpenComputers. - */ -public final class Slot { - public static final String None = "none"; - public static final String Any = "any"; - - public static final String Card = "card"; - public static final String ComponentBus = "component_bus"; - public static final String Container = "container"; - public static final String CPU = "cpu"; - public static final String Floppy = "floppy"; - public static final String HDD = "hdd"; - public static final String Memory = "memory"; - public static final String Tablet = "tablet"; - public static final String Upgrade = "upgrade"; - - private Slot() { - } -} diff --git a/src/api/java/li/cil/oc/api/driver/item/UpgradeRenderer.java b/src/api/java/li/cil/oc/api/driver/item/UpgradeRenderer.java deleted file mode 100755 index ec1e0201c..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/UpgradeRenderer.java +++ /dev/null @@ -1,95 +0,0 @@ -package li.cil.oc.api.driver.item; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import li.cil.oc.api.event.RobotRenderEvent; -import li.cil.oc.api.internal.Robot; -import net.minecraft.item.ItemStack; - -import java.util.Set; - -/** - * This interface can be implemented by items to allow custom rendering of - * upgrades installed in robots. - *

- * Upgrades installed in a robot can have an external representation. This is - * achieved by implementing this interface on an item that serves as a - * renderable upgrade. When the robot is rendered, each equipped upgrade is - * checked for this interface, and if present, the {@link #render} method - * is called. - *

- * Note that these methods are only ever called on the client side. - */ -public interface UpgradeRenderer { - /** - * Returns which mount point this renderer wants to render the specified - * upgrade in. - *

- * This method is used to determine which upgrade is rendered where, and is - * called for every installed, renderable upgrade. The available mount - * point names are defined in {@link MountPointName}, with the two special - * values None and Any. - *

- * None means that the upgrade should not be rendered at all. This - * can be the case when there is no slot remaining that the upgrade may be - * rendered in. Returning null is equivalent to returning None. - *

- * Any means that the upgrade doesn't really care where it's being - * rendered. Mount points not assigned by another upgrade preferring to be - * rendered in it will be assigned to such upgrades in the order they are - * installed in the robot. - *

- * Returning a mount point not in the list of available mount points will - * be equivalent to returning None. - * - * @param stack the item stack of the upgrade to render. - * @param robot the robot the upgrade is rendered on. - * @param availableMountPoints the mount points available for rendering in. - * @return the mount point to reserve for the upgrade. - */ - String computePreferredMountPoint(ItemStack stack, Robot robot, Set availableMountPoints); - - /** - * Render the specified upgrade on a robot. - *

- * The GL state has not been adjusted to the mount points position, so - * that you can perform rotations without having to revert the translation. - * It is your responsibility to position the rendered model to fit the - * specified mount point. The state will be such that the origin is the - * center of the robot. This is what the offset of the mount-point is - * relative to. - *

- * If the stack cannot be rendered, the renderer should indicate so in - * {@link #computePreferredMountPoint}, otherwise it will still consume a mount - * point. - *

- * You usually won't need the robot parameter, but in case you do - * need some contextual information, this should provide you with anything - * you could need. - * - * @param stack the item stack of the upgrade to render. - * @param mountPoint the mount-point to render the upgrade at. - * @param robot the robot the upgrade is rendered on. - * @param pt partial tick time, e.g. for animations. - */ - void render(ItemStack stack, RobotRenderEvent.MountPoint mountPoint, Robot robot, float pt); - - /** - * Mount point names for {@link #computePreferredMountPoint}. - */ - final class MountPointName { - public static final String None = "none"; - public static final String Any = "any"; - - public static final String TopLeft = "top_left"; - public static final String TopRight = "top_right"; - public static final String TopBack = "top_back"; - public static final String BottomLeft = "bottom_left"; - public static final String BottomRight = "bottom_right"; - public static final String BottomBack = "bottom_back"; - public static final String BottomFront = "bottom_front"; - - private MountPointName() { - } - } -} diff --git a/src/api/java/li/cil/oc/api/driver/item/package-info.java b/src/api/java/li/cil/oc/api/driver/item/package-info.java deleted file mode 100755 index 6c2d9fc02..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/package-info.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This package contains item driver related interfaces. - *

- * These interfaces allow specializing item drivers to provide static data, - * that is without creating an actual environment. - */ -@cpw.mods.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Driver|Item", - apiVersion = API.VERSION) -package li.cil.oc.api.driver.item; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/driver/package-info.java b/src/api/java/li/cil/oc/api/driver/package-info.java deleted file mode 100755 index 168e5d364..000000000 --- a/src/api/java/li/cil/oc/api/driver/package-info.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This package contains driver related interfaces. - *

- * Drivers are used to add items and third party blocks to the internal network, - * which is mostly used to make components wrapping them available to computers. - */ -@cpw.mods.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Driver", - apiVersion = API.VERSION) -package li.cil.oc.api.driver; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/event/FileSystemAccessEvent.java b/src/api/java/li/cil/oc/api/event/FileSystemAccessEvent.java deleted file mode 100755 index 97d0518af..000000000 --- a/src/api/java/li/cil/oc/api/event/FileSystemAccessEvent.java +++ /dev/null @@ -1,175 +0,0 @@ -package li.cil.oc.api.event; - -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; -import li.cil.oc.api.network.Node; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -/** - * Events for handling file system access and representing it on the client. - *

- * This is used to play file system access sounds and render disk activity - * indicators on some containers (e.g. disk drive, computer, server). - *

- * Use this to implement rendering of disk access indicators on you own - * containers / computers / drive bays. - *

- * Canceling this event is provided to allow registering higher priority - * event handlers that override default behavior. - */ -@Cancelable -public class FileSystemAccessEvent extends Event { - protected String sound; - - protected World world; - - protected double x; - - protected double y; - - protected double z; - - protected TileEntity tileEntity; - - protected NBTTagCompound data; - - /** - * Constructor for tile entity hosted file systems. - * - * @param sound the name of the sound effect to play. - * @param tileEntity the tile entity hosting the file system. - * @param data the additional data. - */ - protected FileSystemAccessEvent(String sound, TileEntity tileEntity, NBTTagCompound data) { - this.sound = sound; - this.world = tileEntity.getWorldObj(); - this.x = tileEntity.xCoord + 0.5; - this.y = tileEntity.yCoord + 0.5; - this.z = tileEntity.zCoord + 0.5; - this.tileEntity = tileEntity; - this.data = data; - } - - /** - * Constructor for arbitrarily hosted file systems. - * - * @param sound the name of the sound effect to play. - * @param world the world the file system lives in. - * @param x the x coordinate of the file system's container. - * @param y the y coordinate of the file system's container. - * @param z the z coordinate of the file system's container. - * @param data the additional data. - */ - protected FileSystemAccessEvent(String sound, World world, double x, double y, double z, NBTTagCompound data) { - this.sound = sound; - this.world = world; - this.x = x; - this.y = y; - this.z = z; - this.tileEntity = null; - this.data = data; - } - - /** - * The name of the sound effect to play for the file system. - */ - public String getSound() { - return sound; - } - - /** - * The world the file system lives in. - */ - public World getWorld() { - return world; - } - - /** - * The x coordinate of the file system's container. - */ - public double getX() { - return x; - } - - /** - * The y coordinate of the file system's container. - */ - public double getY() { - return y; - } - - /** - * The z coordinate of the file system's container. - */ - public double getZ() { - return z; - } - - /** - * The tile entity hosting the file system. - *

- * Important: this can be null, which is usually the - * case when the container is an entity or item. - */ - public TileEntity getTileEntity() { - return tileEntity; - } - - /** - * Addition custom data, this is used to transmit the number of the server - * in a server rack the file system lives in, for example. - */ - public NBTTagCompound getData() { - return data; - } - - public static final class Server extends FileSystemAccessEvent { - private Node node; - - public Server(String sound, TileEntity tileEntity, Node node) { - super(sound, tileEntity, new NBTTagCompound()); - this.node = node; - } - - public Server(String sound, World world, double x, double y, double z, Node node) { - super(sound, world, x, y, z, new NBTTagCompound()); - this.node = node; - } - - /** - * The node of the file system that signalled activity. - */ - public Node getNode() { - return node; - } - } - - public static final class Client extends FileSystemAccessEvent { - /** - * Constructor for tile entity hosted file systems. - * - * @param sound the name of the sound effect to play. - * @param tileEntity the tile entity hosting the file system. - * @param data the additional data. - */ - public Client(String sound, TileEntity tileEntity, NBTTagCompound data) { - super(sound, tileEntity, data); - } - - /** - * Constructor for arbitrarily hosted file systems. - * - * @param sound the name of the sound effect to play. - * @param world the world the file system lives in. - * @param x the x coordinate of the file system's container. - * @param y the y coordinate of the file system's container. - * @param z the z coordinate of the file system's container. - * @param data the additional data. - */ - public Client(String sound, World world, double x, double y, double z, NBTTagCompound data) { - super(sound, world, x, y, z, data); - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/GeolyzerEvent.java b/src/api/java/li/cil/oc/api/event/GeolyzerEvent.java deleted file mode 100755 index 52c9ab02a..000000000 --- a/src/api/java/li/cil/oc/api/event/GeolyzerEvent.java +++ /dev/null @@ -1,91 +0,0 @@ -package li.cil.oc.api.event; - -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; -import li.cil.oc.api.driver.EnvironmentHost; - -import java.util.HashMap; -import java.util.Map; - -/** - * This event is fired by the geolyzer block/upgrade. - *

- * When cancelling this event, the respective method will bail and report - * that the operation failed. - */ -@Cancelable -public abstract class GeolyzerEvent extends Event { - /** - * The container of the geolyzer component. This can either be the - * geolyzer block, or something with the geolyzer upgrade (a robot). - */ - public final EnvironmentHost host; - - /** - * The options the operation was invoked with. - */ - public final Map options; - - protected GeolyzerEvent(EnvironmentHost host, Map options) { - this.host = host; - this.options = options; - } - - /** - * Long-distance scan, getting quantified information about blocks around - * the geolyzer. By default this will yield a (noisy) listing of the - * hardness of the blocks. - *

- * Note: the y coordinate is computed as geolyzer.y - 32 + data.index. - */ - public static class Scan extends GeolyzerEvent { - /** - * The relative x coordinate of the column being scanned. - */ - public final int scanX; - - /** - * The relative z coordinate of the column being scanned. - */ - public final int scanZ; - - /** - * The data for the column of blocks being scanned, which is an - * interval around the geolyzer itself, with the geolyzer block - * being at index 32. - */ - public final float[] data = new float[64]; - - public Scan(EnvironmentHost host, Map options, int scanX, int scanZ) { - super(host, options); - this.scanX = scanX; - this.scanZ = scanZ; - } - } - - /** - * Zero-range scan, getting in-depth information about blocks directly - * adjacent to the geolyzer. By default this will yield the block's - * name, metadata, hardness and harvest information. - */ - public static class Analyze extends GeolyzerEvent { - /** - * The position of the block to scan. - *

- * Note: get the world via the host if you need it. - */ - public final int x, y, z; - - /** - * The retrieved data for the block being scanned. - */ - public final Map data = new HashMap(); - - public Analyze(EnvironmentHost host, Map options, int x, int y, int z) { - super(host, options); - this.x = x; - this.y = y; - this.z = z; - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotAnalyzeEvent.java b/src/api/java/li/cil/oc/api/event/RobotAnalyzeEvent.java deleted file mode 100755 index b1497ab40..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotAnalyzeEvent.java +++ /dev/null @@ -1,21 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.internal.Agent; -import net.minecraft.entity.player.EntityPlayer; - -/** - * Fired when an analyzer is used on a robot. - *

- * Use this to echo additional information for custom components. - */ -public class RobotAnalyzeEvent extends RobotEvent { - /** - * The player that used the analyzer. - */ - public final EntityPlayer player; - - public RobotAnalyzeEvent(Agent agent, EntityPlayer player) { - super(agent); - this.player = player; - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotAttackEntityEvent.java b/src/api/java/li/cil/oc/api/event/RobotAttackEntityEvent.java deleted file mode 100755 index 9d647ebd3..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotAttackEntityEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -package li.cil.oc.api.event; - -import cpw.mods.fml.common.eventhandler.Cancelable; -import li.cil.oc.api.internal.Agent; -import net.minecraft.entity.Entity; - -public class RobotAttackEntityEvent extends RobotEvent { - /** - * The entity that the robot will attack. - */ - public final Entity target; - - protected RobotAttackEntityEvent(Agent agent, Entity target) { - super(agent); - this.target = target; - } - - /** - * Fired when a robot is about to attack an entity. - *

- * Canceling this event will prevent the attack. - */ - @Cancelable - public static class Pre extends RobotAttackEntityEvent { - public Pre(Agent agent, Entity target) { - super(agent, target); - } - } - - /** - * Fired after a robot has attacked an entity. - */ - public static class Post extends RobotAttackEntityEvent { - public Post(Agent agent, Entity target) { - super(agent, target); - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotBreakBlockEvent.java b/src/api/java/li/cil/oc/api/event/RobotBreakBlockEvent.java deleted file mode 100755 index 2630e95ee..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotBreakBlockEvent.java +++ /dev/null @@ -1,79 +0,0 @@ -package li.cil.oc.api.event; - -import cpw.mods.fml.common.eventhandler.Cancelable; -import li.cil.oc.api.internal.Agent; -import net.minecraft.world.World; - -public abstract class RobotBreakBlockEvent extends RobotEvent { - protected RobotBreakBlockEvent(Agent agent) { - super(agent); - } - - /** - * Fired when a robot is about to break a block. - *

- * Canceling this event will prevent the block from getting broken. - */ - @Cancelable - public static class Pre extends RobotBreakBlockEvent { - /** - * The world in which the block will be broken. - */ - public final World world; - - /** - * The coordinates at which the block will be broken. - */ - public final int x, y, z; - - /** - * The time it takes to break the block. - */ - private double breakTime; - - public Pre(Agent agent, World world, int x, int y, int z, double breakTime) { - super(agent); - this.world = world; - this.x = x; - this.y = y; - this.z = z; - this.breakTime = breakTime; - } - - /** - * Sets the time it should take the robot to break the block. - *

- * Note that the robot will still break the block instantly, but the - * robot's execution is paused for the specified amount of time. - * - * @param breakTime the time in seconds the break operation takes. - */ - public void setBreakTime(double breakTime) { - this.breakTime = Math.max(0.05, breakTime); - } - - /** - * Gets the time that it will take to break the block. - * - * @see #setBreakTime(double) - */ - public double getBreakTime() { - return breakTime; - } - } - - /** - * Fired after a robot broke a block. - */ - public static class Post extends RobotBreakBlockEvent { - /** - * The amount of experience the block that was broken generated (e.g. certain ores). - */ - public final double experience; - - public Post(Agent agent, double experience) { - super(agent); - this.experience = experience; - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotEvent.java b/src/api/java/li/cil/oc/api/event/RobotEvent.java deleted file mode 100755 index 0173809df..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotEvent.java +++ /dev/null @@ -1,18 +0,0 @@ -package li.cil.oc.api.event; - -import cpw.mods.fml.common.eventhandler.Event; -import li.cil.oc.api.internal.Agent; - -/** - * Base class for events generated by robots. - */ -public abstract class RobotEvent extends Event { - /** - * The robot for which this event was fired. - */ - public final Agent agent; - - protected RobotEvent(Agent agent) { - this.agent = agent; - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotExhaustionEvent.java b/src/api/java/li/cil/oc/api/event/RobotExhaustionEvent.java deleted file mode 100755 index ac906ef61..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotExhaustionEvent.java +++ /dev/null @@ -1,19 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.internal.Agent; - -/** - * Fired when a robot performed an action that would cause exhaustion for a - * player. Used for the experience upgrade, for example. - */ -public class RobotExhaustionEvent extends RobotEvent { - /** - * The amount of exhaustion that was generated. - */ - public final double exhaustion; - - public RobotExhaustionEvent(Agent agent, double exhaustion) { - super(agent); - this.exhaustion = exhaustion; - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotMoveEvent.java b/src/api/java/li/cil/oc/api/event/RobotMoveEvent.java deleted file mode 100755 index 909628058..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotMoveEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -package li.cil.oc.api.event; - -import cpw.mods.fml.common.eventhandler.Cancelable; -import li.cil.oc.api.internal.Agent; -import net.minecraftforge.common.util.ForgeDirection; - -public abstract class RobotMoveEvent extends RobotEvent { - /** - * The direction in which the robot will be moving. - */ - public final ForgeDirection direction; - - protected RobotMoveEvent(Agent agent, ForgeDirection direction) { - super(agent); - this.direction = direction; - } - - /** - * Fired when a robot is about to move. - *

- * Canceling the event will prevent the robot from moving. - */ - @Cancelable - public static class Pre extends RobotMoveEvent { - public Pre(Agent agent, ForgeDirection direction) { - super(agent, direction); - } - } - - /** - * Fired after a robot moved. - */ - public static class Post extends RobotMoveEvent { - public Post(Agent agent, ForgeDirection direction) { - super(agent, direction); - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotPlaceBlockEvent.java b/src/api/java/li/cil/oc/api/event/RobotPlaceBlockEvent.java deleted file mode 100755 index 10b32b963..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotPlaceBlockEvent.java +++ /dev/null @@ -1,53 +0,0 @@ -package li.cil.oc.api.event; - -import cpw.mods.fml.common.eventhandler.Cancelable; -import li.cil.oc.api.internal.Agent; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public abstract class RobotPlaceBlockEvent extends RobotEvent { - /** - * The item that is used to place the block. - */ - public final ItemStack stack; - - /** - * The world in which the block will be placed. - */ - public final World world; - - /** - * The coordinates at which the block will be placed. - */ - public final int x, y, z; - - protected RobotPlaceBlockEvent(Agent agent, ItemStack stack, World world, int x, int y, int z) { - super(agent); - this.stack = stack; - this.world = world; - this.x = x; - this.y = y; - this.z = z; - } - - /** - * Fired when a robot is about to place a block. - *

- * Canceling this event will prevent the block from being placed. - */ - @Cancelable - public static class Pre extends RobotPlaceBlockEvent { - public Pre(Agent agent, ItemStack stack, World world, int x, int y, int z) { - super(agent, stack, world, x, y, z); - } - } - - /** - * Fired after a robot placed a block. - */ - public static class Post extends RobotPlaceBlockEvent { - public Post(Agent agent, ItemStack stack, World world, int x, int y, int z) { - super(agent, stack, world, x, y, z); - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotPlaceInAirEvent.java b/src/api/java/li/cil/oc/api/event/RobotPlaceInAirEvent.java deleted file mode 100755 index 81a4b8f18..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotPlaceInAirEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.internal.Agent; - -/** - * This event is fired when a robot tries to place a block and has no point of - * reference, i.e. the place would have to be placed in "thin air". Per default - * this fails (because players can't do this, either). - *

- * This is primarily intended for the 'Angel Upgrade', but it might be useful - * for other upgrades, too. - */ -public class RobotPlaceInAirEvent extends RobotEvent { - private boolean isAllowed = false; - - public RobotPlaceInAirEvent(Agent agent) { - super(agent); - } - - /** - * Whether the placement is allowed. Defaults to false. - */ - public boolean isAllowed() { - return isAllowed; - } - - /** - * Set whether the placement is allowed, can be used to allow robots to - * place blocks in thin air. - */ - public void setAllowed(boolean value) { - this.isAllowed = value; - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotRenderEvent.java b/src/api/java/li/cil/oc/api/event/RobotRenderEvent.java deleted file mode 100755 index 3eb48ce78..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotRenderEvent.java +++ /dev/null @@ -1,81 +0,0 @@ -package li.cil.oc.api.event; - -import cpw.mods.fml.common.eventhandler.Cancelable; -import li.cil.oc.api.driver.item.UpgradeRenderer; -import li.cil.oc.api.internal.Agent; -import li.cil.oc.api.internal.Robot; -import net.minecraft.item.ItemStack; -import org.lwjgl.util.vector.Vector3f; -import org.lwjgl.util.vector.Vector4f; - -import java.util.Set; - -/** - * Fired directly before the robot's chassis is rendered. - *

- * If this event is canceled, the chassis will not be rendered. - * Component items' item renderers will still be invoked, at the possibly - * modified mount points. - *

- * Important: the robot instance may be null in this event, in - * case the render pass is for rendering the robot in an inventory. - */ -@Cancelable -public class RobotRenderEvent extends RobotEvent { - /** - * Points on the robot at which component models may be rendered. - *

- * By convention, components should be rendered in order of their slots, - * meaning that some components may not be rendered at all, if there are - * not enough mount points. - *

- * The equipped tool is rendered at a fixed position, this list does not - * contain a mount point for it. - */ - public final MountPoint[] mountPoints; - - public RobotRenderEvent(Agent agent, MountPoint[] mountPoints) { - super(agent); - this.mountPoints = mountPoints; - } - - /** - * Describes points on the robot model at which components are "mounted", - * i.e. where component models may be rendered. - */ - public static class MountPoint { - /** - * The position of the mount point, relative to the robot's center. - * For the purposes of this offset, the robot is always facing south, - * i.e. the positive Z axis is 'forward'. - *

- * Note that the rotation is applied before the translation. - */ - public final Vector3f offset = new Vector3f(0, 0, 0); - - /** - * The orientation of the mount point specified by the angle and the - * vector to rotate around. The rotation is applied in one - * GL11.glRotate() call. Note that the W component of the - * vector is the rotation. - *

- * Note that the rotation is applied before the translation. - */ - public final Vector4f rotation = new Vector4f(0, 0, 0, 0); - - /** - * The mount point's reference name. - *

- * This is what's used in {@link UpgradeRenderer#computePreferredMountPoint(ItemStack, Robot, Set)}. - */ - public final String name; - - public MountPoint() { - name = null; - } - - public MountPoint(String name) { - this.name = name; - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotUsedToolEvent.java b/src/api/java/li/cil/oc/api/event/RobotUsedToolEvent.java deleted file mode 100755 index d907379ac..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotUsedToolEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.internal.Agent; -import net.minecraft.item.ItemStack; - -public class RobotUsedToolEvent extends RobotEvent { - /** - * The tool that was used, before and after use. - */ - public final ItemStack toolBeforeUse, toolAfterUse; - - protected double damageRate; - - protected RobotUsedToolEvent(Agent agent, ItemStack toolBeforeUse, ItemStack toolAfterUse, double damageRate) { - super(agent); - this.toolBeforeUse = toolBeforeUse; - this.toolAfterUse = toolAfterUse; - this.damageRate = damageRate; - } - - /** - * The rate at which the used tool should lose durability, where one means - * it loses durability at full speed, zero means it doesn't lose durability - * at all. - *

- * This value is in an interval of [0, 1]. - */ - public double getDamageRate() { - return damageRate; - } - - /** - * Fired when a robot used a tool and is about to apply the damage rate to - * partially undo the durability loss. This step is used to compute the - * rate at which the tool should lose durability, which is used by the - * experience upgrade, for example. - */ - public static class ComputeDamageRate extends RobotUsedToolEvent { - public ComputeDamageRate(Agent agent, ItemStack toolBeforeUse, ItemStack toolAfterUse, double damageRate) { - super(agent, toolBeforeUse, toolAfterUse, damageRate); - } - - /** - * Set the rate at which the tool actually gets damaged. - *

- * This will be clamped to an iterval of [0, 1]. - * - * @param damageRate the new damage rate. - */ - public void setDamageRate(double damageRate) { - this.damageRate = Math.max(0, Math.min(1, damageRate)); - } - } - - /** - * Fired when a robot used a tool and the previously fired damage rate - * computation returned a value smaller than one. The callbacks of this - * method are responsible for applying the inverse damage the tool took. - * The toolAfterUse item stack represents the actual tool, any - * changes must be applied to that variable. The toolBeforeUse - * item stack is passed for reference, to compute the actual amount of - * durability that was lost. This may be required for tools where the - * durability is stored in the item's NBT tag. - */ - public static class ApplyDamageRate extends RobotUsedToolEvent { - public ApplyDamageRate(Agent agent, ItemStack toolBeforeUse, ItemStack toolAfterUse, double damageRate) { - super(agent, toolBeforeUse, toolAfterUse, damageRate); - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/package-info.java b/src/api/java/li/cil/oc/api/event/package-info.java deleted file mode 100755 index 04a5d19ec..000000000 --- a/src/api/java/li/cil/oc/api/event/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Events dispatched by OpenComputers to allow other mods to hook into some - * of its functionality. - */ -@cpw.mods.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Event", - apiVersion = API.VERSION) -package li.cil.oc.api.event; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/fs/FileSystem.java b/src/api/java/li/cil/oc/api/fs/FileSystem.java deleted file mode 100755 index a9af47466..000000000 --- a/src/api/java/li/cil/oc/api/fs/FileSystem.java +++ /dev/null @@ -1,246 +0,0 @@ -package li.cil.oc.api.fs; - -import li.cil.oc.api.Persistable; - -import java.io.FileNotFoundException; - -/** - * Interface for file system driver compatible file systems. - *

- * See {@link li.cil.oc.api.FileSystem} for factory methods. - *

- * Note that all paths passed here are assumed to be absolute in the underlying - * file system implementation, meaning they do not contain any "." or "..", and - * are relative to the root of the file system. When wrapping a file system in - * a node with the provided factory functions this is automatically ensured. If - * you call any of the functions of a file system directly it is your - * responsibility to ensure the path has been cleaned up. - */ -public interface FileSystem extends Persistable { - /** - * Whether this file system is read-only. - *

- * This is used to allow programs to check whether a file system can be - * written to without trying to open a file for writing. Note that this is - * merely used as an indicator. All mutating accessors should be implemented - * accordingly to enforce true read-only logic (i.e. {@link #open} should - * not allow opening files in write or append mode, {@link #makeDirectory} - * and such should do nothing/return false/throw an exception). - */ - boolean isReadOnly(); - - /** - * The total storage capacity of the file system, in bytes. - *

- * For read-only systems this should return zero, for writable file systems - * that do not enforce a storage limit this should be a negative value. - * - * @return the total storage space of this file system. - */ - long spaceTotal(); - - /** - * The used storage capacity of the file system, in bytes. - * - * @return the used storage space of this file system. - */ - long spaceUsed(); - - // ----------------------------------------------------------------------- // - - /** - * Tests if a file or directory exists at the specified path. - *

- * This function should never throw. - * - * @param path the path to check at. - * @return true if the path points to a file or directory; - * false otherwise. - */ - boolean exists(String path); - - /** - * Gets the size of a file. - *

- * For files this should return the actual length of the file, in bytes. For - * folders this should return zero. - *

- * If the path is invalid this should return zero. It should never throw. - * - * @param path the path to get the size for. - * @return the size of the object at the specified path. - */ - long size(String path); - - /** - * Tests whether the object at the specified path is a directory. - *

- * If the path is invalid (i.e. there is neither a file nor a directory at - * the specified location) this should also return false. It should never - * throw. - * - * @param path the path to the object to check. - * @return true if the object is a directory; false otherwise. - */ - boolean isDirectory(String path); - - /** - * Gets the timestamp of the last time the file at the specified path was - * written to. - *

- * For folders this should be the time they were created. - *

- * If the path is invalid (i.e. there is neither a file nor a directory at - * the specified location) this should return zero. It should never throw. - *

- * For read-only systems this may be zero for all queries. - * - * @param path the path to the object to get the last modified time of. - * @return the time the object was last modified. - */ - long lastModified(String path); - - /** - * Gets a list of all items in the specified folder. - *

- * This must return the actual object names in the specified parent folder, - * not their full path. For example, for a file at /home/test, when - * doing list("/home/") this should return ["test"], - * not ["/home/test"]. - *

- * Sub-folders should be returned with a trailing slash, to indicate that - * they are folders. - *

- * If the folder is empty this should return an empty array. - * - * @param path the path to the folder to get the contents of. - * @return an array with the names of all objects in that folder; - * null if the specified object does not exist or is not a - * folder. - */ - String[] list(String path); - - // ----------------------------------------------------------------------- // - - /** - * Deletes a file or folder. - *

- * This only has to support deleting single files and empty folders. If a - * directory is non-empty this may return false. If the target - * object does not exists it should return false. - *

- * This is only available for writable file systems. For read-only systems - * it should always return false. - * - * @param path the path to the object to delete. - * @return true if the object was successfully deleted; - * false otherwise. - */ - boolean delete(String path); - - /** - * Create the specified directory. - *

- * This should always only create a single directory. If the parent - * directory does not exists it should return false. If the target - * object already exists it should also return false. - *

- * This is only available for writable file systems. For read-only systems - * it should always return false. - * - * @param path the path to the directory to create. - * @return true if the directory was created; false otherwise. - */ - boolean makeDirectory(String path); - - /** - * Moves / renames a file or folder. - *

- * This is only available for writable file systems. For read-only systems - * it should always return false. - * - * @param from the name of the file or folder to move. - * @param to the location to move the file or folder to. - * @return true if the object was renamed; - * false otherwise. - * @throws FileNotFoundException if the source is not a file or folder. - */ - boolean rename(String from, String to) throws FileNotFoundException; - - /** - * Sets the time a file or folder was supposedly last modified. - *

- * This is not available to the user side via the file system driver. It is - * intended to be used when initializing a file system to a set of known - * modification times (for example, this is used when creating a virtual - * file system from a set of real files). - *

- * Read-only file systems may ignore this request. - * - * @param path the path of the object for which to set the modification time. - * @param time the time the object was supposedly last modified. - * @return true if the modification time was adjusted; - * false otherwise. - */ - boolean setLastModified(String path, long time); - - // ----------------------------------------------------------------------- // - - /** - * Opens a file for reading or writing. - *

- * This should create some internal handle to the file, based on the mode - * specified. A unique ID corresponding to that handle should be returned. - * This ID can be used in {@link #getHandle} to get an abstract wrapper for - * the handle, and to allow interaction with the file. - *

- * It is the responsibility of the file system to restore all handles to - * their previous state when it is reloaded (game loaded for example). - *

- * Important: you should return a random value as the handle, to - * reduce the chance for conflicts. For example, a file system may be used - * in a compound of file systems (e.g. for the ROM of machines), in which - * case it is essential that the handles from different sub file - * systems do not overlap. - * - * @param path the path to the file to open. - * @param mode the mode in which to open the file. - * @return the handle to the opened file. - * @throws FileNotFoundException if the object is not a file, or - * the file cannot be opened in the - * specified mode. - */ - int open(String path, Mode mode) throws FileNotFoundException; - - /** - * Gets a wrapper for a file previously opened using {@link #open}. - *

- * The wrapper allows interaction with the underlying file (stream) based - * on the mode it was opened in. See {@link Handle} for more details. - *

- * If there is no such handle, this should return null, but never - * throw. - * - * @param handle the ID of the handle to get the wrapper for. - * @return the wrapper for that handle ID; null if there is no - * handle with the specified ID. - */ - Handle getHandle(int handle); - - /** - * Called when the file system is destroyed. - *

- * This should close any open real file handles (e.g. all open I/O streams), - * but keep any internal state that may have to be persisted, for example - * for floppy disks (which are removed before they are saved so they don't - * save any open handles). - *

- * When the filesystem is made available as a network node created via - * one of the factory functions in {@link li.cil.oc.api.FileSystem} this - * will be called whenever the node is disconnected from its network. If - * the node was used to represent an item (which will be the usual use-case, - * I imagine) this means the item was removed from its container (e.g. hard - * drive from a computer) or the container was unloaded. - */ - void close(); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/fs/Handle.java b/src/api/java/li/cil/oc/api/fs/Handle.java deleted file mode 100755 index 759ebbfda..000000000 --- a/src/api/java/li/cil/oc/api/fs/Handle.java +++ /dev/null @@ -1,66 +0,0 @@ -package li.cil.oc.api.fs; - -import java.io.IOException; - -/** - * Represents a handle to a file opened from a {@link FileSystem}. - */ -public interface Handle { - /** - * The current position in the file. - */ - long position(); - - /** - * The total length of the file. - */ - long length(); - - /** - * Closes the handle. - *

- * For example, if there is an underlying stream, this should close that - * stream. Any future calls to {@link #read} or {@link #write} should throw - * an IOException after this function was called. - */ - void close(); - - /** - * Tries to read as much data from the file as fits into the specified - * array. - *

- * For files opened in write or append mode this should always throw an - * exception. - * - * @param into the buffer to read the data into. - * @return the number of bytes read; -1 if there are no more bytes (EOF). - * @throws IOException if the file was opened in writing mode or an - * I/O error occurred or the file was already - * closed. - */ - int read(byte[] into) throws IOException; - - /** - * Jump to the specified position in the file, if possible. - *

- * For files opened in write or append mode this should always throw an - * exception. - * - * @param to the position in the file to jump to. - * @return the resulting position in the file. - * @throws IOException if the file was opened in write mode. - */ - long seek(long to) throws IOException; - - /** - * Tries to write all the data from the specified array into the file. - *

- * For files opened in read mode this should always throw an exception. - * - * @param value the data to write into the file. - * @throws IOException if the file was opened in read-only mode, or - * another I/O error occurred (no more space, - * for example), or the file was already closed. - */ - void write(byte[] value) throws IOException; -} diff --git a/src/api/java/li/cil/oc/api/fs/Label.java b/src/api/java/li/cil/oc/api/fs/Label.java deleted file mode 100755 index 4256c80ff..000000000 --- a/src/api/java/li/cil/oc/api/fs/Label.java +++ /dev/null @@ -1,31 +0,0 @@ -package li.cil.oc.api.fs; - -import li.cil.oc.api.Persistable; - -/** - * Used by file system components to get and set the file system's label. - * - * @see li.cil.oc.api.FileSystem#asManagedEnvironment - */ -public interface Label extends Persistable { - /** - * Get the current value of this label. - *

- * May be null if no label is set. - * - * @return the current label. - */ - String getLabel(); - - /** - * Set the new value of this label. - *

- * May be set to null to clear the label. - *

- * May throw an exception if the label is read-only. - * - * @param value the new label. - * @throws IllegalArgumentException if the label is read-only. - */ - void setLabel(String value); -} diff --git a/src/api/java/li/cil/oc/api/fs/Mode.java b/src/api/java/li/cil/oc/api/fs/Mode.java deleted file mode 100755 index ef819f797..000000000 --- a/src/api/java/li/cil/oc/api/fs/Mode.java +++ /dev/null @@ -1,23 +0,0 @@ -package li.cil.oc.api.fs; - -/** - * Possible file modes. - *

- * This is used when opening files from a {@link FileSystem}. - */ -public enum Mode { - /** - * Open a file in reading mode. - */ - Read, - - /** - * Open a file in writing mode, overwriting existing contents. - */ - Write, - - /** - * Open a file in append mode, writing new data after existing contents. - */ - Append -} diff --git a/src/api/java/li/cil/oc/api/fs/package-info.java b/src/api/java/li/cil/oc/api/fs/package-info.java deleted file mode 100755 index 394969fb7..000000000 --- a/src/api/java/li/cil/oc/api/fs/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This package contains interfaces used by the file system implementation. - *

- * This allows it to add custom file systems that will behave the same as the - * existing ones, particularly that can be used the same from a machine as any - * other. In the case of Lua, for example, this means it can be mounted like - * any other file system, and interacted with without further special handling. - *

- * You will usually not need to implement these interfaces! - *

- * Consider using the factory methods in {@link li.cil.oc.api.FileSystem} to - * create file systems and wrapper nodes for these file systems (i.e. nodes - * that can be added as component nodes to the network, so they can be used - * from computers). - */ -@cpw.mods.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|FileSystem", - apiVersion = API.VERSION) -package li.cil.oc.api.fs; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/internal/Adapter.java b/src/api/java/li/cil/oc/api/internal/Adapter.java deleted file mode 100755 index c4526ebc7..000000000 --- a/src/api/java/li/cil/oc/api/internal/Adapter.java +++ /dev/null @@ -1,30 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.network.Environment; -import net.minecraft.inventory.IInventory; - -/** - * This interface is implemented as a marker by adapters. - *

- * This is implemented by adapter tile entities, which also serve as its - * components' environment. That means you can use this to check for - * adapters by using either: - *

- *     if (tileEntity instanceof Adapter) {
- * 
- * or - *
- *     if (node.host() instanceof Adapter) {
- * 
- *

- * This can also be used by {@link li.cil.oc.api.driver.item.HostAware} item - * drivers to check if the provided environment class is an adapter by checking - * for assignability, which allows for items that make no sense in adapters to - * deny being placed into them, for example. - *

- * The only purpose is to allow identifying tile entities as adapters - * via the API, i.e. without having to link against internal classes. This - * also means that you should not implement this. - */ -public interface Adapter extends Environment, IInventory { -} diff --git a/src/api/java/li/cil/oc/api/internal/Agent.java b/src/api/java/li/cil/oc/api/internal/Agent.java deleted file mode 100755 index 6f78c196b..000000000 --- a/src/api/java/li/cil/oc/api/internal/Agent.java +++ /dev/null @@ -1,91 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.machine.MachineHost; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; - -import java.util.UUID; - -/** - * General marker interface for autonomous agents such as robots and drones. - */ -public interface Agent extends MachineHost, Rotatable { - /** - * The equipment inventory of this agent. - *

- * For example, for the robot this is the tool slot as well as slots - * provided by containers installed in the robot, if any. - *

- * If an agent has no equipment slots this will be a zero-sized inventory. - */ - IInventory equipmentInventory(); - - /** - * The main inventory of this agent, which it (usually) also can - * interact with on its own. - *

- * If an agent has no inventory slots this will be a zero-sized inventory. - */ - IInventory mainInventory(); - - /** - * Provides access to the tanks of the agent. - *

- * If an agent has no tanks this will be a zero-sized multi-tank. - */ - MultiTank tank(); - - /** - * Gets the index of the currently selected slot in the agent's inventory. - */ - int selectedSlot(); - - /** - * Set the index of the currently selected slot. - */ - void setSelectedSlot(int index); - - /** - * Get the index of the currently selected tank. - */ - int selectedTank(); - - /** - * Set the index of the currently selected tank. - */ - void setSelectedTank(int index); - - /** - * Returns the fake player used to represent the agent as an entity for - * certain actions that require one. - *

- * This will automatically be positioned and rotated to represent the - * agent's current position and rotation in the world. Use this to trigger - * events involving the agent that require a player entity. - *

- * Note that this may be the common OpenComputers fake player. - * - * @return the fake player for the agent. - */ - EntityPlayer player(); - - /** - * Get the name of this agent. - */ - String name(); - - /** - * Set the name of the agent. - */ - void setName(String name); - - /** - * The name of the player owning this agent, e.g. the player that placed it. - */ - String ownerName(); - - /** - * The UUID of the player owning this agent, e.g. the player that placed it. - */ - UUID ownerUUID(); -} diff --git a/src/api/java/li/cil/oc/api/internal/Case.java b/src/api/java/li/cil/oc/api/internal/Case.java deleted file mode 100755 index ee6e22f2b..000000000 --- a/src/api/java/li/cil/oc/api/internal/Case.java +++ /dev/null @@ -1,23 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.driver.EnvironmentHost; -import li.cil.oc.api.machine.Machine; -import li.cil.oc.api.machine.MachineHost; -import li.cil.oc.api.network.Environment; -import net.minecraft.inventory.IInventory; - -/** - * This interface is implemented as a marker by computer cases. - *

- * This is implemented by computer case tile entities. That means you can - * use this to check for computer cases by using: - *

- *     if (tileEntity instanceof Case) {
- * 
- *

- * The only purpose is to allow identifying tile entities as computer cases - * via the API, i.e. without having to link against internal classes. This - * also means that you should not implement this. - */ -public interface Case extends Environment, EnvironmentHost, MachineHost, Colored, Rotatable, Tiered, IInventory { -} diff --git a/src/api/java/li/cil/oc/api/internal/Colored.java b/src/api/java/li/cil/oc/api/internal/Colored.java deleted file mode 100755 index afdc901f4..000000000 --- a/src/api/java/li/cil/oc/api/internal/Colored.java +++ /dev/null @@ -1,25 +0,0 @@ -package li.cil.oc.api.internal; - -/** - * This interface is implemented by tile entities that can be colored by - * players, such as screens, computer cases and cables. - *

- * Colors are in the common RRGGBB format. - *

- * This interface is not meant to be implemented, just used. - */ -public interface Colored { - /** - * Get the current color value. - * - * @return the current color value. - */ - int getColor(); - - /** - * Set the color value. - * - * @param value the new color value. - */ - void setColor(int value); -} diff --git a/src/api/java/li/cil/oc/api/internal/Database.java b/src/api/java/li/cil/oc/api/internal/Database.java deleted file mode 100755 index ac9b66cf8..000000000 --- a/src/api/java/li/cil/oc/api/internal/Database.java +++ /dev/null @@ -1,57 +0,0 @@ -package li.cil.oc.api.internal; - -import net.minecraft.item.ItemStack; - -/** - * This interface is implemented by the database component. - *

- * This allows getting actual item stack instances as referenced by callers - * of other components' callbacks, without having to push a full representation - * of an item stacks' NBT data to the VM (which can be both a memory and a - * security issue). - *

- * To use this, you'll usually want to accept an address and either an index - * or a hash in your component's callback function, the address being that of - * a database component in the same network as your component. Alternatively - * you can omit requiring an address and just loop through the other nodes on - * the network to look for one those that have a Database as host. - */ -public interface Database { - /** - * The number of slots in this database. - */ - int size(); - - /** - * Get an item stack stored in the specified slot of this database. - *

- * This will return null if there is no entry for the specified - * slot. If there is an entry, this will return a copy of that - * item stack, so it is safe to modify the returned stack. - * - * @param slot the slot of the item stack. - * @return the item stack stored in that slot. - */ - ItemStack getStackInSlot(int slot); - - /** - * Set the contents of a slot in the database upgrade. - *

- * Use this to change the configuration of a database upgrade. - * - * @param slot the slot to configure. - * @param stack the stack to configure the slot to, null to clear. - */ - void setStackInSlot(int slot, ItemStack stack); - - /** - * Get an item stack with the specified hash stored in this database. - *

- * This will return a negative value if there is no entry with a matching - * hash. - * - * @param hash the hash of the item stack. - * @return the index of item stack with the specified hash. - */ - int findStackWithHash(String hash); -} diff --git a/src/api/java/li/cil/oc/api/internal/Drone.java b/src/api/java/li/cil/oc/api/internal/Drone.java deleted file mode 100755 index 8ddebd61f..000000000 --- a/src/api/java/li/cil/oc/api/internal/Drone.java +++ /dev/null @@ -1,42 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.driver.EnvironmentHost; -import net.minecraft.util.Vec3; - -/** - * This interface is implemented as a marker by drones. - *

- * This is implemented by drones entities. That means you can use this to check - * for drones by using: - *

- *     if (entity instanceof Drone) {
- * 
- *

- * The only purpose is to allow identifying entities as drones via the API, - * i.e. without having to link against internal classes. This also means - * that you should not implement this. - */ -public interface Drone extends Agent, EnvironmentHost, Rotatable, Tiered { - /** - * Get the current target coordinates of the drone. - */ - Vec3 getTarget(); - - /** - * Set the new target coordinates of the drone. - *

- * Note that the actual value used will use a reduced accuracy. This is - * to avoid jitter on the client and floating point inaccuracies to - * accumulate. - */ - void setTarget(Vec3 value); - - /** - * Get the drones velocity vector. - *

- * Note that this is really just the underlying entity's motionX/Y/Z, - * so you can cast this to {@link net.minecraft.entity.Entity} and use that - * instead, if you'd like. - */ - Vec3 getVelocity(); -} diff --git a/src/api/java/li/cil/oc/api/internal/Microcontroller.java b/src/api/java/li/cil/oc/api/internal/Microcontroller.java deleted file mode 100755 index 585267ed3..000000000 --- a/src/api/java/li/cil/oc/api/internal/Microcontroller.java +++ /dev/null @@ -1,21 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.driver.EnvironmentHost; -import li.cil.oc.api.machine.MachineHost; -import li.cil.oc.api.network.Environment; - -/** - * This interface is implemented as a marker by microcontrollers. - *

- * This is implemented by microcontroller tile entities. That means you can - * use this to check for microcontrollers by using: - *

- *     if (tileEntity instanceof Microcontroller) {
- * 
- *

- * The only purpose is to allow identifying tile entities as microcontrollers - * via the API, i.e. without having to link against internal classes. This - * also means that you should not implement this. - */ -public interface Microcontroller extends Environment, EnvironmentHost, MachineHost, Rotatable, Tiered { -} diff --git a/src/api/java/li/cil/oc/api/internal/MultiTank.java b/src/api/java/li/cil/oc/api/internal/MultiTank.java deleted file mode 100755 index efaaed984..000000000 --- a/src/api/java/li/cil/oc/api/internal/MultiTank.java +++ /dev/null @@ -1,25 +0,0 @@ -package li.cil.oc.api.internal; - -import net.minecraftforge.fluids.IFluidTank; - -/** - * Implemented by objects with multiple internal tanks. - *

- * This is specifically for containers where the side does not matter when - * accessing the internal tanks, only the index of the tank; unlike with the - * {@link net.minecraftforge.fluids.IFluidHandler} interface. - */ -public interface MultiTank { - /** - * The number of tanks currently installed. - */ - int tankCount(); - - /** - * Get the installed fluid tank with the specified index. - * - * @param index the index of the tank to get. - * @return the tank with the specified index. - */ - IFluidTank getFluidTank(int index); -} diff --git a/src/api/java/li/cil/oc/api/internal/Robot.java b/src/api/java/li/cil/oc/api/internal/Robot.java deleted file mode 100755 index 30eda3ced..000000000 --- a/src/api/java/li/cil/oc/api/internal/Robot.java +++ /dev/null @@ -1,80 +0,0 @@ -package li.cil.oc.api.internal; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import li.cil.oc.api.driver.EnvironmentHost; -import li.cil.oc.api.network.Environment; -import net.minecraft.inventory.ISidedInventory; -import net.minecraftforge.fluids.IFluidHandler; - -/** - * This interface allows interaction with robots. - *

- * It is intended to be used by components when installed in a robot. In that - * case, the robot in question is the tile entity passed to item driver when - * asked to create the component's environment. - *

- * A robot's inventory contains component items and items in the actual - * inventory. The physical layout in the underlying 'real' inventory is as - * follows: - *

    - *
  • Tool
  • - *
  • equipmentInventory.getSizeInventory hot-swappable components.
  • - *
  • mainInventory.getSizeInventory internal inventory slots.
  • - *
  • componentCount hard-wired components.
  • - *
- * Note that there may be no hot-swappable (or even built-in) components or - * no inventory, depending on the configuration of the robot. The hard-wired - * components cannot be changed (removed/replaced). - *

- * This interface is not meant to be implemented, just used. - */ -public interface Robot extends Agent, Environment, EnvironmentHost, Tiered, ISidedInventory, IFluidHandler { - /** - * The number of built-in components in this robot. - */ - int componentCount(); - - /** - * Get the environment for the component in the specified slot. - *

- * This operates on the underlying, real inventory, as described in the - * comment on top of this class. - *

- * This will return null for slots that do not contain components, - * or components that do not have an environment (on the calling side). - * - * @param index the index of the slot from which to get the environment. - * @return the environment for that slot, or null. - */ - Environment getComponentInSlot(int index); - - /** - * Sends the state of the item in the specified slot to the client - * if it is an upgrade. - *

- * Use this to update the state of an upgrade in that slot for rendering - * purposes (e.g. this is used by the generator upgrade to update the - * active state so the renderer knows which texture to use). - *

- * This is necessary because inventories are not synchronized by default, - * only if a player is currently 'looking into' the inventory (opened the - * GUI of the inventory). - *

- * The component will be saved to its item's NBT tag compound, as it would - * be when the game is saved, and then the item is re-sent to the client. - * Keep the number of calls to this function low, since each call causes a - * network packet to be sent. - */ - void synchronizeSlot(int slot); - - /** - * This essentially returns whether the robot is currently running or not. - *

- * This is explicitly meant for client side use, to allow upgrade renderers - * to know whether to resume animations or not, based on whether the robot - * is currently powered on or not. - */ - @SideOnly(Side.CLIENT) - boolean shouldAnimate(); -} diff --git a/src/api/java/li/cil/oc/api/internal/Rotatable.java b/src/api/java/li/cil/oc/api/internal/Rotatable.java deleted file mode 100755 index 9310cfe99..000000000 --- a/src/api/java/li/cil/oc/api/internal/Rotatable.java +++ /dev/null @@ -1,61 +0,0 @@ -package li.cil.oc.api.internal; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * This interface is implemented by the computer case and robot tile entities - * to allow item components to query the orientation of their host, i.e. to - * allow getting the facing of the tile entity passed to their drivers' - * {@link li.cil.oc.api.driver.Item#createEnvironment(net.minecraft.item.ItemStack, li.cil.oc.api.driver.EnvironmentHost)} - * method. - *

- * This interface is not meant to be implemented, just used. - */ -public interface Rotatable { - /** - * The current facing of a tile entity implementing this interface. - *

- * Intended to be used to query the orientation of an item components' host. - * For example: - *

-     * class SomeDriver implements li.cil.oc.api.driver.Item {
-     *     // ...
-     *     ManagedEnvironment createEnvironment(ItemStack stack, TileEntity tileentity) {
-     *         if (tileentity instanceof Rotatable) {
-     *             ForgeDirection facing = ((Rotatable)tileentity).facing();
-     *             // Do something with facing.
-     *         }
-     *     }
-     * }
-     * 
- * - * @return the current facing. - */ - ForgeDirection facing(); - - /** - * Converts a facing relative to the block's local coordinate - * system to a global orientation, using south as the standard - * orientation. - *

- * For example, if the block is facing east, calling this with south will - * return east, calling it with west will return south and so on. - * - * @param value the value to translate. - * @return the translated orientation. - */ - ForgeDirection toGlobal(ForgeDirection value); - - /** - * Converts a global orientation to a facing relative to the - * block's local coordinate system, using south as the standard - * orientation. - *

- * For example, if the block is facing east, calling this with south will - * return east, calling it with west will return north and so on. - * - * @param value the value to translate. - * @return the translated orientation. - */ - ForgeDirection toLocal(ForgeDirection value); -} diff --git a/src/api/java/li/cil/oc/api/internal/Server.java b/src/api/java/li/cil/oc/api/internal/Server.java deleted file mode 100755 index 5c5b8cd87..000000000 --- a/src/api/java/li/cil/oc/api/internal/Server.java +++ /dev/null @@ -1,33 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.driver.EnvironmentHost; -import li.cil.oc.api.machine.MachineHost; - -/** - * This interface is implemented as a marker by servers in server racks. - *

- * This is implemented by servers in server racks, which serve as their - * computer components' environment. That means you can use this to check for - * servers by using either: - *

- *     if (node.host() instanceof Server) {
- * 
- *

- * You can get a reference to a server either via the above cast, or via a - * {@link li.cil.oc.api.internal.ServerRack}. - *

- * The only purpose is to allow identifying node environments as servers - * via the API, i.e. without having to link against internal classes. This - * also means that you should not implement this. - */ -public interface Server extends EnvironmentHost, MachineHost, Tiered { - /** - * The server rack this server is in. - */ - ServerRack rack(); - - /** - * The slot of the server rack this server is in. - */ - int slot(); -} diff --git a/src/api/java/li/cil/oc/api/internal/ServerRack.java b/src/api/java/li/cil/oc/api/internal/ServerRack.java deleted file mode 100755 index 40b5f8be6..000000000 --- a/src/api/java/li/cil/oc/api/internal/ServerRack.java +++ /dev/null @@ -1,38 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.network.Environment; -import li.cil.oc.api.network.SidedEnvironment; -import net.minecraft.inventory.IInventory; - -/** - * This interface is implemented as a marker by server racks. - *

- * This is implemented by server rack tile entities. That means you can use - * this to check for server racks by using: - *

- *     if (tileEntity instanceof ServerRack) {
- * 
- *

- * Server racks do not serve as environment for the computer nodes of - * servers. That's what the {@link Server}s are for. - *

- * The only purpose is to allow identifying tile entities as server racks - * via the API, i.e. without having to link against internal classes. This - * also means that you should not implement this. - */ -public interface ServerRack extends Environment, SidedEnvironment, Rotatable, IInventory { - /** - * The machine currently hosted by the server in the specified slot. - *

- * This can be null, for example when there is no CPU installed - * in the server in that slot, or there is no server in that slot. - * - * @return the machine currently hosted in the specified slot. - */ - Server server(int slot); - - /** - * The currently set wireless range in which remote terminals work. - */ - int range(); -} diff --git a/src/api/java/li/cil/oc/api/internal/Tablet.java b/src/api/java/li/cil/oc/api/internal/Tablet.java deleted file mode 100755 index 342a81223..000000000 --- a/src/api/java/li/cil/oc/api/internal/Tablet.java +++ /dev/null @@ -1,38 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.driver.EnvironmentHost; -import li.cil.oc.api.machine.MachineHost; -import net.minecraft.entity.player.EntityPlayer; - -/** - * This interface is implemented as a marker by tablets. - *

- * This is implemented by the class containing tablets' logic implementation, - * which is not the tablet item! The tablet class serves as its - * computer components' environment. That means you can use this to check for - * tablets by using - *

- *     if (node.host() instanceof Tablet) {
- * 
- *

- * This can also be used by {@link li.cil.oc.api.driver.item.HostAware} item - * drivers to check if the provided environment class is a tablet by checking - * for assignability, which allows for items that make no sense in tablets to - * deny being placed into them in the assembler, for example. - *

- * The only purpose is to allow identifying tile entities as tablets - * via the API, i.e. without having to link against internal classes. This - * also means that you should not implement this. - */ -public interface Tablet extends EnvironmentHost, MachineHost, Rotatable { - /** - * Returns the player last holding the tablet. - *

- * Note that this value may change over the lifetime of a tablet instance. - * The player may also already have dropped the tablet - this value will - * not be set to null in that case! - * - * @return the player last holding the tablet. - */ - EntityPlayer player(); -} diff --git a/src/api/java/li/cil/oc/api/internal/Tiered.java b/src/api/java/li/cil/oc/api/internal/Tiered.java deleted file mode 100755 index 4e2cfc1c6..000000000 --- a/src/api/java/li/cil/oc/api/internal/Tiered.java +++ /dev/null @@ -1,18 +0,0 @@ -package li.cil.oc.api.internal; - -/** - * This is implemented by most things that are tiered in some way. - *

- * For example, this is implemented by screens, computer cases, robots and - * drones as well as microcontrollers. If you want you can add tier specific - * behavior this way. - */ -public interface Tiered { - /** - * The zero-based tier of this... thing. - *

- * For example, a tier one screen will return 0 here, a tier three screen - * will return 2. - */ - int tier(); -} diff --git a/src/api/java/li/cil/oc/api/internal/Wrench.java b/src/api/java/li/cil/oc/api/internal/Wrench.java deleted file mode 100755 index 06c6716cb..000000000 --- a/src/api/java/li/cil/oc/api/internal/Wrench.java +++ /dev/null @@ -1,30 +0,0 @@ -package li.cil.oc.api.internal; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -/** - * Implemented on items that are wrench-like tools. - */ -public interface Wrench { - /** - * Called when the wrench is used. - *

- * This is called in two scenarios, once when testing whether the wrench - * can be used on a certain block, in which case the simulate - * argument will be true, and once when actually used on a block, - * in which case the simulate argument will be false, - * allowing the tool to damage itself, for example. - *

- * This is usually called from blocks' activation logic. - * - * @param player the player using the tool - * @param world the world containing the block the wrench is used on. - * @param x the X coordinate of the block. - * @param y the Y coordinate of the block. - * @param z the Z coordinate of the block. - * @param simulate whether to simulate the usage. - * @return whether the wrench can be used on the block. - */ - boolean useWrenchOnBlock(EntityPlayer player, World world, int x, int y, int z, boolean simulate); -} diff --git a/src/api/java/li/cil/oc/api/internal/package-info.java b/src/api/java/li/cil/oc/api/internal/package-info.java deleted file mode 100755 index 769993c1b..000000000 --- a/src/api/java/li/cil/oc/api/internal/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This package provides interfaces that are implemented by OC internal - * classes so that they can be checked for and used by type checking and - * casting to these interfaces. - *

- * For example, to determine whether a tile entity is a robot, you can - * do an instanceof with the {@link li.cil.oc.api.internal.Robot} - * interface - and cast to it if you wish to access some of the provided - * functionality. - *

- * The other main use-case is in {@link li.cil.oc.api.driver.item.HostAware} - * drivers, where these interfaces can be used to check if the item can be - * used inside the specified environment (where the environment class may - * be assignable to one of the interfaces in this package). - */ -@cpw.mods.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Internal", - apiVersion = API.VERSION) -package li.cil.oc.api.internal; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/machine/Architecture.java b/src/api/java/li/cil/oc/api/machine/Architecture.java deleted file mode 100755 index 5503e447c..000000000 --- a/src/api/java/li/cil/oc/api/machine/Architecture.java +++ /dev/null @@ -1,167 +0,0 @@ -package li.cil.oc.api.machine; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import java.lang.annotation.*; - -/** - * This interface abstracts away any language specific details for the Machine. - *

- * This allows the introduction of other languages, e.g. computers that run - * assembly or some other language interpreter. The two architectures included - * in OpenComputers are the native Lua architecture (using native LuaC) and the - * Java Lua architecture (using LuaJ). - */ -public interface Architecture { - /** - * Used to check if the machine is fully initialized. If this is false no - * signals for detected components will be generated. Avoids duplicate - * signals if component_added signals are generated in the - * language's startup script, for already present components (see Lua's - * init.lua script). - *

- * This is also used to check whether limits on direct calls should be - * enforced or not - this allows a quick boot phase in the language's - * kernel logic before switching to business-as-usual. - * - * @return whether the machine is fully initialized. - */ - boolean isInitialized(); - - /** - * This is called when the amount of memory in the machine may have changed. - * This is usually triggered by the owner when its composition changes. For - * example this is called from computer cases' onInventoryChanged method. - *

- * The amount of memory should be computed from the list of components given. - * The architecture should immediately apply the new memory size - * - * @param components the components to use for computing the total memory. - * @return whether any memory is present at all. - */ - boolean recomputeMemory(Iterable components); - - /** - * Called when a machine starts up. Used to (re-)initialize the underlying - * architecture logic. For example, for Lua this creates a new Lua state. - *

- * This also sets up any built-in APIs for the underlying language, such as - * querying available memory, listing and interacting with components and so - * on. If this returns false the machine fails to start. - *

- * Note that the owning machine has not necessarily been connected to a - * network when this is called, in case this is called from the machine's - * load logic. Use {@link #onConnect()} for additional initialization that - * depends on a node network (such as connecting a ROM file system). - * - * @return whether the architecture was initialized successfully. - */ - boolean initialize(); - - /** - * Called when a machine stopped. Used to clean up any handles, memory and - * so on. For example, for Lua this destroys the Lua state. - */ - void close(); - - /** - * Performs a synchronized call initialized in a previous call to - * {@link #runThreaded(boolean)}. - *

- * This method is invoked from the main server thread, meaning it is safe - * to interact with the world without having to perform manual - * synchronization. - *

- * This method is expected to leave the architecture in a state so it is - * prepared to next be called with runThreaded(true). For example, - * the Lua architecture will leave the results of the synchronized call on - * the stack so they can be further processed in the next call to - * runThreaded. - */ - void runSynchronized(); - - /** - * Continues execution of the machine. The first call may be used to - * initialize the machine (e.g. for Lua we load the libraries in the first - * call so that the computers boot faster). After that the architecture - * should return true from {@link #isInitialized()}. - *

- * The resumed state is either a return from a synchronized call, when a - * synchronized call has been completed (via runSynchronized), or - * a normal yield in all other cases (sleep, interrupt, boot, ...). - *

- * This is expected to return within a very short time, usually. For example, - * in Lua this returns as soon as the state yields, and returns at the latest - * when the Settings.timeout is reached (in which case it forces the state - * to crash). - *

- * This is expected to consume a single signal if one is present and return. - * If returning from a synchronized call this should consume no signal. - * - * @param isSynchronizedReturn whether the architecture is resumed from an - * earlier synchronized call. In the case of - * Lua this means the results of the call are - * now on the stack, for example. - * @return the result of the execution. Used to determine the new state. - */ - ExecutionResult runThreaded(boolean isSynchronizedReturn); - - /** - * Called when the owning machine was connected to the component network. - *

- * This can be useful for connecting custom file systems (read only memory) - * in case {@link #initialize()} was called from the machine's load logic - * (where it was not yet connected to the network). - */ - void onConnect(); - - /** - * Restores the state of this architecture as previously saved in - * {@link #save(NBTTagCompound)}. The architecture should be in the same - * state it was when it was saved after this, so it can be resumed from - * whatever state the owning machine was in when it was saved. - * - * @param nbt the tag compound to save to. - */ - void load(NBTTagCompound nbt); - - /** - * Saves the architecture for later restoration, e.g. across games or chunk - * unloads. Used to persist a machine's execution state. For native Lua this - * uses the Eris library to persist the main coroutine, for example. - *

- * Note that the tag compound is shared with the Machine. - * - * @param nbt the tag compound to save to. - */ - void save(NBTTagCompound nbt); - - /** - * Architectures can be annotated with this to provide a nice display name. - *

- * This is used when the name of an architecture has to be displayed to the - * user, such as when cycling architectures on a CPU. - */ - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.TYPE) - @interface Name { - String value(); - } - - /** - * Architectures flagged with this annotation can potentially run without - * any additional memory installed in the computer. - *

- * Use this to allow assembly of devices such as microcontrollers without - * any memory being installed in them while your architecture is being - * used by the CPU being installed. Note to actually make the machine - * start up you only need to always return true from - * {@link #recomputeMemory}. - */ - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.TYPE) - @Inherited - @interface NoMemoryRequirements { - } -} diff --git a/src/api/java/li/cil/oc/api/machine/Arguments.java b/src/api/java/li/cil/oc/api/machine/Arguments.java deleted file mode 100755 index a5a1c992c..000000000 --- a/src/api/java/li/cil/oc/api/machine/Arguments.java +++ /dev/null @@ -1,339 +0,0 @@ -package li.cil.oc.api.machine; - -import net.minecraft.item.ItemStack; - -import java.util.Map; - -/** - * This interface provides access to arguments passed to a {@link Callback}. - *

- * It allows checking for the presence of arguments in a uniform manner, taking - * care of proper type checking based on what can be passed along by Lua. - *

- * Note that integer values fetched this way are actually double values that - * have been truncated. So if a Lua program passes 1.9 and you do a - * checkInteger you'll get a 1. - *

- * The indexes passed to the various functions start at zero, i.e. to get the - * first argument you would use checkAny(0). This is worth mentioning - * because Lua starts its indexes at one. - */ -public interface Arguments extends Iterable { - /** - * The total number of arguments that were passed to the function. - */ - int count(); - - /** - * Get whatever is at the specified index. - *

- * Throws an error if there are too few arguments. - *

- * The returned object will be one of the following, based on the conversion - * performed internally: - *

    - *
  • null if the Lua value was nil.
  • - *
  • java.lang.Boolean if the Lua value was a boolean.
  • - *
  • java.lang.Double if the Lua value was a number.
  • - *
  • byte[] if the Lua value was a string.
  • - *
- * - * @param index the index from which to get the argument. - * @return the raw value at that index. - * @throws IllegalArgumentException if there is no argument at that index. - */ - Object checkAny(int index); - - /** - * Try to get a boolean value at the specified index. - *

- * Throws an error if there are too few arguments. - * - * @param index the index from which to get the argument. - * @return the boolean value at the specified index. - * @throws IllegalArgumentException if there is no argument at that index, - * or if the argument is not a boolean. - */ - boolean checkBoolean(int index); - - /** - * Try to get an integer value at the specified index. - *

- * Throws an error if there are too few arguments. - * - * @param index the index from which to get the argument. - * @return the integer value at the specified index. - * @throws IllegalArgumentException if there is no argument at that index, - * or if the argument is not a number. - */ - int checkInteger(int index); - - /** - * Try to get a double value at the specified index. - *

- * Throws an error if there are too few arguments. - * - * @param index the index from which to get the argument. - * @return the double value at the specified index. - * @throws IllegalArgumentException if there is no argument at that index, - * or if the argument is not a number. - */ - double checkDouble(int index); - - /** - * Try to get a string value at the specified index. - *

- * Throws an error if there are too few arguments. - *

- * This will actually check for a byte array and convert it to a string - * using UTF-8 encoding. - * - * @param index the index from which to get the argument. - * @return the boolean value at the specified index. - * @throws IllegalArgumentException if there is no argument at that index, - * or if the argument is not a string. - */ - String checkString(int index); - - /** - * Try to get a byte array at the specified index. - *

- * Throws an error if there are too few arguments. - * - * @param index the index from which to get the argument. - * @return the byte array at the specified index. - * @throws IllegalArgumentException if there is no argument at that index, - * or if the argument is not a byte array. - */ - byte[] checkByteArray(int index); - - /** - * Try to get a table at the specified index. - *

- * Throws an error if there are too few arguments. - * - * @param index the index from which to get the argument. - * @return the table at the specified index. - * @throws IllegalArgumentException if there is no argument at that index, - * or if the argument is not a table. - */ - Map checkTable(int index); - - /** - * Try to get an item stack representation at the specified index. - *

- * This is a utility method provided to convert tables to item stacks, with - * the tables being of a compatible format to that of tables generated by - * the built-in item stack converter. In particular, this takes care of - * restoring NBT data attached to the item stack. - *

- * Throws an error if there are too few arguments. - *

- * Important: usually you will not want to be using this. Some - * items require NBT information to fully describe them, and by default - * this information is not returned to underlying architectures when - * item stacks are returned from callbacks. This means the scripts can - * usually not provide this full information, so the roundtrip callback-> - * script->callback will be incomplete. - *

- * Instead, please make use of the {@link li.cil.oc.api.internal.Database} - * component to get complete item stack descriptors. - * - * @param index the index from which to get the argument. - * @return the item stack at the specified index. - */ - ItemStack checkItemStack(int index); - - /** - * Get whatever is at the specified index. - *

- * Return the specified default value if there is no such element, behaves - * like {@link #checkAny(int)} otherwise. - *

- * The returned object will be one of the following, based on the conversion - * performed internally: - *

    - *
  • null if the Lua value was nil.
  • - *
  • java.lang.Boolean if the Lua value was a boolean.
  • - *
  • java.lang.Double if the Lua value was a number.
  • - *
  • byte[] if the Lua value was a string.
  • - *
- * - * @param index the index from which to get the argument. - * @return the raw value at that index. - */ - Object optAny(int index, Object def); - - /** - * Try to get a boolean value at the specified index. - *

- * Return the specified default value if there is no such element, behaves - * like {@link #checkBoolean(int)} otherwise. - * - * @param index the index from which to get the argument. - * @return the boolean value at the specified index. - * @throws IllegalArgumentException if the argument exists and is not a boolean. - */ - boolean optBoolean(int index, boolean def); - - /** - * Try to get an integer value at the specified index. - *

- * Return the specified default value if there is no such element, behaves - * like {@link #checkInteger(int)} otherwise. - * - * @param index the index from which to get the argument. - * @return the integer value at the specified index. - * @throws IllegalArgumentException if the argument exists but is not a number. - */ - int optInteger(int index, int def); - - /** - * Try to get a double value at the specified index. - *

- * Return the specified default value if there is no such element, behaves - * like {@link #checkDouble(int)} otherwise. - * - * @param index the index from which to get the argument. - * @return the double value at the specified index. - * @throws IllegalArgumentException if the argument exists and is not a number. - */ - double optDouble(int index, double def); - - /** - * Try to get a string value at the specified index. - *

- * Return the specified default value if there is no such element, behaves - * like {@link #checkString(int)} otherwise. - *

- * This will actually check for a byte array and convert it to a string - * using UTF-8 encoding. - * - * @param index the index from which to get the argument. - * @return the boolean value at the specified index. - * @throws IllegalArgumentException if the argument exists and is not a string. - */ - String optString(int index, String def); - - /** - * Try to get a byte array at the specified index. - *

- * Return the specified default value if there is no such element, behaves - * like {@link #checkByteArray(int)} otherwise. - * - * @param index the index from which to get the argument. - * @return the byte array at the specified index. - * @throws IllegalArgumentException if the argument exists and is not a byte array. - */ - byte[] optByteArray(int index, byte[] def); - - /** - * Try to get a table at the specified index. - *

- * Return the specified default value if there is no such element, behaves - * like {@link #checkTable(int)} otherwise. - * - * @param index the index from which to get the argument. - * @return the table at the specified index. - * @throws IllegalArgumentException if the argument exists and is not a table. - */ - Map optTable(int index, Map def); - - /** - * Try to get an item stack at the specified index. - *

- * Return the specified default value if there is no such element, behaves - * like {@link #checkItemStack(int)} otherwise. - * - * @param index the index from which to get the argument. - * @return the item stack at the specified index. - * @throws IllegalArgumentException if the argument exists and is not an item stack. - */ - ItemStack optItemStack(int index, ItemStack def); - - /** - * Tests whether the argument at the specified index is a boolean value. - *

- * This will return false if there is no argument at the specified - * index, i.e. if there are too few arguments. - * - * @param index the index to check. - * @return true if the argument is a boolean; false otherwise. - */ - boolean isBoolean(int index); - - /** - * Tests whether the argument at the specified index is an integer value. - *

- * This will return false if there is no argument at the specified - * index, i.e. if there are too few arguments. - * - * @param index the index to check. - * @return true if the argument is an integer; false otherwise. - */ - boolean isInteger(int index); - - /** - * Tests whether the argument at the specified index is a double value. - *

- * This will return false if there is no argument at the specified - * index, i.e. if there are too few arguments. - * - * @param index the index to check. - * @return true if the argument is a double; false otherwise. - */ - boolean isDouble(int index); - - /** - * Tests whether the argument at the specified index is a string value. - *

- * This will return false if there is no argument at the specified - * index, i.e. if there are too few arguments. - * - * @param index the index to check. - * @return true if the argument is a string; false otherwise. - */ - boolean isString(int index); - - /** - * Tests whether the argument at the specified index is a byte array. - *

- * This will return false if there is no argument at the specified - * index, i.e. if there are too few arguments. - * - * @param index the index to check. - * @return true if the argument is a byte array; false otherwise. - */ - boolean isByteArray(int index); - - /** - * Tests whether the argument at the specified index is a table. - *

- * This will return false if there is no argument at the specified - * index, i.e. if there are too few arguments. - * - * @param index the index to check. - * @return true if the argument is a table; false otherwise. - */ - boolean isTable(int index); - - /** - * Tests whether the argument at the specified index is an item stack. - *

- * This will return false if there is no argument at the specified - * index, i.e. if there are too few arguments. - * - * @param index the index to check. - * @return true if the argument is an item stack; false otherwise. - */ - boolean isItemStack(int index); - - /** - * Converts the argument list to a standard Java array, converting byte - * arrays to strings automatically, since this is usually what others - * want - if you need the actual raw byte arrays, don't use this method! - * - * @return an array containing all arguments. - */ - Object[] toArray(); -} diff --git a/src/api/java/li/cil/oc/api/machine/Callback.java b/src/api/java/li/cil/oc/api/machine/Callback.java deleted file mode 100755 index 6c67d1662..000000000 --- a/src/api/java/li/cil/oc/api/machine/Callback.java +++ /dev/null @@ -1,147 +0,0 @@ -package li.cil.oc.api.machine; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * This annotation can be used for methods in an {@link li.cil.oc.api.network.Environment} to mark - * them for exposure to computers. - *

- * Any method exposed like this can be enumerated and called from a computer - * that can see the node of the environment. - *

- * Note that methods annotated with this interface must have the following - * signature: - *

- *     Object[] f(Context context, Arguments arguments) throws Exception;
- * 
- *

- * The method may return null in case it doesn't wish return anything, - * which is functionally equivalent to returning an empty array. - *

- * To raise an error from your callback, simply throw an exception. The - * convention for Lua is to return (null, "reason") for 'soft' errors, i.e. - * errors that are no fault of the caller. For example, passing invalid - * arguments will generate an exception, requesting information and the lookup - * of said information failing should not. - * - * @see Context - * @see li.cil.oc.api.machine.Arguments - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface Callback { - /** - * The name under which to make the callback available. - *

- * This defaults to the name of the annotated method if left empty. - */ - String value() default ""; - - /** - * Whether this function may be called directly from the computer's executor - * thread instead of from the server thread. - *

- * You will have to ensure anything your callback does is thread safe when - * setting this to true. Use this for minor lookups, for example. - * This is mainly intended to allow functions to perform faster than when - * called 'synchronously' (where the call takes at least one server tick). - *

- * Keep in mind that the node {@link li.cil.oc.api.network.Network} is not thread safe! - * Be sure you know what you're doing if you're working with a node's - * network in a direct callback. - *

- * An exception to that rule is {@link li.cil.oc.api.network.Connector#changeBuffer(double)}, - * which is synchronized, so you can consume/produce power in direct calls. - */ - boolean direct() default false; - - /** - * The maximum number of direct calls that may be performed on this - * component in a single tick on a tier two computer. - *

- * This can be used to throttle call speed. For example, this is used by - * graphics cards to limit the amount of net traffic can be generated by - * updating the screen they are bound to. - *

- * You should generally apply a limit if the callback allocates persisting - * memory (i.e. memory that isn't freed once the call returns), sends - * network messages, or uses any other kind of resource for which it'd be - * bad if it were to be used from user programs in an unchecked, unregulated - * manner. - *

- * Note that the limit does not apply when the method is invoked - * via a direct call to {@link li.cil.oc.api.network.Component#invoke(String, Context, Object...)} - * from the host side. Also, this limit is per-computer, so the method may - * be invoked more often than this per tick, if different computers call it. - *

- * Note that the interpretation of this value changed a bit in OC 1.4. - * Before, it was the actual number of calls that could be performed on - * the component per tick. Now it's more of a general cost value: for each - * direct call a computer makes, 1/limit is subtracted from the - * computer's call budget. This budget may vary between computers, for - * example, tier three computers have a higher call budget than tier two - * computers. - */ - int limit() default Integer.MAX_VALUE; - - /** - * A documentation string that is made available to the computers the - * component this callback belongs to is connected to. This allows for - * ingame documentation of callbacks. - *

- * You may want to give a short description of what a method does here, but - * more importantly you should document the expected parameters and return - * type here. - *

- * Important: the recommended format is either
- * function(arg:type[, optionArg:type]):resultType -- Description.
- * or
- * function(arg:type[, optionArg:type]):resultType; Description.
- * where the argument list can be of any format (as long as it doesn't contain - * further braces), and the return type is optional. These two formats are - * recognized by OC's NEI component documentation plugin. If you use a - * different format, the doc string will be used as-is. - */ - String doc() default ""; - - /** - * Whether this callback should work like a getter. - *

- * Callbacks that are getters do not appear as methods on a component's - * proxy. Instead they are accessed as fields, for example in Lua via the - * proxy's __index metamethod, with its only parameter being the - * accessed key. - *

- * Note: if you wish to have a field that is read/write, that is you need - * both a getter and a setter, you have to implement them in the same - * method. This a limitation due to callback names being unique. You can - * differentiate between contexts by checking the number of arguments. - *

- * Important: this only works in environments (for components), - * it does not work for userdata (Value objects). For - * userdata, use the apply method instead. - */ - boolean getter() default false; - - /** - * Whether this callback should work like a setter. - *

- * Callbacks that are setters do not appear as methods on a component's - * proxy. Instead they are accessed as fields, for example in Lua via the - * proxy's __newindex metamethod, with its only two parameters - * being the accessed key and the new value. - *

- * Note: if you wish to have a field that is read/write, that is you need - * both a getter and a setter, you have to implement them in the same - * method. This a limitation due to callback names being unique. You can - * differentiate between contexts by checking the number of arguments. - *

- * Important: this only works in environments (for components), - * it does not work for userdata (Value objects). For - * userdata, use the unapply method instead. - */ - boolean setter() default false; -} diff --git a/src/api/java/li/cil/oc/api/machine/Context.java b/src/api/java/li/cil/oc/api/machine/Context.java deleted file mode 100755 index fe82dacb6..000000000 --- a/src/api/java/li/cil/oc/api/machine/Context.java +++ /dev/null @@ -1,167 +0,0 @@ -package li.cil.oc.api.machine; - -import li.cil.oc.api.network.Node; - -/** - * This is used to provide some context to {@link li.cil.oc.api.machine.Callback}s, i.e. the - * computer from which the callback was called. - */ -public interface Context { - /** - * The node through which the computer is attached to the component network. - */ - Node node(); - - /** - * Tests whether a player is allowed to use the computer. - *

- * If enabled in the server's configuration, computers can be owned by - * players. This means that only players that are in a computer's user list - * may interact with it, i.e. only players in the user list may: - *

    - *
  • Trigger input via a keyboard.
  • - *
  • Change the computer's inventory.
  • - *
  • Break the computer block.
  • - *
- *

- * There are three exceptions to this rule: - *

    - *
  • Operators are always allowed the above actions.
  • - *
  • If the user list is empty then all players are - * allowed the above actions.
  • - *
  • In single player mode the player is always allowed the above - * actions.
  • - *
- *

- * Use this to check whether you should signal something to the computer, - * for example. Note that for signals triggered via network messages there - * is a computer.checked_signal message, that expects an - * EntityPlayer as the first argument and performs this check - * before pushing the signal. - * - * @param player the name of the player to check for. - * @return whether the player with the specified name may use the computer. - */ - boolean canInteract(String player); - - /** - * Whether the computer is currently in a running state, i.e. it is neither - * paused, stopping or stopped. - *

- * The computer thread may or may not be running while the computer is in - * this state. The computer will accept signals while in this state. - */ - boolean isRunning(); - - /** - * Whether the computer is currently in a paused state. - *

- * The computer thread is not running while the computer is in this state. - * The computer will accept signals while in this state. - */ - boolean isPaused(); - - /** - * Starts the computer. - *

- * The computer will enter a starting state, in which it will start - * accepting signals. The computer will start executing in the next server - * tick. - *

- * If this is called while the computer is in a paused state it will set the - * remaining pause time to zero, but it will not immediately resume - * the computer. The computer will continue with what it did before it was - * paused in the next server tick. - *

- * If this is called while the computer is in a non-paused and non-stopped - * state it will do nothing and return false. - * - * @return true if the computer switched to a running state. - */ - boolean start(); - - /** - * Pauses the computer for the specified duration. - *

- * If this is called from a direct callback the computer will only - * pause after the current task has completed, possibly leading to no pause - * at all. If this is called from a non-direct callback the - * computer will be paused for the specified duration before the call - * returns. Use this to add artificial delays, e.g. for expensive or - * powerful operations (say, scanning blocks surrounding a computer). - *

- * Important: if this is called from the server thread while - * the executor thread is running this will block until the - * computer finishes its current task. The pause will be applied after that. - * This is usually a bad thing to do, since it may lag the game, but can be - * handy to synchronize the computer thread to the server thread. For - * example, this is used when saving screens, which are controlled mostly - * via direct callbacks.
- * However, if the computer is already in a paused state - * and the call would not lead to a longer pause this will immediately - * return false, without blocking. - *

- * Note that the computer still accepts signals while in paused state, so - * it is generally better to avoid long pauses, to avoid a signal queue - * overflow, which would lead to some signals being dropped. - *

- * Also note that the time left to spend paused is stored in game ticks, so - * the time resolution is actually quite limited. - *

- * If this is called while the computer is in a paused, stopping or stopped - * state this will do nothing and return false. - * - * @param seconds the number of seconds to pause the computer for. - * @return true if the computer switched to the paused state. - */ - boolean pause(double seconds); - - /** - * Stops the computer. - *

- * The computer will enter a stopping state, in which it will not - * accept new signals. It will be fully stopped in the next server tick. It - * is not possible to return to a running state from a stopping state. If - * start is called while in a stopping state the computer will be rebooted. - *

- * If this is called from a callback, the callback will still finish, but - * its result will be discarded. If this is called from the server thread - * while the executor thread is running the computer in the background, it - * will finish its current work and the computer will be stopped in some - * future server tick after it has completed. - *

- * If this is called while the computer is in a stopping or stopped state - * this will do nothing and return false. - * - * @return true if the computer switched to the stopping state. - */ - boolean stop(); - - /** - * Push a signal into the computer. - *

- * Signals are processed sequentially by the computer, and are queued in a - * queue with limited length. If the queue is full and the signal could not - * be pushed this will return false. - *

- * Note that only a limited amount of types is supported for arguments: - *

    - *
  • null and Scala's Unit and None (all appear - * as nil on the Lua side, for example)
  • - *
  • Boolean values.
  • - *
  • Numeric types (byte, short, int, long, float, double).
  • - *
  • Strings.
  • - *
  • Byte arrays (which appear as strings on the Lua side, e.g.).
  • - *
  • Maps if and only if both keys and values are strings.
  • - *
  • NBTTagCompounds.
  • - *
- * If an unsupported type is specified the method will enqueue nothing - * instead, resulting in a nil on the Lua side, e.g., and log a - * warning. - * - * @param name the name of the signal to push. - * @param args additional arguments to pass along with the signal. - * @return true if the signal was queued; false otherwise. - */ - boolean signal(String name, Object... args); -} diff --git a/src/api/java/li/cil/oc/api/machine/ExecutionResult.java b/src/api/java/li/cil/oc/api/machine/ExecutionResult.java deleted file mode 100755 index b538c05d9..000000000 --- a/src/api/java/li/cil/oc/api/machine/ExecutionResult.java +++ /dev/null @@ -1,66 +0,0 @@ -package li.cil.oc.api.machine; - -/** - * Used by the Machine to determine the result of a call to - * {@link Architecture#runThreaded(boolean)}. - *

- * Do not implement this interface, only use the predefined internal classes. - */ -public abstract class ExecutionResult { - /** - * Indicates the machine may sleep for the specified number of ticks. This - * is merely considered a suggestion. If signals are in the queue or are - * pushed to the queue while sleeping, the sleep will be interrupted and - * {@link Architecture#runThreaded(boolean)} will be called so that the next - * signal is pushed. - */ - public static final class Sleep extends ExecutionResult { - /** - * The number of ticks to sleep. - */ - public final int ticks; - - public Sleep(int ticks) { - this.ticks = ticks; - } - } - - /** - * Indicates tha the computer should shutdown or reboot. - */ - public static final class Shutdown extends ExecutionResult { - /** - * Whether to reboot. If false the computer will stop. - */ - public final boolean reboot; - - public Shutdown(boolean reboot) { - this.reboot = reboot; - } - } - - /** - * Indicates that a synchronized call should be performed. The architecture - * is expected to be in a state that allows the next call to be to - * {@link Architecture#runSynchronized()} instead of - * {@link Architecture#runThreaded(boolean)}. This is used to perform calls - * from the server's main thread, to avoid threading issues when interacting - * with other objects in the world. - */ - public static final class SynchronizedCall extends ExecutionResult { - } - - /** - * Indicates that an error occurred and the computer should crash. - */ - public static final class Error extends ExecutionResult { - /** - * The error message. - */ - public final String message; - - public Error(String message) { - this.message = message; - } - } -} diff --git a/src/api/java/li/cil/oc/api/machine/LimitReachedException.java b/src/api/java/li/cil/oc/api/machine/LimitReachedException.java deleted file mode 100755 index 69d46eab6..000000000 --- a/src/api/java/li/cil/oc/api/machine/LimitReachedException.java +++ /dev/null @@ -1,8 +0,0 @@ -package li.cil.oc.api.machine; - -/** - * Used to signal that the direct call limit for the current server tick has - * been reached in {@link Machine#invoke(String, String, Object[])}. - */ -public class LimitReachedException extends Exception { -} diff --git a/src/api/java/li/cil/oc/api/machine/Machine.java b/src/api/java/li/cil/oc/api/machine/Machine.java deleted file mode 100755 index 43cc0667b..000000000 --- a/src/api/java/li/cil/oc/api/machine/Machine.java +++ /dev/null @@ -1,309 +0,0 @@ -package li.cil.oc.api.machine; - -import li.cil.oc.api.network.ManagedEnvironment; - -import java.util.Map; - -/** - * This interface allows interacting with a Machine obtained via the factory - * method {@link li.cil.oc.api.Machine#create(MachineHost)}. - */ -@SuppressWarnings("unused") -public interface Machine extends ManagedEnvironment, Context { - /** - * The owner of the machine, usually a tile entity hosting the machine. - * - * @return the owner of the machine. - */ - MachineHost host(); - - /** - * This must be called from the host when something relevant to the - * machine changes, such as a change in the amount of available memory. - */ - void onHostChanged(); - - /** - * The underlying architecture of the machine. - *

- * This is what actually evaluates code running on the machine, where the - * machine class itself serves as a scheduler. - *

- * This may be null, for example when the hosting computer has - * no CPU installed. - * - * @return the architecture of this machine. - */ - Architecture architecture(); - - /** - * The list of components attached to this machine. - *

- * This maps address to component type/name. Note that the list may not - * immediately reflect changes after components were added to the network, - * since such changes are cached in an internal list of 'added components' - * that are processed in the machine's update logic (i.e. server tick). - *

- * This list is kept up-to-date automatically, do not mess with it. - * - * @return the list of attached components. - */ - Map components(); - - /** - * The number of connected components. - *

- * This number can differ from components().size(), since this is - * the number of actually connected components, which is used to - * determine whether the component limit has been exceeded, for example. It - * takes into account components added but not processed, yet (see also - * {@link #components()}). - * - * @return the number of connected components. - */ - int componentCount(); - - /** - * The maximum number of components this machine can currently support. - *

- * This is automatically recomputed based on the hosts internal components - * whenever the host calls {@link Machine#onHostChanged()}. - * - * @return the maximum number of components supported. - */ - int maxComponents(); - - /** - * Gets the amount of energy this machine consumes per tick when it is - * running. - * - * @return the energy consumed per tick by the machine. - */ - double getCostPerTick(); - - /** - * Sets the amount of energy this machine consumes per tick when it is - * running. - * - * @param value the energy consumed per tick by the machine. - */ - void setCostPerTick(double value); - - /** - * The address of the file system that holds the machine's temporary files - * (tmpfs). This may return null if either the creation of the file - * system failed, or if the size of the tmpfs has been set to zero in the - * config. - *

- * Use this in a custom architecture to allow code do differentiate the - * tmpfs from other file systems, for example. - * - * @return the address of the tmpfs component, or null. - */ - String tmpAddress(); - - /** - * A string with the last error message. - *

- * The error string is set either when the machine crashes (see the - * {@link #crash(String)} method), or when it fails to start (which, - * technically, is also a crash). - *

- * When the machine started, this is reset to null. - * - * @return the last error message, or null. - */ - String lastError(); - - /** - * The current world time. This is updated each tick and provides a thread - * safe way to access the world time for architectures. - *

- * This is equivalent to owner().world().getWorldTime(). - * - * @return the current world time. - */ - long worldTime(); - - /** - * The time that has passed since the machine was started, in seconds. - *

- * Note that this is actually measured in world time, so the resolution is - * pretty limited. This is done to avoid 'time skips' when leaving the game - * and coming back later, resuming a persisted machine. - */ - double upTime(); - - /** - * The time spent running the underlying architecture in execution threads, - * i.e. the time spent in {@link Architecture#runThreaded(boolean)} since - * the machine was last started, in seconds. - */ - double cpuTime(); - - // ----------------------------------------------------------------------- // - - /** - * Play a sound using the machine's built-in speaker. - *

- * This is what's used to emit beep codes when an error occurs while trying - * to start the computer, for example, and what's used for playing sounds - * when computer.beep is called. - *

- * Be responsible in how you limit calls to this, as each call will cause - * a packet to be sent to all nearby clients, and will cause the receiving - * clients to generate the required sound sample on-the-fly. It is - * therefore recommended to not call this too frequently, and to limit the - * length of the sound to something relatively short (not longer than a few - * seconds at most). - *

- * The audio will be played at the machine's host's location. - * - * @param frequency the frequency of the tone to generate. - * @param duration the duration of the tone to generate, in milliseconds. - */ - void beep(short frequency, short duration); - - /** - * Utility method for playing beep codes. - *

- * The underlying functionality is similar to that of {@link #beep(short, short)}, - * except that this will play tones at a fixed frequency, and two different - * durations - in a pattern as defined in the passed string. - *

- * This is useful for generating beep codes, such as for boot errors. It - * has the advantage of only generating a single network packet, and - * generating a single, longer sound sample for the full pattern. As such - * the same considerations should be made as for {@link #beep(short, short)}, - * i.e. prefer not to use overly long patterns. - *

- * The passed pattern must consist of dots (.) and dashes (-), - * where a dot is short tone, and a dash is a long tone. - *

- * The audio will be played at the machine's host's location. - * - * @param pattern the beep pattern to play. - */ - void beep(String pattern); - - /** - * Crashes the computer. - *

- * This is exactly the same as {@link Context#stop()}, except that it also - * sets the error message in the machine. This message can be seen when the - * Analyzer is used on computer cases, for example. - * - * @param message the message to set. - * @return true if the computer switched to the stopping state. - */ - boolean crash(String message); - - /** - * Tries to pop a signal from the queue and returns it. - *

- * Signals are stored in a FIFO queue of limited size. This method is / must - * be called by architectures regularly to process the queue. - * - * @return a signal or null if the queue was empty. - */ - Signal popSignal(); - - /** - * Get a list of all methods and their annotations of the specified object. - *

- * The specified object can be either a {@link Value} - * or a {@link li.cil.oc.api.network.Environment}. This is useful for - * custom architectures, to allow providing a list of callback methods to - * evaluated programs. - * - * @param value the value to get the method listing for. - * @return the methods that can be called on the object. - */ - Map methods(Object value); - - /** - * Makes the machine call a component callback. - *

- * This is intended to be used from architectures, but may be useful in - * other scenarios, too. It will make the machine call the method with the - * specified name on the attached component with the specified address. - *

- * This will perform a visibility check, ensuring the component can be seen - * from the machine. It will also ensure that the direct call limit for - * individual callbacks is respected. - * - * @param address the address of the component to call the method on. - * @param method the name of the method to call. - * @param args the list of arguments to pass to the callback. - * @return a list of results returned by the callback, or null. - * @throws LimitReachedException when the called method supports direct - * calling, but the number of calls in this - * tick has exceeded the allowed limit. - * @throws IllegalArgumentException if there is no such component. - * @throws Exception if the callback throws an exception. - */ - Object[] invoke(String address, String method, Object[] args) throws Exception; - - /** - * Makes the machine call a value callback. - *

- * This is intended to be used from architectures, but may be useful in - * other scenarios, too. It will make the machine call the method with the - * specified name on the specified value. - *

- * This will will ensure that the direct call limit for individual - * callbacks is respected. - * - * @param value the value to call the method on. - * @param method the name of the method to call. - * @param args the list of arguments to pass to the callback. - * @return a list of results returned by the callback, or null. - * @throws LimitReachedException when the called method supports direct - * calling, but the number of calls in this - * tick has exceeded the allowed limit. - * @throws IllegalArgumentException if there is no such component. - * @throws Exception if the callback throws an exception. - */ - Object[] invoke(Value value, String method, Object[] args) throws Exception; - - // ----------------------------------------------------------------------- // - - /** - * The list of users registered on this machine. - *

- * This list is used for {@link Context#canInteract(String)}. Exposed for - * informative purposes only, for example to expose it to user code. Note - * that the returned array is a copy of the internal representation of the - * user list. Changing it has no influence on the actual list. - * - * @return the list of registered users. - */ - String[] users(); - - /** - * Add a player to the machine's list of users, by username. - *

- * This requires for the player to be online. - * - * @param name the name of the player to add as a user. - * @throws Exception if - *

    - *
  • There are already too many users.
  • - *
  • The player is already registered.
  • - *
  • The provided name is too long.
  • - *
  • The player is not online.
  • - *
- */ - void addUser(String name) throws Exception; - - /** - * Removes a player as a user from this machine, by username. - *

- * Unlike when adding players, the player does not have to be - * online to be removed from the list. - * - * @param name the name of the player to remove. - * @return whether the player was removed from the user list. - */ - boolean removeUser(String name); -} diff --git a/src/api/java/li/cil/oc/api/machine/MachineHost.java b/src/api/java/li/cil/oc/api/machine/MachineHost.java deleted file mode 100755 index bade1f0eb..000000000 --- a/src/api/java/li/cil/oc/api/machine/MachineHost.java +++ /dev/null @@ -1,58 +0,0 @@ -package li.cil.oc.api.machine; - -import li.cil.oc.api.driver.EnvironmentHost; -import li.cil.oc.api.network.Environment; -import li.cil.oc.api.network.Node; -import net.minecraft.item.ItemStack; - -/** - * This interface has to be implemented by 'hosts' of machine instances. - *

- * It provides some context for the machine, in particular which world it is - * running in, to allow querying the time of day, for example. - */ -public interface MachineHost extends EnvironmentHost { - /** - * The machine currently hosted. - */ - Machine machine(); - - /** - * List of all components that are built into this machine directly. - *

- * This is used to find CPUs, component buses and memory. - */ - Iterable internalComponents(); - - /** - * Get the slot a component with the specified address is in. - *

- * This is intended to allow determining the slot of item - * components sitting in computers. For other components this returns - * negative values. - * - * @param address the address of the component to get the slot for. - * @return the index of the slot the component is in. - */ - int componentSlot(String address); - - /** - * This is called on the owner when the machine's {@link Environment#onConnect(Node)} - * method gets called. This can be useful for reacting to network events - * when the owner does not have its own node (for example, computer cases - * expose their machine's node as their own node). This callback allows it - * to connect its components (graphics cards and the like) when it is - * connected to a node network (when added to the world, for example). - * - * @param node the node that was connected to the network. - */ - void onMachineConnect(Node node); - - /** - * Like {@link #onMachineConnect(Node)}, except that this is called whenever - * the machine's {@link Environment#onDisconnect(Node)} method is called. - * - * @param node the node that was disconnected from the network. - */ - void onMachineDisconnect(Node node); -} diff --git a/src/api/java/li/cil/oc/api/machine/Signal.java b/src/api/java/li/cil/oc/api/machine/Signal.java deleted file mode 100755 index f74581c67..000000000 --- a/src/api/java/li/cil/oc/api/machine/Signal.java +++ /dev/null @@ -1,19 +0,0 @@ -package li.cil.oc.api.machine; - -/** - * A single signal that was queued on a machine. - *

- * This interface is not intended to be implemented, it only serves as a return - * type for {@link Machine#popSignal()}. - */ -public interface Signal { - /** - * The name of the signal. - */ - String name(); - - /** - * The list of arguments for the signal. - */ - Object[] args(); -} diff --git a/src/api/java/li/cil/oc/api/machine/Value.java b/src/api/java/li/cil/oc/api/machine/Value.java deleted file mode 100755 index 71352c28f..000000000 --- a/src/api/java/li/cil/oc/api/machine/Value.java +++ /dev/null @@ -1,77 +0,0 @@ -package li.cil.oc.api.machine; - -import li.cil.oc.api.Persistable; - -/** - * A value object can be pushed to a machine like a primitive value. - *

- * This is the only non-primitive type that can be pushed to machines, allowing - * for much more advanced interaction, since the methods on this value can be - * called from Lua directly. This is similar to component callbacks, but at the - * same time very different, because these objects can be pushed as results - * from callbacks, therefore outliving their component, for example. - *

- * There are a few limitations too keep in mind: - *

    - *
  • Values must have a default constructor for loading.
  • - *
  • Values must be persistable (implement save/load).
  • - *
- *

- * Callbacks can be defined in a manner similar to environments, e.g. using the - * {@link Callback} annotation. - */ -public interface Value extends Persistable { - /** - * This is called when the code running on a machine tries to index this - * value. - * - * @param context the context from which the method is called, usually the - * instance of the computer running the script that made - * the call. - * @param arguments the arguments passed to the method. - * @return the current value at the specified index, or null. - */ - Object apply(Context context, Arguments arguments); - - /** - * This is called when the code running on a machine tries to assign a new - * value at the specified index of this value. - *

- * Does nothing if the value is not indexable. - * - * @param context the context from which the method is called, usually the - * instance of the computer running the script that made - * the call. - * @param arguments the arguments passed to the method. - */ - void unapply(Context context, Arguments arguments); - - /** - * This is called when the code running on a machine tries to call this - * value as a function. - *

- * If this value is not callable, throws an exception. - * - * @param context the context from which the method is called, usually the - * instance of the computer running the script that made - * the call. - * @param arguments the arguments passed to the method. - * @return the result of the call. - * @throws RuntimeException if this value is not callable. - */ - Object[] call(Context context, Arguments arguments); - - /** - * This is called when the object's representation in the machine it was - * pushed to is garbage collected. - *

- * Important: be aware of the consequences of pushing the same - * object to multiple machines. You should usually not do that, - * but if you do, realize this method may be called by either machine. - * - * @param context the context from which the method is called, usually the - * instance of the computer running the script that just - * garbage collected the object. - */ - void dispose(Context context); -} diff --git a/src/api/java/li/cil/oc/api/machine/package-info.java b/src/api/java/li/cil/oc/api/machine/package-info.java deleted file mode 100755 index e9dfb589b..000000000 --- a/src/api/java/li/cil/oc/api/machine/package-info.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This package provides low level machine access. - *

- * Using the {@link li.cil.oc.api.Machine} class, you can create new machine - * instances, i.e. essentially computer "cores", that will run code. This allows - * you to implement your own computer blocks. Or robots. Or whatever you come up - * with. - *

- * The interfaces in here also allow you to implement an arbitrary new - * {@link li.cil.oc.api.machine.Architecture}, which can then be used when - * creating a new {@link li.cil.oc.api.machine.Machine} using the factory - * methods in {@link li.cil.oc.api.Machine}. An architecture could be a custom - * language interpreter, or a full blown hardware emulator for old microchips. - *

- * There are also a couple of interfaces in here that are not meant to be - * implemented, but merely to allow accessing some mod internals in a regulated - * fashion, such as {@link li.cil.oc.api.internal.Robot}. - */ -@cpw.mods.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Machine", - apiVersion = API.VERSION) -package li.cil.oc.api.machine; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/manual/ContentProvider.java b/src/api/java/li/cil/oc/api/manual/ContentProvider.java deleted file mode 100755 index f36b45440..000000000 --- a/src/api/java/li/cil/oc/api/manual/ContentProvider.java +++ /dev/null @@ -1,29 +0,0 @@ -package li.cil.oc.api.manual; - -/** - * This interface allows implementation of content providers for the manual. - *

- * Content providers can be used to provide possibly dynamic page content for - * arbitrary paths. Note that content providers have lower priority - * than content found in resource packs, i.e. content providers will only be - * queried for missing pages, so to speak. - *

- * - * @see li.cil.oc.api.prefab.ResourceContentProvider - */ -public interface ContentProvider { - /** - * Called to get the content of a path pointed to by the specified path. - *

- * This should provide an iterable over the lines of a Markdown document - * (with the formatting provided by the in-game manual, which is a small - * subset of "normal" Markdown). - *

- * If this provider cannot provide the requested path, it should return - * null to indicate so, allowing other providers to be queried. - * - * @param path the path to the manual page we're looking for. - * @return the content of the document at that path, or null. - */ - Iterable getContent(String path); -} diff --git a/src/api/java/li/cil/oc/api/manual/ImageProvider.java b/src/api/java/li/cil/oc/api/manual/ImageProvider.java deleted file mode 100755 index 4bdb12fb4..000000000 --- a/src/api/java/li/cil/oc/api/manual/ImageProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -package li.cil.oc.api.manual; - -/** - * This allows implementing custom image providers for rendering custom content - * in manual pages. Each provider can be registered for one or more prefixes, - * and will be selected based on the prefix it was registered with. It is - * expected to return an image renderer, which essentially represents the - * area it will render to. - */ -public interface ImageProvider { - /** - * Gets an image renderer for the specified data. - *

- * The data passed here will be part of the image URL following the prefix - * that the provider was registered with. So for example, if the provider - * was registered for the prefix custom, and the image to be - * rendered in the Markdown document was [blah](custom:the data], - * then the string passed where would be the data. - *

- * If there is no appropriate image renderer (for example, for the built-in - * item stack renderers: if the item definition is invalid), this should - * return null, it should never throw an exception. - * - * @param data the data part of the image definition. - * @return the image renderer for the data. - */ - ImageRenderer getImage(String data); -} diff --git a/src/api/java/li/cil/oc/api/manual/ImageRenderer.java b/src/api/java/li/cil/oc/api/manual/ImageRenderer.java deleted file mode 100755 index 2dcad21f7..000000000 --- a/src/api/java/li/cil/oc/api/manual/ImageRenderer.java +++ /dev/null @@ -1,47 +0,0 @@ -package li.cil.oc.api.manual; - -/** - * This allows implementing custom image renderers. - *

- * Image renderers are used to draw custom areas in a manual page, defined as - * an image with a special URL, matching the prefix of a registered image - * provider. A renderer will then be used to draw something at the position - * of the image tag. - *

- * Built-in image renderers are item, block and oredict. - */ -public interface ImageRenderer { - /** - * The width of the area this renderer uses. - *

- * This is used to offset the OpenGL state properly before calling - * {@link #render(int, int)}, to correctly align the image horizontally. - * - * @return the width of the rendered image. - */ - int getWidth(); - - /** - * The height of the area this renderer uses. - *

- * This is used to offset the OpenGL state properly before calling - * {@link #render(int, int)}, as well as to know where to resume rendering - * other content below the image. - * - * @return the height of the rendered image. - */ - int getHeight(); - - /** - * Render the image, with specified maximum width. - *

- * This should render the image as is, the OpenGL state will be set up - * such that you can start drawing at (0,0,*), and render up to - * (getWidth,getHeight,*), i.e. translation and scaling are taken care - * of for you. - * - * @param mouseX the X position of the mouse relative to the element. - * @param mouseY the Y position of the mouse relative to the element. - */ - void render(int mouseX, int mouseY); -} diff --git a/src/api/java/li/cil/oc/api/manual/InteractiveImageRenderer.java b/src/api/java/li/cil/oc/api/manual/InteractiveImageRenderer.java deleted file mode 100755 index cad23de5a..000000000 --- a/src/api/java/li/cil/oc/api/manual/InteractiveImageRenderer.java +++ /dev/null @@ -1,35 +0,0 @@ -package li.cil.oc.api.manual; - -/** - * Allows implementing advanced image renderers that react to mouse input and - * specify customized tooltips. - *

- * This way you can e.g. disable the default tooltip and render a more advanced - * one, or render a small GUI on a page. - */ -public interface InteractiveImageRenderer extends ImageRenderer { - /** - * Get a custom tooltip for this image renderer. - *

- * This can be used to override the original tooltip of an image. - * - * @param tooltip the original tooltip of the element. - * @return the tooltip to use for the element. - */ - String getTooltip(String tooltip); - - /** - * Called when the mouse is clicked while over this image renderer. - *

- * This only fires for left-clicks, because right-clicks are reserved for - * navigating back in the manual. - *

- * If this returns false and the element is a link, the link will - * be followed. If it returns true, it will not. - * - * @param mouseX the X coordinate of the mouse, relative to the element. - * @param mouseY the Y coordinate of the mouse, relative to the element. - * @return whether the click was handled. - */ - boolean onMouseClick(int mouseX, int mouseY); -} diff --git a/src/api/java/li/cil/oc/api/manual/PathProvider.java b/src/api/java/li/cil/oc/api/manual/PathProvider.java deleted file mode 100755 index c31b7f75c..000000000 --- a/src/api/java/li/cil/oc/api/manual/PathProvider.java +++ /dev/null @@ -1,45 +0,0 @@ -package li.cil.oc.api.manual; - -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * Allows providing paths for item stacks and blocks in the world. - *

- * This is used for generating NEI usage pages with a button opening the manual - * on the page at the specified path, or for opening the manual when held in - * hand and sneak-activating a block in the world. - *

- * This way you can easily make entries in your documentation available the - * same way OpenComputers does it itself. - *

- * Note that you can use the special variable %LANGUAGE% in your - * paths, for language agnostic paths. These will be resolved to the currently - * set language, falling back to en_US, during actual content lookup. - */ -public interface PathProvider { - /** - * Get the path to the documentation page for the provided item stack. - *

- * Return null if there is no known page for this item, allowing - * other providers to be queried. - * - * @param stack the stack to get the documentation path to. - * @return the path to the page, null if none is known. - */ - String pathFor(ItemStack stack); - - /** - * Get the path to the documentation page for the provided block. - *

- * Return null if there is no known page for this item, allowing - * other providers to be queried. - * - * @param world the world containing the block. - * @param x the X coordinate of the block. - * @param y the Y coordinate of the block. - * @param z the Z coordinate of the block. - * @return the path to the page, null if none is known. - */ - String pathFor(World world, int x, int y, int z); -} diff --git a/src/api/java/li/cil/oc/api/manual/TabIconRenderer.java b/src/api/java/li/cil/oc/api/manual/TabIconRenderer.java deleted file mode 100755 index 45b3a329f..000000000 --- a/src/api/java/li/cil/oc/api/manual/TabIconRenderer.java +++ /dev/null @@ -1,26 +0,0 @@ -package li.cil.oc.api.manual; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -/** - * Allows defining a renderer for a manual tab. - *

- * Each renderer instance represents the single graphic it is drawing. To - * provide different graphics for different tabs you'll need to create - * multiple tab renderer instances. - *

- * - * @see li.cil.oc.api.prefab.ItemStackTabIconRenderer - * @see li.cil.oc.api.prefab.TextureTabIconRenderer - */ -public interface TabIconRenderer { - /** - * Called when icon of a tab should be rendered. - *

- * This should render something in a 16x16 area. The OpenGL state has been - * adjusted so that drawing starts at (0,0,0), and should go to (16,16,0). - */ - @SideOnly(Side.CLIENT) - void render(); -} diff --git a/src/api/java/li/cil/oc/api/manual/package-info.java b/src/api/java/li/cil/oc/api/manual/package-info.java deleted file mode 100755 index 81ae1eec8..000000000 --- a/src/api/java/li/cil/oc/api/manual/package-info.java +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This package contains manual related interfaces. - *

- * The manual represents the in-game documentation of OpenComputers and any - * other mod that may choose to add its documentation to it, such as addon - * mods. - */ -@cpw.mods.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Manual", - apiVersion = API.VERSION) -package li.cil.oc.api.manual; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/network/Analyzable.java b/src/api/java/li/cil/oc/api/network/Analyzable.java deleted file mode 100755 index 769c12677..000000000 --- a/src/api/java/li/cil/oc/api/network/Analyzable.java +++ /dev/null @@ -1,34 +0,0 @@ -package li.cil.oc.api.network; - -import net.minecraft.entity.player.EntityPlayer; - -/** - * Allows defining a callback for when a block is right-clicked with an - * analyzer. - *

- * This has to be implemented by a {@link net.minecraft.tileentity.TileEntity}, - * else it will have no effect. - */ -public interface Analyzable { - /** - * Called when a player uses the analyzer tool on the tile entity's block. - *

- * This can be used to display additional block specific information in the - * player's chat when the analyzer is used (or do whatever) and may also be - * used to redirect the query to some other environment by returning some - * other environment than this. The latter is used by multi-block - * screens, for example, to always show information of the primary screen. - *

- * Return null to suppress any further node information being - * displayed. - * - * @param player the player that used the analyzer. - * @param side the side of the block the player clicked. - * @param hitX the relative X coordinate the player clicked. - * @param hitY the relative Y coordinate the player clicked. - * @param hitZ the relative Z coordinate the player clicked. - * @return the nodes to display information for, usually an environment's - * main node (i.e. this.node()). - */ - Node[] onAnalyze(EntityPlayer player, int side, float hitX, float hitY, float hitZ); -} diff --git a/src/api/java/li/cil/oc/api/network/BlacklistedPeripheral.java b/src/api/java/li/cil/oc/api/network/BlacklistedPeripheral.java deleted file mode 100755 index 7598551d5..000000000 --- a/src/api/java/li/cil/oc/api/network/BlacklistedPeripheral.java +++ /dev/null @@ -1,13 +0,0 @@ -package li.cil.oc.api.network; - -/** - * This interface can be implemented by ComputerCraft peripherals, to allow - * dynamically deciding whether OC should wrap the peripheral or not. - *

- * If you have an OC driver equivalent to your peripheral and the more broad, - * IMC based method (which works purely on class names) doesn't work for you, - * use this. - */ -public interface BlacklistedPeripheral { - boolean isPeripheralBlacklisted(); -} diff --git a/src/api/java/li/cil/oc/api/network/Component.java b/src/api/java/li/cil/oc/api/network/Component.java deleted file mode 100755 index a6b53b533..000000000 --- a/src/api/java/li/cil/oc/api/network/Component.java +++ /dev/null @@ -1,107 +0,0 @@ -package li.cil.oc.api.network; - -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; - -import java.util.Collection; - -/** - * Components are nodes that can be addressed computers via drivers. - *

- * Components therefore form a sub-network in the overall network, and some - * special rules apply to them. For one, components specify an additional - * kind of visibility. Component visibility may have to differ from real - * network reachability in some cases, such as network cards (which have to - * be able to communicate across the whole network, but computers should only - * "see" the cards installed directly in them). - *

- * Unlike the {@link Node}'s network reachability, this is a dynamic value and - * can be changed at any time. For example, this is used to hide multi-block - * screen parts that are not the origin from computers in the network. - *

- * The method responsible for dispatching network messages from computers also - * only allows sending messages to components that the computer can see, - * according to the component's visibility. Therefore nodes won't receive - * messages from computer's that should not be able to see them. - */ -public interface Component extends Node { - /** - * The name of the node. - *

- * This should be the type name of the component represented by the node, - * since this is what is returned from component.type. As such it - * is to be expected that there be multiple nodes with the same name, but - * that those nodes all have the same underlying type (i.e. there can be - * multiple "filesystem" nodes, but they should all behave the same way). - */ - String name(); - - /** - * Get the visibility of this component. - */ - Visibility visibility(); - - /** - * Set the visibility of this component. - *

- * Note that this cannot be higher / more visible than the reachability of - * the node. Trying to set it to a higher value will generate an exception. - * - * @throws IllegalArgumentException if the specified value is - * more visible than the node's - * reachability. - */ - void setVisibility(Visibility value); - - /** - * Tests whether this component can be seen by the specified node, - * usually representing a computer in the network. - *

- * Important: this will always return true if the node is - * not currently in a network. - * - * @param other the computer node to check for. - * @return true if the computer can see this node; false otherwise. - */ - boolean canBeSeenFrom(Node other); - - // ----------------------------------------------------------------------- // - - /** - * The list of names of methods exposed by this component. - *

- * This does not return the callback annotations directly, because those - * may not contain the method's name (as it defaults to the name of the - * annotated method). - *

- * The returned collection is read-only. - */ - Collection methods(); - - /** - * Get the annotation information of a method. - *

- * This is needed for custom architecture implementations that need to know - * if a callback is direct or not, for example. - * - * @param method the method to the the info for. - * @return the annotation of the specified method or null. - */ - Callback annotation(String method); - - /** - * Tries to call a function with the specified name on this component. - *

- * The name of the method must be one of the names in {@link #methods()}. - * The returned array may be null if there is no return value. - * - * @param method the name of the method to call. - * @param context the context from which the method is called, usually the - * instance of the computer running the script that made - * the call. - * @param arguments the arguments passed to the method. - * @return the list of results, or null if there is no result. - * @throws NoSuchMethodException if there is no method with that name. - */ - Object[] invoke(String method, Context context, Object... arguments) throws Exception; -} diff --git a/src/api/java/li/cil/oc/api/network/ComponentConnector.java b/src/api/java/li/cil/oc/api/network/ComponentConnector.java deleted file mode 100755 index 969a8901d..000000000 --- a/src/api/java/li/cil/oc/api/network/ComponentConnector.java +++ /dev/null @@ -1,7 +0,0 @@ -package li.cil.oc.api.network; - -/** - * For nodes that are both component and connector. - */ -public interface ComponentConnector extends Component, Connector { -} diff --git a/src/api/java/li/cil/oc/api/network/Connector.java b/src/api/java/li/cil/oc/api/network/Connector.java deleted file mode 100755 index 7189915bd..000000000 --- a/src/api/java/li/cil/oc/api/network/Connector.java +++ /dev/null @@ -1,97 +0,0 @@ -package li.cil.oc.api.network; - -/** - * Interface for nodes that act as power connectors between their network and - * some power producer or consumer. - *

- * For each connector a buffer is managed. Its size is initialized via the - * factory function in the network API, but can also be configured later on. - * Its current fill level can be queried and manipulated as desired. - *

- * Each connector can take two roles: it can be a producer, feeding - * power into the network, or it can be a consumer, requiring power - * from the network to power something (or it can be both). This depends - * entirely on how you call {@link #changeBuffer}, i.e. on whether you - * fill up the connectors buffer or drain it. - *

- * To feed power into the network, simply fill up the buffer, to consume power - * take power from the buffer. The network will balance the power between all - * buffers connected to it. The algorithm goes as follows: if there was a change - * to some buffer, computer the average power available in all buffers. Build - * two sets: those of buffers with above-average level, and those with below- - * average fill. From all above-average buffers take so much energy that they - * remain just above average fill (but only take integral values - this is to - * avoid floating point errors causing trouble). Distribute the collected energy - * equally among the below-average buffers (as good as possible). - */ -public interface Connector extends Node { - /** - * The energy stored in the local buffer. - */ - double localBuffer(); - - /** - * The size of the local buffer. - */ - double localBufferSize(); - - /** - * The accumulative energy stored across all buffers in the node's network. - */ - double globalBuffer(); - - /** - * The accumulative size of all buffers in the node's network. - */ - double globalBufferSize(); - - /** - * Try to apply the specified delta to the global buffer. - *

- * This can be used to apply reactionary power changes. For example, a - * screen may require a certain amount of energy to refresh its display when - * a program tries to display text on it. For running costs just apply the - * same delta each tick. - *

- * If the specified delta cannot be completely applied to the buffer, the - * remaining delta will be returned. This means that for negative values - * a part of the energy will have been consumed, though. - *

- * If there is enough energy or no overflow this will return 0. - *

- * Keep in mind that this change is applied to the global buffer, - * i.e. energy from multiple buffers may be consumed / multiple buffers may - * be filled. The buffer for which this method is called (i.e. this node - * instance) will be prioritized, though. - * - * @param delta the amount of energy to consume or store. - * @return the remainder of the delta that could not be applied. - */ - double changeBuffer(double delta); - - /** - * Like {@link #changeBuffer}, but will only store/consume the specified - * amount of energy if there is enough capacity/energy available. - * - * @param delta the amount of energy to consume or store. - * @return true if the energy was successfully consumed or stored. - */ - boolean tryChangeBuffer(double delta); - - /** - * Change the size of the connectors local buffer. - *

- * If the size is reduced, any superfluous energy is distributed across - * other connectors' buffers in the network, if possible. Any surplus - * energy that cannot be stored in other buffers will be lost. - *

- * Note that this automatically called when the connector is disconnected - * from its network to set its buffer size to zero and distribute its - * energy to other connectors in the network. - * - * @param size the new size of the local buffer. Note that this is capped - * to a minimum of zero, i.e. if a negative value is passed the - * size will be set to zero. - */ - void setLocalBufferSize(double size); -} diff --git a/src/api/java/li/cil/oc/api/network/Environment.java b/src/api/java/li/cil/oc/api/network/Environment.java deleted file mode 100755 index 906543874..000000000 --- a/src/api/java/li/cil/oc/api/network/Environment.java +++ /dev/null @@ -1,113 +0,0 @@ -package li.cil.oc.api.network; - -/** - * The environment of a node. - *

- * For blocks/tile entities this will usually be the tile entity. For items - * this will usually be an object created when a component is added to a - * compatible inventory (e.g. put into a computer). - *

- * Tile entities should implement this interface if they want to be connected - * to the component network of their neighboring blocks. If you cannot do that, - * as mentioned above, you will have to provide a driver that creates a managed - * environment for the block you wish to connect instead. - *

- * To get some more control over which sides of your block may connect to a - * network, see {@link SidedEnvironment}. - *

- * When a tile entity implements this interface a good way of connecting and - * disconnecting is the following pattern: - *

- *     void updateEntity() {
- *         super.updateEntity()
- *         if (node != null && node.network == null) {
- *             api.Network.joinOrCreateNetwork(this);
- *         }
- *     }
- *
- *     void onChunkUnload() {
- *         super.onChunkUnload()
- *         if (node != null) node.remove()
- *     }
- *
- *     void invalidate() {
- *         super.invalidate()
- *         if (node != null) node.remove()
- *     }
- * 
- *

- * Item environments are always managed, so you will always have to provide a - * driver for items that should interact with the component network. - *

- * To interact with environments from user code you will have to do two things: - *

    - *
  1. Make the environment's {@link #node} a {@link Component} and ensure - * its {@link Component#visibility} is set to a value where it can - * be seen by computers in the network.
  2. - *
  3. Annotate methods in the environment as {@link li.cil.oc.api.machine.Callback}s.
  4. - *
- */ -public interface Environment { - /** - * The node this environment wraps. - *

- * The node is the environments gateway to the component network, and thus - * its preferred way to interact with other components in the same network. - * - * @return the node this environment wraps. - */ - Node node(); - - /** - * This is called when a node is added to a network. - *

- * This is also called for the node itself, if it was added to the network. - *

- * At this point the node's network is never null and you can use - * it to query it for other nodes. Use this to perform initialization logic, - * such as building lists of nodes of a certain type in the network. - *

- * For example, if node A is added to a network with nodes B and C, these - * calls are made: - *

    - *
  • A.onConnect(A)
  • - *
  • A.onConnect(B)
  • - *
  • A.onConnect(C)
  • - *
  • B.onConnect(A)
  • - *
  • C.onConnect(A)
  • - *
- */ - void onConnect(Node node); - - /** - * This is called when a node is removed from the network. - *

- * This is also called for the node itself, when it has been removed from - * its network. Note that this is called on the node that is being removed - * only once with the node itself as the parameter. - *

- * At this point the node's network is no longer available (null). - * Use this to perform clean-up logic such as removing references to the - * removed node. - *

- * For example, if node A is removed from a network with nodes A, B and C, - * these calls are made: - *

    - *
  • A.onDisconnect(A)
  • - *
  • B.onDisconnect(A)
  • - *
  • C.onDisconnect(A)
  • - *
- */ - void onDisconnect(Node node); - - /** - * This is the generic message handler. - *

- * It is called whenever this environments {@link Node} receives a message - * that was sent via one of the send methods in the {@link Network} - * or the Node itself. - * - * @param message the message to handle. - */ - void onMessage(Message message); -} diff --git a/src/api/java/li/cil/oc/api/network/FilteredEnvironment.java b/src/api/java/li/cil/oc/api/network/FilteredEnvironment.java deleted file mode 100755 index 9f81749f7..000000000 --- a/src/api/java/li/cil/oc/api/network/FilteredEnvironment.java +++ /dev/null @@ -1,25 +0,0 @@ -package li.cil.oc.api.network; - -/** - * This interface can be added to {@link Environment}s with a number of - * {@link li.cil.oc.api.machine.Callback}s on them, to select which of these - * callbacks should be exposed to machines dynamically. - *

- * Important: while this allows dynamic selection of callbacks, if - * what the filter method returns changes during the lifetime of the - * environment, these changes will not be reflected in already connected - * computers. - */ -public interface FilteredEnvironment { - /** - * Whether the callback with the specified name on this environment is enabled. - *

- * Returning true will be the same as if this interface were not - * implemented. Returning false will hide the callback with the - * specified name from machines connected to it. - * - * @param name the name of the callback to check for. - * @return whether the callback should be visible or not. - */ - boolean isCallbackEnabled(String name); -} diff --git a/src/api/java/li/cil/oc/api/network/ManagedEnvironment.java b/src/api/java/li/cil/oc/api/network/ManagedEnvironment.java deleted file mode 100755 index 7a1a10ea5..000000000 --- a/src/api/java/li/cil/oc/api/network/ManagedEnvironment.java +++ /dev/null @@ -1,33 +0,0 @@ -package li.cil.oc.api.network; - -import li.cil.oc.api.Persistable; - -/** - * This kind of environment is managed by either a compatible inventory, such - * as a computer or floppy drive, or by an adapter block or similar. - *

- * This means its update and save/load methods will be called by their logical - * container. This is required for item environments, and for block - * environments that cannot be directly integrated into a block's tile entity, - * for example because you have no direct control over the block (e.g. what we - * do with the command block). - *

- * You should not implement this interface in your tile entities, or - * weird things may happen (e.g. update and save/load being called multiple - * times). - */ -public interface ManagedEnvironment extends Environment, Persistable { - /** - * Like the method of the same name on tile entities, this is used to - * decide whether to put a component in the list of components that need - * updating, i.e. for which {@link #update()} should be called each tick. - *

- * Return false here, if you do not need updates, to improve performance. - */ - boolean canUpdate(); - - /** - * This is called by the host of this managed environment once per tick. - */ - void update(); -} diff --git a/src/api/java/li/cil/oc/api/network/ManagedPeripheral.java b/src/api/java/li/cil/oc/api/network/ManagedPeripheral.java deleted file mode 100755 index 9de7a9bbc..000000000 --- a/src/api/java/li/cil/oc/api/network/ManagedPeripheral.java +++ /dev/null @@ -1,38 +0,0 @@ -package li.cil.oc.api.network; - -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Context; - -/** - * This interface can be used with an {@link Environment} - * and is intended to be used for environments wrapping a ComputerCraft - * peripheral. It could be used for other purposes as well, though. It allows - * providing method names in addition to those defined via the - * {@link li.cil.oc.api.machine.Callback} annotation, and invoking said methods. - */ -public interface ManagedPeripheral { - /** - * Get the list of methods provided by this environment, in - * addition to methods marked as callbacks. - *

- * Returning null has the same meaning as returning an empty array, - * that being that there are no methods - in which case you don't need this - * interface! - * - * @return the list of methods provided by the environment. - */ - String[] methods(); - - /** - * Calls a method from the list provided by {@link #methods()}. - *

- * - * @param method the name of the method to call. - * @param context the context from which the method is called. - * @param args the arguments to pass to the method. - * @return the result of calling the method. Same as for callbacks. - * @throws NoSuchMethodException if there is no method with the - * specified name. - */ - Object[] invoke(String method, Context context, Arguments args) throws Exception; -} diff --git a/src/api/java/li/cil/oc/api/network/Message.java b/src/api/java/li/cil/oc/api/network/Message.java deleted file mode 100755 index 980b36a63..000000000 --- a/src/api/java/li/cil/oc/api/network/Message.java +++ /dev/null @@ -1,39 +0,0 @@ -package li.cil.oc.api.network; - -/** - * This type is used to deliver messages sent in a component network. - *

- * We use an extra class to deliver messages to nodes to make the cancel logic - * more clear (returning a boolean can get annoying very fast). - */ -public interface Message { - /** - * The node that sent the message. - * - * @return the source node. - */ - Node source(); - - /** - * The name of this message. - * - * @return the name of the message. - */ - String name(); - - /** - * The values passed along in the message. - * - * @return the message data. - */ - Object[] data(); - - /** - * Stop further propagation of a broadcast message. - *

- * This can be used to stop further distributing messages when either - * serving a message to a specific address and there are multiple nodes - * with that address, or when serving a broadcast message. - */ - void cancel(); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/network/Network.java b/src/api/java/li/cil/oc/api/network/Network.java deleted file mode 100755 index 3d76f0014..000000000 --- a/src/api/java/li/cil/oc/api/network/Network.java +++ /dev/null @@ -1,225 +0,0 @@ -package li.cil.oc.api.network; - -/** - * Interface for interacting with networks. - *

- * Computers and components form ad-hoc "networks" when placed next to each - * other. They allow computers to communicate with the components attached to - * them (and nodes amongst each other) by using the network as an index - * structure. - *

- * There are three types of nodes: - *

    - *
  • {@link Node}, the most basic form.
  • - *
  • {@link Component}, used to expose callbacks to user code.
  • - *
  • {@link Connector}, used for consuming of producing energy.
  • - *
- *

- * See Node for more details on the behavior of single nodes, and in - * particular how nodes represented by tile entities should be added. - *

- * Another important concept of node networks is reachability and visibility, - * see {@link Visibility}. - *

- * Note that network access in general is not thread safe! Networks - * should only be accessed from the main server thread. The exception are the - * connector nodes, which can be used to consume or produce energy from other - * threads. - *

- * IMPORTANT: do *not* implement this interface yourself and create - * instances of your own network implementation; this will lead to - * incompatibilities with the built-in network implementation (which can only - * merge with other networks of its own type). Always use the methods provided - * in {@link li.cil.oc.api.Network} to create and join networks. - */ -public interface Network { - /** - * Adds a new node connection in the network. - *

- * This is used by nodes to join an existing network. At least one of the two - * nodes must already be in the network. If one of the nodes is not yet in the - * network, it will be added to the network. If both nodes are already in the - * network only the connection between the two nodes is added. If one of the - * nodes is not in this network but in another network, the networks will be - * merged. - *

- * This way of adding nodes is used to build an internal graph to allow - * properly splitting networks when nodes are removed. - * - * @param nodeA the first node. - * @param nodeB the second node. - * @return true if a new connection between the two nodes was added; false if - * the connection already existed. - * @throws IllegalArgumentException if neither node is in this network. - */ - boolean connect(Node nodeA, Node nodeB); - - /** - * Removes a node connection in the network. - *

- * Both nodes must be part of this network. - *

- * This can be useful for cutting connections that depend on some condition - * that does not involve the nodes' actual existence in the network, such as - * the distance between two nodes, for example (think access points of a - * wireless network). - * - * @param nodeA the first node. - * @param nodeB the second node. - * @return true if the connection was cut; false if there was none. - * @throws IllegalArgumentException if the nodes are not in this network. - */ - boolean disconnect(Node nodeA, Node nodeB); - - /** - * Removes a node from the network. - *

- * This should be called by nodes when they are destroyed (e.g. in - * {@link net.minecraft.tileentity.TileEntity#invalidate()}) or unloaded - * (e.g. in {@link net.minecraft.tileentity.TileEntity#onChunkUnload()}). - * Removing the node can lead to one or more new networks if it was the a - * bridge node, i.e. the only node connecting the resulting networks. - * - * @param node the node to remove from the network. - * @return true if the node was removed; false if it wasn't in the network. - */ - boolean remove(Node node); - - // ----------------------------------------------------------------------- // - - /** - * Get the network node with the specified address. - * - * @param address the address of the node to get. - * @return the node with that address. - */ - Node node(String address); - - /** - * The list of all nodes in this network. - * - * @return the list of nodes in this network. - */ - Iterable nodes(); - - /** - * The list of addressed nodes in the network visible to the specified node. - *

- * This does not include nodes with a visibility of None - * or a visibility of Neighbors when there is no direct connection - * between that node and the reference node. - *

- * This does not include the node itself. - *

- * This can be useful when performing a delayed initialization of a node. - * For example, computers will use this when starting up to generate - * component_added signals for all visible components in the - * network. - * - * @param reference the node to get the visible other nodes for. - * @return the nodes visible to the specified node. - */ - Iterable nodes(Node reference); - - /** - * The list of nodes the specified node is directly connected to. - *

- * This does include nodes with a visibility of None. - *

- * This does not include the node itself. - *

- * This can be used to verify arguments for components that should only work - * for other components that are directly connected to them, for example. - * - * @param node the node to get the neighbors for. - * @return a list of nodes the node is directly connect to. - * @throws IllegalArgumentException if the specified node is not in this network. - */ - Iterable neighbors(Node node); - - // ----------------------------------------------------------------------- // - - /** - * Sends a message to the node with the specified address. - *

- * If the target node with that address has a visibility of None - * the message will not be delivered to that node. If the target - * node with that address has a visibility of Neighbors and the - * source node is not directly connected to the target the message will - * not be delivered to that node. - *

- * Messages should have a unique name to allow differentiating them when - * handling them in a network node. For example, computers will try to parse - * messages named computer.signal by converting the message data to - * a signal and inject that signal into the machine, so no message not used - * for this purpose should be named computer.signal. - * - * @param source the node that sends the message. - * @param target the id of the node to send the message to. - * @param name the name of the message. - * @param data the message to send. - * @throws IllegalArgumentException if the source node is not in this network. - */ - void sendToAddress(Node source, String target, String name, Object... data); - - /** - * Sends a message to all addressed, visible neighbors of the source node. - *

- * Targets are determined using {@link #neighbors(Node)} and additionally - * filtered for reachability (so that unreachable nodes are ignored). - *

- * Messages should have a unique name to allow differentiating them when - * handling them in a network node. For example, computers will try to parse - * messages named computer.signal by converting the message data to - * a signal and inject that signal into the machine, so no message not used - * for this purpose should be named computer.signal. - * - * @param source the node that sends the message. - * @param name the name of the message. - * @param data the message to send. - * @throws IllegalArgumentException if the source node is not in this network. - * @see #neighbors(Node) - */ - void sendToNeighbors(Node source, String name, Object... data); - - /** - * Sends a message to all addressed nodes reachable to the source node. - *

- * Targets are determined using {@link #nodes(Node)}. - *

- * Messages should have a unique name to allow differentiating them when - * handling them in a network node. For example, computers will try to parse - * messages named computer.signal by converting the message data to - * a signal and inject that signal into the machine, so no message not used - * for this purpose should be named computer.signal. - * - * @param source the node that sends the message. - * @param data the message to send. - * @throws IllegalArgumentException if the source node is not in this network. - * @see #nodes(Node) - */ - void sendToReachable(Node source, String name, Object... data); - - /** - * Sends a message to all addressed nodes visible to the source node. - *

- * Targets are determined using {@link #nodes(Node)} and additionally - * filtered for visibility (so that invisible nodes are ignored). - *

- * Note that messages sent this way are only delivered to other - * components. The message will not be delivered to normal nodes. - *

- * Messages should have a unique name to allow differentiating them when - * handling them in a network node. For example, computers will try to parse - * messages named computer.signal by converting the message data to - * a signal and inject that signal into the machine, so no message not used - * for this purpose should be named computer.signal. - * - * @param source the node that sends the message. - * @param data the message to send. - * @throws IllegalArgumentException if the source node is not in this network. - * @see #nodes(Node) - * @see Component#canBeSeenFrom(Node) - */ - void sendToVisible(Node source, String name, Object... data); -} diff --git a/src/api/java/li/cil/oc/api/network/Node.java b/src/api/java/li/cil/oc/api/network/Node.java deleted file mode 100755 index b50a648ff..000000000 --- a/src/api/java/li/cil/oc/api/network/Node.java +++ /dev/null @@ -1,220 +0,0 @@ -package li.cil.oc.api.network; - -import li.cil.oc.api.Persistable; - -/** - * A single node in a {@link Network}. - *

- * All nodes in a network have a unique address; the network will generate a - * unique address and assign it to new nodes. - *

- * Per default there are two kinds of nodes: tile entities and items. - *

- * Items will usually only have nodes when in containers, such as a computer or - * disk drive. Otherwise you'll have to connect/disconnect them manually as - * desired. - *

- * All other kinds of nodes you may come up with will also have to be - * handled manually. - *

- * Items have to be handled by a corresponding {@link li.cil.oc.api.driver.Item}. - * Existing blocks may be interfaced with the adapter block if a - * {@link li.cil.oc.api.driver.Block} exists that supports the block. - *

- * Important: like the Network interface you must not create - * your own implementations of this interface. Use the factory methods in the - * network API to create new node instances and store them in your environment. - * - * @see Component - */ -public interface Node extends Persistable { - /** - * The environment hosting this node. - *

- * For blocks whose tile entities implement {@link Environment} this will - * be the tile entity. For all other implementations this will be a managed - * environment. - */ - Environment host(); - - /** - * The reachability of this node. - *

- * This is used by the network to control which system messages to deliver - * to which nodes. This value should not change over the lifetime of a node. - *

- * It furthermore determines what is returned by the Network's - * neighbors and nodes functions. - *

- * Note that this has no effect on the real reachability of a node; - * it is only used to filter to which nodes to send connect, disconnect and - * reconnect messages. If addressed directly, the node will still receive - * that message even if it comes from a node that should not be able to see - * it. Therefore nodes should still verify themselves that they want to - * accept a message from the message's source. - *

- * A different matter is a {@link Component}'s visibility, which is - * checked before delivering messages a computer tries to send. - */ - Visibility reachability(); - - /** - * The address of the node, so that it can be found in the network. - *

- * This is used by the network manager when a node is added to a network to - * assign it a unique address, if it doesn't already have one. Nodes must not - * use custom addresses, only those assigned by the network. The only option - * they have is to *not* have an address, which can be useful for "dummy" - * nodes, such as cables. In that case they may ignore the address being set. - */ - String address(); - - /** - * The network this node is currently in. - *

- * Note that valid nodes should never return `None` here. When created a node - * should immediately be added to a network, after being removed from its - * network a node should be considered invalid. - *

- * This will always be set automatically by the network manager. Do not - * change this value and do not return anything that it wasn't set to. - */ - Network network(); - - // ----------------------------------------------------------------------- // - - /** - * Checks whether this node is a neighbor of the specified node. - * - * @param other the node to check for. - * @return whether this node is directly connected to the other node. - */ - boolean isNeighborOf(Node other); - - /** - * Checks whether this node can be reached from the specified node. - * - * @param other the node to check for. - * @return whether this node can be reached from the specified node. - */ - boolean canBeReachedFrom(Node other); - - /** - * Get the list of neighbor nodes, i.e. nodes directly connected to this - * node. - *

- * This is a shortcut for node.network.neighbors(node). - *

- * If this node is not in a network, i.e. network is null, - * this returns an empty list. - * - * @return the list of nodes directly connected to this node. - */ - Iterable neighbors(); - - /** - * Get the list of nodes reachable from this node, based on their - * {@link #reachability()}. - *

- * This is a shortcut for node.network.nodes(node). - *

- * If this node is not in a network, i.e. network is null, - * this returns an empty list. - * - * @return the list of nodes reachable from this node. - */ - Iterable reachableNodes(); - - // ----------------------------------------------------------------------- // - - /** - * Connects the specified node to this node. - *

- * This is a shortcut for node.network.connect(node, other). - *

- * If this node is not in a network, i.e. network is null, - * this will throw an exception. - * - * @param node the node to connect to this node. - * @throws NullPointerException if network is null. - */ - void connect(Node node); - - /** - * Disconnects the specified node from this node. - *

- * This is a shortcut for node.network.disconnect(node, other). - *

- * If this node is not in a network, i.e. network is null, - * this will do nothing. - * - * @param node the node to connect to this node. - * @throws NullPointerException if network is null. - */ - void disconnect(Node node); - - /** - * Removes this node from its network. - *

- * This is a shortcut for node.network.remove(node). - *

- * If this node is not in a network, i.e. network is null, - * this will do nothing. - */ - void remove(); - - // ----------------------------------------------------------------------- // - - /** - * Send a message to a node with the specified address. - *

- * This is a shortcut for node.network.sendToAddress(node, ...). - *

- * If this node is not in a network, i.e. network is null, - * this will do nothing. - * - * @param target the address of the node to send the message to. - * @param name the name of the message. - * @param data the data to pass along with the message. - */ - void sendToAddress(String target, String name, Object... data); - - /** - * Send a message to all neighbors of this node. - *

- * This is a shortcut for node.network.sendToNeighbors(node, ...). - *

- * If this node is not in a network, i.e. network is null, - * this will do nothing. - * - * @param name the name of the message. - * @param data the data to pass along with the message. - */ - void sendToNeighbors(String name, Object... data); - - /** - * Send a message to all nodes reachable from this node. - *

- * This is a shortcut for node.network.sendToReachable(node, ...). - *

- * If this node is not in a network, i.e. network is null, - * this will do nothing. - * - * @param name the name of the message. - * @param data the data to pass along with the message. - */ - void sendToReachable(String name, Object... data); - - /** - * Send a message to all nodes visible from this node. - *

- * This is a shortcut for node.network.sendToVisible(node, ...). - *

- * If this node is not in a network, i.e. network is null, - * this will do nothing. - * - * @param name the name of the message. - * @param data the data to pass along with the message. - */ - void sendToVisible(String name, Object... data); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/network/Packet.java b/src/api/java/li/cil/oc/api/network/Packet.java deleted file mode 100755 index 233e72018..000000000 --- a/src/api/java/li/cil/oc/api/network/Packet.java +++ /dev/null @@ -1,69 +0,0 @@ -package li.cil.oc.api.network; - -import net.minecraft.nbt.NBTTagCompound; - -/** - * These packets represent messages sent using a network card or wireless - * network card, and can be relayed by the switch and access point blocks. - *

- * These will be sent as the payload of network.message messages. - *

- * Important: do not implement this interface. Use the factory - * methods in {@link li.cil.oc.api.Network} instead. - */ -public interface Packet { - /** - * The address of the original sender of this packet. - */ - String source(); - - /** - * The address of the destination of the packet. This is null for - * broadcast packets. - */ - String destination(); - - /** - * The port this packet is being sent to. - */ - int port(); - - /** - * The payload of the packet. This will usually only contain simple types, - * to allow persisting the packet. - */ - Object[] data(); - - /** - * The size of the packet's payload. - *

- * This is computed based on the types in the data array, but is only defined - * for primitive types, i.e. null, boolean, integer, boolean byte array and - * string. All other types do not contribute to the packet's size. - */ - int size(); - - /** - * The remaining 'time to live' for this packet. When a packet with a TTL of - * zero is received it will not be relayed by switches and access points. It - * will however still be received by a network card. - */ - int ttl(); - - /** - * Generates a copy of the packet, with a reduced time to live. - *

- * This is called by switches and access points to generate relayed packets. - * - * @return a copy of this packet with a reduced TTL. - */ - Packet hop(); - - /** - * Saves the packet's data to the specified compound tag. - *

- * Restore a packet saved like this using the factory method in the - * {@link li.cil.oc.api.Network} class. - */ - void save(NBTTagCompound nbt); -} diff --git a/src/api/java/li/cil/oc/api/network/SidedComponent.java b/src/api/java/li/cil/oc/api/network/SidedComponent.java deleted file mode 100755 index 68dd76866..000000000 --- a/src/api/java/li/cil/oc/api/network/SidedComponent.java +++ /dev/null @@ -1,26 +0,0 @@ -package li.cil.oc.api.network; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * This is an extended version of {@link li.cil.oc.api.network.SimpleComponent} - * which allows controlling connectivity on a side-by-side basis. - *

- * Like the SimpleComponent interface, this is intended to be used - * with tile entities that should act as OC components. Please see the - * SimpleComponent interface for more information. - */ -public interface SidedComponent { - /** - * Whether this component can connect to a node on the specified side. - *

- * The provided side is relative to the component, i.e. when the tile - * entity sits at (0, 0, 0) and is asked for its southern node (positive - * Z axis) it has to return the connectivity for the face between it and - * the block at (0, 0, 1). - * - * @param side the side to check for. - * @return whether the component may be connected to from the specified side. - */ - boolean canConnectNode(ForgeDirection side); -} diff --git a/src/api/java/li/cil/oc/api/network/SidedEnvironment.java b/src/api/java/li/cil/oc/api/network/SidedEnvironment.java deleted file mode 100755 index 8c7dce15f..000000000 --- a/src/api/java/li/cil/oc/api/network/SidedEnvironment.java +++ /dev/null @@ -1,55 +0,0 @@ -package li.cil.oc.api.network; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * This interface is like {@link net.minecraft.inventory.ISidedInventory} is to - * {@link net.minecraft.inventory.IInventory}, it allows an environment to - * specify different node access for its different sides. - *

- * This interface is intended to be used on tile entities that are environments. - * It is used to determine which neighbors a tile entity can connect to when - * calling {@link li.cil.oc.api.Network#joinOrCreateNetwork(TileEntity)}. It is - * used by the keyboard to only interface with the side on which it is attached, - * as well as the switch to offer a different node for each side. - */ -public interface SidedEnvironment { - /** - * The node this environment uses for the specified side. - *

- * This is the side aware version of the normal {@link Environment#node} - * method. - *

- * The provided side is relative to the environment, i.e. when the tile - * entity hosting the environment sits at (0, 0, 0) and is asked for its - * southern node (positive Z axis) it has to return the node for the face - * between it and the block at (0, 0, 1). - * - * @param side the side to get the node for. - * @return the node for the specified side. - * @see Environment#node - */ - Node sidedNode(ForgeDirection side); - - /** - * Whether the environment provides a node to connect to on the specified - * side. - *

- * For each side the environment returns false here, it should - * return null from {@link #sidedNode}, and for each side it - * returns true for it should return a node. - *

- * This is intended for the client side, i.e. rendering related things, - * since nodes are not created on the client side. - *

- * The side is relative to the environment, same as for sidedNode. - * - * @param side the side to check for. - * @return whether the environment provides a node for the specified side. - */ - @SideOnly(Side.CLIENT) - boolean canConnect(ForgeDirection side); -} diff --git a/src/api/java/li/cil/oc/api/network/SimpleComponent.java b/src/api/java/li/cil/oc/api/network/SimpleComponent.java deleted file mode 100755 index 178941945..000000000 --- a/src/api/java/li/cil/oc/api/network/SimpleComponent.java +++ /dev/null @@ -1,114 +0,0 @@ -package li.cil.oc.api.network; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * This interface can be used to easily convert tile entities to components, - * without having to implement {@link Environment} - * themselves. The simple implementation will provide no access to OC's internal - * component network, since you won't have access to the node representing the - * tile entity. Use this only for simple cases, where you want to expose a - * couple of methods to the programs running computers. - *

- * This is an interface instead of an annotation, to allow stripping via the - * ever so handy {@link cpw.mods.fml.common.Optional} annotation, meaning there - * will be no strong dependency on OpenComputers. - *

- * Classes implementing this interface will be expanded with the methods - * required for them to function as native block components (say, like the - * screen or keyboard). This means functions in the Environment - * interface have to created using a class transformer. If any of the methods - * already exist, this will fail! If things don't work, check your logs, first. - *

- * To expose methods to OC, tag them with {@link li.cil.oc.api.machine.Callback} - * and have them use the according signature (see the documentation on the - * Callback annotation). - *

- * Alternatively, implement {@link li.cil.oc.api.network.ManagedPeripheral} in - * addition to this interface, to make methods available ComputerCraft style. - *

- * So, in short: - *

    - *
  • Implement this interface on a tile entity that should expose - * methods to computers.
  • - *
  • Annotate methods with Callback so they exported.
  • - *
  • Alternatively/additionally implement ManagedPeripheral to - * provide methods via a list of names and single callback method.
  • - *
- *

- * For example: - *

- *     {@literal @}Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")
- *     public class TileEntityMyFancyThing extends TileEntity
- *            implements SimpleComponent
- *     {
- *         {@literal @}Override
- *         public String getComponentName() {
- *             return "fancy_thing";
- *         }
- *
- *         {@literal @}Callback
- *         {@literal @}Optional.Method(modid = "OpenComputers")
- *         public Object[] greet(Context context, Arguments args) {
- *             return new Object[]{String.format("Hello, %s!", args.checkString(0))};
- *         }
- *     }
- * 
- * Using the alternative method to provide methods: - *
- *     {@literal @}Optional.InterfaceList({
- *         {@literal @}Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
- *         {@literal @}Optional.Interface(iface = "li.cil.oc.api.network.ManagedPeripheral", modid = "OpenComputers")
- *     })
- *     public class TileEntityMyFancyThing extends TileEntity
- *            implements SimpleComponent, ManagedPeripheral
- *     {
- *         {@literal @}Override
- *         public String getComponentName() {
- *             return "fancy_thing";
- *         }
- *
- *         public String[] methods() {
- *             return new String[] {"greet"};
- *         }
- *
- *         {@literal @}Optional.Method(modid = "OpenComputers")
- *         public Object[] invoke(String method, Context context, Arguments args) {
- *             if ("greet".equals(method)) {
- *                 return new Object[]{String.format("Hello, %s!", args.checkString(0))};
- *             } else {
- *                 throw new NoSuchMethodException();
- *             }
- *         }
- *     }
- * 
- */ -public interface SimpleComponent { - /** - * The name the component should be made available as. - *

component.list() in Lua, for - * example. You'll want to make this short and descriptive. The convention - * for component names is: all lowercase, underscores where necessary. Good - * component names are for example: disk_drive, furnace, crafting_table. - * - * @return the component's name. - */ - String getComponentName(); - - /** - * Use this to skip logic injection for the class this is implemented by. - *

- * For example, if you have a class transformer that injects logic from a - * template class into your actual tile entities, OC's class transformer - * would complain when it finds the interface on the template class. That - * warning can be suppressed by using this annotation on the template. - */ - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.TYPE) - @interface SkipInjection { - } -} diff --git a/src/api/java/li/cil/oc/api/network/Visibility.java b/src/api/java/li/cil/oc/api/network/Visibility.java deleted file mode 100755 index e91a79043..000000000 --- a/src/api/java/li/cil/oc/api/network/Visibility.java +++ /dev/null @@ -1,42 +0,0 @@ -package li.cil.oc.api.network; - -/** - * Possible reachability values for nodes. - *

- * Since all nodes that are connected are packed into the same network, we want - * some way of controlling what's accessible from where on a low level (to - * avoid unnecessary messages and unauthorized access). - *

- * Note that there is a more specific kind of visibility for components. See - * {@link Component} for more details on that. - */ -public enum Visibility { - /** - * Nodes with this visibility neither receive nor send messages. - *

- * Components with this visibility cannot be seen nor reached by computers. - */ - None, - - /** - * Nodes with this visibility only receive messages from their immediate - * neighbors, i.e. nodes to which a direct connection exists. It can send - * messages to all nodes visible to it. - *

- * Components with this visibility can likewise only be reached by the - * computer(s) they are directly attached to. For example, if a block - * component is placed directly next to the computer, or an item installed - * in the computer (i.e. it is in the computer's inventory). - */ - Neighbors, - - /** - * Nodes with this visibility can receive messages from any node in its - * network. It can still only send messages to all nodes visible to it. - *

- * Components with this visibility are likewise reachable by all computers - * in their network. For example, a screen only indirectly connected to a - * computer will still be addressable by that computer. - */ - Network -} diff --git a/src/api/java/li/cil/oc/api/network/WirelessEndpoint.java b/src/api/java/li/cil/oc/api/network/WirelessEndpoint.java deleted file mode 100755 index c5de36d3d..000000000 --- a/src/api/java/li/cil/oc/api/network/WirelessEndpoint.java +++ /dev/null @@ -1,47 +0,0 @@ -package li.cil.oc.api.network; - -import net.minecraft.world.World; - -/** - * Interface for wireless endpoints that can be registered with the internal - * wireless network registry. - *

- * These can be added to the wireless network via the Network API, to - * allow them to receive packets like wireless network cards and access points - * do (and handle or forward them as they see fit). - *

- * If the position of the endpoint can change, it must be updated manually via - * {@link li.cil.oc.api.Network#updateWirelessNetwork(WirelessEndpoint)}. - */ -public interface WirelessEndpoint { - /** - * The X coordinate of the endpoint in the world, in block coordinates. - */ - int x(); - - /** - * The Y coordinate of the endpoint in the world, in block coordinates. - */ - int y(); - - /** - * The Z coordinate of the endpoint in the world, in block coordinates. - */ - int z(); - - /** - * The world this endpoint lives in. - */ - World world(); - - /** - * Makes the endpoint receive a single packet. - * - * @param packet the packet to receive. - * @param sender the endpoint that sent the message. This is not - * necessarily the original sender of the packet, just - * the last point it went through, such as an access - * point, for example. - */ - void receivePacket(Packet packet, WirelessEndpoint sender); -} diff --git a/src/api/java/li/cil/oc/api/network/package-info.java b/src/api/java/li/cil/oc/api/network/package-info.java deleted file mode 100755 index ef7ae77ed..000000000 --- a/src/api/java/li/cil/oc/api/network/package-info.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This package provides component networking related functionality. - *

- * This mainly involves the (purely server-side!) network that is spanned over - * all of OpenComputers' components, including blocks and items alike. - */ -@cpw.mods.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Network", - apiVersion = API.VERSION) -package li.cil.oc.api.network; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/package-info.java b/src/api/java/li/cil/oc/api/package-info.java deleted file mode 100755 index 94fc3bdc2..000000000 --- a/src/api/java/li/cil/oc/api/package-info.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * This API provides interfaces and factory methods for the OpenComputers mod. - *

- * There are several parts to this API: - *

- *
The {@link li.cil.oc.api.Driver} API
- *
- * This API is used to provide glue code to the mod that allows it to interact - * with foreign objects. You need a driver if you wish to connect some object - * to the internal {@link li.cil.oc.api.network.Network}, for example because - * you wish to interact with other blocks / components of the mod. The most - * typical scenario for this will be adding a new object that user programs - * should be able to interact with: a {@link li.cil.oc.api.network.Component}. - *

- * Note that for tile entities you implement yourself, you will not have to - * provide a driver, as long as you implement the necessary interface: - * {@link li.cil.oc.api.network.Environment} and call {@link li.cil.oc.api.Network#joinOrCreateNetwork(net.minecraft.tileentity.TileEntity)} - * in the first updateEntity() call. For items that should be installed - * in a computer you will always have to provide a driver. - *

- *
The {@link li.cil.oc.api.FileSystem} API
- *
- * This API provides facilities that make it easier to create file systems that - * can be interacted with from user programs via the file system driver that - * comes with the mod. - *
- *
The {@link li.cil.oc.api.Network} API
- *
- * This API provides interfaces that allow interacting with the internal network - * and creating nodes, components and power connectors for said network. If you - * implement Environment in your tile entity or provide a - * {@link li.cil.oc.api.network.ManagedEnvironment} via a driver you'll want to - * create a node. This API provides factory methods for creating it. - *
- *
- */ -@cpw.mods.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Core", - apiVersion = API.VERSION) -package li.cil.oc.api; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/prefab/AbstractInteractiveImageRenderer.java b/src/api/java/li/cil/oc/api/prefab/AbstractInteractiveImageRenderer.java deleted file mode 100755 index 2ba7569c8..000000000 --- a/src/api/java/li/cil/oc/api/prefab/AbstractInteractiveImageRenderer.java +++ /dev/null @@ -1,19 +0,0 @@ -package li.cil.oc.api.prefab; - -import li.cil.oc.api.manual.InteractiveImageRenderer; - -/** - * Simple base implementation of {@link InteractiveImageRenderer}. - */ -@SuppressWarnings("UnusedDeclaration") -public abstract class AbstractInteractiveImageRenderer implements InteractiveImageRenderer { - @Override - public String getTooltip(String tooltip) { - return tooltip; - } - - @Override - public boolean onMouseClick(int mouseX, int mouseY) { - return false; - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/AbstractValue.java b/src/api/java/li/cil/oc/api/prefab/AbstractValue.java deleted file mode 100755 index 7d686b5df..000000000 --- a/src/api/java/li/cil/oc/api/prefab/AbstractValue.java +++ /dev/null @@ -1,37 +0,0 @@ -package li.cil.oc.api.prefab; - -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Context; -import li.cil.oc.api.machine.Value; -import net.minecraft.nbt.NBTTagCompound; - -/** - * Basic implementation for the Value interface. - */ -public class AbstractValue implements Value { - @Override - public Object apply(Context context, Arguments arguments) { - return null; - } - - @Override - public void unapply(Context context, Arguments arguments) { - } - - @Override - public Object[] call(Context context, Arguments arguments) { - throw new RuntimeException("trying to call a non-callable value"); - } - - @Override - public void dispose(Context context) { - } - - @Override - public void load(NBTTagCompound nbt) { - } - - @Override - public void save(NBTTagCompound nbt) { - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/DriverBlock.java b/src/api/java/li/cil/oc/api/prefab/DriverBlock.java deleted file mode 100755 index bb9e1654f..000000000 --- a/src/api/java/li/cil/oc/api/prefab/DriverBlock.java +++ /dev/null @@ -1,49 +0,0 @@ -package li.cil.oc.api.prefab; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.oredict.OreDictionary; - -/** - * If you wish to create a block component for a third-party block, i.e. a block - * for which you do not control the tile entity, such as vanilla blocks, you - * will need a block driver. - *

- * This prefab allows creating a driver that works for a specified list of item - * stacks (to support different blocks with the same id but different metadata - * values). - *

- * You still have to provide the implementation for creating its environment, if - * any. - * - * @see li.cil.oc.api.network.ManagedEnvironment - */ -@SuppressWarnings("UnusedDeclaration") -public abstract class DriverBlock implements li.cil.oc.api.driver.Block { - protected final ItemStack[] blocks; - - protected DriverBlock(final ItemStack... blocks) { - this.blocks = blocks.clone(); - } - - @Override - public boolean worksWith(final World world, final int x, final int y, final int z) { - return worksWith(world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); - } - - protected boolean worksWith(final Block referenceBlock, final int referenceMetadata) { - for (ItemStack stack : blocks) { - if (stack != null && stack.getItem() instanceof ItemBlock) { - final ItemBlock item = (ItemBlock) stack.getItem(); - final Block supportedBlock = item.field_150939_a; - final int supportedMetadata = item.getMetadata(stack.getItemDamage()); - if (referenceBlock == supportedBlock && (referenceMetadata == supportedMetadata || stack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) { - return true; - } - } - } - return false; - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/DriverItem.java b/src/api/java/li/cil/oc/api/prefab/DriverItem.java deleted file mode 100755 index e56e4f715..000000000 --- a/src/api/java/li/cil/oc/api/prefab/DriverItem.java +++ /dev/null @@ -1,85 +0,0 @@ -package li.cil.oc.api.prefab; - -import li.cil.oc.api.driver.EnvironmentHost; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -/** - * If you wish to create item components such as the network card or hard drives - * you will need an item driver. - *

- * This prefab allows creating a driver that works for a specified list of item - * stacks (to support different items with the same id but different damage - * values). It also takes care of creating and getting the tag compound on an - * item stack to save data to or load data from. - *

- * You still have to specify your component's slot type and provide the - * implementation for creating its environment, if any. - * - * @see li.cil.oc.api.network.ManagedEnvironment - */ -@SuppressWarnings("UnusedDeclaration") -public abstract class DriverItem implements li.cil.oc.api.driver.Item { - protected final ItemStack[] items; - - protected DriverItem(final ItemStack... items) { - this.items = items.clone(); - } - - @Override - public boolean worksWith(final ItemStack stack) { - if (stack != null) { - for (ItemStack item : items) { - if (item != null && item.isItemEqual(stack)) { - return true; - } - } - } - return false; - } - - @Override - public int tier(final ItemStack stack) { - return 0; - } - - @Override - public NBTTagCompound dataTag(final ItemStack stack) { - if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); - } - final NBTTagCompound nbt = stack.getTagCompound(); - // This is the suggested key under which to store item component data. - // You are free to change this as you please. - if (!nbt.hasKey("oc:data")) { - nbt.setTag("oc:data", new NBTTagCompound()); - } - return nbt.getCompoundTag("oc:data"); - } - - // Convenience methods provided for HostAware drivers. - - protected boolean isAdapter(Class host) { - return li.cil.oc.api.internal.Adapter.class.isAssignableFrom(host); - } - - protected boolean isComputer(Class host) { - return li.cil.oc.api.internal.Case.class.isAssignableFrom(host); - } - - protected boolean isRobot(Class host) { - return li.cil.oc.api.internal.Robot.class.isAssignableFrom(host); - } - - protected boolean isRotatable(Class host) { - return li.cil.oc.api.internal.Rotatable.class.isAssignableFrom(host); - } - - protected boolean isServer(Class host) { - return li.cil.oc.api.internal.Server.class.isAssignableFrom(host); - } - - protected boolean isTablet(Class host) { - return li.cil.oc.api.internal.Tablet.class.isAssignableFrom(host); - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/DriverTileEntity.java b/src/api/java/li/cil/oc/api/prefab/DriverTileEntity.java deleted file mode 100755 index e9c6890ef..000000000 --- a/src/api/java/li/cil/oc/api/prefab/DriverTileEntity.java +++ /dev/null @@ -1,20 +0,0 @@ -package li.cil.oc.api.prefab; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public abstract class DriverTileEntity implements li.cil.oc.api.driver.Block { - public abstract Class getTileEntityClass(); - - @Override - public boolean worksWith(final World world, final int x, final int y, final int z) { - final Class filter = getTileEntityClass(); - if (filter == null) { - // This can happen if filter classes are deduced by reflection and - // the class in question is not present. - return false; - } - final TileEntity tileEntity = world.getTileEntity(x, y, z); - return tileEntity != null && filter.isAssignableFrom(tileEntity.getClass()); - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/ItemStackTabIconRenderer.java b/src/api/java/li/cil/oc/api/prefab/ItemStackTabIconRenderer.java deleted file mode 100755 index db8d43be4..000000000 --- a/src/api/java/li/cil/oc/api/prefab/ItemStackTabIconRenderer.java +++ /dev/null @@ -1,34 +0,0 @@ -package li.cil.oc.api.prefab; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import li.cil.oc.api.manual.TabIconRenderer; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.item.ItemStack; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -/** - * Simple implementation of a tab icon renderer using an item stack as its graphic. - */ -@SuppressWarnings("UnusedDeclaration") -public class ItemStackTabIconRenderer implements TabIconRenderer { - private final ItemStack stack; - - public ItemStackTabIconRenderer(ItemStack stack) { - this.stack = stack; - } - - @SideOnly(Side.CLIENT) - @Override - public void render() { - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - RenderHelper.enableGUIStandardItemLighting(); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240); - RenderItem.getInstance().renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, 0, 0); - RenderHelper.disableStandardItemLighting(); - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/ManagedEnvironment.java b/src/api/java/li/cil/oc/api/prefab/ManagedEnvironment.java deleted file mode 100755 index ed9ccfba4..000000000 --- a/src/api/java/li/cil/oc/api/prefab/ManagedEnvironment.java +++ /dev/null @@ -1,74 +0,0 @@ -package li.cil.oc.api.prefab; - -import li.cil.oc.api.network.Message; -import li.cil.oc.api.network.Node; -import net.minecraft.nbt.NBTTagCompound; - -/** - * Simple base implementation of the ManagedEnvironment interface, so - * unused methods don't clutter the implementing class. - */ -public abstract class ManagedEnvironment implements li.cil.oc.api.network.ManagedEnvironment { - // Should be initialized using setNode(api.Network.newNode()). See TileEntityEnvironment. - private Node _node; - - @Override - public Node node() { - return _node; - } - - protected void setNode(Node value) { - _node = value; - } - - @Override - public boolean canUpdate() { - return false; - } - - @Override - public void update() { - } - - @Override - public void onConnect(final Node node) { - } - - @Override - public void onDisconnect(final Node node) { - } - - @Override - public void onMessage(final Message message) { - } - - @Override - public void load(final NBTTagCompound nbt) { - if (node() != null) { - node().load(nbt.getCompoundTag("node")); - } - } - - @Override - public void save(final NBTTagCompound nbt) { - if (node() != null) { - // Force joining a network when saving and we're not in one yet, so that - // the address is embedded in the saved data that gets sent to the client, - // so that that address can be used to associate components on server and - // client (for example keyboard and screen/text buffer). - if (node().address() == null) { - li.cil.oc.api.Network.joinNewNetwork(node()); - - final NBTTagCompound nodeTag = new NBTTagCompound(); - node().save(nodeTag); - nbt.setTag("node", nodeTag); - - node().remove(); - } else { - final NBTTagCompound nodeTag = new NBTTagCompound(); - node().save(nodeTag); - nbt.setTag("node", nodeTag); - } - } - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/ResourceContentProvider.java b/src/api/java/li/cil/oc/api/prefab/ResourceContentProvider.java deleted file mode 100755 index 44d5efe68..000000000 --- a/src/api/java/li/cil/oc/api/prefab/ResourceContentProvider.java +++ /dev/null @@ -1,65 +0,0 @@ -package li.cil.oc.api.prefab; - -import com.google.common.base.Charsets; -import li.cil.oc.api.manual.ContentProvider; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ResourceLocation; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; - -/** - * Basic implementation of a content provider based on Minecraft's resource - * loading framework. - *

- * Beware that the manual is unaware of resource domains. In other words, two - * paths that are identical except for their resource domain will be the same, - * as seen from the manual. This means you should probably place your - * documentation somewhere other than doc/, because that's where the - * OpenComputers documentation lives, and it is queried first - meaning if you - * have a page with the same path as one in OpenComputers, it is practically - * unreachable (because the OC provider is always queried first). - */ -@SuppressWarnings("UnusedDeclaration") -public class ResourceContentProvider implements ContentProvider { - private final String resourceDomain; - - private final String basePath; - - public ResourceContentProvider(String resourceDomain, String basePath) { - this.resourceDomain = resourceDomain; - this.basePath = basePath; - } - - public ResourceContentProvider(String resourceDomain) { - this(resourceDomain, ""); - } - - @Override - public Iterable getContent(String path) { - final ResourceLocation location = new ResourceLocation(resourceDomain, basePath + (path.startsWith("/") ? path.substring(1) : path)); - InputStream is = null; - try { - is = Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream(); - final BufferedReader reader = new BufferedReader(new InputStreamReader(is, Charsets.UTF_8)); - final ArrayList lines = new ArrayList(); - String line; - while ((line = reader.readLine()) != null) { - lines.add(line); - } - return lines; - } catch (Throwable ignored) { - return null; - } finally { - if (is != null) { - try { - is.close(); - } catch (IOException ignored) { - } - } - } - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/TextureTabIconRenderer.java b/src/api/java/li/cil/oc/api/prefab/TextureTabIconRenderer.java deleted file mode 100755 index 0a382814b..000000000 --- a/src/api/java/li/cil/oc/api/prefab/TextureTabIconRenderer.java +++ /dev/null @@ -1,33 +0,0 @@ -package li.cil.oc.api.prefab; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import li.cil.oc.api.manual.TabIconRenderer; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.ResourceLocation; - -/** - * Simple implementation of a tab icon renderer using a full texture as its graphic. - */ -@SuppressWarnings("UnusedDeclaration") -public class TextureTabIconRenderer implements TabIconRenderer { - private final ResourceLocation location; - - public TextureTabIconRenderer(ResourceLocation location) { - this.location = location; - } - - @Override - @SideOnly(Side.CLIENT) - public void render() { - Minecraft.getMinecraft().getTextureManager().bindTexture(location); - final Tessellator t = Tessellator.instance; - t.startDrawingQuads(); - t.addVertexWithUV(0, 16, 0, 0, 1); - t.addVertexWithUV(16, 16, 0, 1, 1); - t.addVertexWithUV(16, 0, 0, 1, 0); - t.addVertexWithUV(0, 0, 0, 0, 0); - t.draw(); - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/TileEntityEnvironment.java b/src/api/java/li/cil/oc/api/prefab/TileEntityEnvironment.java deleted file mode 100755 index e1fb6fca8..000000000 --- a/src/api/java/li/cil/oc/api/prefab/TileEntityEnvironment.java +++ /dev/null @@ -1,155 +0,0 @@ -package li.cil.oc.api.prefab; - -import li.cil.oc.api.Network; -import li.cil.oc.api.network.Environment; -import li.cil.oc.api.network.Message; -import li.cil.oc.api.network.Node; -import li.cil.oc.api.network.Visibility; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -/** - * TileEntities can implement the {@link li.cil.oc.api.network.Environment} - * interface to allow them to interact with the component network, by providing - * a {@link li.cil.oc.api.network.Node} and connecting it to said network. - *

- * Nodes in such a network can communicate with each other, or just use the - * network as an index structure to find other nodes connected to them. - */ -@SuppressWarnings("UnusedDeclaration") -public abstract class TileEntityEnvironment extends TileEntity implements Environment { - /** - * This must be set in subclasses to the node that is used to represent - * this tile entity. - *

- * You must only create new nodes using the factory method in the network - * API, {@link li.cil.oc.api.Network#newNode(Environment, Visibility)}. - *

- * For example: - *

-     * // The first parameters to newNode is the host() of the node, which will
-     * // usually be this tile entity. The second one is it's reachability,
-     * // which determines how other nodes in the same network can query this
-     * // node. See {@link li.cil.oc.api.network.Network#nodes(li.cil.oc.api.network.Node)}.
-     * node = Network.newNode(this, Visibility.Network)
-     *       // This call allows the node to consume energy from the
-     *       // component network it is in and act as a consumer, or to
-     *       // inject energy into that network and act as a producer.
-     *       // If you do not need energy remove this call.
-     *       .withConnector()
-     *       // This call marks the tile entity as a component. This means you
-     *       // can mark methods in it using the {@link li.cil.oc.api.machine.Callback}
-     *       // annotation, making them callable from user code. The first
-     *       // parameter is the name by which the component will be known in
-     *       // the computer, in this case it could be accessed as
-     *       // component.example. The second parameter is the
-     *       // component's visibility. This is like the node's reachability,
-     *       // but only applies to computers. For example, network cards can
-     *       // only be seen by the computer they're installed in, but
-     *       // can be reached by all other network cards in the same
-     *       // network. If you do not need callbacks remove this call.
-     *       .withComponent("example", Visibility.Neighbors)
-     *       // Finalizes the construction of the node and returns it.
-     *       .create();
-     * 
- */ - protected Node node; - - // See updateEntity(). - protected boolean addedToNetwork = false; - - // ----------------------------------------------------------------------- // - - @Override - public Node node() { - return node; - } - - @Override - public void onConnect(final Node node) { - // This is called when the call to Network.joinOrCreateNetwork(this) in - // updateEntity was successful, in which case `node == this`. - // This is also called for any other node that gets connected to the - // network our node is in, in which case `node` is the added node. - // If our node is added to an existing network, this is called for each - // node already in said network. - } - - @Override - public void onDisconnect(final Node node) { - // This is called when this node is removed from its network when the - // tile entity is removed from the world (see onChunkUnload() and - // invalidate()), in which case `node == this`. - // This is also called for each other node that gets removed from the - // network our node is in, in which case `node` is the removed node. - // If a net-split occurs this is called for each node that is no longer - // connected to our node. - } - - @Override - public void onMessage(final Message message) { - // This is used to deliver messages sent via node.sendToXYZ. Handle - // messages at your own discretion. If you do not wish to handle a - // message you should *not* throw an exception, though. - } - - // ----------------------------------------------------------------------- // - - @Override - public void updateEntity() { - // On the first update, try to add our node to nearby networks. We do - // this in the update logic, not in validate() because we need to access - // neighboring tile entities, which isn't possible in validate(). - // We could alternatively check node != null && node.network() == null, - // but this has somewhat better performance, and makes it clearer. - if (!addedToNetwork) { - addedToNetwork = true; - Network.joinOrCreateNetwork(this); - } - } - - @Override - public void onChunkUnload() { - super.onChunkUnload(); - // Make sure to remove the node from its network when its environment, - // meaning this tile entity, gets unloaded. - if (node != null) node.remove(); - } - - @Override - public void invalidate() { - super.invalidate(); - // Make sure to remove the node from its network when its environment, - // meaning this tile entity, gets unloaded. - if (node != null) node.remove(); - } - - // ----------------------------------------------------------------------- // - - @Override - public void readFromNBT(final NBTTagCompound nbt) { - super.readFromNBT(nbt); - // The host check may be superfluous for you. It's just there to allow - // some special cases, where getNode() returns some node managed by - // some other instance (for example when you have multiple internal - // nodes in this tile entity). - if (node != null && node.host() == this) { - // This restores the node's address, which is required for networks - // to continue working without interruption across loads. If the - // node is a power connector this is also required to restore the - // internal energy buffer of the node. - node.load(nbt.getCompoundTag("oc:node")); - } - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) { - super.writeToNBT(nbt); - // See readFromNBT() regarding host check. - if (node != null && node.host() == this) { - final NBTTagCompound nodeNbt = new NBTTagCompound(); - node.save(nodeNbt); - nbt.setTag("oc:node", nodeNbt); - } - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/TileEntitySidedEnvironment.java b/src/api/java/li/cil/oc/api/prefab/TileEntitySidedEnvironment.java deleted file mode 100755 index 2d6c247e7..000000000 --- a/src/api/java/li/cil/oc/api/prefab/TileEntitySidedEnvironment.java +++ /dev/null @@ -1,152 +0,0 @@ -package li.cil.oc.api.prefab; - -import li.cil.oc.api.Network; -import li.cil.oc.api.network.Node; -import li.cil.oc.api.network.SidedEnvironment; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * TileEntities can implement the {@link li.cil.oc.api.network.SidedEnvironment} - * interface to allow them to interact with the component network, by providing - * a separate {@link li.cil.oc.api.network.Node} for each block face, and - * connecting it to said network. This allows more control over connectivity - * than the simple {@link li.cil.oc.api.network.Environment}. - *

- * Nodes in such a network can communicate with each other, or just use the - * network as an index structure to find other nodes connected to them. - */ -@SuppressWarnings("UnusedDeclaration") -public abstract class TileEntitySidedEnvironment extends TileEntity implements SidedEnvironment { - // See constructor. - protected Node[] nodes = new Node[6]; - - // See updateEntity(). - protected boolean addedToNetwork = false; - - /** - * This expects a node per face that is used to represent this tile entity. - *

- * You must only create new nodes using the factory method in the network - * API, {@link li.cil.oc.api.Network#newNode(li.cil.oc.api.network.Environment, li.cil.oc.api.network.Visibility)}. - *

- * For example: - *

-     * // The first parameters to newNode is the host() of the node, which will
-     * // usually be this tile entity. The second one is it's reachability,
-     * // which determines how other nodes in the same network can query this
-     * // node. See {@link li.cil.oc.api.network.Network#nodes(li.cil.oc.api.network.Node)}.
-     * super(Network.newNode(???, Visibility.Network)
-     *       // This call allows the node to consume energy from the
-     *       // component network it is in and act as a consumer, or to
-     *       // inject energy into that network and act as a producer.
-     *       // If you do not need energy remove this call.
-     *       .withConnector()
-     *       // This call marks the tile entity as a component. This means you
-     *       // can mark methods in it using the {@link li.cil.oc.api.machine.Callback}
-     *       // annotation, making them callable from user code. The first
-     *       // parameter is the name by which the component will be known in
-     *       // the computer, in this case it could be accessed as
-     *       // component.example. The second parameter is the
-     *       // component's visibility. This is like the node's reachability,
-     *       // but only applies to computers. For example, network cards can
-     *       // only be seen by the computer they're installed in, but
-     *       // can be reached by all other network cards in the same
-     *       // network. If you do not need callbacks remove this call.
-     *       .withComponent("example", Visibility.Neighbors)
-     *       // Finalizes the construction of the node and returns it.
-     *       .create(), ...);
-     * 
- */ - protected TileEntitySidedEnvironment(final Node... nodes) { - System.arraycopy(nodes, 0, this.nodes, 0, Math.min(nodes.length, this.nodes.length)); - } - - // ----------------------------------------------------------------------- // - - // canConnect() is for the client side, to determine how cables are - // rendered, for example, so you'll have to provide that logic yourself. - // Nodes are only created on the server side, so checking whether a node - // exists for a side won't work on the client. - - @Override - public Node sidedNode(final ForgeDirection side) { - return side == ForgeDirection.UNKNOWN ? null : nodes[side.ordinal()]; - } - - // ----------------------------------------------------------------------- // - - @Override - public void updateEntity() { - super.updateEntity(); - // On the first update, try to add our node to nearby networks. We do - // this in the update logic, not in validate() because we need to access - // neighboring tile entities, which isn't possible in validate(). - // We could alternatively check node != null && node.network() == null, - // but this has somewhat better performance, and makes it clearer. - if (!addedToNetwork) { - addedToNetwork = true; - // Note that joinOrCreateNetwork will try to connect each of our - // sided nodes to their respective neighbor (sided) node. - Network.joinOrCreateNetwork(this); - } - } - - @Override - public void onChunkUnload() { - super.onChunkUnload(); - // Make sure to remove the node from its network when its environment, - // meaning this tile entity, gets unloaded. - for (Node node : nodes) { - if (node != null) node.remove(); - } - } - - @Override - public void invalidate() { - super.invalidate(); - // Make sure to remove the node from its network when its environment, - // meaning this tile entity, gets unloaded. - for (Node node : nodes) { - if (node != null) node.remove(); - } - } - - // ----------------------------------------------------------------------- // - - @Override - public void readFromNBT(final NBTTagCompound nbt) { - super.readFromNBT(nbt); - int index = 0; - for (Node node : nodes) { - // The host check may be superfluous for you. It's just there to allow - // some special cases, where getNode() returns some node managed by - // some other instance (for example when you have multiple internal - // nodes in this tile entity). - if (node != null && node.host() == this) { - // This restores the node's address, which is required for networks - // to continue working without interruption across loads. If the - // node is a power connector this is also required to restore the - // internal energy buffer of the node. - node.load(nbt.getCompoundTag("oc:node" + index)); - } - ++index; - } - } - - @Override - public void writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(nbt); - int index = 0; - for (Node node : nodes) { - // See readFromNBT() regarding host check. - if (node != null && node.host() == this) { - final NBTTagCompound nodeNbt = new NBTTagCompound(); - node.save(nodeNbt); - nbt.setTag("oc:node" + index, nodeNbt); - } - ++index; - } - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/package-info.java b/src/api/java/li/cil/oc/api/prefab/package-info.java deleted file mode 100755 index ba933b12c..000000000 --- a/src/api/java/li/cil/oc/api/prefab/package-info.java +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This package provides base implementations of some interfaces. - *

- * This is provided for convenience only, you do not have to use these classes, - * you are free to fully implement them yourself. You may also copy these - * classes and / or rename them if you wish. Just don't make changes to them - * while leaving them in the same package with the same name and then ship them - * with your mod! - */ -@cpw.mods.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Prefab", - apiVersion = API.VERSION) -package li.cil.oc.api.prefab; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/mcp/mobius/waila/api/ITaggedList.java b/src/api/java/mcp/mobius/waila/api/ITaggedList.java deleted file mode 100644 index 7413c2849..000000000 --- a/src/api/java/mcp/mobius/waila/api/ITaggedList.java +++ /dev/null @@ -1,21 +0,0 @@ -package mcp.mobius.waila.api; - -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.Map.Entry; - -public interface ITaggedList extends List { - public boolean add(E e, T tag); - public boolean add(E e, Collection taglst); - public Set getTags(E e); - public Set getTags(int index); - public void addTag(E e, T tag); - public void addTag(int index, T tag); - public void removeTag(E e, T tag); - public void removeTag(int index, T tag); - public Set getEntries(T tag); - public void removeEntries(T tag); - public String getTagsAsString(E e); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaBlock.java b/src/api/java/mcp/mobius/waila/api/IWailaBlock.java deleted file mode 100644 index 8b4dd131e..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaBlock.java +++ /dev/null @@ -1,34 +0,0 @@ -package mcp.mobius.waila.api; - -import java.util.List; - -import net.minecraft.item.ItemStack; - -@Deprecated -public interface IWailaBlock { - /* - * Use this method to return an item stack in case the default lookup system fails. - * Return null if you want to use the default lookup system. - * You get the world, the player and the location of the block. With that, it is easy to gather information & tile entities - */ - ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config); - - /* Waila HUD is divided into 3 zones. The head corresponds to the item name, - * body to where you mostly want to put informations, and I reserve the tail for modname display - */ - - /* Those 2 methods works exactly the same way, except they are related to a different zone in Waila HUD. - * You get in input world, player and the block location. You also get the itemstack as returned by the default lookup system or getWailaStack(). - * ConfigHandler provides the current Waila config state so you can show/hide elements depending on the configuration. Refer the ConfigHandler class for more info. - * currenttip represents the current list of text lines in the tooltip zone. - * For example, getWailaHead() will have the current item name as currenttip. - * You can modify the tips, add more, remove some, etc. - * When you are done, just returns the currenttip and it will display in Waila. - * - * Always return the currenttip is you don't want to modify the current zone. - */ - - List getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); - List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); - List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java b/src/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java deleted file mode 100644 index 7dc6ba03c..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java +++ /dev/null @@ -1,24 +0,0 @@ -package mcp.mobius.waila.api; - -import net.minecraft.item.ItemStack; - -/** - * Callback class interface used to provide Block/TileEntity decorator.
- * All methods in this interface shouldn't to be called by the implementing mod. An instance of the class is to be - * registered to Waila via the {@link IWailaRegistrar} instance provided in the original registration callback method - * (cf. {@link IWailaRegistrar} documentation for more information). - * @author ProfMobius - * - */ -public interface IWailaBlockDecorator { - - /** - * Callback for the decorator. It provides a standard GL stack positioned on the block.
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerDecorator}.
- * @param itemStack Current block scanned, in ItemStack form. - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - */ - void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config); - -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaCommonAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaCommonAccessor.java deleted file mode 100644 index 982f50bec..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaCommonAccessor.java +++ /dev/null @@ -1,37 +0,0 @@ -package mcp.mobius.waila.api; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * The Accessor is used to get some basic data out of the game without having to request direct access to the game engine.
- * It will also return things that are unmodified by the overriding systems (like getWailaStack).
- * Common accessor for both Entity and Block/TileEntity.
- * Available data depends on what it is called upon (ie : getEntity() will return null if looking at a block, etc).
- * - */ -public interface IWailaCommonAccessor { - World getWorld(); - EntityPlayer getPlayer(); - Block getBlock(); - int getBlockID(); - String getBlockQualifiedName(); - int getMetadata(); - TileEntity getTileEntity(); - Entity getEntity(); - MovingObjectPosition getPosition(); - Vec3 getRenderingPosition(); - NBTTagCompound getNBTData(); - int getNBTInteger(NBTTagCompound tag, String keyname); - double getPartialFrame(); - ForgeDirection getSide(); - ItemStack getStack(); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java b/src/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java deleted file mode 100644 index 9752e423f..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java +++ /dev/null @@ -1,44 +0,0 @@ -package mcp.mobius.waila.api; - -import java.util.HashMap; -import java.util.Set; - -/** - * Read-only interface for Waila internal config storage.
- * An instance of this interface is passed to most of Waila callbacks as a way to change the behavior depending on client settings. - * - * @author ProfMobius - * - */ -public interface IWailaConfigHandler { - /** Returns a set of all the currently loaded modules in the config handler. - * - * @return - */ - public Set getModuleNames(); - - /** - * Returns all the currently available options for a given module - * - * @param modName Module name - * @return - */ - public HashMap getConfigKeys(String modName); - - /** - * Returns the current value of an option (true/false) with a default value if not set. - * - * @param key Option to lookup - * @param defvalue Default values - * @return Value of the option or defvalue if not set. - */ - public boolean getConfig(String key, boolean defvalue); - - /** - * Returns the current value of an option (true/false) with a default value true if not set - * - * @param key Option to lookup - * @return Value of the option or true if not set. - */ - public boolean getConfig(String key); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java deleted file mode 100644 index 7b87217ac..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java +++ /dev/null @@ -1,37 +0,0 @@ -package mcp.mobius.waila.api; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * The Accessor is used to get some basic data out of the game without having to request direct access to the game engine.
- * It will also return things that are unmodified by the overriding systems (like getWailaStack).
- * An instance of this interface is passed to most of Waila Block/TileEntity callbacks. - * @author ProfMobius - * - */ - -public interface IWailaDataAccessor{ - - World getWorld(); - EntityPlayer getPlayer(); - Block getBlock(); - int getBlockID(); - String getBlockQualifiedName(); - int getMetadata(); - TileEntity getTileEntity(); - MovingObjectPosition getPosition(); - Vec3 getRenderingPosition(); - NBTTagCompound getNBTData(); - int getNBTInteger(NBTTagCompound tag, String keyname); - double getPartialFrame(); - ForgeDirection getSide(); - ItemStack getStack(); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java deleted file mode 100644 index eb7e98bfa..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java +++ /dev/null @@ -1,83 +0,0 @@ -package mcp.mobius.waila.api; - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -/** - * Callback class interface used to provide Block/TileEntity tooltip informations to Waila.
- * All methods in this interface shouldn't to be called by the implementing mod. An instance of the class is to be - * registered to Waila via the {@link IWailaRegistrar} instance provided in the original registration callback method - * (cf. {@link IWailaRegistrar} documentation for more information). - * @author ProfMobius - * - */ -public interface IWailaDataProvider{ - - /** - * Callback used to override the default Waila lookup system.
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerStackProvider}.
- * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return null if override is not required, an ItemStack otherwise. - */ - ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerHeadProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param itemStack Current block scanned, in ItemStack form. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerBodyProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param itemStack Current block scanned, in ItemStack form. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerTailProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param itemStack Current block scanned, in ItemStack form. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used server side to return a custom synchronization NBTTagCompound.
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerNBTProvider} server and client side.
- * You are supposed to always return the modified input NBTTagCompound tag.
- * @param player The player requesting data synchronization (The owner of the current connection). - * @param te The TileEntity targeted for synchronization. - * @param tag Current synchronization tag (might have been processed by other providers and might be processed by other providers). - * @param world TileEntity's World. - * @param x X position of the TileEntity. - * @param y Y position of the TileEntity. - * @param z Z position of the TileEntity. - * @return Modified input NBTTagCompound tag. - */ - NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java deleted file mode 100644 index a4c00760c..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java +++ /dev/null @@ -1,27 +0,0 @@ -package mcp.mobius.waila.api; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; - -/** - * The Accessor is used to get some basic data out of the game without having to request direct access to the game engine.
- * It will also return things that are unmodified by the overriding systems (like getWailaStack).
- * An instance of this interface is passed to most of Waila Entity callbacks. - * @author ProfMobius - * - */ - -public interface IWailaEntityAccessor { - World getWorld(); - EntityPlayer getPlayer(); - Entity getEntity(); - MovingObjectPosition getPosition(); - Vec3 getRenderingPosition(); - NBTTagCompound getNBTData(); - int getNBTInteger(NBTTagCompound tag, String keyname); - double getPartialFrame(); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java deleted file mode 100644 index 5a9acd8da..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java +++ /dev/null @@ -1,79 +0,0 @@ -package mcp.mobius.waila.api; - -import java.util.List; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; - -/** - * Callback class interface used to provide Entity tooltip informations to Waila.
- * All methods in this interface shouldn't to be called by the implementing mod. An instance of the class is to be - * registered to Waila via the {@link IWailaRegistrar} instance provided in the original registration callback method - * (cf. {@link IWailaRegistrar} documentation for more information). - * @author ProfMobius - * - */ -public interface IWailaEntityProvider { - - /** - * Callback used to override the default Waila lookup system.
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerOverrideEntityProvider}.
- * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return null if override is not required, an Entity otherwise. - */ - Entity getWailaOverride(IWailaEntityAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerHeadProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param entity Current Entity scanned. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaHead(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerBodyProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param entity Current Entity scanned. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaBody(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerTailProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param entity Current Entity scanned. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaTail(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used server side to return a custom synchronization NBTTagCompound.
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerNBTProvider} server and client side.
- * You are supposed to always return the modified input NBTTagCompound tag.
- * @param player The player requesting data synchronization (The owner of the current connection). - * @param ent The Entity targeted for synchronization. - * @param tag Current synchronization tag (might have been processed by other providers and might be processed by other providers). - * @param world TileEntity's World. - * @return Modified input NBTTagCompound tag. - */ - NBTTagCompound getNBTData(EntityPlayerMP player, Entity ent, NBTTagCompound tag, World world); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java deleted file mode 100644 index 99fb5e8ae..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java +++ /dev/null @@ -1,29 +0,0 @@ -package mcp.mobius.waila.api; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; - -/** - * The Accessor is used to get some basic data out of the game without having to request direct access to the game engine.
- * It will also return things that are unmodified by the overriding systems (like getWailaStack).
- * An instance of this interface is passed to most of Waila FMP callbacks. - * @author ProfMobius - * - */ - -public interface IWailaFMPAccessor { - World getWorld(); - EntityPlayer getPlayer(); - TileEntity getTileEntity(); - MovingObjectPosition getPosition(); - NBTTagCompound getNBTData(); - NBTTagCompound getFullNBTData(); - int getNBTInteger(NBTTagCompound tag, String keyname); - double getPartialFrame(); - Vec3 getRenderingPosition(); - String getID(); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java b/src/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java deleted file mode 100644 index 5484a566e..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java +++ /dev/null @@ -1,23 +0,0 @@ -package mcp.mobius.waila.api; - -import net.minecraft.item.ItemStack; - -/** - * Callback class interface used to provide FMP decorator.
- * All methods in this interface shouldn't to be called by the implementing mod. An instance of the class is to be - * registered to Waila via the {@link IWailaRegistrar} instance provided in the original registration callback method - * (cf. {@link IWailaRegistrar} documentation for more information). - * @author ProfMobius - * - */ -public interface IWailaFMPDecorator { - - /** - * Callback for the decorator. It provides a standard GL stack positioned on the block.
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerDecorator}.
- * @param itemStack Current block scanned, in ItemStack form. - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - */ - void decorateBlock(ItemStack itemStack, IWailaFMPAccessor accessor, IWailaConfigHandler config); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java deleted file mode 100644 index 6db02fb27..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java +++ /dev/null @@ -1,54 +0,0 @@ -package mcp.mobius.waila.api; - -import java.util.List; - -import net.minecraft.item.ItemStack; - -/** - * Callback class interface used to provide FMP tooltip informations to Waila.
- * All methods in this interface shouldn't to be called by the implementing mod. An instance of the class is to be - * registered to Waila via the {@link IWailaRegistrar} instance provided in the original registration callback method - * (cf. {@link IWailaRegistrar} documentation for more information). - * @author ProfMobius - * - */ -public interface IWailaFMPProvider { - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerHeadProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param itemStack Current block scanned, in ItemStack form. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaHead(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerBodyProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param itemStack Current block scanned, in ItemStack form. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaBody(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerTailProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param itemStack Current block scanned, in ItemStack form. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaTail(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaRegistrar.java b/src/api/java/mcp/mobius/waila/api/IWailaRegistrar.java deleted file mode 100644 index 66f43ada2..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaRegistrar.java +++ /dev/null @@ -1,77 +0,0 @@ -package mcp.mobius.waila.api; - -/** - * Main registration interface. An instance will be provided to a method specified in an IMC msg formatted as follow
- * FMLInterModComms.sendMessage("Waila", "register", "fully.qualified.path.to.registration.method");
- * The registration method need to follow this signature
- * public static void callbackRegister({@link IWailaRegistrar} registrar)

- * If not specified otherwise, all the registration methods taking a class can take classes as well as interfaces. - * Waila will do a lookup using instanceof on the registered classes, meaning that if all your targets inherit one interface, you only need - * to specify it to cover the whole hierarchy.
- * For the registration of blocks, both Blocks and TileEntities are accepted.

- * For the configuration keys :
- * modname refers to a String used for display in Waila's config panel.
- * keyname refers to an unique key used internally for config query (cf {@link IWailaConfigHandler}). Those keys are shared across Waila, keep them unique !
- * - * - * @author ProfMobius - * - */ -public interface IWailaRegistrar { - /* Add a config option in the section modname with displayed text configtext and access key keyname */ - public void addConfig(String modname, String keyname, String configtext); - public void addConfig(String modname, String keyname, String configtext, boolean defvalue); - public void addConfigRemote(String modname, String keyname, String configtext); - public void addConfigRemote(String modname, String keyname, String configtext, boolean defvalue); - public void addConfig(String modname, String keyname); - public void addConfig(String modname, String keyname, boolean defvalue); - public void addConfigRemote(String modname, String keyname); - public void addConfigRemote(String modname, String keyname, boolean defvalue); - - /* Register a stack overrider for the given blockID */ - public void registerStackProvider(IWailaDataProvider dataProvider, Class block); - - /* Same thing, but works on a class hierarchy instead */ - public void registerHeadProvider (IWailaDataProvider dataProvider, Class block); - public void registerBodyProvider (IWailaDataProvider dataProvider, Class block); - public void registerTailProvider (IWailaDataProvider dataProvider, Class block); - - /* Registering an NBT Provider provides a way to override the default "writeToNBT" way of doing things. */ - public void registerNBTProvider(IWailaDataProvider dataProvider, Class block); - - /* Entity text registration methods */ - public void registerHeadProvider (IWailaEntityProvider dataProvider, Class entity); - public void registerBodyProvider (IWailaEntityProvider dataProvider, Class entity); - public void registerTailProvider (IWailaEntityProvider dataProvider, Class entity); - public void registerOverrideEntityProvider (IWailaEntityProvider dataProvider, Class entity); - - /* Registering an NBT Provider provides a way to override the default "writeToNBT" way of doing things. */ - public void registerNBTProvider(IWailaEntityProvider dataProvider, Class entity); - - /* FMP Providers */ - public void registerHeadProvider(IWailaFMPProvider dataProvider, String name); - public void registerBodyProvider(IWailaFMPProvider dataProvider, String name); - public void registerTailProvider(IWailaFMPProvider dataProvider, String name); - - /* The block decorators */ - public void registerDecorator (IWailaBlockDecorator decorator, Class block); - public void registerDecorator (IWailaFMPDecorator decorator, String name); - - /* Selective NBT key syncing. Will register a key to sync over the network for the given class (block, te or ent). - * Accept * as a ending wildcard - * registerNBTKey("bob.*", MyBlock.class) - * registerNBTKey("data.life", MyEntity.class) - * registerNBTKey("*", MyTileEntity.class) will reproduce the full tag syncing from 1.4.5 - * - * This registration method is deprecated in favor to registerNBTProvider. - * It will be removed in MC 1.8 !!! - * */ - @Deprecated - public void registerSyncedNBTKey(String key, Class target); - - public void registerTooltipRenderer(String name, IWailaTooltipRenderer renderer); - - /* UNUSED FOR NOW (Will be used for the ingame wiki */ - //public void registerDocTextFile (String filename); - //public void registerShortDataProvider (IWailaSummaryProvider dataProvider, Class item); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java deleted file mode 100644 index f79064981..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java +++ /dev/null @@ -1,21 +0,0 @@ -package mcp.mobius.waila.api; - -import java.util.LinkedHashMap; - -import net.minecraft.item.ItemStack; - -public interface IWailaSummaryProvider { - /* This interface is used to control the display data in the description screen */ - - /* BASIC TOOLS & ITEMS DATA */ - //EnumToolMaterial getMaterial(ItemStack stack); - //String getMaterialName(ItemStack stack); - //String getEffectiveBlock(ItemStack stack); - //int getHarvestLevel(ItemStack stack); - //float getEfficiencyOnProperMaterial(ItemStack stack); - //int getEnchantability(ItemStack stack); - //int getDamageVsEntity(ItemStack stack); - //int getDurability(ItemStack stack); - - LinkedHashMap getSummary(ItemStack stack, LinkedHashMap currentSummary, IWailaConfigHandler config); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaTooltipRenderer.java b/src/api/java/mcp/mobius/waila/api/IWailaTooltipRenderer.java deleted file mode 100644 index 700a27814..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaTooltipRenderer.java +++ /dev/null @@ -1,24 +0,0 @@ -package mcp.mobius.waila.api; - -import java.awt.Dimension; -import java.awt.Point; - - -public interface IWailaTooltipRenderer { - /** - * - * @param params Array of string parameters as passed to the RENDER arg in the tooltip ({rendername,param1,param2,...}) - * @param accessor A global accessor for TileEntities and Entities - * @return Dimension of the reserved area - */ - Dimension getSize(String[] params, IWailaCommonAccessor accessor); - - /** - * Draw method for the renderer. The GL matrice is automatically moved to the top left of the reserved zone.
- * All calls should be relative to (0,0) - * - * @param params Array of string parameters as passed to the RENDER arg in the tooltip ({rendername,param1,param2,...}) - * @param accessor A global accessor for TileEntities and Entities - */ - void draw (String[] params, IWailaCommonAccessor accessor); -} diff --git a/src/api/java/mcp/mobius/waila/api/SpecialChars.java b/src/api/java/mcp/mobius/waila/api/SpecialChars.java deleted file mode 100644 index f2630cc72..000000000 --- a/src/api/java/mcp/mobius/waila/api/SpecialChars.java +++ /dev/null @@ -1,70 +0,0 @@ -package mcp.mobius.waila.api; - -import static mcp.mobius.waila.api.SpecialChars.RENDER; -import static mcp.mobius.waila.api.SpecialChars.WailaStyle; - -import java.util.regex.Pattern; - -public class SpecialChars { - - public static String MCStyle = "\u00A7"; - - public static String BLACK = MCStyle + "0"; - public static String DBLUE = MCStyle + "1"; - public static String DGREEN = MCStyle + "2"; - public static String DAQUA = MCStyle + "3"; - public static String DRED = MCStyle + "4"; - public static String DPURPLE = MCStyle + "5"; - public static String GOLD = MCStyle + "6"; - public static String GRAY = MCStyle + "7"; - public static String DGRAY = MCStyle + "8"; - public static String BLUE = MCStyle + "9"; - public static String GREEN = MCStyle + "a"; - public static String AQUA = MCStyle + "b"; - public static String RED = MCStyle + "c"; - public static String LPURPLE = MCStyle + "d"; - public static String YELLOW = MCStyle + "e"; - public static String WHITE = MCStyle + "f"; - - public static String OBF = MCStyle + "k"; - public static String BOLD = MCStyle + "l"; - public static String STRIKE = MCStyle + "m"; - public static String UNDER = MCStyle + "n"; - public static String ITALIC = MCStyle + "o"; - public static String RESET = MCStyle + "r"; - - public static String WailaStyle = "\u00A4"; - public static String WailaIcon = "\u00A5"; - public static String WailaRenderer = "\u00A6"; - public static String TAB = WailaStyle + WailaStyle +"a"; - public static String ALIGNRIGHT = WailaStyle + WailaStyle +"b"; - public static String ALIGNCENTER = WailaStyle + WailaStyle +"c"; - public static String HEART = WailaStyle + WailaIcon +"a"; - public static String HHEART = WailaStyle + WailaIcon +"b"; - public static String EHEART = WailaStyle + WailaIcon +"c"; - public static String RENDER = WailaStyle + WailaRenderer +"a"; - - public static final Pattern patternMinecraft = Pattern.compile("(?i)" + MCStyle + "[0-9A-FK-OR]"); - public static final Pattern patternWaila = Pattern.compile("(?i)(" + WailaStyle + "(?..))"); - public static final Pattern patternRender = Pattern.compile("(?i)(" + RENDER + "\\{(?[^,}]*),?(?[^}]*)\\})"); - public static final Pattern patternTab = Pattern.compile("(?i)" + TAB); - public static final Pattern patternRight = Pattern.compile("(?i)" + ALIGNRIGHT); - public static final Pattern patternCenter = Pattern.compile("(?i)" + ALIGNCENTER); - public static final Pattern patternIcon = Pattern.compile("(?i)(" + WailaStyle + WailaIcon + "(?[0-9a-z]))"); - public static final Pattern patternLineSplit = Pattern.compile("(?i)(" + WailaStyle + WailaStyle + "[^" + WailaStyle + "]+|" + WailaStyle + WailaIcon + "[0-9A-Z]|" + WailaStyle + WailaRenderer + "a\\{([^,}]*),?([^}]*)\\}|[^" + WailaStyle + "]+)"); - - /** - * Helper method to get a proper RENDER string. Just put the name of the renderer and the params in, and it will give back a directly usable String for the tooltip. - * @param name - * @param params - * @return - */ - public static String getRenderString(String name, String... params){ - String result = RENDER + "{" + name; - for (String s : params){ - result += "," + s; - } - result += "}"; - return result; - } -} diff --git a/src/api/java/mcp/mobius/waila/api/package-info.java b/src/api/java/mcp/mobius/waila/api/package-info.java deleted file mode 100644 index 5fc5aa6f3..000000000 --- a/src/api/java/mcp/mobius/waila/api/package-info.java +++ /dev/null @@ -1,3 +0,0 @@ -@API(apiVersion="1.2",owner="Waila",provides="WailaAPI") -package mcp.mobius.waila.api; -import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/api/java/micdoodle8/mods/galacticraft/api/API-Usage.txt b/src/api/java/micdoodle8/mods/galacticraft/api/API-Usage.txt deleted file mode 100644 index eb544af31..000000000 --- a/src/api/java/micdoodle8/mods/galacticraft/api/API-Usage.txt +++ /dev/null @@ -1,25 +0,0 @@ -A note to anyone looking to use this API: -This API should now be fairly stable and usable. You can use prefabs and core API classes to create your own galaxies. - -Please avoid including interfaces where possible... - -If you are creating your own addon you should be relying on Galacticraft: - - Use the following steps to allow Galacticraft compilation: - 1. Download the dev-deobf (deobfuscated development) version of Galacticraft. - 2. Place the jar file somewhere in your workspace, remember the location. - 3. In eclipse, right click on your project, click properties->Java Build Path->Libraries->Add External Jars and select the dev jar. - 4. Galacticraft will now compile properly. - - You can also download the source from github "https://github.com/micdoodle8" and add it to your development source. - - Release your addon without any API classes or prefabs. Users with Galacticraft installed will experience no issues. - -If you are implementing a few classes for compatibility, or checking inheritance: - - Try to use java reflection where performance is not mandatory. Google is your friend for learning reflection. - - Create multiple versions of a class implementing one of my interfaces. Check if Galacticraft is installed and invoke the appropriate class. - Crashes will only occur if you reference a class with a missing interface, so call the correct one and you won't have issues. - - If you must include interfaces, only include the ones you need and check for updates. \ No newline at end of file diff --git a/src/api/java/micdoodle8/mods/galacticraft/api/entity/IEntityBreathable.java b/src/api/java/micdoodle8/mods/galacticraft/api/entity/IEntityBreathable.java deleted file mode 100644 index 618c4529a..000000000 --- a/src/api/java/micdoodle8/mods/galacticraft/api/entity/IEntityBreathable.java +++ /dev/null @@ -1,13 +0,0 @@ -package micdoodle8.mods.galacticraft.api.entity; - -/** - * Implement into entities that are living, but can breath without oxygen - */ -public interface IEntityBreathable -{ - /** - * Whether or not this entity can currently breathe without oxygen in it's - * vicinity - */ - public boolean canBreath(); -} diff --git a/src/api/java/micdoodle8/mods/galacticraft/api/package-info.java b/src/api/java/micdoodle8/mods/galacticraft/api/package-info.java deleted file mode 100644 index 55ce1bae8..000000000 --- a/src/api/java/micdoodle8/mods/galacticraft/api/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -@API(apiVersion = "1.0", owner = "GalacticraftCore", provides = "Galacticraft API") -package micdoodle8.mods.galacticraft.api; - -import cpw.mods.fml.common.API; - diff --git a/src/api/java/micdoodle8/mods/galacticraft/api/world/ISolarLevel.java b/src/api/java/micdoodle8/mods/galacticraft/api/world/ISolarLevel.java deleted file mode 100644 index 721af2336..000000000 --- a/src/api/java/micdoodle8/mods/galacticraft/api/world/ISolarLevel.java +++ /dev/null @@ -1,18 +0,0 @@ -package micdoodle8.mods.galacticraft.api.world; - -/** - * Used to change the solar multiplier of certain world providers - *

- * If you have a solar feature in your mod, check whether the world's provider - * inherits this class and multiply the solar generation by the solar multiplier - * double - *

- * for example: - *

- * if (worldObj.provider instanceof ISolarLevel) solarStrength *= ((ISolarLevel) - * worldObj.provider).getSolarEnergyMultiplier(); - */ -public interface ISolarLevel -{ - public double getSolarEnergyMultiplier(); -} diff --git a/src/api/java/powercrystals/minefactoryreloaded/api/IDeepStorageUnit.java b/src/api/java/powercrystals/minefactoryreloaded/api/IDeepStorageUnit.java deleted file mode 100644 index bc84d73cb..000000000 --- a/src/api/java/powercrystals/minefactoryreloaded/api/IDeepStorageUnit.java +++ /dev/null @@ -1,29 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.item.ItemStack; - -public interface IDeepStorageUnit -{ - /** - * @return A populated ItemStack with stackSize for the full amount of materials in the DSU. - * May have a stackSize > getMaxStackSize(). May have a stackSize of 0 (indicating locked contents). - */ - ItemStack getStoredItemType(); - - /** - * Sets the total amount of the item currently being stored, or zero if all items are to be removed. - */ - void setStoredItemCount(int amount); - - /** - * Sets the type of the stored item and initializes the number of stored items to amount. - * Will overwrite any existing stored items. - */ - void setStoredItemType(ItemStack type, int amount); - - /** - * @return The maximum number of items the DSU can hold. - * May change based on the current type stored. - */ - int getMaxStoredCount(); -} diff --git a/src/main/java/codechicken/core/launch/DepLoader.java b/src/main/java/codechicken/core/launch/DepLoader.java deleted file mode 100644 index 0032ed5cf..000000000 --- a/src/main/java/codechicken/core/launch/DepLoader.java +++ /dev/null @@ -1,618 +0,0 @@ -package codechicken.core.launch; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import cpw.mods.fml.common.versioning.ComparableVersion; -import cpw.mods.fml.relauncher.FMLInjectionData; -import cpw.mods.fml.relauncher.FMLLaunchHandler; -import cpw.mods.fml.relauncher.IFMLCallHook; -import cpw.mods.fml.relauncher.IFMLLoadingPlugin; -import net.minecraft.launchwrapper.LaunchClassLoader; -import sun.misc.URLClassPath; -import sun.net.util.URLUtil; - -import javax.swing.*; -import javax.swing.event.HyperlinkEvent; -import javax.swing.event.HyperlinkListener; -import java.awt.*; -import java.awt.Dialog.ModalityType; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.*; -import java.lang.reflect.Field; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.net.URLConnection; -import java.nio.ByteBuffer; -import java.util.*; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -/** - * For autodownloading stuff. - * This is really unoriginal, mostly ripped off FML, credits to cpw. - */ -public class DepLoader implements IFMLLoadingPlugin, IFMLCallHook { - private static ByteBuffer downloadBuffer = ByteBuffer.allocateDirect(1 << 23); - private static final String owner = "CB's DepLoader"; - private static DepLoadInst inst; - - public interface IDownloadDisplay { - void resetProgress(int sizeGuess); - - void setPokeThread(Thread currentThread); - - void updateProgress(int fullLength); - - boolean shouldStopIt(); - - void updateProgressString(String string, Object... data); - - Object makeDialog(); - - void showErrorDialog(String name, String url); - } - - @SuppressWarnings("serial") - public static class Downloader extends JOptionPane implements IDownloadDisplay { - private JDialog container; - private JLabel currentActivity; - private JProgressBar progress; - boolean stopIt; - Thread pokeThread; - - private Box makeProgressPanel() { - Box box = Box.createVerticalBox(); - box.add(Box.createRigidArea(new Dimension(0, 10))); - JLabel welcomeLabel = new JLabel("" + owner + " is setting up your minecraft environment"); - box.add(welcomeLabel); - welcomeLabel.setAlignmentY(LEFT_ALIGNMENT); - welcomeLabel = new JLabel("Please wait, " + owner + " has some tasks to do before you can play"); - welcomeLabel.setAlignmentY(LEFT_ALIGNMENT); - box.add(welcomeLabel); - box.add(Box.createRigidArea(new Dimension(0, 10))); - currentActivity = new JLabel("Currently doing ..."); - box.add(currentActivity); - box.add(Box.createRigidArea(new Dimension(0, 10))); - progress = new JProgressBar(0, 100); - progress.setStringPainted(true); - box.add(progress); - box.add(Box.createRigidArea(new Dimension(0, 30))); - return box; - } - - @Override - public JDialog makeDialog() { - if (container != null) - return container; - - setMessageType(JOptionPane.INFORMATION_MESSAGE); - setMessage(makeProgressPanel()); - setOptions(new Object[]{"Stop"}); - addPropertyChangeListener(new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getSource() == Downloader.this && evt.getPropertyName() == VALUE_PROPERTY) { - requestClose("This will stop minecraft from launching\nAre you sure you want to do this?"); - } - } - }); - container = new JDialog(null, "Hello", ModalityType.MODELESS); - container.setResizable(false); - container.setLocationRelativeTo(null); - container.add(this); - this.updateUI(); - container.pack(); - container.setMinimumSize(container.getPreferredSize()); - container.setVisible(true); - container.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - container.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - requestClose("Closing this window will stop minecraft from launching\nAre you sure you wish to do this?"); - } - }); - return container; - } - - protected void requestClose(String message) { - int shouldClose = JOptionPane.showConfirmDialog(container, message, "Are you sure you want to stop?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); - if (shouldClose == JOptionPane.YES_OPTION) - container.dispose(); - - stopIt = true; - if (pokeThread != null) - pokeThread.interrupt(); - } - - @Override - public void updateProgressString(String progressUpdate, Object... data) { - //FMLLog.finest(progressUpdate, data); - if (currentActivity != null) - currentActivity.setText(String.format(progressUpdate, data)); - } - - @Override - public void resetProgress(int sizeGuess) { - if (progress != null) - progress.getModel().setRangeProperties(0, 0, 0, sizeGuess, false); - } - - @Override - public void updateProgress(int fullLength) { - if (progress != null) - progress.getModel().setValue(fullLength); - } - - @Override - public void setPokeThread(Thread currentThread) { - this.pokeThread = currentThread; - } - - @Override - public boolean shouldStopIt() { - return stopIt; - } - - @Override - public void showErrorDialog(String name, String url) { - JEditorPane ep = new JEditorPane("text/html", - "" + - owner + " was unable to download required library " + name + - "
Check your internet connection and try restarting or download it manually from" + - "
" + url + " and put it in your mods folder" + - ""); - - ep.setEditable(false); - ep.setOpaque(false); - ep.addHyperlinkListener(new HyperlinkListener() { - @Override - public void hyperlinkUpdate(HyperlinkEvent event) { - try { - if (event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) - Desktop.getDesktop().browse(event.getURL().toURI()); - } catch (Exception e) { - } - } - }); - - JOptionPane.showMessageDialog(null, ep, "A download error has occured", JOptionPane.ERROR_MESSAGE); - } - } - - public static class DummyDownloader implements IDownloadDisplay { - @Override - public void resetProgress(int sizeGuess) { - } - - @Override - public void setPokeThread(Thread currentThread) { - } - - @Override - public void updateProgress(int fullLength) { - } - - @Override - public boolean shouldStopIt() { - return false; - } - - @Override - public void updateProgressString(String string, Object... data) { - } - - @Override - public Object makeDialog() { - return null; - } - - @Override - public void showErrorDialog(String name, String url) { - } - } - - public static class VersionedFile - { - public final Pattern pattern; - public final String filename; - public final ComparableVersion version; - public final String name; - - public VersionedFile(String filename, Pattern pattern) { - this.pattern = pattern; - this.filename = filename; - Matcher m = pattern.matcher(filename); - if(m.matches()) { - name = m.group(1); - version = new ComparableVersion(m.group(2)); - } - else { - name = null; - version = null; - } - } - - public boolean matches() { - return name != null; - } - } - - public static class Dependency - { - public String url; - public VersionedFile file; - - public String existing; - /** - * Flag set to add this dep to the classpath immediately because it is required for a coremod. - */ - public boolean coreLib; - - public Dependency(String url, VersionedFile file, boolean coreLib) { - this.url = url; - this.file = file; - this.coreLib = coreLib; - } - } - - public static class DepLoadInst { - private File modsDir; - private File v_modsDir; - private IDownloadDisplay downloadMonitor; - private JDialog popupWindow; - - private Map depMap = new HashMap(); - private HashSet depSet = new HashSet(); - - public DepLoadInst() { - String mcVer = (String) FMLInjectionData.data()[4]; - File mcDir = (File) FMLInjectionData.data()[6]; - - modsDir = new File(mcDir, "mods"); - v_modsDir = new File(mcDir, "mods/" + mcVer); - if (!v_modsDir.exists()) - v_modsDir.mkdirs(); - } - - private void addClasspath(String name) { - try { - ((LaunchClassLoader) DepLoader.class.getClassLoader()).addURL(new File(v_modsDir, name).toURI().toURL()); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - private void deleteMod(File mod) { - if (mod.delete()) - return; - - try { - ClassLoader cl = DepLoader.class.getClassLoader(); - URL url = mod.toURI().toURL(); - Field f_ucp = URLClassLoader.class.getDeclaredField("ucp"); - Field f_loaders = URLClassPath.class.getDeclaredField("loaders"); - Field f_lmap = URLClassPath.class.getDeclaredField("lmap"); - f_ucp.setAccessible(true); - f_loaders.setAccessible(true); - f_lmap.setAccessible(true); - - URLClassPath ucp = (URLClassPath) f_ucp.get(cl); - Closeable loader = ((Map) f_lmap.get(ucp)).remove(URLUtil.urlNoFragString(url)); - if (loader != null) { - loader.close(); - ((List) f_loaders.get(ucp)).remove(loader); - } - } catch (Exception e) { - e.printStackTrace(); - } - - if (!mod.delete()) { - mod.deleteOnExit(); - String msg = owner + " was unable to delete file " + mod.getPath() + " the game will now try to delete it on exit. If this dialog appears again, delete it manually."; - System.err.println(msg); - if (!GraphicsEnvironment.isHeadless()) - JOptionPane.showMessageDialog(null, msg, "An update error has occured", JOptionPane.ERROR_MESSAGE); - - System.exit(1); - } - } - - private void download(Dependency dep) { - popupWindow = (JDialog) downloadMonitor.makeDialog(); - File libFile = new File(v_modsDir, dep.file.filename); - try { - URL libDownload = new URL(dep.url + '/' + dep.file.filename); - downloadMonitor.updateProgressString("Downloading file %s", libDownload.toString()); - System.out.format("Downloading file %s\n", libDownload.toString()); - URLConnection connection = libDownload.openConnection(); - connection.setConnectTimeout(5000); - connection.setReadTimeout(5000); - connection.setRequestProperty("User-Agent", "" + owner + " Downloader"); - int sizeGuess = connection.getContentLength(); - download(connection.getInputStream(), sizeGuess, libFile); - downloadMonitor.updateProgressString("Download complete"); - System.out.println("Download complete"); - - scanDepInfo(libFile); - } catch (Exception e) { - libFile.delete(); - if (downloadMonitor.shouldStopIt()) { - System.err.println("You have stopped the downloading operation before it could complete"); - System.exit(1); - return; - } - downloadMonitor.showErrorDialog(dep.file.filename, dep.url + '/' + dep.file.filename); - throw new RuntimeException("A download error occured", e); - } - } - - private void download(InputStream is, int sizeGuess, File target) throws Exception { - if (sizeGuess > downloadBuffer.capacity()) - throw new Exception(String.format("The file %s is too large to be downloaded by " + owner + " - the download is invalid", target.getName())); - - downloadBuffer.clear(); - - int bytesRead, fullLength = 0; - - downloadMonitor.resetProgress(sizeGuess); - try { - downloadMonitor.setPokeThread(Thread.currentThread()); - byte[] smallBuffer = new byte[1024]; - while ((bytesRead = is.read(smallBuffer)) >= 0) { - downloadBuffer.put(smallBuffer, 0, bytesRead); - fullLength += bytesRead; - if (downloadMonitor.shouldStopIt()) { - break; - } - downloadMonitor.updateProgress(fullLength); - } - is.close(); - downloadMonitor.setPokeThread(null); - downloadBuffer.limit(fullLength); - downloadBuffer.position(0); - } catch (InterruptedIOException e) { - // We were interrupted by the stop button. We're stopping now.. clear interruption flag. - Thread.interrupted(); - throw new Exception("Stop"); - } catch (IOException e) { - throw e; - } - - try { - /*String cksum = generateChecksum(downloadBuffer); - if (cksum.equals(validationHash)) - {*/ - if (!target.exists()) - target.createNewFile(); - - - downloadBuffer.position(0); - FileOutputStream fos = new FileOutputStream(target); - fos.getChannel().write(downloadBuffer); - fos.close(); - /*} - else - { - throw new RuntimeException(String.format("The downloaded file %s has an invalid checksum %s (expecting %s). The download did not succeed correctly and the file has been deleted. Please try launching again.", target.getName(), cksum, validationHash)); - }*/ - } catch (Exception e) { - throw e; - } - } - - private String checkExisting(Dependency dep) { - for (File f : modsDir.listFiles()) { - VersionedFile vfile = new VersionedFile(f.getName(), dep.file.pattern); - if (!vfile.matches() || !vfile.name.equals(dep.file.name)) - continue; - - if (f.renameTo(new File(v_modsDir, f.getName()))) - continue; - - deleteMod(f); - } - - for (File f : v_modsDir.listFiles()) { - VersionedFile vfile = new VersionedFile(f.getName(), dep.file.pattern); - if (!vfile.matches() || !vfile.name.equals(dep.file.name)) - continue; - - int cmp = vfile.version.compareTo(dep.file.version); - if (cmp < 0) { - System.out.println("Deleted old version " + f.getName()); - deleteMod(f); - return null; - } - if (cmp > 0) { - System.err.println("Warning: version of " + dep.file.name + ", " + vfile.version + " is newer than request " + dep.file.version); - return f.getName(); - } - return f.getName();//found dependency - } - return null; - } - - public void load() { - scanDepInfos(); - if (depMap.isEmpty()) - return; - - loadDeps(); - activateDeps(); - } - - private void activateDeps() { - for (Dependency dep : depMap.values()) - if (dep.coreLib) - addClasspath(dep.existing); - } - - private void loadDeps() { - downloadMonitor = FMLLaunchHandler.side().isClient() ? new Downloader() : new DummyDownloader(); - try { - while (!depSet.isEmpty()) { - Iterator it = depSet.iterator(); - Dependency dep = depMap.get(it.next()); - it.remove(); - load(dep); - } - } finally { - if (popupWindow != null) { - popupWindow.setVisible(false); - popupWindow.dispose(); - } - } - } - - private void load(Dependency dep) { - dep.existing = checkExisting(dep); - if (dep.existing == null)//download dep - { - download(dep); - dep.existing = dep.file.filename; - } - } - - private List modFiles() { - List list = new LinkedList(); - list.addAll(Arrays.asList(modsDir.listFiles())); - list.addAll(Arrays.asList(v_modsDir.listFiles())); - return list; - } - - private void scanDepInfos() { - for (File file : modFiles()) { - if (!file.getName().endsWith(".jar") && !file.getName().endsWith(".zip")) - continue; - - scanDepInfo(file); - } - } - - private void scanDepInfo(File file) { - try { - ZipFile zip = new ZipFile(file); - ZipEntry e = zip.getEntry("dependancies.info"); - if (e == null) e = zip.getEntry("dependencies.info"); - if (e != null) - loadJSon(zip.getInputStream(e)); - zip.close(); - } catch (Exception e) { - System.err.println("Failed to load dependencies.info from " + file.getName() + " as JSON"); - e.printStackTrace(); - } - } - - private void loadJSon(InputStream input) throws IOException { - InputStreamReader reader = new InputStreamReader(input); - JsonElement root = new JsonParser().parse(reader); - if (root.isJsonArray()) - loadJSonArr(root); - else - loadJson(root.getAsJsonObject()); - reader.close(); - } - - private void loadJSonArr(JsonElement root) throws IOException { - for (JsonElement node : root.getAsJsonArray()) - loadJson(node.getAsJsonObject()); - } - - private void loadJson(JsonObject node) throws IOException { - boolean obfuscated = ((LaunchClassLoader) DepLoader.class.getClassLoader()) - .getClassBytes("net.minecraft.world.World") == null; - - String testClass = node.get("class").getAsString(); - if (DepLoader.class.getResource("/" + testClass.replace('.', '/') + ".class") != null) - return; - - String repo = node.get("repo").getAsString(); - String filename = node.get("file").getAsString(); - if (!obfuscated && node.has("dev")) - filename = node.get("dev").getAsString(); - - boolean coreLib = node.has("coreLib") && node.get("coreLib").getAsBoolean(); - - Pattern pattern = null; - try { - if(node.has("pattern")) - pattern = Pattern.compile(node.get("pattern").getAsString()); - } catch (PatternSyntaxException e) { - System.err.println("Invalid filename pattern: "+node.get("pattern")); - e.printStackTrace(); - } - if(pattern == null) - pattern = Pattern.compile("(\\w+).*?([\\d\\.]+)[-\\w]*\\.[^\\d]+"); - - VersionedFile file = new VersionedFile(filename, pattern); - if (!file.matches()) - throw new RuntimeException("Invalid filename format for dependency: " + filename); - - addDep(new Dependency(repo, file, coreLib)); - } - - private void addDep(Dependency newDep) { - if (mergeNew(depMap.get(newDep.file.name), newDep)) { - depMap.put(newDep.file.name, newDep); - depSet.add(newDep.file.name); - } - } - - private boolean mergeNew(Dependency oldDep, Dependency newDep) { - if (oldDep == null) - return true; - - Dependency newest = newDep.file.version.compareTo(oldDep.file.version) > 0 ? newDep : oldDep; - newest.coreLib = newDep.coreLib || oldDep.coreLib; - - return newest == newDep; - } - } - - public static void load() { - if (inst == null) { - inst = new DepLoadInst(); - inst.load(); - } - } - - @Override - public String[] getASMTransformerClass() { - return null; - } - - @Override - public String getModContainerClass() { - return null; - } - - @Override - public String getSetupClass() { - return getClass().getName(); - } - - @Override - public void injectData(Map data) { - } - - @Override - public Void call() { - load(); - - return null; - } - - @Override - public String getAccessTransformerClass() { - return null; - } -} diff --git a/src/main/java/cofh/api/CoFHAPIProps.java b/src/main/java/cofh/api/CoFHAPIProps.java deleted file mode 100644 index ac3b23255..000000000 --- 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.10"; - -} diff --git a/src/main/java/cofh/api/energy/EnergyStorage.java b/src/main/java/cofh/api/energy/EnergyStorage.java deleted file mode 100644 index 1674c1894..000000000 --- a/src/main/java/cofh/api/energy/EnergyStorage.java +++ /dev/null @@ -1,158 +0,0 @@ -package cofh.api.energy; - -import net.minecraft.nbt.NBTTagCompound; - -/** - * Reference implementation of {@link IEnergyStorage}. Use/extend this or implement your own. - * - * @author King Lemming - * - */ -public class EnergyStorage implements IEnergyStorage { - - protected int energy; - protected int capacity; - protected int maxReceive; - protected int maxExtract; - - public EnergyStorage(int capacity) { - - this(capacity, capacity, capacity); - } - - public EnergyStorage(int capacity, int maxTransfer) { - - this(capacity, maxTransfer, maxTransfer); - } - - public EnergyStorage(int capacity, int maxReceive, int maxExtract) { - - this.capacity = capacity; - this.maxReceive = maxReceive; - this.maxExtract = maxExtract; - } - - public EnergyStorage readFromNBT(NBTTagCompound nbt) { - - this.energy = nbt.getInteger("Energy"); - - if (energy > capacity) { - energy = capacity; - } - return this; - } - - public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - - if (energy < 0) { - energy = 0; - } - nbt.setInteger("Energy", energy); - return nbt; - } - - public void setCapacity(int capacity) { - - this.capacity = capacity; - - if (energy > capacity) { - energy = capacity; - } - } - - public void setMaxTransfer(int maxTransfer) { - - setMaxReceive(maxTransfer); - setMaxExtract(maxTransfer); - } - - public void setMaxReceive(int maxReceive) { - - this.maxReceive = maxReceive; - } - - public void setMaxExtract(int maxExtract) { - - this.maxExtract = maxExtract; - } - - public int getMaxReceive() { - - return maxReceive; - } - - public int getMaxExtract() { - - return maxExtract; - } - - /** - * This function is included to allow for server -> client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers - * are guaranteed to have it. - * - * @param energy - */ - public void setEnergyStored(int energy) { - - this.energy = energy; - - if (this.energy > capacity) { - this.energy = capacity; - } else if (this.energy < 0) { - this.energy = 0; - } - } - - /** - * This function is included to allow the containing tile to directly and efficiently modify the energy contained in the EnergyStorage. Do not rely on this - * externally, as not all IEnergyHandlers are guaranteed to have it. - * - * @param energy - */ - public void modifyEnergyStored(int energy) { - - this.energy += energy; - - if (this.energy > capacity) { - this.energy = capacity; - } else if (this.energy < 0) { - this.energy = 0; - } - } - - /* IEnergyStorage */ - @Override - public int receiveEnergy(int maxReceive, boolean simulate) { - - int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); - - if (!simulate) { - energy += energyReceived; - } - return energyReceived; - } - - @Override - public int extractEnergy(int maxExtract, boolean simulate) { - - int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); - - if (!simulate) { - energy -= energyExtracted; - } - return energyExtracted; - } - - @Override - public int getEnergyStored() { - - return energy; - } - - @Override - public int getMaxEnergyStored() { - - return capacity; - } - -} diff --git a/src/main/java/cofh/api/energy/IEnergyConnection.java b/src/main/java/cofh/api/energy/IEnergyConnection.java deleted file mode 100644 index 79bdf77af..000000000 --- a/src/main/java/cofh/api/energy/IEnergyConnection.java +++ /dev/null @@ -1,21 +0,0 @@ -package cofh.api.energy; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not - * accept it; otherwise just use IEnergyHandler. - *

- * Note that {@link IEnergyHandler} is an extension of this. - * - * @author King Lemming - * - */ -public interface IEnergyConnection { - - /** - * Returns TRUE if the TileEntity can connect on a given side. - */ - boolean canConnectEnergy(ForgeDirection from); - -} diff --git a/src/main/java/cofh/api/energy/IEnergyContainerItem.java b/src/main/java/cofh/api/energy/IEnergyContainerItem.java deleted file mode 100644 index c28455b1a..000000000 --- a/src/main/java/cofh/api/energy/IEnergyContainerItem.java +++ /dev/null @@ -1,52 +0,0 @@ -package cofh.api.energy; - -import net.minecraft.item.ItemStack; - -/** - * Implement this interface on Item classes that support external manipulation of their internal energy storages. - *

- * A reference implementation is provided {@link ItemEnergyContainer}. - * - * @author King Lemming - * - */ -public interface IEnergyContainerItem { - - /** - * Adds energy to a container item. Returns the quantity of energy that was accepted. This should always return 0 if the item cannot be externally charged. - * - * @param container - * ItemStack to be charged. - * @param maxReceive - * Maximum amount of energy to be sent into the item. - * @param simulate - * If TRUE, the charge will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) received by the item. - */ - int receiveEnergy(ItemStack container, int maxReceive, boolean simulate); - - /** - * Removes energy from a container item. Returns the quantity of energy that was removed. This should always return 0 if the item cannot be externally - * discharged. - * - * @param container - * ItemStack to be discharged. - * @param maxExtract - * Maximum amount of energy to be extracted from the item. - * @param simulate - * If TRUE, the discharge will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) extracted from the item. - */ - int extractEnergy(ItemStack container, int maxExtract, boolean simulate); - - /** - * Get the amount of energy currently stored in the container item. - */ - int getEnergyStored(ItemStack container); - - /** - * Get the max amount of energy that can be stored in the container item. - */ - int getMaxEnergyStored(ItemStack container); - -} diff --git a/src/main/java/cofh/api/energy/IEnergyHandler.java b/src/main/java/cofh/api/energy/IEnergyHandler.java deleted file mode 100644 index 22f2dbc62..000000000 --- a/src/main/java/cofh/api/energy/IEnergyHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -package cofh.api.energy; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects. - *

- * A reference implementation is provided {@link TileEnergyHandler}. - * - * @author King Lemming - * - */ -public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver { - - // merely a convenience interface (remove these methods in 1.8; provided here for back-compat via compiler doing things) - - /** - * Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver. - * - * @param from - * Orientation the energy is received from. - * @param maxReceive - * Maximum amount of energy to receive. - * @param simulate - * If TRUE, the charge will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) received. - */ - @Override - int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate); - - /** - * Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider. - * - * @param from - * Orientation the energy is extracted from. - * @param maxExtract - * Maximum amount of energy to extract. - * @param simulate - * If TRUE, the extraction will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) extracted. - */ - @Override - int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate); - - - /** - * Returns the amount of energy currently stored. - */ - @Override - int getEnergyStored(ForgeDirection from); - - /** - * Returns the maximum amount of energy that can be stored. - */ - @Override - int getMaxEnergyStored(ForgeDirection from); - -} diff --git a/src/main/java/cofh/api/energy/IEnergyProvider.java b/src/main/java/cofh/api/energy/IEnergyProvider.java deleted file mode 100644 index 05287b35e..000000000 --- a/src/main/java/cofh/api/energy/IEnergyProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -package cofh.api.energy; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Implement this interface on Tile Entities which should provide energy, generally storing it in one or more internal {@link IEnergyStorage} objects. - *

- * A reference implementation is provided {@link TileEnergyHandler}. - * - * @author King Lemming - * - */ -public interface IEnergyProvider extends IEnergyConnection { - - /** - * Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider. - * - * @param from - * Orientation the energy is extracted from. - * @param maxExtract - * Maximum amount of energy to extract. - * @param simulate - * If TRUE, the extraction will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) extracted. - */ - int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate); - - /** - * Returns the amount of energy currently stored. - */ - int getEnergyStored(ForgeDirection from); - - /** - * Returns the maximum amount of energy that can be stored. - */ - int getMaxEnergyStored(ForgeDirection from); - -} diff --git a/src/main/java/cofh/api/energy/IEnergyReceiver.java b/src/main/java/cofh/api/energy/IEnergyReceiver.java deleted file mode 100644 index c726e09e0..000000000 --- a/src/main/java/cofh/api/energy/IEnergyReceiver.java +++ /dev/null @@ -1,38 +0,0 @@ -package cofh.api.energy; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Implement this interface on Tile Entities which should receive energy, generally storing it in one or more internal {@link IEnergyStorage} objects. - *

- * A reference implementation is provided {@link TileEnergyHandler}. - * - * @author King Lemming - * - */ -public interface IEnergyReceiver extends IEnergyConnection { - - /** - * Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver. - * - * @param from - * Orientation the energy is received from. - * @param maxReceive - * Maximum amount of energy to receive. - * @param simulate - * If TRUE, the charge will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) received. - */ - int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate); - - /** - * Returns the amount of energy currently stored. - */ - int getEnergyStored(ForgeDirection from); - - /** - * Returns the maximum amount of energy that can be stored. - */ - int getMaxEnergyStored(ForgeDirection from); - -} diff --git a/src/main/java/cofh/api/energy/IEnergyStorage.java b/src/main/java/cofh/api/energy/IEnergyStorage.java deleted file mode 100644 index bc2065607..000000000 --- a/src/main/java/cofh/api/energy/IEnergyStorage.java +++ /dev/null @@ -1,46 +0,0 @@ -package cofh.api.energy; - -/** - * An energy storage is the unit of interaction with Energy inventories.
- * This is not to be implemented on TileEntities. This is for internal use only. - *

- * A reference implementation can be found at {@link EnergyStorage}. - * - * @author King Lemming - * - */ -public interface IEnergyStorage { - - /** - * Adds energy to the storage. Returns quantity of energy that was accepted. - * - * @param maxReceive - * Maximum amount of energy to be inserted. - * @param simulate - * If TRUE, the insertion will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) accepted by the storage. - */ - int receiveEnergy(int maxReceive, boolean simulate); - - /** - * Removes energy from the storage. Returns quantity of energy that was removed. - * - * @param maxExtract - * Maximum amount of energy to be extracted. - * @param simulate - * If TRUE, the extraction will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) extracted from the storage. - */ - int extractEnergy(int maxExtract, boolean simulate); - - /** - * Returns the amount of energy currently stored. - */ - int getEnergyStored(); - - /** - * Returns the maximum amount of energy that can be stored. - */ - int getMaxEnergyStored(); - -} diff --git a/src/main/java/cofh/api/energy/ItemEnergyContainer.java b/src/main/java/cofh/api/energy/ItemEnergyContainer.java deleted file mode 100644 index 055ae45bc..000000000 --- a/src/main/java/cofh/api/energy/ItemEnergyContainer.java +++ /dev/null @@ -1,110 +0,0 @@ -package cofh.api.energy; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -/** - * Reference implementation of {@link IEnergyContainerItem}. Use/extend this or implement your own. - * - * @author King Lemming - * - */ -public class ItemEnergyContainer extends Item implements IEnergyContainerItem { - - protected int capacity; - protected int maxReceive; - protected int maxExtract; - - public ItemEnergyContainer() { - - } - - public ItemEnergyContainer(int capacity) { - - this(capacity, capacity, capacity); - } - - public ItemEnergyContainer(int capacity, int maxTransfer) { - - this(capacity, maxTransfer, maxTransfer); - } - - public ItemEnergyContainer(int capacity, int maxReceive, int maxExtract) { - - this.capacity = capacity; - this.maxReceive = maxReceive; - this.maxExtract = maxExtract; - } - - public ItemEnergyContainer setCapacity(int capacity) { - - this.capacity = capacity; - return this; - } - - public void setMaxTransfer(int maxTransfer) { - - setMaxReceive(maxTransfer); - setMaxExtract(maxTransfer); - } - - public void setMaxReceive(int maxReceive) { - - this.maxReceive = maxReceive; - } - - public void setMaxExtract(int maxExtract) { - - this.maxExtract = maxExtract; - } - - /* IEnergyContainerItem */ - @Override - public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { - - if (container.stackTagCompound == null) { - container.stackTagCompound = new NBTTagCompound(); - } - int energy = container.stackTagCompound.getInteger("Energy"); - int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); - - if (!simulate) { - energy += energyReceived; - container.stackTagCompound.setInteger("Energy", energy); - } - return energyReceived; - } - - @Override - public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { - - if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { - return 0; - } - int energy = container.stackTagCompound.getInteger("Energy"); - int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); - - if (!simulate) { - energy -= energyExtracted; - container.stackTagCompound.setInteger("Energy", energy); - } - return energyExtracted; - } - - @Override - public int getEnergyStored(ItemStack container) { - - if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { - return 0; - } - return container.stackTagCompound.getInteger("Energy"); - } - - @Override - public int getMaxEnergyStored(ItemStack container) { - - return capacity; - } - -} diff --git a/src/main/java/cofh/api/energy/TileEnergyHandler.java b/src/main/java/cofh/api/energy/TileEnergyHandler.java deleted file mode 100644 index 7cc655e92..000000000 --- a/src/main/java/cofh/api/energy/TileEnergyHandler.java +++ /dev/null @@ -1,65 +0,0 @@ -package cofh.api.energy; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Reference implementation of {@link IEnergyHandler}. Use/extend this or implement your own. - * - * @author King Lemming - * - */ -public class TileEnergyHandler extends TileEntity implements IEnergyHandler { - - protected EnergyStorage storage = new EnergyStorage(32000); - - @Override - public void readFromNBT(NBTTagCompound nbt) { - - super.readFromNBT(nbt); - storage.readFromNBT(nbt); - } - - @Override - public void writeToNBT(NBTTagCompound nbt) { - - super.writeToNBT(nbt); - storage.writeToNBT(nbt); - } - - /* IEnergyConnection */ - @Override - public boolean canConnectEnergy(ForgeDirection from) { - - return true; - } - - /* IEnergyReceiver */ - @Override - public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { - - return storage.receiveEnergy(maxReceive, simulate); - } - - /* IEnergyProvider */ - @Override - public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) { - - return storage.extractEnergy(maxExtract, simulate); - } - - /* IEnergyReceiver and IEnergyProvider */ - @Override - public int getEnergyStored(ForgeDirection from) { - - return storage.getEnergyStored(); - } - - @Override - public int getMaxEnergyStored(ForgeDirection from) { - - return storage.getMaxEnergyStored(); - } - -} diff --git a/src/main/java/cofh/api/energy/package-info.java b/src/main/java/cofh/api/energy/package-info.java deleted file mode 100644 index 7379702b8..000000000 --- a/src/main/java/cofh/api/energy/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|energy") -package cofh.api.energy; - -import cofh.api.CoFHAPIProps; -import cpw.mods.fml.common.API; - diff --git a/src/main/java/cofh/api/item/IEmpowerableItem.java b/src/main/java/cofh/api/item/IEmpowerableItem.java deleted file mode 100644 index f77c71f6a..000000000 --- a/src/main/java/cofh/api/item/IEmpowerableItem.java +++ /dev/null @@ -1,41 +0,0 @@ -package cofh.api.item; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; - -/** - * Implement this interface on Item classes which may be "Empowered" - what that means is completely up to you. This just provides a uniform way of dealing with - * them. - * - * @author King Lemming - * - */ -public interface IEmpowerableItem { - - /** - * Check whether or not a given item is currently in an empowered state. - */ - boolean isEmpowered(ItemStack stack); - - /** - * Attempt to set the empowered state of the item. - * - * @param stack - * ItemStack to be empowered/disempowered. - * @param state - * Desired state. - * @return TRUE if the operation was successful, FALSE if it was not. - */ - boolean setEmpoweredState(ItemStack stack, boolean state); - - /** - * Callback method for reacting to a state change. Useful in KeyBinding handlers. - * - * @param player - * Player holding the item, if applicable. - * @param stack - * The item being held. - */ - void onStateChange(EntityPlayer player, ItemStack stack); - -} diff --git a/src/main/java/cofh/api/item/IInventoryContainerItem.java b/src/main/java/cofh/api/item/IInventoryContainerItem.java deleted file mode 100644 index b87896ccc..000000000 --- a/src/main/java/cofh/api/item/IInventoryContainerItem.java +++ /dev/null @@ -1,20 +0,0 @@ -package cofh.api.item; - -import net.minecraft.item.ItemStack; - -/** - * Implement this interface on Item classes that are themselves inventories. - * - * A reference implementation is provided {@link ItemInventoryContainer}. - * - * @author King Lemming - * - */ -public interface IInventoryContainerItem { - - /** - * Get the size of this inventory of this container item. - */ - int getSizeInventory(ItemStack container); - -} diff --git a/src/main/java/cofh/api/item/IToolHammer.java b/src/main/java/cofh/api/item/IToolHammer.java deleted file mode 100644 index 1ffefe729..000000000 --- a/src/main/java/cofh/api/item/IToolHammer.java +++ /dev/null @@ -1,44 +0,0 @@ -package cofh.api.item; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; - -/** - * Implement this interface on subclasses of Item to have that item work as a tool for CoFH mods. - */ -public interface IToolHammer { - - /** - * Called to ensure that the wrench can be used. - * - * @param item - * The itemstack for the tool. Not required to match equipped item (e.g., multi-tools that contain other tools) - * @param user - * The entity using the tool - * @param x - * X location of the block/tile - * @param y - * Y location of the block/tile - * @param z - * Z location of the block/tile - * @return True if this tool can be used - */ - boolean isUsable(ItemStack item, EntityLivingBase user, int x, int y, int z); - - /** - * Callback for when the tool has been used reactively. - * - * @param item - * The ItemStack for the tool. Not required to match equipped item (e.g., multi-tools that contain other tools) - * @param user - * The entity using the tool - * @param x - * X location of the block/tile - * @param y - * Y location of the block/tile - * @param z - * Z location of the block/tile - */ - void toolUsed(ItemStack item, EntityLivingBase user, int x, int y, int z); - -} diff --git a/src/main/java/cofh/api/item/package-info.java b/src/main/java/cofh/api/item/package-info.java deleted file mode 100644 index 49608fd13..000000000 --- a/src/main/java/cofh/api/item/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|item") -package cofh.api.item; - -import cofh.api.CoFHAPIProps; -import cpw.mods.fml.common.API; - 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 08ff5fcb6..000000000 --- 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; -