Compare commits

...

44 Commits

Author SHA1 Message Date
thatsIch 50f141edbd Merge pull request #1094 from thatsIch/e-waila-api
Replace deobf version of Waila with an API stub
2015-03-26 11:34:36 +01:00
thatsIch 0542a58e4b Merge pull request #1086 from thatsIch/b-1061-mekanism
Fixes #1061 Recipes are properly registered with new Mekanism
2015-03-26 11:34:16 +01:00
thatsIch 58db877006 Replaced dynamic regular expressions with compiled pattern 2015-03-26 11:33:08 +01:00
thatsIch dff3364eb5 Replace not needed StringBuffer with String concatenation 2015-03-26 11:24:09 +01:00
thatsIch 88310cf04b Single character string concatentation 2015-03-26 11:23:22 +01:00
thatsIch d81eb1fe2d Unnecessary null check before instanceof 2015-03-26 11:22:31 +01:00
thatsIch d8f452b665 Unnecessary enum modifiers 2015-03-26 11:21:55 +01:00
thatsIch ec05bd994c Typos or word-improvements 2015-03-26 11:20:31 +01:00
thatsIch dff48c07c9 finalized 2015-03-26 11:14:34 +01:00
thatsIch 234d97b8ce Security issues: public static collections 2015-03-26 11:13:24 +01:00
thatsIch 9bf8b4388f Extract ++ and -- from expressions 2015-03-26 11:07:26 +01:00
thatsIch b31f2df58d Unnecessary semicolons 2015-03-26 11:03:46 +01:00
thatsIch 14df50dbf3 Unnecessary modifier in interfaces 2015-03-26 11:03:30 +01:00
thatsIch 6aeca93b85 Unnecessary modifier in enums 2015-03-26 11:03:15 +01:00
thatsIch 3143c871d0 this access 2015-03-26 11:01:57 +01:00
thatsIch 7f7c71a22e Unused imports 2015-03-26 10:58:13 +01:00
thatsIch 05f522580b Unnecessary Javadoc link point to containing class 2015-03-26 10:53:09 +01:00
thatsIch 926af89029 Missing @Override annotation 2015-03-26 10:50:34 +01:00
thatsIch f1248c4c33 Unused imports 2015-03-26 10:49:48 +01:00
thatsIch bd2ee1c5ea Assignment replaceable with operator assignment 2015-03-26 10:41:45 +01:00
thatsIch 8ef286b9d6 Replace call to simple setter from within class with inlined version 2015-03-26 10:27:07 +01:00
thatsIch 4b4693498d Replace call to simple getter from within class with inlined version 2015-03-26 10:23:59 +01:00
thatsIch e41d6a0289 Use StringBuilder for creating appended Strings in a loop 2015-03-26 10:15:33 +01:00
thatsIch c8d716d39f Replace deobf version of Waila with an API stub 2015-03-25 20:53:27 +01:00
thatsIch 33c1535bfa Fixes #1061 Most recipes are properly registered with new Mekanism. 2015-03-25 12:24:21 +01:00
thatsIch 1067d30264 Merge pull request #1078 from thatsIch/b-1077-hotfix-packet-size
Fixes #1077 Hotfix: Opening a terminal will not crash as fast anymore in systems with many items.
2015-03-25 12:19:49 +01:00
thatsIch 96145e75f4 Merge pull request #1075 from thatsIch/b-822-io-port
Fixes #822 Automation of IO Port works as intended again
2015-03-25 12:19:09 +01:00
thatsIch 2ba6dad3b2 Merge pull request #1092 from bakaxyf/patch-1
Update zh_CN.lang
2015-03-25 10:51:02 +01:00
bakaxyf a870393edb Update zh_CN.lang 2015-03-25 16:37:46 +08:00
thatsIch d04bc2fb3c Fixed typo in ToC 2015-03-24 18:39:44 +01:00
thatsIch 9d52e85afa Merge pull request #1083 from thatsIch/b-1076-nei-crash
Fixes #1076 Crash on shift clicking a recipe from NEI
2015-03-24 16:54:08 +01:00
thatsIch 3745e6ce8d Fixes #1076 Crash on shift clicking a recipe from NEI 2015-03-24 13:42:32 +01:00
thatsIch a4c38263d1 Merge pull request #1082 from thatsIch/e-integration-name
Renamed Integration class to upper case
2015-03-24 13:18:14 +01:00
thatsIch c1a7a35192 Renamed Integration class to upper case 2015-03-24 13:17:01 +01:00
thatsIch eb98ec891b Merge pull request #1066 from thatsIch/e-remove-deprecated-access
Removes deprecated method access of LocatableRegistry and getPickBlock
2015-03-24 12:47:55 +01:00
thatsIch 69a5507f96 Merge pull request #1064 from thatsIch/e-updated-public-dependencies
Updated public dependencies
2015-03-24 12:47:18 +01:00
thatsIch a1f43ff51a Fixes #1077 Hotfix: Opening a terminal will not crash as fast anymore in systems with many items. 2015-03-23 16:36:06 +01:00
thatsIch da91585d69 Fixes #822 Automation of IO Port works as inteded again
Top and bottom can insert into input slots 0 - 5 on the left
Sides can extract from output slots 6 - 11 on the eight
2015-03-22 11:07:25 +01:00
thatsIch f138a68f3e Merge pull request #1071 from downslope7/grid-connection-exists-coords
Add coords to duplicate connection GridException.
2015-03-22 07:48:23 +01:00
downslope7 30191eb5ba Add coords to duplicate connection GridException.
This exception isn't caught and crashes the server. Added block coordinates to aid in diagnostics.
2015-03-21 20:05:08 -05:00
thatsIch 4552394f6e Removes deprecated method access of LocatableRegistry and getPickBlock 2015-03-21 16:03:26 +01:00
thatsIch 9c3d3db3fb Updated public dependencies
- FMP
- CCL
- WAILA
- BC
2015-03-21 11:51:11 +01:00
thatsIch 9c1c9056f1 Merge pull request #1063 from KamranMackey/rv2
Fixed a couple typos in en_US.lang.
2015-03-21 11:41:06 +01:00
Kamran Mackey b5582688a3 Fixed a couple typos in en_US.lang. 2015-03-21 03:57:41 -06:00
170 changed files with 873 additions and 698 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
# Applied Energistics 2
## Table of Content
## Table of Contents
* [About](#about)
* [Contacts](#contacts)
+5 -5
View File
@@ -14,12 +14,11 @@ forge_version=10.13.2.1291
# APIs used for development #
#########################################################
cb_minecraft_version=1.7.10
fmp_version=1.1.1.321
code_chicken_lib_version=1.1.1.110
fmp_version=1.1.1.324
code_chicken_lib_version=1.1.3.127
code_chicken_core_version=1.0.4.35
nei_version=1.0.4.90
waila_version=1.5.9_1.7.10
bc_version=6.4.2
bc_version=6.4.3
#########################################################
# API Stubs #
@@ -33,9 +32,10 @@ api_craftguide_version=1
api_ic2_version=1
api_immibis_version=1
api_invtweaks_version=1
api_mekansim_version=1
api_mekansim_version=1.7.10-8.0.1.198
api_mfr_version=1
api_railcraft_version=1
api_rblocks_version=1
api_rf_version=2
api_rotarycraft_version=1
api_waila_version=1.5.10_1.7.10
+3 -3
View File
@@ -43,22 +43,22 @@ dependencies {
compile "codechicken:CodeChickenCore:${config.cb_minecraft_version}-${config.code_chicken_core_version}:dev"
compile "codechicken:NotEnoughItems:${config.cb_minecraft_version}-${config.nei_version}:dev"
compile "mcp.mobius.waila:Waila:${config.waila_version}:dev"
compile "com.mod-buildcraft:buildcraft:${config.bc_version}:dev"
// self compiled APIs
compile(group: 'api', name: 'betterstorage', version: "${config.api_betterstorage_version}")
compile(group: 'api', name: 'coloredlightscore', version: "${config.api_coloredlightscore_version}")
compile(group: 'api', name: 'craftguide', version: "${config.api_craftguide_version}")
compile(group: 'api', name: 'ic2', version: "${config.api_ic2_version}")
compile(group: 'api', name: 'immibis', version: "${config.api_immibis_version}")
compile(group: 'api', name: 'invtweaks', version: "${config.api_invtweaks_version}")
compile(group: 'api', name: 'mekansim', version: "${config.api_mekansim_version}")
compile(group: 'api', name: 'mekanism', version: "${config.api_mekansim_version}", classifier: 'api')
compile(group: 'api', name: 'mfr', version: "${config.api_mfr_version}")
compile(group: 'api', name: 'railcraft', version: "${config.api_railcraft_version}")
compile(group: 'api', name: 'rblocks', version: "${config.api_rblocks_version}")
compile(group: 'api', name: 'rf', version: "${config.api_rf_version}")
compile(group: 'api', name: 'rotarycraft', version: "${config.api_rotarycraft_version}")
compile "appeng:Waila:${config.api_waila_version}:api"
testCompile "junit:junit:4.11"
}
@@ -29,7 +29,7 @@ public enum AccessRestriction
private final int permissionBit;
private AccessRestriction(int v) {
AccessRestriction( int v ) {
this.permissionBit = v;
}
@@ -31,7 +31,7 @@ public enum FuzzyMode
final public float breakPoint;
final public float percentage;
private FuzzyMode(float p) {
FuzzyMode( float p ) {
this.percentage = p;
this.breakPoint = p / 100.0f;
}
@@ -32,7 +32,7 @@ public enum PowerUnits
RF("gui.appliedenergistics2.units.thermalexpansion"), // ThermalExpansion - Redstone Flux
MK("gui.appliedenergistics2.units.mekanism"); // Mekanism - Joules
private PowerUnits(String un) {
PowerUnits( String un ) {
this.unlocalizedName = un;
}
+1 -1
View File
@@ -62,7 +62,7 @@ public enum Settings
return this.values;
}
private Settings( EnumSet set )
Settings( EnumSet set )
{
if ( set == null || set.isEmpty() )
throw new RuntimeException( "Invalid configuration." );
+1 -1
View File
@@ -46,7 +46,7 @@ public enum Upgrades
public final int myTier;
public final HashMap<ItemStack, Integer> supportedMax = new HashMap<ItemStack, Integer>();
private Upgrades( int tier )
Upgrades( int tier )
{
this.myTier = tier;
}
@@ -36,42 +36,42 @@ public interface IGrinderEntry
*
* @return input that the grinder will accept.
*/
public ItemStack getInput();
ItemStack getInput();
/**
* lets you change the grinder recipe by changing its input.
*
* @param input input item
*/
public void setInput(ItemStack input);
void setInput( ItemStack input );
/**
* gets the current output
*
* @return output that the grinder will produce
*/
public ItemStack getOutput();
ItemStack getOutput();
/**
* gets the current output
*
* @return output that the grinder will produce
*/
public ItemStack getOptionalOutput();
ItemStack getOptionalOutput();
/**
* gets the current output
*
* @return output that the grinder will produce
*/
public ItemStack getSecondOptionalOutput();
ItemStack getSecondOptionalOutput();
/**
* allows you to change the output.
*
* @param output output item
*/
public void setOutput(ItemStack output);
void setOutput( ItemStack output );
/**
* stack, and 0.0-1.0 chance that it will be generated.
@@ -79,14 +79,14 @@ public interface IGrinderEntry
* @param output output item
* @param chance generation chance
*/
public void setOptionalOutput(ItemStack output, float chance);
void setOptionalOutput( ItemStack output, float chance );
/**
* 0.0 - 1.0 the chance that the optional output will be generated.
*
* @return chance of optional output
*/
public float getOptionalChance();
float getOptionalChance();
/**
* stack, and 0.0-1.0 chance that it will be generated.
@@ -94,26 +94,26 @@ public interface IGrinderEntry
* @param output second optional output item
* @param chance second optional output chance
*/
public void setSecondOptionalOutput(ItemStack output, float chance);
void setSecondOptionalOutput( ItemStack output, float chance );
/**
* 0.0 - 1.0 the chance that the optional output will be generated.
*
* @return second optional output chance
*/
public float getSecondOptionalChance();
float getSecondOptionalChance();
/**
* Energy cost, in turns.
*
* @return number of turns it takes to produce the output from the input.
*/
public int getEnergyCost();
int getEnergyCost();
/**
* Allows you to adjust the number of turns
*
* @param c number of turns to produce output.
*/
public void setEnergyCost(int c);
void setEnergyCost( int c );
}
@@ -23,10 +23,11 @@
package appeng.api.features;
import net.minecraft.item.ItemStack;
import java.util.List;
import net.minecraft.item.ItemStack;
/**
* Lets you manipulate Grinder Recipes, by adding or editing existing ones.
*/
@@ -38,7 +39,7 @@ public interface IGrinderRegistry
*
* @return currentlyRegisteredRecipes
*/
public List<IGrinderEntry> getRecipes();
List<IGrinderEntry> getRecipes();
/**
* add a new recipe the easy way, in &#8594; out, how many turns., duplicates will not be added.
@@ -47,7 +48,7 @@ public interface IGrinderRegistry
* @param out output
* @param turns amount of turns to turn the input into the output
*/
public void addRecipe(ItemStack in, ItemStack out, int turns);
void addRecipe( ItemStack in, ItemStack out, int turns );
/**
* add a new recipe with optional outputs, duplicates will not be added.
@@ -79,6 +80,6 @@ public interface IGrinderRegistry
* @param input input
* @return identified recipe or null
*/
public IGrinderEntry getRecipeForInput(ItemStack input);
IGrinderEntry getRecipeForInput( ItemStack input );
}
@@ -26,8 +26,8 @@ package appeng.api.features;
public interface IItemComparison
{
public boolean sameAsPrecise(IItemComparison comp);
boolean sameAsPrecise( IItemComparison comp );
public boolean sameAsFuzzy(IItemComparison comp);
boolean sameAsFuzzy( IItemComparison comp );
}
@@ -48,6 +48,6 @@ public interface IItemComparisonProvider
* @param stack item
* @return true, if getComparison will return a valid IItemComparison Object
*/
public boolean canHandle(ItemStack stack);
boolean canHandle( ItemStack stack );
}
@@ -23,7 +23,9 @@
package appeng.api.features;
import net.minecraft.item.ItemStack;
import appeng.api.config.TunnelType;
/**
@@ -41,7 +43,7 @@ public interface IP2PTunnelRegistry
* @param type
* - the type of tunnel
*/
public abstract void addNewAttunement(ItemStack trigger, TunnelType type);
void addNewAttunement( ItemStack trigger, TunnelType type );
/**
* returns null if no attunement can be found.
@@ -58,7 +58,7 @@ public interface IRecipeHandlerRegistry
/**
* @return a new recipe handler, which can be used to parse, and read recipe files.
*/
public IRecipeHandler createNewRecipehandler();
IRecipeHandler createNewRecipehandler();
/**
* resolve sub items by name.
@@ -45,6 +45,6 @@ public interface ISpecialComparisonRegistry
*
* @param prov comparison provider
*/
public void addComparisonProvider(IItemComparisonProvider prov);
void addComparisonProvider( IItemComparisonProvider prov );
}
@@ -29,16 +29,16 @@ import net.minecraft.world.WorldProvider;
public interface IWorldGen
{
public enum WorldGenType
enum WorldGenType
{
CertusQuartz, ChargedCertusQuartz, Meteorites
}
public void disableWorldGenForProviderID(WorldGenType type, Class<? extends WorldProvider> provider);
void disableWorldGenForProviderID( WorldGenType type, Class<? extends WorldProvider> provider );
public void enableWorldGenForDimension(WorldGenType type, int dimID);
void enableWorldGenForDimension( WorldGenType type, int dimID );
public void disableWorldGenForDimension(WorldGenType type, int dimID);
void disableWorldGenForDimension( WorldGenType type, int dimID );
boolean isWorldGenEnabled(WorldGenType type, World w);
@@ -28,5 +28,5 @@ import net.minecraft.item.ItemStack;
public interface IGuiItemObject
{
public ItemStack getItemStack();
ItemStack getItemStack();
}
@@ -23,7 +23,9 @@
package appeng.api.implementations.items;
import net.minecraft.item.ItemStack;
import appeng.api.config.AccessRestriction;
import appeng.api.networking.energy.IAEPowerStorage;
@@ -39,7 +41,7 @@ public interface IAEItemPowerStorage
*
* @return amount unable to be stored
*/
public double injectAEPower(ItemStack is, double amt);
double injectAEPower( ItemStack is, double amt );
/**
* Attempt to extract power from the device, it will extract what it can and
@@ -48,17 +50,17 @@ public interface IAEItemPowerStorage
* @param amt to be extracted power from device
* @return what it could extract
*/
public double extractAEPower(ItemStack is, double amt);
double extractAEPower( ItemStack is, double amt );
/**
* @return the current maximum power ( this can change :P )
*/
public double getAEMaxPower(ItemStack is);
double getAEMaxPower( ItemStack is );
/**
* @return the current AE Power Level, this may exceed getMEMaxPower()
*/
public double getAECurrentPower(ItemStack is);
double getAECurrentPower( ItemStack is );
/**
* Control the power flow by telling what the network can do, either add? or
@@ -66,6 +68,6 @@ public interface IAEItemPowerStorage
*
* @return access restriction of network
*/
public AccessRestriction getPowerFlow(ItemStack is);
AccessRestriction getPowerFlow( ItemStack is );
}
@@ -40,7 +40,7 @@ public interface IGrid
* @param iface face
* @return the IGridCache you requested.
*/
public <C extends IGridCache> C getCache(Class<? extends IGridCache> iface);
<C extends IGridCache> C getCache( Class<? extends IGridCache> iface );
/**
* Post an event into the network event bus.
@@ -49,7 +49,7 @@ public interface IGrid
* - event to post
* @return returns ev back to original poster
*/
public MENetworkEvent postEvent(MENetworkEvent ev);
MENetworkEvent postEvent( MENetworkEvent ev );
/**
* Post an event into the network event bus, but direct it at a single node.
@@ -58,7 +58,7 @@ public interface IGrid
* event to post
* @return returns ev back to original poster
*/
public MENetworkEvent postEventTo(IGridNode node, MENetworkEvent ev);
MENetworkEvent postEventTo( IGridNode node, MENetworkEvent ev );
/**
* get a list of the diversity of classes, you can use this to better detect which machines your interested in,
@@ -66,7 +66,7 @@ public interface IGrid
*
* @return IReadOnlyCollection of all available host types (Of Type IGridHost).
*/
public IReadOnlyCollection<Class<? extends IGridHost>> getMachinesClasses();
IReadOnlyCollection<Class<? extends IGridHost>> getMachinesClasses();
/**
* Get machines on the network.
@@ -74,7 +74,7 @@ public interface IGrid
* @param gridHostClass class of the grid host
* @return IMachineSet of all nodes belonging to hosts of specified class.
*/
public IMachineSet getMachines(Class<? extends IGridHost> gridHostClass);
IMachineSet getMachines( Class<? extends IGridHost> gridHostClass );
/**
* @return IReadOnlyCollection for all nodes on the network, node visitors are preferred.
@@ -84,11 +84,11 @@ public interface IGrid
/**
* @return true if the last node has been removed from the grid.
*/
public boolean isEmpty();
boolean isEmpty();
/**
* @return the node considered the pivot point of the grid.
*/
public IGridNode getPivot();
IGridNode getPivot();
}
@@ -23,13 +23,15 @@
package appeng.api.networking;
import appeng.api.parts.IPart;
import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.EnumSet;
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
@@ -85,7 +87,7 @@ public interface IGridBlock
* @param grid grid
* @param channelsInUse used channels
*/
public void setNetworkStatus(IGrid grid, int channelsInUse);
void setNetworkStatus( IGrid grid, int channelsInUse );
/**
* Determine which sides of the block can be connected too, only used when isWorldAccessible returns true, not used
@@ -108,5 +110,5 @@ public interface IGridBlock
*
* @return the render item stack to use to render this node, null is valid, and will not show this node.
*/
public ItemStack getMachineRepresentation();
ItemStack getMachineRepresentation();
}
@@ -32,6 +32,6 @@ public interface IGridConnectionVisitor extends IGridVisitor
* @param n
* the connection.
*/
public void visitConnection(IGridConnection n);
void visitConnection( IGridConnection n );
}
@@ -23,8 +23,10 @@
package appeng.api.networking;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.parts.IPart;
import appeng.api.util.AECableType;
@@ -48,7 +50,7 @@ public interface IGridHost
* @return a new IGridNode, create these with
* AEApi.INSTANCE().createGridNode( MyIGridBlock )
*/
public IGridNode getGridNode(ForgeDirection dir);
IGridNode getGridNode( ForgeDirection dir );
/**
* Determines how cables render when they connect to this block. Priority is
@@ -56,11 +58,11 @@ public interface IGridHost
*
* @param dir direction
*/
public AECableType getCableConnectionType(ForgeDirection dir);
AECableType getCableConnectionType( ForgeDirection dir );
/**
* break this host, its violating security rules, just break your block, or part.
*/
public void securityBreak();
void securityBreak();
}
@@ -39,6 +39,6 @@ public interface IGridVisitor
*
* @return true to continue visiting nodes beyond this node.
*/
public boolean visitNode(IGridNode n);
boolean visitNode( IGridNode n );
}
@@ -32,6 +32,6 @@ public interface ICraftingCallback
* @param job
* - final job
*/
public void calculationComplete(ICraftingJob job);
void calculationComplete( ICraftingJob job );
}
@@ -40,17 +40,17 @@ public interface IAEPowerStorage extends IEnergySource
*
* @return amount of power which was unable to be stored
*/
public double injectAEPower(double amt, Actionable mode);
double injectAEPower( double amt, Actionable mode );
/**
* @return the current maximum power ( this can change :P )
*/
public double getAEMaxPower();
double getAEMaxPower();
/**
* @return the current AE Power Level, this may exceed getMEMaxPower()
*/
public double getAECurrentPower();
double getAECurrentPower();
/**
* Checked on network reset to see if your block can be used as a public power storage ( use getPowerFlow to control
@@ -58,13 +58,13 @@ public interface IAEPowerStorage extends IEnergySource
*
* @return true if it can be used as a public power storage
*/
public boolean isAEPublicPowerStorage();
boolean isAEPublicPowerStorage();
/**
* Control the power flow by telling what the network can do, either add? or subtract? or both!
*
* @return access restriction what the network can do
*/
public AccessRestriction getPowerFlow();
AccessRestriction getPowerFlow();
}
@@ -36,18 +36,18 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
/**
* @return the current calculated idle energy drain each tick, is used internally to drain power for each tick.
*/
public double getIdlePowerUsage();
double getIdlePowerUsage();
/**
* @return the average power drain over the past 10 ticks, includes idle usage during this time, and all use of
* extractPower.
*/
public double getAvgPowerUsage();
double getAvgPowerUsage();
/**
* @return the average energy injected into the system per tick, for the last 10 ticks.
*/
public double getAvgPowerInjection();
double getAvgPowerInjection();
/**
* AE maintains an idle draw of power separate from active power draw, it condenses this into a single operation
@@ -59,7 +59,7 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
*
* @return if the network is powered or not.
*/
public boolean isNetworkPowered();
boolean isNetworkPowered();
/**
* AE will accept any power, and store it, to maintain sanity please don't send more then 10,000 at a time.
@@ -78,14 +78,14 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
* should the action be simulated or performed?
* @return the amount of power that the network has OVER the limit.
*/
public double injectPower(double amt, Actionable mode);
double injectPower( double amt, Actionable mode );
/**
* this is should be considered an estimate, and not relied upon for real calculations.
*
* @return estimated available power.
*/
public double getStoredPower();
double getStoredPower();
/**
* this is should be considered an estimate, and not relied upon for real calculations.
@@ -100,6 +100,6 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
*
* @return Amount of power required to charge the grid, in AE.
*/
public double getEnergyDemand(double maxRequired);
double getEnergyDemand( double maxRequired );
}
@@ -36,16 +36,16 @@ public interface IEnergyGridProvider
/**
* internal use only
*/
public double extractAEPower(double amt, Actionable mode, Set<IEnergyGrid> seen);
double extractAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen );
/**
* internal use only
*/
public double injectAEPower(double amt, Actionable mode, Set<IEnergyGrid> seen);
double injectAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen );
/**
* internal use only
*/
public double getEnergyDemand(double d, Set<IEnergyGrid> seen);
double getEnergyDemand( double d, Set<IEnergyGrid> seen );
}
@@ -36,6 +36,6 @@ public interface IEnergySource
* @param mode should the action be simulated or performed?
* @return returns extracted power.
*/
public double extractAEPower(double amt, Actionable mode, PowerMultiplier usePowerMultiplier);
double extractAEPower( double amt, Actionable mode, PowerMultiplier usePowerMultiplier );
}
@@ -33,7 +33,7 @@ public enum CableRenderMode
public final boolean transparentFacades;
public final boolean opaqueFacades;
private CableRenderMode(boolean hideFacades) {
CableRenderMode( boolean hideFacades ) {
this.transparentFacades = hideFacades;
this.opaqueFacades = !hideFacades;
}
@@ -23,12 +23,13 @@
package appeng.api.recipes;
import java.util.List;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError;
import appeng.api.exceptions.RegistrationError;
import java.util.List;
public interface ICraftHandler
{
@@ -39,7 +40,7 @@ public interface ICraftHandler
* @param output parsed outputs
* @throws RecipeError
*/
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError;
void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError;
/**
* called when all recipes are parsed, and your required to register your recipe.
@@ -47,6 +48,6 @@ public interface ICraftHandler
* @throws RegistrationError
* @throws MissingIngredientError
*/
public void register() throws RegistrationError, MissingIngredientError;
void register() throws RegistrationError, MissingIngredientError;
}
@@ -23,7 +23,9 @@
package appeng.api.recipes;
import net.minecraft.item.ItemStack;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RegistrationError;
@@ -55,27 +57,27 @@ public interface IIngredient {
*
* @return true if this slot contains no ItemStack, this is passed as "_"
*/
public boolean isAir();
boolean isAir();
/**
* @return The Name Space of the item. Prefer getItemStack or getItemStackSet
*/
public String getNameSpace();
String getNameSpace();
/**
* @return The Name of the item. Prefer getItemStack or getItemStackSet
*/
public String getItemName();
String getItemName();
/**
* @return The Damage Value of the item. Prefer getItemStack or getItemStackSet
*/
public int getDamageValue();
int getDamageValue();
/**
* @return The Damage Value of the item. Prefer getItemStack or getItemStackSet
*/
public int getQty();
int getQty();
/**
* Bakes the lists in for faster runtime look-ups.
@@ -31,6 +31,6 @@ public interface ISubItemResolver
* @param fullName name of sub item
* @return either a ResolveResult, or a ResolverResultSet
*/
public Object resolveItemByName(String namespace, String fullName);
Object resolveItemByName( String namespace, String fullName );
}
@@ -49,7 +49,7 @@ public interface IMEInventory<StackType extends IAEStack>
* @param src action source
* @return returns the number of items not added.
*/
public StackType injectItems(StackType input, Actionable type, BaseActionSource src);
StackType injectItems( StackType input, Actionable type, BaseActionSource src );
/**
* Extract the specified item from the ME Inventory
@@ -60,7 +60,7 @@ public interface IMEInventory<StackType extends IAEStack>
* simulate, or perform action?
* @return returns the number of items extracted, null
*/
public StackType extractItems(StackType request, Actionable mode, BaseActionSource src);
StackType extractItems( StackType request, Actionable mode, BaseActionSource src );
/**
* request a full report of all available items, storage.
@@ -69,11 +69,11 @@ public interface IMEInventory<StackType extends IAEStack>
* the IItemList the results will be written too
* @return returns same list that was passed in, is passed out
*/
public IItemList<StackType> getAvailableItems(IItemList<StackType> out);
IItemList<StackType> getAvailableItems( IItemList<StackType> out );
/**
* @return the type of channel your handler should be part of
*/
public StorageChannel getChannel();
StorageChannel getChannel();
}
@@ -40,7 +40,7 @@ public interface IMEInventoryHandler<StackType extends IAEStack> extends IMEInve
*
* @return the access
*/
public AccessRestriction getAccess();
AccessRestriction getAccess();
/**
* determine if a particular item is prioritized for this inventory handler, if it is, then it will be added to this
@@ -50,7 +50,7 @@ public interface IMEInventoryHandler<StackType extends IAEStack> extends IMEInve
* - item that might be added
* @return if its prioritized
*/
public boolean isPrioritized(StackType input);
boolean isPrioritized( StackType input );
/**
* determine if an item can be accepted and stored.
@@ -59,23 +59,23 @@ public interface IMEInventoryHandler<StackType extends IAEStack> extends IMEInve
* - item that might be added
* @return if the item can be added
*/
public boolean canAccept(StackType input);
boolean canAccept( StackType input );
/**
* determine what the priority of the inventory is.
*
* @return the priority, zero is default, positive and negative are supported.
*/
public int getPriority();
int getPriority();
/**
* 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 the {@link IMEInventoryHandler}.
* are the implementer of this.
*/
public int getSlot();
int getSlot();
/**
* AE Uses a two pass placement system, the first pass checks contents and tries to find a place where the item
@@ -86,5 +86,5 @@ public interface IMEInventoryHandler<StackType extends IAEStack> extends IMEInve
* - pass number ( 1 or 2 )
* @return true, if this inventory is valid for this pass.
*/
public boolean validForPass(int i);
boolean validForPass( int i );
}
@@ -30,12 +30,12 @@ import appeng.api.storage.data.IItemList;
public interface IMEMonitor<T extends IAEStack> extends IMEInventoryHandler<T>, IBaseMonitor<T>
{
@Override
@Deprecated
/**
* This method is discouraged when accessing data via a IMEMonitor
*/
public IItemList<T> getAvailableItems(IItemList out);
@Override
@Deprecated
IItemList<T> getAvailableItems( IItemList out );
/**
* Get access to the full item list of the network, preferred over {@link IMEInventory} .getAvailableItems(...)
@@ -43,7 +43,7 @@ public enum StorageChannel
public final Class<? extends IAEStack> type;
private StorageChannel( Class<? extends IAEStack> t ) {
StorageChannel( Class<? extends IAEStack> t ) {
this.type = t;
}
@@ -54,7 +54,7 @@ public interface IAEFluidStack extends IAEStack<IAEFluidStack>
* @return the copy.
*/
@Override
public IAEFluidStack copy();
IAEFluidStack copy();
/**
* Combines two IAEItemStacks via addition.
@@ -44,7 +44,7 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
*
* @return new ItemStack
*/
public ItemStack getItemStack();
ItemStack getItemStack();
/**
* create a AE Item clone
@@ -52,7 +52,7 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
* @return the copy
*/
@Override
public IAEItemStack copy();
IAEItemStack copy();
/**
* is there NBT Data for this item?
@@ -23,7 +23,9 @@
package appeng.api.storage.data;
import net.minecraft.nbt.NBTTagCompound;
import appeng.api.features.IItemComparison;
/**
@@ -37,7 +39,7 @@ public interface IAETagCompound
/**
* @return a copy ( the copy will not be a IAETagCompound, it will be a NBTTagCompound )
*/
public NBTTagCompound getNBTTagCompoundCopy();
NBTTagCompound getNBTTagCompoundCopy();
/**
* compare to other NBTTagCompounds or IAETagCompounds
@@ -23,10 +23,11 @@
package appeng.api.storage.data;
import appeng.api.config.FuzzyMode;
import java.util.Collection;
import appeng.api.config.FuzzyMode;
/**
* Represents a list of items in AE.
*
@@ -42,7 +43,7 @@ public interface IItemContainer<StackType extends IAEStack>
*
* @param option added stack
*/
public void add(StackType option); // adds stack as is
void add( StackType option ); // adds stack as is
/**
* @param i compared item
@@ -55,11 +56,11 @@ public interface IItemContainer<StackType extends IAEStack>
* @param input compared item
* @return a list of relevant fuzzy matched stacks
*/
public Collection<StackType> findFuzzy(StackType input, FuzzyMode fuzzy);
Collection<StackType> findFuzzy( StackType input, FuzzyMode fuzzy );
/**
* @return true if there are no items in the list
*/
public boolean isEmpty();
boolean isEmpty();
}
@@ -41,14 +41,14 @@ public interface IItemList<StackType extends IAEStack> extends IItemContainer<St
*
* @param option stacktype option
*/
public void addStorage(StackType option); // adds a stack as stored
void addStorage( StackType option ); // adds a stack as stored
/**
* add a stack to the list as craftable, this will merge the stack with an item already in the list if found.
*
* @param option stacktype option
*/
public void addCrafting(StackType option);
void addCrafting( StackType option );
/**
* add a stack to the list, stack size is used to add to requestable, this will merge the stack with an item already
@@ -56,7 +56,7 @@ public interface IItemList<StackType extends IAEStack> extends IItemContainer<St
*
* @param option stacktype option
*/
public void addRequestable(StackType option); // adds a stack as requestable
void addRequestable( StackType option ); // adds a stack as requestable
/**
* @return the first item in the list
@@ -72,7 +72,7 @@ public interface IItemList<StackType extends IAEStack> extends IItemContainer<St
* allows you to iterate the list.
*/
@Override
public Iterator<StackType> iterator();
Iterator<StackType> iterator();
/**
* resets stack sizes to 0.
@@ -56,7 +56,7 @@ public interface AEItemDefinition
ItemStack stack(int stackSize);
/**
* Compare {@link ItemStack} with this {@link AEItemDefinition}
* Compare {@link ItemStack} with this
*
* @param comparableItem compared item
* @return true if the item stack is a matching item.
@@ -23,10 +23,10 @@
package appeng.api.util;
import net.minecraft.nbt.NBTTagCompound;
import java.util.Set;
import net.minecraft.nbt.NBTTagCompound;
/**
* Used to adjust settings on an object,
*
@@ -70,9 +70,9 @@ public interface IConfigManager
/**
* write all settings to the NBT Tag so they can be read later.
*
* @param dest to be written nbt tag
* @param destination to be written nbt tag
*/
void writeToNBT(NBTTagCompound dest);
void writeToNBT(NBTTagCompound destination);
/**
* Only works after settings have been registered
@@ -70,8 +70,8 @@ import appeng.parts.NullCableBusContainer;
import appeng.tile.AEBaseTile;
import appeng.tile.networking.TileCableBus;
import appeng.tile.networking.TileCableBusTESR;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.integration.Method;
import appeng.transformer.annotations.Integration.Interface;
import appeng.transformer.annotations.Integration.Method;
import appeng.util.Platform;
@Interface(iface = "powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection", iname = "MFR")
@@ -25,6 +25,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -163,10 +164,11 @@ public class BlockSkyStone extends AEBaseBlock implements IOrientableBlock
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
public ItemStack getPickBlock( MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player )
{
ItemStack is = super.getPickBlock( target, world, x, y, z );
final ItemStack is = super.getPickBlock( target, world, x, y, z, player );
is.setItemDamage( world.getBlockMetadata( x, y, z ) );
return is;
}
@@ -87,10 +87,11 @@ public class BlockSkyChest extends AEBaseBlock implements ICustomCollision
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
public ItemStack getPickBlock( MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player )
{
ItemStack is = super.getPickBlock( target, world, x, y, z );
final ItemStack is = super.getPickBlock( target, world, x, y, z, player );
is.setItemDamage( world.getBlockMetadata( x, y, z ) );
return is;
}
@@ -25,14 +25,14 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import com.google.common.base.Joiner;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import com.google.common.base.Joiner;
import appeng.api.AEApi;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
@@ -328,10 +328,10 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
if ( AEConfig.instance.useColoredCraftingStatus && ( active || scheduled ) )
{
int bgcol = ( active ? AEColor.Green.blackVariant : AEColor.Yellow.blackVariant ) | 0x5A000000;
int bgColor = ( active ? AEColor.Green.blackVariant : AEColor.Yellow.blackVariant ) | 0x5A000000;
int startX = (x * (1 + sectionLength) + xo) * 2;
int startY = ((y * offY + yo) - 3) * 2;
drawRect( startX, startY, startX + (sectionLength * 2), startY + (offY * 2) - 2, bgcol);
drawRect( startX, startY, startX + (sectionLength * 2), startY + (offY * 2) - 2, bgColor);
}
int negY = ((lines - 1) * 5) / 2;
@@ -173,7 +173,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
int viewStart = 0;// myScrollBar.getCurrentScroll() * 5;
int viewEnd = viewStart + 5 * 4;
String ToolTip = "";
String toolTip = "";
int toolPosX = 0;
int toolPosY = 0;
@@ -199,11 +199,11 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
if ( this.tooltip == z - viewStart )
{
ToolTip = Platform.getItemDisplayName( this.repo.getItem( z ) );
toolTip = Platform.getItemDisplayName( this.repo.getItem( z ) );
ToolTip = ToolTip + ( '\n' + GuiText.Installed.getLocal() + ": " + (refStack.getStackSize()));
toolTip += ( '\n' + GuiText.Installed.getLocal() + ": " + ( refStack.getStackSize() ) );
if ( refStack.getCountRequestable() > 0 )
ToolTip = ToolTip + ( '\n' + GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( refStack.getCountRequestable(), true ));
toolTip += ( '\n' + GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( refStack.getCountRequestable(), true ) );
toolPosX = x * sectionLength + xo + sectionLength - 8;
toolPosY = y * 18 + yo;
@@ -222,10 +222,10 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
}
if ( this.tooltip >= 0 && ToolTip.length() > 0 )
if ( this.tooltip >= 0 && toolTip.length() > 0 )
{
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
this.drawTooltip( toolPosX, toolPosY + 10, 0, ToolTip );
this.drawTooltip( toolPosX, toolPosY + 10, 0, toolTip );
GL11.glPopAttrib();
}
@@ -54,6 +54,7 @@ import appeng.core.localization.ButtonToolTips;
public class GuiImgButton extends GuiButton implements ITooltip
{
private static final Pattern COMPILE = Pattern.compile( "%s" );
private static final Pattern PATTERN_NEW_LINE = Pattern.compile( "\\n", Pattern.LITERAL );
private static Map<EnumPair, ButtonAppearance> appearances;
private final Enum buttonSetting;
public boolean halfSize = false;
@@ -281,7 +282,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
if ( this.fillVar != null )
value = COMPILE.matcher( value ).replaceFirst( this.fillVar );
value = value.replace( "\\n", "\n" );
value = PATTERN_NEW_LINE.matcher( value ).replaceAll( "\n" );
StringBuilder sb = new StringBuilder( value );
int i = sb.lastIndexOf( "\n" );
@@ -19,6 +19,8 @@
package appeng.client.gui.widgets;
import java.util.regex.Pattern;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
@@ -30,6 +32,7 @@ import appeng.client.texture.ExtraBlockTextures;
public class GuiToggleButton extends GuiButton implements ITooltip
{
private static final Pattern PATTERN_NEW_LINE = Pattern.compile( "\\n", Pattern.LITERAL );
private final int iconIdxOn;
private final int iconIdxOff;
@@ -94,7 +97,7 @@ public class GuiToggleButton extends GuiButton implements ITooltip
if ( value == null || value.isEmpty() )
value = this.displayHint;
value = value.replace( "\\n", "\n" );
value = PATTERN_NEW_LINE.matcher( value ).replaceAll( "\n" );
StringBuilder sb = new StringBuilder( value );
int i = sb.lastIndexOf( "\n" );
@@ -39,7 +39,7 @@ public class SlotDisconnected extends AppEngSlot
@Override
public ItemStack getDisplayStack()
{
if ( Platform.isClient() )// && (which == PlaceableItemType.ENCODED_PATTERN) )
if ( Platform.isClient() )
{
ItemStack is = super.getStack();
if ( is != null && is.getItem() instanceof ItemEncodedPattern )
@@ -19,6 +19,7 @@
package appeng.client.render;
import java.util.HashMap;
import java.util.Map;
import org.lwjgl.opengl.GL11;
@@ -48,7 +49,7 @@ public class BusRenderer implements IItemRenderer
public static final BusRenderer INSTANCE = new BusRenderer();
public final RenderBlocksWorkaround renderer = new RenderBlocksWorkaround();
public static final HashMap<Integer, IPart> RENDER_PART = new HashMap<Integer, IPart>();
private static final Map<Integer, IPart> RENDER_PART = new HashMap<Integer, IPart>();
public IPart getRenderer(ItemStack is, IPartItem c)
{
@@ -688,7 +688,8 @@ public class RenderBlocksWorkaround extends RenderBlocks
for (int k = -1; k <= 1; k++)
{
this.lightHashTmp[o++] = blk.getMixedBrightnessForBlock( this.blockAccess, x + i, y + j, z + k );
this.lightHashTmp[o] = blk.getMixedBrightnessForBlock( this.blockAccess, x + i, y + j, z + k );
o++;
}
return Arrays.hashCode( this.lightHashTmp );
@@ -91,11 +91,13 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
int spin = 0;
int max = 5;
while (walrus != cmt.getUp() && max-- > 0)
while (walrus != cmt.getUp() && max > 0)
{
max--;
spin++;
walrus = Platform.rotateAround( walrus, side );
}
max--;
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
GL11.glTranslated( side.offsetX * 0.69, side.offsetY * 0.69, side.offsetZ * 0.69 );
@@ -118,7 +118,7 @@ public class RenderBlockSkyCompass extends BaseBlockRender
{
if ( cr.spin )
{
now = now % 100000;
now %= 100000;
this.model.renderAll( (now / 50000.0f) * (float) Math.PI * 500.0f );
}
else
@@ -139,14 +139,14 @@ public class RenderBlockSkyCompass extends BaseBlockRender
}
else
{
now = now % 1000000;
now %= 1000000;
this.model.renderAll( (now / 500000.0f) * (float) Math.PI * 500.0f );
}
}
else
{
now = now % 100000;
now %= 100000;
this.model.renderAll( (now / 50000.0f) * (float) Math.PI * 500.0f );
}
@@ -195,7 +195,7 @@ public class RenderBlockSkyCompass extends BaseBlockRender
{
if ( cr.spin )
{
now = now % 100000;
now %= 100000;
this.model.renderAll( (now / 50000.0f) * (float) Math.PI * 500.0f );
}
else
@@ -204,7 +204,7 @@ public class RenderBlockSkyCompass extends BaseBlockRender
}
else
{
now = now % 1000000;
now %= 1000000;
this.model.renderAll( (now / 500000.0f) * (float) Math.PI * 500.0f );
}
@@ -68,9 +68,10 @@ public class VibrantFX extends EntityFX
// this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.particleScale *= 0.95;
if ( this.particleMaxAge-- <= 0 || this.particleScale < 0.1 )
if ( this.particleMaxAge <= 0 || this.particleScale < 0.1 )
{
this.setDead();
}
this.particleMaxAge--;
}
}
@@ -101,7 +101,7 @@ public enum CableBusTextures
return this.name;
}
private CableBusTextures(String name) {
CableBusTextures( String name ) {
this.name = name;
}
@@ -111,7 +111,7 @@ public enum ExtraBlockTextures
return this.name;
}
private ExtraBlockTextures(String name) {
ExtraBlockTextures( String name ) {
this.name = name;
}
@@ -49,7 +49,7 @@ public enum ExtraItemTextures
return this.name;
}
private ExtraItemTextures(String name) {
ExtraItemTextures( String name ) {
this.name = name;
}
@@ -172,7 +172,8 @@ public abstract class AEBaseContainer extends Container
int page = 0;
for (byte[] packet : miniPackets)
{
PacketPartialItem ppi = new PacketPartialItem( page++, miniPackets.size(), packet );
PacketPartialItem ppi = new PacketPartialItem( page, miniPackets.size(), packet );
page++;
NetworkHandler.instance.sendToServer( ppi );
}
}
@@ -818,7 +819,7 @@ public abstract class AEBaseContainer extends Container
}
// get target item.
IAEItemStack slotItem = this.getTargetStack();
IAEItemStack slotItem = this.clientRequestedTargetItem;
switch (action)
{
@@ -223,7 +223,10 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
for (int w = 0; w < 7; w++)
for (int z = 0; z < 9; z++)
this.addSlotToContainer( new SlotFakeTypeOnly( inv, offset++, x + z * 18, y + w * 18 ) );
{
this.addSlotToContainer( new SlotFakeTypeOnly( inv, offset, x + z * 18, y + w * 18 ) );
offset++;
}
for (int zz = 0; zz < 3; zz++)
for (int z = 0; z < 8; z++)
@@ -33,21 +33,47 @@ import appeng.container.slot.SlotRestrictedInput;
import appeng.tile.storage.TileIOPort;
import appeng.util.Platform;
public class ContainerIOPort extends ContainerUpgradeable
{
final TileIOPort ioPort;
@GuiSync(2)
@GuiSync( 2 )
public FullnessMode fMode = FullnessMode.EMPTY;
@GuiSync(3)
@GuiSync( 3 )
public OperationMode opMode = OperationMode.EMPTY;
public ContainerIOPort(InventoryPlayer ip, TileIOPort te) {
public ContainerIOPort( InventoryPlayer ip, TileIOPort te )
{
super( ip, te );
this.ioPort = te;
}
@Override
protected void setupConfig()
{
int offX = 19;
int offY = 17;
IInventory cells = this.upgradeable.getInventoryByName( "cells" );
for ( int y = 0; y < 3; y++ )
for ( int x = 0; x < 2; x++ )
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, cells, x + y * 2, offX + x * 18, offY + y * 18, this.invPlayer ) );
offX = 122;
offY = 17;
for ( int y = 0; y < 3; y++ )
for ( int x = 0; x < 2; x++ )
this.addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offX + x * 18, offY + y * 18, SlotRestrictedInput.PlacableItemType.STORAGE_CELLS.IIcon ) );
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer ) ).setNotDraggable() );
}
@Override
protected int getHeight()
{
@@ -66,30 +92,6 @@ public class ContainerIOPort extends ContainerUpgradeable
return false;
}
@Override
protected void setupConfig()
{
int offX = 19;
int offY = 17;
IInventory cells = this.upgradeable.getInventoryByName( "cells" );
for (int y = 0; y < 3; y++)
for (int x = 0; x < 2; x++)
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, cells, x + y * 2, offX + x * 18, offY + y * 18, this.invPlayer ) );
offX = 122;
offY = 17;
for (int y = 0; y < 3; y++)
for (int x = 0; x < 2; x++)
this.addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offX + x * 18, offY + y * 18, SlotRestrictedInput.PlacableItemType.STORAGE_CELLS.IIcon ) );
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer )).setNotDraggable() );
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer )).setNotDraggable() );
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer )).setNotDraggable() );
}
@Override
public void detectAndSendChanges()
{
@@ -104,5 +106,4 @@ public class ContainerIOPort extends ContainerUpgradeable
this.standardDetectAndSendChanges();
}
}
@@ -114,7 +114,7 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
IBiometricCard bc = (IBiometricCard) a.getItem();
for (SecurityPermissions sp : bc.getPermissions( a ))
this.security = this.security | (1 << sp.ordinal());
this.security |= ( 1 << sp.ordinal() );
}
this.updatePowerStatus();
@@ -126,7 +126,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
{
super.onPickupFromSlot( p, is );
// actually necessary to cleanup this case...
p.openContainer.onCraftMatrixChanged( this.getCraftingMatrix() );
p.openContainer.onCraftMatrixChanged( this.craftInv );
return request;
}
}
@@ -157,7 +157,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
}
// shouldn't be necessary...
p.openContainer.onCraftMatrixChanged( this.getCraftingMatrix() );
p.openContainer.onCraftMatrixChanged( this.craftInv );
return is;
}
@@ -178,10 +178,12 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
if ( Platform.isServer() )
{
// set new items onto the crafting table...
for ( int x = 0; x < this.getCraftingMatrix().getSizeInventory(); x++ )
for ( int x = 0; x < this.craftInv.getSizeInventory(); x++ )
{
if ( this.getCraftingMatrix().getStackInSlot( x ) == null )
this.getCraftingMatrix().setInventorySlotContents( x, set[x] );
if ( this.craftInv.getStackInSlot( x ) == null )
{
this.craftInv.setInventorySlotContents( x, set[x] );
}
else if ( set[x] != null )
{
// eek! put it back!
@@ -61,7 +61,7 @@ public class SlotRestrictedInput extends AppEngSlot
public final int IIcon;
private PlacableItemType(int o) {
PlacableItemType( int o ) {
this.IIcon = o;
}
}
+7 -5
View File
@@ -32,9 +32,6 @@ import java.util.Map;
import java.util.UUID;
import java.util.WeakHashMap;
import com.google.common.base.Optional;
import com.mojang.authlib.GameProfile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
@@ -44,6 +41,9 @@ import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import com.google.common.base.Optional;
import com.mojang.authlib.GameProfile;
import appeng.api.util.WorldCoord;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketNewStorageDimension;
@@ -402,7 +402,8 @@ public class WorldSettings extends Configuration
private long nextGridStorage()
{
long r = this.lastGridStorage++;
long r = this.lastGridStorage;
this.lastGridStorage++;
this.get( "Counters", "lastGridStorage", this.lastGridStorage ).set( Long.toString( this.lastGridStorage ) );
return r;
}
@@ -444,7 +445,8 @@ public class WorldSettings extends Configuration
private long nextPlayer()
{
long r = this.lastPlayer++;
long r = this.lastPlayer;
this.lastPlayer++;
this.get( "Counters", "lastPlayer", this.lastPlayer ).set( this.lastPlayer );
return r;
}
@@ -78,13 +78,13 @@ public enum AEFeature
public final boolean isVisible;
public final boolean defaultValue;
private AEFeature(String cat) {
AEFeature( String cat ) {
this.category = cat;
this.isVisible = !this.name().equals( "Core" );
this.defaultValue = true;
}
private AEFeature(String cat, boolean defaultValue) {
AEFeature( String cat, boolean defaultValue ) {
this.category = cat;
this.isVisible = !this.name().equals( "Core" );
this.defaultValue = defaultValue;
@@ -20,6 +20,7 @@ package appeng.core.features;
import java.util.EnumSet;
import java.util.regex.Pattern;
import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs;
@@ -44,6 +45,10 @@ import appeng.util.Platform;
public class AEFeatureHandler implements AEItemDefinition
{
private static final Pattern PATTERN_ITEM_MULTI_PART = Pattern.compile( "ItemMultiPart", Pattern.LITERAL );
private static final Pattern PATTERN_ITEM_MULTI_MATERIAL = Pattern.compile( "ItemMultiMaterial", Pattern.LITERAL );
private static final Pattern PATTERN_QUARTZ = Pattern.compile( "Quartz", Pattern.LITERAL );
private final EnumSet<AEFeature> features;
private final String subName;
@@ -149,9 +154,9 @@ public class AEFeatureHandler implements AEItemDefinition
String name = o.getSimpleName();
if ( name.startsWith( "ItemMultiPart" ) )
name = name.replace( "ItemMultiPart", "ItemPart" );
name = PATTERN_ITEM_MULTI_PART.matcher( name ).replaceAll( "ItemPart" );
else if ( name.startsWith( "ItemMultiMaterial" ) )
name = name.replace( "ItemMultiMaterial", "ItemMaterial" );
name = PATTERN_ITEM_MULTI_MATERIAL.matcher( name ).replaceAll( "ItemMaterial" );
if ( subName != null )
{
@@ -161,9 +166,9 @@ public class AEFeatureHandler implements AEItemDefinition
return "ItemPart.P2PTunnel";
if ( subName.equals( "CertusQuartzTools" ) )
return name.replace( "Quartz", "CertusQuartz" );
return PATTERN_QUARTZ.matcher( name ).replaceAll( "CertusQuartz" );
if ( subName.equals( "NetherQuartzTools" ) )
return name.replace( "Quartz", "NetherQuartz" );
return PATTERN_QUARTZ.matcher( name ).replaceAll( "NetherQuartz" );
name += '.' + subName;
}
@@ -19,11 +19,17 @@
package appeng.core.features;
import java.util.regex.Pattern;
import com.google.common.base.Optional;
public class FeatureNameExtractor
{
private static final Pattern PATTERN_ITEM_MULTI_PART = Pattern.compile( "ItemMultiPart", Pattern.LITERAL );
private static final Pattern PATTERN_ITEM_MULTI_MATERIAL = Pattern.compile( "ItemMultiMaterial", Pattern.LITERAL );
private static final Pattern PATTERN_QUARTZ = Pattern.compile( "Quartz", Pattern.LITERAL );
private final Class<?> clazz;
private final Optional<String> subName;
@@ -39,11 +45,11 @@ public class FeatureNameExtractor
if ( name.startsWith( "ItemMultiPart" ) )
{
name = name.replace( "ItemMultiPart", "ItemPart" );
name = PATTERN_ITEM_MULTI_PART.matcher( name ).replaceAll( "ItemPart" );
}
else if ( name.startsWith( "ItemMultiMaterial" ) )
{
name = name.replace( "ItemMultiMaterial", "ItemMaterial" );
name = PATTERN_ITEM_MULTI_MATERIAL.matcher( name ).replaceAll( "ItemMaterial" );
}
if ( this.subName.isPresent() )
@@ -57,11 +63,11 @@ public class FeatureNameExtractor
}
else if ( subName.equals( "CertusQuartzTools" ) )
{
return name.replace( "Quartz", "CertusQuartz" );
return PATTERN_QUARTZ.matcher( name ).replaceAll( "CertusQuartz" );
}
else if ( subName.equals( "NetherQuartzTools" ) )
{
return name.replace( "Quartz", "NetherQuartz" );
return PATTERN_QUARTZ.matcher( name ).replaceAll( "NetherQuartz" );
}
name += '.' + subName;
@@ -63,6 +63,7 @@ public final class LocatableRegistry implements ILocatableRegistry
* Find a locate-able object by its serial.
*/
@Override
@Deprecated
public Object findLocatableBySerial( long ser )
{
return this.set.get( ser );
@@ -50,7 +50,7 @@ public enum TickRates
public int min;
public int max;
private TickRates(int min, int max) {
TickRates( int min, int max ) {
this.min = min;
this.max = max;
}
@@ -130,7 +130,7 @@ public enum Achievements
return this.stat;
}
private Achievements( int x, int y, AEColoredItemDefinition which, AchievementType type )
Achievements( int x, int y, AEColoredItemDefinition which, AchievementType type )
{
this.stack = (which != null) ? which.stack( AEColor.Transparent, 1 ) : null;
this.type = type;
@@ -138,7 +138,7 @@ public enum Achievements
this.y = y;
}
private Achievements( int x, int y, AEItemDefinition which, AchievementType type )
Achievements( int x, int y, AEItemDefinition which, AchievementType type )
{
this.stack = (which != null) ? which.stack( 1 ) : null;
this.type = type;
@@ -146,7 +146,7 @@ public enum Achievements
this.y = y;
}
private Achievements( int x, int y, ItemStack which, AchievementType type )
Achievements( int x, int y, ItemStack which, AchievementType type )
{
this.stack = which;
this.type = type;
@@ -48,7 +48,7 @@ public class PlayerStatsRegistration
private final boolean isAchievementFeatureEnabled;
/**
* Constructs a {@link appeng.core.stats.PlayerStatsRegistration} with an {@link cpw.mods.fml.common.eventhandler.EventBus} and {@link appeng.core.AEConfig}.
* Constructs this with an {@link cpw.mods.fml.common.eventhandler.EventBus} and {@link appeng.core.AEConfig}.
*
* @param bus {@see #bus}
* @param config {@link appeng.core.AEConfig} which is used to determine if the {@link appeng.core.features.AEFeature#Achievements} is enabled
+1 -1
View File
@@ -47,7 +47,7 @@ public enum Stats
return this.stat;
}
private Stats() {
Stats() {
}
public void addToPlayer(EntityPlayer player, int howMany)
@@ -18,6 +18,7 @@
package appeng.core.sync;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
@@ -50,101 +51,101 @@ import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.core.sync.packets.PacketTransitionEffect;
import appeng.core.sync.packets.PacketValueConfig;
public class AppEngPacketHandlerBase
{
private static final Map<Class<? extends AppEngPacket>, PacketTypes> REVERSE_LOOKUP = new HashMap<Class<? extends AppEngPacket>, AppEngPacketHandlerBase.PacketTypes>();
public static final Map<Class, PacketTypes> REVERSE_LOOKUP = new HashMap<Class, AppEngPacketHandlerBase.PacketTypes>();
public enum PacketTypes
{
PACKET_COMPASS_REQUEST(PacketCompassRequest.class),
PACKET_COMPASS_REQUEST( PacketCompassRequest.class ),
PACKET_COMPASS_RESPONSE(PacketCompassResponse.class),
PACKET_COMPASS_RESPONSE( PacketCompassResponse.class ),
PACKET_INVENTORY_ACTION(PacketInventoryAction.class),
PACKET_INVENTORY_ACTION( PacketInventoryAction.class ),
PACKET_ME_INVENTORY_UPDATE(PacketMEInventoryUpdate.class),
PACKET_ME_INVENTORY_UPDATE( PacketMEInventoryUpdate.class ),
PACKET_CONFIG_BUTTON(PacketConfigButton.class),
PACKET_CONFIG_BUTTON( PacketConfigButton.class ),
PACKET_MULTIPART(PacketMultiPart.class),
PACKET_MULTIPART( PacketMultiPart.class ),
PACKET_PART_PLACEMENT(PacketPartPlacement.class),
PACKET_PART_PLACEMENT( PacketPartPlacement.class ),
PACKET_LIGHTNING(PacketLightning.class),
PACKET_LIGHTNING( PacketLightning.class ),
PACKET_MATTER_CANNON(PacketMatterCannon.class),
PACKET_MATTER_CANNON( PacketMatterCannon.class ),
PACKET_MOCK_EXPLOSION(PacketMockExplosion.class),
PACKET_MOCK_EXPLOSION( PacketMockExplosion.class ),
PACKET_VALUE_CONFIG(PacketValueConfig.class),
PACKET_VALUE_CONFIG( PacketValueConfig.class ),
PACKET_TRANSITION_EFFECT(PacketTransitionEffect.class),
PACKET_TRANSITION_EFFECT( PacketTransitionEffect.class ),
PACKET_PROGRESS_VALUE(PacketProgressBar.class),
PACKET_PROGRESS_VALUE( PacketProgressBar.class ),
PACKET_CLICK(PacketClick.class),
PACKET_CLICK( PacketClick.class ),
PACKET_NEW_STORAGE_DIMENSION(PacketNewStorageDimension.class),
PACKET_NEW_STORAGE_DIMENSION( PacketNewStorageDimension.class ),
PACKET_SWITCH_GUIS(PacketSwitchGuis.class),
PACKET_SWITCH_GUIS( PacketSwitchGuis.class ),
PACKET_SWAP_SLOTS(PacketSwapSlots.class),
PACKET_SWAP_SLOTS( PacketSwapSlots.class ),
PACKET_PATTERN_SLOT(PacketPatternSlot.class),
PACKET_PATTERN_SLOT( PacketPatternSlot.class ),
PACKET_RECIPE_NEI(PacketNEIRecipe.class),
PACKET_RECIPE_NEI( PacketNEIRecipe.class ),
PACKET_PARTIAL_ITEM(PacketPartialItem.class),
PACKET_PARTIAL_ITEM( PacketPartialItem.class ),
PACKET_CRAFTING_REQUEST(PacketCraftRequest.class),
PACKET_CRAFTING_REQUEST( PacketCraftRequest.class ),
PACKET_ASSEMBLER_ANIMATION(PacketAssemblerAnimation.class),
PACKET_ASSEMBLER_ANIMATION( PacketAssemblerAnimation.class ),
PACKET_COMPRESSED_NBT(PacketCompressedNBT.class),
PACKET_COMPRESSED_NBT( PacketCompressedNBT.class ),
PACKET_PAINTED_ENTITY(PacketPaintedEntity.class);
PACKET_PAINTED_ENTITY( PacketPaintedEntity.class );
final public Class pc;
final public Constructor con;
private final Class<? extends AppEngPacket> packetClass;
private final Constructor<? extends AppEngPacket> packetConstructor;
private PacketTypes(Class c) {
this.pc = c;
PacketTypes( Class<? extends AppEngPacket> c )
{
this.packetClass = c;
Constructor x = null;
Constructor<? extends AppEngPacket> x = null;
try
{
x = this.pc.getConstructor( ByteBuf.class );
x = this.packetClass.getConstructor( ByteBuf.class );
}
catch (NoSuchMethodException ignored)
catch( NoSuchMethodException ignored )
{
}
catch (SecurityException ignored)
catch( SecurityException ignored )
{
}
this.con = x;
AppEngPacketHandlerBase.REVERSE_LOOKUP.put( this.pc, this );
this.packetConstructor = x;
REVERSE_LOOKUP.put( this.packetClass, this );
if ( this.con == null )
if( this.packetConstructor == null )
throw new RuntimeException( "Invalid Packet Class, must be constructable on DataInputStream" );
}
public AppEngPacket parsePacket(ByteBuf in) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
public static PacketTypes getPacket( int id )
{
return (AppEngPacket) this.con.newInstance( in );
return ( values() )[id];
}
public static PacketTypes getPacket(int id)
public static PacketTypes getID( Class<? extends AppEngPacket> c )
{
return (values())[id];
return REVERSE_LOOKUP.get( c );
}
public static PacketTypes getID(Class<? extends AppEngPacket> c)
public AppEngPacket parsePacket( ByteBuf in ) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
{
return AppEngPacketHandlerBase.REVERSE_LOOKUP.get( c );
return this.packetConstructor.newInstance( in );
}
}
}
+17 -11
View File
@@ -18,11 +18,9 @@
package appeng.core.sync;
import static appeng.core.sync.GuiHostType.ITEM;
import static appeng.core.sync.GuiHostType.ITEM_OR_WORLD;
import static appeng.core.sync.GuiHostType.WORLD;
import java.lang.reflect.Constructor;
import java.util.regex.Pattern;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -118,6 +116,10 @@ import appeng.tile.storage.TileIOPort;
import appeng.tile.storage.TileSkyChest;
import appeng.util.Platform;
import static appeng.core.sync.GuiHostType.ITEM;
import static appeng.core.sync.GuiHostType.ITEM_OR_WORLD;
import static appeng.core.sync.GuiHostType.WORLD;
public enum GuiBridge implements IGuiHandler
{
GUI_Handler(),
@@ -189,13 +191,15 @@ public enum GuiBridge implements IGuiHandler
GUI_CRAFTING_STATUS(ContainerCraftingStatus.class, ITerminalHost.class, ITEM_OR_WORLD, SecurityPermissions.CRAFT);
private static final Pattern PATTERN_PRE_CONTAINER = Pattern.compile( ".Container", Pattern.LITERAL );
private static final Pattern PATTERN_POST_CONTAINER = Pattern.compile( "container." );
private final Class Tile;
private Class Gui;
private final Class Container;
private GuiHostType type;
private SecurityPermissions requiredPermission;
private GuiBridge() {
GuiBridge() {
this.Tile = null;
this.Gui = null;
this.Container = null;
@@ -209,24 +213,26 @@ public enum GuiBridge implements IGuiHandler
{
if ( Platform.isClient() )
{
String start = this.Container.getName();
String GuiClass = start.replaceFirst( "container.", "client.gui." ).replace( ".Container", ".Gui" );
if ( start.equals( GuiClass ) )
final String start = this.Container.getName();
final String guiClassPostReplaced = PATTERN_POST_CONTAINER.matcher( start ).replaceFirst( "client.gui." );
final String guiClassPreReplaced = PATTERN_PRE_CONTAINER.matcher( guiClassPostReplaced ).replaceAll( ".Gui" );
if ( start.equals( guiClassPreReplaced ) )
throw new RuntimeException( "Unable to find gui class" );
this.Gui = ReflectionHelper.getClass( this.getClass().getClassLoader(), GuiClass );
this.Gui = ReflectionHelper.getClass( this.getClass().getClassLoader(), guiClassPreReplaced );
if ( this.Gui == null )
throw new RuntimeException( "Cannot Load class: " + GuiClass );
throw new RuntimeException( "Cannot Load class: " + guiClassPreReplaced );
}
}
private GuiBridge(Class _Container, SecurityPermissions requiredPermission) {
GuiBridge( Class _Container, SecurityPermissions requiredPermission ) {
this.requiredPermission = requiredPermission;
this.Container = _Container;
this.Tile = null;
this.getGui();
}
private GuiBridge(Class _Container, Class _Tile, GuiHostType type, SecurityPermissions requiredPermission) {
GuiBridge( Class _Container, Class _Tile, GuiHostType type, SecurityPermissions requiredPermission ) {
this.requiredPermission = requiredPermission;
this.Container = _Container;
this.type = type;
@@ -18,6 +18,7 @@
package appeng.core.sync.packets;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -26,6 +27,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import javax.annotation.Nullable;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
@@ -48,23 +50,31 @@ import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.util.item.AEItemStack;
public class PacketMEInventoryUpdate extends AppEngPacket
{
// output...
final private byte ref;
final private ByteBuf data;
final private GZIPOutputStream compressFrame;
int writtenBytes = 0;
boolean empty = true;
private static final int UNCOMPRESSED_PACKET_BYTE_LIMIT = 16 * 1024 * 1024;
private static final int OPERATION_BYTE_LIMIT = 2 * 1024;
private static final int TEMP_BUFFER_SIZE = 1024;
private static final int STREAM_MASK = 0xff;
// input.
final List<IAEItemStack> list;
@Nullable
private final List<IAEItemStack> list;
// output...
private final byte ref;
@Nullable
private final ByteBuf data;
@Nullable
private final GZIPOutputStream compressFrame;
private int writtenBytes = 0;
private boolean empty = true;
// automatic.
public PacketMEInventoryUpdate(final ByteBuf stream) throws IOException {
public PacketMEInventoryUpdate( final ByteBuf stream ) throws IOException
{
this.data = null;
this.compressFrame = null;
this.list = new LinkedList<IAEItemStack>();
@@ -72,25 +82,24 @@ public class PacketMEInventoryUpdate extends AppEngPacket
// int originalBytes = stream.readableBytes();
GZIPInputStream gzReader = new GZIPInputStream( new InputStream() {
GZIPInputStream gzReader = new GZIPInputStream( new InputStream()
{
@Override
public int read() throws IOException
{
if ( stream.readableBytes() <= 0 )
if( stream.readableBytes() <= 0 )
return -1;
return stream.readByte() & 0xff;
return stream.readByte() & STREAM_MASK;
}
} );
ByteBuf uncompressed = Unpooled.buffer( stream.readableBytes() );
byte[] tmp = new byte[1024];
while (gzReader.available() != 0)
byte[] tmp = new byte[TEMP_BUFFER_SIZE];
while( gzReader.available() != 0 )
{
int bytes = gzReader.read( tmp );
if ( bytes > 0 )
if( bytes > 0 )
uncompressed.writeBytes( tmp, 0, bytes );
}
gzReader.close();
@@ -98,32 +107,58 @@ public class PacketMEInventoryUpdate extends AppEngPacket
// int uncompressedBytes = uncompressed.readableBytes();
// AELog.info( "Receiver: " + originalBytes + " -> " + uncompressedBytes );
while (uncompressed.readableBytes() > 0)
while( uncompressed.readableBytes() > 0 )
this.list.add( AEItemStack.loadItemStackFromPacket( uncompressed ) );
this.empty = this.list.isEmpty();
}
// api
public PacketMEInventoryUpdate() throws IOException
{
this( (byte) 0 );
}
// api
public PacketMEInventoryUpdate( byte ref ) throws IOException
{
this.ref = ref;
this.data = Unpooled.buffer( OPERATION_BYTE_LIMIT );
this.data.writeInt( this.getPacketID() );
this.data.writeByte( this.ref );
this.compressFrame = new GZIPOutputStream( new OutputStream()
{
@Override
public void write( int value ) throws IOException
{
PacketMEInventoryUpdate.this.data.writeByte( value );
}
} );
this.list = null;
}
@Override
@SideOnly(Side.CLIENT)
public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player)
@SideOnly( Side.CLIENT )
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
{
GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if ( gs instanceof GuiCraftConfirm )
((GuiCraftConfirm) gs).postUpdate( this.list, this.ref );
if( gs instanceof GuiCraftConfirm )
( (GuiCraftConfirm) gs ).postUpdate( this.list, this.ref );
if ( gs instanceof GuiCraftingCPU )
((GuiCraftingCPU) gs).postUpdate( this.list, this.ref );
if( gs instanceof GuiCraftingCPU )
( (GuiCraftingCPU) gs ).postUpdate( this.list, this.ref );
if ( gs instanceof GuiMEMonitorable )
((GuiMEMonitorable) gs).postUpdate( this.list );
if ( gs instanceof GuiNetworkStatus )
((GuiNetworkStatus) gs).postUpdate( this.list );
if( gs instanceof GuiMEMonitorable )
( (GuiMEMonitorable) gs ).postUpdate( this.list );
if( gs instanceof GuiNetworkStatus )
( (GuiNetworkStatus) gs ).postUpdate( this.list );
}
@Nullable
@Override
public FMLProxyPacket getProxy()
{
@@ -134,46 +169,24 @@ public class PacketMEInventoryUpdate extends AppEngPacket
this.configureWrite( this.data );
return super.getProxy();
}
catch (IOException e)
catch( IOException e )
{
AELog.error( e );
}
return null;
}
// api
public PacketMEInventoryUpdate() throws IOException {
this( (byte) 0 );
}
// api
public PacketMEInventoryUpdate(byte ref) throws IOException {
this.data = Unpooled.buffer( 2048 );
this.data.writeInt( this.getPacketID() );
this.data.writeByte( this.ref = ref );
this.compressFrame = new GZIPOutputStream( new OutputStream() {
@Override
public void write(int value) throws IOException
{
PacketMEInventoryUpdate.this.data.writeByte( value );
}
} );
this.list = null;
}
public void appendItem(IAEItemStack is) throws IOException, BufferOverflowException
public void appendItem( IAEItemStack is ) throws IOException, BufferOverflowException
{
ByteBuf tmp = Unpooled.buffer( 2048 );
ByteBuf tmp = Unpooled.buffer( OPERATION_BYTE_LIMIT );
is.writeToPacket( tmp );
this.compressFrame.flush();
if ( this.writtenBytes + tmp.readableBytes() > 2 * 1024 * 1024 ) // 2mb!
if( this.writtenBytes + tmp.readableBytes() > UNCOMPRESSED_PACKET_BYTE_LIMIT )
{
throw new BufferOverflowException();
}
else
{
this.writtenBytes += tmp.readableBytes();
@@ -191,5 +204,4 @@ public class PacketMEInventoryUpdate extends AppEngPacket
{
return this.empty;
}
}
@@ -202,7 +202,7 @@ public class PacketNEIRecipe extends AppEngPacket
{
// check if the item in slot y matches the required item.
playerItemStack = playerInventory.getStackInSlot( i );
if ( playerItemStack != null && playerItemStack.getItem() == this.recipe[x][y].getItem() )
if ( playerItemStack != null && this.recipe[x][y] != null && playerItemStack.getItem() == this.recipe[x][y].getItem() )
{
if ( realForFake == Actionable.SIMULATE )
{
@@ -18,15 +18,16 @@
package appeng.crafting;
import java.util.HashMap;
import java.util.HashSet;
import java.util.concurrent.TimeUnit;
import com.google.common.base.Stopwatch;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import com.google.common.base.Stopwatch;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.networking.IGrid;
@@ -177,7 +178,7 @@ public class CraftingJob implements Runnable, ICraftingJob
AELog.crafting( s + " * " + ti.times + " = " + (ti.perOp * ti.times) );
}
AELog.crafting( "------------- " + this.getByteTotal() + "b real" + timer.elapsed( TimeUnit.MILLISECONDS ) + "ms" );
AELog.crafting( "------------- " + this.bytes + "b real" + timer.elapsed( TimeUnit.MILLISECONDS ) + "ms" );
// if ( mode == Actionable.MODULATE )
// craftingInventory.moveItemsToStorage( storage );
}
@@ -203,7 +204,7 @@ public class CraftingJob implements Runnable, ICraftingJob
AELog.crafting( s + " * " + ti.times + " = " + (ti.perOp * ti.times) );
}
AELog.crafting( "------------- " + this.getByteTotal() + "b simulate" + timer.elapsed( TimeUnit.MILLISECONDS ) + "ms" );
AELog.crafting( "------------- " + this.bytes + "b simulate" + timer.elapsed( TimeUnit.MILLISECONDS ) + "ms" );
}
catch (CraftBranchFailure e1)
{
@@ -292,7 +293,7 @@ public class CraftingJob implements Runnable, ICraftingJob
synchronized (this.monitor)
{
if ( this.isDone() )
if ( this.done )
return false;
this.watch.reset();
@@ -324,7 +325,7 @@ public class CraftingJob implements Runnable, ICraftingJob
public void handlePausing() throws InterruptedException
{
if ( this.incTime++ > 100 )
if ( this.incTime > 100 )
{
this.incTime = 0;
@@ -353,6 +354,7 @@ public class CraftingJob implements Runnable, ICraftingJob
if ( Thread.interrupted() )
throw new InterruptedException();
}
this.incTime++;
}
private void log(String string)
@@ -41,7 +41,7 @@ public class CraftingLinkNexus
public boolean isDead(IGrid g, CraftingGridCache craftingGridCache)
{
if ( this.isCanceled() || this.isDone() )
if ( this.canceled || this.done )
return true;
if ( this.req == null || this.cpu == null )
+1 -1
View File
@@ -33,7 +33,7 @@ import appeng.tile.AEBaseTile;
public class TileItemGen extends AEBaseTile implements IInventory
{
public static final Queue<ItemStack> POSSIBLE_ITEMS = new LinkedList<ItemStack>();
private static final Queue<ItemStack> POSSIBLE_ITEMS = new LinkedList<ItemStack>();
public TileItemGen() {
if ( POSSIBLE_ITEMS.isEmpty() )
@@ -60,11 +60,12 @@ final public class EntityChargedQuartz extends AEBaseEntityItem
if ( !AEConfig.instance.isFeatureEnabled( AEFeature.inWorldFluix ) )
return;
if ( Platform.isClient() && this.delay++ > 30 && AEConfig.instance.enableEffects )
if ( Platform.isClient() && this.delay > 30 && AEConfig.instance.enableEffects )
{
CommonHelper.proxy.spawnEffect( EffectType.Lightning, this.worldObj, this.posX, this.posY, this.posZ, null );
this.delay = 0;
}
this.delay++;
int j = MathHelper.floor_double( this.posX );
int i = MathHelper.floor_double( this.posY );
@@ -48,8 +48,9 @@ final public class EntityFloatingItem extends EntityItem
if ( !this.isDead && this.parent.isDead )
this.setDead();
if ( this.superDeath++ > 100 )
if ( this.superDeath > 100 )
this.setDead();
this.superDeath++;
this.age = ageStatic;
}
@@ -118,7 +118,8 @@ final public class EntitySingularity extends AEBaseEntityItem
ItemStack Output = AEApi.instance().materials().materialQESingularity.stack( 2 );
NBTTagCompound cmp = Platform.openNbtData( Output );
cmp.setLong( "freq", ( new Date() ).getTime() * 100 + ( randTickSeed++ ) % 100 );
cmp.setLong( "freq", ( new Date() ).getTime() * 100 + ( randTickSeed ) % 100 );
randTickSeed++;
item.stackSize--;
this.worldObj.spawnEntityInWorld( new EntitySingularity( this.worldObj, this.posX, this.posY, this.posZ, Output ) );
@@ -91,7 +91,7 @@ final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
this.setDead();
}
if ( this.fuse-- <= 0 )
if ( this.fuse <= 0 )
{
this.setDead();
@@ -104,6 +104,7 @@ final public class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit
{
this.worldObj.spawnParticle( "smoke", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D );
}
this.fuse--;
}
// override :P
+4 -2
View File
@@ -40,7 +40,7 @@ public enum PartRegistry
return this.name;
}
private PartRegistry(String name, Class<? extends AEBaseBlock> blk, Class<? extends TMultiPart> part) {
PartRegistry( String name, Class<? extends AEBaseBlock> blk, Class<? extends TMultiPart> part ) {
this.name = name;
this.blk = blk;
this.part = part;
@@ -67,7 +67,9 @@ public enum PartRegistry
for (PartRegistry pr : values())
{
if ( pr.equals( c ) )
return pr.getName();
{
return pr.name;
}
}
throw new RuntimeException( "Invalid PartName" );
}
@@ -1080,7 +1080,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
{
if ( mop.blockX == te.xCoord && mop.blockY == te.yCoord && mop.blockZ == te.zCoord )
{
ItemStack g = blk.getPickBlock( mop, w, te.xCoord, te.yCoord, te.zCoord );
ItemStack g = blk.getPickBlock( mop, w, te.xCoord, te.yCoord, te.zCoord, null );
if ( g != null )
what = g;
}
@@ -232,12 +232,18 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
int offset = 0;
this.condensedInputs = new IAEItemStack[tmpInputs.size()];
for (IAEItemStack io : tmpInputs.values())
this.condensedInputs[offset++] = io;
{
this.condensedInputs[offset] = io;
offset++;
}
offset = 0;
this.condensedOutputs = new IAEItemStack[tmpOutputs.size()];
for (IAEItemStack io : tmpOutputs.values())
this.condensedOutputs[offset++] = io;
{
this.condensedOutputs[offset] = io;
offset++;
}
}
@Override
@@ -27,6 +27,7 @@ import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.features.ILocatable;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.api.implementations.tiles.IWirelessAccessPoint;
@@ -76,12 +77,12 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost
this.myPlayer = ep;
this.wth = wh;
Object obj = null;
ILocatable obj = null;
try
{
long encKey = Long.parseLong( this.encryptionKey );
obj = AEApi.instance().registries().locatable().findLocatableBySerial( encKey );
obj = AEApi.instance().registries().locatable().getLocatableBy( encKey );
}
catch (NumberFormatException err)
{
@@ -279,8 +280,10 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost
if ( this.wth != null && this.effectiveItem != null )
{
if ( mode == Actionable.SIMULATE )
return this.wth.hasPower( this.myPlayer, amt, this.getItemStack() ) ? amt : 0;
return this.wth.usePower( this.myPlayer, amt, this.getItemStack() ) ? amt : 0;
{
return this.wth.hasPower( this.myPlayer, amt, this.effectiveItem ) ? amt : 0;
}
return this.wth.usePower( this.myPlayer, amt, this.effectiveItem ) ? amt : 0;
}
return 0.0;
}
+1 -1
View File
@@ -88,7 +88,7 @@ public class AETrading implements IVillageTradeHandler
ItemStack reverseTo = From.copy();
ItemStack reverseFrom = To.copy();
reverseFrom.stackSize = (int) (reverseFrom.stackSize * (rand.nextFloat() * 3.0f + 1.0f));
reverseFrom.stackSize *= rand.nextFloat() * 3.0f + 1.0f;
this.addToList( list, reverseFrom, reverseTo );
}
+7 -5
View File
@@ -18,6 +18,7 @@
package appeng.hooks;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
@@ -27,10 +28,6 @@ import java.util.WeakHashMap;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import com.google.common.base.Stopwatch;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
import net.minecraft.world.World;
import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.event.world.WorldEvent;
@@ -41,6 +38,10 @@ import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.Type;
import cpw.mods.fml.common.gameevent.TickEvent.WorldTickEvent;
import com.google.common.base.Stopwatch;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
import appeng.api.AEApi;
import appeng.api.networking.IGridNode;
import appeng.api.parts.CableRenderMode;
@@ -118,8 +119,9 @@ public class TickHandler
while (i.hasNext())
{
PlayerColor pc = i.next();
if ( pc.ticksLeft-- <= 0 )
if ( pc.ticksLeft <= 0 )
i.remove();
pc.ticksLeft--;
}
}
@@ -19,6 +19,7 @@
package appeng.integration;
import java.util.Collection;
import java.util.LinkedList;
import cpw.mods.fml.relauncher.FMLLaunchHandler;
@@ -29,7 +30,7 @@ public enum IntegrationRegistry
{
INSTANCE;
private final LinkedList<IntegrationNode> modules = new LinkedList<IntegrationNode>();
private final Collection<IntegrationNode> modules = new LinkedList<IntegrationNode>();
public void add( IntegrationType type )
{
@@ -59,19 +60,20 @@ public enum IntegrationRegistry
public String getStatus()
{
String out = null;
final StringBuilder builder = new StringBuilder( this.modules.size() * 3 );
for ( IntegrationNode node : this.modules )
{
String str = node.shortName + ":" + ( node.state == IntegrationStage.FAILED ? "OFF" : "ON" );
if ( builder.length() != 0 )
{
builder.append( ", " );
}
if ( out == null )
out = str;
else
out += ", " + str;
final String integrationState = node.shortName + ":" + ( node.state == IntegrationStage.FAILED ? "OFF" : "ON" );
builder.append( integrationState );
}
return out;
return builder.toString();
}
public boolean isEnabled( IntegrationType name )
@@ -66,7 +66,7 @@ public enum IntegrationType
public final String dspName;
public final String modID;
private IntegrationType(IntegrationSide side, String Name, String modid) {
IntegrationType( IntegrationSide side, String Name, String modid ) {
this.side = side;
this.dspName = Name;
this.modID = modid;
@@ -156,7 +156,7 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
}
catch (Exception e)
{
if ( errCount++ >= 5 )
if ( errCount >= 5 )
{
CraftGuideLog
.log( "CraftGuide DefaultRecipeProvider: Stack trace limit reached, further stack traces from this invocation will not be logged to the console. They will still be logged to (.minecraft)/config/CraftGuide/CraftGuide.log",
@@ -167,6 +167,7 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
{
e.printStackTrace();
}
errCount++;
CraftGuideLog.log( e );
}
@@ -19,13 +19,14 @@
package appeng.integration.modules;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import mekanism.api.RecipeHelper;
import cpw.mods.fml.common.event.FMLInterModComms;
import appeng.integration.BaseModule;
import appeng.integration.abstraction.IMekanism;
public class Mekanism extends BaseModule implements IMekanism
public final class Mekanism extends BaseModule implements IMekanism
{
public static Mekanism instance;
@@ -45,13 +46,31 @@ public class Mekanism extends BaseModule implements IMekanism
@Override
public void addCrusherRecipe(ItemStack in, ItemStack out)
{
RecipeHelper.addCrusherRecipe( in, out );
final NBTTagCompound sendTag = this.convertToSimpleRecipe( in, out );
FMLInterModComms.sendMessage( "mekanism", "CrusherRecipe", sendTag );
}
@Override
public void addEnrichmentChamberRecipe(ItemStack in, ItemStack out)
{
RecipeHelper.addEnrichmentChamberRecipe( in, out );
final NBTTagCompound sendTag = this.convertToSimpleRecipe( in, out );
FMLInterModComms.sendMessage( "mekanism", "EnrichmentChamberRecipe", sendTag );
}
private NBTTagCompound convertToSimpleRecipe( ItemStack in, ItemStack out )
{
final NBTTagCompound sendTag = new NBTTagCompound();
final NBTTagCompound inputTagDummy = new NBTTagCompound();
final NBTTagCompound outputTagDummy = new NBTTagCompound();
final NBTTagCompound inputTag = in.writeToNBT( inputTagDummy );
final NBTTagCompound outputTag = out.writeToNBT( outputTagDummy );
sendTag.setTag( "input", inputTag );
sendTag.setTag( "output", outputTag );
return sendTag;
}
}
@@ -66,7 +66,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
{
ItemStack f = Platform.cloneItemStack( target );
f.stackSize = amount;
return cs.extractItems( f, amount );
return this.cs.extractItems( f, amount );
}
return null;
@@ -25,7 +25,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
@@ -63,9 +63,11 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
amt = usePowerMultiplier.multiply( amt );
if ( mode == Actionable.SIMULATE )
return usePowerMultiplier.divide( Math.min( amt, this.ips.getAECurrentPower( this.getItemStack() ) ) );
{
return usePowerMultiplier.divide( Math.min( amt, this.ips.getAECurrentPower( this.target ) ) );
}
return usePowerMultiplier.divide( this.ips.extractAEPower( this.getItemStack(), amt ) );
return usePowerMultiplier.divide( this.ips.extractAEPower( this.target, amt ) );
}
@Override
@@ -50,7 +50,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketClick;
import appeng.items.AEBaseItem;
import appeng.items.contents.NetworkToolViewer;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.Integration.Interface;
import appeng.util.Platform;
@@ -29,9 +29,9 @@ import ic2.api.item.IElectricItemManager;
import ic2.api.item.ISpecialElectricItem;
import appeng.api.config.PowerUnits;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.integration.InterfaceList;
import appeng.transformer.annotations.integration.Method;
import appeng.transformer.annotations.Integration.Interface;
import appeng.transformer.annotations.Integration.InterfaceList;
import appeng.transformer.annotations.Integration.Method;
@InterfaceList( value = { @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = "IC2" ),

Some files were not shown because too many files have changed in this diff Show More