#1210 Conduits enabling without AE2. Switch to AE2 API instead of lib.

This commit is contained in:
tterrag1098 committed 2014-11-14 02:15:08 -05:00
1 parent 4bcfce2bf2
commit 3791b4b611
231 files changed
+7973 -52

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
package appeng.api;
/**
*
* Entry point for api.
*
* Available IMCs:
*
*/
public class AEApi
{
static private IAppEngApi api = null;
/**
* API Entry Point.
*
* @return the {@link IAppEngApi} or null if the instance could not be retrieved
*/
public static IAppEngApi instance()
{
if ( api == null )
{
try
{
Class c = Class.forName( "appeng.core.Api" );
api = (IAppEngApi) c.getField( "instance" ).get( c );
}
catch (Throwable e)
{
return null;
}
}
return api;
}
}
+71
View File
@@ -0,0 +1,71 @@
package appeng.api;
import appeng.api.definitions.Blocks;
import appeng.api.definitions.Items;
import appeng.api.definitions.Materials;
import appeng.api.definitions.Parts;
import appeng.api.exceptions.FailedConnection;
import appeng.api.features.IRegistryContainer;
import appeng.api.networking.IGridBlock;
import appeng.api.networking.IGridConnection;
import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
import appeng.api.parts.IPartHelper;
import appeng.api.storage.IStorageHelper;
public interface IAppEngApi
{
/**
* @return Registry Container for the numerous registries in AE2.
*/
IRegistryContainer registries();
/**
* @return helper for working with storage data types.
*/
IStorageHelper storage();
/**
* @return helper for working with grids, and buses.
*/
IPartHelper partHelper();
/**
* @return an accessible list of all of AE's Items
*/
Items items();
/**
* @return an accessible list of all of AE's materials; materials are items
*/
Materials materials();
/**
* @return an accessible list of all of AE's blocks
*/
Blocks blocks();
/**
* @return an accessible list of all of AE's parts, parts are items
*/
Parts parts();
/**
* create a grid node for your {@link IGridHost}
*
* @param block
* @return
*/
IGridNode createGridNode(IGridBlock block);
/**
* create a connection between two {@link IGridNode}
*
* @param a
* @param b
* @throws FailedConnection
*/
IGridConnection createGridConnection(IGridNode a, IGridNode b) throws FailedConnection;
}
@@ -0,0 +1,48 @@
package appeng.api.config;
public enum AccessRestriction
{
NO_ACCESS(0), READ(1), WRITE(2), READ_WRITE(3);
private final int permisionBit;
private AccessRestriction(int v) {
permisionBit = v;
}
public boolean hasPermission(AccessRestriction ar)
{
return (permisionBit & ar.permisionBit) == ar.permisionBit;
}
public AccessRestriction restrictPermissions(AccessRestriction ar)
{
return getPermByBit( permisionBit & ar.permisionBit );
}
public AccessRestriction addPermissions(AccessRestriction ar)
{
return getPermByBit( permisionBit | ar.permisionBit );
}
public AccessRestriction removePermissions(AccessRestriction ar)
{
return getPermByBit( permisionBit & (~ar.permisionBit) );
}
private AccessRestriction getPermByBit(int bit)
{
switch (bit)
{
default:
case 0:
return NO_ACCESS;
case 1:
return READ;
case 2:
return WRITE;
case 3:
return READ_WRITE;
}
}
}
@@ -0,0 +1,6 @@
package appeng.api.config;
public enum ActionItems
{
WRENCH, CLOSE, STASH, ENCODE, SUBSTITUTION
}
@@ -0,0 +1,14 @@
package appeng.api.config;
public enum Actionable
{
/**
* Perform the intended action.
*/
MODULATE,
/**
* Pretend to perform the action.
*/
SIMULATE
}
@@ -0,0 +1,15 @@
package appeng.api.config;
public enum CondenserOuput
{
TRASH, // 0
MATTER_BALLS, // 256
SINGULARITY; // 250,000
public int requiredPower = 0;
}
@@ -0,0 +1,6 @@
package appeng.api.config;
public enum CopyMode
{
CLEAR_ON_REMOVE, KEEP_ON_REMOVE
}
@@ -0,0 +1,6 @@
package appeng.api.config;
public enum FullnessMode
{
EMPTY, HALF, FULL
}
@@ -0,0 +1,21 @@
package appeng.api.config;
public enum FuzzyMode
{
// Note that percentage damaged, is the inverse of percentage durability.
IGNORE_ALL(-1), PERCENT_99(0), PERCENT_75(25), PERCENT_50(50), PERCENT_25(75);
final public float breakPoint;
final public float percentage;
private FuzzyMode(float p) {
percentage = p;
breakPoint = p / 100.0f;
}
public int calculateBreakPoint(int maxDamage)
{
return (int) ((percentage * maxDamage) / 100.0f);
}
}
@@ -0,0 +1,6 @@
package appeng.api.config;
public enum IncludeExclude
{
WHITELIST, BLACKLIST
}
@@ -0,0 +1,10 @@
package appeng.api.config;
public enum LevelEmitterMode
{
STORED_AMOUNT,
STOREABLE_AMOUNT
}
@@ -0,0 +1,10 @@
package appeng.api.config;
public enum LevelType
{
ITEM_LEVEL,
ENERGY_LEVEL
}
@@ -0,0 +1,6 @@
package appeng.api.config;
public enum ModSettings
{
}
@@ -0,0 +1,12 @@
package appeng.api.config;
public enum NetworkEmitterMode
{
POWER_LEVEL,
BOOTING,
CHANNEL_ERROR
}
@@ -0,0 +1,6 @@
package appeng.api.config;
public enum OperationMode
{
FILL, EMPTY
}
@@ -0,0 +1,6 @@
package appeng.api.config;
public enum OutputMode
{
EXPORT_ONLY, EXPORT_OR_CRAFT, CRAFT_ONLY
}
@@ -0,0 +1,21 @@
package appeng.api.config;
public enum PowerMultiplier
{
ONE, CONFIG;
/**
* please do not edit this value, it is set when AE loads its config files.
*/
public double multiplier = 1.0;
public double multiply(double in)
{
return in * multiplier;
}
public double divide(double in)
{
return in / multiplier;
}
}
@@ -0,0 +1,42 @@
package appeng.api.config;
public enum PowerUnits
{
AE("gui.appliedenergistics2.units.appliedenergstics"), // Native Units - AE Energy
MJ("gui.appliedenergistics2.units.buildcraft"), // BuildCraft - Minecraft Joules
EU("gui.appliedenergistics2.units.ic2"), // IndustrialCraft 2 - Energy Units
WA("gui.appliedenergistics2.units.rotarycraft"), // RotaryCraft - Watts
RF("gui.appliedenergistics2.units.thermalexpansion"), // ThermalExpansion - Redstone Flux
MK("gui.appliedenergistics2.units.mekanism"); // Mekanism - Joules
private PowerUnits(String un) {
unlocalizedName = un;
}
/**
* please do not edit this value, it is set when AE loads its config files.
*/
public double conversionRatio = 1.0;
/**
* unlocalized name for the power unit.
*/
final public String unlocalizedName;
/**
* do power conversion using AE's conversion rates.
*
* Example: PowerUnits.EU.convertTo( PowerUnits.AE, 32 );
*
* will normally returns 64, as it will convert the EU, to AE with AE's power settings.
*
* @param target
* @param value
* @return value converted to target units, from this units.
*/
public double convertTo(PowerUnits target, double value)
{
return (value * conversionRatio) / target.conversionRatio;
}
}
@@ -0,0 +1,6 @@
package appeng.api.config;
public enum RedstoneMode
{
IGNORE, LOW_SIGNAL, HIGH_SIGNAL, SIGNAL_PULSE
}
@@ -0,0 +1,6 @@
package appeng.api.config;
public enum RelativeDirection
{
LEFT, RIGHT, UP, DOW
}
@@ -0,0 +1,6 @@
package appeng.api.config;
public enum SearchBoxMode
{
AUTOSEARCH, MANUAL_SEARCH, NEI_AUTOSEARCH, NEI_MANUAL_SEARCH
}
@@ -0,0 +1,47 @@
package appeng.api.config;
/**
* Represent the security systems basic permissions, these are not for anti-griefing, they are part of the mod as a
* gameplay feature.
*/
public enum SecurityPermissions
{
/**
* required to insert items into the network via terminal ( also used for machines based on the owner of the
* network, which is determined by its Security Block. )
*/
INJECT,
/**
* required to extract items from the network via terminal ( also used for machines based on the owner of the
* network, which is determined by its Security Block. )
*/
EXTRACT,
/**
* required to request crafting from the network via terminal.
*/
CRAFT,
/**
* required to modify automation, and make modifications to the networks physical layout.
*/
BUILD,
/**
* required to modify the security blocks settings.
*/
SECURITY;
final private String unlocalizedName = "gui.appliedenergistics2.security." + name().toLowerCase();
public String getUnlocalizedName()
{
return unlocalizedName + ".name";
}
public String getUnlocalizedTip()
{
return unlocalizedName + ".tip";
}
}
@@ -0,0 +1,46 @@
package appeng.api.config;
import java.util.EnumSet;
public enum Settings
{
LEVEL_EMITTER_MODE(EnumSet.allOf( LevelEmitterMode.class )),
REDSTONE_EMITTER(EnumSet.of( RedstoneMode.HIGH_SIGNAL, RedstoneMode.LOW_SIGNAL )), REDSTONE_CONTROLLED(EnumSet.allOf( RedstoneMode.class )),
CONDENSER_OUTPUT(EnumSet.allOf( CondenserOuput.class )),
POWER_UNITS(EnumSet.allOf( PowerUnits.class )), ACCESS(EnumSet.of( AccessRestriction.READ_WRITE, AccessRestriction.READ, AccessRestriction.WRITE )),
SORT_DIRECTION(EnumSet.allOf( SortDir.class )), SORT_BY(EnumSet.allOf( SortOrder.class )),
SEARCH_TOOLTIPS(EnumSet.of( YesNo.YES, YesNo.NO )), VIEW_MODE(EnumSet.allOf( ViewItems.class )), SEARCH_MODE(EnumSet.allOf( SearchBoxMode.class )),
ACTIONS(EnumSet.allOf( ActionItems.class )), IO_DIRECTION(EnumSet.of( RelativeDirection.LEFT, RelativeDirection.RIGHT )),
BLOCK(EnumSet.of( YesNo.YES, YesNo.NO )), OPERATION_MODE(EnumSet.allOf( OperationMode.class )),
FULLNESS_MODE(EnumSet.allOf( FullnessMode.class )), CRAFT_ONLY(EnumSet.of( YesNo.YES, YesNo.NO )),
FUZZY_MODE(EnumSet.allOf( FuzzyMode.class )), LEVEL_TYPE(EnumSet.allOf( LevelType.class )),
TERMINAL_STYLE(EnumSet.of( TerminalStyle.TALL, TerminalStyle.SMALL )), COPY_MODE(EnumSet.allOf( CopyMode.class )),
INTERFACE_TERMINAL(EnumSet.of( YesNo.YES, YesNo.NO )), CRAFT_VIA_REDSTONE(EnumSet.of( YesNo.YES, YesNo.NO )),
STORAGE_FILTER(EnumSet.allOf( StorageFilter.class ));
private EnumSet values;
public EnumSet getPossibleValues()
{
return values;
}
private Settings(EnumSet set) {
if ( set == null || set.isEmpty() )
throw new RuntimeException( "Invalid configuration." );
values = set;
}
}
@@ -0,0 +1,6 @@
package appeng.api.config;
public enum SortDir
{
ASCENDING, DESCENDING;
}
@@ -0,0 +1,6 @@
package appeng.api.config;
public enum SortOrder
{
NAME, AMOUNT, MOD, INVTWEAKS
}
@@ -0,0 +1,10 @@
package appeng.api.config;
public enum StorageFilter
{
NONE,
EXTACTABLE_ONLY
}
@@ -0,0 +1,12 @@
package appeng.api.config;
public enum TerminalStyle
{
TALL,
FULL,
SMALL
}
@@ -0,0 +1,15 @@
package appeng.api.config;
public enum TunnelType
{
ME, // Network Tunnel
BC_POWER, // MJ Tunnel
IC2_POWER, // EU Tunnel
RF_POWER, // RF Tunnel
REDSTONE, // Redstone Tunnel
FLUID, // Fluid Tunnel
ITEM, // Item Tunnel
LIGHT, // Light Tunnel
BUNDLED_REDSTONE, // Bundled Redstone Tunnel
COMPUTER_MESSAGE // Computer Message Tunnel
}
@@ -0,0 +1,39 @@
package appeng.api.config;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
public enum Upgrades
{
/**
* Gold Tier Upgrades.
*/
CAPACITY(0), REDSTONE(0), CRAFTING(0),
/**
* Diamond Tier Upgrades.
*/
FUZZY(1), SPEED(1), INVERTER(1);
public final int myTier;
public final HashMap<ItemStack, Integer> supportedMax = new HashMap<ItemStack, Integer>();
private Upgrades(int tier) {
myTier = tier;
}
/**
* @return list of Items/Blocks that support this upgrade, and how many it supports.
*/
public HashMap<ItemStack, Integer> getSupported()
{
return supportedMax;
}
public void registerItem(ItemStack myItem, int maxSupported)
{
if ( myItem != null )
supportedMax.put( myItem, maxSupported );
}
}
@@ -0,0 +1,6 @@
package appeng.api.config;
public enum ViewItems
{
ALL, STORED, CRAFTABLE
}
@@ -0,0 +1,6 @@
package appeng.api.config;
public enum YesNo
{
YES, NO, UNDECIDED
}
@@ -0,0 +1,89 @@
package appeng.api.definitions;
import appeng.api.util.AEItemDefinition;
public class Blocks
{
/*
* World Gen
*/
public AEItemDefinition blockQuartzOre;
public AEItemDefinition blockQuartzOreCharged;
public AEItemDefinition blockMatrixFrame;
/*
* Decorative
*/
public AEItemDefinition blockQuartz;
public AEItemDefinition blockQuartzPiller;
public AEItemDefinition blockQuartzChiseled;
public AEItemDefinition blockQuartzGlass;
public AEItemDefinition blockQuartzVibrantGlass;
public AEItemDefinition blockQuartzTorch;
public AEItemDefinition blockFluix;
public AEItemDefinition blockSkyStone;
public AEItemDefinition blockSkyChest;
public AEItemDefinition blockSkyCompass;
/*
* Misc
*/
public AEItemDefinition blockGrindStone;
public AEItemDefinition blockCrankHandle;
public AEItemDefinition blockInscriber;
public AEItemDefinition blockWireless;
public AEItemDefinition blockCharger;
public AEItemDefinition blockTinyTNT;
public AEItemDefinition blockSecurity;
/*
* Quantum Network Bridge
*/
public AEItemDefinition blockQuantumRing;
public AEItemDefinition blockQuantumLink;
/*
* Spatial IO
*/
public AEItemDefinition blockSpatialPylon;
public AEItemDefinition blockSpatialIOPort;
/*
* Bus / Cables
*/
public AEItemDefinition blockMultiPart;
/*
* Machines
*/
public AEItemDefinition blockController;
public AEItemDefinition blockDrive;
public AEItemDefinition blockChest;
public AEItemDefinition blockInterface;
public AEItemDefinition blockCellWorkbench;
public AEItemDefinition blockIOPort;
public AEItemDefinition blockCondenser;
public AEItemDefinition blockEnergyAcceptor;
public AEItemDefinition blockVibrationChamber;
public AEItemDefinition blockQuartzGrowthAccelerator;
public AEItemDefinition blockEnergyCell;
public AEItemDefinition blockEnergyCellDense;
public AEItemDefinition blockEnergyCellCreative;
// rv1
public AEItemDefinition blockCraftingUnit;
public AEItemDefinition blockCraftingAccelerator;
public AEItemDefinition blockCraftingStorage1k;
public AEItemDefinition blockCraftingStorage4k;
public AEItemDefinition blockCraftingStorage16k;
public AEItemDefinition blockCraftingStorage64k;
public AEItemDefinition blockCraftingMonitor;
public AEItemDefinition blockMolecularAssembler;
public AEItemDefinition blockLightDetector;
public AEItemDefinition blockPaint;
}
@@ -0,0 +1,54 @@
package appeng.api.definitions;
import appeng.api.util.AEColoredItemDefinition;
import appeng.api.util.AEItemDefinition;
public class Items
{
public AEItemDefinition itemCertusQuartzAxe;
public AEItemDefinition itemCertusQuartzHoe;
public AEItemDefinition itemCertusQuartzShovel;
public AEItemDefinition itemCertusQuartzPick;
public AEItemDefinition itemCertusQuartzSword;
public AEItemDefinition itemCertusQuartzWrench;
public AEItemDefinition itemCertusQuartzKnife;
public AEItemDefinition itemNetherQuartzAxe;
public AEItemDefinition itemNetherQuartzHoe;
public AEItemDefinition itemNetherQuartzShovel;
public AEItemDefinition itemNetherQuartzPick;
public AEItemDefinition itemNetherQuartzSword;
public AEItemDefinition itemNetherQuartzWrench;
public AEItemDefinition itemNetherQuartzKnife;
public AEItemDefinition itemEntropyManipulator;
public AEItemDefinition itemWirelessTerminal;
public AEItemDefinition itemBiometricCard;
public AEItemDefinition itemChargedStaff;
public AEItemDefinition itemMassCannon;
public AEItemDefinition itemMemoryCard;
public AEItemDefinition itemNetworkTool;
public AEItemDefinition itemPortableCell;
public AEItemDefinition itemCellCreative;
public AEItemDefinition itemViewCell;
public AEItemDefinition itemCell1k;
public AEItemDefinition itemCell4k;
public AEItemDefinition itemCell16k;
public AEItemDefinition itemCell64k;
public AEItemDefinition itemSpatialCell2;
public AEItemDefinition itemSpatialCell16;
public AEItemDefinition itemSpatialCell128;
public AEItemDefinition itemFacade;
public AEItemDefinition itemCrystalSeed;
// rv1
public AEItemDefinition itemEncodedPattern;
public AEItemDefinition itemColorApplicator;
public AEColoredItemDefinition itemPaintBall;
public AEColoredItemDefinition itemLumenPaintBall;
}
@@ -0,0 +1,80 @@
package appeng.api.definitions;
import appeng.api.util.AEItemDefinition;
public class Materials
{
public AEItemDefinition materialCell2SpatialPart;
public AEItemDefinition materialCell16SpatialPart;
public AEItemDefinition materialCell128SpatialPart;
public AEItemDefinition materialSilicon;
public AEItemDefinition materialSkyDust;
public AEItemDefinition materialCalcProcessorPress;
public AEItemDefinition materialEngProcessorPress;
public AEItemDefinition materialLogicProcessorPress;
public AEItemDefinition materialCalcProcessorPrint;
public AEItemDefinition materialEngProcessorPrint;
public AEItemDefinition materialLogicProcessorPrint;
public AEItemDefinition materialSiliconPress;
public AEItemDefinition materialSiliconPrint;
public AEItemDefinition materialNamePress;
public AEItemDefinition materialLogicProcessor;
public AEItemDefinition materialCalcProcessor;
public AEItemDefinition materialEngProcessor;
public AEItemDefinition materialBasicCard;
public AEItemDefinition materialAdvCard;
public AEItemDefinition materialPureifiedCertusQuartzCrystal;
public AEItemDefinition materialPureifiedNetherQuartzCrystal;
public AEItemDefinition materialPureifiedFluixCrystal;
public AEItemDefinition materialCell1kPart;
public AEItemDefinition materialCell4kPart;
public AEItemDefinition materialCell16kPart;
public AEItemDefinition materialCell64kPart;
public AEItemDefinition materialEmptyStorageCell;
public AEItemDefinition materialCardRedstone;
public AEItemDefinition materialCardSpeed;
public AEItemDefinition materialCardCapacity;
public AEItemDefinition materialCardFuzzy;
public AEItemDefinition materialCardInverter;
public AEItemDefinition materialCardCrafting;
public AEItemDefinition materialEnderDust;
public AEItemDefinition materialFlour;
public AEItemDefinition materialGoldDust;
public AEItemDefinition materialIronDust;
public AEItemDefinition materialFluixDust;
public AEItemDefinition materialCertusQuartzDust;
public AEItemDefinition materialNetherQuartzDust;
public AEItemDefinition materialMatterBall;
public AEItemDefinition materialIronNugget;
public AEItemDefinition materialCertusQuartzCrystal;
public AEItemDefinition materialCertusQuartzCrystalCharged;
public AEItemDefinition materialFluixCrystal;
public AEItemDefinition materialFluixPearl;
public AEItemDefinition materialWoodenGear;
public AEItemDefinition materialWireless;
public AEItemDefinition materialWirelessBooster;
public AEItemDefinition materialAnnihilationCore;
public AEItemDefinition materialFormationCore;
public AEItemDefinition materialSingularity;
public AEItemDefinition materialQESingularity;
public AEItemDefinition materialBlankPattern;
}
@@ -0,0 +1,54 @@
package appeng.api.definitions;
import appeng.api.util.AEColoredItemDefinition;
import appeng.api.util.AEItemDefinition;
public class Parts
{
public AEColoredItemDefinition partCableSmart;
public AEColoredItemDefinition partCableCovered;
public AEColoredItemDefinition partCableGlass;
public AEColoredItemDefinition partCableDense;
public AEColoredItemDefinition partLumenCableSmart;
public AEColoredItemDefinition partLumenCableCovered;
public AEColoredItemDefinition partLumenCableGlass;
public AEColoredItemDefinition partLumenCableDense;
public AEItemDefinition partQuartzFiber;
public AEItemDefinition partToggleBus;
public AEItemDefinition partInvertedToggleBus;
public AEItemDefinition partStorageBus;
public AEItemDefinition partImportBus;
public AEItemDefinition partExportBus;
public AEItemDefinition partInterface;
public AEItemDefinition partLevelEmitter;
public AEItemDefinition partAnnihilationPlane;
public AEItemDefinition partFormationPlane;
public AEItemDefinition partP2PTunnelME;
public AEItemDefinition partP2PTunnelRedstone;
public AEItemDefinition partP2PTunnelItems;
public AEItemDefinition partP2PTunnelLiquids;
public AEItemDefinition partP2PTunnelMJ;
public AEItemDefinition partP2PTunnelEU;
public AEItemDefinition partP2PTunnelRF;
public AEItemDefinition partP2PTunnelLight;
public AEItemDefinition partCableAnchor;
public AEItemDefinition partMonitor;
public AEItemDefinition partSemiDarkMonitor;
public AEItemDefinition partDarkMonitor;
public AEItemDefinition partInterfaceTerminal;
public AEItemDefinition partPatternTerminal;
public AEItemDefinition partCraftingTerminal;
public AEItemDefinition partTerminal;
public AEItemDefinition partStorageMonitor;
public AEItemDefinition partConversionMonitor;
}
@@ -0,0 +1,28 @@
package appeng.api.events;
import appeng.api.features.ILocatable;
import cpw.mods.fml.common.eventhandler.Event;
/**
* Input Event:
*
* Used to Notify the Location Registry of objects, and their availability.
*/
public class LocatableEventAnnounce extends Event
{
public enum LocatableEvent
{
Register, // Adds the locatable to the registry
Unregister // Removes the locatable from the registry
};
final public ILocatable target;
final public LocatableEvent change;
public LocatableEventAnnounce(ILocatable o, LocatableEvent ev) {
target = o;
change = ev;
}
}
@@ -0,0 +1,11 @@
package appeng.api.exceptions;
public class AppEngException extends Exception
{
private static final long serialVersionUID = -9051434206368465494L;
public AppEngException(String t) {
super( t );
}
}
@@ -0,0 +1,10 @@
package appeng.api.exceptions;
public class FailedConnection extends Exception
{
private static final long serialVersionUID = -2544208090248293753L;
public FailedConnection() {
}
}
@@ -0,0 +1,11 @@
package appeng.api.exceptions;
public class MissingIngredientError extends Exception {
private static final long serialVersionUID = -998858343831371697L;
public MissingIngredientError(String n) {
super( n );
}
}
@@ -0,0 +1,12 @@
package appeng.api.exceptions;
public class ModNotInstalled extends Exception
{
private static final long serialVersionUID = -9052435206368425494L;
public ModNotInstalled(String t) {
super( t );
}
}
@@ -0,0 +1,12 @@
package appeng.api.exceptions;
public class RecipeError extends Exception
{
private static final long serialVersionUID = -6602870588617670262L;
public RecipeError(String n) {
super( n );
}
}
@@ -0,0 +1,12 @@
package appeng.api.exceptions;
public class RegistrationError extends Exception
{
private static final long serialVersionUID = -6602870588617670263L;
public RegistrationError(String n) {
super( n );
}
}
@@ -0,0 +1,96 @@
package appeng.api.features;
import net.minecraft.item.ItemStack;
/**
* Registration Records for {@link IGrinderRegistry}
*/
public interface IGrinderEntry
{
/**
* the current input
*
* @return input that the grinder will accept.
*/
public ItemStack getInput();
/**
* lets you change the grinder recipe by changing its input.
*
* @param input
*/
public void setInput(ItemStack input);
/**
* gets the current output
*
* @return output that the grinder will produce
*/
public ItemStack getOutput();
/**
* gets the current output
*
* @return output that the grinder will produce
*/
public ItemStack getOptionalOutput();
/**
* gets the current output
*
* @return output that the grinder will produce
*/
public ItemStack getSecondOptionalOutput();
/**
* allows you to change the output.
*
* @param output
*/
public void setOutput(ItemStack output);
/**
* stack, and 0.0-1.0 chance that it will be generated.
*
* @param output
* @param chance
*/
public void setOptionalOutput(ItemStack output, float chance);
/**
* 0.0 - 1.0 the chance that the optional output will be generated.
*
* @return
*/
public float getOptionalChance();
/**
* stack, and 0.0-1.0 chance that it will be generated.
*
* @param output
* @param chance
*/
public void setSecondOptionalOutput(ItemStack output, float chance);
/**
* 0.0 - 1.0 the chance that the optional output will be generated.
*
* @return
*/
public float getSecondOptionalChance();
/**
* Energy cost, in turns.
*
* @return number of turns it takes to produce the output from the input.
*/
public int getEnergyCost();
/**
* Allows you to adjust the number of turns
*
* @param new number of turns to produce output.
*/
public void setEnergyCost(int c);
}
@@ -0,0 +1,61 @@
package appeng.api.features;
import java.util.List;
import net.minecraft.item.ItemStack;
/**
* Lets you manipulate Grinder Recipes, by adding or editing existing ones.
*/
public interface IGrinderRegistry
{
/**
* Current list of registered recipes, you can modify this if you want too.
*
* @return currentlyRegistredRecipes
*/
public List<IGrinderEntry> getRecipes();
/**
* add a new recipe the easy way, in -> out, how many turns., duplicates will not be added.
*
* @param in input
* @param out output
* @param turns amount of turns to turn the input into the output
*/
public void addRecipe(ItemStack in, ItemStack out, int turns);
/**
* add a new recipe with optional outputs, duplicates will not be added.
*
* @param in input
* @param out output
* @param optional optional output
* @param chance chance to get the optional output within 0.0 - 1.0
* @param turns amount of turns to turn the input into the outputs
*/
void addRecipe(ItemStack in, ItemStack out, ItemStack optional, float chance, int turns);
/**
* add a new recipe with optional outputs, duplicates will not be added.
*
* @param in input
* @param out output
* @param optional optional output
* @param chance chance to get the optional output within 0.0 - 1.0
* @param optional2 second optional output
* @param chance2 chance to get the second optional output within 0.0 - 1.0
* @param turns amount of turns to turn the input into the outputs
*/
void addRecipe(ItemStack in, ItemStack out, ItemStack optional, float chance, ItemStack optional2, float chance2, int turns);
/**
* Searches for a recipe for a given input, and returns it.
*
* @param input input
* @return identified recipe or null
*/
public IGrinderEntry getRecipeForInput(ItemStack input);
}
@@ -0,0 +1,30 @@
package appeng.api.features;
import net.minecraft.item.ItemStack;
/**
* Provider for special comparisons. when an item is encountered AE Will request
* if the comparison function handles the item, by trying to request a
* IItemComparison class.
*/
public interface IItemComparisionProvider
{
/**
* should return a new IItemComparison, or return null if it doesn't handle
* the supplied item.
*
* @param is
* @return IItemComparison, or null
*/
IItemComparison getComparison(ItemStack is);
/**
* Simple test for support ( AE generally skips this and calls the above function. )
*
* @param stack
* @return true, if getComparison will return a valid IItemComparison Object
*/
public boolean canHandle(ItemStack stack);
}
@@ -0,0 +1,10 @@
package appeng.api.features;
public interface IItemComparison
{
public boolean sameAsPrecise(IItemComparison comp);
public boolean sameAsFuzzy(IItemComparison comp);
}
@@ -0,0 +1,17 @@
package appeng.api.features;
import appeng.api.events.LocatableEventAnnounce;
/**
* A registration record for the {@link ILocatableRegistry} use the {@link LocatableEventAnnounce} event on the Forge
* Event bus to update the registry.
*/
public interface ILocatable
{
/**
* @return the serial for a locatable object
*/
long getLocatableSerial();
}
@@ -0,0 +1,18 @@
package appeng.api.features;
/**
* A Registry for locatable items, works based on serial numbers.
*/
public interface ILocatableRegistry
{
/**
* Attempts to find the object with the serial specified, if it can it
* returns the object.
*
* @param ser
* @return requestedObject, or null
*/
public abstract Object findLocateableBySerial(long ser);
}
@@ -0,0 +1,24 @@
package appeng.api.features;
import net.minecraft.item.ItemStack;
public interface IMatterCannonAmmoRegistry
{
/**
* register a new ammo, generally speaking this is based off of atomic weight to make it easier to guess at
*
* @param ammo
* @param weight
*/
void registerAmmo(ItemStack ammo, double weight);
/**
* get the penetration value for a particular ammo, 0 indicates a non-ammo.
*
* @param is
* @return 0 or a valid penetration value.
*/
float getPenetration(ItemStack is);
}
@@ -0,0 +1,28 @@
package appeng.api.features;
import net.minecraft.item.ItemStack;
public interface INetworkEncodable {
/**
* Used to get the current key from the item.
*
* @param player
* @param item
* @return
*/
String getEncryptionKey(ItemStack item);
/**
* Encode the wireless frequency via the Controller.
*
* @param item
* the wireless terminal.
* @param encKey
* the wireless encryption key.
* @param name
* null for now.
*/
void setEncryptionKey(ItemStack item, String encKey, String name);
}
@@ -0,0 +1,31 @@
package appeng.api.features;
import net.minecraft.item.ItemStack;
import appeng.api.config.TunnelType;
/**
* A Registry for how p2p Tunnels are attuned
*/
public interface IP2PTunnelRegistry
{
/**
* Allows third parties to register items from their mod as potential
* attunements for AE's P2P Tunnels
*
* @param trigger
* - the item which triggers attunement
* @param type
* - the type of tunnel
*/
public abstract void addNewAttunement(ItemStack trigger, TunnelType type);
/**
* returns null if no attunement can be found.
*
* @param trigger
* @return
*/
TunnelType getTunnelTypeByItem(ItemStack trigger);
}
@@ -0,0 +1,26 @@
package appeng.api.features;
import net.minecraft.entity.player.EntityPlayer;
import com.mojang.authlib.GameProfile;
/**
* Maintains a save specific list of userids and username combinations this greatly simplifies storage internally and
* gives a common place to look up and get IDs for the security framework.
*/
public interface IPlayerRegistry
{
/**
* @param player
* @return user id of a username.
*/
int getID(GameProfile gameProfile);
/**
* @param player
* @return user id of a player entity.
*/
int getID(EntityPlayer player);
}
@@ -0,0 +1,48 @@
package appeng.api.features;
import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IRecipeHandler;
import appeng.api.recipes.ISubItemResolver;
public interface IRecipeHandlerRegistry
{
/**
* Add a new Recipe Handler to the parser.
*
* MUST BE CALLED IN PRE-INIT
*
* @param name
* @param handler
*/
void addNewCraftHandler(String name, Class<? extends ICraftHandler> handler);
/**
* Add a new resolver to the parser.
*
* MUST BE CALLED IN PRE-INIT
*
* @param sir
*/
void addNewSubItemResolver(ISubItemResolver sir);
/**
* @param name
* @return A recipe handler by name, returns null on failure.
*/
ICraftHandler getCraftHandlerFor(String name);
/**
* @return a new recipe handler, which can be used to parse, and read recipe files.
*/
public IRecipeHandler createNewRecipehandler();
/**
* resolve sub items by name.
*
* @param tmpName
* @return ResolerResult or ResolverResultSet
*/
Object resolveItem(String nameSpace, String itemName);
}
@@ -0,0 +1,76 @@
package appeng.api.features;
import appeng.api.movable.IMovableRegistry;
import appeng.api.networking.IGridCacheRegistry;
import appeng.api.storage.ICellRegistry;
import appeng.api.storage.IExternalStorageRegistry;
public interface IRegistryContainer
{
/**
* Use the movable registry to white list your tiles.
*/
IMovableRegistry moveable();
/**
* Add new Grid Caches for use during run time, only use during loading phase.
*/
IGridCacheRegistry gridCache();
/**
* Add additional storage bus handlers to improve interplay with mod blocks that contains special inventories that
* function unlike vanilla chests. AE uses this internally for barrels, dsu's, quantum chests, AE Networks and more.
*/
IExternalStorageRegistry externalStorage();
/**
* Add additional special comparison functionality, AE Uses this internally for Bees.
*/
ISpecialComparisonRegistry specialComparson();
/**
* Lets you register your items as wireless terminals
*/
IWirelessTermRegistery wireless();
/**
* Allows you to register new cell types, these will function in drives
*/
ICellRegistry cell();
/**
* Manage grinder recipes via API
*/
IGrinderRegistry grinder();
/**
* get access to the locatable registry
*/
ILocatableRegistry locateable();
/**
* get access to the p2p tunnel registry.
*/
IP2PTunnelRegistry p2pTunnel();
/**
* get access to the ammo registry.
*/
IMatterCannonAmmoRegistry matterCannon();
/**
* get access to the player registry
*/
IPlayerRegistry players();
/**
* get access to the ae2 recipe api
*/
IRecipeHandlerRegistry recipes();
/**
* get access to the world-gen api.
*/
IWorldGen worldgen();
}
@@ -0,0 +1,27 @@
package appeng.api.features;
import net.minecraft.item.ItemStack;
/**
* A Registry of any special comparison handlers for AE To use.
*
*/
public interface ISpecialComparisonRegistry
{
/**
* return TheHandler or null.
*
* @param stack
* @return a handler it found for a specific item
*/
IItemComparison getSpecialComparion(ItemStack stack);
/**
* Register a new special comparison function with AE.
*
* @param prov
*/
public void addComparisonProvider(IItemComparisionProvider prov);
}
@@ -0,0 +1,46 @@
package appeng.api.features;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.util.IConfigManager;
/**
* A handler for a wireless terminal.
*/
public interface IWirelessTermHandler extends INetworkEncodable
{
/**
* @param is
* @return true, if usePower, hasPower, etc... can be called for the provided item
*/
boolean canHandle(ItemStack is);
/**
* use an amount of power, in AE units
*
* @param amount
* is in AE units ( 5 per MJ ), if you return false, the item should be dead and return false for
* hasPower
* @param is
* @return
*/
boolean usePower(EntityPlayer player, double amount, ItemStack is);
/**
* gets the power status of the item.
*
* @param is
* @return returns true if there is any power left.
*/
boolean hasPower(EntityPlayer player, double amount, ItemStack is);
/**
* Return the config manage for the wireless terminal.
*
* @param is
* @return
*/
IConfigManager getConfigManager(ItemStack is);
}
@@ -0,0 +1,39 @@
package appeng.api.features;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* Registration record for a Custom Cell handler.
*/
public interface IWirelessTermRegistery
{
/**
* add this handler to the list of other wireless handler.
*
* @param handler
*/
void registerWirelessHandler(IWirelessTermHandler handler);
/**
* @param is
* @return true if there is a handler for this item
*/
boolean isWirelessTerminal(ItemStack is);
/**
* @param is
* @return a register handler for the item in question, or null if there
* isn't one
*/
IWirelessTermHandler getWirelessTerminalHandler(ItemStack is);
/**
* opens the wireless terminal gui, the wireless terminal item, must be in
* the active slot on the tool bar.
*/
void OpenWirelessTermainlGui(ItemStack item, World w, EntityPlayer player);
}
@@ -0,0 +1,20 @@
package appeng.api.features;
import net.minecraft.world.World;
import net.minecraft.world.WorldProvider;
public interface IWorldGen
{
public enum WorldGenType
{
CertusQuartz, ChargedCertusQuartz, Metorites
};
public void disableWorldGenForProviderID(WorldGenType type, Class<? extends WorldProvider> provider);
public void disableWorldGenForDimension(WorldGenType type, int dimid);
boolean isWorldGenEnabled(WorldGenType type, World w);
}
@@ -0,0 +1,22 @@
package appeng.api.implementations;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import appeng.api.networking.crafting.ICraftingPatternDetails;
/**
* Implemented on {@link Item}
*/
public interface ICraftingPatternItem
{
/**
* Access Details about a patern
*
* @param is
* @param w
* @return
*/
ICraftingPatternDetails getPatternForItem(ItemStack is, World w);
}
@@ -0,0 +1,19 @@
package appeng.api.implementations;
/**
* This is intended for use on the client side to provide details to Waila.
*/
public interface IPowerChannelState
{
/**
* @return true if the part/tile is powered.
*/
boolean isPowered();
/**
* @return true if the part/tile isActive
*/
boolean isActive();
}
@@ -0,0 +1,23 @@
package appeng.api.implementations;
import net.minecraft.tileentity.TileEntity;
import appeng.api.config.Upgrades;
import appeng.api.implementations.tiles.ISegmentedInventory;
import appeng.api.util.IConfigureableObject;
public interface IUpgradeableHost extends IConfigureableObject, ISegmentedInventory
{
/**
* determine how many of an upgrade are installed.
*/
int getInstalledUpgrades(Upgrades u);
/**
* the tile...
*
* @return
*/
TileEntity getTile();
}
@@ -0,0 +1,18 @@
package appeng.api.implementations;
/**
* Defines the result of performing a transition from the world into a storage
* cell, if its possible, and what the energy usage is.
*/
public class TransitionResult
{
public TransitionResult(boolean _success, double power) {
success = _success;
energyUsage = power;
}
public final boolean success;
public final double energyUsage;
}
@@ -0,0 +1,15 @@
package appeng.api.implementations.guiobjects;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* Implemented on Item objects, to return objects used to manage, and interact
* with the contents.
*/
public interface IGuiItem
{
IGuiItemObject getGuiObject(ItemStack is, World world, int x, int y, int z);
}
@@ -0,0 +1,9 @@
package appeng.api.implementations.guiobjects;
import net.minecraft.item.ItemStack;
public interface IGuiItemObject
{
public ItemStack getItemStack();
}
@@ -0,0 +1,14 @@
package appeng.api.implementations.guiobjects;
import net.minecraft.inventory.IInventory;
import appeng.api.networking.IGridHost;
/**
* Obtained via {@link IGuiItem} getGuiObject
*/
public interface INetworkTool extends IInventory, IGuiItemObject
{
IGridHost getGridHost(); // null for most purposes.
}
@@ -0,0 +1,14 @@
package appeng.api.implementations.guiobjects;
import appeng.api.networking.energy.IEnergySource;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
/**
* Obtained via {@link IGuiItem} getGuiObject
*/
public interface IPortableCell extends ITerminalHost, IMEMonitor<IAEItemStack>, IEnergySource, IGuiItemObject
{
}
@@ -0,0 +1,48 @@
package appeng.api.implementations.items;
import net.minecraft.item.ItemStack;
import appeng.api.config.AccessRestriction;
import appeng.api.networking.energy.IAEPowerStorage;
/**
* Basically the same as {@link IAEPowerStorage}, but for items.
*/
public interface IAEItemPowerStorage
{
/**
* Inject amt, power into the device, it will store what it can, and return
* the amount unable to be stored.
*
* @return
*/
public double injectAEPower(ItemStack is, double amt);
/**
* Attempt to extract power from the device, it will extract what it can and
* return it.
*
* @param amt
* @return
*/
public double extractAEPower(ItemStack is, double amt);
/**
* @return the current maximum power ( this can change :P )
*/
public double getAEMaxPower(ItemStack is);
/**
* @return the current AE Power Level, this may exceed getMEMaxPower()
*/
public double getAECurrentPower(ItemStack is);
/**
* Control the power flow by telling what the network can do, either add? or
* subtract? or both!
*
* @return
*/
public AccessRestriction getPowerFlow(ItemStack is);
}
@@ -0,0 +1,24 @@
package appeng.api.implementations.items;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* Implemented on AE's wrench(s) as a substitute for if BC's API is not
* available.
*/
public interface IAEWrench
{
/**
* Check if the wrench can be used.
*
* @param player
* @param x
* @param y
* @param z
* @return
*/
boolean canWrench(ItemStack wrench, EntityPlayer player, int x, int y, int z);
}
@@ -0,0 +1,64 @@
package appeng.api.implementations.items;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import appeng.api.config.SecurityPermissions;
import appeng.api.features.IPlayerRegistry;
import appeng.api.networking.security.ISecurityRegister;
import com.mojang.authlib.GameProfile;
public interface IBiometricCard
{
/**
* Set the {@link GameProfile} to null, to clear it.
*/
void setProfile(ItemStack itemStack, GameProfile username);
/**
* @return {@link GameProfile} of the player encoded on this card, or a blank string.
*/
GameProfile getProfile(ItemStack is);
/**
* @param itemStack
* @return the full list of permissions encoded on the card.
*/
EnumSet<SecurityPermissions> getPermissions(ItemStack itemStack);
/**
* Check if a permission is encoded on the card.
*
* @param permission
* @return true if this permission is set on the card.
*/
boolean hasPermission(ItemStack is, SecurityPermissions permission);
/**
* remove a permission from the item stack.
*
* @param itemStack
* @param permission
*/
void removePermission(ItemStack itemStack, SecurityPermissions permission);
/**
* add a permission to the item stack.
*
* @param itemStack
* @param permission
*/
void addPermission(ItemStack itemStack, SecurityPermissions permission);
/**
* lets you handle submission of security values on the card for custom behavior.
*
* @param register
* @param pr
* @param is
*/
void registerPermissions(ISecurityRegister register, IPlayerRegistry pr, ItemStack is);
}
@@ -0,0 +1,14 @@
package appeng.api.implementations.items;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
public interface IGrowableCrystal
{
ItemStack triggerGrowth(ItemStack is);
float getMultiplier(Block blk, Material mat);
}
@@ -0,0 +1,21 @@
package appeng.api.implementations.items;
import java.util.Set;
import net.minecraft.item.ItemStack;
/**
* Lets you specify the name of the group of items this falls under.
*/
public interface IItemGroup
{
/**
* returning null, is the same as not implementing the interface at all.
*
* @param is
* @return an unlocalized string to use for the items group name.
*/
String getUnlocalizedGroupName(Set<ItemStack> otherItems, ItemStack is);
}
@@ -0,0 +1,56 @@
package appeng.api.implementations.items;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
/**
* Memory Card API
*
* AE's Memory Card Item Class implements this interface.
*/
public interface IMemoryCard
{
/**
* Configures the data stored on the memory card, the SettingsName, will be
* localized when displayed.
*
* @param is
* @param SettingsName
* unlocalized string that represents the tile entity.
* @param data
* may contain a String called "tooltip" which is is a
* unlocalized string displayed after the settings name, optional
* but can be used to add details to the card for later.
*/
void setMemoryCardContents(ItemStack is, String SettingsName, NBTTagCompound data);
/**
* returns the settings name provided by a pervious call to
* setMemoryCardContents, or "AppEng.GuiITooltip.Blank" if there was no
* previous call to setMemoryCardContents.
*
* @param is
* @return
*/
String getSettingsName(ItemStack is);
/**
* @param is
* @return the NBT Data previously saved by setMemoryCardContents, or an
* empty NBTCompound
*/
NBTTagCompound getData(ItemStack is);
/**
* notify the user of a outcome related to the memory card.
*
* @param player
* that used the card.
* @param settingsSaved
* which message to send.
*/
void notifyUser(EntityPlayer player, MemoryCardMessages msg);
}
@@ -0,0 +1,69 @@
package appeng.api.implementations.items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import appeng.api.implementations.TransitionResult;
import appeng.api.util.WorldCoord;
/**
* Implemented on a {@link Item}
*/
public interface ISpatialStorageCell
{
/**
* @param is
* @return true if this item is a spatial storage cell
*/
boolean isSpatialStorage(ItemStack is);
/**
* @param is
* @return the maximum size of the spatial storage cell along any given axis
*/
int getMaxStoredDim(ItemStack is);
/**
* @param is
* @return the world for this cell
*/
World getWorld(ItemStack is);
/**
* get the currently stored size.
*
* @param is
* @return
*/
WorldCoord getStoredSize(ItemStack is);
/**
* Minimum coordinates in its world for the storage cell.
*
* @param is
* @return
*/
WorldCoord getMin(ItemStack is);
/**
* Maximum coordinates in its world for the storage cell.
*
* @param is
* @return
*/
WorldCoord getMax(ItemStack is);
/**
* Perform a spatial swap with the contents of the cell, and the world.
*
* @param is
* @param w
* @param min
* @param max
* @param doTransition
* @return
*/
TransitionResult doSpatialTransition(ItemStack is, World w, WorldCoord min, WorldCoord max, boolean doTransition);
}
@@ -0,0 +1,82 @@
package appeng.api.implementations.items;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ICellWorkbenchItem;
import appeng.api.storage.data.IAEItemStack;
/**
* Any item which implements this can be treated as an IMEInventory via
* Util.getCell / Util.isCell It automatically handles the internals and NBT
* data, which is both nice, and bad for you!
*
* Good cause it means you don't have to do anything, bad because you have
* little to no control over it.
*
* The standard AE implementation only provides 1-63 Types
*
*/
public interface IStorageCell extends ICellWorkbenchItem
{
/**
* If this returns something where N % 8 != 0 Then you will be shot on
* sight, or your car will explode, something like that least...
*
* @param cellItem
* @return numberofBytes
*/
int getBytes(ItemStack cellItem);
/**
* Determines the number of bytes used for any type included on the cell.
*
* @param cellItem
* @return numberOfBytes
*/
int BytePerType(ItemStack cellItem);
/**
* Must be between 1 and 63, indicates how many types you want to store on
* the item.
*
* @param cellItem
* @return numberOfTypes
*/
int getTotalTypes(ItemStack cellItem);
/**
* Allows you to fine tune which items are allowed on a given cell, if you
* don't care, just return false; As the handler for this type of cell is
* still the default cells, the normal AE black list is also applied.
*
* @param cellItem
* @param requestedAddition
* @return true to preventAdditionOfItem
*/
boolean isBlackListed(ItemStack cellItem, IAEItemStack requestedAddition);
/**
* Allows you to specify if this storage cell can be stored inside other
* storage cells, only set this for special items like the matter cannon
* that are not general purpose storage.
*
* @return true if the storage cell can be stored inside other storage
* cells, this is generally false, except for certain situations
* such as the matter cannon.
*/
boolean storableInStorageCell();
/**
* Allows an item to selectively enable or disable its status as a storage
* cell.
*
* @param i
* @return if the ItemStack should behavior as a storage cell.
*/
boolean isStorageCell(ItemStack i);
/**
* @return drain in ae/t this storage cell will use.
*/
double getIdleDrain();
}
@@ -0,0 +1,30 @@
package appeng.api.implementations.items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
/**
* Implemented on a {@link Item}
*/
public interface IStorageComponent
{
/**
* This isn't necessarily the same as if you make a storage cell out of it,
* but all of AE's default cells do it that way, its currently only used for
* the condenser.
*
* @param cellItem
* @return numberofBytes
*/
int getBytes(ItemStack is);
/**
* Just true or false for the item stack.
*
* @param is
* @return
*/
boolean isStorageComponent(ItemStack is);
}
@@ -0,0 +1,15 @@
package appeng.api.implementations.items;
import net.minecraft.item.ItemStack;
import appeng.api.config.Upgrades;
public interface IUpgradeModule
{
/**
* @param itemstack
* @return null, or a valid upgrade type.
*/
Upgrades getType(ItemStack itemstack);
}
@@ -0,0 +1,9 @@
package appeng.api.implementations.items;
/**
* Status Results for use with {@link IMemoryCard}
*/
public enum MemoryCardMessages
{
INVALID_MACHINE, SETTINGS_LOADED, SETTINGS_SAVED, SETTINGS_CLEARED
}
@@ -0,0 +1,61 @@
package appeng.api.implementations.parts;
import java.util.EnumSet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.networking.IGridHost;
import appeng.api.parts.BusSupport;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartHost;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
/**
* Implemented on the {@link IPart}s cable objects that can be placed at {@link ForgeDirection}.UNKNWON in
* {@link IPartHost}s
*/
public interface IPartCable extends IPart, IGridHost
{
/**
* does this cable support buses?
*/
BusSupport supportsBuses();
/**
* @return the current color of the cable.
*/
AEColor getCableColor();
/**
* @return the Cable type.
*/
AECableType getCableConnectionType();
/**
* Change the color of the cable, this should cost a small amount of dye, or something.
*
* @param newColor
* @return if the color change was successful.
*/
boolean changeColor(AEColor newColor, EntityPlayer who);
/**
* Change sides on the cables node.
*
* Called by AE, do not invoke.
*
* @param sides
*/
void setValidSides(EnumSet<ForgeDirection> sides);
/**
* used to tests if a cable connects to neighbors visually.
*
* @param side
* @return true if this side is currently connects to an external block.
*/
boolean isConnected(ForgeDirection side);
}
@@ -0,0 +1,18 @@
package appeng.api.implementations.parts;
import appeng.api.networking.IGridHost;
import appeng.api.parts.IPart;
/**
* Implemented by all screen like parts provided by AE.
*/
public interface IPartMonitor extends IPart, IGridHost
{
/**
* @return if the device is online you should check this before providing
* any other information.
*/
boolean isPowered();
}
@@ -0,0 +1,26 @@
package appeng.api.implementations.parts;
import appeng.api.networking.IGridHost;
import appeng.api.parts.IPart;
import appeng.api.storage.data.IAEStack;
import appeng.api.util.INetworkToolAgent;
/**
* The Storage monitor is a {@link IPart} located on the sides of a IPartHost
*/
public interface IPartStorageMonitor extends IPartMonitor, IPart, IGridHost, INetworkToolAgent
{
/**
* @return the item being displayed on the storage monitor, in AEStack Form, can be either a IAEItemStack or an
* IAEFluidStack the quantity is important remember to use getStackSize() on the IAEStack, and not on the
* FluidStack/ItemStack acquired from it.
*/
IAEStack getDisplayed();
/**
* @return the current locked state of the Storage Monitor
*/
boolean isLocked();
}
@@ -0,0 +1,40 @@
package appeng.api.implementations.tiles;
import appeng.api.networking.IGridHost;
import appeng.api.storage.ICellContainer;
import appeng.api.util.IOrientable;
public interface IChestOrDrive extends ICellContainer, IGridHost, IOrientable
{
/**
* @return how many slots are available. Chest has 1, Drive has 10.
*/
int getCellCount();
/**
* 0 - cell is missing.
*
* 1 - green,
*
* 2 - orange,
*
* 3 - red
*
* @param slot
* @return status of the slot, one of the above indices.
*/
int getCellStatus(int slot);
/**
* @return if the device is online you should check this before providing any other information.
*/
boolean isPowered();
/**
* @param slot
* @return is the cell currently blinking to show activity.
*/
boolean isCellBlinking(int slot);
}
@@ -0,0 +1,14 @@
package appeng.api.implementations.tiles;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.util.AEColor;
public interface IColorableTile
{
AEColor getColor();
boolean recolourBlock(ForgeDirection side, AEColor colour, EntityPlayer who);
}
@@ -0,0 +1,29 @@
package appeng.api.implementations.tiles;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.networking.crafting.ICraftingPatternDetails;
public interface ICraftingMachine
{
/**
* inserts a crafting plan, and the necessary items into the crafting machine.
*
* @param patternDetails
* @param table
* @param ejectionDirection
*
* @return if it was accepted, all or nothing.
*/
boolean pushPattern(ICraftingPatternDetails patternDetails, InventoryCrafting table, ForgeDirection ejectionDirection);
/**
* check if the crafting machine is accepting pushes via pushPattern, if this is false, all cals to push will fail,
* you can try inserting into the inventry instead.
*
* @return true, if pushPattern can complete, if its false push will always be false.
*/
boolean acceptsPlans();
}
@@ -0,0 +1,35 @@
package appeng.api.implementations.tiles;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Crank/Crankable API,
*
* Tiles that Implement this can receive power, from the crank, and have the
* crank placed on them.
*
* Tiles that access other tiles that implement this method can act as Cranks.
*
* This interface must be implemented by a tile entity.
*/
public interface ICrankable
{
/**
* Test if the crank can turn, return false if there is no work to be done.
*
* @return if crank should be allowed to turn.
*/
boolean canTurn();
/**
* The crank has completed one turn.
*/
void applyTurn();
/**
* @return true if the crank can attach on the given side.
*/
boolean canCrankAttach(ForgeDirection directionToCrank);
}
@@ -0,0 +1,8 @@
package appeng.api.implementations.tiles;
public interface ICrystalGrowthAccelerator
{
boolean isPowered();
}
@@ -0,0 +1,8 @@
package appeng.api.implementations.tiles;
import appeng.api.networking.energy.IEnergySource;
public interface IMEChest extends IChestOrDrive, ITileStorageMonitorable, IEnergySource
{
}
@@ -0,0 +1,17 @@
package appeng.api.implementations.tiles;
import net.minecraft.inventory.IInventory;
public interface ISegmentedInventory
{
/**
* Access an internal inventory, note, not all inventories contain real items, some may be ghost items, and treating
* them a real inventories will result in duplication.
*
* @param name
* @return
*/
IInventory getInventoryByName(String name);
}
@@ -0,0 +1,15 @@
package appeng.api.implementations.tiles;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IStorageMonitorable;
/**
* Implemented on inventories that can share their inventories with other networks, best example, ME Interface.
*/
public interface ITileStorageMonitorable
{
IStorageMonitorable getMonitorable(ForgeDirection side, BaseActionSource src);
}
@@ -0,0 +1,15 @@
package appeng.api.implementations.tiles;
import net.minecraft.inventory.IInventory;
public interface IViewCellStorage
{
/**
* should contains at least 5 slot, the first 5
*
* @return inventory with at least 5 slot
*/
IInventory getViewCellStorage();
}
@@ -0,0 +1,30 @@
package appeng.api.implementations.tiles;
import appeng.api.networking.IGrid;
import appeng.api.networking.security.IActionHost;
import appeng.api.util.DimensionalCoord;
public interface IWirelessAccessPoint extends IActionHost
{
/**
* @return location of WAP
*/
DimensionalCoord getLocation();
/**
* @return max range for this WAP
*/
double getRange();
/**
* @return can you use this WAP?
*/
boolean isActive();
/**
* @return
*/
IGrid getGrid();
}
@@ -0,0 +1,20 @@
package appeng.api.integration;
/**
* An interface to get access to the individual settings for AE's Internal Bee
* Comparison handler.
*
* Assessable via: ( IBeeComparison )
* IAEItemStack.getTagCompound().getSpecialComparison()
*
* If you don't have the forestry API, just delete this file when using the API.
*/
public interface IBeeComparison
{
/**
* @return the Forestry IIndividual for this comparison object - cast this to a IIndividual if you want to use it.
*/
Object getIndividual();
}
@@ -0,0 +1,41 @@
package appeng.api.movable;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public interface IMovableHandler
{
/**
* if you return true from this, your saying you can handle the class, not
* that single entity, you cannot opt out of single entities.
*
* @param myClass
* @param tile
* @return
*/
boolean canHandle(Class<? extends TileEntity> myClass, TileEntity tile);
/**
* request that the handler move the the tile from its current location to
* the new one. the tile has already been invalidated, and the blocks have
* already been fully moved.
*
* Potential Example:
*
* Chunk c = world.getChunkFromBlockCoords( x, z ); c.setChunkBlockTileEntity( x
* & 0xF, y + y, z & 0xF, tile );
*
* if ( c.isChunkLoaded ) { world.addTileEntity( tile ); world.markBlockForUpdate( x,
* y, z ); }
*
* @param tile
* @param world
* @param x
* @param y
* @param z
* @return
*/
void moveTile(TileEntity tile, World world, int x, int y, int z);
}
@@ -0,0 +1,97 @@
package appeng.api.movable;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
/**
* Used to determine if a tile is marked as movable, a block will be considered movable, if...
*
* 1. The Tile or its super classes have been white listed with whiteListTileEntity.
*
* 2. The Tile has been register with the IMC ( which basically calls whiteListTileEntity. )
*
* 3. The Tile implements IMovableTile 4. A IMovableHandler is register that returns canHandle = true for the Tile
* Entity Class
*
* IMC Example: FMLInterModComms.sendMessage( "appliedenergistics2", "movabletile", "appeng.common.AppEngTile" );
*
* The movement process is as follows,
*
* 1. IMovableTile.prepareToMove() or TileEntity.invalidate() depending on your opt-in method. 2. The tile will be
* removed from the world. 3. Its world, coordinates will be changed. *** this can be overridden with a IMovableHandler
* *** 4. It will then be re-added to the world, or a new world. 5. TileEntity.validate() 6. IMovableTile.doneMoving (
* if you implemented IMovableTile )
*
* Please note, this is a 100% white list only feature, I will never opt in any non-vanilla, non-AE blocks. If you do
* not want to support your tiles being moved, you don't have to do anything.
*
* I appreciate anyone that takes the effort to get their tiles to work with this system to create a better use
* experience.
*
* If you need a build of deobf build of AE for testing, do not hesitate to ask.
*/
public interface IMovableRegistry
{
/**
* Black list a block from movement, please only use this to prevent exploits.
*
* You can also use the IMC, FMLInterModComms.sendMessage( "appliedenergistics2", "whitelist-spatial",
* "appeng.common.AppEngTile" );
*
* @param blk
*/
void blacklistBlock(Block blk);
/**
* White list your tile entity with the registry.
*
* You can also use the IMC, FMLInterModComms.sendMessage( "appliedenergistics2", "blacklist-block-spatial", new
* ItemStack(...) );
*
* If you tile is handled with IMovableHandler or IMovableTile you do not need to white list it.
*/
void whiteListTileEntity(Class<? extends TileEntity> c);
/**
* @param te
* @return true if the tile has accepted your request to move it
*/
boolean askToMove(TileEntity te);
/**
* tells the tile you are done moving it.
*
* @param te
*/
void doneMoving(TileEntity te);
/**
* add a new handler movable handler.
*
* @param handler
*/
void addHandler(IMovableHandler handler);
/**
* handlers are used to perform movement, this allows you to override AE's internal version.
*
* only valid after askToMove(...) = true
*
* @param te
* @return
*/
IMovableHandler getHandler(TileEntity te);
/**
* @return a copy of the default handler
*/
IMovableHandler getDefaultHandler();
/**
* @param blk
* @return true if this block is blacklisted
*/
boolean isBlacklisted(Block blk);
}
@@ -0,0 +1,23 @@
package appeng.api.movable;
/**
* You can implement this, or use the IMovableRegistry to white list your tile,
* please see the registry for more information.
*/
public interface IMovableTile
{
/**
* notification that your block will be moved, called instead of invalidate,
* return false to prevent movement.
*
* @return
*/
boolean prepareToMove();
/**
* notification that your block was moved, called after validate.
*/
void doneMoving();
}
@@ -0,0 +1,45 @@
package appeng.api.networking;
/**
* Various flags to determine network node behavior.
*/
public enum GridFlags
{
/**
* import/export buses, terminals, and other devices that use network features, will use this setting.
*/
REQUIRE_CHANNEL,
/**
* P2P ME tunnels use this setting.
*/
COMPRESSED_CHANNEL,
/**
* cannot carry channels over this node.
*/
CANNOT_CARRY,
/**
* Used by P2P Tunnels to prevent tunnels from tunneling recursively.
*/
CANNOT_CARRY_COMPRESSED,
/**
* This node can transmit 32 signals, this should only apply to Tier2 Cable, P2P Tunnels, and Quantum Network
* Bridges.
*/
DENSE_CAPACITY,
/**
* This block is part of a multiblock, used in conjunction with REQUIRE_CANNEL, and {@link IGridMultiblock} see this
* interface for details.
*/
MULTIBLOCK,
/**
* Indicates which path might be preferred, this only matters if two routes of equal length exist, ad only changes
* the order they are processed in.
*/
PREFERED
}
@@ -0,0 +1,9 @@
package appeng.api.networking;
public enum GridNotification
{
/**
* the visible connections for this node have changed, useful for cable.
*/
ConnectionsChanged,
}
@@ -0,0 +1,71 @@
package appeng.api.networking;
import appeng.api.networking.events.MENetworkEvent;
import appeng.api.util.IReadOnlyCollection;
/**
* Gives you access to Grid based information.
*
* Don't Implement.
*/
public interface IGrid
{
/**
* Get Access to various grid modules
*
* @param iface
* @return the IGridCache you requested.
*/
public <C extends IGridCache> C getCache(Class<? extends IGridCache> iface);
/**
* Post an event into the network event bus.
*
* @param ev
* - event to post
* @return returns ev back to original poster
*/
public MENetworkEvent postEvent(MENetworkEvent ev);
/**
* Post an event into the network event bus, but direct it at a single node.
*
* @param ev
* event to post
* @return returns ev back to original poster
*/
public MENetworkEvent postEventTo(IGridNode node, MENetworkEvent ev);
/**
* get a list of the diversity of classes, you can use this to better detect which machines your interested in,
* rather then iterating the entire grid to test them.
*
* @return IReadOnlyCollection of all available host types (Of Type IGridHost).
*/
public IReadOnlyCollection<Class<? extends IGridHost>> getMachinesClasses();
/**
* Get machines on the network.
*
* @param classofIGridHost
* @return IMachineSet of all nodes belonging to hosts of specified class.
*/
public IMachineSet getMachines(Class<? extends IGridHost> classofIGridHost);
/**
* @return IReadOnlyCollection for all nodes on the network, node visitors are prefered.
*/
IReadOnlyCollection<IGridNode> getNodes();
/**
* @return true if the last node has been removed from the grid.
*/
public boolean isEmpty();
/**
* @return the node considered the pivot point of the grid.
*/
public IGridNode getPivot();
}
@@ -0,0 +1,88 @@
package appeng.api.networking;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.parts.IPart;
import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord;
/**
* An Implementation is required to create your node for IGridHost
*
* Implement for use with IGridHost
*/
public interface IGridBlock
{
/**
* how much power to drain per tick as part of idle network usage.
*
* if the value of this changes, you must post a MENetworkPowerIdleChange
*
* @return ae/t to use.
*/
double getIdlePowerUsage();
/**
* Various flags that AE uses to modify basic behavior for various parts of the network.
*
* @return Set of flags for this IGridBlock
*/
EnumSet<GridFlags> getFlags();
/**
* generally speaking you will return true for this, the one exception is buses, or worm holes where the node
* represents something that isn't a real connection in the world, but rather one represented internally to the
* block.
*
* @return if the world can connect to this node, and the node can connect to the world.
*/
boolean isWorldAccessable();
/**
* @return current location of this node
*/
DimensionalCoord getLocation();
/**
* @return Transparent, or a valid color, NULL IS NOT A VALID RETURN
*/
AEColor getGridColor();
/**
* Notifies your IGridBlock that changes were made to your connections
*/
void onGridNotification(GridNotification notification);
/**
* Update Blocks network/connection/booting status. grid,
*
* @param isReady
*/
public void setNetworkStatus(IGrid grid, int channelsInUse);
/**
* Determine which sides of the block can be connected too, only used when isWorldAccessable returns true, not used
* for {@link IPart} implementations.
*/
EnumSet<ForgeDirection> getConnectableSides();
/**
* @return the IGridHost for the node, this will be an IGridPart or a TileEntity generally speaking.
*/
IGridHost getMachine();
/**
* called when the grid for the node has changed, the general grid state should not be trusted at this point.
*/
void gridChanged();
/**
* Determines what item stack is used to render this node in the GUI.
*
* @return the render item stack to use to render this node, null is valid, and will not show this node.
*/
public ItemStack getMachineRepresentation();
}
@@ -0,0 +1,71 @@
package appeng.api.networking;
/**
*
* Allows you to create a network wise service, AE2 uses these for providing
* item, spatial, and tunnel services.
*
* Any Class that implements this, should have a public default constructor that
* takes a single argument of type IGrid.
*
*/
public interface IGridCache
{
/**
* Called each tick for the network, allows you to have active network wide
* behaviors.
*
*/
void onUpdateTick();
/**
* inform your cache, that a machine was removed from the grid.
*
* Important: Do not trust the grids state in this method, interact only
* with the node you are passed, if you need to manage other grid
* information, do it on the next updateTick.
*
* @param gridNode
* @param machine
*/
void removeNode(IGridNode gridNode, IGridHost machine);
/**
* informs you cache that a machine was added to the grid.
*
* Important: Do not trust the grids state in this method, interact only
* with the node you are passed, if you need to manage other grid
* information, do it on the next updateTick.
*
* @param gridNode
* @param machine
*/
void addNode(IGridNode gridNode, IGridHost machine);
/**
* Called when a grid splits into two grids, AE will call a split as it
* Iteratively processes changes. The destination should receive half, and
* the current cache should receive half.
*
* @param destinationStorage
*/
void onSplit(IGridStorage destinationStorage);
/**
* Called when two grids merge into one, AE will call a join as it
* Iteratively processes changes. Use this method to incorporate all the
* data from the source into your cache.
*
* @param sourceStorage
*/
void onJoin(IGridStorage sourceStorage);
/**
* Called when saving changes,
*
* @param destinationStorage
*/
void populateGridStorage(IGridStorage destinationStorage);
}
@@ -0,0 +1,28 @@
package appeng.api.networking;
import java.util.HashMap;
/**
* A registry of grid caches to extend grid functionality.
*/
public interface IGridCacheRegistry
{
/**
* Register a new grid cache for use during operation, must be called during the loading phase.
*
* @param cl
* @return cache id ( can be used later to ask the grid for you cache. )
*/
void registerGridCache(Class<? extends IGridCache> iface, Class<? extends IGridCache> implementation);
/**
* requests a new instance of a grid cache for use, used internally
*
* @param grid
*
* @return a new HashMap of IGridCaches from the registry, called from IGrid when constructing a new grid.
*/
HashMap<Class<? extends IGridCache>, IGridCache> createCacheInstance(IGrid grid);
}
Loaded 100 of 231 files, more files were not shown because too many files have changed in this diff. Show more