Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 58e96aa3de | |||
| 4f07b63b13 | |||
| 905dd6c888 | |||
| ab7f35a9ee | |||
| 6e81f698c0 | |||
| 8ad8ce68b5 | |||
| 644194d0d6 | |||
| 95b27f490c | |||
| 6032c0328e |
+7
-6
@@ -7,9 +7,9 @@ aebasename=appliedenergistics2
|
||||
#########################################################
|
||||
# Versions #
|
||||
#########################################################
|
||||
minecraft_version=1.12.1
|
||||
mcp_mappings=snapshot_20170811
|
||||
forge_version=14.22.1.2478
|
||||
minecraft_version=1.12.2
|
||||
mcp_mappings=snapshot_20171003
|
||||
forge_version=14.23.0.2491
|
||||
|
||||
#########################################################
|
||||
# Installable #
|
||||
@@ -19,13 +19,14 @@ hwyla_version=1.8.20-B35_1.12
|
||||
#########################################################
|
||||
# Provided APIs #
|
||||
#########################################################
|
||||
jei_version=4.7.8.95
|
||||
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.+
|
||||
|
||||
#########################################################
|
||||
# Deployment #
|
||||
#########################################################
|
||||
website_version=1.12.x
|
||||
curse_versions=1.12,1.12.1
|
||||
website_version=1.12.2
|
||||
curse_versions=1.12.2
|
||||
|
||||
@@ -76,6 +76,7 @@ dependencies {
|
||||
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"
|
||||
|
||||
// at runtime, use the full JEI jar
|
||||
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
||||
|
||||
@@ -25,14 +25,13 @@ package appeng.api;
|
||||
|
||||
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.exceptions.FailedConnection;
|
||||
import appeng.api.features.IRegistryContainer;
|
||||
import appeng.api.networking.IGridBlock;
|
||||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.IGridHelper;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.parts.IPartHelper;
|
||||
import appeng.api.storage.IStorageHelper;
|
||||
|
||||
|
||||
@AEInjectable
|
||||
public interface IAppEngApi
|
||||
{
|
||||
@@ -42,36 +41,23 @@ public interface IAppEngApi
|
||||
IRegistryContainer registries();
|
||||
|
||||
/**
|
||||
* @return helper for working with storage data types.
|
||||
* @return A helper for working with storage data types.
|
||||
*/
|
||||
IStorageHelper storage();
|
||||
|
||||
/**
|
||||
* @return helper for working with grids, and buses.
|
||||
* @return A helper to create {@link IGridNode} and other grid related objects.
|
||||
*/
|
||||
IGridHelper grid();
|
||||
|
||||
/**
|
||||
* @return A helper for working with grids, and buses.
|
||||
*/
|
||||
IPartHelper partHelper();
|
||||
|
||||
/**
|
||||
* @return an accessible list of all AE definitions
|
||||
* @return An accessible list of all AE definitions
|
||||
*/
|
||||
IDefinitions definitions();
|
||||
|
||||
/**
|
||||
* create a grid node for your {@link appeng.api.networking.IGridHost}
|
||||
*
|
||||
* @param block grid block
|
||||
*
|
||||
* @return grid node of block
|
||||
*/
|
||||
IGridNode createGridNode( IGridBlock block );
|
||||
|
||||
/**
|
||||
* create a connection between two {@link appeng.api.networking.IGridNode}
|
||||
*
|
||||
* @param a to be connected gridnode
|
||||
* @param b to be connected gridnode
|
||||
*
|
||||
* @throws appeng.api.exceptions.FailedConnection
|
||||
*/
|
||||
IGridConnection createGridConnection( IGridNode a, IGridNode b ) throws FailedConnection;
|
||||
}
|
||||
@@ -1,64 +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.client;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
/**
|
||||
* TODO: Needs to be moved to an internal class. API is only allowed to contain interfaces and/or data.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public class BakingPipeline<F, T> implements BakingPipelineElement<F, T>
|
||||
{
|
||||
|
||||
private final ImmutableList<BakingPipelineElement<?, ?>> pipeline;
|
||||
|
||||
public BakingPipeline( BakingPipelineElement<?, ?>... pipeline )
|
||||
{
|
||||
this.pipeline = ImmutableList.copyOf( pipeline );
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: fix generics
|
||||
*/
|
||||
@Override
|
||||
public List pipe( List things, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
|
||||
{
|
||||
for( BakingPipelineElement pipe : this.pipeline )
|
||||
{
|
||||
things = pipe.pipe( things, parent, state, side, rand );
|
||||
}
|
||||
return things;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +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.client;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
|
||||
public interface BakingPipelineElement<F, T>
|
||||
{
|
||||
|
||||
public List<T> pipe( List<F> elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand );
|
||||
|
||||
}
|
||||
@@ -26,5 +26,5 @@ package appeng.api.config;
|
||||
|
||||
public enum SearchBoxMode
|
||||
{
|
||||
AUTOSEARCH, MANUAL_SEARCH, JEI_AUTOSEARCH, JEI_MANUAL_SEARCH
|
||||
AUTOSEARCH, AUTOSEARCH_KEEP, MANUAL_SEARCH, MANUAL_SEARCH_KEEP, JEI_AUTOSEARCH, JEI_AUTOSEARCH_KEEP, JEI_MANUAL_SEARCH, JEI_MANUAL_SEARCH_KEEP
|
||||
}
|
||||
|
||||
@@ -33,29 +33,53 @@ public enum Settings
|
||||
{
|
||||
LEVEL_EMITTER_MODE( EnumSet.allOf( LevelEmitterMode.class ) ),
|
||||
|
||||
REDSTONE_EMITTER( EnumSet.of( RedstoneMode.HIGH_SIGNAL, RedstoneMode.LOW_SIGNAL ) ), REDSTONE_CONTROLLED( EnumSet.allOf( RedstoneMode.class ) ),
|
||||
REDSTONE_EMITTER( EnumSet.of( RedstoneMode.HIGH_SIGNAL, RedstoneMode.LOW_SIGNAL ) ),
|
||||
|
||||
REDSTONE_CONTROLLED( EnumSet.allOf( RedstoneMode.class ) ),
|
||||
|
||||
CONDENSER_OUTPUT( EnumSet.allOf( CondenserOutput.class ) ),
|
||||
|
||||
POWER_UNITS( EnumSet.allOf( PowerUnits.class ) ), ACCESS( EnumSet.of( AccessRestriction.READ_WRITE, AccessRestriction.READ, AccessRestriction.WRITE ) ),
|
||||
POWER_UNITS( EnumSet.allOf( PowerUnits.class ) ),
|
||||
|
||||
SORT_DIRECTION( EnumSet.allOf( SortDir.class ) ), SORT_BY( EnumSet.allOf( SortOrder.class ) ),
|
||||
ACCESS( EnumSet.of( AccessRestriction.READ_WRITE, AccessRestriction.READ, AccessRestriction.WRITE ) ),
|
||||
|
||||
SEARCH_TOOLTIPS( EnumSet.of( YesNo.YES, YesNo.NO ) ), VIEW_MODE( EnumSet.allOf( ViewItems.class ) ), SEARCH_MODE( EnumSet.allOf( SearchBoxMode.class ) ),
|
||||
SORT_DIRECTION( EnumSet.allOf( SortDir.class ) ),
|
||||
|
||||
ACTIONS( EnumSet.allOf( ActionItems.class ) ), IO_DIRECTION( EnumSet.of( RelativeDirection.LEFT, RelativeDirection.RIGHT ) ),
|
||||
SORT_BY( EnumSet.allOf( SortOrder.class ) ),
|
||||
|
||||
BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ), OPERATION_MODE( EnumSet.allOf( OperationMode.class ) ),
|
||||
SEARCH_TOOLTIPS( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||
|
||||
FULLNESS_MODE( EnumSet.allOf( FullnessMode.class ) ), CRAFT_ONLY( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||
VIEW_MODE( EnumSet.allOf( ViewItems.class ) ),
|
||||
|
||||
FUZZY_MODE( EnumSet.allOf( FuzzyMode.class ) ), LEVEL_TYPE( EnumSet.allOf( LevelType.class ) ),
|
||||
SEARCH_MODE( EnumSet.allOf( SearchBoxMode.class ) ),
|
||||
|
||||
TERMINAL_STYLE( EnumSet.of( TerminalStyle.TALL, TerminalStyle.SMALL ) ), COPY_MODE( EnumSet.allOf( CopyMode.class ) ),
|
||||
ACTIONS( EnumSet.allOf( ActionItems.class ) ),
|
||||
|
||||
INTERFACE_TERMINAL( EnumSet.of( YesNo.YES, YesNo.NO ) ), CRAFT_VIA_REDSTONE( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||
IO_DIRECTION( EnumSet.of( RelativeDirection.LEFT, RelativeDirection.RIGHT ) ),
|
||||
|
||||
STORAGE_FILTER( EnumSet.allOf( StorageFilter.class ) ), PLACE_BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||
BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||
|
||||
OPERATION_MODE( EnumSet.allOf( OperationMode.class ) ),
|
||||
|
||||
FULLNESS_MODE( EnumSet.allOf( FullnessMode.class ) ),
|
||||
|
||||
CRAFT_ONLY( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||
|
||||
FUZZY_MODE( EnumSet.allOf( FuzzyMode.class ) ),
|
||||
|
||||
LEVEL_TYPE( EnumSet.allOf( LevelType.class ) ),
|
||||
|
||||
TERMINAL_STYLE( EnumSet.of( TerminalStyle.TALL, TerminalStyle.SMALL ) ),
|
||||
|
||||
COPY_MODE( EnumSet.allOf( CopyMode.class ) ),
|
||||
|
||||
INTERFACE_TERMINAL( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||
|
||||
CRAFT_VIA_REDSTONE( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||
|
||||
STORAGE_FILTER( EnumSet.allOf( StorageFilter.class ) ),
|
||||
|
||||
PLACE_BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||
|
||||
SCHEDULING_MODE( EnumSet.allOf( SchedulingMode.class ) );
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ package appeng.api.exceptions;
|
||||
|
||||
public class CoreInaccessibleException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = -7434641554655517242L;
|
||||
|
||||
public CoreInaccessibleException( final String message )
|
||||
{
|
||||
super( message );
|
||||
|
||||
@@ -37,7 +37,7 @@ import appeng.api.networking.IGridNode;
|
||||
* @version rv3
|
||||
* @since rv3
|
||||
*/
|
||||
public class ExistingConnectionException extends FailedConnection
|
||||
public class ExistingConnectionException extends FailedConnectionException
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 2975450379720353182L;
|
||||
|
||||
+3
-3
@@ -40,16 +40,16 @@ import appeng.api.networking.IGridNode;
|
||||
* @version rv3
|
||||
* @since rv0
|
||||
*/
|
||||
public class FailedConnection extends Exception
|
||||
public class FailedConnectionException extends Exception
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = -2544208090248293753L;
|
||||
|
||||
public FailedConnection()
|
||||
public FailedConnectionException()
|
||||
{
|
||||
}
|
||||
|
||||
public FailedConnection( String message )
|
||||
public FailedConnectionException( String message )
|
||||
{
|
||||
super( message );
|
||||
}
|
||||
+4
-2
@@ -19,9 +19,11 @@
|
||||
package appeng.api.exceptions;
|
||||
|
||||
|
||||
public class MissingDefinition extends RuntimeException
|
||||
public class MissingDefinitionException extends RuntimeException
|
||||
{
|
||||
public MissingDefinition( final String message )
|
||||
private static final long serialVersionUID = -6547396584255825761L;
|
||||
|
||||
public MissingDefinitionException( final String message )
|
||||
{
|
||||
super( message );
|
||||
}
|
||||
+2
-2
@@ -24,12 +24,12 @@
|
||||
package appeng.api.exceptions;
|
||||
|
||||
|
||||
public class MissingIngredientError extends Exception
|
||||
public class MissingIngredientException extends Exception
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = -998858343831371697L;
|
||||
|
||||
public MissingIngredientError( final String n )
|
||||
public MissingIngredientException( final String n )
|
||||
{
|
||||
super( n );
|
||||
}
|
||||
+2
-2
@@ -24,12 +24,12 @@
|
||||
package appeng.api.exceptions;
|
||||
|
||||
|
||||
public class ModNotInstalled extends Exception
|
||||
public class ModNotInstalledException extends Exception
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = -9052435206368425494L;
|
||||
|
||||
public ModNotInstalled( final String t )
|
||||
public ModNotInstalledException( final String t )
|
||||
{
|
||||
super( t );
|
||||
}
|
||||
@@ -34,7 +34,7 @@ package appeng.api.exceptions;
|
||||
* @version rv3
|
||||
* @since rv3
|
||||
*/
|
||||
public class NullNodeConnectionException extends FailedConnection
|
||||
public class NullNodeConnectionException extends FailedConnectionException
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = -2143719383495321764L;
|
||||
|
||||
+2
-2
@@ -24,12 +24,12 @@
|
||||
package appeng.api.exceptions;
|
||||
|
||||
|
||||
public class RecipeError extends Exception
|
||||
public class RecipeException extends Exception
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = -6602870588617670262L;
|
||||
|
||||
public RecipeError( final String n )
|
||||
public RecipeException( final String n )
|
||||
{
|
||||
super( n );
|
||||
}
|
||||
+2
-2
@@ -24,12 +24,12 @@
|
||||
package appeng.api.exceptions;
|
||||
|
||||
|
||||
public class RegistrationError extends Exception
|
||||
public class RegistrationException extends Exception
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = -6602870588617670263L;
|
||||
|
||||
public RegistrationError( final String n )
|
||||
public RegistrationException( final String n )
|
||||
{
|
||||
super( n );
|
||||
}
|
||||
@@ -34,7 +34,7 @@ package appeng.api.exceptions;
|
||||
* @version rv3
|
||||
* @since rv3
|
||||
*/
|
||||
public class SecurityConnectionException extends FailedConnection
|
||||
public class SecurityConnectionException extends FailedConnectionException
|
||||
{
|
||||
private static final long serialVersionUID = 5048714900434215426L;
|
||||
private static final String DEFAULT_MESSAGE = "Connection failed due to different security realms.";
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 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.features;
|
||||
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
|
||||
|
||||
/**
|
||||
* A registry to allow mapping {@link Item}s to a specific charge rate when being placed inside a charger.
|
||||
*
|
||||
* The registry is used in favor of an additional method for {@link IAEItemPowerStorage} with a fixed value per item.
|
||||
* This allows more flexibility for other charger like machines to choose their own values when needed.
|
||||
*
|
||||
* There is no guarantee that this is charged per tick, it only represents the value per operation.
|
||||
* By default this is one charging operation every 10 ticks in case of an AE2 charger.
|
||||
*
|
||||
* @author yueh
|
||||
* @version rv5
|
||||
* @since rv5
|
||||
*/
|
||||
public interface IChargerRegistry
|
||||
{
|
||||
|
||||
/**
|
||||
* Fetch a charge rate for a specific item.
|
||||
*
|
||||
* The specific item does not need to have a mapping registered at all.
|
||||
* In this case it will use a default value of 160 AE.
|
||||
*
|
||||
* @param item A {@link Item} implementing {@link IAEItemPowerStorage}.
|
||||
* @return custom rate or default of 160
|
||||
*/
|
||||
@Nonnegative
|
||||
double getChargeRate( @Nonnull Item item );
|
||||
|
||||
/**
|
||||
* Register a custom charge rate for a specific item.
|
||||
*
|
||||
* Capped at 16000 to avoid extracting too much energy from a network for each operation.
|
||||
* This is done silently without any feedback or exception.
|
||||
* Further the cap is not fixed, it can change at any time in the future should power issues arise.
|
||||
*
|
||||
* @param item A {@link Item} implementing {@link IAEItemPowerStorage}.
|
||||
* @param chargeRate the custom rate, must be > 0, capped to 16000d
|
||||
*/
|
||||
void addChargeRate( @Nonnull Item item, @Nonnegative double chargeRate );
|
||||
|
||||
/**
|
||||
* Remove the custom rate for a specific item.
|
||||
*
|
||||
* It will revert to the default value afterwards.
|
||||
*
|
||||
* @param item A {@link Item} implementing {@link IAEItemPowerStorage}.
|
||||
*/
|
||||
void removeChargeRate( @Nonnull Item item );
|
||||
|
||||
}
|
||||
@@ -34,7 +34,8 @@ import appeng.api.storage.ICellRegistry;
|
||||
/**
|
||||
* @author AlgorithmX2
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @author yueh
|
||||
* @version rv5
|
||||
* @since rv0
|
||||
*/
|
||||
@AEInjectable
|
||||
@@ -76,6 +77,11 @@ public interface IRegistryContainer
|
||||
*/
|
||||
IInscriberRegistry inscriber();
|
||||
|
||||
/**
|
||||
* Manage charger via API
|
||||
*/
|
||||
IChargerRegistry charger();
|
||||
|
||||
/**
|
||||
* get access to the locatable registry
|
||||
*/
|
||||
|
||||
+32
-32
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013 AlgorithmX2
|
||||
* Copyright (c) 2017 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
|
||||
@@ -21,44 +21,44 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package appeng.api.storage;
|
||||
package appeng.api.networking;
|
||||
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.exceptions.FailedConnectionException;
|
||||
|
||||
|
||||
public enum StorageChannel
|
||||
/**
|
||||
* A helper responsible for creating new {@link IGridNode}, {@link IGridConnection} or potentially similar tasks.
|
||||
*
|
||||
* @author yueh
|
||||
* @version rv5
|
||||
* @since rv5
|
||||
*/
|
||||
public interface IGridHelper
|
||||
{
|
||||
/**
|
||||
* AE2's Default Storage.
|
||||
*/
|
||||
ITEMS( IAEItemStack.class ),
|
||||
|
||||
/**
|
||||
* AE2's Fluid Based Storage ( mainly added to better support ExtraCells )
|
||||
* 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.
|
||||
*
|
||||
* @param block grid block
|
||||
*
|
||||
* @return grid node of block
|
||||
*/
|
||||
FLUIDS( IAEFluidStack.class );
|
||||
IGridNode createGridNode( IGridBlock block );
|
||||
|
||||
public final Class<? extends IAEStack> type;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
IGridConnection createGridConnection( IGridNode a, IGridNode b ) throws FailedConnectionException;
|
||||
|
||||
StorageChannel( final Class<? extends IAEStack> t )
|
||||
{
|
||||
this.type = t;
|
||||
}
|
||||
|
||||
public IItemList createList()
|
||||
{
|
||||
if( this == ITEMS )
|
||||
{
|
||||
return AEApi.instance().storage().createItemList();
|
||||
}
|
||||
else
|
||||
{
|
||||
return AEApi.instance().storage().createFluidList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ package appeng.api.networking.events;
|
||||
|
||||
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
|
||||
|
||||
/**
|
||||
@@ -40,9 +40,9 @@ public class MENetworkStorageEvent extends MENetworkEvent
|
||||
{
|
||||
|
||||
public final IMEMonitor monitor;
|
||||
public final StorageChannel channel;
|
||||
public final IStorageChannel channel;
|
||||
|
||||
public MENetworkStorageEvent( final IMEMonitor o, final StorageChannel chan )
|
||||
public MENetworkStorageEvent( final IMEMonitor o, final IStorageChannel chan )
|
||||
{
|
||||
this.monitor = o;
|
||||
this.channel = chan;
|
||||
|
||||
@@ -28,7 +28,7 @@ import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
public interface IBaseMonitor<T extends IAEStack>
|
||||
public interface IBaseMonitor<T extends IAEStack<T>>
|
||||
{
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@ package appeng.api.networking.storage;
|
||||
|
||||
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
|
||||
@@ -50,5 +50,5 @@ public interface IStackWatcherHost
|
||||
* @param src action source
|
||||
* @param chan storage channel
|
||||
*/
|
||||
void onStackChange( IItemList o, IAEStack fullStack, IAEStack diffStack, IActionSource src, StorageChannel chan );
|
||||
void onStackChange( IItemList<?> o, IAEStack<?> fullStack, IAEStack<?> diffStack, IActionSource src, IStorageChannel<?> chan );
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.ICellContainer;
|
||||
import appeng.api.storage.ICellProvider;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public interface IStorageGrid extends IGridCache, IStorageMonitorable
|
||||
*
|
||||
* @param input injected items
|
||||
*/
|
||||
void postAlterationOfStoredItems( StorageChannel chan, Iterable<? extends IAEStack> input, IActionSource src );
|
||||
void postAlterationOfStoredItems( IStorageChannel<?> chan, Iterable<? extends IAEStack<?>> input, IActionSource src );
|
||||
|
||||
/**
|
||||
* Used to add a cell provider to the storage system
|
||||
|
||||
@@ -26,9 +26,9 @@ package appeng.api.recipes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.exceptions.MissingIngredientError;
|
||||
import appeng.api.exceptions.RecipeError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.exceptions.MissingIngredientException;
|
||||
import appeng.api.exceptions.RecipeException;
|
||||
import appeng.api.exceptions.RegistrationException;
|
||||
|
||||
|
||||
public interface ICraftHandler
|
||||
@@ -40,15 +40,15 @@ public interface ICraftHandler
|
||||
* @param input parsed inputs
|
||||
* @param output parsed outputs
|
||||
*
|
||||
* @throws RecipeError
|
||||
* @throws RecipeException
|
||||
*/
|
||||
void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError;
|
||||
void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeException;
|
||||
|
||||
/**
|
||||
* called when all recipes are parsed, and your required to register your recipe.
|
||||
*
|
||||
* @throws RegistrationError
|
||||
* @throws MissingIngredientError
|
||||
* @throws RegistrationException
|
||||
* @throws MissingIngredientException
|
||||
*/
|
||||
void register() throws RegistrationError, MissingIngredientError;
|
||||
void register() throws RegistrationException, MissingIngredientException;
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ package appeng.api.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.exceptions.MissingIngredientError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.exceptions.MissingIngredientException;
|
||||
import appeng.api.exceptions.RegistrationException;
|
||||
|
||||
|
||||
public interface IIngredient
|
||||
@@ -39,10 +39,10 @@ public interface IIngredient
|
||||
*
|
||||
* @return a single ItemStack for the recipe handler.
|
||||
*
|
||||
* @throws RegistrationError
|
||||
* @throws MissingIngredientError
|
||||
* @throws RegistrationException
|
||||
* @throws MissingIngredientException
|
||||
*/
|
||||
ItemStack getItemStack() throws RegistrationError, MissingIngredientError;
|
||||
ItemStack getItemStack() throws RegistrationException, MissingIngredientException;
|
||||
|
||||
/**
|
||||
* Acquire a list of all the input stacks for the current recipe, this is for handlers that support
|
||||
@@ -50,10 +50,10 @@ public interface IIngredient
|
||||
*
|
||||
* @return an array of ItemStacks for the recipe handler.
|
||||
*
|
||||
* @throws RegistrationError
|
||||
* @throws MissingIngredientError
|
||||
* @throws RegistrationException
|
||||
* @throws MissingIngredientException
|
||||
*/
|
||||
ItemStack[] getItemStackSet() throws RegistrationError, MissingIngredientError;
|
||||
ItemStack[] getItemStackSet() throws RegistrationException, MissingIngredientException;
|
||||
|
||||
/**
|
||||
* If you wish to support air, you must test before getting the ItemStack, or ItemStackSet
|
||||
@@ -85,8 +85,8 @@ public interface IIngredient
|
||||
/**
|
||||
* Bakes the lists in for faster runtime look-ups.
|
||||
*
|
||||
* @throws MissingIngredientError
|
||||
* @throws RegistrationError
|
||||
* @throws MissingIngredientException
|
||||
* @throws RegistrationException
|
||||
*/
|
||||
void bake() throws RegistrationError, MissingIngredientError;
|
||||
void bake() throws RegistrationException, MissingIngredientException;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
/**
|
||||
@@ -56,7 +57,7 @@ public interface ICellHandler
|
||||
*
|
||||
* @return a new IMEHandler for the provided item
|
||||
*/
|
||||
IMEInventoryHandler getCellInventory( ItemStack is, ISaveProvider host, StorageChannel channel );
|
||||
<T extends IAEStack<T>> IMEInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> channel );
|
||||
|
||||
/**
|
||||
* Called when the storage cell is planed in an ME Chest and the user tries to open the terminal side, if your item
|
||||
@@ -70,7 +71,7 @@ public interface ICellHandler
|
||||
* @param is item
|
||||
* @param chan storage channel
|
||||
*/
|
||||
void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan );
|
||||
<T extends IAEStack<T>> void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler<T> inv, ItemStack is, IStorageChannel<T> chan );
|
||||
|
||||
/**
|
||||
* 0 - cell is missing.
|
||||
@@ -86,10 +87,10 @@ public interface ICellHandler
|
||||
*
|
||||
* @return get the status of the cell based on its contents.
|
||||
*/
|
||||
int getStatusForCell( ItemStack is, IMEInventory handler );
|
||||
<T extends IAEStack<T>> int getStatusForCell( ItemStack is, IMEInventory<T> handler );
|
||||
|
||||
/**
|
||||
* @return the ae/t to drain for this storage cell inside a chest/drive.
|
||||
*/
|
||||
double cellIdleDrain( ItemStack is, IMEInventory handler );
|
||||
<T extends IAEStack<T>> double cellIdleDrain( ItemStack is, IMEInventory<T> handler );
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public interface ICellProvider
|
||||
*
|
||||
* @return a valid list of handlers, NEVER NULL
|
||||
*/
|
||||
List<IMEInventoryHandler> getCellArray( StorageChannel channel );
|
||||
List<IMEInventoryHandler> getCellArray( IStorageChannel<?> channel );
|
||||
|
||||
/**
|
||||
* the storage's priority.
|
||||
|
||||
@@ -27,6 +27,7 @@ package appeng.api.storage;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
/**
|
||||
@@ -73,5 +74,5 @@ public interface ICellRegistry
|
||||
*
|
||||
* @return new IMEInventoryHandler, or null if there isn't one.
|
||||
*/
|
||||
IMEInventoryHandler getCellInventory( ItemStack is, ISaveProvider host, StorageChannel chan );
|
||||
<T extends IAEStack<T>> IMEInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> chan );
|
||||
}
|
||||
@@ -40,7 +40,7 @@ import appeng.api.storage.data.IItemList;
|
||||
* If you want to request a stack of an item, you should should determine that prior to requesting the stack from the
|
||||
* inventory.
|
||||
*/
|
||||
public interface IMEInventory<StackType extends IAEStack>
|
||||
public interface IMEInventory<T extends IAEStack<T>>
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ public interface IMEInventory<StackType extends IAEStack>
|
||||
*
|
||||
* @return returns the number of items not added.
|
||||
*/
|
||||
StackType injectItems( StackType input, Actionable type, IActionSource src );
|
||||
T injectItems( T input, Actionable type, IActionSource src );
|
||||
|
||||
/**
|
||||
* Extract the specified item from the ME Inventory
|
||||
@@ -62,7 +62,7 @@ public interface IMEInventory<StackType extends IAEStack>
|
||||
*
|
||||
* @return returns the number of items extracted, null
|
||||
*/
|
||||
StackType extractItems( StackType request, Actionable mode, IActionSource src );
|
||||
T extractItems( T request, Actionable mode, IActionSource src );
|
||||
|
||||
/**
|
||||
* request a full report of all available items, storage.
|
||||
@@ -71,10 +71,10 @@ public interface IMEInventory<StackType extends IAEStack>
|
||||
*
|
||||
* @return returns same list that was passed in, is passed out
|
||||
*/
|
||||
IItemList<StackType> getAvailableItems( IItemList<StackType> out );
|
||||
IItemList<T> getAvailableItems( IItemList<T> out );
|
||||
|
||||
/**
|
||||
* @return the type of channel your handler should be part of
|
||||
*/
|
||||
StorageChannel getChannel();
|
||||
IStorageChannel<T> getChannel();
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@ import appeng.api.storage.data.IAEStack;
|
||||
* Thin logic layer that can be swapped with different IMEInventory implementations, used to handle features related to
|
||||
* storage, that are Separate from the storage medium itself.
|
||||
*
|
||||
* @param <StackType>
|
||||
* @param <T>
|
||||
*/
|
||||
public interface IMEInventoryHandler<StackType extends IAEStack> extends IMEInventory<StackType>
|
||||
public interface IMEInventoryHandler<T extends IAEStack<T>> extends IMEInventory<T>
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ public interface IMEInventoryHandler<StackType extends IAEStack> extends IMEInve
|
||||
*
|
||||
* @return if its prioritized
|
||||
*/
|
||||
boolean isPrioritized( StackType input );
|
||||
boolean isPrioritized( T input );
|
||||
|
||||
/**
|
||||
* determine if an item can be accepted and stored.
|
||||
@@ -61,7 +61,7 @@ public interface IMEInventoryHandler<StackType extends IAEStack> extends IMEInve
|
||||
*
|
||||
* @return if the item can be added
|
||||
*/
|
||||
boolean canAccept( StackType input );
|
||||
boolean canAccept( T input );
|
||||
|
||||
/**
|
||||
* determine what the priority of the inventory is.
|
||||
|
||||
@@ -29,7 +29,7 @@ import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
|
||||
|
||||
public interface IMEMonitor<T extends IAEStack> extends IMEInventoryHandler<T>, IBaseMonitor<T>
|
||||
public interface IMEMonitor<T extends IAEStack<T>> extends IMEInventoryHandler<T>, IBaseMonitor<T>
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -37,7 +37,7 @@ public interface IMEMonitor<T extends IAEStack> extends IMEInventoryHandler<T>,
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
IItemList<T> getAvailableItems( IItemList out );
|
||||
IItemList<T> getAvailableItems( IItemList<T> out );
|
||||
|
||||
/**
|
||||
* Get access to the full item list of the network, preferred over {@link IMEInventory} .getAvailableItems(...)
|
||||
|
||||
@@ -29,7 +29,7 @@ import appeng.api.networking.storage.IBaseMonitor;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
public interface IMEMonitorHandlerReceiver<StackType extends IAEStack>
|
||||
public interface IMEMonitorHandlerReceiver<T extends IAEStack<T>>
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ public interface IMEMonitorHandlerReceiver<StackType extends IAEStack>
|
||||
*
|
||||
* @param change done change
|
||||
*/
|
||||
void postChange( IBaseMonitor<StackType> monitor, Iterable<StackType> change, IActionSource actionSource );
|
||||
void postChange( IBaseMonitor<T> monitor, Iterable<T> change, IActionSource actionSource );
|
||||
|
||||
/**
|
||||
* called when the list updates its contents, this is mostly for handling power events.
|
||||
|
||||
@@ -27,5 +27,5 @@ package appeng.api.storage;
|
||||
public interface ISaveProvider
|
||||
{
|
||||
|
||||
void saveChanges( IMEInventory cellInventory );
|
||||
void saveChanges( IMEInventory<?> cellInventory );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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.storage;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
|
||||
|
||||
public interface IStorageChannel<T extends IAEStack<T>>
|
||||
{
|
||||
|
||||
/**
|
||||
* Create a new {@link IItemList} of the specific type.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Nonnull
|
||||
IItemList<T> createList();
|
||||
|
||||
/**
|
||||
* Create a new {@link IAEStack} subtype of the specific object.
|
||||
*
|
||||
* The parameter is unbound to allow a slightly more flexible approach.
|
||||
* But the general intention is about converting an {@link ItemStack} into the corresponding {@link IAEItemStack}.
|
||||
* Another valid case might be to use it instead of {@link IAEStack#copy()}, but this might not be supported by all
|
||||
* types.
|
||||
*
|
||||
* @param input The object to turn into an {@link IAEStack}
|
||||
* @return The converted stack or null
|
||||
*/
|
||||
@Nullable
|
||||
T createStack( @Nonnull Object input );
|
||||
|
||||
/**
|
||||
*
|
||||
* @param input
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@Nullable
|
||||
T readFromPacket( @Nonnull ByteBuf input ) throws IOException;
|
||||
|
||||
/**
|
||||
* use energy from energy, to remove request items from cell, at the request of src.
|
||||
*
|
||||
* @param energy to be drained energy source
|
||||
* @param cell cell of requested items
|
||||
* @param request requested items
|
||||
* @param src action source
|
||||
*
|
||||
* @return items that successfully extracted.
|
||||
*/
|
||||
@Nullable
|
||||
T poweredExtraction( @Nonnull IEnergySource energy, @Nonnull IMEInventory<T> cell, @Nonnull T request, @Nonnull IActionSource src );
|
||||
|
||||
/**
|
||||
* use energy from energy, to inject input items into cell, at the request of src
|
||||
*
|
||||
* @param energy to be added energy source
|
||||
* @param cell injected cell
|
||||
* @param input to be injected items
|
||||
* @param src action source
|
||||
*
|
||||
* @return items that failed to insert.
|
||||
*/
|
||||
@Nullable
|
||||
T poweredInsert( @Nonnull IEnergySource energy, @Nonnull IMEInventory<T> cell, @Nonnull T input, @Nonnull IActionSource src );
|
||||
|
||||
}
|
||||
@@ -24,26 +24,63 @@
|
||||
package appeng.api.storage;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.crafting.ICraftingRequester;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
public interface IStorageHelper
|
||||
{
|
||||
|
||||
/**
|
||||
* Register a new storage channel.
|
||||
*
|
||||
* AE2 already provides native channels for {@link IAEItemStack} and {@link IAEFluidStack}.
|
||||
*
|
||||
* Each {@link IAEStack} subtype can only have a single factory instance. Overwriting is not intended.
|
||||
* Each subtype should be a direct one, this might be enforced at any time.
|
||||
*
|
||||
* Channel class and factory instance can be used interchangeable as identifier. In most cases the factory instance
|
||||
* is used as key as having direct access the methods is more beneficial compared to being forced to query the
|
||||
* registry each time.
|
||||
*
|
||||
* Caching the factory instance in a field or local variable is perfectly for performance reasons. But do not use
|
||||
* any AE2 internal field as they can change randomly between releases.
|
||||
*
|
||||
* @param channel The channel type, must be a subtype of {@link IStorageChannel}
|
||||
* @param factory An instance implementing the channel, must be be an instance of channel
|
||||
*/
|
||||
@Nonnull
|
||||
<T extends IAEStack<T>, C extends IStorageChannel<T>> void registerStorageChannel( @Nonnull Class<C> channel, @Nonnull C factory );
|
||||
|
||||
/**
|
||||
* Fetch the factory instance for a specific storage channel.
|
||||
*
|
||||
* Channel must be a direct subtype of {@link IStorageChannel}.
|
||||
*
|
||||
* @throws NullPointerException when fetching an unregistered channel.
|
||||
* @param channel The channel type
|
||||
* @return the factory instance
|
||||
*/
|
||||
@Nonnull
|
||||
<T extends IAEStack<T>, C extends IStorageChannel<T>> C getStorageChannel( @Nonnull Class<C> channel );
|
||||
|
||||
/**
|
||||
* An unmodifiable collection of all registered factory instance.
|
||||
*
|
||||
* This is mainly used as helper to let storage grids construct their internal storage for each type.
|
||||
*/
|
||||
@Nonnull
|
||||
Collection<IStorageChannel<? extends IAEStack<?>>> storageChannels();
|
||||
|
||||
/**
|
||||
* load a crafting link from nbt data.
|
||||
*
|
||||
@@ -53,73 +90,4 @@ public interface IStorageHelper
|
||||
*/
|
||||
ICraftingLink loadCraftingLink( NBTTagCompound data, ICraftingRequester req );
|
||||
|
||||
/**
|
||||
* @param is An ItemStack
|
||||
*
|
||||
* @return a new INSTANCE of {@link IAEItemStack} from a MC {@link ItemStack}
|
||||
*/
|
||||
IAEItemStack createItemStack( ItemStack is );
|
||||
|
||||
/**
|
||||
* @param is A FluidStack
|
||||
*
|
||||
* @return a new INSTANCE of {@link IAEFluidStack} from a Forge {@link FluidStack}
|
||||
*/
|
||||
IAEFluidStack createFluidStack( FluidStack is );
|
||||
|
||||
/**
|
||||
* @return a new INSTANCE of {@link IItemList} for items
|
||||
*/
|
||||
IItemList<IAEItemStack> createItemList();
|
||||
|
||||
/**
|
||||
* @return a new INSTANCE of {@link IItemList} for fluids
|
||||
*/
|
||||
IItemList<IAEFluidStack> createFluidList();
|
||||
|
||||
/**
|
||||
* Read a AE Item Stack from a byte stream, returns a AE item stack or null.
|
||||
*
|
||||
* @param input to be loaded data
|
||||
*
|
||||
* @return item based of data
|
||||
*
|
||||
* @throws IOException if file could not be read
|
||||
*/
|
||||
IAEItemStack readItemFromPacket( ByteBuf input ) throws IOException;
|
||||
|
||||
/**
|
||||
* Read a AE Fluid Stack from a byte stream, returns a AE fluid stack or null.
|
||||
*
|
||||
* @param input to be loaded data
|
||||
*
|
||||
* @return fluid based on data
|
||||
*
|
||||
* @throws IOException if file could not be written
|
||||
*/
|
||||
IAEFluidStack readFluidFromPacket( ByteBuf input ) throws IOException;
|
||||
|
||||
/**
|
||||
* use energy from energy, to remove request items from cell, at the request of src.
|
||||
*
|
||||
* @param energy to be drained energy source
|
||||
* @param cell cell of requested items
|
||||
* @param request requested items
|
||||
* @param src action source
|
||||
*
|
||||
* @return items that successfully extracted.
|
||||
*/
|
||||
IAEItemStack poweredExtraction( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack request, IActionSource src );
|
||||
|
||||
/**
|
||||
* use energy from energy, to inject input items into cell, at the request of src
|
||||
*
|
||||
* @param energy to be added energy source
|
||||
* @param cell injected cell
|
||||
* @param input to be injected items
|
||||
* @param src action source
|
||||
*
|
||||
* @return items that failed to insert.
|
||||
*/
|
||||
IAEItemStack poweredInsert( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack input, IActionSource src );
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
package appeng.api.storage;
|
||||
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
/**
|
||||
@@ -35,13 +34,6 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
public interface IStorageMonitorable
|
||||
{
|
||||
|
||||
/**
|
||||
* Access the item inventory for the monitorable storage.
|
||||
*/
|
||||
IMEMonitor<IAEItemStack> getItemInventory();
|
||||
<T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel );
|
||||
|
||||
/**
|
||||
* Access the fluid inventory for the monitorable storage.
|
||||
*/
|
||||
IMEMonitor<IAEFluidStack> getFluidInventory();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 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.storage.channels;
|
||||
|
||||
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
|
||||
|
||||
public interface IFluidStorageChannel extends IStorageChannel<IAEFluidStack>
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 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.storage.channels;
|
||||
|
||||
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
||||
|
||||
public interface IItemStorageChannel extends IStorageChannel<IAEItemStack>
|
||||
{
|
||||
|
||||
}
|
||||
@@ -37,7 +37,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
*
|
||||
* Don't Implement.
|
||||
*
|
||||
* Construct with Util.createFluidStack( FluidStack )
|
||||
* Construct with AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class).createStack( FluidStack )
|
||||
*/
|
||||
public interface IAEFluidStack extends IAEStack<IAEFluidStack>
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ import net.minecraft.item.ItemStack;
|
||||
*
|
||||
* Don't Implement.
|
||||
*
|
||||
* Construct with Util.createItemStack( ItemStack )
|
||||
* Construct with AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class).createStack( ItemStack )
|
||||
*/
|
||||
public interface IAEItemStack extends IAEStack<IAEItemStack>
|
||||
{
|
||||
|
||||
@@ -32,10 +32,10 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
|
||||
|
||||
public interface IAEStack<StackType extends IAEStack<StackType>>
|
||||
public interface IAEStack<T extends IAEStack<T>>
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -43,7 +43,7 @@ public interface IAEStack<StackType extends IAEStack<StackType>>
|
||||
*
|
||||
* @param is added item
|
||||
*/
|
||||
void add( StackType is );
|
||||
void add( T is );
|
||||
|
||||
/**
|
||||
* number of items in the stack.
|
||||
@@ -57,7 +57,7 @@ public interface IAEStack<StackType extends IAEStack<StackType>>
|
||||
*
|
||||
* @param stackSize , ItemStack.stackSize = N
|
||||
*/
|
||||
StackType setStackSize( long stackSize );
|
||||
T setStackSize( long stackSize );
|
||||
|
||||
/**
|
||||
* Same as getStackSize, but for requestable items. ( LP )
|
||||
@@ -71,7 +71,7 @@ public interface IAEStack<StackType extends IAEStack<StackType>>
|
||||
*
|
||||
* @return basically itemStack.stackSize = N but for setStackSize items.
|
||||
*/
|
||||
StackType setCountRequestable( long countRequestable );
|
||||
T setCountRequestable( long countRequestable );
|
||||
|
||||
/**
|
||||
* true, if the item can be crafted.
|
||||
@@ -85,12 +85,12 @@ public interface IAEStack<StackType extends IAEStack<StackType>>
|
||||
*
|
||||
* @param isCraftable can item be crafted
|
||||
*/
|
||||
StackType setCraftable( boolean isCraftable );
|
||||
T setCraftable( boolean isCraftable );
|
||||
|
||||
/**
|
||||
* clears, requestable, craftable, and stack sizes.
|
||||
*/
|
||||
StackType reset();
|
||||
T reset();
|
||||
|
||||
/**
|
||||
* returns true, if the item can be crafted, requested, or extracted.
|
||||
@@ -174,14 +174,14 @@ public interface IAEStack<StackType extends IAEStack<StackType>>
|
||||
*
|
||||
* @return a new Stack, which is copied from the original.
|
||||
*/
|
||||
StackType copy();
|
||||
T copy();
|
||||
|
||||
/**
|
||||
* create an empty stack.
|
||||
*
|
||||
* @return a new stack, which represents an empty copy of the original.
|
||||
*/
|
||||
StackType empty();
|
||||
T empty();
|
||||
|
||||
/**
|
||||
* @return true if the stack is a {@link IAEItemStack}
|
||||
@@ -196,7 +196,7 @@ public interface IAEStack<StackType extends IAEStack<StackType>>
|
||||
/**
|
||||
* @return ITEM or FLUID
|
||||
*/
|
||||
StorageChannel getChannel();
|
||||
IStorageChannel<T> getChannel();
|
||||
|
||||
/**
|
||||
* Returns itemstack for display and similar purposes. Always has a count of 1.
|
||||
|
||||
@@ -34,9 +34,8 @@ import appeng.api.config.FuzzyMode;
|
||||
*
|
||||
* Don't Implement.
|
||||
*
|
||||
* Construct with Util.createItemList()
|
||||
*/
|
||||
public interface IItemContainer<StackType extends IAEStack>
|
||||
public interface IItemContainer<T extends IAEStack<T>>
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -44,7 +43,7 @@ public interface IItemContainer<StackType extends IAEStack>
|
||||
*
|
||||
* @param option added stack
|
||||
*/
|
||||
void add( StackType option ); // adds stack as is
|
||||
void add( T option ); // adds stack as is
|
||||
|
||||
/**
|
||||
* @param i compared item
|
||||
@@ -52,14 +51,14 @@ public interface IItemContainer<StackType extends IAEStack>
|
||||
* @return a stack equivalent to the stack passed in, but with the correct stack size information, or null if its
|
||||
* not present
|
||||
*/
|
||||
StackType findPrecise( StackType i );
|
||||
T findPrecise( T i );
|
||||
|
||||
/**
|
||||
* @param input compared item
|
||||
*
|
||||
* @return a list of relevant fuzzy matched stacks
|
||||
*/
|
||||
Collection<StackType> findFuzzy( StackType input, FuzzyMode fuzzy );
|
||||
Collection<T> findFuzzy( T input, FuzzyMode fuzzy );
|
||||
|
||||
/**
|
||||
* @return true if there are no items in the list
|
||||
|
||||
@@ -26,15 +26,20 @@ package appeng.api.storage.data;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a list of items in AE.
|
||||
*
|
||||
* Don't Implement.
|
||||
*
|
||||
* Construct with Util.createItemList()
|
||||
* Construct with
|
||||
* - For items: AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class).createList()
|
||||
* - For fluids: AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class).createList()
|
||||
* - Replace with the corresponding {@link IStorageChannel} type for non native channels
|
||||
*/
|
||||
public interface IItemList<StackType extends IAEStack> extends IItemContainer<StackType>, Iterable<StackType>
|
||||
public interface IItemList<T extends IAEStack<T>> extends IItemContainer<T>, Iterable<T>
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -43,14 +48,14 @@ public interface IItemList<StackType extends IAEStack> extends IItemContainer<St
|
||||
*
|
||||
* @param option stacktype option
|
||||
*/
|
||||
void addStorage( StackType option ); // adds a stack as stored
|
||||
void addStorage( T option ); // adds a stack as stored
|
||||
|
||||
/**
|
||||
* add a stack to the list as craftable, this will merge the stack with an item already in the list if found.
|
||||
*
|
||||
* @param option stacktype option
|
||||
*/
|
||||
void addCrafting( StackType option );
|
||||
void addCrafting( T option );
|
||||
|
||||
/**
|
||||
* add a stack to the list, stack size is used to add to requestable, this will merge the stack with an item already
|
||||
@@ -58,12 +63,12 @@ public interface IItemList<StackType extends IAEStack> extends IItemContainer<St
|
||||
*
|
||||
* @param option stacktype option
|
||||
*/
|
||||
void addRequestable( StackType option ); // adds a stack as requestable
|
||||
void addRequestable( T option ); // adds a stack as requestable
|
||||
|
||||
/**
|
||||
* @return the first item in the list
|
||||
*/
|
||||
StackType getFirstItem();
|
||||
T getFirstItem();
|
||||
|
||||
/**
|
||||
* @return the number of items in the list
|
||||
@@ -74,7 +79,7 @@ public interface IItemList<StackType extends IAEStack> extends IItemContainer<St
|
||||
* allows you to iterate the list.
|
||||
*/
|
||||
@Override
|
||||
Iterator<StackType> iterator();
|
||||
Iterator<T> iterator();
|
||||
|
||||
/**
|
||||
* resets stack sizes to 0.
|
||||
|
||||
@@ -100,14 +100,12 @@ public abstract class AEBaseBlock extends Block
|
||||
return new BlockStateContainer( this, this.getAEStates() );
|
||||
}
|
||||
|
||||
@SuppressWarnings( "deprecation" )
|
||||
@Override
|
||||
public final boolean isNormalCube( IBlockState state )
|
||||
{
|
||||
return this.isFullSize() && this.isOpaque();
|
||||
}
|
||||
|
||||
@SuppressWarnings( "deprecation" )
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox( IBlockState state, IBlockAccess source, BlockPos pos )
|
||||
{
|
||||
@@ -226,7 +224,6 @@ public abstract class AEBaseBlock extends Block
|
||||
return super.getSelectedBoundingBox( state, w, pos );
|
||||
}
|
||||
|
||||
@SuppressWarnings( "deprecation" )
|
||||
@Override
|
||||
public final boolean isOpaqueCube( IBlockState state )
|
||||
{
|
||||
@@ -281,14 +278,12 @@ public abstract class AEBaseBlock extends Block
|
||||
return super.collisionRayTrace( state, w, pos, a, b );
|
||||
}
|
||||
|
||||
@SuppressWarnings( "deprecation" )
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride( IBlockState state )
|
||||
{
|
||||
return this.isInventory();
|
||||
}
|
||||
|
||||
@SuppressWarnings( "deprecation" )
|
||||
@Override
|
||||
public int getComparatorInputOverride( IBlockState state, final World worldIn, final BlockPos pos )
|
||||
{
|
||||
|
||||
@@ -67,7 +67,6 @@ public class AEBaseItemBlock extends ItemBlock
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public final void addInformation( final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
this.addCheckedInformation( itemStack, world, toolTip, advancedTooltips );
|
||||
|
||||
@@ -97,7 +97,6 @@ public class BlockController extends AEBaseTileBlock
|
||||
* controllers and the network state of this controller (offline, online, conflicted). This is used to
|
||||
* get a rudimentary connected texture feel for the controller based on how it is placed.
|
||||
*/
|
||||
@SuppressWarnings( "deprecation" )
|
||||
@Override
|
||||
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
@@ -160,7 +159,6 @@ public class BlockController extends AEBaseTileBlock
|
||||
return state.getValue( CONTROLLER_STATE ).ordinal();
|
||||
}
|
||||
|
||||
@SuppressWarnings( "deprecation" )
|
||||
@Override
|
||||
public IBlockState getStateFromMeta( final int meta )
|
||||
{
|
||||
@@ -174,7 +172,6 @@ public class BlockController extends AEBaseTileBlock
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@SuppressWarnings( "deprecation" )
|
||||
@Override
|
||||
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
|
||||
{
|
||||
|
||||
@@ -140,7 +140,6 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
private List<Slot> getInventorySlots()
|
||||
{
|
||||
return this.inventorySlots.inventorySlots;
|
||||
|
||||
@@ -120,7 +120,6 @@ public abstract class AEBaseMEGui extends AEBaseGui
|
||||
ITooltipFlag.TooltipFlags tooltipFlag = this.mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL;
|
||||
if( myStack != null )
|
||||
{
|
||||
@SuppressWarnings( "unchecked" )
|
||||
final List<String> currentToolTip = stack.getTooltip( this.mc.player, tooltipFlag );
|
||||
|
||||
if( myStack.getStackSize() > BigNumber || ( myStack.getStackSize() > 1 && stack.isItemDamaged() ) )
|
||||
|
||||
@@ -37,6 +37,7 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
@@ -62,9 +63,9 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
|
||||
private final int rows = 5;
|
||||
|
||||
private final IItemList<IAEItemStack> storage = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> missing = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> storage = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private final IItemList<IAEItemStack> pending = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private final IItemList<IAEItemStack> missing = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
|
||||
private final List<IAEItemStack> visual = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ import appeng.api.AEApi;
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEColor;
|
||||
@@ -84,9 +85,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
|
||||
private final ContainerCraftingCPU craftingCpu;
|
||||
|
||||
private IItemList<IAEItemStack> storage = AEApi.instance().storage().createItemList();
|
||||
private IItemList<IAEItemStack> active = AEApi.instance().storage().createItemList();
|
||||
private IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList();
|
||||
private IItemList<IAEItemStack> storage = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private IItemList<IAEItemStack> active = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private IItemList<IAEItemStack> pending = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
|
||||
private List<IAEItemStack> visual = new ArrayList<>();
|
||||
private GuiButton cancel;
|
||||
@@ -110,9 +111,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
|
||||
public void clearItems()
|
||||
{
|
||||
this.storage = AEApi.instance().storage().createItemList();
|
||||
this.active = AEApi.instance().storage().createItemList();
|
||||
this.pending = AEApi.instance().storage().createItemList();
|
||||
this.storage = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
this.active = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
this.pending = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
this.visual = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.gui.widgets.MEGuiTextField;
|
||||
@@ -347,7 +348,9 @@ public class GuiInterfaceTerminal extends AEBaseGui
|
||||
final ItemStack parsedItemStack = new ItemStack( outTag.getCompoundTagAt( i ) );
|
||||
if( !parsedItemStack.isEmpty() )
|
||||
{
|
||||
final String displayName = Platform.getItemDisplayName( AEApi.instance().storage().createItemStack( parsedItemStack ) ).toLowerCase();
|
||||
final String displayName = Platform
|
||||
.getItemDisplayName( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( parsedItemStack ) )
|
||||
.toLowerCase();
|
||||
if( displayName.contains( searchTerm ) )
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -292,6 +292,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
this.buttonList.add(
|
||||
this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance().getConfigManager().getSetting(
|
||||
Settings.SEARCH_MODE ) ) );
|
||||
|
||||
offset += 20;
|
||||
|
||||
if( !( this instanceof GuiMEPortableCell ) || this instanceof GuiWirelessTerm )
|
||||
@@ -315,16 +316,22 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
this.craftingStatusBtn.setHideEdge( 13 );
|
||||
}
|
||||
|
||||
final Enum setting = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
||||
this.searchField.setFocused( SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.JEI_AUTOSEARCH == setting );
|
||||
this.searchField.setCanLoseFocus( SearchBoxMode.MANUAL_SEARCH == setting || SearchBoxMode.JEI_MANUAL_SEARCH == setting );
|
||||
final Enum searchModeSetting = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
||||
|
||||
if( setting == SearchBoxMode.JEI_AUTOSEARCH || setting == SearchBoxMode.JEI_MANUAL_SEARCH )
|
||||
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( isAutoFocus );
|
||||
this.searchField.setCanLoseFocus( isManualFocus );
|
||||
|
||||
if( isJEIEnabled )
|
||||
{
|
||||
memoryText = Integrations.jei().getSearchText();
|
||||
}
|
||||
|
||||
if( memoryText != null && !memoryText.isEmpty() )
|
||||
if( isKeepFilter && memoryText != null && !memoryText.isEmpty() )
|
||||
{
|
||||
this.searchField.setText( memoryText );
|
||||
this.searchField.selectAll();
|
||||
@@ -359,6 +366,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
|
||||
craftingGridOffsetX -= 25;
|
||||
craftingGridOffsetY -= 6;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -110,6 +110,13 @@ public class GuiImgButton extends GuiButton implements ITooltip
|
||||
this.registerApp( 16 * 2 + 5, Settings.SEARCH_MODE, SearchBoxMode.JEI_AUTOSEARCH, ButtonToolTips.SearchMode, ButtonToolTips.SearchMode_JEIAuto );
|
||||
this.registerApp( 16 * 2 + 6, Settings.SEARCH_MODE, SearchBoxMode.JEI_MANUAL_SEARCH, ButtonToolTips.SearchMode,
|
||||
ButtonToolTips.SearchMode_JEIStandard );
|
||||
this.registerApp( 16 * 2 + 7, Settings.SEARCH_MODE, SearchBoxMode.AUTOSEARCH_KEEP, ButtonToolTips.SearchMode, ButtonToolTips.SearchMode_AutoKeep );
|
||||
this.registerApp( 16 * 2 + 8, Settings.SEARCH_MODE, SearchBoxMode.MANUAL_SEARCH_KEEP, ButtonToolTips.SearchMode,
|
||||
ButtonToolTips.SearchMode_StandardKeep );
|
||||
this.registerApp( 16 * 2 + 9, Settings.SEARCH_MODE, SearchBoxMode.JEI_AUTOSEARCH_KEEP, ButtonToolTips.SearchMode,
|
||||
ButtonToolTips.SearchMode_JEIAutoKeep );
|
||||
this.registerApp( 16 * 2 + 10, Settings.SEARCH_MODE, SearchBoxMode.JEI_MANUAL_SEARCH_KEEP, ButtonToolTips.SearchMode,
|
||||
ButtonToolTips.SearchMode_JEIStandardKeep );
|
||||
|
||||
this.registerApp( 16 * 5 + 3, Settings.LEVEL_TYPE, LevelType.ENERGY_LEVEL, ButtonToolTips.LevelType, ButtonToolTips.LevelType_Energy );
|
||||
this.registerApp( 16 * 4 + 3, Settings.LEVEL_TYPE, LevelType.ITEM_LEVEL, ButtonToolTips.LevelType, ButtonToolTips.LevelType_Item );
|
||||
|
||||
@@ -33,6 +33,7 @@ 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.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.widgets.IScrollSource;
|
||||
@@ -48,7 +49,7 @@ import appeng.util.prioritylist.IPartitionList;
|
||||
public class ItemRepo
|
||||
{
|
||||
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private final ArrayList<IAEItemStack> view = new ArrayList<>();
|
||||
private final IScrollSource src;
|
||||
private final ISortSource sortSrc;
|
||||
@@ -111,14 +112,13 @@ public class ItemRepo
|
||||
|
||||
final Enum viewMode = this.sortSrc.getSortDisplay();
|
||||
final Enum searchMode = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
||||
if( searchMode == SearchBoxMode.JEI_AUTOSEARCH || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH )
|
||||
if( searchMode == SearchBoxMode.JEI_AUTOSEARCH || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH || searchMode == SearchBoxMode.JEI_AUTOSEARCH_KEEP || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH_KEEP )
|
||||
{
|
||||
this.updateJEI( this.searchString );
|
||||
}
|
||||
|
||||
this.innerSearch = this.searchString;
|
||||
final boolean terminalSearchToolTips = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_TOOLTIPS ) != YesNo.NO;
|
||||
// boolean terminalSearchMods = Configuration.INSTANCE.settings.getSetting( Settings.SEARCH_MODS ) != YesNo.NO;
|
||||
|
||||
boolean searchMod = false;
|
||||
if( this.innerSearch.startsWith( "@" ) )
|
||||
|
||||
@@ -79,7 +79,7 @@ public class FacadeWithBlockBakedModel implements IBakedModel
|
||||
{
|
||||
if( sprite.getTint() != -1 )
|
||||
{
|
||||
builder.setColor( Minecraft.getMinecraft().getItemColors().getColorFromItemstack( this.textureItem, sprite.getTint() ) );
|
||||
builder.setColor( Minecraft.getMinecraft().getItemColors().colorMultiplier( this.textureItem, sprite.getTint() ) );
|
||||
}
|
||||
builder.setTexture( sprite.getSprite() );
|
||||
builder.setDrawFaces( EnumSet.of( EnumFacing.NORTH ) );
|
||||
|
||||
@@ -39,7 +39,7 @@ public class StaticItemColor implements IItemColor
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColorFromItemstack( ItemStack stack, int tintIndex )
|
||||
public int colorMultiplier( ItemStack stack, int tintIndex )
|
||||
{
|
||||
return this.color.getVariantByTintIndex( tintIndex );
|
||||
}
|
||||
|
||||
@@ -168,6 +168,8 @@ public class CableBusBakedModel implements IBakedModel
|
||||
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;
|
||||
@@ -208,6 +210,8 @@ public class CableBusBakedModel implements IBakedModel
|
||||
case DENSE_SMART:
|
||||
this.cableBuilder.addStraightDenseSmartConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return; // Don't render the other form of connection
|
||||
@@ -237,6 +241,8 @@ public class CableBusBakedModel implements IBakedModel
|
||||
case DENSE_SMART:
|
||||
// Dense cables do not render connections to parts since none can be attached
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,6 +271,8 @@ public class CableBusBakedModel implements IBakedModel
|
||||
case DENSE_SMART:
|
||||
this.cableBuilder.addDenseSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class FacadeRenderState
|
||||
|
||||
public int resolveTintColor( int tintIndex )
|
||||
{
|
||||
return Minecraft.getMinecraft().getItemColors().getColorFromItemstack( this.textureItem, tintIndex );
|
||||
return Minecraft.getMinecraft().getItemColors().colorMultiplier( this.textureItem, tintIndex );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.security.ISecurityGrid;
|
||||
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;
|
||||
@@ -204,7 +205,7 @@ public abstract class AEBaseContainer extends Container
|
||||
final NBTTagCompound data = CompressedStreamTools.readCompressed( new ByteArrayInputStream( buffer ) );
|
||||
if( data != null )
|
||||
{
|
||||
this.setTargetStack( AEApi.instance().storage().createItemStack( new ItemStack( data ) ) );
|
||||
this.setTargetStack( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( new ItemStack( data ) ) );
|
||||
}
|
||||
}
|
||||
catch( final IOException e )
|
||||
@@ -893,7 +894,7 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
if( !isg.isEmpty() && releaseQty > 0 )
|
||||
{
|
||||
IAEItemStack ais = AEApi.instance().storage().createItemStack( isg );
|
||||
IAEItemStack ais = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( isg );
|
||||
ais.setStackSize( 1 );
|
||||
final IAEItemStack extracted = ais.copy();
|
||||
|
||||
@@ -983,7 +984,7 @@ public abstract class AEBaseContainer extends Container
|
||||
}
|
||||
else
|
||||
{
|
||||
IAEItemStack ais = AEApi.instance().storage().createItemStack( player.inventory.getItemStack() );
|
||||
IAEItemStack ais = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( player.inventory.getItemStack() );
|
||||
ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
|
||||
if( ais != null )
|
||||
{
|
||||
@@ -1032,7 +1033,7 @@ public abstract class AEBaseContainer extends Container
|
||||
}
|
||||
else
|
||||
{
|
||||
IAEItemStack ais = AEApi.instance().storage().createItemStack( player.inventory.getItemStack() );
|
||||
IAEItemStack ais = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( player.inventory.getItemStack() );
|
||||
ais.setStackSize( 1 );
|
||||
ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
|
||||
if( ais == null )
|
||||
@@ -1107,7 +1108,8 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance().sendTo( new PacketInventoryAction( InventoryAction.UPDATE_HAND, 0, AEItemStack.create( p.inventory.getItemStack() ) ),
|
||||
NetworkHandler.instance().sendTo(
|
||||
new PacketInventoryAction( InventoryAction.UPDATE_HAND, 0, AEItemStack.fromItemStack( p.inventory.getItemStack() ) ),
|
||||
p );
|
||||
}
|
||||
catch( final IOException e )
|
||||
@@ -1123,7 +1125,8 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
return input;
|
||||
}
|
||||
final IAEItemStack ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), AEApi.instance().storage().createItemStack( input ),
|
||||
final IAEItemStack ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(),
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( input ),
|
||||
this.getActionSource() );
|
||||
if( ais == null )
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.storage.ICellWorkbenchItem;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
@@ -227,12 +227,14 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
final IItemHandler inv = this.getUpgradeable().getInventoryByName( "config" );
|
||||
|
||||
final IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory(
|
||||
this.getUpgradeable().getInventoryByName( "cell" ).getStackInSlot( 0 ), null, StorageChannel.ITEMS );
|
||||
this.getUpgradeable().getInventoryByName( "cell" ).getStackInSlot( 0 ), null,
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
|
||||
Iterator<IAEItemStack> i = new NullIterator<>();
|
||||
if( cellInv != null )
|
||||
{
|
||||
final IItemList<IAEItemStack> list = cellInv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
final IItemList<IAEItemStack> list = cellInv
|
||||
.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
|
||||
i = list.iterator();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.AEBaseContainer;
|
||||
@@ -208,7 +209,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
final PacketMEInventoryUpdate b = new PacketMEInventoryUpdate( (byte) 1 );
|
||||
final PacketMEInventoryUpdate c = this.result.isSimulation() ? new PacketMEInventoryUpdate( (byte) 2 ) : null;
|
||||
|
||||
final IItemList<IAEItemStack> plan = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> plan = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
this.result.populatePlan( plan );
|
||||
|
||||
this.setUsedBytes( this.result.getByteTotal() );
|
||||
@@ -225,7 +226,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
p.setStackSize( out.getCountRequestable() );
|
||||
|
||||
final IStorageGrid sg = this.getGrid().getCache( IStorageGrid.class );
|
||||
final IMEInventory<IAEItemStack> items = sg.getItemInventory();
|
||||
final IMEInventory<IAEItemStack> items = sg.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
|
||||
IAEItemStack m = null;
|
||||
if( c != null && this.result.isSimulation() )
|
||||
|
||||
@@ -34,6 +34,7 @@ import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IBaseMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.AEBaseContainer;
|
||||
@@ -52,7 +53,7 @@ import appeng.util.Platform;
|
||||
public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorHandlerReceiver<IAEItemStack>, ICustomNameObject
|
||||
{
|
||||
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private IGrid network;
|
||||
private CraftingCPUCluster monitor = null;
|
||||
private String cpuName = null;
|
||||
|
||||
@@ -54,6 +54,7 @@ import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -77,7 +78,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
|
||||
private final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5];
|
||||
private final IMEMonitor<IAEItemStack> monitor;
|
||||
private final IItemList<IAEItemStack> items = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> items = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private final IConfigManager clientCM;
|
||||
private final ITerminalHost host;
|
||||
@GuiSync( 99 )
|
||||
@@ -108,7 +109,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
{
|
||||
this.serverCM = monitorable.getConfigManager();
|
||||
|
||||
this.monitor = monitorable.getItemInventory();
|
||||
this.monitor = monitorable.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
if( this.monitor != null )
|
||||
{
|
||||
this.monitor.addListener( this, null );
|
||||
@@ -188,7 +189,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
if( this.monitor != this.host.getItemInventory() )
|
||||
if( this.monitor != this.host.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) )
|
||||
{
|
||||
this.setValidContainer( false );
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import appeng.api.networking.IGridBlock;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -113,14 +114,14 @@ public class ContainerNetworkStatus extends AEBaseContainer
|
||||
|
||||
for( final Class<? extends IGridHost> machineClass : this.network.getMachinesClasses() )
|
||||
{
|
||||
final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
for( final IGridNode machine : this.network.getMachines( machineClass ) )
|
||||
{
|
||||
final IGridBlock blk = machine.getGridBlock();
|
||||
final ItemStack is = blk.getMachineRepresentation();
|
||||
if( !is.isEmpty() )
|
||||
{
|
||||
final IAEItemStack ais = AEItemStack.create( is );
|
||||
final IAEItemStack ais = AEItemStack.fromItemStack( is );
|
||||
ais.setStackSize( 1 );
|
||||
ais.setCountRequestable( (long) ( blk.getIdlePowerUsage() * 100.0 ) );
|
||||
list.add( ais );
|
||||
|
||||
@@ -45,6 +45,7 @@ import appeng.api.config.Actionable;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.ContainerNull;
|
||||
@@ -398,7 +399,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
return;
|
||||
}
|
||||
|
||||
final IMEMonitor<IAEItemStack> storage = this.getPatternTerminal().getItemInventory();
|
||||
final IMEMonitor<IAEItemStack> storage = this.getPatternTerminal()
|
||||
.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final IItemList<IAEItemStack> all = storage.getStorageList();
|
||||
|
||||
final ItemStack is = r.getCraftingResult( ic );
|
||||
@@ -447,7 +449,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
final ItemStack failed = real.getStackInSlot( x );
|
||||
if( !failed.isEmpty() )
|
||||
{
|
||||
this.getCellInventory().injectItems( AEItemStack.create( failed ), Actionable.MODULATE,
|
||||
this.getCellInventory().injectItems( AEItemStack.fromItemStack( failed ), Actionable.MODULATE,
|
||||
new MachineSource( this.getPatternTerminal() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import appeng.api.config.Settings;
|
||||
import appeng.api.config.StorageFilter;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
@@ -157,7 +158,8 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
Iterator<IAEItemStack> i = new NullIterator<>();
|
||||
if( cellInv != null )
|
||||
{
|
||||
final IItemList<IAEItemStack> list = cellInv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
final IItemList<IAEItemStack> list = cellInv
|
||||
.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
|
||||
i = list.iterator();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,11 +34,13 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.ContainerNull;
|
||||
@@ -105,7 +107,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
return;
|
||||
}
|
||||
|
||||
final IMEMonitor<IAEItemStack> inv = this.storage.getItemInventory();
|
||||
final IMEMonitor<IAEItemStack> inv = this.storage.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final int howManyPerCraft = this.getStack().getCount();
|
||||
int maxTimesToCraft = 0;
|
||||
|
||||
@@ -306,7 +308,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
else if( !set[x].isEmpty() )
|
||||
{
|
||||
// eek! put it back!
|
||||
final IAEItemStack fail = inv.injectItems( AEItemStack.create( set[x] ), Actionable.MODULATE, this.mySrc );
|
||||
final IAEItemStack fail = inv.injectItems( AEItemStack.fromItemStack( set[x] ), Actionable.MODULATE, this.mySrc );
|
||||
if( fail != null )
|
||||
{
|
||||
drops.add( fail.createItemStack() );
|
||||
|
||||
@@ -29,6 +29,7 @@ import appeng.api.AEApi;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.packets.PacketPatternSlot;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
@@ -50,7 +51,8 @@ public class SlotPatternTerm extends SlotCraftingTerm
|
||||
|
||||
public AppEngPacket getRequest( final boolean shift ) throws IOException
|
||||
{
|
||||
return new PacketPatternSlot( this.getPattern(), AEApi.instance().storage().createItemStack( this.getStack() ), shift );
|
||||
return new PacketPatternSlot( this
|
||||
.getPattern(), AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( this.getStack() ), shift );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,20 +20,14 @@ package appeng.core;
|
||||
|
||||
|
||||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.exceptions.FailedConnection;
|
||||
import appeng.api.features.IRegistryContainer;
|
||||
import appeng.api.networking.IGridBlock;
|
||||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.IGridHelper;
|
||||
import appeng.api.storage.IStorageHelper;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.api.ApiGrid;
|
||||
import appeng.core.api.ApiPart;
|
||||
import appeng.core.api.ApiStorage;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.core.features.registries.RegistryContainer;
|
||||
import appeng.me.GridConnection;
|
||||
import appeng.me.GridNode;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public final class Api implements IAppEngApi
|
||||
@@ -45,11 +39,13 @@ public final class Api implements IAppEngApi
|
||||
// private MovableTileRegistry MovableRegistry = new MovableTileRegistry();
|
||||
private final IRegistryContainer registryContainer;
|
||||
private final IStorageHelper storageHelper;
|
||||
private final IGridHelper networkHelper;
|
||||
private final ApiDefinitions definitions;
|
||||
|
||||
private Api()
|
||||
{
|
||||
this.storageHelper = new ApiStorage();
|
||||
this.networkHelper = new ApiGrid();
|
||||
this.registryContainer = new RegistryContainer();
|
||||
this.partHelper = new ApiPart();
|
||||
this.definitions = new ApiDefinitions( (PartModels) this.registryContainer.partModels() );
|
||||
@@ -72,6 +68,12 @@ public final class Api implements IAppEngApi
|
||||
return this.storageHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridHelper grid()
|
||||
{
|
||||
return this.networkHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiPart partHelper()
|
||||
{
|
||||
@@ -83,21 +85,4 @@ public final class Api implements IAppEngApi
|
||||
{
|
||||
return this.definitions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode createGridNode( final IGridBlock blk )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
throw new IllegalStateException( "Grid features for " + blk + " are server side only." );
|
||||
}
|
||||
|
||||
return new GridNode( blk );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridConnection createGridConnection( final IGridNode a, final IGridNode b ) throws FailedConnection
|
||||
{
|
||||
return new GridConnection( a, b, AEPartLocation.INTERNAL );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ import appeng.services.version.VersionCheckerConfig;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.12,1.12.1]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
|
||||
@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.12.2]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
|
||||
public final class AppEng
|
||||
{
|
||||
@SidedProxy( clientSide = "appeng.client.ClientHelper", serverSide = "appeng.server.ServerHelper", modId = AppEng.MOD_ID )
|
||||
|
||||
@@ -460,10 +460,18 @@ final class Registration
|
||||
// Inscriber
|
||||
Upgrades.SPEED.registerItem( blocks.inscriber(), 3 );
|
||||
|
||||
items.wirelessTerminal().maybeItem().ifPresent( terminal ->
|
||||
{
|
||||
registries.wireless().registerWirelessHandler( (IWirelessTermHandler) terminal );
|
||||
} );
|
||||
// Wireless Terminal Handler
|
||||
items.wirelessTerminal().maybeItem().ifPresent( terminal -> registries.wireless().registerWirelessHandler( (IWirelessTermHandler) terminal ) );
|
||||
|
||||
// Charge Rates
|
||||
items.chargedStaff().maybeItem().ifPresent( chargedStaff -> registries.charger().addChargeRate( chargedStaff, 320d ) );
|
||||
items.portableCell().maybeItem().ifPresent( chargedStaff -> registries.charger().addChargeRate( chargedStaff, 800d ) );
|
||||
items.colorApplicator().maybeItem().ifPresent( colorApplicator -> registries.charger().addChargeRate( colorApplicator, 800d ) );
|
||||
items.wirelessTerminal().maybeItem().ifPresent( terminal -> registries.charger().addChargeRate( terminal, 8000d ) );
|
||||
items.entropyManipulator().maybeItem().ifPresent( entropyManipulator -> registries.charger().addChargeRate( entropyManipulator, 8000d ) );
|
||||
items.massCannon().maybeItem().ifPresent( massCannon -> registries.charger().addChargeRate( massCannon, 8000d ) );
|
||||
blocks.energyCell().maybeItem().ifPresent( cell -> registries.charger().addChargeRate( cell, 8000d ) );
|
||||
blocks.energyCellDense().maybeItem().ifPresent( cell -> registries.charger().addChargeRate( cell, 16000d ) );
|
||||
|
||||
// add villager trading to black smiths for a few basic materials
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.VILLAGER_TRADING ) )
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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.core.api;
|
||||
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import appeng.api.exceptions.FailedConnectionException;
|
||||
import appeng.api.networking.IGridBlock;
|
||||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.IGridHelper;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.me.GridConnection;
|
||||
import appeng.me.GridNode;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
/**
|
||||
* @author yueh
|
||||
* @version rv5
|
||||
* @since rv5
|
||||
*/
|
||||
public class ApiGrid implements IGridHelper
|
||||
{
|
||||
|
||||
@Override
|
||||
public IGridNode createGridNode( final IGridBlock blk )
|
||||
{
|
||||
Preconditions.checkNotNull( blk );
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
throw new IllegalStateException( "Grid features for " + blk + " are server side only." );
|
||||
}
|
||||
|
||||
return new GridNode( blk );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridConnection createGridConnection( final IGridNode a, final IGridNode b ) throws FailedConnectionException
|
||||
{
|
||||
Preconditions.checkNotNull( a );
|
||||
Preconditions.checkNotNull( b );
|
||||
|
||||
return new GridConnection( a, b, AEPartLocation.INTERNAL );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,6 +20,12 @@ package appeng.core.api;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ClassToInstanceMap;
|
||||
import com.google.common.collect.MutableClassToInstanceMap;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
@@ -32,9 +38,13 @@ import appeng.api.networking.crafting.ICraftingRequester;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.IStorageHelper;
|
||||
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.crafting.CraftingLink;
|
||||
import appeng.util.Platform;
|
||||
@@ -47,57 +57,157 @@ import appeng.util.item.ItemList;
|
||||
public class ApiStorage implements IStorageHelper
|
||||
{
|
||||
|
||||
private final ClassToInstanceMap<IStorageChannel<?>> channels;
|
||||
|
||||
public ApiStorage()
|
||||
{
|
||||
this.channels = MutableClassToInstanceMap.create();
|
||||
this.registerStorageChannel( IItemStorageChannel.class, new ItemStorageChannel() );
|
||||
this.registerStorageChannel( IFluidStorageChannel.class, new FluidStorageChannel() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IAEStack<T>, C extends IStorageChannel<T>> void registerStorageChannel( Class<C> channel, C factory )
|
||||
{
|
||||
Preconditions.checkNotNull( channel );
|
||||
Preconditions.checkNotNull( factory );
|
||||
Preconditions.checkArgument( channel.isInstance( factory ) );
|
||||
Preconditions.checkArgument( !this.channels.containsKey( channel ) );
|
||||
|
||||
this.channels.putInstance( channel, factory );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IAEStack<T>, C extends IStorageChannel<T>> C getStorageChannel( Class<C> channel )
|
||||
{
|
||||
Preconditions.checkNotNull( channel );
|
||||
|
||||
final C type = this.channels.getInstance( channel );
|
||||
|
||||
Preconditions.checkNotNull( type );
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IStorageChannel<? extends IAEStack<?>>> storageChannels()
|
||||
{
|
||||
return Collections.unmodifiableCollection( this.channels.values() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICraftingLink loadCraftingLink( final NBTTagCompound data, final ICraftingRequester req )
|
||||
{
|
||||
Preconditions.checkNotNull( data );
|
||||
Preconditions.checkNotNull( req );
|
||||
|
||||
return new CraftingLink( data, req );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack createItemStack( final ItemStack is )
|
||||
private static final class ItemStorageChannel implements IItemStorageChannel
|
||||
{
|
||||
return AEItemStack.create( is );
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> createList()
|
||||
{
|
||||
return new ItemList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack createStack( Object input )
|
||||
{
|
||||
Preconditions.checkNotNull( input );
|
||||
|
||||
if( input instanceof ItemStack )
|
||||
{
|
||||
return AEItemStack.fromItemStack( (ItemStack) input );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack readFromPacket( ByteBuf input ) throws IOException
|
||||
{
|
||||
Preconditions.checkNotNull( input );
|
||||
|
||||
return AEItemStack.fromPacket( input );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack poweredExtraction( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack request, IActionSource src )
|
||||
{
|
||||
Preconditions.checkNotNull( energy );
|
||||
Preconditions.checkNotNull( cell );
|
||||
Preconditions.checkNotNull( request );
|
||||
Preconditions.checkNotNull( src );
|
||||
|
||||
return Platform.poweredExtraction( energy, cell, request, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack poweredInsert( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack input, IActionSource src )
|
||||
{
|
||||
Preconditions.checkNotNull( energy );
|
||||
Preconditions.checkNotNull( cell );
|
||||
Preconditions.checkNotNull( input );
|
||||
Preconditions.checkNotNull( src );
|
||||
|
||||
return Platform.poweredInsert( energy, cell, input, src );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack createFluidStack( final FluidStack is )
|
||||
private static final class FluidStorageChannel implements IFluidStorageChannel
|
||||
{
|
||||
return AEFluidStack.create( is );
|
||||
|
||||
@Override
|
||||
public IItemList<IAEFluidStack> createList()
|
||||
{
|
||||
return new FluidList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack createStack( Object input )
|
||||
{
|
||||
Preconditions.checkNotNull( input );
|
||||
|
||||
if( input instanceof FluidStack )
|
||||
{
|
||||
return AEFluidStack.fromFluidStack( (FluidStack) input );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack readFromPacket( ByteBuf input ) throws IOException
|
||||
{
|
||||
Preconditions.checkNotNull( input );
|
||||
|
||||
return AEFluidStack.fromPacket( input );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack poweredExtraction( IEnergySource energy, IMEInventory<IAEFluidStack> cell, IAEFluidStack request, IActionSource src )
|
||||
{
|
||||
Preconditions.checkNotNull( energy );
|
||||
Preconditions.checkNotNull( cell );
|
||||
Preconditions.checkNotNull( request );
|
||||
Preconditions.checkNotNull( src );
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack poweredInsert( IEnergySource energy, IMEInventory<IAEFluidStack> cell, IAEFluidStack input, IActionSource src )
|
||||
{
|
||||
Preconditions.checkNotNull( energy );
|
||||
Preconditions.checkNotNull( cell );
|
||||
Preconditions.checkNotNull( input );
|
||||
Preconditions.checkNotNull( src );
|
||||
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> createItemList()
|
||||
{
|
||||
return new ItemList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEFluidStack> createFluidList()
|
||||
{
|
||||
return new FluidList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack readItemFromPacket( final ByteBuf input ) throws IOException
|
||||
{
|
||||
return AEItemStack.loadItemStackFromPacket( input );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack readFluidFromPacket( final ByteBuf input ) throws IOException
|
||||
{
|
||||
return AEFluidStack.loadFluidStackFromPacket( input );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack poweredExtraction( final IEnergySource energy, final IMEInventory<IAEItemStack> cell, final IAEItemStack request, final IActionSource src )
|
||||
{
|
||||
return Platform.poweredExtraction( energy, cell, request, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack poweredInsert( final IEnergySource energy, final IMEInventory<IAEItemStack> cell, final IAEItemStack input, final IActionSource src )
|
||||
{
|
||||
return Platform.poweredInsert( energy, cell, input, src );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ public final class ApiItems implements IItems
|
||||
@Override
|
||||
public IItemDefinition biometricCard()
|
||||
{
|
||||
return this.biometricCard;
|
||||
return this.chargedStaff;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,7 +21,7 @@ package appeng.core.api.definitions;
|
||||
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.IParts;
|
||||
import appeng.api.exceptions.MissingDefinition;
|
||||
import appeng.api.exceptions.MissingDefinitionException;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
import appeng.bootstrap.FeatureFactory;
|
||||
@@ -180,28 +180,28 @@ public final class ApiParts implements IParts
|
||||
@Override
|
||||
public AEColoredItemDefinition lumenCableSmart()
|
||||
{
|
||||
throw new MissingDefinition( "Lumen Smart Cable has yet to be implemented." );
|
||||
throw new MissingDefinitionException( "Lumen Smart Cable has yet to be implemented." );
|
||||
// return this.lumenCableSmart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition lumenCableCovered()
|
||||
{
|
||||
throw new MissingDefinition( "Lumen Covered Cable has yet to be implemented." );
|
||||
throw new MissingDefinitionException( "Lumen Covered Cable has yet to be implemented." );
|
||||
// return this.lumenCableCovered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition lumenCableGlass()
|
||||
{
|
||||
throw new MissingDefinition( "Lumen Glass Cable has yet to be implemented." );
|
||||
throw new MissingDefinitionException( "Lumen Glass Cable has yet to be implemented." );
|
||||
// return this.lumenCableGlass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition lumenDenseCableSmart()
|
||||
{
|
||||
throw new MissingDefinition( "Lumen Dense Cable has yet to be implemented." );
|
||||
throw new MissingDefinitionException( "Lumen Dense Cable has yet to be implemented." );
|
||||
// return this.lumenCableDense;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.core.features.registries;
|
||||
|
||||
|
||||
import appeng.api.features.IChargerRegistry;
|
||||
import appeng.api.features.IGrinderRegistry;
|
||||
import appeng.api.features.IInscriberRegistry;
|
||||
import appeng.api.features.ILocatableRegistry;
|
||||
@@ -35,6 +36,7 @@ import appeng.api.networking.IGridCacheRegistry;
|
||||
import appeng.api.parts.IPartModels;
|
||||
import appeng.api.storage.ICellRegistry;
|
||||
import appeng.core.features.registries.cell.CellRegistry;
|
||||
import appeng.core.features.registries.charger.ChargerRegistry;
|
||||
import appeng.core.features.registries.grinder.GrinderRecipeManager;
|
||||
import appeng.core.features.registries.inscriber.InscriberRegistry;
|
||||
|
||||
@@ -44,13 +46,15 @@ import appeng.core.features.registries.inscriber.InscriberRegistry;
|
||||
*
|
||||
* @author AlgorithmX2
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @author yueh
|
||||
* @version rv5
|
||||
* @since rv0
|
||||
*/
|
||||
public class RegistryContainer implements IRegistryContainer
|
||||
{
|
||||
private final IGrinderRegistry grinder = new GrinderRecipeManager();
|
||||
private final IInscriberRegistry inscriber = new InscriberRegistry();
|
||||
private final IChargerRegistry charger = new ChargerRegistry();
|
||||
private final ICellRegistry cell = new CellRegistry();
|
||||
private final ILocatableRegistry locatable = new LocatableRegistry();
|
||||
private final ISpecialComparisonRegistry comparison = new SpecialComparisonRegistry();
|
||||
@@ -105,6 +109,12 @@ public class RegistryContainer implements IRegistryContainer
|
||||
return this.inscriber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChargerRegistry charger()
|
||||
{
|
||||
return this.charger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILocatableRegistry locatable()
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.storage.ICellInventory;
|
||||
@@ -30,7 +31,9 @@ import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.ISaveProvider;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
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.CellInventory;
|
||||
@@ -48,9 +51,9 @@ public class BasicCellHandler implements ICellHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventoryHandler getCellInventory( final ItemStack is, final ISaveProvider container, final StorageChannel channel )
|
||||
public <T extends IAEStack<T>> IMEInventoryHandler<T> getCellInventory( final ItemStack is, final ISaveProvider container, final IStorageChannel<T> channel )
|
||||
{
|
||||
if( channel == StorageChannel.ITEMS )
|
||||
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
return CellInventory.getCell( is, container );
|
||||
}
|
||||
@@ -58,7 +61,7 @@ public class BasicCellHandler implements ICellHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChestGui( final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final StorageChannel chan )
|
||||
public void openChestGui( final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final IStorageChannel chan )
|
||||
{
|
||||
Platform.openGUI( player, (TileEntity) chest, AEPartLocation.fromFacing( chest.getUp() ), GuiBridge.GUI_ME );
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.storage.ICellRegistry;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.ISaveProvider;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
public class CellRegistry implements ICellRegistry
|
||||
@@ -85,7 +86,7 @@ public class CellRegistry implements ICellRegistry
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventoryHandler getCellInventory( final ItemStack is, final ISaveProvider container, final StorageChannel chan )
|
||||
public <T extends IAEStack<T>> IMEInventoryHandler<T> getCellInventory( final ItemStack is, final ISaveProvider container, final IStorageChannel<T> chan )
|
||||
{
|
||||
if( is.isEmpty() )
|
||||
{
|
||||
|
||||
@@ -23,12 +23,14 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.ISaveProvider;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.items.storage.ItemCreativeStorageCell;
|
||||
@@ -46,9 +48,10 @@ public class CreativeCellHandler implements ICellHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventoryHandler getCellInventory( final ItemStack is, final ISaveProvider container, final StorageChannel channel )
|
||||
public IMEInventoryHandler getCellInventory( final ItemStack is, final ISaveProvider container, final IStorageChannel channel )
|
||||
{
|
||||
if( channel == StorageChannel.ITEMS && !is.isEmpty() && is.getItem() instanceof ItemCreativeStorageCell )
|
||||
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) && !is.isEmpty() && is
|
||||
.getItem() instanceof ItemCreativeStorageCell )
|
||||
{
|
||||
return CreativeCellInventory.getCell( is );
|
||||
}
|
||||
@@ -56,7 +59,7 @@ public class CreativeCellHandler implements ICellHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChestGui( final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final StorageChannel chan )
|
||||
public void openChestGui( final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final IStorageChannel chan )
|
||||
{
|
||||
Platform.openGUI( player, (TileEntity) chest, AEPartLocation.fromFacing( chest.getUp() ), GuiBridge.GUI_ME );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2017, 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.features.registries.charger;
|
||||
|
||||
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import appeng.api.features.IChargerRegistry;
|
||||
|
||||
|
||||
public class ChargerRegistry implements IChargerRegistry
|
||||
{
|
||||
private static final double DEFAULT_CHARGE_RATE = 160d;
|
||||
private static final double CAPPED_CHARGE_RATE = 16000d;
|
||||
|
||||
private final Map<Item, Double> chargeRates;
|
||||
|
||||
public ChargerRegistry()
|
||||
{
|
||||
this.chargeRates = new IdentityHashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnegative
|
||||
public double getChargeRate( @Nonnull Item item )
|
||||
{
|
||||
Preconditions.checkNotNull( item );
|
||||
|
||||
return this.chargeRates.getOrDefault( item, DEFAULT_CHARGE_RATE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChargeRate( @Nonnull Item item, @Nonnegative double value )
|
||||
{
|
||||
Preconditions.checkNotNull( item );
|
||||
Preconditions.checkArgument( value > 0d );
|
||||
|
||||
final double cappedValue = Math.min( value, CAPPED_CHARGE_RATE );
|
||||
|
||||
this.chargeRates.put( item, cappedValue );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeChargeRate( @Nonnull Item item )
|
||||
{
|
||||
Preconditions.checkNotNull( item );
|
||||
|
||||
this.chargeRates.remove( item );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -64,11 +64,15 @@ public enum ButtonToolTips
|
||||
|
||||
TransferToStorageCell,
|
||||
ToggleSortDirection,
|
||||
SearchMode_Auto,
|
||||
|
||||
SearchMode_Auto,
|
||||
SearchMode_Standard,
|
||||
SearchMode_JEIAuto,
|
||||
SearchMode_JEIStandard,
|
||||
SearchMode_AutoKeep,
|
||||
SearchMode_StandardKeep,
|
||||
SearchMode_JEIAutoKeep,
|
||||
SearchMode_JEIStandardKeep,
|
||||
|
||||
SearchMode,
|
||||
ItemName,
|
||||
@@ -137,7 +141,11 @@ public enum ButtonToolTips
|
||||
SchedulingMode,
|
||||
SchedulingModeDefault,
|
||||
SchedulingModeRoundRobin,
|
||||
SchedulingModeRandom;
|
||||
SchedulingModeRandom,
|
||||
|
||||
FilterMode,
|
||||
FilterModeKeep,
|
||||
FilterModeClear;
|
||||
|
||||
private final String root;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class PacketAssemblerAnimation extends AppEngPacket
|
||||
this.y = stream.readInt();
|
||||
this.z = stream.readInt();
|
||||
this.rate = stream.readByte();
|
||||
this.is = AEItemStack.loadItemStackFromPacket( stream );
|
||||
this.is = AEItemStack.fromPacket( stream );
|
||||
}
|
||||
|
||||
// api
|
||||
|
||||
@@ -59,7 +59,7 @@ public class PacketInventoryAction extends AppEngPacket
|
||||
final boolean hasItem = stream.readBoolean();
|
||||
if( hasItem )
|
||||
{
|
||||
this.slotItem = AEItemStack.loadItemStackFromPacket( stream );
|
||||
this.slotItem = AEItemStack.fromPacket( stream );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -36,6 +36,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGrid;
|
||||
@@ -44,6 +45,7 @@ import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
@@ -135,7 +137,7 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
|
||||
if( inv != null && this.recipe != null && security != null )
|
||||
{
|
||||
final IMEMonitor<IAEItemStack> storage = inv.getItemInventory();
|
||||
final IMEMonitor<IAEItemStack> storage = inv.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final IPartitionList<IAEItemStack> filter = ItemViewCell.createFilter( cct.getViewCells() );
|
||||
|
||||
for( int x = 0; x < craftMatrix.getSlots(); x++ )
|
||||
@@ -151,7 +153,7 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
// put away old item
|
||||
if( newItem != currentItem && security.hasPermission( player, SecurityPermissions.INJECT ) )
|
||||
{
|
||||
final IAEItemStack in = AEItemStack.create( currentItem );
|
||||
final IAEItemStack in = AEItemStack.fromItemStack( currentItem );
|
||||
final IAEItemStack out = cct.useRealItems() ? Platform.poweredInsert( energy, storage, in, cct.getActionSource() ) : null;
|
||||
if( out != null )
|
||||
{
|
||||
@@ -169,7 +171,7 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
// for each variant
|
||||
for( int y = 0; y < this.recipe[x].length && currentItem.isEmpty(); y++ )
|
||||
{
|
||||
final IAEItemStack request = AEItemStack.create( this.recipe[x][y] );
|
||||
final IAEItemStack request = AEItemStack.fromItemStack( this.recipe[x][y] );
|
||||
if( request != null )
|
||||
{
|
||||
// try ae
|
||||
|
||||
@@ -113,7 +113,7 @@ public class PacketMEInventoryUpdate extends AppEngPacket
|
||||
|
||||
while( uncompressed.readableBytes() > 0 )
|
||||
{
|
||||
this.list.add( AEItemStack.loadItemStackFromPacket( uncompressed ) );
|
||||
this.list.add( AEItemStack.fromPacket( uncompressed ) );
|
||||
}
|
||||
|
||||
this.empty = this.list.isEmpty();
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.implementations.ContainerPatternTerm;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
@@ -65,7 +66,7 @@ public class PacketPatternSlot extends AppEngPacket
|
||||
|
||||
if( hasItem )
|
||||
{
|
||||
return AEItemStack.loadItemStackFromPacket( stream );
|
||||
return AEItemStack.fromPacket( stream );
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -87,7 +88,7 @@ public class PacketPatternSlot extends AppEngPacket
|
||||
this.writeItem( slotItem, data );
|
||||
for( int x = 0; x < 9; x++ )
|
||||
{
|
||||
this.pattern[x] = AEApi.instance().storage().createItemStack( pat.getStackInSlot( x ) );
|
||||
this.pattern[x] = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( pat.getStackInSlot( x ) );
|
||||
this.writeItem( this.pattern[x], data );
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
@@ -54,8 +55,8 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
|
||||
private final MECraftingInventory original;
|
||||
private final World world;
|
||||
private final IItemList<IAEItemStack> crafting = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> missing = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> crafting = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private final IItemList<IAEItemStack> missing = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private final HashMap<String, TwoIntegers> opsAndMultiplier = new HashMap<>();
|
||||
private final Object monitor = new Object();
|
||||
private final Stopwatch watch = Stopwatch.createUnstarted();
|
||||
@@ -85,7 +86,8 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
this.callback = callback;
|
||||
final ICraftingGrid cc = grid.getCache( ICraftingGrid.class );
|
||||
final IStorageGrid sg = grid.getCache( IStorageGrid.class );
|
||||
this.original = new MECraftingInventory( sg.getItemInventory(), actionSrc, false, false, false );
|
||||
this.original = new MECraftingInventory( sg
|
||||
.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ), actionSrc, false, false, false );
|
||||
|
||||
this.setTree( this.getCraftingTree( cc, what ) );
|
||||
this.availableCheck = null;
|
||||
|
||||
@@ -34,6 +34,7 @@ import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
@@ -45,7 +46,7 @@ public class CraftingTreeNode
|
||||
// what slot!
|
||||
private final int slot;
|
||||
private final CraftingJob job;
|
||||
private final IItemList<IAEItemStack> used = AEApi.instance().storage().createItemList();
|
||||
private final IItemList<IAEItemStack> used = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
// parent node.
|
||||
private final CraftingTreeProcess parent;
|
||||
private final World world;
|
||||
|
||||
@@ -34,6 +34,7 @@ import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.ContainerNull;
|
||||
@@ -207,7 +208,7 @@ public class CraftingTreeProcess
|
||||
ItemStack is = ic.getStackInSlot( x );
|
||||
is = Platform.getContainerItem( is );
|
||||
|
||||
final IAEItemStack o = AEApi.instance().storage().createItemStack( is );
|
||||
final IAEItemStack o = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( is );
|
||||
if( o != null )
|
||||
{
|
||||
this.bytes++;
|
||||
@@ -226,7 +227,7 @@ public class CraftingTreeProcess
|
||||
if( this.containerItems )
|
||||
{
|
||||
final ItemStack is = Platform.getContainerItem( stack.createItemStack() );
|
||||
final IAEItemStack o = AEApi.instance().storage().createItemStack( is );
|
||||
final IAEItemStack o = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( is );
|
||||
if( o != null )
|
||||
{
|
||||
this.bytes++;
|
||||
|
||||
@@ -24,7 +24,8 @@ import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.util.inv.ItemListIgnoreCrafting;
|
||||
@@ -49,7 +50,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
public MECraftingInventory()
|
||||
{
|
||||
this.localCache = new ItemListIgnoreCrafting<>( AEApi.instance().storage().createItemList() );
|
||||
this.localCache = new ItemListIgnoreCrafting<>( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
|
||||
this.extractedCache = null;
|
||||
this.injectedCache = null;
|
||||
this.missingCache = null;
|
||||
@@ -69,7 +70,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( this.logMissing )
|
||||
{
|
||||
this.missingCache = AEApi.instance().storage().createItemList();
|
||||
this.missingCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -78,7 +79,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( this.logExtracted )
|
||||
{
|
||||
this.extractedCache = AEApi.instance().storage().createItemList();
|
||||
this.extractedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -87,14 +88,15 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( this.logInjections )
|
||||
{
|
||||
this.injectedCache = AEApi.instance().storage().createItemList();
|
||||
this.injectedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.injectedCache = null;
|
||||
}
|
||||
|
||||
this.localCache = this.target.getAvailableItems( new ItemListIgnoreCrafting<>( AEApi.instance().storage().createItemList() ) );
|
||||
this.localCache = this.target
|
||||
.getAvailableItems( new ItemListIgnoreCrafting<>( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() ) );
|
||||
|
||||
this.par = parent;
|
||||
}
|
||||
@@ -108,7 +110,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( logMissing )
|
||||
{
|
||||
this.missingCache = AEApi.instance().storage().createItemList();
|
||||
this.missingCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -117,7 +119,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( logExtracted )
|
||||
{
|
||||
this.extractedCache = AEApi.instance().storage().createItemList();
|
||||
this.extractedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -126,14 +128,14 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( logInjections )
|
||||
{
|
||||
this.injectedCache = AEApi.instance().storage().createItemList();
|
||||
this.injectedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.injectedCache = null;
|
||||
}
|
||||
|
||||
this.localCache = new ItemListIgnoreCrafting<>( AEApi.instance().storage().createItemList() );
|
||||
this.localCache = new ItemListIgnoreCrafting<>( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
|
||||
for( final IAEItemStack is : target.getStorageList() )
|
||||
{
|
||||
this.localCache.add( target.extractItems( is, Actionable.SIMULATE, src ) );
|
||||
@@ -151,7 +153,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( logMissing )
|
||||
{
|
||||
this.missingCache = AEApi.instance().storage().createItemList();
|
||||
this.missingCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -160,7 +162,7 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( logExtracted )
|
||||
{
|
||||
this.extractedCache = AEApi.instance().storage().createItemList();
|
||||
this.extractedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -169,14 +171,14 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
if( logInjections )
|
||||
{
|
||||
this.injectedCache = AEApi.instance().storage().createItemList();
|
||||
this.injectedCache = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.injectedCache = null;
|
||||
}
|
||||
|
||||
this.localCache = target.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
this.localCache = target.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
|
||||
this.par = null;
|
||||
}
|
||||
|
||||
@@ -255,9 +257,9 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel getChannel()
|
||||
{
|
||||
return StorageChannel.ITEMS;
|
||||
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
|
||||
}
|
||||
|
||||
public IItemList<IAEItemStack> getItemList()
|
||||
@@ -267,8 +269,8 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
public boolean commit( final IActionSource src )
|
||||
{
|
||||
final IItemList<IAEItemStack> added = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> pulled = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> added = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
final IItemList<IAEItemStack> pulled = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
boolean failed = false;
|
||||
|
||||
if( this.logInjections )
|
||||
|
||||
@@ -30,7 +30,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.exceptions.MissingDefinition;
|
||||
import appeng.api.exceptions.MissingDefinitionException;
|
||||
import appeng.client.render.effects.ChargedOreFX;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
@@ -53,7 +53,7 @@ public final class BlockChargedQuartzOre extends BlockQuartzOre
|
||||
.materials()
|
||||
.certusQuartzCrystalCharged()
|
||||
.maybeItem()
|
||||
.orElseThrow( () -> new MissingDefinition( "Tried to access charged certus quartz crystal, even though they are disabled" ) );
|
||||
.orElseThrow( () -> new MissingDefinitionException( "Tried to access charged certus quartz crystal, even though they are disabled" ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,7 +64,7 @@ public final class BlockChargedQuartzOre extends BlockQuartzOre
|
||||
.materials()
|
||||
.certusQuartzCrystalCharged()
|
||||
.maybeStack( 1 )
|
||||
.orElseThrow( () -> new MissingDefinition( "Tried to access charged certus quartz crystal, even though they are disabled" ) )
|
||||
.orElseThrow( () -> new MissingDefinitionException( "Tried to access charged certus quartz crystal, even though they are disabled" ) )
|
||||
.getItemDamage();
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.exceptions.MissingDefinition;
|
||||
import appeng.api.exceptions.MissingDefinitionException;
|
||||
import appeng.block.AEBaseBlock;
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ public class BlockQuartzOre extends AEBaseBlock
|
||||
.materials()
|
||||
.certusQuartzCrystal()
|
||||
.maybeItem()
|
||||
.orElseThrow( () -> new MissingDefinition( "Tried to access certus quartz crystal, even though they are disabled" ) );
|
||||
.orElseThrow( () -> new MissingDefinitionException( "Tried to access certus quartz crystal, even though they are disabled" ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,7 +122,7 @@ public class BlockQuartzOre extends AEBaseBlock
|
||||
.materials()
|
||||
.certusQuartzCrystal()
|
||||
.maybeStack( 1 )
|
||||
.orElseThrow( () -> new MissingDefinition( "Tried to access certus quartz crystal, even though they are disabled" ) )
|
||||
.orElseThrow( () -> new MissingDefinitionException( "Tried to access certus quartz crystal, even though they are disabled" ) )
|
||||
.getItemDamage();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ public abstract class AEBaseEntityItem extends EntityItem
|
||||
super( world, x, y, z, stack );
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
protected List<Entity> getCheckedEntitiesWithinAABBExcludingEntity( final AxisAlignedBB region )
|
||||
{
|
||||
return this.world.getEntitiesWithinAABBExcludingEntity( this, region );
|
||||
|
||||
@@ -75,11 +75,14 @@ import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.IStorageMonitorableAccessor;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
@@ -125,8 +128,12 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, NUMBER_OF_CONFIG_SLOTS );
|
||||
private final AppEngInternalInventory storage = new AppEngInternalInventory( this, NUMBER_OF_STORAGE_SLOTS );
|
||||
private final AppEngInternalInventory patterns = new AppEngInternalInventory( this, NUMBER_OF_PATTERN_SLOTS );
|
||||
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>( new NullInventory<IAEItemStack>(), StorageChannel.ITEMS );
|
||||
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>( new NullInventory<IAEFluidStack>(), StorageChannel.FLUIDS );
|
||||
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>( new NullInventory<IAEItemStack>(), AEApi.instance()
|
||||
.storage()
|
||||
.getStorageChannel( IItemStorageChannel.class ) );
|
||||
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>( new NullInventory<IAEFluidStack>(), AEApi.instance()
|
||||
.storage()
|
||||
.getStorageChannel( IFluidStorageChannel.class ) );
|
||||
private final UpgradeInventory upgrades;
|
||||
private boolean hasConfig = false;
|
||||
private int priority;
|
||||
@@ -412,7 +419,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
if( req == null && !stored.isEmpty() )
|
||||
{
|
||||
final IAEItemStack work = AEApi.instance().storage().createItemStack( stored );
|
||||
final IAEItemStack work = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( stored );
|
||||
this.requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
return;
|
||||
}
|
||||
@@ -435,7 +442,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
else
|
||||
// Stored != null; dispose!
|
||||
{
|
||||
final IAEItemStack work = AEApi.instance().storage().createItemStack( stored );
|
||||
final IAEItemStack work = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( stored );
|
||||
this.requireWork[slot] = work.setStackSize( -work.getStackSize() );
|
||||
return;
|
||||
}
|
||||
@@ -500,7 +507,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
@Override
|
||||
public boolean canInsert( final ItemStack stack )
|
||||
{
|
||||
final IAEItemStack out = this.destination.injectItems( AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE, null );
|
||||
final IAEItemStack out = this.destination.injectItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( stack ),
|
||||
Actionable.SIMULATE, null );
|
||||
if( out == null )
|
||||
{
|
||||
return true;
|
||||
@@ -526,8 +534,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
try
|
||||
{
|
||||
this.items.setInternal( this.gridProxy.getStorage().getItemInventory() );
|
||||
this.fluids.setInternal( this.gridProxy.getStorage().getFluidInventory() );
|
||||
this.items.setInternal( this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) );
|
||||
this.fluids.setInternal( this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) ) );
|
||||
}
|
||||
catch( final GridAccessException gae )
|
||||
{
|
||||
@@ -663,7 +671,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
boolean changed = false;
|
||||
try
|
||||
{
|
||||
this.destination = this.gridProxy.getStorage().getItemInventory();
|
||||
this.destination = this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
final IEnergySource src = this.gridProxy.getEnergy();
|
||||
|
||||
if( this.craftingTracker.isBusy( x ) )
|
||||
@@ -788,14 +796,28 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
|
||||
{
|
||||
if( this.hasConfig() )
|
||||
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
return new InterfaceInventory( this );
|
||||
if( this.hasConfig() )
|
||||
{
|
||||
return (IMEMonitor<T>) new InterfaceInventory( this );
|
||||
}
|
||||
|
||||
return (IMEMonitor<T>) this.items;
|
||||
}
|
||||
else if( channel == AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) )
|
||||
{
|
||||
if( this.hasConfig() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (IMEMonitor<T>) this.fluids;
|
||||
}
|
||||
|
||||
return this.items;
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean hasConfig()
|
||||
@@ -851,17 +873,6 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
if( this.hasConfig() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.fluids;
|
||||
}
|
||||
|
||||
private void cancelCrafting()
|
||||
{
|
||||
this.craftingTracker.cancel();
|
||||
@@ -880,14 +891,12 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
{
|
||||
return new InterfaceInventory( di );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
|
||||
{
|
||||
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
return (IMEMonitor<T>) new InterfaceInventory( di );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -1119,11 +1128,11 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
return AEItemStack.create( adaptor.simulateAdd( acquired.createItemStack() ) );
|
||||
return AEItemStack.fromItemStack( adaptor.simulateAdd( acquired.createItemStack() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
final IAEItemStack is = AEItemStack.create( adaptor.addItems( acquired.createItemStack() ) );
|
||||
final IAEItemStack is = AEItemStack.fromItemStack( adaptor.addItems( acquired.createItemStack() ) );
|
||||
this.updatePlan( slot );
|
||||
return is;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.util.ItemSorters;
|
||||
@@ -78,7 +79,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
this.canSubstitute = this.isCrafting && encodedValue.getBoolean( "substitute" );
|
||||
this.patternItem = is;
|
||||
this.pattern = AEItemStack.create( is );
|
||||
this.pattern = AEItemStack.fromItemStack( is );
|
||||
|
||||
final List<IAEItemStack> in = new ArrayList<>();
|
||||
final List<IAEItemStack> out = new ArrayList<>();
|
||||
@@ -100,7 +101,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
this.markItemAs( x, gs, TestStatus.ACCEPT );
|
||||
}
|
||||
|
||||
in.add( AEApi.instance().storage().createItemStack( gs ) );
|
||||
in.add( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( gs ) );
|
||||
this.testFrame.setInventorySlotContents( x, gs );
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
if( this.standardRecipe != null )
|
||||
{
|
||||
this.correctOutput = this.standardRecipe.getCraftingResult( this.crafting );
|
||||
out.add( AEApi.instance().storage().createItemStack( this.correctOutput ) );
|
||||
out.add( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( this.correctOutput ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -135,7 +136,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
if( !gs.isEmpty() )
|
||||
{
|
||||
out.add( AEApi.instance().storage().createItemStack( gs ) );
|
||||
out.add( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( gs ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,10 @@ import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
@@ -95,7 +96,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
this.sg = this.targetGrid.getCache( IStorageGrid.class );
|
||||
if( this.sg != null )
|
||||
{
|
||||
this.itemStorage = this.sg.getItemInventory();
|
||||
this.itemStorage = this.sg.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,23 +109,9 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
|
||||
{
|
||||
if( this.sg == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return this.sg.getItemInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
if( this.sg == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return this.sg.getFluidInventory();
|
||||
return this.sg.getInventory( channel );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,7 +133,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems( final IItemList out )
|
||||
public IItemList<IAEItemStack> getAvailableItems( final IItemList<IAEItemStack> out )
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
@@ -242,13 +229,13 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
public IStorageChannel getChannel()
|
||||
{
|
||||
if( this.itemStorage != null )
|
||||
{
|
||||
return this.itemStorage.getChannel();
|
||||
}
|
||||
return StorageChannel.ITEMS;
|
||||
return AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,9 +21,11 @@ package appeng.hooks;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -49,7 +51,6 @@ import appeng.core.AppEng;
|
||||
import appeng.core.sync.packets.PacketPaintedEntity;
|
||||
import appeng.crafting.CraftingJob;
|
||||
import appeng.me.Grid;
|
||||
import appeng.me.NetworkList;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.IWorldCallable;
|
||||
import appeng.util.Platform;
|
||||
@@ -118,7 +119,7 @@ public class TickHandler
|
||||
{
|
||||
if( Platform.isServer() ) // for no there is no reason to care about this on the client...
|
||||
{
|
||||
this.getRepo().networks.add( grid );
|
||||
this.getRepo().addNetwork( grid );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +127,7 @@ public class TickHandler
|
||||
{
|
||||
if( Platform.isServer() ) // for no there is no reason to care about this on the client...
|
||||
{
|
||||
this.getRepo().networks.remove( grid );
|
||||
this.getRepo().removeNetwork( grid );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,6 +148,7 @@ public class TickHandler
|
||||
{
|
||||
final LinkedList<IGridNode> toDestroy = new LinkedList<>();
|
||||
|
||||
this.getRepo().updateNetworks();
|
||||
for( final Grid g : this.getRepo().networks )
|
||||
{
|
||||
for( final IGridNode n : g.getNodes() )
|
||||
@@ -218,6 +220,7 @@ public class TickHandler
|
||||
}
|
||||
|
||||
// tick networks.
|
||||
this.getRepo().updateNetworks();
|
||||
for( final Grid g : this.getRepo().networks )
|
||||
{
|
||||
g.update();
|
||||
@@ -295,12 +298,37 @@ public class TickHandler
|
||||
|
||||
private Queue<AEBaseTile> tiles = new LinkedList<>();
|
||||
|
||||
private Collection<Grid> networks = new NetworkList();
|
||||
private Set<Grid> networks = new HashSet<>();
|
||||
private Set<Grid> toAdd = new HashSet<>();
|
||||
private Set<Grid> toRemove = new HashSet<>();
|
||||
|
||||
private void clear()
|
||||
{
|
||||
this.tiles = new LinkedList<>();
|
||||
this.networks = new NetworkList();
|
||||
this.networks = new HashSet<>();
|
||||
this.toAdd = new HashSet<>();
|
||||
this.toRemove = new HashSet<>();
|
||||
}
|
||||
|
||||
private synchronized void addNetwork( Grid g )
|
||||
{
|
||||
this.toAdd.add( g );
|
||||
this.toRemove.remove( g );
|
||||
}
|
||||
|
||||
private synchronized void removeNetwork( Grid g )
|
||||
{
|
||||
this.toRemove.add( g );
|
||||
this.toAdd.remove( g );
|
||||
}
|
||||
|
||||
private synchronized void updateNetworks()
|
||||
{
|
||||
this.networks.removeAll( this.toRemove );
|
||||
this.toRemove.clear();
|
||||
|
||||
this.networks.addAll( this.toAdd );
|
||||
this.toAdd.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ package appeng.integration;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.ModAPIManager;
|
||||
|
||||
import appeng.api.exceptions.ModNotInstalled;
|
||||
import appeng.api.exceptions.ModNotInstalledException;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
|
||||
@@ -96,7 +96,7 @@ final class IntegrationNode
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ModNotInstalled( this.modID );
|
||||
throw new ModNotInstalledException( this.modID );
|
||||
}
|
||||
|
||||
this.mod.preInit();
|
||||
@@ -130,7 +130,7 @@ final class IntegrationNode
|
||||
if( this.getState() == IntegrationStage.FAILED )
|
||||
{
|
||||
AELog.info( this.displayName + " - Integration Disabled" );
|
||||
if( !( this.exception instanceof ModNotInstalled ) )
|
||||
if( !( this.exception instanceof ModNotInstalledException ) )
|
||||
{
|
||||
AELog.integration( this.exception );
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ import net.minecraft.item.ItemStack;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
|
||||
|
||||
import appeng.api.exceptions.MissingIngredientError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.exceptions.MissingIngredientException;
|
||||
import appeng.api.exceptions.RegistrationException;
|
||||
import appeng.api.recipes.IIngredient;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.recipes.game.ShapedRecipe;
|
||||
@@ -72,7 +72,7 @@ class ShapedRecipeWrapper implements IShapedCraftingRecipeWrapper
|
||||
ItemStack[] is = ing.getItemStackSet();
|
||||
slotList = useSingleItems ? Platform.findPreferred( is ) : Arrays.asList( is );
|
||||
}
|
||||
catch( final RegistrationError | MissingIngredientError ignored )
|
||||
catch( final RegistrationException | MissingIngredientException ignored )
|
||||
{
|
||||
}
|
||||
in.add( slotList );
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user