Basic reformat, hit once, hope never again
This commit is contained in:
parent
4ff1631f89
commit
d34c988c88
|
@ -51,17 +51,17 @@ public enum AEApi
|
|||
|
||||
HELD_API = (IAppEngApi) apiField.get( apiClass );
|
||||
}
|
||||
catch ( ClassNotFoundException e )
|
||||
catch( ClassNotFoundException e )
|
||||
{
|
||||
throw new CoreInaccessibleException( "AE2 API tried to access the " + CORE_API_FQN + " class, without it being declared." );
|
||||
throw new CoreInaccessibleException( "AE2 API tried to access the " + CORE_API_FQN + " class, without it being declared." );
|
||||
}
|
||||
catch ( NoSuchFieldException e )
|
||||
catch( NoSuchFieldException e )
|
||||
{
|
||||
throw new CoreInaccessibleException( "AE2 API tried to access the " + CORE_API_FIELD + " field in " + CORE_API_FQN + " without it being declared." );
|
||||
}
|
||||
catch ( IllegalAccessException e )
|
||||
catch( IllegalAccessException e )
|
||||
{
|
||||
throw new CoreInaccessibleException( "AE2 API tried to access the " + CORE_API_FIELD + " field in " + CORE_API_FQN + " without enough access permissions.");
|
||||
throw new CoreInaccessibleException( "AE2 API tried to access the " + CORE_API_FIELD + " field in " + CORE_API_FQN + " without enough access permissions." );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@ public enum AccessRestriction
|
|||
|
||||
private final int permissionBit;
|
||||
|
||||
AccessRestriction( int v ) {
|
||||
AccessRestriction( int v )
|
||||
{
|
||||
this.permissionBit = v;
|
||||
}
|
||||
|
||||
|
@ -44,19 +45,9 @@ public enum AccessRestriction
|
|||
return this.getPermByBit( this.permissionBit & ar.permissionBit );
|
||||
}
|
||||
|
||||
public AccessRestriction addPermissions( AccessRestriction ar )
|
||||
{
|
||||
return this.getPermByBit( this.permissionBit | ar.permissionBit );
|
||||
}
|
||||
|
||||
public AccessRestriction removePermissions( AccessRestriction ar )
|
||||
{
|
||||
return this.getPermByBit( this.permissionBit & ( ~ar.permissionBit ) );
|
||||
}
|
||||
|
||||
private AccessRestriction getPermByBit( int bit )
|
||||
{
|
||||
switch ( bit )
|
||||
switch( bit )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
|
@ -69,4 +60,14 @@ public enum AccessRestriction
|
|||
return READ_WRITE;
|
||||
}
|
||||
}
|
||||
|
||||
public AccessRestriction addPermissions( AccessRestriction ar )
|
||||
{
|
||||
return this.getPermByBit( this.permissionBit | ar.permissionBit );
|
||||
}
|
||||
|
||||
public AccessRestriction removePermissions( AccessRestriction ar )
|
||||
{
|
||||
return this.getPermByBit( this.permissionBit & ( ~ar.permissionBit ) );
|
||||
}
|
||||
}
|
|
@ -32,7 +32,8 @@ public enum FuzzyMode
|
|||
final public float breakPoint;
|
||||
final public float percentage;
|
||||
|
||||
FuzzyMode( float p ) {
|
||||
FuzzyMode( float p )
|
||||
{
|
||||
this.percentage = p;
|
||||
this.breakPoint = p / 100.0f;
|
||||
}
|
||||
|
|
|
@ -32,19 +32,19 @@ public enum PowerUnits
|
|||
RF( "gui.appliedenergistics2.units.thermalexpansion" ), // ThermalExpansion - Redstone Flux
|
||||
MK( "gui.appliedenergistics2.units.mekanism" ); // Mekanism - Joules
|
||||
|
||||
PowerUnits( String un ) {
|
||||
this.unlocalizedName = un;
|
||||
}
|
||||
|
||||
/**
|
||||
* unlocalized name for the power unit.
|
||||
*/
|
||||
final public String unlocalizedName;
|
||||
/**
|
||||
* 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;
|
||||
PowerUnits( String un )
|
||||
{
|
||||
this.unlocalizedName = un;
|
||||
}
|
||||
|
||||
/**
|
||||
* do power conversion using AE's conversion rates.
|
||||
|
|
|
@ -57,16 +57,16 @@ public enum Settings
|
|||
|
||||
private final EnumSet values;
|
||||
|
||||
Settings( EnumSet set )
|
||||
{
|
||||
if( set == null || set.isEmpty() )
|
||||
throw new RuntimeException( "Invalid configuration." );
|
||||
this.values = set;
|
||||
}
|
||||
|
||||
public EnumSet getPossibleValues()
|
||||
{
|
||||
return this.values;
|
||||
}
|
||||
|
||||
Settings( EnumSet set )
|
||||
{
|
||||
if ( set == null || set.isEmpty() )
|
||||
throw new RuntimeException( "Invalid configuration." );
|
||||
this.values = set;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -75,13 +75,13 @@ public enum Upgrades
|
|||
/**
|
||||
* Registers a specific amount of this upgrade into a specific machine
|
||||
*
|
||||
* @param item machine in which this upgrade can be installed
|
||||
* @param item machine in which this upgrade can be installed
|
||||
* @param maxSupported amount how many upgrades can be installed
|
||||
*/
|
||||
public void registerItem( IItemDefinition item, int maxSupported )
|
||||
{
|
||||
final Optional<ItemStack> maybeStack = item.maybeStack( 1 );
|
||||
for ( ItemStack stack : maybeStack.asSet() )
|
||||
for( ItemStack stack : maybeStack.asSet() )
|
||||
{
|
||||
this.registerItem( stack, maxSupported );
|
||||
}
|
||||
|
@ -90,7 +90,21 @@ public enum Upgrades
|
|||
/**
|
||||
* Registers a specific amount of this upgrade into a specific machine
|
||||
*
|
||||
* @param item machine in which this upgrade can be installed
|
||||
* @param stack machine in which this upgrade can be installed
|
||||
* @param maxSupported amount how many upgrades can be installed
|
||||
*/
|
||||
public void registerItem( ItemStack stack, int maxSupported )
|
||||
{
|
||||
if( stack != null )
|
||||
{
|
||||
this.supportedMax.put( stack, maxSupported );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a specific amount of this upgrade into a specific machine
|
||||
*
|
||||
* @param item machine in which this upgrade can be installed
|
||||
* @param maxSupported amount how many upgrades can be installed
|
||||
*
|
||||
* @deprecated use {@link Upgrades#registerItem(IItemDefinition, int)}
|
||||
|
@ -98,31 +112,17 @@ public enum Upgrades
|
|||
@Deprecated
|
||||
public void registerItem( AEItemDefinition item, int maxSupported )
|
||||
{
|
||||
if ( item != null )
|
||||
if( item != null )
|
||||
{
|
||||
final ItemStack stack = item.stack( 1 );
|
||||
|
||||
if ( stack != null )
|
||||
if( stack != null )
|
||||
{
|
||||
this.registerItem( stack, maxSupported );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a specific amount of this upgrade into a specific machine
|
||||
*
|
||||
* @param stack machine in which this upgrade can be installed
|
||||
* @param maxSupported amount how many upgrades can be installed
|
||||
*/
|
||||
public void registerItem( ItemStack stack, int maxSupported )
|
||||
{
|
||||
if ( stack != null )
|
||||
{
|
||||
this.supportedMax.put( stack, maxSupported );
|
||||
}
|
||||
}
|
||||
|
||||
public int getTier()
|
||||
{
|
||||
return this.tier;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* 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 appeng.api.definitions;
|
||||
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ public interface IComparableDefinition
|
|||
* Compare {@link ItemStack} with this
|
||||
*
|
||||
* @param comparableStack compared item
|
||||
*
|
||||
* @return true if the item stack is a matching item.
|
||||
*/
|
||||
boolean isSameAs( ItemStack comparableStack );
|
||||
|
@ -22,9 +23,9 @@ public interface IComparableDefinition
|
|||
* Compare Block with world.
|
||||
*
|
||||
* @param world world of block
|
||||
* @param x x pos of block
|
||||
* @param y y pos of block
|
||||
* @param z z pos of block
|
||||
* @param x x pos of block
|
||||
* @param y y pos of block
|
||||
* @param z z pos of block
|
||||
*
|
||||
* @return if the block is placed in the world at the specific location.
|
||||
*/
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* 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 appeng.api.definitions;
|
||||
|
||||
|
||||
|
|
|
@ -17,5 +17,5 @@ public interface IItemDefinition extends IComparableDefinition
|
|||
/**
|
||||
* @return an {@link ItemStack} with specified quantity of this item.
|
||||
*/
|
||||
Optional<ItemStack> maybeStack(int stackSize);
|
||||
Optional<ItemStack> maybeStack( int stackSize );
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* 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 appeng.api.definitions;
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* 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 appeng.api.definitions;
|
||||
|
||||
|
||||
|
|
|
@ -31,19 +31,12 @@ import appeng.api.features.ILocatable;
|
|||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
|
@ -52,4 +45,10 @@ public class LocatableEventAnnounce extends Event
|
|||
this.target = o;
|
||||
this.change = ev;
|
||||
}
|
||||
|
||||
public enum LocatableEvent
|
||||
{
|
||||
Register, // Adds the locatable to the registry
|
||||
Unregister // Removes the locatable from the registry
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,13 @@ public interface IGrinderEntry
|
|||
*/
|
||||
ItemStack getOutput();
|
||||
|
||||
/**
|
||||
* allows you to change the output.
|
||||
*
|
||||
* @param output output item
|
||||
*/
|
||||
void setOutput( ItemStack output );
|
||||
|
||||
/**
|
||||
* gets the current output
|
||||
*
|
||||
|
@ -68,13 +75,6 @@ public interface IGrinderEntry
|
|||
*/
|
||||
ItemStack getSecondOptionalOutput();
|
||||
|
||||
/**
|
||||
* allows you to change the output.
|
||||
*
|
||||
* @param output output item
|
||||
*/
|
||||
void setOutput( ItemStack output );
|
||||
|
||||
/**
|
||||
* stack, and 0.0-1.0 chance that it will be generated.
|
||||
*
|
||||
|
|
|
@ -45,8 +45,8 @@ public interface IGrinderRegistry
|
|||
/**
|
||||
* add a new recipe the easy way, in → out, how many turns., duplicates will not be added.
|
||||
*
|
||||
* @param in input
|
||||
* @param out output
|
||||
* @param in input
|
||||
* @param out output
|
||||
* @param turns amount of turns to turn the input into the output
|
||||
*/
|
||||
void addRecipe( ItemStack in, ItemStack out, int turns );
|
||||
|
@ -54,8 +54,8 @@ public interface IGrinderRegistry
|
|||
/**
|
||||
* add a new recipe with optional outputs, duplicates will not be added.
|
||||
*
|
||||
* @param in input
|
||||
* @param out output
|
||||
* @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
|
||||
|
@ -64,11 +64,11 @@ public interface IGrinderRegistry
|
|||
|
||||
/**
|
||||
* 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 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
|
||||
|
|
|
@ -32,8 +32,8 @@ 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 new ammo
|
||||
*
|
||||
* @param ammo new ammo
|
||||
* @param weight atomic weight
|
||||
*/
|
||||
void registerAmmo( ItemStack ammo, double weight );
|
||||
|
|
|
@ -41,13 +41,10 @@ public interface INetworkEncodable
|
|||
|
||||
/**
|
||||
* Encode the wireless frequency via the Controller.
|
||||
*
|
||||
* @param item
|
||||
* the wireless terminal.
|
||||
* @param encKey
|
||||
* the wireless encryption key.
|
||||
* @param name
|
||||
* null for now.
|
||||
*
|
||||
* @param item the wireless terminal.
|
||||
* @param encKey the wireless encryption key.
|
||||
* @param name null for now.
|
||||
*/
|
||||
void setEncryptionKey( ItemStack item, String encKey, String name );
|
||||
}
|
||||
|
|
|
@ -38,11 +38,9 @@ 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
|
||||
*
|
||||
* @param trigger - the item which triggers attunement
|
||||
* @param type - the type of tunnel
|
||||
*/
|
||||
void addNewAttunement( ItemStack trigger, TunnelType type );
|
||||
|
||||
|
|
|
@ -34,17 +34,17 @@ public interface IRecipeHandlerRegistry
|
|||
|
||||
/**
|
||||
* Add a new Recipe Handler to the parser.
|
||||
*
|
||||
*
|
||||
* MUST BE CALLED IN PRE-INIT
|
||||
*
|
||||
* @param name name of crafthandler
|
||||
*
|
||||
* @param name name of crafthandler
|
||||
* @param handler class of crafthandler
|
||||
*/
|
||||
void addNewCraftHandler( String name, Class<? extends ICraftHandler> handler );
|
||||
|
||||
/**
|
||||
* Add a new resolver to the parser.
|
||||
*
|
||||
*
|
||||
* MUST BE CALLED IN PRE-INIT
|
||||
*
|
||||
* @param sir sub item resolver
|
||||
|
|
|
@ -45,11 +45,11 @@ public interface IWirelessTermHandler extends INetworkEncodable
|
|||
|
||||
/**
|
||||
* 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 wireless terminal
|
||||
*
|
||||
* @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 wireless terminal
|
||||
*
|
||||
* @return true if wireless terminal uses power
|
||||
*/
|
||||
boolean usePower( EntityPlayer player, double amount, ItemStack is );
|
||||
|
|
|
@ -31,11 +31,6 @@ import net.minecraft.world.WorldProvider;
|
|||
public interface IWorldGen
|
||||
{
|
||||
|
||||
enum WorldGenType
|
||||
{
|
||||
CertusQuartz, ChargedCertusQuartz, Meteorites
|
||||
}
|
||||
|
||||
void disableWorldGenForProviderID( WorldGenType type, Class<? extends WorldProvider> provider );
|
||||
|
||||
void enableWorldGenForDimension( WorldGenType type, int dimID );
|
||||
|
@ -43,4 +38,9 @@ public interface IWorldGen
|
|||
void disableWorldGenForDimension( WorldGenType type, int dimID );
|
||||
|
||||
boolean isWorldGenEnabled( WorldGenType type, World w );
|
||||
|
||||
enum WorldGenType
|
||||
{
|
||||
CertusQuartz, ChargedCertusQuartz, Meteorites
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,16 +66,16 @@ public interface IBiometricCard
|
|||
|
||||
/**
|
||||
* remove a permission from the item stack.
|
||||
*
|
||||
* @param itemStack card
|
||||
*
|
||||
* @param itemStack card
|
||||
* @param permission to be removed permission
|
||||
*/
|
||||
void removePermission( ItemStack itemStack, SecurityPermissions permission );
|
||||
|
||||
/**
|
||||
* add a permission to the item stack.
|
||||
*
|
||||
* @param itemStack card
|
||||
*
|
||||
* @param itemStack card
|
||||
* @param permission to be added permission
|
||||
*/
|
||||
void addPermission( ItemStack itemStack, SecurityPermissions permission );
|
||||
|
|
|
@ -31,7 +31,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
|
||||
/**
|
||||
* Memory Card API
|
||||
*
|
||||
*
|
||||
* AE's Memory Card Item Class implements this interface.
|
||||
*/
|
||||
public interface IMemoryCard
|
||||
|
@ -40,14 +40,12 @@ public interface IMemoryCard
|
|||
/**
|
||||
* Configures the data stored on the memory card, the SettingsName, will be
|
||||
* localized when displayed.
|
||||
*
|
||||
* @param is item
|
||||
* @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.
|
||||
*
|
||||
* @param is item
|
||||
* @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 );
|
||||
|
||||
|
@ -72,11 +70,9 @@ public interface IMemoryCard
|
|||
|
||||
/**
|
||||
* notify the user of a outcome related to the memory card.
|
||||
*
|
||||
* @param player
|
||||
* that used the card.
|
||||
* @param msg
|
||||
* which message to send.
|
||||
*
|
||||
* @param player that used the card.
|
||||
* @param msg which message to send.
|
||||
*/
|
||||
void notifyUser( EntityPlayer player, MemoryCardMessages msg );
|
||||
}
|
||||
|
|
|
@ -88,11 +88,11 @@ public interface ISpatialStorageCell
|
|||
|
||||
/**
|
||||
* Perform a spatial swap with the contents of the cell, and the world.
|
||||
*
|
||||
* @param is spatial storage cell
|
||||
* @param w world of spatial
|
||||
* @param min min coord
|
||||
* @param max max coord
|
||||
*
|
||||
* @param is spatial storage cell
|
||||
* @param w world of spatial
|
||||
* @param min min coord
|
||||
* @param max max coord
|
||||
* @param doTransition transition
|
||||
*
|
||||
* @return result of transition
|
||||
|
|
|
@ -34,10 +34,10 @@ 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
|
||||
|
@ -76,8 +76,8 @@ public interface IStorageCell extends ICellWorkbenchItem
|
|||
* 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 item
|
||||
*
|
||||
* @param cellItem item
|
||||
* @param requestedAddition requested addition
|
||||
*
|
||||
* @return true to preventAdditionOfItem
|
||||
|
|
|
@ -70,7 +70,7 @@ public interface IPartCable extends IPart, IGridHost
|
|||
|
||||
/**
|
||||
* Change sides on the cables node.
|
||||
*
|
||||
*
|
||||
* Called by AE, do not invoke.
|
||||
*
|
||||
* @param sides sides of cable
|
||||
|
|
|
@ -23,10 +23,12 @@
|
|||
|
||||
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
|
||||
{
|
||||
|
||||
|
@ -45,9 +47,10 @@ public interface IChestOrDrive extends ICellContainer, IGridHost, IOrientable
|
|||
* 3 - red
|
||||
*
|
||||
* @param slot slot index
|
||||
*
|
||||
* @return status of the slot, one of the above indices.
|
||||
*/
|
||||
int getCellStatus(int slot);
|
||||
int getCellStatus( int slot );
|
||||
|
||||
/**
|
||||
* @return if the device is online you should check this before providing any other information.
|
||||
|
@ -56,8 +59,8 @@ public interface IChestOrDrive extends ICellContainer, IGridHost, IOrientable
|
|||
|
||||
/**
|
||||
* @param slot slot index
|
||||
*
|
||||
* @return is the cell currently blinking to show activity.
|
||||
*/
|
||||
boolean isCellBlinking(int slot);
|
||||
|
||||
boolean isCellBlinking( int slot );
|
||||
}
|
||||
|
|
|
@ -29,19 +29,20 @@ 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 details of pattern
|
||||
* @param table crafting table
|
||||
* @param patternDetails details of pattern
|
||||
* @param table crafting table
|
||||
* @param ejectionDirection ejection direction
|
||||
*
|
||||
* @return if it was accepted, all or nothing.
|
||||
*/
|
||||
boolean pushPattern(ICraftingPatternDetails patternDetails, InventoryCrafting table, ForgeDirection ejectionDirection);
|
||||
boolean pushPattern( ICraftingPatternDetails patternDetails, InventoryCrafting table, ForgeDirection ejectionDirection );
|
||||
|
||||
/**
|
||||
* check if the crafting machine is accepting pushes via pushPattern, if this is false, all calls to push will fail,
|
||||
|
@ -50,5 +51,4 @@ public interface ICraftingMachine
|
|||
* @return true, if pushPattern can complete, if its false push will always be false.
|
||||
*/
|
||||
boolean acceptsPlans();
|
||||
|
||||
}
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
|
||||
package appeng.api.implementations.tiles;
|
||||
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
|
||||
/**
|
||||
* Crank/Crankable API,
|
||||
*
|
||||
|
@ -53,6 +55,5 @@ public interface ICrankable
|
|||
/**
|
||||
* @return true if the crank can attach on the given side.
|
||||
*/
|
||||
boolean canCrankAttach(ForgeDirection directionToCrank);
|
||||
|
||||
boolean canCrankAttach( ForgeDirection directionToCrank );
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
package appeng.api.integration;
|
||||
|
||||
|
||||
/**
|
||||
* An interface to get access to the individual settings for AE's Internal Bee
|
||||
* Comparison handler.
|
||||
|
@ -39,5 +40,4 @@ public interface IBeeComparison
|
|||
* @return the Forestry IIndividual for this comparison object - cast this to a IIndividual if you want to use it.
|
||||
*/
|
||||
Object getIndividual();
|
||||
|
||||
}
|
|
@ -23,9 +23,11 @@
|
|||
|
||||
package appeng.api.movable;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public interface IMovableHandler
|
||||
{
|
||||
|
||||
|
@ -34,10 +36,11 @@ public interface IMovableHandler
|
|||
* that single entity, you cannot opt out of single entities.
|
||||
*
|
||||
* @param myClass tile entity class
|
||||
* @param tile tile entity
|
||||
* @param tile tile entity
|
||||
*
|
||||
* @return true if it can handle moving
|
||||
*/
|
||||
boolean canHandle(Class<? extends TileEntity> myClass, TileEntity tile);
|
||||
boolean canHandle( Class<? extends TileEntity> myClass, TileEntity tile );
|
||||
|
||||
/**
|
||||
* request that the handler move the the tile from its current location to
|
||||
|
@ -56,12 +59,11 @@ public interface IMovableHandler
|
|||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @param tile to be moved tile
|
||||
* @param tile to be moved tile
|
||||
* @param world world of tile
|
||||
* @param x x coord of tile
|
||||
* @param y y coord of tile
|
||||
* @param z z coord of tile
|
||||
* @param x x coord of tile
|
||||
* @param y y coord of tile
|
||||
* @param z z coord of tile
|
||||
*/
|
||||
void moveTile(TileEntity tile, World world, int x, int y, int z);
|
||||
|
||||
void moveTile( TileEntity tile, World world, int x, int y, int z );
|
||||
}
|
|
@ -23,9 +23,11 @@
|
|||
|
||||
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...
|
||||
*
|
||||
|
@ -64,7 +66,7 @@ public interface IMovableRegistry
|
|||
*
|
||||
* @param blk block
|
||||
*/
|
||||
void blacklistBlock(Block blk);
|
||||
void blacklistBlock( Block blk );
|
||||
|
||||
/**
|
||||
* White list your tile entity with the registry.
|
||||
|
@ -74,27 +76,28 @@ public interface IMovableRegistry
|
|||
*
|
||||
* If you tile is handled with IMovableHandler or IMovableTile you do not need to white list it.
|
||||
*/
|
||||
void whiteListTileEntity(Class<? extends TileEntity> c);
|
||||
void whiteListTileEntity( Class<? extends TileEntity> c );
|
||||
|
||||
/**
|
||||
* @param te to be moved tile entity
|
||||
*
|
||||
* @return true if the tile has accepted your request to move it
|
||||
*/
|
||||
boolean askToMove(TileEntity te);
|
||||
boolean askToMove( TileEntity te );
|
||||
|
||||
/**
|
||||
* tells the tile you are done moving it.
|
||||
*
|
||||
* @param te moved tile entity
|
||||
*/
|
||||
void doneMoving(TileEntity te);
|
||||
void doneMoving( TileEntity te );
|
||||
|
||||
/**
|
||||
* add a new handler movable handler.
|
||||
*
|
||||
* @param handler moving handler
|
||||
*/
|
||||
void addHandler(IMovableHandler handler);
|
||||
void addHandler( IMovableHandler handler );
|
||||
|
||||
/**
|
||||
* handlers are used to perform movement, this allows you to override AE's internal version.
|
||||
|
@ -102,9 +105,10 @@ public interface IMovableRegistry
|
|||
* only valid after askToMove(...) = true
|
||||
*
|
||||
* @param te tile entity
|
||||
*
|
||||
* @return moving handler of tile entity
|
||||
*/
|
||||
IMovableHandler getHandler(TileEntity te);
|
||||
IMovableHandler getHandler( TileEntity te );
|
||||
|
||||
/**
|
||||
* @return a copy of the default handler
|
||||
|
@ -113,8 +117,8 @@ public interface IMovableRegistry
|
|||
|
||||
/**
|
||||
* @param blk block
|
||||
*
|
||||
* @return true if this block is blacklisted
|
||||
*/
|
||||
boolean isBlacklisted(Block blk);
|
||||
|
||||
boolean isBlacklisted( Block blk );
|
||||
}
|
|
@ -23,9 +23,11 @@
|
|||
|
||||
package appeng.api.networking;
|
||||
|
||||
|
||||
import appeng.api.networking.events.MENetworkEvent;
|
||||
import appeng.api.util.IReadOnlyCollection;
|
||||
|
||||
|
||||
/**
|
||||
* Gives you access to Grid based information.
|
||||
*
|
||||
|
@ -38,6 +40,7 @@ public interface IGrid
|
|||
* Get Access to various grid modules
|
||||
*
|
||||
* @param iface face
|
||||
*
|
||||
* @return the IGridCache you requested.
|
||||
*/
|
||||
<C extends IGridCache> C getCache( Class<? extends IGridCache> iface );
|
||||
|
@ -45,8 +48,8 @@ public interface IGrid
|
|||
/**
|
||||
* Post an event into the network event bus.
|
||||
*
|
||||
* @param ev
|
||||
* - event to post
|
||||
* @param ev - event to post
|
||||
*
|
||||
* @return returns ev back to original poster
|
||||
*/
|
||||
MENetworkEvent postEvent( MENetworkEvent ev );
|
||||
|
@ -54,8 +57,8 @@ public interface IGrid
|
|||
/**
|
||||
* Post an event into the network event bus, but direct it at a single node.
|
||||
*
|
||||
* @param ev
|
||||
* event to post
|
||||
* @param ev event to post
|
||||
*
|
||||
* @return returns ev back to original poster
|
||||
*/
|
||||
MENetworkEvent postEventTo( IGridNode node, MENetworkEvent ev );
|
||||
|
@ -72,6 +75,7 @@ public interface IGrid
|
|||
* Get machines on the network.
|
||||
*
|
||||
* @param gridHostClass class of the grid host
|
||||
*
|
||||
* @return IMachineSet of all nodes belonging to hosts of specified class.
|
||||
*/
|
||||
IMachineSet getMachines( Class<? extends IGridHost> gridHostClass );
|
||||
|
@ -90,5 +94,4 @@ public interface IGrid
|
|||
* @return the node considered the pivot point of the grid.
|
||||
*/
|
||||
IGridNode getPivot();
|
||||
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ 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
|
||||
*
|
||||
|
@ -79,12 +80,12 @@ public interface IGridBlock
|
|||
/**
|
||||
* Notifies your IGridBlock that changes were made to your connections
|
||||
*/
|
||||
void onGridNotification(GridNotification notification);
|
||||
void onGridNotification( GridNotification notification );
|
||||
|
||||
/**
|
||||
* Update Blocks network/connection/booting status. grid,
|
||||
*
|
||||
* @param grid grid
|
||||
* @param grid grid
|
||||
* @param channelsInUse used channels
|
||||
*/
|
||||
void setNetworkStatus( IGrid grid, int channelsInUse );
|
||||
|
|
|
@ -23,14 +23,13 @@
|
|||
|
||||
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
|
||||
{
|
||||
|
@ -38,7 +37,6 @@ public interface IGridCache
|
|||
/**
|
||||
* Called each tick for the network, allows you to have active network wide
|
||||
* behaviors.
|
||||
*
|
||||
*/
|
||||
void onUpdateTick();
|
||||
|
||||
|
@ -50,9 +48,9 @@ public interface IGridCache
|
|||
* information, do it on the next updateTick.
|
||||
*
|
||||
* @param gridNode removed from that grid
|
||||
* @param machine to be removed machine
|
||||
* @param machine to be removed machine
|
||||
*/
|
||||
void removeNode(IGridNode gridNode, IGridHost machine);
|
||||
void removeNode( IGridNode gridNode, IGridHost machine );
|
||||
|
||||
/**
|
||||
* informs you cache that a machine was added to the grid.
|
||||
|
@ -62,9 +60,9 @@ public interface IGridCache
|
|||
* information, do it on the next updateTick.
|
||||
*
|
||||
* @param gridNode added to grid node
|
||||
* @param machine to be added machine
|
||||
* @param machine to be added machine
|
||||
*/
|
||||
void addNode(IGridNode gridNode, IGridHost machine);
|
||||
void addNode( IGridNode gridNode, IGridHost machine );
|
||||
|
||||
/**
|
||||
* Called when a grid splits into two grids, AE will call a split as it
|
||||
|
@ -73,7 +71,7 @@ public interface IGridCache
|
|||
*
|
||||
* @param destinationStorage storage which receives half of old grid
|
||||
*/
|
||||
void onSplit(IGridStorage destinationStorage);
|
||||
void onSplit( IGridStorage destinationStorage );
|
||||
|
||||
/**
|
||||
* Called when two grids merge into one, AE will call a join as it
|
||||
|
@ -82,13 +80,12 @@ public interface IGridCache
|
|||
*
|
||||
* @param sourceStorage old storage
|
||||
*/
|
||||
void onJoin(IGridStorage sourceStorage);
|
||||
void onJoin( IGridStorage sourceStorage );
|
||||
|
||||
/**
|
||||
* Called when saving changes,
|
||||
*
|
||||
* @param destinationStorage storage
|
||||
*/
|
||||
void populateGridStorage(IGridStorage destinationStorage);
|
||||
|
||||
void populateGridStorage( IGridStorage destinationStorage );
|
||||
}
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
|
||||
package appeng.api.networking;
|
||||
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
|
||||
/**
|
||||
* Access to AE's internal grid connections.
|
||||
*
|
||||
|
@ -40,17 +42,19 @@ public interface IGridConnection
|
|||
* lets you get the opposing node of the connection by passing your own node.
|
||||
*
|
||||
* @param gridNode current grid node
|
||||
*
|
||||
* @return the IGridNode which represents the opposite side of the connection.
|
||||
*/
|
||||
IGridNode getOtherSide(IGridNode gridNode);
|
||||
IGridNode getOtherSide( IGridNode gridNode );
|
||||
|
||||
/**
|
||||
* determine the direction of the connection based on your node.
|
||||
*
|
||||
* @param gridNode current grid node
|
||||
*
|
||||
* @return the direction of the connection, only valid for in world connections.
|
||||
*/
|
||||
ForgeDirection getDirection(IGridNode gridNode);
|
||||
ForgeDirection getDirection( IGridNode gridNode );
|
||||
|
||||
/**
|
||||
* by destroying a connection you may create new grids, and trigger un-expected behavior, you should only destroy
|
||||
|
@ -77,5 +81,4 @@ public interface IGridConnection
|
|||
* @return how many channels pass over this connections.
|
||||
*/
|
||||
int getUsedChannels();
|
||||
|
||||
}
|
|
@ -23,15 +23,14 @@
|
|||
|
||||
package appeng.api.networking;
|
||||
|
||||
|
||||
public interface IGridConnectionVisitor extends IGridVisitor
|
||||
{
|
||||
|
||||
/**
|
||||
* Called for each connection on the network.
|
||||
*
|
||||
* @param n
|
||||
* the connection.
|
||||
* @param n the connection.
|
||||
*/
|
||||
void visitConnection( IGridConnection n );
|
||||
|
||||
}
|
||||
|
|
|
@ -30,11 +30,10 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import appeng.api.parts.IPart;
|
||||
import appeng.api.util.AECableType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Implement to create a networked {@link TileEntity} or {@link IPart} must
|
||||
* be implemented for a part, or tile entity to become part of a grid.
|
||||
*
|
||||
*/
|
||||
public interface IGridHost
|
||||
{
|
||||
|
@ -44,11 +43,11 @@ public interface IGridHost
|
|||
* by returning a valid node later and calling updateState, you can join the
|
||||
* Grid when your block is ready.
|
||||
*
|
||||
* @param dir
|
||||
* feel free to ignore this, most blocks will use the same node
|
||||
* @param dir feel free to ignore this, most blocks will use the same node
|
||||
* for every side.
|
||||
*
|
||||
* @return a new IGridNode, create these with
|
||||
* AEApi.INSTANCE().createGridNode( MyIGridBlock )
|
||||
* AEApi.INSTANCE().createGridNode( MyIGridBlock )
|
||||
*/
|
||||
IGridNode getGridNode( ForgeDirection dir );
|
||||
|
||||
|
@ -64,5 +63,4 @@ public interface IGridHost
|
|||
* break this host, its violating security rules, just break your block, or part.
|
||||
*/
|
||||
void securityBreak();
|
||||
|
||||
}
|
||||
|
|
|
@ -33,14 +33,13 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.util.IReadOnlyCollection;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Gives you a view into your Nodes connections and information.
|
||||
*
|
||||
* updateState, getGrid, destroy are required to implement a proper IGridHost.
|
||||
*
|
||||
* Don't Implement; Acquire from {@link IAppEngApi}.createGridNode
|
||||
*
|
||||
*/
|
||||
public interface IGridNode
|
||||
{
|
||||
|
@ -51,7 +50,7 @@ public interface IGridNode
|
|||
*
|
||||
* @param visitor visitor
|
||||
*/
|
||||
void beginVisit(IGridVisitor visitor);
|
||||
void beginVisit( IGridVisitor visitor );
|
||||
|
||||
/**
|
||||
* inform the node that your IGridBlock has changed its internal state, and force the node to update.
|
||||
|
@ -61,7 +60,6 @@ public interface IGridNode
|
|||
*
|
||||
* If your entity is not in the world, or if you IGridHost returns a different node for the same side you will
|
||||
* likely crash the game.
|
||||
*
|
||||
*/
|
||||
void updateState();
|
||||
|
||||
|
@ -91,7 +89,6 @@ public interface IGridNode
|
|||
World getWorld();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return a set of the connected sides, UNKNOWN represents an invisible connection
|
||||
*/
|
||||
EnumSet<ForgeDirection> getConnectedSides();
|
||||
|
@ -122,23 +119,23 @@ public interface IGridNode
|
|||
*
|
||||
* Important: You must call this before updateState.
|
||||
*
|
||||
* @param name nbt name
|
||||
* @param name nbt name
|
||||
* @param nodeData to be loaded data
|
||||
*/
|
||||
void loadFromNBT(String name, NBTTagCompound nodeData);
|
||||
void loadFromNBT( String name, NBTTagCompound nodeData );
|
||||
|
||||
/**
|
||||
* this should be called for each node you maintain, you can save all your nodes to the same tag with different
|
||||
* names, if you fail to complete the load / save procedure, network state may be lost between game load/saves.
|
||||
*
|
||||
* @param name nbt name
|
||||
* @param name nbt name
|
||||
* @param nodeData to be saved data
|
||||
*/
|
||||
void saveToNBT(String name, NBTTagCompound nodeData);
|
||||
void saveToNBT( String name, NBTTagCompound nodeData );
|
||||
|
||||
/**
|
||||
* @return if the node's channel requirements are currently met, use this for display purposes, use isActive for
|
||||
* status.
|
||||
* status.
|
||||
*/
|
||||
boolean meetsChannelRequirements();
|
||||
|
||||
|
@ -146,9 +143,15 @@ public interface IGridNode
|
|||
* see if this node has a certain flag
|
||||
*
|
||||
* @param flag flags
|
||||
*
|
||||
* @return true if has flag
|
||||
*/
|
||||
boolean hasFlag(GridFlags flag);
|
||||
boolean hasFlag( GridFlags flag );
|
||||
|
||||
/**
|
||||
* @return the ownerID this represents the person who placed the node.
|
||||
*/
|
||||
int getPlayerID();
|
||||
|
||||
/**
|
||||
* tell the node who was responsible for placing it, failure to do this may result in in-compatibility with the
|
||||
|
@ -156,11 +159,5 @@ public interface IGridNode
|
|||
*
|
||||
* @param playerID new player id
|
||||
*/
|
||||
void setPlayerID(int playerID);
|
||||
|
||||
/**
|
||||
* @return the ownerID this represents the person who placed the node.
|
||||
*/
|
||||
int getPlayerID();
|
||||
|
||||
void setPlayerID( int playerID );
|
||||
}
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
package appeng.api.networking;
|
||||
|
||||
|
||||
/**
|
||||
* Simple Visitor pattern access to network nodes.
|
||||
*/
|
||||
|
@ -34,11 +35,9 @@ public interface IGridVisitor
|
|||
*
|
||||
* By returning false your informing the host to stop visiting nodes beyond the current node.
|
||||
*
|
||||
* @param n
|
||||
* the current node.
|
||||
* @param n the current node.
|
||||
*
|
||||
* @return true to continue visiting nodes beyond this node.
|
||||
*/
|
||||
boolean visitNode( IGridNode n );
|
||||
|
||||
}
|
||||
|
|
|
@ -23,15 +23,14 @@
|
|||
|
||||
package appeng.api.networking.crafting;
|
||||
|
||||
|
||||
public interface ICraftingCallback
|
||||
{
|
||||
|
||||
/**
|
||||
* this call back is synchronized with the world you passed.
|
||||
*
|
||||
* @param job
|
||||
* - final job
|
||||
* @param job - final job
|
||||
*/
|
||||
void calculationComplete( ICraftingJob job );
|
||||
|
||||
}
|
||||
|
|
|
@ -36,57 +36,52 @@ import appeng.api.networking.IGridCache;
|
|||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
||||
|
||||
public interface ICraftingGrid extends IGridCache
|
||||
{
|
||||
|
||||
/**
|
||||
* @param whatToCraft requested craft
|
||||
* @param world crafting world
|
||||
* @param slot slot index
|
||||
* @param details pattern details
|
||||
* @param world crafting world
|
||||
* @param slot slot index
|
||||
* @param details pattern details
|
||||
*
|
||||
* @return a collection of crafting patterns for the item in question.
|
||||
*/
|
||||
ImmutableCollection<ICraftingPatternDetails> getCraftingFor(IAEItemStack whatToCraft, ICraftingPatternDetails details, int slot, World world);
|
||||
ImmutableCollection<ICraftingPatternDetails> getCraftingFor( IAEItemStack whatToCraft, ICraftingPatternDetails details, int slot, World world );
|
||||
|
||||
/**
|
||||
* Begin calculating a crafting job.
|
||||
*
|
||||
* @param world crafting world
|
||||
* @param grid network
|
||||
* @param world crafting world
|
||||
* @param grid network
|
||||
* @param actionSrc source
|
||||
* @param craftWhat result
|
||||
* @param callback callback
|
||||
* -- optional
|
||||
* @param callback callback
|
||||
* -- optional
|
||||
*
|
||||
* @return a future which will at an undetermined point in the future get you the {@link ICraftingJob} do not wait
|
||||
* on this, your be waiting forever.
|
||||
* on this, your be waiting forever.
|
||||
*/
|
||||
Future<ICraftingJob> beginCraftingJob(World world, IGrid grid, BaseActionSource actionSrc, IAEItemStack craftWhat, ICraftingCallback callback);
|
||||
Future<ICraftingJob> beginCraftingJob( World world, IGrid grid, BaseActionSource actionSrc, IAEItemStack craftWhat, ICraftingCallback callback );
|
||||
|
||||
/**
|
||||
* Submit the job to the Crafting system for processing.
|
||||
*
|
||||
* @param job
|
||||
* - the crafting job from beginCraftingJob
|
||||
* @param requestingMachine
|
||||
* - a machine if its being requested via automation, may be null.
|
||||
* @param target
|
||||
* - can be null
|
||||
*
|
||||
* @param prioritizePower
|
||||
* - if cpu is null, this determine if the system should prioritize power, or if it should find the lower
|
||||
* end cpus, automatic processes generally should pick lower end cpus.
|
||||
*
|
||||
* @param src
|
||||
* - the action source to use when starting the job, this will be used for extracting items, should
|
||||
* usually be the same as the one provided to beginCraftingJob.
|
||||
* @param job - the crafting job from beginCraftingJob
|
||||
* @param requestingMachine - a machine if its being requested via automation, may be null.
|
||||
* @param target - can be null
|
||||
* @param prioritizePower - if cpu is null, this determine if the system should prioritize power, or if it should find the lower
|
||||
* end cpus, automatic processes generally should pick lower end cpus.
|
||||
* @param src - the action source to use when starting the job, this will be used for extracting items, should
|
||||
* usually be the same as the one provided to beginCraftingJob.
|
||||
*
|
||||
* @return null ( if failed ) or an {@link ICraftingLink} other wise, if you send requestingMachine you need to
|
||||
* properly keep track of this and handle the nbt saving and loading of the object as well as the
|
||||
* {@link ICraftingRequester} methods. if you send null, this object should be discarded after verifying the
|
||||
* return state.
|
||||
* properly keep track of this and handle the nbt saving and loading of the object as well as the
|
||||
* {@link ICraftingRequester} methods. if you send null, this object should be discarded after verifying the
|
||||
* return state.
|
||||
*/
|
||||
ICraftingLink submitJob(ICraftingJob job, ICraftingRequester requestingMachine, ICraftingCPU target, boolean prioritizePower, BaseActionSource src);
|
||||
ICraftingLink submitJob( ICraftingJob job, ICraftingRequester requestingMachine, ICraftingCPU target, boolean prioritizePower, BaseActionSource src );
|
||||
|
||||
/**
|
||||
* @return list of all the crafting cpus on the grid
|
||||
|
@ -95,16 +90,17 @@ public interface ICraftingGrid extends IGridCache
|
|||
|
||||
/**
|
||||
* @param what to be requested item
|
||||
*
|
||||
* @return true if the item can be requested via a crafting emitter.
|
||||
*/
|
||||
boolean canEmitFor(IAEItemStack what);
|
||||
boolean canEmitFor( IAEItemStack what );
|
||||
|
||||
/**
|
||||
* is this item being crafted?
|
||||
*
|
||||
* @param aeStackInSlot item being crafted
|
||||
*
|
||||
* @return true if it is being crafting
|
||||
*/
|
||||
boolean isRequesting(IAEItemStack aeStackInSlot);
|
||||
|
||||
boolean isRequesting( IAEItemStack aeStackInSlot );
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraft.world.World;
|
|||
import appeng.api.implementations.ICraftingPatternItem;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
||||
|
||||
/**
|
||||
* do not implement provided by {@link ICraftingPatternItem}
|
||||
*
|
||||
|
@ -47,11 +48,11 @@ public interface ICraftingPatternDetails
|
|||
/**
|
||||
* @param slotIndex specific slot index
|
||||
* @param itemStack item in slot
|
||||
* @param world crafting world
|
||||
* @param world crafting world
|
||||
*
|
||||
* @return if an item can be used in the specific slot for this pattern.
|
||||
*/
|
||||
boolean isValidItemForSlot(int slotIndex, ItemStack itemStack, World world);
|
||||
boolean isValidItemForSlot( int slotIndex, ItemStack itemStack, World world );
|
||||
|
||||
/**
|
||||
* @return if this pattern is a crafting pattern ( work bench )
|
||||
|
@ -87,17 +88,11 @@ public interface ICraftingPatternDetails
|
|||
* Allow using this INSTANCE of the pattern details to preform the crafting action with performance enhancements.
|
||||
*
|
||||
* @param craftingInv inventory
|
||||
* @param world crafting world
|
||||
* @param world crafting world
|
||||
*
|
||||
* @return the crafted ( work bench ) item.
|
||||
*/
|
||||
ItemStack getOutput(InventoryCrafting craftingInv, World world);
|
||||
|
||||
/**
|
||||
* Set the priority the of this pattern.
|
||||
*
|
||||
* @param priority priority of pattern
|
||||
*/
|
||||
void setPriority(int priority);
|
||||
ItemStack getOutput( InventoryCrafting craftingInv, World world );
|
||||
|
||||
/**
|
||||
* Get the priority of this pattern
|
||||
|
@ -105,4 +100,11 @@ public interface ICraftingPatternDetails
|
|||
* @return the priority of this pattern
|
||||
*/
|
||||
int getPriority();
|
||||
|
||||
/**
|
||||
* Set the priority the of this pattern.
|
||||
*
|
||||
* @param priority priority of pattern
|
||||
*/
|
||||
void setPriority( int priority );
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import appeng.api.config.Actionable;
|
|||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
||||
|
||||
public interface ICraftingRequester extends IActionHost
|
||||
{
|
||||
|
||||
|
@ -46,16 +47,16 @@ public interface ICraftingRequester extends IActionHost
|
|||
* be returned.
|
||||
*
|
||||
* @param items item
|
||||
* @param mode action mode
|
||||
* @param mode action mode
|
||||
*
|
||||
* @return unwanted item
|
||||
*/
|
||||
IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, Actionable mode);
|
||||
IAEItemStack injectCraftedItems( ICraftingLink link, IAEItemStack items, Actionable mode );
|
||||
|
||||
/**
|
||||
* called when the job changes from in progress, to either complete, or canceled.
|
||||
*
|
||||
* after this call the crafting link is "dead" and should be discarded.
|
||||
*/
|
||||
void jobStateChange(ICraftingLink link);
|
||||
|
||||
void jobStateChange( ICraftingLink link );
|
||||
}
|
||||
|
|
|
@ -23,9 +23,11 @@
|
|||
|
||||
package appeng.api.networking.energy;
|
||||
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
|
||||
|
||||
/**
|
||||
* Used to access information about AE's various power accepting blocks for monitoring purposes.
|
||||
*/
|
||||
|
@ -35,7 +37,7 @@ public interface IAEPowerStorage extends IEnergySource
|
|||
/**
|
||||
* Inject amt, power into the device, it will store what it can, and return the amount unable to be stored.
|
||||
*
|
||||
* @param amt to be injected amount
|
||||
* @param amt to be injected amount
|
||||
* @param mode action mode
|
||||
*
|
||||
* @return amount of power which was unable to be stored
|
||||
|
@ -66,5 +68,4 @@ public interface IAEPowerStorage extends IEnergySource
|
|||
* @return access restriction what the network can do
|
||||
*/
|
||||
AccessRestriction getPowerFlow();
|
||||
|
||||
}
|
|
@ -23,10 +23,12 @@
|
|||
|
||||
package appeng.api.networking.energy;
|
||||
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.IGridCache;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
|
||||
|
||||
/**
|
||||
* AE's Power system.
|
||||
*/
|
||||
|
@ -40,7 +42,7 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
|
|||
|
||||
/**
|
||||
* @return the average power drain over the past 10 ticks, includes idle usage during this time, and all use of
|
||||
* extractPower.
|
||||
* extractPower.
|
||||
*/
|
||||
double getAvgPowerUsage();
|
||||
|
||||
|
@ -72,10 +74,9 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
|
|||
* Another important note, is that if a network that had overflow is deleted, its power is gone, this is one of the
|
||||
* reasons why keeping overflow to a minimum is important.
|
||||
*
|
||||
* @param amt
|
||||
* power to inject into the network
|
||||
* @param mode
|
||||
* should the action be simulated or performed?
|
||||
* @param amt power to inject into the network
|
||||
* @param mode should the action be simulated or performed?
|
||||
*
|
||||
* @return the amount of power that the network has OVER the limit.
|
||||
*/
|
||||
double injectPower( double amt, Actionable mode );
|
||||
|
@ -101,5 +102,4 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
|
|||
* @return Amount of power required to charge the grid, in AE.
|
||||
*/
|
||||
double getEnergyDemand( double maxRequired );
|
||||
|
||||
}
|
||||
|
|
|
@ -23,19 +23,21 @@
|
|||
|
||||
package appeng.api.networking.energy;
|
||||
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
|
||||
|
||||
public interface IEnergySource
|
||||
{
|
||||
|
||||
/**
|
||||
* Extract power from the network.
|
||||
*
|
||||
* @param amt extracted power
|
||||
* @param amt extracted power
|
||||
* @param mode should the action be simulated or performed?
|
||||
*
|
||||
* @return returns extracted power.
|
||||
*/
|
||||
double extractAEPower( double amt, Actionable mode, PowerMultiplier usePowerMultiplier );
|
||||
|
||||
}
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
|
||||
package appeng.api.networking.events;
|
||||
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
|
||||
|
||||
/**
|
||||
* Posted by the network when the booting status of the network goes up
|
||||
* or down, the change is reflected via {@link IGridNode}.isActive()
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
package appeng.api.networking.events;
|
||||
|
||||
|
||||
/**
|
||||
* Posted by storage devices to inform AE to refresh its storage structure.
|
||||
*
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
|
||||
package appeng.api.networking.events;
|
||||
|
||||
|
||||
import appeng.api.networking.IGridHost;
|
||||
|
||||
|
||||
/**
|
||||
* Posted to the {@link IGridHost} when the channels on the node connections are altered.
|
||||
*
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
|
||||
package appeng.api.networking.events;
|
||||
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
|
||||
|
||||
/**
|
||||
* Part of AE's Event Bus.
|
||||
*
|
||||
|
@ -69,7 +71,7 @@ public class MENetworkEvent
|
|||
*
|
||||
* @param v current number of visitors
|
||||
*/
|
||||
public void setVisitedObjects(int v)
|
||||
public void setVisitedObjects( int v )
|
||||
{
|
||||
this.visited = v;
|
||||
}
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
|
||||
package appeng.api.networking.events;
|
||||
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
|
||||
|
||||
/**
|
||||
* Implementers of a IGridBlock must post this event when your getIdlePowerUsage
|
||||
* starts returning a new value, if you do not post this event the network will
|
||||
|
@ -37,8 +39,8 @@ public class MENetworkPowerIdleChange extends MENetworkEvent
|
|||
|
||||
public final IGridNode node;
|
||||
|
||||
public MENetworkPowerIdleChange(IGridNode nodeThatChanged) {
|
||||
public MENetworkPowerIdleChange( IGridNode nodeThatChanged )
|
||||
{
|
||||
this.node = nodeThatChanged;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,9 +23,11 @@
|
|||
|
||||
package appeng.api.networking.events;
|
||||
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
|
||||
|
||||
/**
|
||||
* Posted by the network when the power status of the network goes up or down,
|
||||
* the change is reflected via the {@link IEnergyGrid}.isNetworkPowered() or via
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
|
||||
package appeng.api.networking.events;
|
||||
|
||||
|
||||
import appeng.api.networking.energy.IAEPowerStorage;
|
||||
|
||||
|
||||
/**
|
||||
* informs the network, that a {@link IAEPowerStorage} block that had either run,
|
||||
* out of power, or was full, is no longer in that state.
|
||||
|
@ -37,6 +39,15 @@ import appeng.api.networking.energy.IAEPowerStorage;
|
|||
public class MENetworkPowerStorage extends MENetworkEvent
|
||||
{
|
||||
|
||||
public final IAEPowerStorage storage;
|
||||
public final PowerEventType type;
|
||||
|
||||
public MENetworkPowerStorage( IAEPowerStorage t, PowerEventType y )
|
||||
{
|
||||
this.storage = t;
|
||||
this.type = y;
|
||||
}
|
||||
|
||||
public enum PowerEventType
|
||||
{
|
||||
/**
|
||||
|
@ -49,13 +60,4 @@ public class MENetworkPowerStorage extends MENetworkEvent
|
|||
*/
|
||||
PROVIDE_POWER
|
||||
}
|
||||
|
||||
public final IAEPowerStorage storage;
|
||||
public final PowerEventType type;
|
||||
|
||||
public MENetworkPowerStorage(IAEPowerStorage t, PowerEventType y) {
|
||||
this.storage = t;
|
||||
this.type = y;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* 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 appeng.api.networking.events;
|
||||
|
||||
|
||||
|
|
|
@ -23,9 +23,11 @@
|
|||
|
||||
package appeng.api.networking.events;
|
||||
|
||||
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
|
||||
|
||||
/**
|
||||
* posted by the network when the networks Storage Changes, you can use the currentItems list to check levels, and
|
||||
* update status.
|
||||
|
@ -40,9 +42,9 @@ public class MENetworkStorageEvent extends MENetworkEvent
|
|||
public final IMEMonitor monitor;
|
||||
public final StorageChannel channel;
|
||||
|
||||
public MENetworkStorageEvent(IMEMonitor o, StorageChannel chan) {
|
||||
public MENetworkStorageEvent( IMEMonitor o, StorageChannel chan )
|
||||
{
|
||||
this.monitor = o;
|
||||
this.channel = chan;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGridCache;
|
||||
|
||||
|
||||
public interface ISecurityGrid extends IGridCache
|
||||
{
|
||||
|
||||
|
@ -41,25 +42,24 @@ public interface ISecurityGrid extends IGridCache
|
|||
* Check if a player has permissions.
|
||||
*
|
||||
* @param player to be checked player
|
||||
* @param perm checked permissions
|
||||
* @param perm checked permissions
|
||||
*
|
||||
* @return true if the player has permissions.
|
||||
*/
|
||||
boolean hasPermission(EntityPlayer player, SecurityPermissions perm);
|
||||
boolean hasPermission( EntityPlayer player, SecurityPermissions perm );
|
||||
|
||||
/**
|
||||
* Check if a player has permissions.
|
||||
*
|
||||
* @param playerID id of player
|
||||
* @param perm checked permissions
|
||||
* @param perm checked permissions
|
||||
*
|
||||
* @return true if the player has permissions.
|
||||
*/
|
||||
boolean hasPermission(int playerID, SecurityPermissions perm);
|
||||
boolean hasPermission( int playerID, SecurityPermissions perm );
|
||||
|
||||
/**
|
||||
* @return PlayerID of the admin, or owner, this is the person who placed the security block.
|
||||
*/
|
||||
int getOwner();
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.EnumSet;
|
|||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
|
||||
|
||||
/**
|
||||
* Used by vanilla Security Terminal to post biometric data into the security cache.
|
||||
*/
|
||||
|
@ -37,9 +38,8 @@ public interface ISecurityRegistry
|
|||
/**
|
||||
* Submit Permissions into the register.
|
||||
*
|
||||
* @param PlayerID player id
|
||||
* @param PlayerID player id
|
||||
* @param permissions permissions of player
|
||||
*/
|
||||
void addPlayer(int PlayerID, EnumSet<SecurityPermissions> permissions);
|
||||
|
||||
void addPlayer( int PlayerID, EnumSet<SecurityPermissions> permissions );
|
||||
}
|
||||
|
|
|
@ -29,14 +29,14 @@ public class MachineSource extends BaseActionSource
|
|||
|
||||
public final IActionHost via;
|
||||
|
||||
public MachineSource( IActionHost v )
|
||||
{
|
||||
this.via = v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMachine()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public MachineSource( IActionHost v )
|
||||
{
|
||||
this.via = v;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,15 +33,15 @@ public class PlayerSource extends BaseActionSource
|
|||
public final EntityPlayer player;
|
||||
public final IActionHost via;
|
||||
|
||||
@Override
|
||||
public boolean isPlayer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public PlayerSource( EntityPlayer p, IActionHost v )
|
||||
{
|
||||
this.player = p;
|
||||
this.via = v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlayer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,11 +23,13 @@
|
|||
|
||||
package appeng.api.networking.storage;
|
||||
|
||||
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
|
||||
|
||||
public interface IStackWatcherHost
|
||||
{
|
||||
|
||||
|
@ -37,17 +39,16 @@ public interface IStackWatcherHost
|
|||
*
|
||||
* @param newWatcher stack watcher
|
||||
*/
|
||||
void updateWatcher(IStackWatcher newWatcher);
|
||||
void updateWatcher( IStackWatcher newWatcher );
|
||||
|
||||
/**
|
||||
* Called when a watched item changes amounts.
|
||||
*
|
||||
* @param o changed item list
|
||||
* @param o changed item list
|
||||
* @param fullStack old stack
|
||||
* @param diffStack new stack
|
||||
* @param src action source
|
||||
* @param chan storage channel
|
||||
* @param src action source
|
||||
* @param chan storage channel
|
||||
*/
|
||||
void onStackChange(IItemList o, IAEStack fullStack, IAEStack diffStack, BaseActionSource src, StorageChannel chan);
|
||||
|
||||
void onStackChange( IItemList o, IAEStack fullStack, IAEStack diffStack, BaseActionSource src, StorageChannel chan );
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
package appeng.api.networking.storage;
|
||||
|
||||
|
||||
import appeng.api.networking.IGridCache;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
|
@ -32,6 +33,7 @@ import appeng.api.storage.IStorageMonitorable;
|
|||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
/**
|
||||
* Common base class for item / fluid storage caches.
|
||||
*/
|
||||
|
@ -48,7 +50,7 @@ public interface IStorageGrid extends IGridCache, IStorageMonitorable
|
|||
*
|
||||
* @param input injected items
|
||||
*/
|
||||
void postAlterationOfStoredItems(StorageChannel chan, Iterable<? extends IAEStack> input, BaseActionSource src);
|
||||
void postAlterationOfStoredItems( StorageChannel chan, Iterable<? extends IAEStack> input, BaseActionSource src );
|
||||
|
||||
/**
|
||||
* Used to add a cell provider to the storage system
|
||||
|
@ -58,11 +60,10 @@ public interface IStorageGrid extends IGridCache, IStorageMonitorable
|
|||
*
|
||||
* @param cc to be added cell provider
|
||||
*/
|
||||
void registerCellProvider(ICellProvider cc);
|
||||
void registerCellProvider( ICellProvider cc );
|
||||
|
||||
/**
|
||||
* remove a provider added with addCellContainer
|
||||
*/
|
||||
void unregisterCellProvider(ICellProvider cc);
|
||||
|
||||
void unregisterCellProvider( ICellProvider cc );
|
||||
}
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
|
||||
package appeng.api.networking.ticking;
|
||||
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
|
||||
|
||||
/**
|
||||
* Implement on IGridHosts which want to use AE's Network Ticking Feature.
|
||||
*/
|
||||
|
@ -53,9 +55,8 @@ public interface IGridTickable
|
|||
* reset it.
|
||||
*
|
||||
* @return null or a valid new TickingRequest
|
||||
*
|
||||
*/
|
||||
TickingRequest getTickingRequest(IGridNode node);
|
||||
TickingRequest getTickingRequest( IGridNode node );
|
||||
|
||||
/**
|
||||
* AE lets you adjust your tick rate based on the results of your tick, if
|
||||
|
@ -66,14 +67,11 @@ public interface IGridTickable
|
|||
*
|
||||
* Note: this is never called if you return null from getTickingRequest.
|
||||
*
|
||||
* @param TicksSinceLastCall
|
||||
* the number of world ticks that were skipped since your last
|
||||
* tick, you can use this to adjust speed of processing or adjust
|
||||
* your tick rate.
|
||||
* @param TicksSinceLastCall the number of world ticks that were skipped since your last
|
||||
* tick, you can use this to adjust speed of processing or adjust
|
||||
* your tick rate.
|
||||
*
|
||||
* @return tick rate adjustment.
|
||||
*
|
||||
*/
|
||||
TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall);
|
||||
|
||||
TickRateModulation tickingRequest( IGridNode node, int TicksSinceLastCall );
|
||||
}
|
||||
|
|
|
@ -23,13 +23,13 @@
|
|||
|
||||
package appeng.api.networking.ticking;
|
||||
|
||||
|
||||
import appeng.api.networking.IGridCache;
|
||||
import appeng.api.networking.IGridNode;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* The network tick manager.
|
||||
*
|
||||
*/
|
||||
public interface ITickManager extends IGridCache
|
||||
{
|
||||
|
@ -42,26 +42,23 @@ public interface ITickManager extends IGridCache
|
|||
*
|
||||
* @param node gridnode
|
||||
*/
|
||||
boolean alertDevice(IGridNode node);
|
||||
boolean alertDevice( IGridNode node );
|
||||
|
||||
/**
|
||||
*
|
||||
* disables ticking for your device.
|
||||
*
|
||||
* @param node gridnode
|
||||
*
|
||||
* @return if the call was successful.
|
||||
*/
|
||||
boolean sleepDevice(IGridNode node);
|
||||
boolean sleepDevice( IGridNode node );
|
||||
|
||||
/**
|
||||
*
|
||||
* enables ticking for your device, undoes a sleepDevice call.
|
||||
*
|
||||
* @param node gridnode
|
||||
*
|
||||
* @return if the call was successful.
|
||||
*/
|
||||
boolean wakeDevice(IGridNode node);
|
||||
|
||||
boolean wakeDevice( IGridNode node );
|
||||
}
|
||||
|
|
|
@ -23,10 +23,9 @@
|
|||
|
||||
package appeng.api.networking.ticking;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Describes how your tiles ticking is executed.
|
||||
*
|
||||
*/
|
||||
public class TickingRequest
|
||||
{
|
||||
|
@ -37,7 +36,6 @@ public class TickingRequest
|
|||
* Valid Values are : 1+
|
||||
*
|
||||
* Suggested is 5-20
|
||||
*
|
||||
*/
|
||||
public final int minTickRate;
|
||||
|
||||
|
@ -48,30 +46,25 @@ public class TickingRequest
|
|||
* Valid Values are 1+
|
||||
*
|
||||
* Suggested is 20-40
|
||||
*
|
||||
*/
|
||||
public final int maxTickRate;
|
||||
|
||||
/**
|
||||
*
|
||||
* Determines the current expected state of your node, if your node expects
|
||||
* to be sleeping, then return true.
|
||||
*
|
||||
*/
|
||||
public final boolean isSleeping;
|
||||
|
||||
/**
|
||||
*
|
||||
* True only if you call {@link ITickManager}.alertDevice( IGridNode );
|
||||
*
|
||||
*/
|
||||
public final boolean canBeAlerted;
|
||||
|
||||
public TickingRequest(int min, int max, boolean sleep, boolean alertable) {
|
||||
public TickingRequest( int min, int max, boolean sleep, boolean alertable )
|
||||
{
|
||||
this.minTickRate = min;
|
||||
this.maxTickRate = max;
|
||||
this.isSleeping = sleep;
|
||||
this.canBeAlerted = alertable;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public enum CableRenderMode
|
|||
public final boolean transparentFacades;
|
||||
public final boolean opaqueFacades;
|
||||
|
||||
CableRenderMode( boolean hideFacades )
|
||||
CableRenderMode( boolean hideFacades )
|
||||
{
|
||||
this.transparentFacades = hideFacades;
|
||||
this.opaqueFacades = !hideFacades;
|
||||
|
|
|
@ -31,6 +31,7 @@ import io.netty.buffer.ByteBuf;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
|
||||
/**
|
||||
* Used Internally.
|
||||
*
|
||||
|
@ -44,17 +45,17 @@ public interface IFacadeContainer
|
|||
*
|
||||
* @return true if the facade as successfully added.
|
||||
*/
|
||||
boolean addFacade(IFacadePart a);
|
||||
boolean addFacade( IFacadePart a );
|
||||
|
||||
/**
|
||||
* Removed the facade on the given side, or does nothing.
|
||||
*/
|
||||
void removeFacade(IPartHost host, ForgeDirection side);
|
||||
void removeFacade( IPartHost host, ForgeDirection side );
|
||||
|
||||
/**
|
||||
* @return the {@link IFacadePart} for a given side, or null.
|
||||
*/
|
||||
IFacadePart getFacade(ForgeDirection s);
|
||||
IFacadePart getFacade( ForgeDirection s );
|
||||
|
||||
/**
|
||||
* rotate the facades left.
|
||||
|
@ -66,35 +67,37 @@ public interface IFacadeContainer
|
|||
*
|
||||
* @param data to be written data
|
||||
*/
|
||||
void writeToNBT(NBTTagCompound data);
|
||||
void writeToNBT( NBTTagCompound data );
|
||||
|
||||
/**
|
||||
* read from stream
|
||||
*
|
||||
* @param data to be read data
|
||||
*
|
||||
* @return true if it was readable
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
boolean readFromStream(ByteBuf data) throws IOException;
|
||||
boolean readFromStream( ByteBuf data ) throws IOException;
|
||||
|
||||
/**
|
||||
* read from NBT
|
||||
*
|
||||
* @param data to be read data
|
||||
*/
|
||||
void readFromNBT(NBTTagCompound data);
|
||||
void readFromNBT( NBTTagCompound data );
|
||||
|
||||
/**
|
||||
* write to stream
|
||||
*
|
||||
* @param data to be written data
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
void writeToStream(ByteBuf data) throws IOException;
|
||||
void writeToStream( ByteBuf data ) throws IOException;
|
||||
|
||||
/**
|
||||
* @return true if there are no facades.
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
/**
|
||||
* Used Internally.
|
||||
*
|
||||
|
@ -51,24 +52,24 @@ public interface IFacadePart
|
|||
* used to collide, and pick the part
|
||||
*
|
||||
* @param ch collision helper
|
||||
* @param e colliding entity
|
||||
* @param e colliding entity
|
||||
*/
|
||||
void getBoxes(IPartCollisionHelper ch, Entity e);
|
||||
void getBoxes( IPartCollisionHelper ch, Entity e );
|
||||
|
||||
/**
|
||||
* render the part.
|
||||
*
|
||||
* @param x x pos of part
|
||||
* @param y y pos of part
|
||||
* @param z z pos of part
|
||||
* @param instance render helper
|
||||
* @param renderer renderer
|
||||
* @param fc face container
|
||||
* @param busBounds bounding box
|
||||
* @param x x pos of part
|
||||
* @param y y pos of part
|
||||
* @param z z pos of part
|
||||
* @param instance render helper
|
||||
* @param renderer renderer
|
||||
* @param fc face container
|
||||
* @param busBounds bounding box
|
||||
* @param renderStilt if to render stilt
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void renderStatic(int x, int y, int z, IPartRenderHelper instance, RenderBlocks renderer, IFacadeContainer fc, AxisAlignedBB busBounds, boolean renderStilt);
|
||||
@SideOnly( Side.CLIENT )
|
||||
void renderStatic( int x, int y, int z, IPartRenderHelper instance, RenderBlocks renderer, IFacadeContainer fc, AxisAlignedBB busBounds, boolean renderStilt );
|
||||
|
||||
/**
|
||||
* render the part in inventory.
|
||||
|
@ -76,8 +77,8 @@ public interface IFacadePart
|
|||
* @param instance render helper
|
||||
* @param renderer renderer
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void renderInventory(IPartRenderHelper instance, RenderBlocks renderer);
|
||||
@SideOnly( Side.CLIENT )
|
||||
void renderInventory( IPartRenderHelper instance, RenderBlocks renderer );
|
||||
|
||||
/**
|
||||
* @return side the facade is in
|
||||
|
@ -95,8 +96,7 @@ public interface IFacadePart
|
|||
|
||||
boolean isBC();
|
||||
|
||||
void setThinFacades(boolean useThinFacades);
|
||||
void setThinFacades( boolean useThinFacades );
|
||||
|
||||
boolean isTransparent();
|
||||
|
||||
}
|
|
@ -23,8 +23,10 @@
|
|||
|
||||
package appeng.api.parts;
|
||||
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
|
||||
public interface IPartCollisionHelper
|
||||
{
|
||||
|
||||
|
@ -40,7 +42,7 @@ public interface IPartCollisionHelper
|
|||
* @param maxY maximal y collision
|
||||
* @param maxZ maximal z collision
|
||||
*/
|
||||
void addBox(double minX, double minY, double minZ, double maxX, double maxY, double maxZ);
|
||||
void addBox( double minX, double minY, double minZ, double maxX, double maxY, double maxZ );
|
||||
|
||||
/**
|
||||
* @return east in world space.
|
||||
|
@ -61,5 +63,4 @@ public interface IPartCollisionHelper
|
|||
* @return true if this test is to get the BB Collision information.
|
||||
*/
|
||||
boolean isBBCollision();
|
||||
|
||||
}
|
||||
|
|
|
@ -23,10 +23,12 @@
|
|||
|
||||
package appeng.api.parts;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public interface IPartHelper
|
||||
{
|
||||
|
||||
|
@ -54,28 +56,29 @@ public interface IPartHelper
|
|||
* implement that interface on a part get implement it.
|
||||
*
|
||||
* @return true on success, false on failure, usually a error will be logged
|
||||
* as well.
|
||||
* as well.
|
||||
*/
|
||||
boolean registerNewLayer(String string, String layerInterface);
|
||||
boolean registerNewLayer( String string, String layerInterface );
|
||||
|
||||
/**
|
||||
* Register IBusItem with renderer
|
||||
*/
|
||||
void setItemBusRenderer(IPartItem i);
|
||||
void setItemBusRenderer( IPartItem i );
|
||||
|
||||
/**
|
||||
* use in use item, to try and place a IBusItem
|
||||
*
|
||||
* @param is ItemStack of an item which implements {@link IPartItem}
|
||||
* @param x x pos of part
|
||||
* @param y y pos of part
|
||||
* @param z z pos of part
|
||||
* @param side side which the part should be on
|
||||
* @param is ItemStack of an item which implements {@link IPartItem}
|
||||
* @param x x pos of part
|
||||
* @param y y pos of part
|
||||
* @param z z pos of part
|
||||
* @param side side which the part should be on
|
||||
* @param player player placing part
|
||||
* @param world part in world
|
||||
* @param world part in world
|
||||
*
|
||||
* @return true if placing was successful
|
||||
*/
|
||||
boolean placeBus(ItemStack is, int x, int y, int z, int side, EntityPlayer player, World world);
|
||||
boolean placeBus( ItemStack is, int x, int y, int z, int side, EntityPlayer player, World world );
|
||||
|
||||
/**
|
||||
* @return the render mode
|
||||
|
|
|
@ -35,6 +35,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
|
||||
|
||||
/**
|
||||
* Implemented on AE's TileEntity or AE's FMP Part.
|
||||
*
|
||||
|
@ -54,28 +55,31 @@ public interface IPartHost
|
|||
*
|
||||
* @param part to be added part
|
||||
* @param side part placed onto side
|
||||
*
|
||||
* @return returns false if the part cannot be added.
|
||||
*/
|
||||
boolean canAddPart(ItemStack part, ForgeDirection side);
|
||||
boolean canAddPart( ItemStack part, ForgeDirection side );
|
||||
|
||||
/**
|
||||
* try to add a new part to the specified side, returns false if it failed to be added.
|
||||
*
|
||||
* @param is new part
|
||||
* @param side onto side
|
||||
* @param is new part
|
||||
* @param side onto side
|
||||
* @param owner with owning player
|
||||
*
|
||||
* @return null if the item failed to add, the side it was placed on other wise ( may different for cables,
|
||||
* {@link ForgeDirection}.UNKNOWN )
|
||||
* {@link ForgeDirection}.UNKNOWN )
|
||||
*/
|
||||
ForgeDirection addPart(ItemStack is, ForgeDirection side, EntityPlayer owner);
|
||||
ForgeDirection addPart( ItemStack is, ForgeDirection side, EntityPlayer owner );
|
||||
|
||||
/**
|
||||
* Get part by side ( center is {@link ForgeDirection}.UNKNOWN )
|
||||
*
|
||||
* @param side side of part
|
||||
*
|
||||
* @return the part located on the specified side, or null if there is no part.
|
||||
*/
|
||||
IPart getPart(ForgeDirection side);
|
||||
IPart getPart( ForgeDirection side );
|
||||
|
||||
/**
|
||||
* removes the part on the side, this doesn't drop it or anything, if you don't do something with it, its just
|
||||
|
@ -83,11 +87,10 @@ public interface IPartHost
|
|||
*
|
||||
* if you want to drop the part you must request it prior to removing it.
|
||||
*
|
||||
* @param side side of part
|
||||
* @param suppressUpdate
|
||||
* - used if you need to replace a part's INSTANCE, without really removing it first.
|
||||
* @param side side of part
|
||||
* @param suppressUpdate - used if you need to replace a part's INSTANCE, without really removing it first.
|
||||
*/
|
||||
void removePart(ForgeDirection side, boolean suppressUpdate);
|
||||
void removePart( ForgeDirection side, boolean suppressUpdate );
|
||||
|
||||
/**
|
||||
* something changed, might want to send a packet to clients to update state.
|
||||
|
@ -106,7 +109,7 @@ public interface IPartHost
|
|||
|
||||
/**
|
||||
* @return the color of the host type ( this is determined by the middle cable. ) if no cable is present, it returns
|
||||
* {@link AEColor} .Transparent other wise it returns the color of the cable in the center.
|
||||
* {@link AEColor} .Transparent other wise it returns the color of the cable in the center.
|
||||
*/
|
||||
AEColor getColor();
|
||||
|
||||
|
@ -120,15 +123,16 @@ public interface IPartHost
|
|||
*
|
||||
* @return returns if microblocks are blocking this cable path.
|
||||
*/
|
||||
boolean isBlocked(ForgeDirection side);
|
||||
boolean isBlocked( ForgeDirection side );
|
||||
|
||||
/**
|
||||
* finds the part located at the position ( pos must be relative, not global )
|
||||
*
|
||||
* @param pos part position
|
||||
*
|
||||
* @return a new SelectedPart, this is never null.
|
||||
*/
|
||||
SelectedPart selectPart(Vec3 pos);
|
||||
SelectedPart selectPart( Vec3 pos );
|
||||
|
||||
/**
|
||||
* can be used by parts to trigger the tile or part to save.
|
||||
|
@ -144,9 +148,10 @@ public interface IPartHost
|
|||
* get the redstone state of host on this side, this value is cached internally.
|
||||
*
|
||||
* @param side side of part
|
||||
*
|
||||
* @return true of the part host is receiving redstone from an external source.
|
||||
*/
|
||||
boolean hasRedstone(ForgeDirection side);
|
||||
boolean hasRedstone( ForgeDirection side );
|
||||
|
||||
/**
|
||||
* returns false if this block contains any parts or facades, true other wise.
|
||||
|
|
|
@ -26,8 +26,9 @@ package appeng.api.parts;
|
|||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
//@formatter:off
|
||||
|
||||
|
||||
/**
|
||||
* This is a pretty basic requirement, once you implement the interface, and createPartFromItemStack
|
||||
*
|
||||
|
@ -51,7 +52,6 @@ import net.minecraft.item.ItemStack;
|
|||
* }
|
||||
* </code>
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
public interface IPartItem
|
||||
{
|
||||
|
|
|
@ -34,6 +34,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
public interface IPartRenderHelper
|
||||
{
|
||||
|
||||
|
@ -49,83 +50,83 @@ public interface IPartRenderHelper
|
|||
* @param maxY maximal y bound
|
||||
* @param maxZ maximal z bound
|
||||
*/
|
||||
void setBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ);
|
||||
void setBounds( float minX, float minY, float minZ, float maxX, float maxY, float maxZ );
|
||||
|
||||
/**
|
||||
* static renderer
|
||||
*
|
||||
* render a single face.
|
||||
*
|
||||
* @param x x coord of part
|
||||
* @param y y coord of part
|
||||
* @param z z coord of part
|
||||
* @param ico icon of part
|
||||
* @param face direction its facing
|
||||
* @param x x coord of part
|
||||
* @param y y coord of part
|
||||
* @param z z coord of part
|
||||
* @param ico icon of part
|
||||
* @param face direction its facing
|
||||
* @param renderer renderer of part
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void renderFace(int x, int y, int z, IIcon ico, ForgeDirection face, RenderBlocks renderer);
|
||||
@SideOnly( Side.CLIENT )
|
||||
void renderFace( int x, int y, int z, IIcon ico, ForgeDirection face, RenderBlocks renderer );
|
||||
|
||||
/**
|
||||
* static renderer
|
||||
*
|
||||
* render a box with a cut out box in the center.
|
||||
*
|
||||
* @param x x pos of part
|
||||
* @param y y pos of part
|
||||
* @param z z pos of part
|
||||
* @param ico icon of part
|
||||
* @param face face of part
|
||||
* @param x x pos of part
|
||||
* @param y y pos of part
|
||||
* @param z z pos of part
|
||||
* @param ico icon of part
|
||||
* @param face face of part
|
||||
* @param edgeThickness thickness of the edge
|
||||
* @param renderer renderer
|
||||
* @param renderer renderer
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void renderFaceCutout(int x, int y, int z, IIcon ico, ForgeDirection face, float edgeThickness, RenderBlocks renderer);
|
||||
@SideOnly( Side.CLIENT )
|
||||
void renderFaceCutout( int x, int y, int z, IIcon ico, ForgeDirection face, float edgeThickness, RenderBlocks renderer );
|
||||
|
||||
/**
|
||||
* static renderer
|
||||
*
|
||||
* render a block of specified bounds.
|
||||
*
|
||||
* @param x x pos of block
|
||||
* @param y y pos of block
|
||||
* @param z z pos of block
|
||||
* @param x x pos of block
|
||||
* @param y y pos of block
|
||||
* @param z z pos of block
|
||||
* @param renderer renderer
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void renderBlock(int x, int y, int z, RenderBlocks renderer);
|
||||
@SideOnly( Side.CLIENT )
|
||||
void renderBlock( int x, int y, int z, RenderBlocks renderer );
|
||||
|
||||
/**
|
||||
* render a single face in inventory renderer.
|
||||
*
|
||||
* @param IIcon icon of part
|
||||
* @param IIcon icon of part
|
||||
* @param direction face of part
|
||||
* @param renderer renderer
|
||||
* @param renderer renderer
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void renderInventoryFace(IIcon IIcon, ForgeDirection direction, RenderBlocks renderer);
|
||||
@SideOnly( Side.CLIENT )
|
||||
void renderInventoryFace( IIcon IIcon, ForgeDirection direction, RenderBlocks renderer );
|
||||
|
||||
/**
|
||||
* render a box in inventory renderer.
|
||||
*
|
||||
* @param renderer renderer
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void renderInventoryBox(RenderBlocks renderer);
|
||||
@SideOnly( Side.CLIENT )
|
||||
void renderInventoryBox( RenderBlocks renderer );
|
||||
|
||||
/**
|
||||
* inventory, and static renderer.
|
||||
*
|
||||
* set unique icons for each side of the block.
|
||||
*
|
||||
* @param down down face
|
||||
* @param up up face
|
||||
* @param down down face
|
||||
* @param up up face
|
||||
* @param north north face
|
||||
* @param south south face
|
||||
* @param west west face
|
||||
* @param east east face
|
||||
* @param west west face
|
||||
* @param east east face
|
||||
*/
|
||||
void setTexture(IIcon down, IIcon up, IIcon north, IIcon south, IIcon west, IIcon east);
|
||||
void setTexture( IIcon down, IIcon up, IIcon north, IIcon south, IIcon west, IIcon east );
|
||||
|
||||
/**
|
||||
* inventory, and static renderer.
|
||||
|
@ -134,14 +135,14 @@ public interface IPartRenderHelper
|
|||
*
|
||||
* @param ico to be set icon
|
||||
*/
|
||||
void setTexture(IIcon ico);
|
||||
void setTexture( IIcon ico );
|
||||
|
||||
/**
|
||||
* configure the color multiplier for the inventory renderer.
|
||||
*
|
||||
* @param whiteVariant color multiplier
|
||||
*/
|
||||
void setInvColor(int whiteVariant);
|
||||
void setInvColor( int whiteVariant );
|
||||
|
||||
/**
|
||||
* @return the block used for rendering, might need it for some reason...
|
||||
|
@ -169,7 +170,7 @@ public interface IPartRenderHelper
|
|||
*
|
||||
* Only worth it if you render more then 1 block.
|
||||
*/
|
||||
ISimplifiedBundle useSimplifiedRendering(int x, int y, int z, IBoxProvider p, ISimplifiedBundle sim);
|
||||
ISimplifiedBundle useSimplifiedRendering( int x, int y, int z, IBoxProvider p, ISimplifiedBundle sim );
|
||||
|
||||
/**
|
||||
* disables, useSimplifiedRendering.
|
||||
|
@ -179,25 +180,24 @@ public interface IPartRenderHelper
|
|||
/**
|
||||
* render a block using the current renderer state.
|
||||
*
|
||||
* @param x x pos of part
|
||||
* @param y y pos of part
|
||||
* @param z z pos of part
|
||||
* @param x x pos of part
|
||||
* @param y y pos of part
|
||||
* @param z z pos of part
|
||||
* @param renderer renderer of part
|
||||
*/
|
||||
void renderBlockCurrentBounds(int x, int y, int z, RenderBlocks renderer);
|
||||
void renderBlockCurrentBounds( int x, int y, int z, RenderBlocks renderer );
|
||||
|
||||
/**
|
||||
* allow you to enable your part to render during the alpha pass or the standard pass.
|
||||
*
|
||||
* @param pass render pass
|
||||
*/
|
||||
void renderForPass(int pass);
|
||||
void renderForPass( int pass );
|
||||
|
||||
/**
|
||||
* Set which faces to render, remember to set back to ALL when you are done.
|
||||
*
|
||||
* @param complementOf sides to render
|
||||
*/
|
||||
void setFacesToRender(EnumSet<ForgeDirection> complementOf);
|
||||
|
||||
void setFacesToRender( EnumSet<ForgeDirection> complementOf );
|
||||
}
|
|
@ -29,6 +29,7 @@ import java.util.Set;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
|
||||
/**
|
||||
* All Layers must extends this, this get part implementation is provided to interface with the parts, however a real
|
||||
* implementation will be used at runtime.
|
||||
|
@ -42,9 +43,10 @@ public abstract class LayerBase extends TileEntity // implements IPartHost
|
|||
* This Method looks silly, that is because its not used at runtime, a real implementation will be used instead.
|
||||
*
|
||||
* @param side side of part
|
||||
*
|
||||
* @return the part for the requested side.
|
||||
*/
|
||||
public IPart getPart(ForgeDirection side)
|
||||
public IPart getPart( ForgeDirection side )
|
||||
{
|
||||
return null; // place holder.
|
||||
}
|
||||
|
@ -75,5 +77,4 @@ public abstract class LayerBase extends TileEntity // implements IPartHost
|
|||
{
|
||||
// something!
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,14 +30,16 @@ import appeng.api.exceptions.MissingIngredientError;
|
|||
import appeng.api.exceptions.RecipeError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
|
||||
|
||||
public interface ICraftHandler
|
||||
{
|
||||
|
||||
/**
|
||||
* Called when your recipe handler receives a newly parsed list of inputs/outputs.
|
||||
*
|
||||
* @param input parsed inputs
|
||||
* @param input parsed inputs
|
||||
* @param output parsed outputs
|
||||
*
|
||||
* @throws RecipeError
|
||||
*/
|
||||
void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError;
|
||||
|
@ -49,5 +51,4 @@ public interface ICraftHandler
|
|||
* @throws MissingIngredientError
|
||||
*/
|
||||
void register() throws RegistrationError, MissingIngredientError;
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,9 @@ import net.minecraft.item.ItemStack;
|
|||
import appeng.api.exceptions.MissingIngredientError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
|
||||
public interface IIngredient {
|
||||
|
||||
public interface IIngredient
|
||||
{
|
||||
|
||||
/**
|
||||
* Acquire a single input stack for the current recipe, if more then one ItemStack is possible a
|
||||
|
@ -47,6 +49,7 @@ public interface IIngredient {
|
|||
* multiple inputs per slot.
|
||||
*
|
||||
* @return an array of ItemStacks for the recipe handler.
|
||||
*
|
||||
* @throws RegistrationError
|
||||
* @throws MissingIngredientError
|
||||
*/
|
||||
|
@ -81,9 +84,9 @@ public interface IIngredient {
|
|||
|
||||
/**
|
||||
* Bakes the lists in for faster runtime look-ups.
|
||||
*
|
||||
* @throws MissingIngredientError
|
||||
* @throws RegistrationError
|
||||
*/
|
||||
void bake() throws RegistrationError, MissingIngredientError;
|
||||
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
|
||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
||||
|
||||
|
||||
/**
|
||||
* Registration record for {@link ICellRegistry}
|
||||
*/
|
||||
|
@ -44,63 +45,60 @@ public interface ICellHandler
|
|||
* request a handler )
|
||||
*
|
||||
* @param is to be checked item
|
||||
*
|
||||
* @return return true, if getCellHandler will not return null.
|
||||
*/
|
||||
boolean isCell(ItemStack is);
|
||||
boolean isCell( ItemStack is );
|
||||
|
||||
/**
|
||||
* If you cannot handle the provided item, return null
|
||||
*
|
||||
* @param is
|
||||
* a storage cell item.
|
||||
* @param host
|
||||
* anytime the contents of your storage cell changes it should use this to request a save, please
|
||||
* note, this value can be null.
|
||||
* @param channel
|
||||
* the storage channel requested.
|
||||
* @param is a storage cell item.
|
||||
* @param host anytime the contents of your storage cell changes it should use this to request a save, please
|
||||
* note, this value can be null.
|
||||
* @param channel the storage channel requested.
|
||||
*
|
||||
* @return a new IMEHandler for the provided item
|
||||
*/
|
||||
IMEInventoryHandler getCellInventory(ItemStack is, ISaveProvider host, StorageChannel channel);
|
||||
IMEInventoryHandler getCellInventory( ItemStack is, ISaveProvider host, StorageChannel channel );
|
||||
|
||||
/**
|
||||
* @return the ME Chest texture for light pixels this storage cell type, should be 10x10 with 3px of transparent
|
||||
* padding on a 16x16 texture, null is valid if your cell cannot be used in the ME Chest. refer to the
|
||||
* assets for examples.
|
||||
* padding on a 16x16 texture, null is valid if your cell cannot be used in the ME Chest. refer to the
|
||||
* assets for examples.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SideOnly( Side.CLIENT )
|
||||
IIcon getTopTexture_Light();
|
||||
|
||||
/**
|
||||
* @return the ME Chest texture for medium pixels this storage cell type, should be 10x10 with 3px of transparent
|
||||
* padding on a 16x16 texture, null is valid if your cell cannot be used in the ME Chest. refer to the
|
||||
* assets for examples.
|
||||
* padding on a 16x16 texture, null is valid if your cell cannot be used in the ME Chest. refer to the
|
||||
* assets for examples.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SideOnly( Side.CLIENT )
|
||||
IIcon getTopTexture_Medium();
|
||||
|
||||
/**
|
||||
* @return the ME Chest texture for dark pixels this storage cell type, should be 10x10 with 3px of transparent
|
||||
* padding on a 16x16 texture, null is valid if your cell cannot be used in the ME Chest. refer to the
|
||||
* assets for examples.
|
||||
* padding on a 16x16 texture, null is valid if your cell cannot be used in the ME Chest. refer to the
|
||||
* assets for examples.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SideOnly( Side.CLIENT )
|
||||
IIcon getTopTexture_Dark();
|
||||
|
||||
/**
|
||||
*
|
||||
* Called when the storage cell is planed in an ME Chest and the user tries to open the terminal side, if your item
|
||||
* is not available via ME Chests simply tell the user they can't use it, or something, other wise you should open
|
||||
* your gui and display the cell to the user.
|
||||
*
|
||||
* @param player player opening chest gui
|
||||
* @param chest to be opened chest
|
||||
* @param player player opening chest gui
|
||||
* @param chest to be opened chest
|
||||
* @param cellHandler cell handler
|
||||
* @param inv inventory handler
|
||||
* @param is item
|
||||
* @param chan storage channel
|
||||
* @param inv inventory handler
|
||||
* @param is item
|
||||
* @param chan storage channel
|
||||
*/
|
||||
void openChestGui(EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan);
|
||||
void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan );
|
||||
|
||||
/**
|
||||
* 0 - cell is missing.
|
||||
|
@ -111,16 +109,15 @@ public interface ICellHandler
|
|||
*
|
||||
* 3 - red, ( usually means the cell is 100% full )
|
||||
*
|
||||
* @param is the cell item. ( use the handler for any details you can )
|
||||
* @param is the cell item. ( use the handler for any details you can )
|
||||
* @param handler the handler for the cell is provides for reference, you can cast this to your handler.
|
||||
*
|
||||
* @return get the status of the cell based on its contents.
|
||||
*/
|
||||
int getStatusForCell(ItemStack is, IMEInventory handler);
|
||||
int getStatusForCell( ItemStack is, IMEInventory handler );
|
||||
|
||||
/**
|
||||
* @return the ae/t to drain for this storage cell inside a chest/drive.
|
||||
*/
|
||||
double cellIdleDrain(ItemStack is, IMEInventory handler);
|
||||
|
||||
double cellIdleDrain( ItemStack is, IMEInventory handler );
|
||||
}
|
|
@ -23,8 +23,10 @@
|
|||
|
||||
package appeng.api.storage;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Allows you to provide cells via non IGridHosts directly to the storage system, drives, and similar features should go
|
||||
* though {@link ICellContainer} and be automatically handled by the storage system.
|
||||
|
@ -40,7 +42,7 @@ public interface ICellProvider
|
|||
*
|
||||
* @return a valid list of handlers, NEVER NULL
|
||||
*/
|
||||
List<IMEInventoryHandler> getCellArray(StorageChannel channel);
|
||||
List<IMEInventoryHandler> getCellArray( StorageChannel channel );
|
||||
|
||||
/**
|
||||
* the storage's priority.
|
||||
|
@ -48,5 +50,4 @@ public interface ICellProvider
|
|||
* Positive and negative are supported
|
||||
*/
|
||||
int getPriority();
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
import appeng.api.IAppEngApi;
|
||||
|
||||
|
||||
/**
|
||||
* Storage Cell Registry, used for specially implemented cells, if you just want to make a item act like a cell, or new
|
||||
* cell with different bytes, then you should probably consider IStorageCell instead its considerably simpler.
|
||||
|
@ -42,34 +43,35 @@ public interface ICellRegistry
|
|||
*
|
||||
* @param handler cell handler
|
||||
*/
|
||||
void addCellHandler(ICellHandler handler);
|
||||
void addCellHandler( ICellHandler handler );
|
||||
|
||||
/**
|
||||
* return true, if you can get a InventoryHandler for the item passed.
|
||||
*
|
||||
* @param is to be checked item
|
||||
*
|
||||
* @return true if the provided item, can be handled by a handler in AE, ( AE May choose to skip this and just get
|
||||
* the handler instead. )
|
||||
* the handler instead. )
|
||||
*/
|
||||
boolean isCellHandled(ItemStack is);
|
||||
boolean isCellHandled( ItemStack is );
|
||||
|
||||
/**
|
||||
* get the handler, for the requested type.
|
||||
*
|
||||
* @param is to be checked item
|
||||
*
|
||||
* @return the handler registered for this item type.
|
||||
*/
|
||||
ICellHandler getHandler(ItemStack is);
|
||||
ICellHandler getHandler( ItemStack is );
|
||||
|
||||
/**
|
||||
* returns an IMEInventoryHandler for the provided item.
|
||||
*
|
||||
* @param is item with inventory handler
|
||||
* @param is item with inventory handler
|
||||
* @param host can be null, or the hosting tile / part.
|
||||
* @param chan the storage channel to request the handler for.
|
||||
*
|
||||
* @return new IMEInventoryHandler, or null if there isn't one.
|
||||
*/
|
||||
IMEInventoryHandler getCellInventory(ItemStack is, ISaveProvider host, StorageChannel chan);
|
||||
|
||||
IMEInventoryHandler getCellInventory( ItemStack is, ISaveProvider host, StorageChannel chan );
|
||||
}
|
|
@ -29,6 +29,7 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
|
||||
|
||||
public interface ICellWorkbenchItem
|
||||
{
|
||||
|
||||
|
@ -36,9 +37,10 @@ public interface ICellWorkbenchItem
|
|||
* if this return false, the item will not be treated as a cell, and cannot be inserted into the work bench.
|
||||
*
|
||||
* @param is item
|
||||
*
|
||||
* @return true if the item should be editable in the cell workbench.
|
||||
*/
|
||||
boolean isEditable(ItemStack is);
|
||||
boolean isEditable( ItemStack is );
|
||||
|
||||
/**
|
||||
* used to edit the upgrade slots on your cell, should have a capacity of 0-24, you are also responsible for
|
||||
|
@ -46,7 +48,7 @@ public interface ICellWorkbenchItem
|
|||
*
|
||||
* onInventoryChange will be called when saving is needed.
|
||||
*/
|
||||
IInventory getUpgradesInventory(ItemStack is);
|
||||
IInventory getUpgradesInventory( ItemStack is );
|
||||
|
||||
/**
|
||||
* Used to extract, or mirror the contents of the work bench onto the cell.
|
||||
|
@ -55,16 +57,15 @@ public interface ICellWorkbenchItem
|
|||
*
|
||||
* onInventoryChange will be called when saving is needed.
|
||||
*/
|
||||
IInventory getConfigInventory(ItemStack is);
|
||||
IInventory getConfigInventory( ItemStack is );
|
||||
|
||||
/**
|
||||
* @return the current fuzzy status.
|
||||
*/
|
||||
FuzzyMode getFuzzyMode(ItemStack is);
|
||||
FuzzyMode getFuzzyMode( ItemStack is );
|
||||
|
||||
/**
|
||||
* sets the setting on the cell.
|
||||
*/
|
||||
void setFuzzyMode(ItemStack is, FuzzyMode fzMode);
|
||||
|
||||
void setFuzzyMode( ItemStack is, FuzzyMode fzMode );
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
|
||||
|
||||
/**
|
||||
* A Registration Record for {@link IExternalStorageRegistry}
|
||||
*/
|
||||
|
@ -39,11 +40,12 @@ public interface IExternalStorageHandler
|
|||
* if this can handle the provided inventory, return true. ( Generally skipped by AE, and it just calls getInventory
|
||||
* )
|
||||
*
|
||||
* @param te to be handled tile entity
|
||||
* @param te to be handled tile entity
|
||||
* @param mySrc source
|
||||
*
|
||||
* @return true, if it can get a handler via getInventory
|
||||
*/
|
||||
boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc);
|
||||
boolean canHandle( TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc );
|
||||
|
||||
/**
|
||||
* if this can handle the given inventory, return the a IMEInventory implementing class for it, if not return null
|
||||
|
@ -51,12 +53,12 @@ public interface IExternalStorageHandler
|
|||
* please note that if your inventory changes and requires polling, you must use an {@link IMEMonitor} instead of an
|
||||
* {@link IMEInventory} failure to do so will result in invalid item counts and reporting of the inventory.
|
||||
*
|
||||
* @param te to be handled tile entity
|
||||
* @param d direction
|
||||
* @param te to be handled tile entity
|
||||
* @param d direction
|
||||
* @param channel channel
|
||||
* @param src source
|
||||
* @param src source
|
||||
*
|
||||
* @return The Handler for the inventory
|
||||
*/
|
||||
IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src);
|
||||
|
||||
IMEInventory getInventory( TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src );
|
||||
}
|
|
@ -30,6 +30,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
|
||||
|
||||
/**
|
||||
* A Registry of External Storage handlers.
|
||||
*
|
||||
|
@ -43,15 +44,15 @@ public interface IExternalStorageRegistry
|
|||
*
|
||||
* @param esh storage handler
|
||||
*/
|
||||
void addExternalStorageInterface(IExternalStorageHandler esh);
|
||||
void addExternalStorageInterface( IExternalStorageHandler esh );
|
||||
|
||||
/**
|
||||
* @param te tile entity
|
||||
* @param te tile entity
|
||||
* @param opposite direction
|
||||
* @param channel channel
|
||||
* @param mySrc source
|
||||
* @param channel channel
|
||||
* @param mySrc source
|
||||
*
|
||||
* @return the handler for a given tile / forge direction
|
||||
*/
|
||||
IExternalStorageHandler getHandler(TileEntity te, ForgeDirection opposite, StorageChannel channel, BaseActionSource mySrc);
|
||||
|
||||
IExternalStorageHandler getHandler( TileEntity te, ForgeDirection opposite, StorageChannel channel, BaseActionSource mySrc );
|
||||
}
|
|
@ -23,11 +23,13 @@
|
|||
|
||||
package appeng.api.storage;
|
||||
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
|
||||
|
||||
/**
|
||||
* AE's Equivalent to IInventory, used to reading contents, and manipulating contents of ME Inventories.
|
||||
*
|
||||
|
@ -45,8 +47,9 @@ public interface IMEInventory<StackType extends IAEStack>
|
|||
* Store new items, or simulate the addition of new items into the ME Inventory.
|
||||
*
|
||||
* @param input item to add.
|
||||
* @param type action type
|
||||
* @param src action source
|
||||
* @param type action type
|
||||
* @param src action source
|
||||
*
|
||||
* @return returns the number of items not added.
|
||||
*/
|
||||
StackType injectItems( StackType input, Actionable type, BaseActionSource src );
|
||||
|
@ -54,10 +57,9 @@ public interface IMEInventory<StackType extends IAEStack>
|
|||
/**
|
||||
* Extract the specified item from the ME Inventory
|
||||
*
|
||||
* @param request
|
||||
* item to request ( with stack size. )
|
||||
* @param mode
|
||||
* simulate, or perform action?
|
||||
* @param request item to request ( with stack size. )
|
||||
* @param mode simulate, or perform action?
|
||||
*
|
||||
* @return returns the number of items extracted, null
|
||||
*/
|
||||
StackType extractItems( StackType request, Actionable mode, BaseActionSource src );
|
||||
|
@ -65,8 +67,8 @@ public interface IMEInventory<StackType extends IAEStack>
|
|||
/**
|
||||
* request a full report of all available items, storage.
|
||||
*
|
||||
* @param out
|
||||
* the IItemList the results will be written too
|
||||
* @param out the IItemList the results will be written too
|
||||
*
|
||||
* @return returns same list that was passed in, is passed out
|
||||
*/
|
||||
IItemList<StackType> getAvailableItems( IItemList<StackType> out );
|
||||
|
@ -75,5 +77,4 @@ public interface IMEInventory<StackType extends IAEStack>
|
|||
* @return the type of channel your handler should be part of
|
||||
*/
|
||||
StorageChannel getChannel();
|
||||
|
||||
}
|
||||
|
|
|
@ -23,9 +23,11 @@
|
|||
|
||||
package appeng.api.storage;
|
||||
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
/**
|
||||
* Thin logic layer that can be swapped with different IMEInventory implementations, used to handle features related to
|
||||
* storage, that are Separate from the storage medium itself.
|
||||
|
@ -46,8 +48,8 @@ public interface IMEInventoryHandler<StackType extends IAEStack> extends IMEInve
|
|||
* determine if a particular item is prioritized for this inventory handler, if it is, then it will be added to this
|
||||
* inventory prior to any non-prioritized inventories.
|
||||
*
|
||||
* @param input
|
||||
* - item that might be added
|
||||
* @param input - item that might be added
|
||||
*
|
||||
* @return if its prioritized
|
||||
*/
|
||||
boolean isPrioritized( StackType input );
|
||||
|
@ -55,8 +57,8 @@ public interface IMEInventoryHandler<StackType extends IAEStack> extends IMEInve
|
|||
/**
|
||||
* determine if an item can be accepted and stored.
|
||||
*
|
||||
* @param input
|
||||
* - item that might be added
|
||||
* @param input - item that might be added
|
||||
*
|
||||
* @return if the item can be added
|
||||
*/
|
||||
boolean canAccept( StackType input );
|
||||
|
@ -72,8 +74,8 @@ public interface IMEInventoryHandler<StackType extends IAEStack> extends IMEInve
|
|||
* pass back value for blinkCell.
|
||||
*
|
||||
* @return the slot index for the cell that this represents in the storage unit, the method on the
|
||||
* {@link ICellContainer} will be called with this value, only trust the return value of this method if you
|
||||
* are the implementer of this.
|
||||
* {@link ICellContainer} will be called with this value, only trust the return value of this method if you
|
||||
* are the implementer of this.
|
||||
*/
|
||||
int getSlot();
|
||||
|
||||
|
@ -82,8 +84,8 @@ public interface IMEInventoryHandler<StackType extends IAEStack> extends IMEInve
|
|||
* belongs, however in some cases you can save processor time, or require that the second, or first pass is simply
|
||||
* ignored, this allows you to do that.
|
||||
*
|
||||
* @param i
|
||||
* - pass number ( 1 or 2 )
|
||||
* @param i - pass number ( 1 or 2 )
|
||||
*
|
||||
* @return true, if this inventory is valid for this pass.
|
||||
*/
|
||||
boolean validForPass( int i );
|
||||
|
|
|
@ -40,6 +40,7 @@ import appeng.api.storage.data.IAEFluidStack;
|
|||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
|
||||
|
||||
public interface IStorageHelper
|
||||
{
|
||||
|
||||
|
@ -47,25 +48,24 @@ public interface IStorageHelper
|
|||
* load a crafting link from nbt data.
|
||||
*
|
||||
* @param data to be loaded data
|
||||
*
|
||||
* @return crafting link
|
||||
*/
|
||||
ICraftingLink loadCraftingLink(NBTTagCompound data, ICraftingRequester req);
|
||||
ICraftingLink loadCraftingLink( NBTTagCompound data, ICraftingRequester req );
|
||||
|
||||
/**
|
||||
* @param is
|
||||
* An ItemStack
|
||||
* @param is An ItemStack
|
||||
*
|
||||
* @return a new INSTANCE of {@link IAEItemStack} from a MC {@link ItemStack}
|
||||
*/
|
||||
IAEItemStack createItemStack(ItemStack is);
|
||||
IAEItemStack createItemStack( ItemStack is );
|
||||
|
||||
/**
|
||||
* @param is
|
||||
* A FluidStack
|
||||
* @param is A FluidStack
|
||||
*
|
||||
* @return a new INSTANCE of {@link IAEFluidStack} from a Forge {@link FluidStack}
|
||||
*/
|
||||
IAEFluidStack createFluidStack(FluidStack is);
|
||||
IAEFluidStack createFluidStack( FluidStack is );
|
||||
|
||||
/**
|
||||
* @return a new INSTANCE of {@link IItemList} for items
|
||||
|
@ -81,40 +81,45 @@ public interface IStorageHelper
|
|||
* Read a AE Item Stack from a byte stream, returns a AE item stack or null.
|
||||
*
|
||||
* @param input to be loaded data
|
||||
*
|
||||
* @return item based of data
|
||||
*
|
||||
* @throws IOException if file could not be read
|
||||
*/
|
||||
IAEItemStack readItemFromPacket(ByteBuf input) throws IOException;
|
||||
IAEItemStack readItemFromPacket( ByteBuf input ) throws IOException;
|
||||
|
||||
/**
|
||||
* Read a AE Fluid Stack from a byte stream, returns a AE fluid stack or null.
|
||||
*
|
||||
* @param input to be loaded data
|
||||
*
|
||||
* @return fluid based on data
|
||||
*
|
||||
* @throws IOException if file could not be written
|
||||
*/
|
||||
IAEFluidStack readFluidFromPacket(ByteBuf input) throws IOException;
|
||||
IAEFluidStack readFluidFromPacket( ByteBuf input ) throws IOException;
|
||||
|
||||
/**
|
||||
* use energy from energy, to remove request items from cell, at the request of src.
|
||||
*
|
||||
* @param energy to be drained energy source
|
||||
* @param cell cell of requested items
|
||||
* @param energy to be drained energy source
|
||||
* @param cell cell of requested items
|
||||
* @param request requested items
|
||||
* @param src action source
|
||||
* @param src action source
|
||||
*
|
||||
* @return items that successfully extracted.
|
||||
*/
|
||||
IAEItemStack poweredExtraction(IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack request, BaseActionSource src);
|
||||
IAEItemStack poweredExtraction( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack request, BaseActionSource src );
|
||||
|
||||
/**
|
||||
* use energy from energy, to inject input items into cell, at the request of src
|
||||
*
|
||||
* @param energy to be added energy source
|
||||
* @param cell injected cell
|
||||
* @param input to be injected items
|
||||
* @param src action source
|
||||
* @param cell injected cell
|
||||
* @param input to be injected items
|
||||
* @param src action source
|
||||
*
|
||||
* @return items that failed to insert.
|
||||
*/
|
||||
IAEItemStack poweredInsert(IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack input, BaseActionSource src);
|
||||
|
||||
IAEItemStack poweredInsert( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack input, BaseActionSource src );
|
||||
}
|
||||
|
|
|
@ -23,10 +23,12 @@
|
|||
|
||||
package appeng.api.storage;
|
||||
|
||||
|
||||
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
||||
|
||||
/**
|
||||
* represents the internal behavior of a {@link ITileStorageMonitorable} use it to get this value for a tile, or part.
|
||||
*
|
||||
|
@ -44,5 +46,4 @@ public interface IStorageMonitorable
|
|||
* Access the fluid inventory for the monitorable storage.
|
||||
*/
|
||||
IMEMonitor<IAEFluidStack> getFluidInventory();
|
||||
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import appeng.api.networking.security.BaseActionSource;
|
|||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
|
||||
|
||||
/**
|
||||
* Common implementation of a simple class that monitors injection/extraction of a inventory to send events to a list of
|
||||
* listeners.
|
||||
|
@ -51,106 +52,89 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
|
|||
|
||||
protected boolean hasChanged = true;
|
||||
|
||||
public MEMonitorHandler( IMEInventoryHandler<StackType> t )
|
||||
{
|
||||
this.internalHandler = t;
|
||||
this.cachedList = (IItemList<StackType>) t.getChannel().createList();
|
||||
}
|
||||
|
||||
public MEMonitorHandler( IMEInventoryHandler<StackType> t, StorageChannel chan )
|
||||
{
|
||||
this.internalHandler = t;
|
||||
this.cachedList = (IItemList<StackType>) chan.createList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener( IMEMonitorHandlerReceiver<StackType> l, Object verificationToken )
|
||||
{
|
||||
this.listeners.put( l, verificationToken );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener( IMEMonitorHandlerReceiver<StackType> l )
|
||||
{
|
||||
this.listeners.remove( l );
|
||||
}
|
||||
|
||||
@Override
|
||||
public StackType injectItems( StackType input, Actionable mode, BaseActionSource src )
|
||||
{
|
||||
if( mode == Actionable.SIMULATE )
|
||||
return this.getHandler().injectItems( input, mode, src );
|
||||
return this.monitorDifference( input.copy(), this.getHandler().injectItems( input, mode, src ), false, src );
|
||||
}
|
||||
|
||||
protected IMEInventoryHandler<StackType> getHandler()
|
||||
{
|
||||
return this.internalHandler;
|
||||
}
|
||||
|
||||
private StackType monitorDifference( IAEStack original, StackType leftOvers, boolean extraction, BaseActionSource src )
|
||||
{
|
||||
StackType diff = (StackType) original.copy();
|
||||
|
||||
if( extraction )
|
||||
diff.setStackSize( leftOvers == null ? 0 : -leftOvers.getStackSize() );
|
||||
else if( leftOvers != null )
|
||||
diff.decStackSize( leftOvers.getStackSize() );
|
||||
|
||||
if( diff.getStackSize() != 0 )
|
||||
this.postChangesToListeners( ImmutableList.of( diff ), src );
|
||||
|
||||
return leftOvers;
|
||||
}
|
||||
|
||||
protected void postChangesToListeners( Iterable<StackType> changes, BaseActionSource src )
|
||||
{
|
||||
this.notifyListenersOfChange( changes, src );
|
||||
}
|
||||
|
||||
protected void notifyListenersOfChange( Iterable<StackType> diff, BaseActionSource src )
|
||||
{
|
||||
this.hasChanged = true;// need to update the cache.
|
||||
Iterator<Entry<IMEMonitorHandlerReceiver<StackType>, Object>> i = this.getListeners();
|
||||
while( i.hasNext() )
|
||||
{
|
||||
Entry<IMEMonitorHandlerReceiver<StackType>, Object> o = i.next();
|
||||
IMEMonitorHandlerReceiver<StackType> receiver = o.getKey();
|
||||
if( receiver.isValid( o.getValue() ) )
|
||||
receiver.postChange( this, diff, src );
|
||||
else
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
|
||||
protected Iterator<Entry<IMEMonitorHandlerReceiver<StackType>, Object>> getListeners()
|
||||
{
|
||||
return this.listeners.entrySet().iterator();
|
||||
}
|
||||
|
||||
protected void postChangesToListeners( Iterable<StackType> changes, BaseActionSource src)
|
||||
{
|
||||
this.notifyListenersOfChange( changes, src );
|
||||
}
|
||||
|
||||
protected void notifyListenersOfChange(Iterable<StackType> diff, BaseActionSource src)
|
||||
{
|
||||
this.hasChanged = true;// need to update the cache.
|
||||
Iterator<Entry<IMEMonitorHandlerReceiver<StackType>, Object>> i = this.getListeners();
|
||||
while (i.hasNext())
|
||||
{
|
||||
Entry<IMEMonitorHandlerReceiver<StackType>, Object> o = i.next();
|
||||
IMEMonitorHandlerReceiver<StackType> receiver = o.getKey();
|
||||
if ( receiver.isValid( o.getValue() ) )
|
||||
receiver.postChange( this, diff, src );
|
||||
else
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
|
||||
private StackType monitorDifference(IAEStack original, StackType leftOvers, boolean extraction, BaseActionSource src)
|
||||
{
|
||||
StackType diff = (StackType) original.copy();
|
||||
|
||||
if ( extraction )
|
||||
diff.setStackSize( leftOvers == null ? 0 : -leftOvers.getStackSize() );
|
||||
else if ( leftOvers != null )
|
||||
diff.decStackSize( leftOvers.getStackSize() );
|
||||
|
||||
if ( diff.getStackSize() != 0 )
|
||||
this.postChangesToListeners( ImmutableList.of( diff ), src );
|
||||
|
||||
return leftOvers;
|
||||
}
|
||||
|
||||
public MEMonitorHandler(IMEInventoryHandler<StackType> t) {
|
||||
this.internalHandler = t;
|
||||
this.cachedList = (IItemList<StackType>) t.getChannel().createList();
|
||||
}
|
||||
|
||||
public MEMonitorHandler(IMEInventoryHandler<StackType> t, StorageChannel chan) {
|
||||
this.internalHandler = t;
|
||||
this.cachedList = (IItemList<StackType>) chan.createList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(IMEMonitorHandlerReceiver<StackType> l, Object verificationToken)
|
||||
public StackType extractItems( StackType request, Actionable mode, BaseActionSource src )
|
||||
{
|
||||
this.listeners.put( l, verificationToken );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(IMEMonitorHandlerReceiver<StackType> l)
|
||||
{
|
||||
this.listeners.remove( l );
|
||||
}
|
||||
|
||||
@Override
|
||||
public StackType injectItems(StackType input, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
if ( mode == Actionable.SIMULATE )
|
||||
return this.getHandler().injectItems( input, mode, src );
|
||||
return this.monitorDifference(input.copy(), this.getHandler().injectItems(input, mode, src), false, src);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StackType extractItems(StackType request, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
if ( mode == Actionable.SIMULATE )
|
||||
if( mode == Actionable.SIMULATE )
|
||||
return this.getHandler().extractItems( request, mode, src );
|
||||
return this.monitorDifference(request.copy(), this.getHandler().extractItems(request, mode, src), true, src);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<StackType> getStorageList()
|
||||
{
|
||||
if ( this.hasChanged )
|
||||
{
|
||||
this.hasChanged = false;
|
||||
this.cachedList.resetStatus();
|
||||
return this.getAvailableItems( this.cachedList );
|
||||
}
|
||||
|
||||
return this.cachedList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<StackType> getAvailableItems(IItemList out)
|
||||
{
|
||||
return this.getHandler().getAvailableItems( out );
|
||||
return this.monitorDifference( request.copy(), this.getHandler().extractItems( request, mode, src ), true, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -163,18 +147,33 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
|
|||
public AccessRestriction getAccess()
|
||||
{
|
||||
return this.getHandler().getAccess();
|
||||
} @Override
|
||||
public IItemList<StackType> getStorageList()
|
||||
{
|
||||
if( this.hasChanged )
|
||||
{
|
||||
this.hasChanged = false;
|
||||
this.cachedList.resetStatus();
|
||||
return this.getAvailableItems( this.cachedList );
|
||||
}
|
||||
|
||||
return this.cachedList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrioritized(StackType input)
|
||||
public boolean isPrioritized( StackType input )
|
||||
{
|
||||
return this.getHandler().isPrioritized( input );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAccept(StackType input)
|
||||
public boolean canAccept( StackType input )
|
||||
{
|
||||
return this.getHandler().canAccept( input );
|
||||
} @Override
|
||||
public IItemList<StackType> getAvailableItems( IItemList out )
|
||||
{
|
||||
return this.getHandler().getAvailableItems( out );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -190,9 +189,12 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean validForPass(int i)
|
||||
public boolean validForPass( int i )
|
||||
{
|
||||
return this.getHandler().validForPass( i );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -45,14 +45,14 @@ public enum StorageChannel
|
|||
|
||||
public final Class<? extends IAEStack> type;
|
||||
|
||||
StorageChannel( Class<? extends IAEStack> t )
|
||||
StorageChannel( Class<? extends IAEStack> t )
|
||||
{
|
||||
this.type = t;
|
||||
}
|
||||
|
||||
public IItemList createList()
|
||||
{
|
||||
if ( this == ITEMS )
|
||||
if( this == ITEMS )
|
||||
return AEApi.instance().storage().createItemList();
|
||||
else
|
||||
return AEApi.instance().storage().createFluidList();
|
||||
|
|
|
@ -23,9 +23,11 @@
|
|||
|
||||
package appeng.api.storage.data;
|
||||
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
|
||||
/**
|
||||
* An alternate version of FluidStack for AE to keep tabs on things easier, and
|
||||
* to support larger storage. stackSizes of getFluidStack will be capped.
|
||||
|
@ -36,7 +38,6 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
* Don't Implement.
|
||||
*
|
||||
* Construct with Util.createFluidStack( FluidStack )
|
||||
*
|
||||
*/
|
||||
public interface IAEFluidStack extends IAEStack<IAEFluidStack>
|
||||
{
|
||||
|
@ -48,6 +49,14 @@ public interface IAEFluidStack extends IAEStack<IAEFluidStack>
|
|||
*/
|
||||
FluidStack getFluidStack();
|
||||
|
||||
/**
|
||||
* Combines two IAEItemStacks via addition.
|
||||
*
|
||||
* @param option , to add to the current one.
|
||||
*/
|
||||
@Override
|
||||
void add( IAEFluidStack option );
|
||||
|
||||
/**
|
||||
* create a AE Fluid clone.
|
||||
*
|
||||
|
@ -56,20 +65,10 @@ public interface IAEFluidStack extends IAEStack<IAEFluidStack>
|
|||
@Override
|
||||
IAEFluidStack copy();
|
||||
|
||||
/**
|
||||
* Combines two IAEItemStacks via addition.
|
||||
*
|
||||
* @param option
|
||||
* , to add to the current one.
|
||||
*/
|
||||
@Override
|
||||
void add(IAEFluidStack option);
|
||||
|
||||
/**
|
||||
* quick way to get access to the Forge Fluid Definition.
|
||||
*
|
||||
* @return fluid definition
|
||||
*/
|
||||
Fluid getFluid();
|
||||
|
||||
}
|
||||
|
|
|
@ -23,9 +23,11 @@
|
|||
|
||||
package appeng.api.storage.data;
|
||||
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
/**
|
||||
* An alternate version of ItemStack for AE to keep tabs on things easier, and to support larger storage. stackSizes of
|
||||
* getItemStack will be capped.
|
||||
|
@ -46,14 +48,6 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
|
|||
*/
|
||||
ItemStack getItemStack();
|
||||
|
||||
/**
|
||||
* create a AE Item clone
|
||||
*
|
||||
* @return the copy
|
||||
*/
|
||||
@Override
|
||||
IAEItemStack copy();
|
||||
|
||||
/**
|
||||
* is there NBT Data for this item?
|
||||
*
|
||||
|
@ -64,11 +58,18 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
|
|||
/**
|
||||
* Combines two IAEItemStacks via addition.
|
||||
*
|
||||
* @param option
|
||||
* to add to the current one.
|
||||
* @param option to add to the current one.
|
||||
*/
|
||||
@Override
|
||||
void add(IAEItemStack option);
|
||||
void add( IAEItemStack option );
|
||||
|
||||
/**
|
||||
* create a AE Item clone
|
||||
*
|
||||
* @return the copy
|
||||
*/
|
||||
@Override
|
||||
IAEItemStack copy();
|
||||
|
||||
/**
|
||||
* quick way to get access to the MC Item Definition.
|
||||
|
@ -85,21 +86,23 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
|
|||
/**
|
||||
* Compare the Ore Dictionary ID for this to another item.
|
||||
*/
|
||||
boolean sameOre(IAEItemStack is);
|
||||
boolean sameOre( IAEItemStack is );
|
||||
|
||||
/**
|
||||
* compare the item/damage/nbt of the stack.
|
||||
*
|
||||
* @param otherStack to be compared item
|
||||
*
|
||||
* @return true if it is the same type (same item, damage, nbt)
|
||||
*/
|
||||
boolean isSameType(IAEItemStack otherStack);
|
||||
boolean isSameType( IAEItemStack otherStack );
|
||||
|
||||
/**
|
||||
* compare the item/damage/nbt of the stack.
|
||||
*
|
||||
* @param stored to be compared item
|
||||
*
|
||||
* @return true if it is the same type (same item, damage, nbt)
|
||||
*/
|
||||
boolean isSameType(ItemStack stored);
|
||||
boolean isSameType( ItemStack stored );
|
||||
}
|
|
@ -33,6 +33,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
|
||||
|
||||
public interface IAEStack<StackType extends IAEStack>
|
||||
{
|
||||
|
||||
|
@ -41,7 +42,7 @@ public interface IAEStack<StackType extends IAEStack>
|
|||
*
|
||||
* @param is added item
|
||||
*/
|
||||
void add(StackType is);
|
||||
void add( StackType is );
|
||||
|
||||
/**
|
||||
* number of items in the stack.
|
||||
|
@ -53,10 +54,9 @@ public interface IAEStack<StackType extends IAEStack>
|
|||
/**
|
||||
* changes the number of items in the stack.
|
||||
*
|
||||
* @param stackSize
|
||||
* , ItemStack.stackSize = N
|
||||
* @param stackSize , ItemStack.stackSize = N
|
||||
*/
|
||||
StackType setStackSize(long stackSize);
|
||||
StackType setStackSize( long stackSize );
|
||||
|
||||
/**
|
||||
* Same as getStackSize, but for requestable items. ( LP )
|
||||
|
@ -70,7 +70,7 @@ public interface IAEStack<StackType extends IAEStack>
|
|||
*
|
||||
* @return basically itemStack.stackSize = N but for setStackSize items.
|
||||
*/
|
||||
StackType setCountRequestable(long countRequestable);
|
||||
StackType setCountRequestable( long countRequestable );
|
||||
|
||||
/**
|
||||
* true, if the item can be crafted.
|
||||
|
@ -84,7 +84,7 @@ public interface IAEStack<StackType extends IAEStack>
|
|||
*
|
||||
* @param isCraftable can item be crafted
|
||||
*/
|
||||
StackType setCraftable(boolean isCraftable);
|
||||
StackType setCraftable( boolean isCraftable );
|
||||
|
||||
/**
|
||||
* clears, requestable, craftable, and stack sizes.
|
||||
|
@ -103,33 +103,33 @@ public interface IAEStack<StackType extends IAEStack>
|
|||
*
|
||||
* @param i additional stack size
|
||||
*/
|
||||
void incStackSize(long i);
|
||||
void incStackSize( long i );
|
||||
|
||||
/**
|
||||
* removes some from the stack size.
|
||||
*/
|
||||
void decStackSize(long i);
|
||||
void decStackSize( long i );
|
||||
|
||||
/**
|
||||
* adds items to the requestable
|
||||
*
|
||||
* @param i increased amount of requested items
|
||||
*/
|
||||
void incCountRequestable(long i);
|
||||
void incCountRequestable( long i );
|
||||
|
||||
/**
|
||||
* removes items from the requestable
|
||||
*
|
||||
* @param i decreased amount of requested items
|
||||
*/
|
||||
void decCountRequestable(long i);
|
||||
void decCountRequestable( long i );
|
||||
|
||||
/**
|
||||
* write to a NBTTagCompound.
|
||||
*
|
||||
* @param i to be written data
|
||||
*/
|
||||
void writeToNBT(NBTTagCompound i);
|
||||
void writeToNBT( NBTTagCompound i );
|
||||
|
||||
/**
|
||||
* Compare stacks using precise logic.
|
||||
|
@ -141,29 +141,32 @@ public interface IAEStack<StackType extends IAEStack>
|
|||
* IAEFluidStack, FluidStack
|
||||
*
|
||||
* @param obj compared object
|
||||
*
|
||||
* @return true if they are the same.
|
||||
*/
|
||||
@Override
|
||||
boolean equals(Object obj);
|
||||
boolean equals( Object obj );
|
||||
|
||||
/**
|
||||
* compare stacks using fuzzy logic
|
||||
*
|
||||
* a IAEItemStack to another AEItemStack or a ItemStack.
|
||||
*
|
||||
* @param st stacks
|
||||
* @param st stacks
|
||||
* @param mode used fuzzy mode
|
||||
*
|
||||
* @return true if two stacks are equal based on AE Fuzzy Comparison.
|
||||
*/
|
||||
boolean fuzzyComparison(Object st, FuzzyMode mode);
|
||||
boolean fuzzyComparison( Object st, FuzzyMode mode );
|
||||
|
||||
/**
|
||||
* Slower for disk saving, but smaller/more efficient for packets.
|
||||
*
|
||||
* @param data to be written data
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
void writeToPacket(ByteBuf data) throws IOException;
|
||||
void writeToPacket( ByteBuf data ) throws IOException;
|
||||
|
||||
/**
|
||||
* Clone the Item / Fluid Stack
|
||||
|
@ -200,5 +203,4 @@ public interface IAEStack<StackType extends IAEStack>
|
|||
* @return ITEM or FLUID
|
||||
*/
|
||||
StorageChannel getChannel();
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
|
||||
import appeng.api.features.IItemComparison;
|
||||
|
||||
|
||||
/**
|
||||
* Don't cast this... either compare with it, or copy it.
|
||||
*
|
||||
|
@ -45,14 +46,14 @@ public interface IAETagCompound
|
|||
* compare to other NBTTagCompounds or IAETagCompounds
|
||||
*
|
||||
* @param a compared object
|
||||
*
|
||||
* @return true, if they are the same.
|
||||
*/
|
||||
@Override
|
||||
boolean equals(Object a);
|
||||
boolean equals( Object a );
|
||||
|
||||
/**
|
||||
* @return the special comparison for this tag
|
||||
*/
|
||||
IItemComparison getSpecialComparison();
|
||||
|
||||
}
|
|
@ -28,6 +28,7 @@ import java.util.Collection;
|
|||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a list of items in AE.
|
||||
*
|
||||
|
@ -47,13 +48,15 @@ public interface IItemContainer<StackType extends IAEStack>
|
|||
|
||||
/**
|
||||
* @param i compared item
|
||||
*
|
||||
* @return a stack equivalent to the stack passed in, but with the correct stack size information, or null if its
|
||||
* not present
|
||||
* not present
|
||||
*/
|
||||
StackType findPrecise(StackType i);
|
||||
StackType findPrecise( StackType i );
|
||||
|
||||
/**
|
||||
* @param input compared item
|
||||
*
|
||||
* @return a list of relevant fuzzy matched stacks
|
||||
*/
|
||||
Collection<StackType> findFuzzy( StackType input, FuzzyMode fuzzy );
|
||||
|
@ -62,5 +65,4 @@ public interface IItemContainer<StackType extends IAEStack>
|
|||
* @return true if there are no items in the list
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
}
|
|
@ -23,8 +23,10 @@
|
|||
|
||||
package appeng.api.storage.data;
|
||||
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a list of items in AE.
|
||||
*
|
||||
|
@ -78,5 +80,4 @@ public interface IItemList<StackType extends IAEStack> extends IItemContainer<St
|
|||
* resets stack sizes to 0.
|
||||
*/
|
||||
void resetStatus();
|
||||
|
||||
}
|
|
@ -38,39 +38,39 @@ import net.minecraft.util.StatCollector;
|
|||
public enum AEColor
|
||||
{
|
||||
|
||||
White("gui.appliedenergistics2.White", 0xBEBEBE, 0xDBDBDB, 0xFAFAFA),
|
||||
White( "gui.appliedenergistics2.White", 0xBEBEBE, 0xDBDBDB, 0xFAFAFA ),
|
||||
|
||||
Orange("gui.appliedenergistics2.Orange", 0xF99739, 0xFAAE44, 0xF4DEC3),
|
||||
Orange( "gui.appliedenergistics2.Orange", 0xF99739, 0xFAAE44, 0xF4DEC3 ),
|
||||
|
||||
Magenta("gui.appliedenergistics2.Magenta", 0x821E82, 0xB82AB8, 0xC598C8),
|
||||
Magenta( "gui.appliedenergistics2.Magenta", 0x821E82, 0xB82AB8, 0xC598C8 ),
|
||||
|
||||
LightBlue("gui.appliedenergistics2.LightBlue", 0x628DCB, 0x82ACE7, 0xD8F6FF),
|
||||
LightBlue( "gui.appliedenergistics2.LightBlue", 0x628DCB, 0x82ACE7, 0xD8F6FF ),
|
||||
|
||||
Yellow("gui.appliedenergistics2.Yellow", 0xFFF7AA, 0xF8FF4A, 0xFFFFE8),
|
||||
Yellow( "gui.appliedenergistics2.Yellow", 0xFFF7AA, 0xF8FF4A, 0xFFFFE8 ),
|
||||
|
||||
Lime("gui.appliedenergistics2.Lime", 0x7CFF4A, 0xBBFF51, 0xE7F7D7),
|
||||
Lime( "gui.appliedenergistics2.Lime", 0x7CFF4A, 0xBBFF51, 0xE7F7D7 ),
|
||||
|
||||
Pink("gui.appliedenergistics2.Pink", 0xDC8DB5, 0xF8B5D7, 0xF7DEEB),
|
||||
Pink( "gui.appliedenergistics2.Pink", 0xDC8DB5, 0xF8B5D7, 0xF7DEEB ),
|
||||
|
||||
Gray("gui.appliedenergistics2.Gray", 0x7C7C7C, 0xA0A0A0, 0xC9C9C9),
|
||||
Gray( "gui.appliedenergistics2.Gray", 0x7C7C7C, 0xA0A0A0, 0xC9C9C9 ),
|
||||
|
||||
LightGray("gui.appliedenergistics2.LightGray", 0x9D9D9D, 0xCDCDCD, 0xEFEFEF),
|
||||
LightGray( "gui.appliedenergistics2.LightGray", 0x9D9D9D, 0xCDCDCD, 0xEFEFEF ),
|
||||
|
||||
Cyan("gui.appliedenergistics2.Cyan", 0x2F9BA5, 0x51AAC6, 0xAEDDF4),
|
||||
Cyan( "gui.appliedenergistics2.Cyan", 0x2F9BA5, 0x51AAC6, 0xAEDDF4 ),
|
||||
|
||||
Purple("gui.appliedenergistics2.Purple", 0x8230B2, 0xA453CE, 0xC7A3CC),
|
||||
Purple( "gui.appliedenergistics2.Purple", 0x8230B2, 0xA453CE, 0xC7A3CC ),
|
||||
|
||||
Blue("gui.appliedenergistics2.Blue", 0x2D29A0, 0x514AFF, 0xDDE6FF),
|
||||
Blue( "gui.appliedenergistics2.Blue", 0x2D29A0, 0x514AFF, 0xDDE6FF ),
|
||||
|
||||
Brown("gui.appliedenergistics2.Brown", 0x724E35, 0xB7967F, 0xE0D2C8),
|
||||
Brown( "gui.appliedenergistics2.Brown", 0x724E35, 0xB7967F, 0xE0D2C8 ),
|
||||
|
||||
Green("gui.appliedenergistics2.Green", 0x45A021, 0x60E32E, 0xE3F2E3),
|
||||
Green( "gui.appliedenergistics2.Green", 0x45A021, 0x60E32E, 0xE3F2E3 ),
|
||||
|
||||
Red("gui.appliedenergistics2.Red", 0xA50029, 0xFF003C, 0xFFE6ED),
|
||||
Red( "gui.appliedenergistics2.Red", 0xA50029, 0xFF003C, 0xFFE6ED ),
|
||||
|
||||
Black("gui.appliedenergistics2.Black", 0x2B2B2B, 0x565656, 0x848484),
|
||||
Black( "gui.appliedenergistics2.Black", 0x2B2B2B, 0x565656, 0x848484 ),
|
||||
|
||||
Transparent("gui.appliedenergistics2.Fluix", 0x1B2344, 0x895CA8, 0xD7BBEC);
|
||||
Transparent( "gui.appliedenergistics2.Fluix", 0x1B2344, 0x895CA8, 0xD7BBEC );
|
||||
|
||||
public static final List<AEColor> VALID_COLORS = Arrays.asList( White, Orange, Magenta, LightBlue, Yellow, Lime, Pink, Gray, LightGray, Cyan, Purple, Blue, Brown, Green, Red, Black );
|
||||
|
||||
|
@ -94,7 +94,8 @@ public enum AEColor
|
|||
*/
|
||||
final public int whiteVariant;
|
||||
|
||||
AEColor(String unlocalizedName, int blackHex, int medHex, int whiteHex) {
|
||||
AEColor( String unlocalizedName, int blackHex, int medHex, int whiteHex )
|
||||
{
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
this.blackVariant = blackHex;
|
||||
this.mediumVariant = medHex;
|
||||
|
@ -104,7 +105,7 @@ public enum AEColor
|
|||
/**
|
||||
* Logic to see which colors match each other.. special handle for Transparent
|
||||
*/
|
||||
public boolean matches(AEColor color)
|
||||
public boolean matches( AEColor color )
|
||||
{
|
||||
return this == Transparent || color == Transparent || this == color;
|
||||
}
|
||||
|
|
|
@ -64,9 +64,10 @@ public class DimensionalCoord extends WorldCoord
|
|||
return new DimensionalCoord( this );
|
||||
}
|
||||
|
||||
public boolean isEqual( DimensionalCoord c )
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return this.x == c.x && this.y == c.y && this.z == c.z && c.w == this.w;
|
||||
return super.hashCode() ^ this.dimId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,15 +76,9 @@ public class DimensionalCoord extends WorldCoord
|
|||
return obj instanceof DimensionalCoord && this.isEqual( (DimensionalCoord) obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
public boolean isEqual( DimensionalCoord c )
|
||||
{
|
||||
return super.hashCode() ^ this.dimId;
|
||||
}
|
||||
|
||||
public boolean isInWorld( World world )
|
||||
{
|
||||
return this.w == world;
|
||||
return this.x == c.x && this.y == c.y && this.z == c.z && c.w == this.w;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -92,6 +87,11 @@ public class DimensionalCoord extends WorldCoord
|
|||
return "dimension=" + this.dimId + ", " + super.toString();
|
||||
}
|
||||
|
||||
public boolean isInWorld( World world )
|
||||
{
|
||||
return this.w == world;
|
||||
}
|
||||
|
||||
public World getWorld()
|
||||
{
|
||||
return this.w;
|
||||
|
|
|
@ -49,40 +49,41 @@ public interface IConfigManager
|
|||
/**
|
||||
* used to initialize the configuration manager, should be called for all settings.
|
||||
*
|
||||
* @param settingName name of setting
|
||||
* @param settingName name of setting
|
||||
* @param defaultValue default value of setting
|
||||
*/
|
||||
void registerSetting(Settings settingName, Enum<?> defaultValue);
|
||||
void registerSetting( Settings settingName, Enum<?> defaultValue );
|
||||
|
||||
/**
|
||||
* Get Value of a particular setting
|
||||
*
|
||||
* @param settingName name of setting
|
||||
*
|
||||
* @return value of setting
|
||||
*/
|
||||
Enum<?> getSetting(Settings settingName);
|
||||
Enum<?> getSetting( Settings settingName );
|
||||
|
||||
/**
|
||||
* Change setting
|
||||
*
|
||||
* @param settingName to be changed setting
|
||||
* @param newValue new value for setting
|
||||
* @param newValue new value for setting
|
||||
*
|
||||
* @return changed setting
|
||||
*/
|
||||
Enum<?> putSetting(Settings settingName, Enum<?> newValue);
|
||||
Enum<?> putSetting( Settings settingName, Enum<?> newValue );
|
||||
|
||||
/**
|
||||
* write all settings to the NBT Tag so they can be read later.
|
||||
*
|
||||
* @param destination to be written nbt tag
|
||||
*/
|
||||
void writeToNBT(NBTTagCompound destination);
|
||||
void writeToNBT( NBTTagCompound destination );
|
||||
|
||||
/**
|
||||
* Only works after settings have been registered
|
||||
*
|
||||
* @param src to be read nbt tag
|
||||
*/
|
||||
void readFromNBT(NBTTagCompound src);
|
||||
|
||||
void readFromNBT( NBTTagCompound src );
|
||||
}
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
|
||||
package appeng.api.util;
|
||||
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
|
||||
/**
|
||||
* Nearly all of AE's Tile Entities implement IOrientable.
|
||||
*
|
||||
|
@ -52,9 +54,9 @@ public interface IOrientable
|
|||
|
||||
/**
|
||||
* Update the orientation
|
||||
*
|
||||
* @param Forward new forward direction
|
||||
* @param Up new upwards direction
|
||||
* @param Up new upwards direction
|
||||
*/
|
||||
void setOrientation(ForgeDirection Forward, ForgeDirection Up);
|
||||
|
||||
void setOrientation( ForgeDirection Forward, ForgeDirection Up );
|
||||
}
|
|
@ -39,12 +39,16 @@ public class WorldCoord
|
|||
public int y;
|
||||
public int z;
|
||||
|
||||
public WorldCoord add( ForgeDirection direction, int length )
|
||||
public WorldCoord( TileEntity s )
|
||||
{
|
||||
this.x += direction.offsetX * length;
|
||||
this.y += direction.offsetY * length;
|
||||
this.z += direction.offsetZ * length;
|
||||
return this;
|
||||
this( s.xCoord, s.yCoord, s.zCoord );
|
||||
}
|
||||
|
||||
public WorldCoord( int _x, int _y, int _z )
|
||||
{
|
||||
this.x = _x;
|
||||
this.y = _y;
|
||||
this.z = _z;
|
||||
}
|
||||
|
||||
public WorldCoord subtract( ForgeDirection direction, int length )
|
||||
|
@ -87,18 +91,6 @@ public class WorldCoord
|
|||
return this;
|
||||
}
|
||||
|
||||
public WorldCoord( int _x, int _y, int _z )
|
||||
{
|
||||
this.x = _x;
|
||||
this.y = _y;
|
||||
this.z = _z;
|
||||
}
|
||||
|
||||
public WorldCoord( TileEntity s )
|
||||
{
|
||||
this( s.xCoord, s.yCoord, s.zCoord );
|
||||
}
|
||||
|
||||
/**
|
||||
* Will Return NULL if it's at some diagonal!
|
||||
*/
|
||||
|
@ -112,22 +104,22 @@ public class WorldCoord
|
|||
int ylen = Math.abs( oy );
|
||||
int zlen = Math.abs( oz );
|
||||
|
||||
if ( loc.isEqual( this.copy().add( ForgeDirection.EAST, xlen ) ) )
|
||||
if( loc.isEqual( this.copy().add( ForgeDirection.EAST, xlen ) ) )
|
||||
return ForgeDirection.EAST;
|
||||
|
||||
if ( loc.isEqual( this.copy().add( ForgeDirection.WEST, xlen ) ) )
|
||||
if( loc.isEqual( this.copy().add( ForgeDirection.WEST, xlen ) ) )
|
||||
return ForgeDirection.WEST;
|
||||
|
||||
if ( loc.isEqual( this.copy().add( ForgeDirection.NORTH, zlen ) ) )
|
||||
if( loc.isEqual( this.copy().add( ForgeDirection.NORTH, zlen ) ) )
|
||||
return ForgeDirection.NORTH;
|
||||
|
||||
if ( loc.isEqual( this.copy().add( ForgeDirection.SOUTH, zlen ) ) )
|
||||
if( loc.isEqual( this.copy().add( ForgeDirection.SOUTH, zlen ) ) )
|
||||
return ForgeDirection.SOUTH;
|
||||
|
||||
if ( loc.isEqual( this.copy().add( ForgeDirection.UP, ylen ) ) )
|
||||
if( loc.isEqual( this.copy().add( ForgeDirection.UP, ylen ) ) )
|
||||
return ForgeDirection.UP;
|
||||
|
||||
if ( loc.isEqual( this.copy().add( ForgeDirection.DOWN, ylen ) ) )
|
||||
if( loc.isEqual( this.copy().add( ForgeDirection.DOWN, ylen ) ) )
|
||||
return ForgeDirection.DOWN;
|
||||
|
||||
return null;
|
||||
|
@ -138,11 +130,25 @@ public class WorldCoord
|
|||
return this.x == c.x && this.y == c.y && this.z == c.z;
|
||||
}
|
||||
|
||||
public WorldCoord add( ForgeDirection direction, int length )
|
||||
{
|
||||
this.x += direction.offsetX * length;
|
||||
this.y += direction.offsetY * length;
|
||||
this.z += direction.offsetZ * length;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WorldCoord copy()
|
||||
{
|
||||
return new WorldCoord( this.x, this.y, this.z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ( this.y << 24 ) ^ this.x ^ this.z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object obj )
|
||||
{
|
||||
|
@ -154,10 +160,4 @@ public class WorldCoord
|
|||
{
|
||||
return "x=" + this.x + ", y=" + this.y + ", z=" + this.z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ( this.y << 24 ) ^ this.x ^ this.z;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
package appeng.block;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -42,71 +43,78 @@ import appeng.me.helpers.IGridProxyable;
|
|||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class AEBaseItemBlock extends ItemBlock
|
||||
{
|
||||
|
||||
final AEBaseBlock blockType;
|
||||
|
||||
public AEBaseItemBlock(Block id)
|
||||
public AEBaseItemBlock( Block id )
|
||||
{
|
||||
super( id );
|
||||
this.blockType = (AEBaseBlock) id;
|
||||
this.hasSubtypes = this.blockType.hasSubtypes;
|
||||
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
MinecraftForgeClient.registerItemRenderer( this, ItemRenderer.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int dmg)
|
||||
public int getMetadata( int dmg )
|
||||
{
|
||||
if ( this.hasSubtypes )
|
||||
if( this.hasSubtypes )
|
||||
return dmg;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack is)
|
||||
{
|
||||
return this.blockType.getUnlocalizedName( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings("unchecked")
|
||||
public final void addInformation(ItemStack itemStack, EntityPlayer player, List toolTip, boolean advancedTooltips)
|
||||
@SideOnly( Side.CLIENT )
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public final void addInformation( ItemStack itemStack, EntityPlayer player, List toolTip, boolean advancedTooltips )
|
||||
{
|
||||
this.addCheckedInformation( itemStack, player, toolTip, advancedTooltips );
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addCheckedInformation(ItemStack itemStack, EntityPlayer player, List<String> toolTip, boolean advancedToolTips)
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void addCheckedInformation( ItemStack itemStack, EntityPlayer player, List<String> toolTip, boolean advancedToolTips )
|
||||
{
|
||||
this.blockType.addInformation( itemStack, player, toolTip, advancedToolTips );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
|
||||
public boolean isBookEnchantable( ItemStack itemstack1, ItemStack itemstack2 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName( ItemStack is )
|
||||
{
|
||||
return this.blockType.getUnlocalizedName( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt( ItemStack stack, EntityPlayer player, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata )
|
||||
{
|
||||
ForgeDirection up = ForgeDirection.UNKNOWN;
|
||||
ForgeDirection forward = ForgeDirection.UNKNOWN;
|
||||
|
||||
IOrientable ori = null;
|
||||
|
||||
if ( this.blockType.hasBlockTileEntity() )
|
||||
if( this.blockType.hasBlockTileEntity() )
|
||||
{
|
||||
if ( this.blockType instanceof BlockLightDetector )
|
||||
if( this.blockType instanceof BlockLightDetector )
|
||||
{
|
||||
up = ForgeDirection.getOrientation( side );
|
||||
if ( up == ForgeDirection.UP || up == ForgeDirection.DOWN )
|
||||
if( up == ForgeDirection.UP || up == ForgeDirection.DOWN )
|
||||
forward = ForgeDirection.SOUTH;
|
||||
else
|
||||
forward = ForgeDirection.UP;
|
||||
}
|
||||
else if ( this.blockType instanceof BlockWireless || this.blockType instanceof BlockSkyCompass )
|
||||
else if( this.blockType instanceof BlockWireless || this.blockType instanceof BlockSkyCompass )
|
||||
{
|
||||
forward = ForgeDirection.getOrientation( side );
|
||||
if ( forward == ForgeDirection.UP || forward == ForgeDirection.DOWN )
|
||||
if( forward == ForgeDirection.UP || forward == ForgeDirection.DOWN )
|
||||
up = ForgeDirection.SOUTH;
|
||||
else
|
||||
up = ForgeDirection.UP;
|
||||
|
@ -115,31 +123,31 @@ public class AEBaseItemBlock extends ItemBlock
|
|||
{
|
||||
up = ForgeDirection.UP;
|
||||
|
||||
byte rotation = (byte) (MathHelper.floor_double( (player.rotationYaw * 4F) / 360F + 2.5D ) & 3);
|
||||
byte rotation = (byte) ( MathHelper.floor_double( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 );
|
||||
|
||||
switch (rotation)
|
||||
switch( rotation )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
forward = ForgeDirection.SOUTH;
|
||||
break;
|
||||
case 1:
|
||||
forward = ForgeDirection.WEST;
|
||||
break;
|
||||
case 2:
|
||||
forward = ForgeDirection.NORTH;
|
||||
break;
|
||||
case 3:
|
||||
forward = ForgeDirection.EAST;
|
||||
break;
|
||||
default:
|
||||
case 0:
|
||||
forward = ForgeDirection.SOUTH;
|
||||
break;
|
||||
case 1:
|
||||
forward = ForgeDirection.WEST;
|
||||
break;
|
||||
case 2:
|
||||
forward = ForgeDirection.NORTH;
|
||||
break;
|
||||
case 3:
|
||||
forward = ForgeDirection.EAST;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( player.rotationPitch > 65 )
|
||||
if( player.rotationPitch > 65 )
|
||||
{
|
||||
up = forward.getOpposite();
|
||||
forward = ForgeDirection.UP;
|
||||
}
|
||||
else if ( player.rotationPitch < -65 )
|
||||
else if( player.rotationPitch < -65 )
|
||||
{
|
||||
up = forward.getOpposite();
|
||||
forward = ForgeDirection.DOWN;
|
||||
|
@ -147,45 +155,45 @@ public class AEBaseItemBlock extends ItemBlock
|
|||
}
|
||||
}
|
||||
|
||||
if ( this.blockType instanceof IOrientableBlock )
|
||||
if( this.blockType instanceof IOrientableBlock )
|
||||
{
|
||||
ori = ((IOrientableBlock) this.blockType).getOrientable( w, x, y, z );
|
||||
ori = ( (IOrientableBlock) this.blockType ).getOrientable( w, x, y, z );
|
||||
up = ForgeDirection.getOrientation( side );
|
||||
forward = ForgeDirection.SOUTH;
|
||||
if ( up.offsetY == 0 )
|
||||
if( up.offsetY == 0 )
|
||||
forward = ForgeDirection.UP;
|
||||
|
||||
ori.setOrientation( forward, up );
|
||||
}
|
||||
|
||||
if ( !this.blockType.isValidOrientation( w, x, y, z, forward, up ) )
|
||||
if( !this.blockType.isValidOrientation( w, x, y, z, forward, up ) )
|
||||
return false;
|
||||
|
||||
if ( super.placeBlockAt( stack, player, w, x, y, z, side, hitX, hitY, hitZ, metadata ) )
|
||||
if( super.placeBlockAt( stack, player, w, x, y, z, side, hitX, hitY, hitZ, metadata ) )
|
||||
{
|
||||
if ( this.blockType.hasBlockTileEntity() && !(this.blockType instanceof BlockLightDetector) )
|
||||
if( this.blockType.hasBlockTileEntity() && !( this.blockType instanceof BlockLightDetector ) )
|
||||
{
|
||||
AEBaseTile tile = this.blockType.getTileEntity( w, x, y, z );
|
||||
ori = tile;
|
||||
|
||||
if ( tile == null )
|
||||
if( tile == null )
|
||||
return true;
|
||||
|
||||
if ( ori.canBeRotated() && !this.blockType.hasCustomRotation() )
|
||||
if( ori.canBeRotated() && !this.blockType.hasCustomRotation() )
|
||||
{
|
||||
if ( ori.getForward() == null || ori.getUp() == null || // null
|
||||
if( ori.getForward() == null || ori.getUp() == null || // null
|
||||
tile.getForward() == ForgeDirection.UNKNOWN || ori.getUp() == ForgeDirection.UNKNOWN )
|
||||
ori.setOrientation( forward, up );
|
||||
}
|
||||
|
||||
if ( tile instanceof IGridProxyable )
|
||||
if( tile instanceof IGridProxyable )
|
||||
{
|
||||
((IGridProxyable) tile).getProxy().setOwner( player );
|
||||
( (IGridProxyable) tile ).getProxy().setOwner( player );
|
||||
}
|
||||
|
||||
tile.onPlacement( stack, player, side );
|
||||
}
|
||||
else if ( this.blockType instanceof IOrientableBlock )
|
||||
else if( this.blockType instanceof IOrientableBlock )
|
||||
{
|
||||
ori.setOrientation( forward, up );
|
||||
}
|
||||
|
@ -194,11 +202,4 @@ public class AEBaseItemBlock extends ItemBlock
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue