Compare commits

..

8 Commits

Author SHA1 Message Date
fscan fa2b4fabc7 Fix ConcurrentModificatonException in NetworkEventBus (#3660) 2018-08-01 00:35:44 +02:00
Saereth f8d5f4ddb1 Fixes #3478: Changes the way xp drops from Certus Ore blocks (#3482) 2018-06-26 23:36:21 +02:00
fscan f8dfa2619e Fixes #3535: Prevent crash when either quartz types are disabled (#3542)
* Fixes crash when either quartz types are disabled and prevent cascading worldgen.
* Also fixes  #3486
2018-06-26 15:31:03 +02:00
fscan c1d1dc947f Fixes #3548: AEBaseTile now respect overridden markDirty implementations. (#3550) 2018-06-26 10:33:56 +02:00
fscan 6bb465be0b Fixes #3449: Prevent CellInventory#getCell() from mutating the cell itemstack definition (#3552)
CellInventory#getCell() initalizes the ItemStack with an empty NBT and therefore was messing with the item definition.
2018-06-26 10:32:58 +02:00
fscan 8902af9766 Fixes #3459: Open the inventory if raytrace misses (#3549) 2018-06-26 10:31:17 +02:00
fscan 2b592dd40e Fixes DriveBakedModel to not crash when SLOT_STATE is null (#3545)
Uses a null object in case the TE is not available for whichever reason.
2018-06-18 19:03:28 +02:00
fscan 41e7558b24 Fixes interface shift-clicking to generate correct onChangeInventory events (#3544) 2018-06-18 19:01:17 +02:00
466 changed files with 7930 additions and 15560 deletions
+5 -6
View File
@@ -27,18 +27,17 @@ A Mod about Matter, Energy and using them to conquer the world..
* [Website](http://ae-mod.info/)
* [IRC #appliedenergistics on esper.net](http://webchat.esper.net/?channels=appliedenergistics&prompt=1)
* [GitHub](https://github.com/AppliedEnergistics/Applied-Energistics-2)
* [Discord](https://discord.gg/DJ9hVAN)
## License
* Applied Energistics 2 API
- (c) 2013 - 2018 AlgorithmX2 et al
- (c) 2013 - 2017 AlgorithmX2 et al
- [![License](https://img.shields.io/badge/License-MIT-red.svg?style=flat-square)](http://opensource.org/licenses/MIT)
* Applied Energistics 2
- (c) 2013 - 2018 AlgorithmX2 et al
- (c) 2013 - 2017 AlgorithmX2 et al
- [![License](https://img.shields.io/badge/License-LGPLv3-blue.svg?style=flat-square)](https://raw.githubusercontent.com/AppliedEnergistics/Applied-Energistics-2/rv2/LICENSE)
* Textures and Models
- (c) 2013 - 2018 AlgorithmX2 et al
- (c) 2013 - 2017 AlgorithmX2 et al
- [![License](https://img.shields.io/badge/License-CC%20BY--NC--SA%203.0-yellow.svg?style=flat-square)](https://creativecommons.org/licenses/by-nc-sa/3.0/)
* Text and Translations
- [![License](https://img.shields.io/badge/License-No%20Restriction-green.svg?style=flat-square)](https://creativecommons.org/publicdomain/zero/1.0/)
@@ -147,14 +146,14 @@ Universal builds obtained [Here](http://ae2.ae-mod.info/Downloads/) should work
When compiling against the AE2 API you can use gradle dependencies, just add
dependencies {
compile "appeng:appliedenergistics2:rv_-_____-__:api"
compile "appeng:appliedenergistics2:rv_-_____-__:dev"
}
or add the compile line to your existing dependencies task to your build.gradle
Where the __ are filled in with the correct version criteria; AE2 is available from the default forge maven so no additional repositories are necessary.
An example string would be `appeng:appliedenergistics2:rv5-stable-1:api` for the API only or `appeng:appliedenergistics2:rv5-stable-1` for the whole mod.
An example string would be `appeng:appliedenergistics2:rv2-alpha-30:dev`
## Applied Energistics 2 CraftTweaker
+8 -8
View File
@@ -9,22 +9,22 @@ aebasename=appliedenergistics2
#########################################################
minecraft_version=1.12.2
mcp_mappings=snapshot_20171003
forge_version=14.23.3.2655
forge_version=14.23.1.2554
#########################################################
# Installable #
#########################################################
hwyla_version=1.8.26-B41_1.12.2
hwyla_version=1.8.20-B35_1.12
#########################################################
# Provided APIs #
#########################################################
jei_version=4.10.0.198
tesla_version=1.0.63
ic2_version=2.8.73-ex112
top_version=1.12-1.4.23-16
cofhcore_version=1.12.2-4.5.2.19
crafttweaker_version=4.1.8.9
jei_version=4.8.0.105
tesla_version=1.0.61
ic2_version=2.8.19-ex112
top_version=1.12-1.4.18-10
cofhcore_version=1.12-4.+
crafttweaker_version=4.0.10.310
#########################################################
# Deployment #
+1 -1
View File
@@ -83,7 +83,7 @@ dependencies {
// compile against provided APIs
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
compileOnly "net.darkhax.tesla:Tesla-1.12:${tesla_version}"
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
@@ -148,8 +148,6 @@ public interface IBlocks
ITileDefinition iface();
ITileDefinition fluidIface();
ITileDefinition cellWorkbench();
ITileDefinition iOPort();
@@ -88,14 +88,6 @@ public interface IItems
IItemDefinition cell64k();
IItemDefinition fluidCell1k();
IItemDefinition fluidCell4k();
IItemDefinition fluidCell16k();
IItemDefinition fluidCell64k();
IItemDefinition spatialCell2();
IItemDefinition spatialCell16();
@@ -134,12 +134,4 @@ public interface IMaterials
IItemDefinition qESingularity();
IItemDefinition blankPattern();
IItemDefinition fluidCell1kPart();
IItemDefinition fluidCell4kPart();
IItemDefinition fluidCell16kPart();
IItemDefinition fluidCell64kPart();
}
@@ -39,7 +39,7 @@ public interface IParts
AEColoredItemDefinition cableGlass();
AEColoredItemDefinition cableDenseCovered();
AEColoredItemDefinition cableDenseSmart();
AEColoredItemDefinition lumenCableSmart();
@@ -64,8 +64,6 @@ public interface IParts
IItemDefinition iface();
IItemDefinition fluidIface();
IItemDefinition levelEmitter();
IItemDefinition annihilationPlane();
@@ -109,18 +107,4 @@ public interface IParts
IItemDefinition storageMonitor();
IItemDefinition conversionMonitor();
IItemDefinition fluidTerminal();
IItemDefinition fluidImportBus();
IItemDefinition fluidExportBus();
IItemDefinition fluidStorageBus();
IItemDefinition fluidLevelEmitter();
IItemDefinition fluidAnnihilationPlane();
IItemDefinition fluidFormationnPlane();
}
@@ -27,8 +27,7 @@ package appeng.api.implementations.items;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ICellWorkbenchItem;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IAEItemStack;
/**
@@ -41,7 +40,7 @@ import appeng.api.storage.data.IAEStack;
*
* The standard AE implementation only provides 1-63 Types
*/
public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
public interface IStorageCell extends ICellWorkbenchItem
{
/**
@@ -83,7 +82,7 @@ public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
*
* @return true to preventAdditionOfItem
*/
boolean isBlackListed( ItemStack cellItem, T requestedAddition );
boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition );
/**
* Allows you to specify if this storage cell can be stored inside other
@@ -110,9 +109,4 @@ public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
* @return drain in ae/t this storage cell will use.
*/
double getIdleDrain();
/**
* @return the type of channel your cell should be part of
*/
IStorageChannel<T> getChannel();
}
+4 -13
View File
@@ -24,8 +24,6 @@
package appeng.api.networking;
import javax.annotation.Nonnull;
import appeng.api.networking.events.MENetworkEvent;
import appeng.api.util.IReadOnlyCollection;
@@ -45,8 +43,7 @@ public interface IGrid
*
* @return the IGridCache you requested.
*/
@Nonnull
<C extends IGridCache> C getCache( @Nonnull Class<? extends IGridCache> iface );
<C extends IGridCache> C getCache( Class<? extends IGridCache> iface );
/**
* Post an event into the network event bus.
@@ -55,8 +52,7 @@ public interface IGrid
*
* @return returns ev back to original poster
*/
@Nonnull
MENetworkEvent postEvent( @Nonnull MENetworkEvent ev );
MENetworkEvent postEvent( MENetworkEvent ev );
/**
* Post an event into the network event bus, but direct it at a single node.
@@ -65,8 +61,7 @@ public interface IGrid
*
* @return returns ev back to original poster
*/
@Nonnull
MENetworkEvent postEventTo( @Nonnull IGridNode node, @Nonnull 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,
@@ -74,7 +69,6 @@ public interface IGrid
*
* @return IReadOnlyCollection of all available host types (Of Type IGridHost).
*/
@Nonnull
IReadOnlyCollection<Class<? extends IGridHost>> getMachinesClasses();
/**
@@ -84,13 +78,11 @@ public interface IGrid
*
* @return IMachineSet of all nodes belonging to hosts of specified class.
*/
@Nonnull
IMachineSet getMachines( @Nonnull Class<? extends IGridHost> gridHostClass );
IMachineSet getMachines( Class<? extends IGridHost> gridHostClass );
/**
* @return IReadOnlyCollection for all nodes on the network, node visitors are preferred.
*/
@Nonnull
IReadOnlyCollection<IGridNode> getNodes();
/**
@@ -101,6 +93,5 @@ public interface IGrid
/**
* @return the node considered the pivot point of the grid.
*/
@Nonnull
IGridNode getPivot();
}
@@ -26,10 +26,6 @@ package appeng.api.networking;
import java.util.EnumSet;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
@@ -53,7 +49,6 @@ public interface IGridBlock
*
* @return ae/t to use.
*/
@Nonnegative
double getIdlePowerUsage();
/**
@@ -61,11 +56,10 @@ public interface IGridBlock
*
* @return Set of flags for this IGridBlock
*/
@Nonnull
EnumSet<GridFlags> getFlags();
/**
* Generally speaking you will return true for this, the one exception is buses, or worm holes where the node
* generally speaking you will return true for this, the one exception is buses, or worm holes where the node
* represents something that isn't a real connection in the world, but rather one represented internally to the
* block.
*
@@ -74,46 +68,37 @@ public interface IGridBlock
boolean isWorldAccessible();
/**
* Must not return when {@link #isWorldAccessible()} is true.
* Otherwise the behavior is unspecified.
*
* @return current location of this node
*/
@Nonnull
DimensionalCoord getLocation();
/**
* @return Transparent, or a valid color, NULL IS NOT A VALID RETURN
*/
@Nonnull
AEColor getGridColor();
/**
* Notifies your IGridBlock that changes were made to your connections
*/
void onGridNotification( @Nonnull GridNotification notification );
void onGridNotification( GridNotification notification );
/**
* Update Blocks network/connection/booting status. grid,
*
* @param grid grid
* @param channelsInUse used channels
* @deprecated to be removed in rv7
*/
@Deprecated
void setNetworkStatus( IGrid grid, int channelsInUse );
/**
* Determine which sides of the block can be connected too, only used when isWorldAccessible returns true, not used
* for {@link IPart} implementations.
*/
@Nonnull
EnumSet<EnumFacing> getConnectableSides();
/**
* @return the IGridHost for the node, this will be an IGridPart or a TileEntity generally speaking.
*/
@Nonnull
IGridHost getMachine();
/**
@@ -126,6 +111,5 @@ public interface IGridBlock
*
* @return the render item stack to use to render this node, null is valid, and will not show this node.
*/
@Nullable
ItemStack getMachineRepresentation();
}
@@ -24,9 +24,6 @@
package appeng.api.networking;
import javax.annotation.Nonnull;
/**
* Allows you to create a network wise service, AE2 uses these for providing
* item, spatial, and tunnel services.
@@ -53,7 +50,7 @@ public interface IGridCache
* @param gridNode removed from that grid
* @param machine to be removed machine
*/
void removeNode( @Nonnull IGridNode gridNode, @Nonnull IGridHost machine );
void removeNode( IGridNode gridNode, IGridHost machine );
/**
* informs you cache that a machine was added to the grid.
@@ -65,7 +62,7 @@ public interface IGridCache
* @param gridNode added to grid node
* @param machine to be added machine
*/
void addNode( @Nonnull IGridNode gridNode, @Nonnull IGridHost machine );
void addNode( IGridNode gridNode, IGridHost machine );
/**
* Called when a grid splits into two grids, AE will call a split as it
@@ -74,7 +71,7 @@ public interface IGridCache
*
* @param destinationStorage storage which receives half of old grid
*/
void onSplit( @Nonnull IGridStorage destinationStorage );
void onSplit( IGridStorage destinationStorage );
/**
* Called when two grids merge into one, AE will call a join as it
@@ -83,12 +80,12 @@ public interface IGridCache
*
* @param sourceStorage old storage
*/
void onJoin( @Nonnull IGridStorage sourceStorage );
void onJoin( IGridStorage sourceStorage );
/**
* Called when saving changes,
*
* @param destinationStorage storage
*/
void populateGridStorage( @Nonnull IGridStorage destinationStorage );
void populateGridStorage( IGridStorage destinationStorage );
}
@@ -24,9 +24,7 @@
package appeng.api.networking;
import java.util.Map;
import javax.annotation.Nonnull;
import java.util.HashMap;
/**
@@ -40,14 +38,14 @@ public interface IGridCacheRegistry
*
* @param iface grid cache class
*/
void registerGridCache( @Nonnull Class<? extends IGridCache> iface, @Nonnull Class<? extends IGridCache> implementation );
void registerGridCache( Class<? extends IGridCache> iface, Class<? extends IGridCache> implementation );
/**
* requests a new INSTANCE of a grid cache for use, used internally
*
* @param grid grid
*
* @return a new Map of IGridCaches from the registry, called from IGrid when constructing a new grid.
* @return a new HashMap of IGridCaches from the registry, called from IGrid when constructing a new grid.
*/
Map<Class<? extends IGridCache>, IGridCache> createCacheInstance( IGrid grid );
HashMap<Class<? extends IGridCache>, IGridCache> createCacheInstance( IGrid grid );
}
@@ -24,8 +24,6 @@
package appeng.api.networking;
import javax.annotation.Nonnull;
import appeng.api.util.AEPartLocation;
@@ -47,7 +45,6 @@ public interface IGridConnection
*
* @return the IGridNode which represents the opposite side of the connection.
*/
@Nonnull
IGridNode getOtherSide( IGridNode gridNode );
/**
@@ -57,7 +54,6 @@ public interface IGridConnection
*
* @return the direction of the connection, only valid for in world connections.
*/
@Nonnull
AEPartLocation getDirection( IGridNode gridNode );
/**
@@ -69,13 +65,11 @@ public interface IGridConnection
/**
* @return node A
*/
@Nonnull
IGridNode a();
/**
* @return node B
*/
@Nonnull
IGridNode b();
/**
@@ -24,9 +24,6 @@
package appeng.api.networking;
import javax.annotation.Nonnull;
public interface IGridConnectionVisitor extends IGridVisitor
{
@@ -35,5 +32,5 @@ public interface IGridConnectionVisitor extends IGridVisitor
*
* @param n the connection.
*/
void visitConnection( @Nonnull IGridConnection n );
void visitConnection( IGridConnection n );
}
@@ -24,14 +24,12 @@
package appeng.api.networking;
import javax.annotation.Nonnull;
import appeng.api.exceptions.FailedConnectionException;
/**
* A helper responsible for creating new {@link IGridNode}, {@link IGridConnection} or potentially similar tasks.
*
*
* @author yueh
* @version rv5
* @since rv5
@@ -41,7 +39,7 @@ public interface IGridHelper
/**
* Create a grid node for your {@link IGridHost}
*
*
* The passed {@link IGridBlock} represents the definition for properties like connectable sides.
* Refer to its documentation for further details.
*
@@ -49,20 +47,18 @@ public interface IGridHelper
*
* @return grid node of block
*/
@Nonnull
IGridNode createGridNode( @Nonnull IGridBlock block );
IGridNode createGridNode( IGridBlock block );
/**
* Create a direct connection between two {@link IGridNode}.
*
*
* This will be considered as having a distance of 1, regardless of the location of both nodes.
*
*
* @param a to be connected gridnode
* @param b to be connected gridnode
*
* @throws appeng.api.exceptions.FailedConnectionException
*/
@Nonnull
IGridConnection createGridConnection( @Nonnull IGridNode a, @Nonnull IGridNode b ) throws FailedConnectionException;
IGridConnection createGridConnection( IGridNode a, IGridNode b ) throws FailedConnectionException;
}
@@ -24,9 +24,6 @@
package appeng.api.networking;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.tileentity.TileEntity;
import appeng.api.parts.IPart;
@@ -52,8 +49,7 @@ public interface IGridHost
* @return a new IGridNode, create these with
* AEApi.INSTANCE().createGridNode( MyIGridBlock )
*/
@Nullable
IGridNode getGridNode( @Nonnull AEPartLocation dir );
IGridNode getGridNode( AEPartLocation dir );
/**
* Determines how cables render when they connect to this block. Priority is
@@ -61,8 +57,7 @@ public interface IGridHost
*
* @param dir direction
*/
@Nonnull
AECableType getCableConnectionType( @Nonnull AEPartLocation dir );
AECableType getCableConnectionType( AEPartLocation dir );
/**
* break this host, its violating security rules, just break your block, or part.
@@ -26,8 +26,6 @@ package appeng.api.networking;
import java.util.Iterator;
import javax.annotation.Nonnull;
/**
* An extension of IGridBlock, only means something when your getFlags() contains REQUIRE_CHANNEL, when done properly it
@@ -42,6 +40,5 @@ public interface IGridMultiblock extends IGridBlock
*
* @return an iterator that will iterate all the nodes for the multiblock. ( read-only iterator expected. )
*/
@Nonnull
Iterator<IGridNode> getMultiblockNodes();
}
@@ -26,8 +26,6 @@ package appeng.api.networking;
import java.util.EnumSet;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@@ -52,7 +50,7 @@ public interface IGridNode
*
* @param visitor visitor
*/
void beginVisit( @Nonnull IGridVisitor visitor );
void beginVisit( IGridVisitor visitor );
/**
* inform the node that your IGridBlock has changed its internal state, and force the node to update.
@@ -70,7 +68,6 @@ public interface IGridNode
*
* @return grid host
*/
@Nonnull
IGridHost getMachine();
/**
@@ -78,7 +75,6 @@ public interface IGridNode
*
* @return grid
*/
@Nonnull
IGrid getGrid();
/**
@@ -90,13 +86,11 @@ public interface IGridNode
/**
* @return the world the node is located in
*/
@Nonnull
World getWorld();
/**
* @return a set of the connected sides, INTERNAL represents an invisible connection
*/
@Nonnull
EnumSet<AEPartLocation> getConnectedSides();
/**
@@ -104,13 +98,11 @@ public interface IGridNode
*
* @return grid connections
*/
@Nonnull
IReadOnlyCollection<IGridConnection> getConnections();
/**
* @return the IGridBlock for this node
*/
@Nonnull
IGridBlock getGridBlock();
/**
@@ -130,7 +122,7 @@ public interface IGridNode
* @param name nbt name
* @param nodeData to be loaded data
*/
void loadFromNBT( @Nonnull String name, @Nonnull 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
@@ -139,7 +131,7 @@ public interface IGridNode
* @param name nbt name
* @param nodeData to be saved data
*/
void saveToNBT( @Nonnull String name, @Nonnull 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
@@ -154,7 +146,7 @@ public interface IGridNode
*
* @return true if has flag
*/
boolean hasFlag( @Nonnull GridFlags flag );
boolean hasFlag( GridFlags flag );
/**
* @return the ownerID this represents the person who placed the node.
@@ -24,8 +24,6 @@
package appeng.api.networking;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound;
@@ -35,7 +33,6 @@ public interface IGridStorage
/**
* @return an NBTTagCompound that can be read, and written too.
*/
@Nonnull
NBTTagCompound dataObject();
/**
@@ -24,9 +24,6 @@
package appeng.api.networking;
import javax.annotation.Nonnull;
/**
* Simple Visitor pattern access to network nodes.
*/
@@ -42,5 +39,5 @@ public interface IGridVisitor
*
* @return true to continue visiting nodes beyond this node.
*/
boolean visitNode( @Nonnull IGridNode n );
boolean visitNode( IGridNode n );
}
@@ -24,8 +24,6 @@
package appeng.api.networking;
import javax.annotation.Nonnull;
import appeng.api.util.IReadOnlyCollection;
@@ -35,6 +33,5 @@ public interface IMachineSet extends IReadOnlyCollection<IGridNode>
/**
* @return the machine class for this set.
*/
@Nonnull
Class<? extends IGridHost> getMachineClass();
}
@@ -24,9 +24,6 @@
package appeng.api.networking.crafting;
import javax.annotation.Nonnull;
public interface ICraftingCallback
{
@@ -35,5 +32,5 @@ public interface ICraftingCallback
*
* @param job - final job
*/
void calculationComplete( @Nonnull ICraftingJob job );
void calculationComplete( ICraftingJob job );
}
@@ -24,8 +24,6 @@
package appeng.api.networking.energy;
import javax.annotation.Nonnull;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
@@ -44,7 +42,7 @@ public interface IAEPowerStorage extends IEnergySource
*
* @return amount of power which was unable to be stored
*/
double injectAEPower( double amt, @Nonnull Actionable mode );
double injectAEPower( double amt, Actionable mode );
/**
* @return the current maximum power ( this can change :P )
@@ -69,6 +67,5 @@ public interface IAEPowerStorage extends IEnergySource
*
* @return access restriction what the network can do
*/
@Nonnull
AccessRestriction getPowerFlow();
}
@@ -24,9 +24,6 @@
package appeng.api.networking.energy;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import appeng.api.config.Actionable;
import appeng.api.networking.IGridCache;
import appeng.api.networking.events.MENetworkPowerStatusChange;
@@ -41,20 +38,17 @@ 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.
*/
@Nonnegative
double getIdlePowerUsage();
/**
* @return the average power drain over the past 10 ticks, includes idle usage during this time, and all use of
* extractPower.
*/
@Nonnegative
double getAvgPowerUsage();
/**
* @return the average energy injected into the system per tick, for the last 10 ticks.
*/
@Nonnegative
double getAvgPowerInjection();
/**
@@ -85,15 +79,13 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
*
* @return the amount of power that the network has OVER the limit.
*/
@Nonnegative
double injectPower( @Nonnegative double amt, @Nonnull 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.
*/
@Nonnegative
double getStoredPower();
/**
@@ -101,7 +93,6 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
*
* @return estimated available power.
*/
@Nonnegative
double getMaxStoredPower();
/**
@@ -110,6 +101,5 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
*
* @return Amount of power required to charge the grid, in AE.
*/
@Nonnegative
double getEnergyDemand( @Nonnegative double maxRequired );
double getEnergyDemand( double maxRequired );
}
@@ -24,9 +24,6 @@
package appeng.api.networking.energy;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
@@ -42,6 +39,5 @@ public interface IEnergySource
*
* @return returns extracted power.
*/
@Nonnegative
double extractAEPower( @Nonnegative double amt, @Nonnull Actionable mode, @Nonnull PowerMultiplier usePowerMultiplier );
double extractAEPower( double amt, Actionable mode, PowerMultiplier usePowerMultiplier );
}
@@ -24,9 +24,6 @@
package appeng.api.networking.energy;
import javax.annotation.Nonnegative;
/**
* DO NOT IMPLEMENT.
*
@@ -42,7 +39,7 @@ public interface IEnergyWatcher
* @param amount
* @return true, if successfully added.
*/
boolean add( @Nonnegative double amount );
boolean add( double amount );
/**
* Remove a specific threshold from the watcher.
@@ -50,7 +47,7 @@ public interface IEnergyWatcher
* @param amount
* @return true, if successfully removed.
*/
boolean remove( @Nonnegative double amount );
boolean remove( double amount );
/**
* Removes all thresholds and resets the watcher to a clean state.
@@ -24,9 +24,6 @@
package appeng.api.networking.energy;
import javax.annotation.Nonnull;
public interface IEnergyWatcherHost
{
@@ -36,12 +33,12 @@ public interface IEnergyWatcherHost
*
* @param newWatcher new watcher
*/
void updateWatcher( @Nonnull IEnergyWatcher newWatcher );
void updateWatcher( IEnergyWatcher newWatcher );
/**
* Called when a threshold is crossed.
*
* @param energyGrid grid
*/
void onThresholdPass( @Nonnull IEnergyGrid energyGrid );
void onThresholdPass( IEnergyGrid energyGrid );
}
@@ -24,8 +24,6 @@
package appeng.api.networking.pathing;
import javax.annotation.Nonnull;
import appeng.api.networking.IGridCache;
@@ -41,7 +39,6 @@ public interface IPathingGrid extends IGridCache
* @return the controller state of the network, useful if you want to
* require a controller for a feature.
*/
@Nonnull
ControllerState getControllerState();
/**
@@ -24,8 +24,6 @@
package appeng.api.networking.security;
import javax.annotation.Nonnull;
import appeng.api.networking.IGridNode;
@@ -40,6 +38,5 @@ public interface IActionHost
* @return the the gridnode that actions from this IGridHost are preformed
* by.
*/
@Nonnull
IGridNode getActionableNode();
}
@@ -24,9 +24,6 @@
package appeng.api.networking.security;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.EntityPlayer;
import appeng.api.config.SecurityPermissions;
@@ -49,7 +46,7 @@ public interface ISecurityGrid extends IGridCache
*
* @return true if the player has permissions.
*/
boolean hasPermission( @Nonnull EntityPlayer player, @Nonnull SecurityPermissions perm );
boolean hasPermission( EntityPlayer player, SecurityPermissions perm );
/**
* Check if a player has permissions.
@@ -59,7 +56,7 @@ public interface ISecurityGrid extends IGridCache
*
* @return true if the player has permissions.
*/
boolean hasPermission( @Nonnegative int playerID, @Nonnull SecurityPermissions perm );
boolean hasPermission( int playerID, SecurityPermissions perm );
/**
* @return PlayerID of the admin, or owner, this is the person who placed the security block.
@@ -25,7 +25,7 @@ package appeng.api.networking.security;
import java.util.EnumSet;
import java.util.Map;
import java.util.HashMap;
import appeng.api.config.SecurityPermissions;
@@ -48,7 +48,7 @@ public interface ISecurityProvider
*
* @param playerPerms player permissions
*/
void readPermissions( Map<Integer, EnumSet<SecurityPermissions>> playerPerms );
void readPermissions( HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms );
/**
* @return is security on or off?
@@ -26,8 +26,6 @@ package appeng.api.networking.security;
import java.util.EnumSet;
import javax.annotation.Nonnull;
import appeng.api.config.SecurityPermissions;
@@ -43,5 +41,5 @@ public interface ISecurityRegistry
* @param playerID player id
* @param permissions permissions of player
*/
void addPlayer( int playerID, @Nonnull EnumSet<SecurityPermissions> permissions );
void addPlayer( int playerID, EnumSet<SecurityPermissions> permissions );
}
@@ -24,8 +24,6 @@
package appeng.api.networking.ticking;
import javax.annotation.Nonnull;
import appeng.api.networking.IGridNode;
@@ -47,18 +45,18 @@ public interface IGridTickable
*/
/**
* Return a valid TickingRequest to tell AE a guide for which type of
* responsiveness your device wants.
* You can return null, if you wish to tick using MC's ticking mechanism, or
* you can return a valid TickingRequest to tell AE a guide for which type
* of responsiveness your device wants.
*
* This will be called for your tile any time your tile changes grids, this
* this will be called for your tile any time your tile changes grids, this
* can happen at any time, so if your using the sleep feature you may wish
* to preserve your sleep, in the result of this method. or you can simply
* reset it.
*
* @return a valid new TickingRequest
* @return null or a valid new TickingRequest
*/
@Nonnull
TickingRequest getTickingRequest( @Nonnull IGridNode node );
TickingRequest getTickingRequest( IGridNode node );
/**
* AE lets you adjust your tick rate based on the results of your tick, if
@@ -69,12 +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
* @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.
*/
@Nonnull
TickRateModulation tickingRequest( @Nonnull IGridNode node, int ticksSinceLastCall );
TickRateModulation tickingRequest( IGridNode node, int TicksSinceLastCall );
}
@@ -24,8 +24,6 @@
package appeng.api.networking.ticking;
import javax.annotation.Nonnull;
import appeng.api.networking.IGridCache;
import appeng.api.networking.IGridNode;
@@ -44,7 +42,7 @@ public interface ITickManager extends IGridCache
*
* @param node gridnode
*/
boolean alertDevice( @Nonnull IGridNode node );
boolean alertDevice( IGridNode node );
/**
* disables ticking for your device.
@@ -53,7 +51,7 @@ public interface ITickManager extends IGridCache
*
* @return if the call was successful.
*/
boolean sleepDevice( @Nonnull IGridNode node );
boolean sleepDevice( IGridNode node );
/**
* enables ticking for your device, undoes a sleepDevice call.
@@ -62,5 +60,5 @@ public interface ITickManager extends IGridCache
*
* @return if the call was successful.
*/
boolean wakeDevice( @Nonnull IGridNode node );
boolean wakeDevice( IGridNode node );
}
@@ -28,10 +28,10 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IAEItemStack;
public interface ICellInventory<T extends IAEStack<T>> extends IMEInventory<T>
public interface ICellInventory extends IMEInventory<IAEItemStack>
{
/**
@@ -25,10 +25,10 @@ package appeng.api.storage;
import appeng.api.config.IncludeExclude;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IAEItemStack;
public interface ICellInventoryHandler<T extends IAEStack<T>> extends IMEInventoryHandler<T>
public interface ICellInventoryHandler extends IMEInventoryHandler<IAEItemStack>
{
/**
@@ -24,11 +24,7 @@
package appeng.api.storage;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import appeng.api.IAppEngApi;
import appeng.api.storage.data.IAEStack;
@@ -46,12 +42,9 @@ public interface ICellRegistry
/**
* Register a new handler.
*
* Never be call before {@link FMLInitializationEvent} was handled by AE2.
* Will throw an exception otherwise.
*
* @param handler cell handler
*/
void addCellHandler( @Nonnull ICellHandler handler );
void addCellHandler( ICellHandler handler );
/**
* return true, if you can get a InventoryHandler for the item passed.
@@ -70,7 +63,6 @@ public interface ICellRegistry
*
* @return the handler registered for this item type.
*/
@Nullable
ICellHandler getHandler( ItemStack is );
/**
@@ -82,6 +74,5 @@ public interface ICellRegistry
*
* @return new IMEInventoryHandler, or null if there isn't one.
*/
@Nullable
<T extends IAEStack<T>> IMEInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> chan );
}
@@ -149,14 +149,16 @@ public interface IAEStack<T extends IAEStack<T>>
boolean equals( Object obj );
/**
* Compare the same subtype of {@link IAEStack} with another using a fuzzy comparison.
* compare stacks using fuzzy logic
*
* @param other The stack to compare.
* @param mode Which {@link FuzzyMode} should be used.
* a IAEItemStack to another AEItemStack or a ItemStack.
*
* @param st stacks
* @param mode used fuzzy mode
*
* @return true if two stacks are equal based on AE Fuzzy Comparison.
*/
boolean fuzzyComparison( T other, FuzzyMode mode );
boolean fuzzyComparison( Object st, FuzzyMode mode );
/**
* Slower for disk saving, but smaller/more efficient for packets.
@@ -198,7 +200,7 @@ public interface IAEStack<T extends IAEStack<T>>
/**
* Returns itemstack for display and similar purposes. Always has a count of 1.
*
*
* @return itemstack
*/
ItemStack asItemStackRepresentation();
@@ -1,42 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.util;
public enum AECableSize
{
NONE,
NORMAL,
DENSE;
public static AECableSize min( AECableSize a, AECableSize b )
{
return a.compareTo( b ) < 0 ? a : b;
}
public static AECableSize max( AECableSize a, AECableSize b )
{
return a.compareTo( b ) > 0 ? a : b;
}
}
+6 -99
View File
@@ -29,32 +29,32 @@ public enum AECableType
/**
* No Cable present.
*/
NONE( AECableVariant.NONE, AECableSize.NONE ),
NONE,
/**
* Connections to this block should render as glass.
*/
GLASS( AECableVariant.GLASS, AECableSize.NORMAL ),
GLASS,
/**
* Connections to this block should render as covered.
*/
COVERED( AECableVariant.COVERED, AECableSize.NORMAL ),
COVERED,
/**
* Connections to this block should render as smart.
*/
SMART( AECableVariant.SMART, AECableSize.NORMAL ),
SMART,
/**
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
*/
DENSE_COVERED( AECableVariant.COVERED, AECableSize.DENSE ),
DENSE_COVERED,
/**
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
*/
DENSE_SMART( AECableVariant.SMART, AECableSize.DENSE );
DENSE_SMART;
public static final AECableType[] VALIDCABLES = {
GLASS,
@@ -64,97 +64,4 @@ public enum AECableType
DENSE_SMART
};
private final AECableVariant variant;
private final AECableSize size;
private AECableType( AECableVariant variant, AECableSize size )
{
this.variant = variant;
this.size = size;
}
public AECableSize size()
{
return size;
}
public AECableVariant variant()
{
return variant;
}
public boolean isValid()
{
return this.variant != AECableVariant.NONE && this.size != AECableSize.NONE;
}
public boolean isDense()
{
return this.size == AECableSize.DENSE;
}
public boolean isSmart()
{
return this.variant == AECableVariant.SMART;
}
public static AECableType min( AECableType a, AECableType b )
{
final AECableVariant v = AECableVariant.min( a.variant(), b.variant() );
final AECableSize s = AECableSize.min( a.size(), b.size() );
return AECableType.from( v, s );
}
public static AECableType max( AECableType a, AECableType b )
{
final AECableVariant v = AECableVariant.max( a.variant(), b.variant() );
final AECableSize s = AECableSize.max( a.size(), b.size() );
return AECableType.from( v, s );
}
private static AECableType from( AECableVariant variant, AECableSize size )
{
switch( variant )
{
case GLASS:
switch( size )
{
case NORMAL:
return GLASS;
default:
break;
}
break;
case COVERED:
switch( size )
{
case NORMAL:
return COVERED;
case DENSE:
return DENSE_COVERED;
default:
break;
}
break;
case SMART:
switch( size )
{
case NORMAL:
return SMART;
case DENSE:
return DENSE_SMART;
default:
break;
}
break;
default:
break;
}
return NONE;
}
}
@@ -1,43 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.util;
public enum AECableVariant
{
NONE,
GLASS,
COVERED,
SMART;
public static AECableVariant min( AECableVariant a, AECableVariant b )
{
return a.compareTo( b ) < 0 ? a : b;
}
public static AECableVariant max( AECableVariant a, AECableVariant b )
{
return a.compareTo( b ) > 0 ? a : b;
}
}
+27 -127
View File
@@ -22,11 +22,11 @@ package appeng.client.gui;
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@@ -46,8 +46,6 @@ import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ClickType;
@@ -56,11 +54,8 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fluids.Fluid;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.GuiCustomSlot;
import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.ITooltip;
import appeng.client.me.InternalSlotME;
@@ -71,7 +66,7 @@ import appeng.container.AEBaseContainer;
import appeng.container.slot.AppEngCraftingSlot;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.AppEngSlot.hasCalculatedValidness;
import appeng.container.slot.IOptionalSlot;
import appeng.container.slot.OptionalSlotFake;
import appeng.container.slot.SlotCraftingTerm;
import appeng.container.slot.SlotDisabled;
import appeng.container.slot.SlotFake;
@@ -84,24 +79,20 @@ import appeng.core.AppEng;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.core.sync.packets.PacketSwapSlots;
import appeng.fluids.client.render.FluidStackSizeRenderer;
import appeng.fluids.container.slots.IMEFluidSlot;
import appeng.helpers.InventoryAction;
public abstract class AEBaseGui extends GuiContainer
{
private final List<InternalSlotME> meSlots = new ArrayList<>();
private final List<InternalSlotME> meSlots = new LinkedList<>();
// drag y
private final Set<Slot> drag_click = new HashSet<>();
private final StackSizeRenderer stackSizeRenderer = new StackSizeRenderer();
private final FluidStackSizeRenderer fluidStackSizeRenderer = new FluidStackSizeRenderer();
private GuiScrollbar myScrollBar = null;
private boolean disableShiftClick = false;
private Stopwatch dbl_clickTimer = Stopwatch.createStarted();
private ItemStack dbl_whichItem = ItemStack.EMPTY;
private Slot bl_clicked;
protected final List<GuiCustomSlot> guiSlots = new ArrayList<>();
public AEBaseGui( final Container container )
{
@@ -155,76 +146,35 @@ public abstract class AEBaseGui extends GuiContainer
}
@Override
public void drawScreen( final int mouseX, final int mouseY, final float partialTicks )
public void drawScreen( final int mouseX, final int mouseY, final float btn )
{
super.drawDefaultBackground();
super.drawScreen( mouseX, mouseY, partialTicks );
GlStateManager.pushMatrix();
GlStateManager.translate( (float) this.guiLeft, (float) this.guiTop, 0.0F );
GlStateManager.enableDepth();
for( final GuiCustomSlot c : this.guiSlots )
{
drawGuiSlot( c, mouseX, mouseY, partialTicks );
}
GlStateManager.disableDepth();
for( final GuiCustomSlot c : this.guiSlots )
{
drawTooltip( c, mouseX - this.guiLeft, mouseY - this.guiTop );
}
GlStateManager.popMatrix();
super.drawScreen( mouseX, mouseY, btn );
this.renderHoveredToolTip( mouseX, mouseY );
for( final Object c : this.buttonList )
{
if( c instanceof ITooltip )
{
drawTooltip( (ITooltip) c, mouseX, mouseY );
}
}
}
final ITooltip tooltip = (ITooltip) c;
final int x = tooltip.xPos(); // ((GuiImgButton) c).x;
int y = tooltip.yPos(); // ((GuiImgButton) c).y;
protected void drawGuiSlot( GuiCustomSlot slot, int mouseX, int mouseY, float partialTicks )
{
if( slot.isSlotEnabled() )
{
final int left = slot.xPos();
final int top = slot.yPos();
final int right = left + slot.getWidth();
final int bottom = top + slot.getHeight();
slot.drawContent( this.mc, mouseX, mouseY, partialTicks );
if( this.isPointInRegion( left, top, slot.getWidth(), slot.getHeight(), mouseX, mouseY ) && slot.canClick( this.mc.player ) )
{
GlStateManager.disableLighting();
GlStateManager.colorMask( true, true, true, false );
this.drawGradientRect( left, top, right, bottom, -2130706433, -2130706433 );
GlStateManager.colorMask( true, true, true, true );
GlStateManager.enableLighting();
}
}
}
private void drawTooltip( ITooltip tooltip, int mouseX, int mouseY )
{
final int x = tooltip.xPos(); // ((GuiImgButton) c).x;
int y = tooltip.yPos(); // ((GuiImgButton) c).y;
if( x < mouseX && x + tooltip.getWidth() > mouseX && tooltip.isVisible() )
{
if( y < mouseY && y + tooltip.getHeight() > mouseY )
{
if( y < 15 )
if( x < mouseX && x + tooltip.getWidth() > mouseX && tooltip.isVisible() )
{
y = 15;
}
if( y < mouseY && y + tooltip.getHeight() > mouseY )
{
if( y < 15 )
{
y = 15;
}
final String msg = tooltip.getMessage();
if( msg != null )
{
this.drawTooltip( x + 11, y + 4, msg );
final String msg = tooltip.getMessage();
if( msg != null )
{
this.drawTooltip( x + 11, y + 4, msg );
}
}
}
}
}
@@ -286,36 +236,27 @@ public abstract class AEBaseGui extends GuiContainer
final List<Slot> slots = this.getInventorySlots();
for( final Slot slot : slots )
{
if( slot instanceof IOptionalSlot )
if( slot instanceof OptionalSlotFake )
{
final IOptionalSlot optionalSlot = (IOptionalSlot) slot;
if( optionalSlot.isRenderDisabled() )
final OptionalSlotFake fs = (OptionalSlotFake) slot;
if( fs.renderDisabled() )
{
final AppEngSlot aeSlot = (AppEngSlot) slot;
if( aeSlot.isSlotEnabled() )
if( fs.isSlotEnabled() )
{
this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1,
18,
this.drawTexturedModalRect( ox + fs.xPos - 1, oy + fs.yPos - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18,
18 );
}
else
{
GlStateManager.color( 1.0F, 1.0F, 1.0F, 0.4F );
GlStateManager.enableBlend();
this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1,
18,
this.drawTexturedModalRect( ox + fs.xPos - 1, oy + fs.yPos - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18,
18 );
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
}
}
}
}
for( final GuiCustomSlot slot : this.guiSlots )
{
slot.drawBackground( ox, oy );
}
}
@Override
@@ -336,14 +277,6 @@ public abstract class AEBaseGui extends GuiContainer
}
}
for( GuiCustomSlot slot : this.guiSlots )
{
if( this.isPointInRegion( slot.xPos(), slot.yPos(), slot.getWidth(), slot.getHeight(), xCoord, yCoord ) && slot.canClick( this.mc.player ) )
{
slot.slotClicked( this.mc.player.inventory.getItemStack(), btn );
}
}
if( this.getScrollBar() != null )
{
this.getScrollBar().click( this, xCoord - this.guiLeft, yCoord - this.guiTop );
@@ -782,39 +715,6 @@ public abstract class AEBaseGui extends GuiContainer
return;
}
else if( s instanceof IMEFluidSlot && ( (IMEFluidSlot) s ).shouldRenderAsFluid() )
{
final IMEFluidSlot slot = (IMEFluidSlot) s;
final IAEFluidStack fs = slot.getAEFluidStack();
if( fs != null && this.isPowered() )
{
GlStateManager.disableLighting();
GlStateManager.disableBlend();
final Fluid fluid = fs.getFluid();
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
final TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite( fluid.getStill().toString() );
// Set color for dynamic fluids
// Convert int color to RGB
float red = ( fluid.getColor() >> 16 & 255 ) / 255.0F;
float green = ( fluid.getColor() >> 8 & 255 ) / 255.0F;
float blue = ( fluid.getColor() & 255 ) / 255.0F;
GlStateManager.color( red, green, blue );
this.drawTexturedModalRect( s.xPos, s.yPos, sprite, 16, 16 );
GlStateManager.enableLighting();
GlStateManager.enableBlend();
this.fluidStackSizeRenderer.renderStackSize( this.fontRenderer, fs, s.xPos, s.yPos );
}
else if( !this.isPowered() )
{
drawRect( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111 );
}
return;
}
else
{
try
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import com.google.common.base.Joiner;
@@ -237,7 +238,7 @@ public class GuiCraftConfirm extends AEBaseGui
final int viewEnd = viewStart + 3 * this.rows;
String dspToolTip = "";
final List<String> lineList = new ArrayList<>();
final List<String> lineList = new LinkedList<>();
int toolPosX = 0;
int toolPosY = 0;
@@ -22,6 +22,7 @@ package appeng.client.gui.implementations;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -211,7 +212,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
final int viewEnd = viewStart + 3 * 6;
String dspToolTip = "";
final List<String> lineList = new ArrayList<>();
final List<String> lineList = new LinkedList<>();
int toolPosX = 0;
int toolPosY = 0;
@@ -82,8 +82,8 @@ public class GuiInterface extends GuiUpgradeable
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.Interface.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.Config.getLocal(), 8, 6 + 11 + 7, 4210752 );
this.fontRenderer.drawString( GuiText.StoredItems.getLocal(), 8, 6 + 60 + 7, 4210752 );
this.fontRenderer.drawString( GuiText.Config.getLocal(), 18, 6 + 11 + 7, 4210752 );
this.fontRenderer.drawString( GuiText.StoredItems.getLocal(), 18, 6 + 60 + 7, 4210752 );
this.fontRenderer.drawString( GuiText.Patterns.getLocal(), 8, 6 + 73 + 7, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
@@ -95,9 +95,6 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
private GuiImgButton SortDirBox;
private GuiImgButton searchBoxSettings;
private GuiImgButton terminalStyleBox;
private boolean isAutoFocus = false;
private int currentMouseX = 0;
private int currentMouseY = 0;
public GuiMEMonitorable( final InventoryPlayer inventoryPlayer, final ITerminalHost te )
{
@@ -227,10 +224,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
Keyboard.enableRepeatEvents( true );
this.maxRows = this.getMaxRows();
this.perRow = AEConfig.instance()
.getConfigManager()
.getSetting(
Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ( ( this.width - this.standardSize ) / 18 );
this.perRow = AEConfig.instance().getConfigManager().getSetting(
Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ( ( this.width - this.standardSize ) / 18 );
final int magicNumber = 114 + 1;
final int extraSpace = this.height - magicNumber - this.reservedSpace;
@@ -295,10 +290,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
offset += 20;
this.buttonList.add(
this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance()
.getConfigManager()
.getSetting(
Settings.SEARCH_MODE ) ) );
this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance().getConfigManager().getSetting(
Settings.SEARCH_MODE ) ) );
offset += 20;
@@ -313,7 +306,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.searchField.setEnableBackgroundDrawing( false );
this.searchField.setMaxStringLength( 25 );
this.searchField.setTextColor( 0xFFFFFF );
this.searchField.setSelectionColor( 0xFF008000 );
this.searchField.setSelectionColor( 0xFF99FF99 );
this.searchField.setVisible( true );
if( this.viewCell || this instanceof GuiWirelessTerm )
@@ -325,11 +318,13 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
final Enum searchModeSetting = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
this.isAutoFocus = SearchBoxMode.AUTOSEARCH == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH == searchModeSetting || SearchBoxMode.AUTOSEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH_KEEP == searchModeSetting;
final boolean isAutoFocus = SearchBoxMode.AUTOSEARCH == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH == searchModeSetting || SearchBoxMode.AUTOSEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH_KEEP == searchModeSetting;
final boolean isManualFocus = SearchBoxMode.MANUAL_SEARCH == searchModeSetting || SearchBoxMode.JEI_MANUAL_SEARCH == searchModeSetting || SearchBoxMode.MANUAL_SEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_MANUAL_SEARCH_KEEP == searchModeSetting;
final boolean isKeepFilter = SearchBoxMode.AUTOSEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH_KEEP == searchModeSetting || SearchBoxMode.MANUAL_SEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_MANUAL_SEARCH_KEEP == searchModeSetting;
final boolean isJEIEnabled = SearchBoxMode.JEI_AUTOSEARCH == searchModeSetting || SearchBoxMode.JEI_MANUAL_SEARCH == searchModeSetting;
this.searchField.setFocused( this.isAutoFocus );
this.searchField.setFocused( isAutoFocus );
this.searchField.setCanLoseFocus( isManualFocus );
if( isJEIEnabled )
{
@@ -379,9 +374,6 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
{
this.fontRenderer.drawString( this.getGuiDisplayName( this.myName.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.currentMouseX = mouseX;
this.currentMouseY = mouseY;
}
@Override
@@ -478,40 +470,18 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
@Override
protected void keyTyped( final char character, final int key ) throws IOException
{
if( !this.checkHotbarKeys( key ) )
{
if( key == Keyboard.KEY_TAB )
{
this.searchField.setFocused( !this.searchField.isFocused() );
return;
}
if( this.searchField.isFocused() && ( key == Keyboard.KEY_ESCAPE || key == Keyboard.KEY_RETURN ) )
{
this.searchField.setFocused( false );
return;
}
if( character == ' ' && this.searchField.getText().isEmpty() )
{
return;
}
final boolean mouseInGui = this.isPointInRegion( 0, 0, this.xSize, this.ySize, this.currentMouseX, this.currentMouseY );
if( this.isAutoFocus && !this.searchField.isFocused() && mouseInGui )
{
this.searchField.setFocused( true );
}
if( this.searchField.textboxKeyTyped( character, key ) )
{
this.repo.setSearchString( this.searchField.getText() );
this.repo.updateView();
this.setScrollBar();
// tell forge the key event is handled and should not be sent out
this.keyHandled = mouseInGui;
}
else
{
@@ -25,9 +25,14 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.definitions.IBlocks;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiNumberBox;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.AEBaseContainer;
import appeng.container.implementations.ContainerPriority;
import appeng.core.AEConfig;
import appeng.core.AELog;
@@ -37,6 +42,12 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.helpers.IPriorityHost;
import appeng.parts.automation.PartFormationPlane;
import appeng.parts.misc.PartInterface;
import appeng.parts.misc.PartStorageBus;
import appeng.tile.misc.TileInterface;
import appeng.tile.storage.TileChest;
import appeng.tile.storage.TileDrive;
public class GuiPriority extends AEBaseGui
@@ -81,11 +92,49 @@ public class GuiPriority extends AEBaseGui
this.buttonList.add( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 69, 32, 20, "-" + c ) );
this.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + d ) );
final ContainerPriority con = ( (ContainerPriority) this.inventorySlots );
final ItemStack myIcon = con.getPriorityHost().getItemStackRepresentation();
this.OriginalGui = con.getPriorityHost().getGuiBridge();
ItemStack myIcon = null;
final Object target = ( (AEBaseContainer) this.inventorySlots ).getTarget();
final IDefinitions definitions = AEApi.instance().definitions();
final IParts parts = definitions.parts();
final IBlocks blocks = definitions.blocks();
if( this.OriginalGui != null && !myIcon.isEmpty() )
if( target instanceof PartStorageBus )
{
myIcon = parts.storageBus().maybeStack( 1 ).orElse( myIcon );
this.OriginalGui = GuiBridge.GUI_STORAGEBUS;
}
if( target instanceof PartFormationPlane )
{
myIcon = parts.formationPlane().maybeStack( 1 ).orElse( myIcon );
this.OriginalGui = GuiBridge.GUI_FORMATION_PLANE;
}
if( target instanceof TileDrive )
{
myIcon = blocks.drive().maybeStack( 1 ).orElse( myIcon );
this.OriginalGui = GuiBridge.GUI_DRIVE;
}
if( target instanceof TileChest )
{
myIcon = blocks.chest().maybeStack( 1 ).orElse( myIcon );
this.OriginalGui = GuiBridge.GUI_CHEST;
}
if( target instanceof TileInterface )
{
myIcon = blocks.iface().maybeStack( 1 ).orElse( myIcon );
this.OriginalGui = GuiBridge.GUI_INTERFACE;
}
if( target instanceof PartInterface )
{
myIcon = parts.iface().maybeStack( 1 ).orElse( myIcon );
this.OriginalGui = GuiBridge.GUI_INTERFACE;
}
if( this.OriginalGui != null && myIcon != null )
{
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), this.itemRender ) );
}
@@ -1,85 +0,0 @@
package appeng.client.gui.widgets;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public abstract class GuiCustomSlot extends Gui implements ITooltip
{
private final int x;
private final int y;
private final int id;
public GuiCustomSlot( final int id, final int x, final int y )
{
this.x = x;
this.y = y;
this.id = id;
}
public int getId()
{
return id;
}
public boolean canClick( final EntityPlayer player )
{
return true;
}
public void slotClicked( final ItemStack clickStack, final int mouseButton )
{
}
public abstract void drawContent( final Minecraft mc, final int mouseX, final int mouseY, final float partialTicks );
public void drawBackground( int guileft, int guitop )
{
}
@Override
public String getMessage()
{
return null;
}
@Override
public int xPos()
{
return this.x;
}
@Override
public int yPos()
{
return this.y;
}
@Override
public int getWidth()
{
return 16;
}
@Override
public int getHeight()
{
return 16;
}
@Override
public boolean isVisible()
{
return false;
}
public boolean isSlotEnabled()
{
return true;
}
}
@@ -43,7 +43,6 @@ public class MEGuiTextField extends GuiTextField
private final int _yPos;
private final int _width;
private final int _height;
private final int _fontPad;
private int selectionColor = 0xFF00FF00;
/**
@@ -60,7 +59,6 @@ public class MEGuiTextField extends GuiTextField
{
super( 0, fontRenderer, xPos + PADDING, yPos + PADDING, width - 2 * PADDING - fontRenderer.getCharWidth( '_' ), height - 2 * PADDING );
this._fontPad = fontRenderer.getCharWidth( '_' );
this._xPos = xPos;
this._yPos = yPos;
this._width = width;
@@ -108,31 +106,9 @@ public class MEGuiTextField extends GuiTextField
this.selectionColor = color;
}
@Override
public void drawTextBox()
{
if( this.getVisible() )
{
if( this.isFocused() )
{
drawRect( this.x - PADDING + 1, this.y - PADDING + 1, this.x + this.width + this._fontPad + PADDING - 1, this.y + this.height + PADDING - 1,
0xFF606060 );
}
else
{
drawRect( this.x - PADDING + 1, this.y - PADDING + 1, this.x + this.width + this._fontPad + PADDING - 1, this.y + this.height + PADDING - 1,
0xFFA8A8A8 );
}
super.drawTextBox();
}
}
@Override
public void drawSelectionBox( int startX, int startY, int endX, int endY )
{
if( !this.isFocused() )
return;
if( startX < endX )
{
int i = startX;
@@ -183,5 +159,4 @@ public class MEGuiTextField extends GuiTextField
GlStateManager.disableColorLogic();
GlStateManager.enableTexture2D();
}
}
@@ -24,6 +24,7 @@ import javax.annotation.Nonnull;
import net.minecraft.util.text.translation.I18n;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.util.ItemSorters;
public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
@@ -56,7 +57,7 @@ public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
@Override
public int compareTo( @Nonnull final ClientDCInternalInv o )
{
return Long.compare( this.sortBy, o.sortBy );
return ItemSorters.compareLong( this.sortBy, o.sortBy );
}
public AppEngInternalInventory getInventory()
@@ -68,4 +69,4 @@ public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
{
return this.id;
}
}
}
@@ -1,243 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.me;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
import javax.annotation.Nonnull;
import appeng.api.AEApi;
import appeng.api.config.Settings;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.config.YesNo;
import appeng.api.storage.channels.IFluidStorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IItemList;
import appeng.client.gui.widgets.IScrollSource;
import appeng.client.gui.widgets.ISortSource;
import appeng.core.AEConfig;
import appeng.fluids.util.FluidSorters;
import appeng.util.Platform;
import appeng.util.prioritylist.IPartitionList;
/**
* @author BrockWS
* @version rv6 - 22/05/2018
* @since rv6 22/05/2018
*/
public class FluidRepo
{
private final IItemList<IAEFluidStack> list = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createList();
private final ArrayList<IAEFluidStack> view = new ArrayList<>();
private final IScrollSource src;
private final ISortSource sortSrc;
private int rowSize = 9;
private String searchString = "";
private IPartitionList<IAEFluidStack> myPartitionList;
private boolean hasPower;
public FluidRepo( final IScrollSource src, final ISortSource sortSrc )
{
this.src = src;
this.sortSrc = sortSrc;
}
public void updateView()
{
this.view.clear();
this.view.ensureCapacity( this.list.size() );
String innerSearch = this.searchString;
boolean searchMod = false;
if( innerSearch.startsWith( "@" ) )
{
searchMod = true;
innerSearch = innerSearch.substring( 1 );
}
Pattern m;
try
{
m = Pattern.compile( innerSearch.toLowerCase(), Pattern.CASE_INSENSITIVE );
}
catch( final Exception ignore1 )
{
try
{
m = Pattern.compile( Pattern.quote( innerSearch.toLowerCase() ), Pattern.CASE_INSENSITIVE );
}
catch( final Exception ignore2 )
{
return;
}
}
final Enum viewMode = this.sortSrc.getSortDisplay();
final boolean needsZeroCopy = viewMode == ViewItems.CRAFTABLE;
final boolean terminalSearchToolTips = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_TOOLTIPS ) != YesNo.NO;
boolean notDone = false;
for( IAEFluidStack fs : this.list )
{
if( this.myPartitionList != null && !this.myPartitionList.isListed( fs ) )
{
continue;
}
if( viewMode == ViewItems.CRAFTABLE && !fs.isCraftable() )
{
continue;
}
if( viewMode == ViewItems.STORED && fs.getStackSize() == 0 )
{
continue;
}
final String dspName = searchMod ? Platform.getModId( fs ) : Platform.getFluidDisplayName( fs );
boolean foundMatchingFluidStack = false;
notDone = true;
if( m.matcher( dspName.toLowerCase() ).find() )
{
notDone = false;
foundMatchingFluidStack = true;
}
if( terminalSearchToolTips && notDone && !searchMod )
{
final List<String> tooltip = Platform.getTooltip( fs );
for( final String line : tooltip )
{
if( m.matcher( line ).find() )
{
foundMatchingFluidStack = true;
break;
}
}
}
if( foundMatchingFluidStack )
{
if( needsZeroCopy )
{
fs = fs.copy();
fs.setStackSize( 0 );
}
this.view.add( fs );
}
}
final Enum sortBy = this.sortSrc.getSortBy();
final Enum sortDir = this.sortSrc.getSortDir();
FluidSorters.setDirection( (appeng.api.config.SortDir) sortDir );
if( sortBy == SortOrder.MOD )
{
Collections.sort( this.view, FluidSorters.CONFIG_BASED_SORT_BY_MOD );
}
else if( sortBy == SortOrder.AMOUNT )
{
Collections.sort( this.view, FluidSorters.CONFIG_BASED_SORT_BY_SIZE );
}
else
{
Collections.sort( this.view, FluidSorters.CONFIG_BASED_SORT_BY_NAME );
}
}
public void postUpdate( final IAEFluidStack is )
{
final IAEFluidStack st = this.list.findPrecise( is );
if( st != null )
{
st.reset();
st.add( is );
}
else
{
this.list.add( is );
}
}
public IAEFluidStack getReferenceFluid( int idx )
{
idx += this.src.getCurrentScroll() * this.rowSize;
if( idx >= this.view.size() )
{
return null;
}
return this.view.get( idx );
}
public int size()
{
return this.view.size();
}
public void clear()
{
this.list.resetStatus();
}
public boolean hasPower()
{
return this.hasPower;
}
public void setPower( final boolean hasPower )
{
this.hasPower = hasPower;
}
public int getRowSize()
{
return this.rowSize;
}
public void setRowSize( final int rowSize )
{
this.rowSize = rowSize;
}
public String getSearchString()
{
return this.searchString;
}
public void setSearchString( @Nonnull final String searchString )
{
this.searchString = searchString;
}
}
@@ -1,65 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.me;
import appeng.api.storage.data.IAEFluidStack;
/**
* @author BrockWS
* @version rv6 - 22/05/2018
* @since rv6 22/05/2018
*/
public class InternalFluidSlotME
{
private final int offset;
private final int xPos;
private final int yPos;
private final FluidRepo repo;
public InternalFluidSlotME( final FluidRepo def, final int offset, final int displayX, final int displayY )
{
this.repo = def;
this.offset = offset;
this.xPos = displayX;
this.yPos = displayY;
}
IAEFluidStack getAEStack()
{
return this.repo.getReferenceFluid( this.offset );
}
boolean hasPower()
{
return this.repo.hasPower();
}
int getxPosition()
{
return this.xPos;
}
int getyPosition()
{
return this.yPos;
}
}
@@ -1,112 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.me;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.SlotItemHandler;
import appeng.api.storage.data.IAEFluidStack;
import appeng.fluids.container.slots.IMEFluidSlot;
/**
* @author BrockWS
* @version rv6 - 22/05/2018
* @since rv6 22/05/2018
*/
public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot
{
private InternalFluidSlotME slot;
public SlotFluidME( InternalFluidSlotME slot )
{
super( null, 0, slot.getxPosition(), slot.getyPosition() );
this.slot = slot;
}
@Override
public IAEFluidStack getAEFluidStack()
{
if( this.slot.hasPower() )
{
return this.slot.getAEStack();
}
return null;
}
@Override
public boolean isItemValid( final ItemStack par1ItemStack )
{
return false;
}
@Nonnull
@Override
public ItemStack getStack()
{
return ItemStack.EMPTY;
}
@Override
public boolean getHasStack()
{
if( this.slot.hasPower() )
{
return this.getAEFluidStack() != null;
}
return false;
}
@Override
public void putStack( final ItemStack par1ItemStack )
{
}
@Override
public int getSlotStackLimit()
{
return 0;
}
@Nonnull
@Override
public ItemStack decrStackSize( final int par1 )
{
return ItemStack.EMPTY;
}
@Override
public boolean isHere( final IInventory inv, final int slotIn )
{
return false;
}
@Override
public boolean canTakeStack( final EntityPlayer par1EntityPlayer )
{
return false;
}
}
@@ -1,84 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.render;
import java.util.List;
import javax.annotation.Nullable;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumFacing;
/**
* @author DrummerMC
* @version rv6 - 2018-01-22
* @since rv6 2018-01-22
*/
public class DummyFluidBakedModel implements IBakedModel
{
private final ImmutableList<BakedQuad> quads;
public DummyFluidBakedModel( ImmutableList<BakedQuad> quads )
{
this.quads = quads;
}
@Override
public List<BakedQuad> getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand )
{
return quads;
}
@Override
public boolean isAmbientOcclusion()
{
return false;
}
@Override
public boolean isGui3d()
{
return false;
}
@Override
public boolean isBuiltInRenderer()
{
return false;
}
@Override
public TextureAtlasSprite getParticleTexture()
{
return null;
}
@Override
public ItemOverrideList getOverrides()
{
return null;
}
}
@@ -1,117 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.render;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import javax.annotation.Nullable;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ItemLayerModel;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import appeng.fluids.items.FluidDummyItem;
/**
* This baked model class is used as a dispatcher to redirect the renderer to the *real* model that should be used based
* on the item stack.
* A custom Item Override List is used to accomplish this.
*/
public class DummyFluidDispatcherBakedModel extends DelegateBakedModel
{
private final VertexFormat format;
private final Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter;
public DummyFluidDispatcherBakedModel( IBakedModel baseModel, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
{
super( baseModel );
this.format = format;
this.bakedTextureGetter = bakedTextureGetter;
}
// This is never used. See the item override list below.
@Override
public List<BakedQuad> getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand )
{
return Collections.emptyList();
}
@Override
public boolean isGui3d()
{
return this.getBaseModel().isGui3d();
}
@Override
public boolean isBuiltInRenderer()
{
return false;
}
@Override
public ItemOverrideList getOverrides()
{
return new ItemOverrideList( Collections.emptyList() )
{
@Override
public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity )
{
if( !( stack.getItem() instanceof FluidDummyItem ) )
{
return originalModel;
}
FluidDummyItem itemFacade = (FluidDummyItem) stack.getItem();
FluidStack fluidStack = itemFacade.getFluidStack( stack );
if( fluidStack == null )
{
fluidStack = new FluidStack( FluidRegistry.WATER, Fluid.BUCKET_VOLUME );
}
TextureAtlasSprite sprite = bakedTextureGetter.apply( fluidStack.getFluid().getStill( fluidStack ) );
if( sprite == null )
{
return new DummyFluidBakedModel( ImmutableList.of() );
}
return new DummyFluidBakedModel( ItemLayerModel.getQuadsForSprite( 0, sprite, format, Optional.empty() ) );
}
};
}
}
@@ -1,89 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.render;
import java.util.Collection;
import java.util.Collections;
import java.util.function.Function;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.common.model.IModelState;
import appeng.core.AppEng;
/**
* The model class for facades. Since facades wrap existing models, they don't declare any dependencies here other
* than the cable anchor.
*/
public class DummyFluidItemModel implements IModel
{
// We use this to get the default item transforms and make our lives easier
private static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "item/dummy_fluid_item_base" );
private IModel baseModel = null;
private IModel getBaseModel()
{
if( this.baseModel == null )
{
try
{
baseModel = ModelLoaderRegistry.getModel( MODEL_BASE );
}
catch( Exception e )
{
throw new RuntimeException( e );
}
}
return this.baseModel;
}
@Override
public Collection<ResourceLocation> getDependencies()
{
return Collections.emptyList();
}
@Override
public Collection<ResourceLocation> getTextures()
{
return Collections.emptyList();
}
@Override
public IBakedModel bake( IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
{
IBakedModel bakedBaseModel = this.getBaseModel().bake( state, format, bakedTextureGetter );
return new DummyFluidDispatcherBakedModel( bakedBaseModel, format, bakedTextureGetter );
}
@Override
public IModelState getDefaultState()
{
return getBaseModel().getDefaultState();
}
}
@@ -132,7 +132,7 @@ class CableBuilder
break;
case DENSE_COVERED:
case DENSE_SMART:
this.addCableCore( CableCoreType.DENSE, color, quadsOut );
this.addCableCore( CableCoreType.DENSE_SMART, color, quadsOut );
break;
default:
}
@@ -153,7 +153,7 @@ class CableBuilder
case COVERED:
cubeBuilder.addCube( 5, 5, 5, 11, 11, 11 );
break;
case DENSE:
case DENSE_SMART:
cubeBuilder.addCube( 3, 3, 3, 13, 13, 13 );
break;
}
@@ -329,6 +329,7 @@ class CableBuilder
public void addConstrainedCoveredConnection( EnumFacing facing, AEColor cableColor, int distanceFromEdge, List<BakedQuad> quadsOut )
{
// The core of a covered cable reaches up to 5 voxels from the block edge, so
// drawing a connection can only occur from there onwards
if( distanceFromEdge >= 5 )
@@ -347,11 +348,6 @@ class CableBuilder
public void addSmartConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List<BakedQuad> quadsOut )
{
if( connectionType == AECableType.COVERED || connectionType == AECableType.GLASS )
{
this.addCoveredConnection( facing, cableColor, connectionType, cableBusAdjacent, quadsOut );
return;
}
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
@@ -169,7 +169,20 @@ public class CableBusBakedModel implements IBakedModel
final AECableType secondType = sides.get( firstSide.getOpposite() );
return firstType == secondType;
// Certain cable types have restrictions on when they're rendered as a straight connection
switch( cableType )
{
case GLASS:
return firstType == AECableType.GLASS && secondType == AECableType.GLASS;
case DENSE_COVERED:
return firstType == AECableType.DENSE_COVERED && secondType == AECableType.DENSE_COVERED;
case DENSE_SMART:
return firstType == AECableType.DENSE_SMART && secondType == AECableType.DENSE_SMART;
default:
break;
}
return true;
}
private void addCableQuads( CableBusRenderState renderState, List<BakedQuad> quadsOut )
@@ -40,7 +40,7 @@ import appeng.core.AppEng;
*/
public enum CableCoreType
{
GLASS( "parts/cable/core/glass" ), COVERED( "parts/cable/core/covered" ), DENSE( "parts/cable/core/dense_smart" );
GLASS( "parts/cable/core/glass" ), COVERED( "parts/cable/core/covered" ), DENSE_SMART( "parts/cable/core/dense_smart" );
private static final Map<AECableType, CableCoreType> cableMapping = generateCableMapping();
@@ -55,8 +55,8 @@ public enum CableCoreType
result.put( AECableType.GLASS, CableCoreType.GLASS );
result.put( AECableType.COVERED, CableCoreType.COVERED );
result.put( AECableType.SMART, CableCoreType.COVERED );
result.put( AECableType.DENSE_COVERED, CableCoreType.DENSE );
result.put( AECableType.DENSE_SMART, CableCoreType.DENSE );
result.put( AECableType.DENSE_COVERED, CableCoreType.DENSE_SMART );
result.put( AECableType.DENSE_SMART, CableCoreType.DENSE_SMART );
return ImmutableMap.copyOf( result );
}
@@ -146,7 +146,7 @@ public class CubeBuilder
builder.setQuadOrientation( face );
builder.setQuadTint( -1 );
builder.setApplyDiffuseLighting( true );
UvVector uv = new UvVector();
// The user might have set specific UV coordinates for this face
@@ -53,6 +53,7 @@ import appeng.api.parts.IPart;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.me.InternalSlotME;
import appeng.client.me.SlotME;
import appeng.container.guisync.GuiSync;
import appeng.container.guisync.SyncData;
@@ -380,6 +381,21 @@ public abstract class AEBaseContainer extends Container
return ItemStack.EMPTY;
}
boolean hasMETiles = false;
for( final Object is : this.inventorySlots )
{
if( is instanceof InternalSlotME )
{
hasMETiles = true;
break;
}
}
if( hasMETiles && Platform.isClient() )
{
return ItemStack.EMPTY;
}
final AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get( idx ); // require AE SLots!
if( clickSlot instanceof SlotDisabled || clickSlot instanceof SlotInaccessible )
@@ -402,21 +418,18 @@ public abstract class AEBaseContainer extends Container
*/
if( clickSlot.isPlayerSide() )
{
tis = this.transferStackToContainer( tis );
tis = this.shiftStoreItem( tis );
if( !tis.isEmpty() )
// target slots in the container...
for( final Object inventorySlot : this.inventorySlots )
{
// target slots in the container...
for( final Object inventorySlot : this.inventorySlots )
{
final AppEngSlot cs = (AppEngSlot) inventorySlot;
final AppEngSlot cs = (AppEngSlot) inventorySlot;
if( !( cs.isPlayerSide() ) && !( cs instanceof SlotFake ) && !( cs instanceof SlotCraftingMatrix ) )
if( !( cs.isPlayerSide() ) && !( cs instanceof SlotFake ) && !( cs instanceof SlotCraftingMatrix ) )
{
if( cs.isItemValid( tis ) )
{
if( cs.isItemValid( tis ) )
{
selectedSlots.add( cs );
}
selectedSlots.add( cs );
}
}
}
@@ -1019,10 +1032,9 @@ public abstract class AEBaseContainer extends Container
{
try
{
NetworkHandler.instance()
.sendTo(
new PacketInventoryAction( InventoryAction.UPDATE_HAND, 0, AEItemStack.fromItemStack( p.inventory.getItemStack() ) ),
p );
NetworkHandler.instance().sendTo(
new PacketInventoryAction( InventoryAction.UPDATE_HAND, 0, AEItemStack.fromItemStack( p.inventory.getItemStack() ) ),
p );
}
catch( final IOException e )
{
@@ -1031,11 +1043,6 @@ public abstract class AEBaseContainer extends Container
}
}
protected ItemStack transferStackToContainer( final ItemStack input )
{
return shiftStoreItem( input );
}
private ItemStack shiftStoreItem( final ItemStack input )
{
if( this.getPowerSource() == null || this.getCellInventory() == null )
@@ -1098,9 +1105,8 @@ public abstract class AEBaseContainer extends Container
{
try
{
NetworkHandler.instance()
.sendTo( new PacketValueConfig( "CustomName", this.getCustomName() ),
(EntityPlayerMP) this.getInventoryPlayer().player );
NetworkHandler.instance().sendTo( new PacketValueConfig( "CustomName", this.getCustomName() ),
(EntityPlayerMP) this.getInventoryPlayer().player );
}
catch( final IOException e )
{
@@ -33,12 +33,10 @@ import appeng.api.AEApi;
import appeng.api.config.CopyMode;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Settings;
import appeng.api.implementations.items.IStorageCell;
import appeng.api.storage.ICellWorkbenchItem;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.container.guisync.GuiSync;
import appeng.container.slot.OptionalSlotRestrictedInput;
@@ -221,20 +219,17 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
public void partition()
{
final IItemHandler inv = this.getUpgradeable().getInventoryByName( "config" );
final ItemStack is = this.getUpgradeable().getInventoryByName( "cell" ).getStackInSlot( 0 );
final IStorageChannel channel = is.getItem() instanceof IStorageCell ? ( (IStorageCell) is.getItem() ).getChannel() : AEApi.instance()
.storage()
.getStorageChannel( IItemStorageChannel.class );
final IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory(
this.getUpgradeable().getInventoryByName( "cell" ).getStackInSlot( 0 ), null,
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
final IMEInventory cellInv = AEApi.instance().registries().cell().getCellInventory( is, null, channel );
Iterator<IAEStack> i = new NullIterator<>();
Iterator<IAEItemStack> i = new NullIterator<>();
if( cellInv != null )
{
final IItemList list = cellInv.getAvailableItems( channel.createList() );
final IItemList<IAEItemStack> list = cellInv
.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
i = list.iterator();
}
@@ -37,7 +37,6 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
@@ -83,8 +82,6 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
private final SlotPatternTerm craftSlot;
private final SlotRestrictedInput patternSlotIN;
private final SlotRestrictedInput patternSlotOUT;
private IRecipe currentRecipe;
@GuiSync( 97 )
public boolean craftingMode = true;
@GuiSync( 96 )
@@ -163,7 +160,6 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
private ItemStack getAndUpdateOutput()
{
final World world = this.getPlayerInv().player.world;
final InventoryCrafting ic = new InventoryCrafting( this, 3, 3 );
for( int x = 0; x < ic.getSizeInventory(); x++ )
@@ -171,22 +167,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
ic.setInventorySlotContents( x, this.crafting.getStackInSlot( x ) );
}
if( this.currentRecipe == null || !this.currentRecipe.matches( ic, world ) )
{
this.currentRecipe = CraftingManager.findMatchingRecipe( ic, world );
}
final ItemStack is;
if( this.currentRecipe == null )
{
is = ItemStack.EMPTY;
}
else
{
is = this.currentRecipe.getCraftingResult( ic );
}
final ItemStack is = CraftingManager.findMatchingResult( ic, this.getPlayerInv().player.world );
this.cOut.setStackInSlot( 0, is );
return is;
}
@@ -88,9 +88,4 @@ public class ContainerPriority extends AEBaseContainer
super.onUpdate( field, oldValue, newValue );
}
public IPriorityHost getPriorityHost()
{
return this.priHost;
}
}
@@ -235,7 +235,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
}
}
protected void checkToolbox()
private void checkToolbox()
{
if( this.hasToolbox() )
{
@@ -289,7 +289,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
return this.fzMode;
}
public void setFuzzyMode( final FuzzyMode fzMode )
void setFuzzyMode( final FuzzyMode fzMode )
{
this.fzMode = fzMode;
}
@@ -309,7 +309,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
return this.rsMode;
}
public void setRedStoneMode( final RedstoneMode rsMode )
void setRedStoneMode( final RedstoneMode rsMode )
{
this.rsMode = rsMode;
}
@@ -324,7 +324,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
this.schedulingMode = schedulingMode;
}
protected IUpgradeableHost getUpgradeable()
IUpgradeableHost getUpgradeable()
{
return this.upgradeable;
}
@@ -22,6 +22,7 @@ package appeng.container.implementations;
import javax.annotation.Nonnull;
import appeng.api.networking.crafting.ICraftingCPU;
import appeng.util.ItemSorters;
public class CraftingCPURecord implements Comparable<CraftingCPURecord>
@@ -43,12 +44,12 @@ public class CraftingCPURecord implements Comparable<CraftingCPURecord>
@Override
public int compareTo( @Nonnull final CraftingCPURecord o )
{
final int a = Long.compare( o.getProcessors(), this.getProcessors() );
final int a = ItemSorters.compareLong( o.getProcessors(), this.getProcessors() );
if( a != 0 )
{
return a;
}
return Long.compare( o.getSize(), this.getSize() );
return ItemSorters.compareLong( o.getSize(), this.getSize() );
}
ICraftingCPU getCpu()
@@ -70,4 +71,4 @@ public class CraftingCPURecord implements Comparable<CraftingCPURecord>
{
return this.size;
}
}
}
@@ -274,7 +274,7 @@ public class AppEngSlot extends Slot
this.isValid = isValid;
}
protected AEBaseContainer getContainer()
AEBaseContainer getContainer()
{
return this.myContainer;
}
@@ -25,7 +25,7 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
public class OptionalSlotFake extends SlotFake implements IOptionalSlot
public class OptionalSlotFake extends SlotFake
{
private final int srcX;
@@ -69,8 +69,12 @@ public class OptionalSlotFake extends SlotFake implements IOptionalSlot
return this.host.isSlotEnabled( this.groupNum );
}
@Override
public boolean isRenderDisabled()
public boolean renderDisabled()
{
return this.isRenderDisabled();
}
private boolean isRenderDisabled()
{
return this.renderDisabled;
}
@@ -22,7 +22,7 @@ package appeng.container.slot;
import net.minecraftforge.items.IItemHandler;
public class OptionalSlotNormal extends AppEngSlot implements IOptionalSlot
public class OptionalSlotNormal extends AppEngSlot
{
private final int groupNum;
@@ -45,16 +45,4 @@ public class OptionalSlotNormal extends AppEngSlot implements IOptionalSlot
return this.host.isSlotEnabled( this.groupNum );
}
@Override
public int getSourceX()
{
return this.xPos;
}
@Override
public int getSourceY()
{
return this.yPos;
}
}
+14 -27
View File
@@ -93,7 +93,6 @@ public final class AEConfig extends Configuration implements IConfigurableObject
private final int[] craftByStacks = { 1, 10, 100, 1000 };
private final int[] priorityByStacks = { 1, 10, 100, 1000 };
private final int[] levelByStacks = { 1, 10, 100, 1000 };
private final int[] levelByMillibuckets = { 10, 100, 1000, 10000 };
// Spatial IO/Dimension
private int storageProviderID = -1;
@@ -173,14 +172,12 @@ public final class AEConfig extends Configuration implements IConfigurableObject
this.settings.registerSetting( Settings.TERMINAL_STYLE, TerminalStyle.TALL );
this.settings.registerSetting( Settings.SEARCH_MODE, SearchBoxMode.AUTOSEARCH );
this.spawnChargedChance = (float) ( 1.0 - this.get( "worldGen", "spawnChargedChance", 1.0 - this.spawnChargedChance )
.getDouble(
1.0 - this.spawnChargedChance ) );
this.spawnChargedChance = (float) ( 1.0 - this.get( "worldGen", "spawnChargedChance", 1.0 - this.spawnChargedChance ).getDouble(
1.0 - this.spawnChargedChance ) );
this.minMeteoriteDistance = this.get( "worldGen", "minMeteoriteDistance", this.minMeteoriteDistance ).getInt( this.minMeteoriteDistance );
this.meteoriteClusterChance = this.get( "worldGen", "meteoriteClusterChance", this.meteoriteClusterChance ).getDouble( this.meteoriteClusterChance );
this.meteoriteMaximumSpawnHeight = this.get( "worldGen", "meteoriteMaximumSpawnHeight", this.meteoriteMaximumSpawnHeight )
.getInt(
this.meteoriteMaximumSpawnHeight );
this.meteoriteMaximumSpawnHeight = this.get( "worldGen", "meteoriteMaximumSpawnHeight", this.meteoriteMaximumSpawnHeight ).getInt(
this.meteoriteMaximumSpawnHeight );
this.meteoriteDimensionWhitelist = this.get( "worldGen", "meteoriteDimensionWhitelist", this.meteoriteDimensionWhitelist ).getIntList();
this.quartzOresPerCluster = this.get( "worldGen", "quartzOresPerCluster", this.quartzOresPerCluster ).getInt( this.quartzOresPerCluster );
@@ -194,17 +191,14 @@ public final class AEConfig extends Configuration implements IConfigurableObject
this.wirelessBaseCost = this.get( "wireless", "wirelessBaseCost", this.wirelessBaseCost ).getDouble( this.wirelessBaseCost );
this.wirelessCostMultiplier = this.get( "wireless", "wirelessCostMultiplier", this.wirelessCostMultiplier ).getDouble( this.wirelessCostMultiplier );
this.wirelessBaseRange = this.get( "wireless", "wirelessBaseRange", this.wirelessBaseRange ).getDouble( this.wirelessBaseRange );
this.wirelessBoosterRangeMultiplier = this.get( "wireless", "wirelessBoosterRangeMultiplier", this.wirelessBoosterRangeMultiplier )
.getDouble(
this.wirelessBoosterRangeMultiplier );
this.wirelessBoosterRangeMultiplier = this.get( "wireless", "wirelessBoosterRangeMultiplier", this.wirelessBoosterRangeMultiplier ).getDouble(
this.wirelessBoosterRangeMultiplier );
this.wirelessBoosterExp = this.get( "wireless", "wirelessBoosterExp", this.wirelessBoosterExp ).getDouble( this.wirelessBoosterExp );
this.wirelessTerminalDrainMultiplier = this.get( "wireless", "wirelessTerminalDrainMultiplier", this.wirelessTerminalDrainMultiplier )
.getDouble(
this.wirelessTerminalDrainMultiplier );
this.wirelessTerminalDrainMultiplier = this.get( "wireless", "wirelessTerminalDrainMultiplier", this.wirelessTerminalDrainMultiplier ).getDouble(
this.wirelessTerminalDrainMultiplier );
this.formationPlaneEntityLimit = this.get( "automation", "formationPlaneEntityLimit", this.formationPlaneEntityLimit )
.getInt(
this.formationPlaneEntityLimit );
this.formationPlaneEntityLimit = this.get( "automation", "formationPlaneEntityLimit", this.formationPlaneEntityLimit ).getInt(
this.formationPlaneEntityLimit );
this.wirelessTerminalBattery = this.get( "battery", "wirelessTerminal", this.wirelessTerminalBattery ).getInt( this.wirelessTerminalBattery );
this.chargedStaffBattery = this.get( "battery", "chargedStaff", this.chargedStaffBattery ).getInt( this.chargedStaffBattery );
@@ -261,17 +255,15 @@ public final class AEConfig extends Configuration implements IConfigurableObject
{
this.storageProviderID = this.get( "spatialio", "storageProviderID", this.storageProviderID ).getInt( this.storageProviderID );
this.storageDimensionID = this.get( "spatialio", "storageDimensionID", this.storageDimensionID ).getInt( this.storageDimensionID );
this.spatialPowerMultiplier = this.get( "spatialio", "spatialPowerMultiplier", this.spatialPowerMultiplier )
.getDouble(
this.spatialPowerMultiplier );
this.spatialPowerMultiplier = this.get( "spatialio", "spatialPowerMultiplier", this.spatialPowerMultiplier ).getDouble(
this.spatialPowerMultiplier );
this.spatialPowerExponent = this.get( "spatialio", "spatialPowerExponent", this.spatialPowerExponent ).getDouble( this.spatialPowerExponent );
}
if( this.isFeatureEnabled( AEFeature.CRAFTING_CPU ) )
{
this.craftingCalculationTimePerTick = this.get( "craftingCPU", "craftingCalculationTimePerTick", this.craftingCalculationTimePerTick )
.getInt(
this.craftingCalculationTimePerTick );
this.craftingCalculationTimePerTick = this.get( "craftingCPU", "craftingCalculationTimePerTick", this.craftingCalculationTimePerTick ).getInt(
this.craftingCalculationTimePerTick );
}
this.updatable = true;
@@ -538,11 +530,6 @@ public final class AEConfig extends Configuration implements IConfigurableObject
return this.levelByStacks[i];
}
public int levelByMillyBuckets( final int i )
{
return this.levelByMillibuckets[i];
}
public Enum getSetting( final String category, final Class<? extends Enum> class1, final Enum myDefault )
{
final String name = class1.getSimpleName();
+16 -2
View File
@@ -58,6 +58,8 @@ import appeng.core.worlddata.WorldData;
import appeng.hooks.TickHandler;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.recipes.CustomRecipeConfig;
import appeng.recipes.CustomRecipeForgeConfiguration;
import appeng.server.AECommand;
import appeng.services.VersionChecker;
import appeng.services.export.ExportConfig;
@@ -96,6 +98,14 @@ public final class AppEng
private final Registration registration;
private File configDirectory;
private CustomRecipeConfig customRecipeConfig;
/**
* Folder for recipes
*
* used for CSV item names and the recipes
*/
private File recipeDirectory;
/**
* determined in pre-init but used in init
@@ -142,6 +152,7 @@ public final class AppEng
{
final Stopwatch watch = Stopwatch.createStarted();
this.configDirectory = new File( event.getModConfigurationDirectory().getPath(), "AppliedEnergistics2" );
this.recipeDirectory = new File( this.configDirectory, "aerecipes" );
final File configFile = new File( this.configDirectory, "AppliedEnergistics2.cfg" );
final File facadeFile = new File( this.configDirectory, "Facades.cfg" );
@@ -153,8 +164,11 @@ public final class AppEng
FacadeConfig.init( facadeFile );
final VersionCheckerConfig versionCheckerConfig = new VersionCheckerConfig( versionFile );
this.customRecipeConfig = new CustomRecipeForgeConfiguration( recipeConfiguration );
this.exportConfig = new ForgeExportConfig( recipeConfiguration );
this.registration.setRecipeInformation( this.recipeDirectory, this.customRecipeConfig );
AELog.info( "Pre Initialization ( started )" );
CreativeTab.init();
@@ -212,7 +226,7 @@ public final class AppEng
{
if( FMLCommonHandler.instance().getSide().isClient() )
{
final ExportProcess process = new ExportProcess( this.configDirectory, this.exportConfig );
final ExportProcess process = new ExportProcess( this.recipeDirectory, this.exportConfig );
final Thread exportProcessThread = new Thread( process );
this.startService( "AE2 CSV Export", exportProcessThread );
@@ -223,7 +237,7 @@ public final class AppEng
}
}
this.registration.initialize( event, this.configDirectory );
this.registration.initialize( event, this.recipeDirectory, this.customRecipeConfig );
IntegrationRegistry.INSTANCE.init();
AELog.info( "Initialization ( ended after " + start.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
+118
View File
@@ -0,0 +1,118 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import javax.annotation.Nonnull;
import com.google.common.base.Preconditions;
import org.apache.commons.io.FileUtils;
import appeng.api.recipes.IRecipeHandler;
import appeng.recipes.CustomRecipeConfig;
import appeng.recipes.loader.ConfigLoader;
import appeng.recipes.loader.JarLoader;
import appeng.recipes.loader.RecipeResourceCopier;
/**
* handles the decision if recipes should be loaded from jar, loaded from file system or force copied from jar
*
* @author thatsIch
* @version rv3 - 12.05.2015
* @since rv3 12.05.2015
*/
public class RecipeLoader implements Runnable
{
/**
* recipe path in the jar
*/
private static final String ASSETS_RECIPE_PATH = "/assets/appliedenergistics2/recipes/";
@Nonnull
private final IRecipeHandler handler;
@Nonnull
private final CustomRecipeConfig config;
@Nonnull
private final File recipeDirectory;
/**
* @param config configuration for the knowledge how to handle the loading process
* @param handler handler to load the recipes
*
* @throws NullPointerException if handler is <tt>null</tt>
*/
public RecipeLoader( @Nonnull final File recipeDirectory, @Nonnull final CustomRecipeConfig config, @Nonnull final IRecipeHandler handler )
{
this.recipeDirectory = Preconditions.checkNotNull( recipeDirectory );
Preconditions.checkArgument( !recipeDirectory.isFile() );
this.config = Preconditions.checkNotNull( config );
this.handler = Preconditions.checkNotNull( handler );
}
@Override
public final void run()
{
if( this.config.isEnabled() )
{
// setup copying
final RecipeResourceCopier copier = new RecipeResourceCopier( "assets/appliedenergistics2/aerecipes/" );
final File generatedRecipesDir = new File( this.recipeDirectory, "generated" );
final File userRecipesDir = new File( this.recipeDirectory, "user" );
// generates generated and user recipes dir
// will clean the generated every time to keep it up to date
// copies over the recipes in the jar over to the generated folder
// copies over the readmes
try
{
FileUtils.forceMkdir( generatedRecipesDir );
FileUtils.forceMkdir( userRecipesDir );
FileUtils.cleanDirectory( generatedRecipesDir );
copier.copyTo( ".recipe", generatedRecipesDir );
copier.copyTo( ".html", this.recipeDirectory );
// parse recipes prioritising the user scripts by using the generated as template
this.handler.parseRecipes( new ConfigLoader( generatedRecipesDir, userRecipesDir ), "index.recipe" );
}
// on failure use jar parsing
catch( final IOException e )
{
AELog.debug( e );
this.handler.parseRecipes( new JarLoader( ASSETS_RECIPE_PATH ), "index.recipe" );
}
catch( final URISyntaxException e )
{
AELog.debug( e );
this.handler.parseRecipes( new JarLoader( ASSETS_RECIPE_PATH ), "index.recipe" );
}
}
else
{
this.handler.parseRecipes( new JarLoader( ASSETS_RECIPE_PATH ), "index.recipe" );
}
}
}
+69 -24
View File
@@ -77,6 +77,7 @@ import appeng.api.networking.spatial.ISpatialCache;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.networking.ticking.ITickManager;
import appeng.api.parts.IPartHelper;
import appeng.api.recipes.IRecipeHandler;
import appeng.bootstrap.ICriterionTriggerRegistry;
import appeng.bootstrap.IModelRegistry;
import appeng.bootstrap.components.IBlockRegistrationComponent;
@@ -90,7 +91,7 @@ import appeng.bootstrap.components.IRecipeRegistrationComponent;
import appeng.capabilities.Capabilities;
import appeng.core.features.AEFeature;
import appeng.core.features.registries.P2PTunnelRegistry;
import appeng.core.features.registries.cell.BasicItemCellHandler;
import appeng.core.features.registries.cell.BasicCellHandler;
import appeng.core.features.registries.cell.CreativeCellHandler;
import appeng.core.localization.GuiText;
import appeng.core.localization.PlayerMessages;
@@ -98,11 +99,9 @@ import appeng.core.stats.AdvancementTriggers;
import appeng.core.stats.PartItemPredicate;
import appeng.core.stats.Stats;
import appeng.core.worlddata.SpatialDimensionManager;
import appeng.fluids.registries.BasicFluidCellHandler;
import appeng.hooks.TickHandler;
import appeng.items.materials.ItemMaterial;
import appeng.items.parts.ItemFacade;
import appeng.items.parts.ItemPart;
import appeng.loot.ChestLoot;
import appeng.me.cache.CraftingGridCache;
import appeng.me.cache.EnergyGridCache;
@@ -114,9 +113,20 @@ import appeng.me.cache.SpatialPylonCache;
import appeng.me.cache.TickManagerCache;
import appeng.parts.PartPlacement;
import appeng.recipes.AEItemResolver;
import appeng.recipes.AERecipeLoader;
import appeng.recipes.CustomRecipeConfig;
import appeng.recipes.RecipeHandler;
import appeng.recipes.game.DisassembleRecipe;
import appeng.recipes.game.FacadeRecipe;
import appeng.recipes.handlers.Crusher;
import appeng.recipes.handlers.Grind;
import appeng.recipes.handlers.HCCrusher;
import appeng.recipes.handlers.Inscribe;
import appeng.recipes.handlers.Macerator;
import appeng.recipes.handlers.MekCrusher;
import appeng.recipes.handlers.MekEnrichment;
import appeng.recipes.handlers.Press;
import appeng.recipes.handlers.Pulverizer;
import appeng.recipes.handlers.Smelt;
import appeng.recipes.ores.OreDictionaryHandler;
import appeng.spatial.BiomeGenStorage;
import appeng.spatial.StorageWorldProvider;
@@ -132,6 +142,15 @@ final class Registration
Biome storageBiome;
AdvancementTriggers advancementTriggers;
private File recipeDirectory;
private CustomRecipeConfig customRecipeConfig;
public void setRecipeInformation( File f, CustomRecipeConfig f2 )
{
this.recipeDirectory = f;
this.customRecipeConfig = f2;
}
void preInitialize( final FMLPreInitializationEvent event )
{
Capabilities.register();
@@ -140,6 +159,10 @@ final class Registration
final IRecipeHandlerRegistry recipeRegistry = api.registries().recipes();
this.registerCraftHandlers( recipeRegistry );
// RecipeSorter.register( "AE2-Facade", FacadeRecipe.class, Category.SHAPED, "" );
// RecipeSorter.register( "AE2-Shaped", ShapedRecipe.class, Category.SHAPED, "" );
// RecipeSorter.register( "AE2-Shapeless", ShapelessRecipe.class, Category.SHAPELESS, "" );
MinecraftForge.EVENT_BUS.register( OreDictionaryHandler.INSTANCE );
ApiDefinitions definitions = api.definitions();
@@ -202,13 +225,26 @@ final class Registration
private void registerCraftHandlers( final IRecipeHandlerRegistry registry )
{
registry.addNewSubItemResolver( new AEItemResolver() );
registry.addNewCraftHandler( "hccrusher", HCCrusher.class );
registry.addNewCraftHandler( "mekcrusher", MekCrusher.class );
registry.addNewCraftHandler( "mekechamber", MekEnrichment.class );
registry.addNewCraftHandler( "grind", Grind.class );
registry.addNewCraftHandler( "crusher", Crusher.class );
registry.addNewCraftHandler( "pulverizer", Pulverizer.class );
registry.addNewCraftHandler( "macerator", Macerator.class );
registry.addNewCraftHandler( "smelt", Smelt.class );
registry.addNewCraftHandler( "inscribe", Inscribe.class );
registry.addNewCraftHandler( "press", Press.class );
}
public void initialize( @Nonnull final FMLInitializationEvent event, @Nonnull final File recipeDirectory )
public void initialize( @Nonnull final FMLInitializationEvent event, @Nonnull final File recipeDirectory, @Nonnull final CustomRecipeConfig customRecipeConfig )
{
Preconditions.checkNotNull( event );
Preconditions.checkNotNull( recipeDirectory );
Preconditions.checkArgument( !recipeDirectory.isFile() );
Preconditions.checkNotNull( customRecipeConfig );
final Api api = Api.INSTANCE;
final IPartHelper partHelper = api.partHelper();
@@ -218,6 +254,19 @@ final class Registration
definitions.getRegistry().getBootstrapComponents( IOreDictComponent.class ).forEachRemaining( b -> b.oreRegistration( event.getSide() ) );
definitions.getRegistry().getBootstrapComponents( IInitComponent.class ).forEachRemaining( b -> b.initialize( event.getSide() ) );
//
// // Perform ore camouflage!
// ItemMaterial.instance.makeUnique();
// final Runnable recipeLoader = new RecipeLoader( recipeDirectory, customRecipeConfig, this.recipeHandler );
// recipeLoader.run();
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.OpenComputers ) )
// {
// partHelper.registerNewLayer( "appeng.parts.layers.LayerSidedEnvironment",
// "li.cil.oc.api.network.SidedEnvironment" );
// }
MinecraftForge.EVENT_BUS.register( TickHandler.INSTANCE );
MinecraftForge.EVENT_BUS.register( new PartPlacement() );
@@ -237,9 +286,8 @@ final class Registration
gcr.registerGridCache( ISecurityGrid.class, SecurityCache.class );
gcr.registerGridCache( ICraftingGrid.class, CraftingGridCache.class );
registries.cell().addCellHandler( new BasicItemCellHandler() );
registries.cell().addCellHandler( new BasicCellHandler() );
registries.cell().addCellHandler( new CreativeCellHandler() );
registries.cell().addCellHandler( new BasicFluidCellHandler() );
api.definitions().materials().matterBall().maybeStack( 1 ).ifPresent( ammoStack ->
{
@@ -299,12 +347,13 @@ final class Registration
// Perform ore camouflage!
ItemMaterial.instance.makeUnique();
ItemPart.instance.registerOreDicts();
if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_DISASSEMBLY_CRAFTING ) )
{
DisassembleRecipe r = new DisassembleRecipe();
registry.register( r.setRegistryName( AppEng.MOD_ID.toLowerCase(), "disassemble" ) );
// RecipeSorter.register( "appliedenergistics2:disassemble", DisassembleRecipe.class, Category.SHAPELESS,
// "after:minecraft:shapeless" );
}
if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_FACADE_CRAFTING ) )
@@ -313,13 +362,18 @@ final class Registration
{
FacadeRecipe f = new FacadeRecipe( (ItemFacade) facadeItem );
registry.register( f.setRegistryName( AppEng.MOD_ID.toLowerCase(), "facade" ) );
// RecipeSorter.register( "appliedenergistics2:facade", FacadeRecipe.class, Category.SHAPED,
// "after:minecraft:shaped" );
} );
}
definitions.getRegistry().getBootstrapComponents( IRecipeRegistrationComponent.class ).forEachRemaining( b -> b.recipeRegistration( side, registry ) );
final AERecipeLoader ldr = new AERecipeLoader();
ldr.loadProcessingRecipes();
// load machine recipes
final IRecipeHandler recipeHandler = new RecipeHandler();
final Runnable recipeLoader = new RecipeLoader( this.recipeDirectory, this.customRecipeConfig, recipeHandler );
recipeLoader.run();
recipeHandler.injectRecipes();
}
@SubscribeEvent
@@ -369,11 +423,6 @@ final class Registration
Upgrades.CAPACITY.registerItem( parts.importBus(), 2 );
Upgrades.SPEED.registerItem( parts.importBus(), 4 );
// Fluid Import Bus
Upgrades.CAPACITY.registerItem( parts.fluidImportBus(), 2 );
Upgrades.REDSTONE.registerItem( parts.fluidImportBus(), 1 );
Upgrades.SPEED.registerItem( parts.fluidImportBus(), 4 );
// Export Bus
Upgrades.FUZZY.registerItem( parts.exportBus(), 1 );
Upgrades.REDSTONE.registerItem( parts.exportBus(), 1 );
@@ -381,11 +430,6 @@ final class Registration
Upgrades.SPEED.registerItem( parts.exportBus(), 4 );
Upgrades.CRAFTING.registerItem( parts.exportBus(), 1 );
// Fluid Export Bus
Upgrades.CAPACITY.registerItem( parts.fluidExportBus(), 2 );
Upgrades.REDSTONE.registerItem( parts.fluidExportBus(), 1 );
Upgrades.SPEED.registerItem( parts.fluidExportBus(), 4 );
// Storage Cells
Upgrades.FUZZY.registerItem( items.cell1k(), 1 );
Upgrades.INVERTER.registerItem( items.cell1k(), 1 );
@@ -410,10 +454,6 @@ final class Registration
Upgrades.INVERTER.registerItem( parts.storageBus(), 1 );
Upgrades.CAPACITY.registerItem( parts.storageBus(), 5 );
// Storage Bus Fluids
Upgrades.INVERTER.registerItem( parts.fluidStorageBus(), 1 );
Upgrades.CAPACITY.registerItem( parts.fluidStorageBus(), 5 );
// Formation Plane
Upgrades.FUZZY.registerItem( parts.formationPlane(), 1 );
Upgrades.INVERTER.registerItem( parts.formationPlane(), 1 );
@@ -516,6 +556,11 @@ final class Registration
{
registries.worldgen().enableWorldGenForDimension( WorldGenType.METEORITES, dimension );
}
/*
* initial recipe bake, if ore dictionary changes after this it re-bakes.
*/
OreDictionaryHandler.INSTANCE.bakeRecipes();
}
private static class ModelLoaderWrapper implements IModelRegistry
+2 -2
View File
@@ -22,9 +22,9 @@ package appeng.core.api;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -75,7 +75,7 @@ public class ApiPart implements IPartHelper
} );
private final Map<Class<?>, String> interfaces2Layer = new HashMap<>();
private final List<String> desc = new ArrayList<>();
private final List<String> desc = new LinkedList<>();
/**
* Conceptually this method will build a new class hierarchy that is rooted at the given base class, and includes a
@@ -47,10 +47,10 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.crafting.CraftingLink;
import appeng.fluids.util.AEFluidStack;
import appeng.fluids.util.FluidList;
import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
import appeng.util.item.AEItemStack;
import appeng.util.item.FluidList;
import appeng.util.item.ItemList;
@@ -163,7 +163,7 @@ public class ApiStorage implements IStorageHelper
@Override
public int transferFactor()
{
return 125;
return 1000;
}
@Override
@@ -126,8 +126,6 @@ import appeng.decorative.solid.BlockQuartzPillar;
import appeng.decorative.solid.BlockSkyStone;
import appeng.decorative.solid.BlockSkyStone.SkystoneType;
import appeng.decorative.stair.BlockStairCommon;
import appeng.fluids.block.BlockFluidInterface;
import appeng.fluids.tile.TileFluidInterface;
import appeng.hooks.DispenserBehaviorTinyTNT;
import appeng.tile.crafting.TileCraftingMonitorTile;
import appeng.tile.crafting.TileCraftingStorageTile;
@@ -199,7 +197,6 @@ public final class ApiBlocks implements IBlocks
private final ITileDefinition drive;
private final ITileDefinition chest;
private final ITileDefinition iface;
private final ITileDefinition fluidIface;
private final ITileDefinition cellWorkbench;
private final ITileDefinition iOPort;
private final ITileDefinition condenser;
@@ -253,11 +250,7 @@ public final class ApiBlocks implements IBlocks
this.quartzOreCharged = registry.block( "charged_quartz_ore", BlockChargedQuartzOre::new )
.features( AEFeature.CERTUS_ORE, AEFeature.CHARGED_CERTUS_ORE )
.useCustomItemModel()
.bootstrap( ( block, item ) -> (IOreDictComponent) side ->
{
OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) );
OreDictionary.registerOre( "oreChargedCertusQuartz", new ItemStack( block ) );
} )
.bootstrap( ( block, item ) -> (IOreDictComponent) side -> OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) ) )
.build();
this.matrixFrame = registry.block( "matrix_frame", BlockMatrixFrame::new ).features( AEFeature.SPATIAL_IO ).build();
@@ -393,10 +386,6 @@ public final class ApiBlocks implements IBlocks
.features( AEFeature.INTERFACE )
.tileEntity( new TileEntityDefinition( TileInterface.class ) )
.build();
this.fluidIface = registry.block( "fluid_interface", BlockFluidInterface::new )
.features( AEFeature.FLUID_INTERFACE )
.tileEntity( new TileEntityDefinition( TileFluidInterface.class ) )
.build();
this.cellWorkbench = registry.block( "cell_workbench", BlockCellWorkbench::new )
.features( AEFeature.STORAGE_CELLS )
.tileEntity( new TileEntityDefinition( TileCellWorkbench.class ) )
@@ -900,12 +889,6 @@ public final class ApiBlocks implements IBlocks
return this.iface;
}
@Override
public ITileDefinition fluidIface()
{
return this.fluidIface;
}
@Override
public ITileDefinition cellWorkbench()
{
@@ -30,9 +30,6 @@ import appeng.debug.ToolDebugCard;
import appeng.debug.ToolEraser;
import appeng.debug.ToolMeteoritePlacer;
import appeng.debug.ToolReplicatorCard;
import appeng.fluids.items.BasicFluidStorageCell;
import appeng.fluids.items.FluidDummyItem;
import appeng.fluids.items.FluidDummyItemRendering;
import appeng.hooks.DispenserBlockTool;
import appeng.hooks.DispenserMatterCannon;
import appeng.items.materials.MaterialType;
@@ -43,7 +40,7 @@ import appeng.items.misc.ItemPaintBall;
import appeng.items.misc.ItemPaintBallRendering;
import appeng.items.parts.FacadeRendering;
import appeng.items.parts.ItemFacade;
import appeng.items.storage.BasicItemStorageCell;
import appeng.items.storage.ItemBasicStorageCell;
import appeng.items.storage.ItemCreativeStorageCell;
import appeng.items.storage.ItemSpatialStorageCell;
import appeng.items.storage.ItemViewCell;
@@ -105,11 +102,6 @@ public final class ApiItems implements IItems
private final IItemDefinition cell16k;
private final IItemDefinition cell64k;
private final IItemDefinition fluidCell1k;
private final IItemDefinition fluidCell4k;
private final IItemDefinition fluidCell16k;
private final IItemDefinition fluidCell64k;
private final IItemDefinition spatialCell2;
private final IItemDefinition spatialCell16;
private final IItemDefinition spatialCell128;
@@ -131,8 +123,6 @@ public final class ApiItems implements IItems
private final IItemDefinition toolDebugCard;
private final IItemDefinition toolReplicatorCard;
private final IItemDefinition dummyFluidItem;
public ApiItems( FeatureFactory registry )
{
FeatureFactory certusTools = registry.features( AEFeature.CERTUS_QUARTZ_TOOLS );
@@ -208,15 +198,10 @@ public final class ApiItems implements IItems
this.viewCell = registry.item( "view_cell", ItemViewCell::new ).features( AEFeature.VIEW_CELL ).build();
FeatureFactory storageCells = registry.features( AEFeature.STORAGE_CELLS );
this.cell1k = storageCells.item( "storage_cell_1k", () -> new BasicItemStorageCell( MaterialType.CELL1K_PART, 1 ) ).build();
this.cell4k = storageCells.item( "storage_cell_4k", () -> new BasicItemStorageCell( MaterialType.CELL4K_PART, 4 ) ).build();
this.cell16k = storageCells.item( "storage_cell_16k", () -> new BasicItemStorageCell( MaterialType.CELL16K_PART, 16 ) ).build();
this.cell64k = storageCells.item( "storage_cell_64k", () -> new BasicItemStorageCell( MaterialType.CELL64K_PART, 64 ) ).build();
this.fluidCell1k = storageCells.item( "fluid_storage_cell_1k", () -> new BasicFluidStorageCell( MaterialType.FLUID_CELL1K_PART, 1 ) ).build();
this.fluidCell4k = storageCells.item( "fluid_storage_cell_4k", () -> new BasicFluidStorageCell( MaterialType.FLUID_CELL4K_PART, 4 ) ).build();
this.fluidCell16k = storageCells.item( "fluid_storage_cell_16k", () -> new BasicFluidStorageCell( MaterialType.FLUID_CELL16K_PART, 16 ) ).build();
this.fluidCell64k = storageCells.item( "fluid_storage_cell_64k", () -> new BasicFluidStorageCell( MaterialType.FLUID_CELL64K_PART, 64 ) ).build();
this.cell1k = storageCells.item( "storage_cell_1k", () -> new ItemBasicStorageCell( MaterialType.CELL1K_PART, 1 ) ).build();
this.cell4k = storageCells.item( "storage_cell_4k", () -> new ItemBasicStorageCell( MaterialType.CELL4K_PART, 4 ) ).build();
this.cell16k = storageCells.item( "storage_cell_16k", () -> new ItemBasicStorageCell( MaterialType.CELL16K_PART, 16 ) ).build();
this.cell64k = storageCells.item( "storage_cell_64k", () -> new ItemBasicStorageCell( MaterialType.CELL64K_PART, 64 ) ).build();
FeatureFactory spatialCells = registry.features( AEFeature.SPATIAL_IO );
this.spatialCell2 = spatialCells.item( "spatial_storage_cell_2_cubed", () -> new ItemSpatialStorageCell( 2 ) ).build();
@@ -251,8 +236,6 @@ public final class ApiItems implements IItems
this.toolMeteoritePlacer = debugTools.item( "debug_meteorite_placer", ToolMeteoritePlacer::new ).build();
this.toolDebugCard = debugTools.item( "debug_card", ToolDebugCard::new ).build();
this.toolReplicatorCard = debugTools.item( "debug_replicator_card", ToolReplicatorCard::new ).build();
this.dummyFluidItem = registry.item( "dummy_fluid_item", FluidDummyItem::new ).rendering( new FluidDummyItemRendering() ).build();
}
@Override
@@ -423,30 +406,6 @@ public final class ApiItems implements IItems
return this.cell64k;
}
@Override
public IItemDefinition fluidCell1k()
{
return this.fluidCell1k;
}
@Override
public IItemDefinition fluidCell4k()
{
return this.fluidCell4k;
}
@Override
public IItemDefinition fluidCell16k()
{
return this.fluidCell16k;
}
@Override
public IItemDefinition fluidCell64k()
{
return this.fluidCell64k;
}
@Override
public IItemDefinition spatialCell2()
{
@@ -525,9 +484,4 @@ public final class ApiItems implements IItems
{
return this.toolReplicatorCard;
}
public IItemDefinition dummyFluidItem()
{
return this.dummyFluidItem;
}
}
@@ -111,11 +111,6 @@ public final class ApiMaterials implements IMaterials
private final IItemDefinition qESingularity;
private final IItemDefinition blankPattern;
private final IItemDefinition fluidCell1kPart;
private final IItemDefinition fluidCell4kPart;
private final IItemDefinition fluidCell16kPart;
private final IItemDefinition fluidCell64kPart;
public ApiMaterials( FeatureFactory registry )
{
final ItemMaterial materials = new ItemMaterial();
@@ -215,11 +210,6 @@ public final class ApiMaterials implements IMaterials
this.qESingularity = new DamagedItemDefinition( "material.singularity.entangled.quantum", materials
.createMaterial( MaterialType.QUANTUM_ENTANGLED_SINGULARITY ) );
this.blankPattern = new DamagedItemDefinition( "material.pattern.blank", materials.createMaterial( MaterialType.BLANK_PATTERN ) );
this.fluidCell1kPart = new DamagedItemDefinition( "material.cell.storage.1k", materials.createMaterial( MaterialType.FLUID_CELL1K_PART ) );
this.fluidCell4kPart = new DamagedItemDefinition( "material.cell.storage.4k", materials.createMaterial( MaterialType.FLUID_CELL4K_PART ) );
this.fluidCell16kPart = new DamagedItemDefinition( "material.cell.storage.16k", materials.createMaterial( MaterialType.FLUID_CELL16K_PART ) );
this.fluidCell64kPart = new DamagedItemDefinition( "material.cell.storage.64k", materials.createMaterial( MaterialType.FLUID_CELL64K_PART ) );
}
@Override
@@ -539,28 +529,4 @@ public final class ApiMaterials implements IMaterials
{
return this.blankPattern;
}
@Override
public IItemDefinition fluidCell1kPart()
{
return this.fluidCell1kPart;
}
@Override
public IItemDefinition fluidCell4kPart()
{
return this.fluidCell4kPart;
}
@Override
public IItemDefinition fluidCell16kPart()
{
return this.fluidCell16kPart;
}
@Override
public IItemDefinition fluidCell64kPart()
{
return this.fluidCell64kPart;
}
}
@@ -55,14 +55,10 @@ public final class ApiParts implements IParts
private final IItemDefinition importBus;
private final IItemDefinition exportBus;
private final IItemDefinition iface;
private final IItemDefinition fluidIface;
private final IItemDefinition levelEmitter;
private final IItemDefinition fluidLevelEmitter;
private final IItemDefinition annihilationPlane;
private final IItemDefinition identityAnnihilationPlane;
private final IItemDefinition fluidAnnihilationPlane;
private final IItemDefinition formationPlane;
private final IItemDefinition fluidFormationPlane;
private final IItemDefinition p2PTunnelME;
private final IItemDefinition p2PTunnelRedstone;
private final IItemDefinition p2PTunnelItems;
@@ -81,10 +77,6 @@ public final class ApiParts implements IParts
private final IItemDefinition terminal;
private final IItemDefinition storageMonitor;
private final IItemDefinition conversionMonitor;
private final IItemDefinition fluidImportBus;
private final IItemDefinition fluidExportBus;
private final IItemDefinition fluidTerminal;
private final IItemDefinition fluidStorageBus;
public ApiParts( FeatureFactory registry, PartModels partModels )
{
@@ -115,15 +107,11 @@ public final class ApiParts implements IParts
this.importBus = new DamagedItemDefinition( "part.bus.import", itemPart.createPart( PartType.IMPORT_BUS ) );
this.exportBus = new DamagedItemDefinition( "part.bus.export", itemPart.createPart( PartType.EXPORT_BUS ) );
this.iface = new DamagedItemDefinition( "part.interface", itemPart.createPart( PartType.INTERFACE ) );
this.fluidIface = new DamagedItemDefinition( "part.fluid_interface", itemPart.createPart( PartType.FLUID_INTERFACE ) );
this.levelEmitter = new DamagedItemDefinition( "part.level_emitter", itemPart.createPart( PartType.LEVEL_EMITTER ) );
this.fluidLevelEmitter = new DamagedItemDefinition( "part.fluid_level_emitter", itemPart.createPart( PartType.FLUID_LEVEL_EMITTER ) );
this.annihilationPlane = new DamagedItemDefinition( "part.plane.annihilation", itemPart.createPart( PartType.ANNIHILATION_PLANE ) );
this.identityAnnihilationPlane = new DamagedItemDefinition( "part.plane.annihiliation.identity", itemPart
.createPart( PartType.IDENTITY_ANNIHILATION_PLANE ) );
this.fluidAnnihilationPlane = new DamagedItemDefinition( "part.plane.fluid_annihilation", itemPart.createPart( PartType.FLUID_ANNIHILATION_PLANE ) );
this.formationPlane = new DamagedItemDefinition( "part.plane.formation", itemPart.createPart( PartType.FORMATION_PLANE ) );
this.fluidFormationPlane = new DamagedItemDefinition( "part.plane.fluid_formation", itemPart.createPart( PartType.FLUID_FORMATION_PLANE ) );
this.p2PTunnelME = new DamagedItemDefinition( "part.tunnel.me", itemPart.createPart( PartType.P2P_TUNNEL_ME ) );
this.p2PTunnelRedstone = new DamagedItemDefinition( "part.tunnel.redstone", itemPart.createPart( PartType.P2P_TUNNEL_REDSTONE ) );
this.p2PTunnelItems = new DamagedItemDefinition( "part.tunnel.item", itemPart.createPart( PartType.P2P_TUNNEL_ITEMS ) );
@@ -143,10 +131,6 @@ public final class ApiParts implements IParts
this.terminal = new DamagedItemDefinition( "part.terminal", itemPart.createPart( PartType.TERMINAL ) );
this.storageMonitor = new DamagedItemDefinition( "part.monitor.storage", itemPart.createPart( PartType.STORAGE_MONITOR ) );
this.conversionMonitor = new DamagedItemDefinition( "part.monitor.conversion", itemPart.createPart( PartType.CONVERSION_MONITOR ) );
this.fluidImportBus = new DamagedItemDefinition( "part.bus.import.fluid", itemPart.createPart( PartType.FLUID_IMPORT_BUS ) );
this.fluidExportBus = new DamagedItemDefinition( "part.bus.export.fluid", itemPart.createPart( PartType.FLUID_EXPORT_BUS ) );
this.fluidTerminal = new DamagedItemDefinition( "part.terminal.fluid", itemPart.createPart( PartType.FLUID_TERMINAL ) );
this.fluidStorageBus = new DamagedItemDefinition( "part.bus.storage.fluid", itemPart.createPart( PartType.FLUID_STORAGE_BUS ) );
}
private static AEColoredItemDefinition constructColoredDefinition( final ItemPart target, final PartType type )
@@ -263,12 +247,6 @@ public final class ApiParts implements IParts
return this.iface;
}
@Override
public IItemDefinition fluidIface()
{
return this.fluidIface;
}
@Override
public IItemDefinition levelEmitter()
{
@@ -402,46 +380,4 @@ public final class ApiParts implements IParts
{
return this.conversionMonitor;
}
@Override
public IItemDefinition fluidTerminal()
{
return this.fluidTerminal;
}
@Override
public IItemDefinition fluidImportBus()
{
return this.fluidImportBus;
}
@Override
public IItemDefinition fluidExportBus()
{
return this.fluidExportBus;
}
@Override
public IItemDefinition fluidStorageBus()
{
return this.fluidStorageBus;
}
@Override
public IItemDefinition fluidLevelEmitter()
{
return this.fluidLevelEmitter;
}
@Override
public IItemDefinition fluidAnnihilationPlane()
{
return this.fluidAnnihilationPlane;
}
@Override
public IItemDefinition fluidFormationnPlane()
{
return this.fluidFormationPlane;
}
}
@@ -1,6 +1,6 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -75,25 +75,17 @@ public enum AEFeature
CHANNELS( "Channels", Constants.CATEGORY_NETWORK_FEATURES ),
INTERFACE( "Interface", Constants.CATEGORY_NETWORK_BUSES ),
FLUID_INTERFACE( "FluidInterface", Constants.CATEGORY_NETWORK_BUSES ),
LEVEL_EMITTER( "LevelEmitter", Constants.CATEGORY_NETWORK_BUSES ),
FLUID_LEVEL_EMITTER( "FluidLevelEmitter", Constants.CATEGORY_NETWORK_BUSES ),
FLUID_TERMINAL( "FluidTerminal", Constants.CATEGORY_NETWORK_BUSES ),
CRAFTING_TERMINAL( "CraftingTerminal", Constants.CATEGORY_NETWORK_BUSES ),
TERMINAL( "Terminal", Constants.CATEGORY_NETWORK_BUSES ),
STORAGE_MONITOR( "StorageMonitor", Constants.CATEGORY_NETWORK_BUSES ),
P2P_TUNNEL( "P2PTunnel", Constants.CATEGORY_NETWORK_BUSES ),
FORMATION_PLANE( "FormationPlane", Constants.CATEGORY_NETWORK_BUSES ),
FLUID_FORMATION_PLANE( "FluidFormationPlane", Constants.CATEGORY_NETWORK_BUSES ),
ANNIHILATION_PLANE( "AnnihilationPlane", Constants.CATEGORY_NETWORK_BUSES ),
IDENTITY_ANNIHILATION_PLANE( "IdentityAnnihilationPlane", Constants.CATEGORY_NETWORK_BUSES ),
FLUID_ANNIHILATION_PLANE( "FluidAnnihilationPlane", Constants.CATEGORY_NETWORK_BUSES ),
IMPORT_BUS( "ImportBus", Constants.CATEGORY_NETWORK_BUSES ),
FLUID_IMPORT_BUS( "FluidImportBus", Constants.CATEGORY_NETWORK_BUSES ),
EXPORT_BUS( "ExportBus", Constants.CATEGORY_NETWORK_BUSES ),
FLUID_EXPORT_BUS( "FluidExportBus", Constants.CATEGORY_NETWORK_BUSES ),
STORAGE_BUS( "StorageBus", Constants.CATEGORY_NETWORK_BUSES ),
FLUID_STORAGE_BUS( "FluidStorageBus", Constants.CATEGORY_NETWORK_BUSES ),
PART_CONVERSION_MONITOR( "PartConversionMonitor", Constants.CATEGORY_NETWORK_BUSES ),
TOGGLE_BUS( "ToggleBus", Constants.CATEGORY_NETWORK_BUSES ),
PANELS( "Panels", Constants.CATEGORY_NETWORK_BUSES ),
@@ -19,10 +19,9 @@
package appeng.core.features.registries;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
@@ -40,8 +39,8 @@ public class MovableTileRegistry implements IMovableRegistry
private final HashSet<Block> blacklisted = new HashSet<>();
private final HashMap<Class<? extends TileEntity>, IMovableHandler> Valid = new HashMap<>();
private final List<Class<? extends TileEntity>> test = new ArrayList<>();
private final List<IMovableHandler> handlers = new ArrayList<>();
private final LinkedList<Class<? extends TileEntity>> test = new LinkedList<>();
private final LinkedList<IMovableHandler> handlers = new LinkedList<>();
private final DefaultSpatialHandler dsh = new DefaultSpatialHandler();
private final IMovableHandler nullHandler = new DefaultSpatialHandler();
@@ -19,9 +19,9 @@
package appeng.core.features.registries;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Map;
@@ -44,7 +44,7 @@ import appeng.recipes.RecipeHandler;
public class RecipeHandlerRegistry implements IRecipeHandlerRegistry
{
private final Map<String, Class<? extends ICraftHandler>> handlers = new HashMap<>( 20 );
private final Collection<ISubItemResolver> resolvers = new ArrayList<>();
private final Collection<ISubItemResolver> resolvers = new LinkedList<>();
@Override
public void addNewCraftHandler( final String name, final Class<? extends ICraftHandler> handler )
@@ -36,18 +36,18 @@ import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEStack;
import appeng.api.util.AEPartLocation;
import appeng.core.sync.GuiBridge;
import appeng.me.storage.ItemCellInventory;
import appeng.me.storage.ItemCellInventoryHandler;
import appeng.me.storage.CellInventory;
import appeng.me.storage.CellInventoryHandler;
import appeng.util.Platform;
public class BasicItemCellHandler implements ICellHandler
public class BasicCellHandler implements ICellHandler
{
@Override
public boolean isCell( final ItemStack is )
{
return ItemCellInventory.isCell( is );
return CellInventory.isCell( is );
}
@Override
@@ -55,27 +55,23 @@ public class BasicItemCellHandler implements ICellHandler
{
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
{
return ItemCellInventory.getCell( is, container );
return CellInventory.getCell( is, container );
}
return null;
}
@Override
public void openChestGui( final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final IStorageChannel chan )
{
if( chan == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
{
Platform.openGUI( player, (TileEntity) chest, AEPartLocation.fromFacing( chest.getUp() ), GuiBridge.GUI_ME );
}
Platform.openGUI( player, (TileEntity) chest, AEPartLocation.fromFacing( chest.getUp() ), GuiBridge.GUI_ME );
}
@Override
public int getStatusForCell( final ItemStack is, final IMEInventory handler )
{
if( handler instanceof ItemCellInventoryHandler )
if( handler instanceof CellInventoryHandler )
{
final ItemCellInventoryHandler ci = (ItemCellInventoryHandler) handler;
final CellInventoryHandler ci = (CellInventoryHandler) handler;
return ci.getStatusForCell();
}
return 0;
@@ -22,9 +22,6 @@ package appeng.core.features.registries.cell;
import java.util.ArrayList;
import java.util.List;
import com.google.common.base.Preconditions;
import com.google.common.base.Verify;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ICellHandler;
@@ -46,15 +43,12 @@ public class CellRegistry implements ICellRegistry
}
@Override
public void addCellHandler( final ICellHandler handler )
public void addCellHandler( final ICellHandler h )
{
Preconditions.checkNotNull( handler, "Called before FMLInitializationEvent." );
Preconditions.checkArgument( !this.handlers.contains( handler ), "Tried to register the same handler instance twice." );
this.handlers.add( handler );
// Verify that the first entry is always our own handler.
Verify.verify( this.handlers.get( 0 ) instanceof BasicItemCellHandler );
if( h != null )
{
this.handlers.add( h );
}
}
@Override
@@ -38,7 +38,7 @@ import appeng.me.storage.CreativeCellInventory;
import appeng.util.Platform;
public final class CreativeCellHandler implements ICellHandler
public class CreativeCellHandler implements ICellHandler
{
@Override
@@ -129,9 +129,6 @@ public enum ButtonToolTips
ReportInaccessibleItems,
ReportInaccessibleItemsYes,
ReportInaccessibleItemsNo,
ReportInaccessibleFluids,
ReportInaccessibleFluidsYes,
ReportInaccessibleFluidsNo,
BlockPlacement,
BlockPlacementYes,
@@ -37,25 +37,19 @@ public enum GuiText
VibrationChamber,
SpatialIOPort,
LevelEmitter,
FluidLevelEmitter,
Terminal,
Interface,
FluidInterface,
Config,
StoredItems,
StoredFluids,
Patterns,
ImportBus,
ImportBusFluids,
ExportBus,
ExportBusFluids,
CellWorkbench,
NetworkDetails,
StorageCells,
IOBuses,
IOBusesFluids,
IOPort,
BytesUsed,
@@ -70,7 +64,6 @@ public enum GuiText
EnergyDrain,
StorageBus,
StorageBusFluids,
Priority,
Security,
Encoded,
@@ -85,7 +78,6 @@ public enum GuiText
CraftingTerminal,
FormationPlane,
FluidFormationPlane,
Inscriber,
QuartzCuttingKnife,
@@ -29,12 +29,8 @@ public enum TickRates
ImportBus( 5, 40 ),
FluidImportBus( 5, 40 ),
ExportBus( 5, 60 ),
FluidExportBus( 5, 60 ),
AnnihilationPlane( 2, 120 ),
METunnel( 5, 20 ),
@@ -49,8 +45,6 @@ public enum TickRates
StorageBus( 5, 60 ),
FluidStorageBus( 5, 60 ),
ItemTunnel( 5, 60 ),
LightTunnel( 5, 60 ),
@@ -39,6 +39,8 @@ import appeng.core.sync.network.NetworkHandler;
public abstract class AppEngPacket implements Packet
{
private AppEngPacketHandlerBase.PacketTypes id;
private PacketBuffer p;
private PacketCallState caller;
@@ -33,11 +33,9 @@ import appeng.core.sync.packets.PacketCompassResponse;
import appeng.core.sync.packets.PacketCompressedNBT;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketCraftRequest;
import appeng.core.sync.packets.PacketFluidSlot;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.core.sync.packets.PacketJEIRecipe;
import appeng.core.sync.packets.PacketLightning;
import appeng.core.sync.packets.PacketMEFluidInventoryUpdate;
import appeng.core.sync.packets.PacketMEInventoryUpdate;
import appeng.core.sync.packets.PacketMatterCannon;
import appeng.core.sync.packets.PacketMockExplosion;
@@ -47,7 +45,6 @@ import appeng.core.sync.packets.PacketPatternSlot;
import appeng.core.sync.packets.PacketProgressBar;
import appeng.core.sync.packets.PacketSwapSlots;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.core.sync.packets.PacketTargetFluidStack;
import appeng.core.sync.packets.PacketTargetItemStack;
import appeng.core.sync.packets.PacketTransitionEffect;
import appeng.core.sync.packets.PacketValueConfig;
@@ -67,8 +64,6 @@ public class AppEngPacketHandlerBase
PACKET_ME_INVENTORY_UPDATE( PacketMEInventoryUpdate.class ),
PACKET_ME_FLUID_INVENTORY_UPDATE( PacketMEFluidInventoryUpdate.class ),
PACKET_CONFIG_BUTTON( PacketConfigButton.class ),
PACKET_PART_PLACEMENT( PacketPartPlacement.class ),
@@ -97,17 +92,13 @@ public class AppEngPacketHandlerBase
PACKET_TARGET_ITEM( PacketTargetItemStack.class ),
PACKET_TARGET_FLUID( PacketTargetFluidStack.class ),
PACKET_CRAFTING_REQUEST( PacketCraftRequest.class ),
PACKET_ASSEMBLER_ANIMATION( PacketAssemblerAnimation.class ),
PACKET_COMPRESSED_NBT( PacketCompressedNBT.class ),
PACKET_PAINTED_ENTITY( PacketPaintedEntity.class ),
PACKET_FLUID_TANK( PacketFluidSlot.class );
PACKET_PAINTED_ENTITY( PacketPaintedEntity.class );
private final Class<? extends AppEngPacket> packetClass;
private final Constructor<? extends AppEngPacket> packetConstructor;
@@ -86,17 +86,6 @@ import appeng.container.implementations.ContainerUpgradeable;
import appeng.container.implementations.ContainerVibrationChamber;
import appeng.container.implementations.ContainerWireless;
import appeng.container.implementations.ContainerWirelessTerm;
import appeng.fluids.container.ContainerFluidFormationPlane;
import appeng.fluids.container.ContainerFluidIO;
import appeng.fluids.container.ContainerFluidInterface;
import appeng.fluids.container.ContainerFluidLevelEmitter;
import appeng.fluids.container.ContainerFluidStorageBus;
import appeng.fluids.container.ContainerFluidTerminal;
import appeng.fluids.helper.IFluidInterfaceHost;
import appeng.fluids.parts.PartFluidFormationPlane;
import appeng.fluids.parts.PartFluidLevelEmitter;
import appeng.fluids.parts.PartFluidStorageBus;
import appeng.fluids.parts.PartSharedFluidBus;
import appeng.helpers.IInterfaceHost;
import appeng.helpers.IPriorityHost;
import appeng.helpers.WirelessTerminalGuiObject;
@@ -161,22 +150,14 @@ public enum GuiBridge implements IGuiHandler
GUI_INTERFACE( ContainerInterface.class, IInterfaceHost.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
GUI_FLUID_INTERFACE( ContainerFluidInterface.class, IFluidInterfaceHost.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
GUI_BUS( ContainerUpgradeable.class, IUpgradeableHost.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
GUI_BUS_FLUID( ContainerFluidIO.class, PartSharedFluidBus.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
GUI_IOPORT( ContainerIOPort.class, TileIOPort.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
GUI_STORAGEBUS( ContainerStorageBus.class, PartStorageBus.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
GUI_STORAGEBUS_FLUID( ContainerFluidStorageBus.class, PartFluidStorageBus.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
GUI_FORMATION_PLANE( ContainerFormationPlane.class, PartFormationPlane.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
GUI_FLUID_FORMATION_PLANE( ContainerFluidFormationPlane.class, PartFluidFormationPlane.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
GUI_PRIORITY( ContainerPriority.class, IPriorityHost.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
GUI_SECURITY( ContainerSecurityStation.class, TileSecurityStation.class, GuiHostType.WORLD, SecurityPermissions.SECURITY ),
@@ -185,13 +166,9 @@ public enum GuiBridge implements IGuiHandler
GUI_PATTERN_TERMINAL( ContainerPatternTerm.class, PartPatternTerminal.class, GuiHostType.WORLD, SecurityPermissions.CRAFT ),
GUI_FLUID_TERMINAL( ContainerFluidTerminal.class, ITerminalHost.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
// extends (Container/Gui) + Bus
GUI_LEVEL_EMITTER( ContainerLevelEmitter.class, PartLevelEmitter.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
GUI_FLUID_LEVEL_EMITTER( ContainerFluidLevelEmitter.class, PartFluidLevelEmitter.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
GUI_SPATIAL_IO_PORT( ContainerSpatialIOPort.class, TileSpatialIOPort.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
GUI_INSCRIBER( ContainerInscriber.class, TileInscriber.class, GuiHostType.WORLD, null ),
@@ -1,95 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.sync.packets;
import java.util.HashMap;
import java.util.Map;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.common.network.ByteBufUtils;
import appeng.api.storage.data.IAEFluidStack;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.fluids.container.IFluidSyncContainer;
import appeng.fluids.util.AEFluidStack;
public class PacketFluidSlot extends AppEngPacket
{
private final Map<Integer, IAEFluidStack> list;
public PacketFluidSlot( final ByteBuf stream )
{
this.list = new HashMap<>();
NBTTagCompound tag = ByteBufUtils.readTag( stream );
for( final String key : tag.getKeySet() )
{
this.list.put( Integer.parseInt( key ), AEFluidStack.fromNBT( tag.getCompoundTag( key ) ) );
}
}
// api
public PacketFluidSlot( final Map<Integer, IAEFluidStack> list )
{
this.list = list;
final NBTTagCompound sendTag = new NBTTagCompound();
for( Map.Entry<Integer, IAEFluidStack> fs : list.entrySet() )
{
final NBTTagCompound tag = new NBTTagCompound();
if( fs.getValue() != null )
{
fs.getValue().writeToNBT( tag );
}
sendTag.setTag( fs.getKey().toString(), tag );
}
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
ByteBufUtils.writeTag( data, sendTag );
this.configureWrite( data );
}
@Override
public void clientPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
final Container c = player.openContainer;
if( c instanceof IFluidSyncContainer )
{
( (IFluidSyncContainer) c ).receiveFluidSlots( this.list );
}
}
@Override
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
{
final Container c = player.openContainer;
if( c instanceof IFluidSyncContainer )
{
( (IFluidSyncContainer) c ).receiveFluidSlots( this.list );
}
}
}
@@ -1,207 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.sync.packets;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.BufferOverflowException;
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;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.storage.data.IAEFluidStack;
import appeng.core.AELog;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.fluids.client.gui.GuiFluidTerminal;
import appeng.fluids.util.AEFluidStack;
/**
* @author BrockWS
* @version rv6 - 22/05/2018
* @since rv6 22/05/2018
*/
public class PacketMEFluidInventoryUpdate extends AppEngPacket
{
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.
@Nullable
private final List<IAEFluidStack> 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 PacketMEFluidInventoryUpdate( final ByteBuf stream ) throws IOException
{
this.data = null;
this.compressFrame = null;
this.list = new LinkedList<>();
this.ref = stream.readByte();
// int originalBytes = stream.readableBytes();
final GZIPInputStream gzReader = new GZIPInputStream( new InputStream()
{
@Override
public int read() throws IOException
{
if( stream.readableBytes() <= 0 )
{
return -1;
}
return stream.readByte() & STREAM_MASK;
}
} );
final ByteBuf uncompressed = Unpooled.buffer( stream.readableBytes() );
final byte[] tmp = new byte[TEMP_BUFFER_SIZE];
while( gzReader.available() != 0 )
{
final int bytes = gzReader.read( tmp );
if( bytes > 0 )
{
uncompressed.writeBytes( tmp, 0, bytes );
}
}
gzReader.close();
// int uncompressedBytes = uncompressed.readableBytes();
// AELog.info( "Receiver: " + originalBytes + " -> " + uncompressedBytes );
while( uncompressed.readableBytes() > 0 )
{
this.list.add( AEFluidStack.fromPacket( uncompressed ) );
}
this.empty = this.list.isEmpty();
}
// api
public PacketMEFluidInventoryUpdate() throws IOException
{
this( (byte) 0 );
}
// api
public PacketMEFluidInventoryUpdate( final 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( final int value ) throws IOException
{
PacketMEFluidInventoryUpdate.this.data.writeByte( value );
}
} );
this.list = null;
}
@Override
@SideOnly( Side.CLIENT )
public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
{
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if( gs instanceof GuiFluidTerminal )
{
( (GuiFluidTerminal) gs ).postUpdate( this.list );
}
}
@Nullable
@Override
public FMLProxyPacket getProxy()
{
try
{
this.compressFrame.close();
this.configureWrite( this.data );
return super.getProxy();
}
catch( final IOException e )
{
AELog.debug( e );
}
return null;
}
public void appendFluid( final IAEFluidStack fs ) throws IOException, BufferOverflowException
{
final ByteBuf tmp = Unpooled.buffer( OPERATION_BYTE_LIMIT );
fs.writeToPacket( tmp );
this.compressFrame.flush();
if( this.writtenBytes + tmp.readableBytes() > UNCOMPRESSED_PACKET_BYTE_LIMIT )
{
throw new BufferOverflowException();
}
else
{
this.writtenBytes += tmp.readableBytes();
this.compressFrame.write( tmp.array(), 0, tmp.readableBytes() );
this.empty = false;
}
}
public int getLength()
{
return this.data.readableBytes();
}
public boolean isEmpty()
{
return this.empty;
}
}
@@ -23,7 +23,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.BufferOverflowException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
@@ -77,7 +77,7 @@ public class PacketMEInventoryUpdate extends AppEngPacket
{
this.data = null;
this.compressFrame = null;
this.list = new ArrayList<>();
this.list = new LinkedList<>();
this.ref = stream.readByte();
// int originalBytes = stream.readableBytes();
@@ -1,94 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.sync.packets;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.EntityPlayer;
import appeng.core.AELog;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.fluids.container.ContainerFluidTerminal;
import appeng.fluids.util.AEFluidStack;
/**
* @author BrockWS
* @version rv6 - 23/05/2018
* @since rv6 23/05/2018
*/
public class PacketTargetFluidStack extends AppEngPacket
{
private AEFluidStack stack;
// automatic.
public PacketTargetFluidStack( final ByteBuf stream )
{
try
{
if( stream.readableBytes() > 0 )
{
this.stack = (AEFluidStack) AEFluidStack.fromPacket( stream );
}
else
{
this.stack = null;
}
}
catch( Exception ex )
{
AELog.debug( ex );
this.stack = null;
}
}
// api
public PacketTargetFluidStack( AEFluidStack stack )
{
this.stack = stack;
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
if( stack != null )
{
try
{
stack.writeToPacket( data );
}
catch( Exception ex )
{
AELog.debug( ex );
}
}
this.configureWrite( data );
}
@Override
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
if( player.openContainer instanceof ContainerFluidTerminal )
{
( (ContainerFluidTerminal) player.openContainer ).setTargetStack( this.stack );
}
}
}
@@ -53,8 +53,6 @@ import appeng.container.implementations.ContainerSecurityStation;
import appeng.container.implementations.ContainerStorageBus;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.fluids.container.ContainerFluidLevelEmitter;
import appeng.fluids.container.ContainerFluidStorageBus;
import appeng.helpers.IMouseWheelItem;
@@ -161,11 +159,6 @@ public class PacketValueConfig extends AppEngPacket
final ContainerLevelEmitter lvc = (ContainerLevelEmitter) c;
lvc.setLevel( Long.parseLong( this.Value ), player );
}
else if( this.Name.equals( "FluidLevelEmitter.Value" ) && c instanceof ContainerFluidLevelEmitter )
{
final ContainerFluidLevelEmitter lvc = (ContainerFluidLevelEmitter) c;
lvc.setLevel( Long.parseLong( this.Value ), player );
}
else if( this.Name.startsWith( "PatternTerminal." ) && c instanceof ContainerPatternTerm )
{
final ContainerPatternTerm cpt = (ContainerPatternTerm) c;
@@ -186,31 +179,18 @@ public class PacketValueConfig extends AppEngPacket
cpt.getPatternTerminal().setSubstitution( this.Value.equals( "1" ) );
}
}
else if( this.Name.startsWith( "StorageBus." ) )
else if( this.Name.startsWith( "StorageBus." ) && c instanceof ContainerStorageBus )
{
final ContainerStorageBus ccw = (ContainerStorageBus) c;
if( this.Name.equals( "StorageBus.Action" ) )
{
if( this.Value.equals( "Partition" ) )
{
if( c instanceof ContainerStorageBus )
{
( (ContainerStorageBus) c ).partition();
}
else if( c instanceof ContainerFluidStorageBus )
{
( (ContainerFluidStorageBus) c ).partition();
}
ccw.partition();
}
else if( this.Value.equals( "Clear" ) )
{
if( c instanceof ContainerStorageBus )
{
( (ContainerStorageBus) c ).clear();
}
else if( c instanceof ContainerFluidStorageBus )
{
( (ContainerFluidStorageBus) c ).clear();
}
ccw.clear();
}
}
}
@@ -23,8 +23,8 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import javax.annotation.Nonnull;
@@ -101,7 +101,7 @@ final class SpawnData implements IWorldSpawnData
@Override
public Collection<NBTTagCompound> getNearByMeteorites( final int dim, final int chunkX, final int chunkZ )
{
final Collection<NBTTagCompound> ll = new ArrayList<>();
final Collection<NBTTagCompound> ll = new LinkedList<>();
synchronized( SpawnData.class )
{
@@ -21,6 +21,7 @@ package appeng.crafting;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import com.google.common.collect.Lists;
@@ -121,7 +122,7 @@ public class CraftingTreeNode
{
this.job.handlePausing();
final List<IAEItemStack> thingsUsed = new ArrayList<>();
final List<IAEItemStack> thingsUsed = new LinkedList<>();
this.what.setStackSize( l );
if( this.getSlot() >= 0 && this.parent != null && this.parent.details.isCraftable() )
+2 -2
View File
@@ -19,7 +19,7 @@
package appeng.debug;
import java.util.ArrayDeque;
import java.util.LinkedList;
import java.util.Queue;
import javax.annotation.Nonnull;
@@ -40,7 +40,7 @@ import appeng.tile.AEBaseTile;
public class TileItemGen extends AEBaseTile
{
private static final Queue<ItemStack> POSSIBLE_ITEMS = new ArrayDeque<>();
private static final Queue<ItemStack> POSSIBLE_ITEMS = new LinkedList<>();
private final IItemHandler handler = new QueuedItemHandler();
+3 -3
View File
@@ -19,7 +19,7 @@
package appeng.debug;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.block.state.IBlockState;
@@ -50,14 +50,14 @@ public class ToolEraser extends AEBaseItem
final IBlockState state = world.getBlockState( pos );
List<BlockPos> next = new ArrayList<>();
List<BlockPos> next = new LinkedList<>();
next.add( pos );
int blocks = 0;
while( blocks < BLOCK_ERASE_LIMIT && !next.isEmpty() )
{
final List<BlockPos> c = next;
next = new ArrayList<>();
next = new LinkedList<>();
for( final BlockPos wc : c )
{

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