Compare commits
162 Commits
rv5.alpha.1
...
rv5-1.12
| Author | SHA1 | Date | |
|---|---|---|---|
| fa2b4fabc7 | |||
| f8d5f4ddb1 | |||
| f8dfa2619e | |||
| c1d1dc947f | |||
| 6bb465be0b | |||
| 8902af9766 | |||
| 2b592dd40e | |||
| 41e7558b24 | |||
| 3e09c49e03 | |||
| 9481c9a7d7 | |||
| ccefb47581 | |||
| 59af05aeb1 | |||
| b32834e2b3 | |||
| 6c7cbb7ee1 | |||
| 84c065ff28 | |||
| c9b92a81a3 | |||
| eed4776c6f | |||
| 22807bc619 | |||
| ae352c093e | |||
| 36d6681eac | |||
| 6cffe93970 | |||
| b1472c58d0 | |||
| 96450a76c7 | |||
| ac209053b9 | |||
| dce1aa37eb | |||
| 0b6831e4d7 | |||
| da6d8ba9a8 | |||
| f0e45c7a3c | |||
| cbfc88c87f | |||
| 8c5842aca9 | |||
| 483049f555 | |||
| a7a65ae39d | |||
| 45878df17d | |||
| 98142d8ade | |||
| 7956872d1d | |||
| e243c8e9a2 | |||
| 641d0d40cc | |||
| 50fad685b6 | |||
| 1ad49edd76 | |||
| 7ceaa4cc3e | |||
| b70c86542b | |||
| c1197c0084 | |||
| f0d807f0a2 | |||
| 5fa2c0ab27 | |||
| 3063bd887c | |||
| fac4a8f9dc | |||
| 9d8226da19 | |||
| 33754d289d | |||
| 959672dae3 | |||
| 90c17c09a8 | |||
| e0bf7223e0 | |||
| ba9af94228 | |||
| 122b6163dc | |||
| fab42ccc75 | |||
| f5dd2c8b0a | |||
| a126112a2d | |||
| 99cda5f5a3 | |||
| 56a5363528 | |||
| be65edbd5b | |||
| fe5d9251eb | |||
| 3cf48b2291 | |||
| cc4599b5fc | |||
| c1fa77df51 | |||
| 725fa491e6 | |||
| e2a6cd1d57 | |||
| 6ddf60fab8 | |||
| 2c07acfe81 | |||
| 3749742231 | |||
| 74b9610b45 | |||
| a725779ff6 | |||
| b82df25c75 | |||
| cc9b33b473 | |||
| 5496b746ea | |||
| f80f623ccf | |||
| cba6c5500f | |||
| bc8268af94 | |||
| 297cd16702 | |||
| 41711e50b9 | |||
| 2bfb8b75e8 | |||
| 58e96aa3de | |||
| 4f07b63b13 | |||
| 905dd6c888 | |||
| ab7f35a9ee | |||
| 6e81f698c0 | |||
| 8ad8ce68b5 | |||
| 644194d0d6 | |||
| 95b27f490c | |||
| 6032c0328e | |||
| e8d554d69d | |||
| 1e15b23506 | |||
| 2ed7a5598a | |||
| 1c05dd5834 | |||
| 632d124359 | |||
| 829c18e2bb | |||
| d3a5be7ed6 | |||
| 217cbf0982 | |||
| 4dd0a4cd96 | |||
| 54c0ce43ea | |||
| bd8f43acbf | |||
| 970630a90d | |||
| 771a944058 | |||
| db1cd8c312 | |||
| 375e1efb15 | |||
| 955fcac92a | |||
| 216e2cb1e3 | |||
| 53f5724657 | |||
| a3269826f9 | |||
| 1a918be658 | |||
| 90130e72aa | |||
| c8f10d92bb | |||
| 548af3c6cc | |||
| 98b9380494 | |||
| bbf4d4a9ce | |||
| 1513ba3f6a | |||
| f03f8ec432 | |||
| e1dcd588b7 | |||
| 8338a7d13e | |||
| b8e685b1b6 | |||
| d84500c5b7 | |||
| a1679c944b | |||
| a3a39201d1 | |||
| d788da687e | |||
| 030e0c6a14 | |||
| 8e4265aa33 | |||
| 80eaa032b9 | |||
| bee9c70497 | |||
| c4fa21c193 | |||
| 8a7450168b | |||
| 7cb641cdc8 | |||
| b5b8050c4c | |||
| e65083b045 | |||
| b61219ef88 | |||
| 4f9fd1b369 | |||
| 630fae3f73 | |||
| 488ef1b544 | |||
| 098ee2f000 | |||
| 04d2b06c0d | |||
| ac48ab02fc | |||
| 9022150e38 | |||
| 65c6d2249a | |||
| 8e7f79a9ea | |||
| 95b48b9438 | |||
| cdd76b7b22 | |||
| 3e2bc0e038 | |||
| eec3e59eea | |||
| e39855b48f | |||
| cdcab7d91c | |||
| 27ad2c2b96 | |||
| 542a2e5d5a | |||
| 3b58f5e8da | |||
| 092afad4a5 | |||
| 6aa810d62a | |||
| 41d98f9944 | |||
| 1b198979fd | |||
| 8d5cc916e0 | |||
| 5abb8bf886 | |||
| 0bed78a144 | |||
| 30940e91ea | |||
| 0f9ac5fdda | |||
| 5e001d86cb | |||
| b13a338948 | |||
| 454404b0c1 |
@@ -14,6 +14,7 @@
|
||||
* [Building](#building)
|
||||
* [Contribution](#contribution)
|
||||
* [API](#applied-energistics-2-api)
|
||||
* [CraftTweaker](#applied-energistics-2-crafttweaker)
|
||||
* [Localization](#applied-energistics-2-localization)
|
||||
* [Credits](#credits)
|
||||
|
||||
@@ -154,6 +155,57 @@ Where the __ are filled in with the correct version criteria; AE2 is available f
|
||||
|
||||
An example string would be `appeng:appliedenergistics2:rv2-alpha-30:dev`
|
||||
|
||||
## Applied Energistics 2 CraftTweaker
|
||||
|
||||
### Inscriber
|
||||
Add a recipe. When `inscribe` is true the bottom and top inputs are not consumed.
|
||||
|
||||
mods.appliedenergistics2.Inscriber.addRecipe(ItemStack output, ItemStack input, boolean inscribe,
|
||||
@Optional ItemStack topInput, @Optional ItemStack bottomInput );
|
||||
|
||||
Remove all recipes for this output stack.
|
||||
|
||||
mods.appliedenergistics2.Inscriber.removeRecipe(ItemStack output);
|
||||
|
||||
### Grindstone
|
||||
Add a recipe.
|
||||
|
||||
mods.appliedenergistics2.Grinder.addRecipe( ItemStack output, ItemStack input, int turns,
|
||||
@Optional ItemStack secondary1Output, @Optional float secondary1Chance,
|
||||
@Optional ItemStack secondary2Output, @Optional float secondary2Chance);
|
||||
|
||||
Remove recipes for this input.
|
||||
|
||||
mods.appliedenergistics2.Grinder.removeRecipe(ItemStack input);
|
||||
|
||||
### Spatial
|
||||
Whitelist a TileEntity class for Spatial IO.
|
||||
|
||||
mods.appliedenergistics2.Spatial.whitelistEntity( String fullEntityClassName );
|
||||
|
||||
### Attunement
|
||||
Attune a ItemStack or ModID to a specific P2P-Tunnel type. ModID's are used as fallback when no ItemStack was found.
|
||||
|
||||
mods.appliedenergistics2.Attunement.attuneME( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneME( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneItem( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneItem( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneFluid( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneFluid( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneRedstone( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneRedstone( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneRF( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneRF( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneIC2( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneIC2( String modID );
|
||||
mods.appliedenergistics2.Attunement.attuneLight( ItemStack itemStack );
|
||||
mods.appliedenergistics2.Attunement.attuneLight( String modID );
|
||||
|
||||
### Cannon
|
||||
Add ammo types for the matter cannon.
|
||||
|
||||
mods.appliedenergistics2.Cannon.registerAmmo( ItemStack itemStack, double weight );
|
||||
|
||||
## Applied Energistics 2 Localization
|
||||
|
||||
### English Text
|
||||
|
||||
+6
-3
@@ -45,6 +45,12 @@ apply from: 'gradle/scripts/optional.gradle'
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
// ensure everything uses UTF-8 and not some random codepage chosen by gradle
|
||||
compileJava.options.encoding = 'UTF-8'
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
version = aeversion + "-" + aechannel + "-" + aebuild
|
||||
group = aegroup
|
||||
archivesBaseName = aebasename
|
||||
@@ -52,7 +58,6 @@ archivesBaseName = aebasename
|
||||
// Add Coremod Manifest
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'FMLCorePluginContainsFMLMod': 'true'
|
||||
attributes 'FMLAT': 'appeng_at.cfg'
|
||||
}
|
||||
|
||||
@@ -68,8 +73,6 @@ jar {
|
||||
}
|
||||
|
||||
minecraft {
|
||||
coreMod = "appeng.coremod.AppEngCore"
|
||||
|
||||
version = minecraft_version + "-" + forge_version
|
||||
|
||||
replaceIn "AEConfig.java"
|
||||
|
||||
+15
-8
@@ -7,20 +7,27 @@ aebasename=appliedenergistics2
|
||||
#########################################################
|
||||
# Versions #
|
||||
#########################################################
|
||||
minecraft_version=1.12
|
||||
mcp_mappings=snapshot_20170704
|
||||
forge_version=14.21.1.2412
|
||||
minecraft_version=1.12.2
|
||||
mcp_mappings=snapshot_20171003
|
||||
forge_version=14.23.1.2554
|
||||
|
||||
#########################################################
|
||||
# Installable #
|
||||
#########################################################
|
||||
hwyla_version=1.8.19-B33_1.12
|
||||
hwyla_version=1.8.20-B35_1.12
|
||||
|
||||
#########################################################
|
||||
# Provided APIs #
|
||||
#########################################################
|
||||
jei_version=4.7.1.69
|
||||
jei_version=4.8.0.105
|
||||
tesla_version=1.0.61
|
||||
ic2_version=2.8.7-ex112
|
||||
rf_version=2.0.0.1
|
||||
top_version=1.12-1.4.8-2
|
||||
ic2_version=2.8.19-ex112
|
||||
top_version=1.12-1.4.18-10
|
||||
cofhcore_version=1.12-4.+
|
||||
crafttweaker_version=4.0.10.310
|
||||
|
||||
#########################################################
|
||||
# Deployment #
|
||||
#########################################################
|
||||
website_version=1.12.2
|
||||
curse_versions=1.12.2
|
||||
|
||||
@@ -31,7 +31,7 @@ repositories {
|
||||
|
||||
maven {
|
||||
name = "Tesla repo"
|
||||
url "http://maven.epoxide.xyz"
|
||||
url "http://maven.mcmoddev.com"
|
||||
}
|
||||
|
||||
maven {
|
||||
@@ -48,7 +48,7 @@ repositories {
|
||||
name 'tterrag maven'
|
||||
url "http://maven.tterrag.com/"
|
||||
}
|
||||
|
||||
|
||||
maven { // McJtyLib
|
||||
name 'mcjty'
|
||||
url "http://maven.k-4u.nl/"
|
||||
@@ -58,6 +58,16 @@ repositories {
|
||||
name 'tehnut'
|
||||
url "http://tehnut.info/maven"
|
||||
}
|
||||
|
||||
maven { // CraftTweaker
|
||||
name 'jared maven'
|
||||
url "http://maven.blamejared.com/"
|
||||
}
|
||||
|
||||
maven { // modmaven, maven proxy
|
||||
name 'modmaven'
|
||||
url "https://modmaven.k-4u.nl/"
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
@@ -69,17 +79,15 @@ dependencies {
|
||||
mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
|
||||
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
|
||||
// mods "com.github.mcjty:compatlayer:${compatlayer_version}"
|
||||
|
||||
// compile against provided APIs
|
||||
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
|
||||
compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||
compileOnly "net.darkhax.tesla:Tesla-${minecraft_version}:${tesla_version}"
|
||||
compileOnly "net.darkhax.tesla:Tesla-1.12:${tesla_version}"
|
||||
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
||||
|
||||
// deobfCompile "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||
deobfCompile "cofh:RedstoneFlux:${minecraft_version}-${rf_version}:universal"
|
||||
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
|
||||
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
|
||||
|
||||
// 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 ) );
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ public enum TunnelType
|
||||
{
|
||||
ME, // Network Tunnel
|
||||
IC2_POWER, // EU Tunnel
|
||||
RF_POWER, // RF Tunnel
|
||||
FE_POWER, // Forge Energy tunnel
|
||||
REDSTONE, // Redstone Tunnel
|
||||
FLUID, // Fluid Tunnel
|
||||
|
||||
@@ -38,7 +38,9 @@ public interface IParts
|
||||
|
||||
AEColoredItemDefinition cableGlass();
|
||||
|
||||
AEColoredItemDefinition cableDense();
|
||||
AEColoredItemDefinition cableDenseCovered();
|
||||
|
||||
AEColoredItemDefinition cableDenseSmart();
|
||||
|
||||
AEColoredItemDefinition lumenCableSmart();
|
||||
|
||||
@@ -46,7 +48,7 @@ public interface IParts
|
||||
|
||||
AEColoredItemDefinition lumenCableGlass();
|
||||
|
||||
AEColoredItemDefinition lumenCableDense();
|
||||
AEColoredItemDefinition lumenDenseCableSmart();
|
||||
|
||||
IItemDefinition quartzFiber();
|
||||
|
||||
@@ -80,8 +82,6 @@ public interface IParts
|
||||
|
||||
IItemDefinition p2PTunnelEU();
|
||||
|
||||
IItemDefinition p2PTunnelRF();
|
||||
|
||||
IItemDefinition p2PTunnelFE();
|
||||
|
||||
IItemDefinition p2PTunnelLight();
|
||||
|
||||
@@ -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 );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* 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.features;
|
||||
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
/**
|
||||
* Builder for a grinder recipe.
|
||||
*
|
||||
* The only default value provided are turns at a value of 8.
|
||||
*
|
||||
* @author yueh
|
||||
* @version rv5
|
||||
* @since rv5
|
||||
*/
|
||||
public interface IGrinderRecipeBuilder
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates an grinder recipe with inputs.
|
||||
* Needs to be invoked.
|
||||
*
|
||||
* @param input new input for the recipe
|
||||
*
|
||||
* @return currently used builder
|
||||
*/
|
||||
@Nonnull
|
||||
IGrinderRecipeBuilder withInput( @Nonnull ItemStack input );
|
||||
|
||||
/**
|
||||
* Creates an grinder recipe with output.
|
||||
* Needs to be invoked.
|
||||
*
|
||||
* @param output new output for the recipe
|
||||
*
|
||||
* @return currently used builder
|
||||
*/
|
||||
@Nonnull
|
||||
IGrinderRecipeBuilder withOutput( @Nonnull ItemStack output );
|
||||
|
||||
/**
|
||||
* Creates an grinder recipe with the first optional output and its chance.
|
||||
*
|
||||
* @param optional new first optional for the recipe
|
||||
* @param chance chance for the first optional output, must be within 0.0 - 1.0
|
||||
*
|
||||
* @return currently used builder
|
||||
*/
|
||||
@Nonnull
|
||||
IGrinderRecipeBuilder withFirstOptional( @Nonnull ItemStack optional, float chance );
|
||||
|
||||
/**
|
||||
* Creates an grinder recipe with the second optional output and its chance.
|
||||
*
|
||||
* @param optional new second optional for the recipe
|
||||
* @param chance chance for the second optional output, must be within 0.0 - 1.0
|
||||
*
|
||||
* @return currently used builder
|
||||
*/
|
||||
@Nonnull
|
||||
IGrinderRecipeBuilder withSecondOptional( @Nonnull ItemStack optional, float chance );
|
||||
|
||||
/**
|
||||
* Creates an grinder recipe with the amount of turns as cost.
|
||||
*
|
||||
* Defaults to 8 when not called.
|
||||
*
|
||||
* @param turns new turns for the recipe, must be > 0
|
||||
*
|
||||
* @return currently used builder
|
||||
*/
|
||||
@Nonnull
|
||||
IGrinderRecipeBuilder withTurns( @Nonnegative int turns );
|
||||
|
||||
/**
|
||||
* Finalizes the process of making the recipe.
|
||||
* Needs to be invoked to fetch grinder recipe.
|
||||
*
|
||||
* @return valid grinder recipe
|
||||
*
|
||||
* @throws IllegalStateException when input is not defined
|
||||
* @throws IllegalStateException when input has no size
|
||||
* @throws IllegalStateException when output is not defined
|
||||
* @throws IllegalStateException when both optionals are not defined
|
||||
* @throws IllegalStateException when process type is not defined
|
||||
*/
|
||||
@Nonnull
|
||||
IGrinderRecipe build();
|
||||
}
|
||||
@@ -38,6 +38,14 @@ import net.minecraft.item.ItemStack;
|
||||
public interface IGrinderRegistry
|
||||
{
|
||||
|
||||
/**
|
||||
* Extensible way to create a grinder recipe.
|
||||
*
|
||||
* @return builder for grinder recipes
|
||||
*/
|
||||
@Nonnull
|
||||
IGrinderRecipeBuilder builder();
|
||||
|
||||
/**
|
||||
* An immutable list of the currently registered recipes.
|
||||
*
|
||||
@@ -47,48 +55,13 @@ public interface IGrinderRegistry
|
||||
Collection<IGrinderRecipe> getRecipes();
|
||||
|
||||
/**
|
||||
* Add a new recipe with a single input and output and how many turns it requires.
|
||||
*
|
||||
* Will ignore duplicate recipes with the same input item.
|
||||
*
|
||||
* @param in The {@link ItemStack} to grind.
|
||||
* @param out The {@link ItemStack} to output.
|
||||
* @param turns Amount of turns to turn the input into the output, with turns > 0.
|
||||
* Add a new recipe to the registry.
|
||||
*/
|
||||
void addRecipe( @Nonnull ItemStack in, @Nonnull ItemStack out, int turns );
|
||||
|
||||
/**
|
||||
* Add a new recipe with an input, output and a single optional output.
|
||||
*
|
||||
* Will ignore duplicate recipes with the same input item.
|
||||
*
|
||||
* @param in The {@link ItemStack} to grind.
|
||||
* @param out The {@link ItemStack} to output.
|
||||
* @param optional The optional {@link ItemStack} to output of a certain chance.
|
||||
* @param chance Chance to get the optional output within 0.0 - 1.0
|
||||
* @param turns Amount of turns to turn the input into the output, with turns > 0.
|
||||
*/
|
||||
void addRecipe( @Nonnull ItemStack in, @Nonnull ItemStack out, @Nonnull ItemStack optional, float chance, int turns );
|
||||
|
||||
/**
|
||||
* add a new recipe with optional outputs, duplicates will not be added.
|
||||
*
|
||||
* Will ignore duplicate recipes with the same input item.
|
||||
*
|
||||
* @param in The {@link ItemStack} to grind.
|
||||
* @param out The {@link ItemStack} to output.
|
||||
* @param optional The first optional {@link ItemStack} to output of a certain chance.
|
||||
* @param chance Chance to get the first optional output within 0.0 - 1.0
|
||||
* @param optional2 The second optional {@link ItemStack} to output of a certain chance.
|
||||
* @param chance2 chance to get the second optional output within 0.0 - 1.0
|
||||
* @param turns Amount of turns to turn the input into the output, with turns > 0.
|
||||
*
|
||||
*/
|
||||
void addRecipe( @Nonnull ItemStack in, @Nonnull ItemStack out, @Nonnull ItemStack optional, float chance, @Nonnull ItemStack optional2, float chance2, int turns );
|
||||
boolean addRecipe( IGrinderRecipe recipe );
|
||||
|
||||
/**
|
||||
* Remove the specific from the recipe list.
|
||||
*
|
||||
*
|
||||
* @param recipe The recipe to be removed.
|
||||
* @return true, if it was removed
|
||||
*/
|
||||
@@ -106,11 +79,11 @@ public interface IGrinderRegistry
|
||||
|
||||
/**
|
||||
* Allows do add a custom ratio from an ore to dust when being grinded.
|
||||
*
|
||||
*
|
||||
* The default ratio is 1 ore to 2 dusts.
|
||||
*
|
||||
*
|
||||
* These have to be added before any recipe is registered. Otherwise it will use the default value.
|
||||
*
|
||||
*
|
||||
* @param oredictName The name of the ore;
|
||||
* @param ratio The amount, must be > 0;
|
||||
*/
|
||||
@@ -118,9 +91,9 @@ public interface IGrinderRegistry
|
||||
|
||||
/**
|
||||
* Remove a custom ratio for a specific ore name.
|
||||
*
|
||||
*
|
||||
* Will use the default of 2 value afterwards.
|
||||
*
|
||||
*
|
||||
* @param oredictName The name of the ore;
|
||||
*/
|
||||
boolean removeDustRatio( @Nonnull String oredictName );
|
||||
|
||||
@@ -31,11 +31,19 @@ import net.minecraft.item.ItemStack;
|
||||
* Lets you manipulate Inscriber Recipes, by adding or editing existing ones.
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv3
|
||||
* @version rv5
|
||||
* @since rv2
|
||||
*/
|
||||
public interface IInscriberRegistry
|
||||
{
|
||||
/**
|
||||
* Extensible way to create an inscriber recipe.
|
||||
*
|
||||
* @return builder for inscriber recipes
|
||||
*/
|
||||
@Nonnull
|
||||
IInscriberRecipeBuilder builder();
|
||||
|
||||
/**
|
||||
* An immutable copy of currently registered recipes.
|
||||
*
|
||||
@@ -65,29 +73,25 @@ public interface IInscriberRegistry
|
||||
@Nonnull
|
||||
Set<ItemStack> getInputs();
|
||||
|
||||
/**
|
||||
* Extensible way to create an inscriber recipe.
|
||||
*
|
||||
* @return builder for inscriber recipes
|
||||
*/
|
||||
@Nonnull
|
||||
IInscriberRecipeBuilder builder();
|
||||
|
||||
/**
|
||||
* add a new recipe the easy way, duplicates will not be added.
|
||||
* Added recipes will be automatically added to the optionals and inputs.
|
||||
*
|
||||
* @param recipe new recipe
|
||||
*
|
||||
* @return true, when successfully added
|
||||
*
|
||||
* @throws IllegalArgumentException if null is added
|
||||
*/
|
||||
void addRecipe( IInscriberRecipe recipe );
|
||||
boolean addRecipe( IInscriberRecipe recipe );
|
||||
|
||||
/**
|
||||
* Removes all equal recipes from the registry.
|
||||
*
|
||||
*
|
||||
* @param toBeRemovedRecipe to be removed recipe, can be null, makes just no sense.
|
||||
*
|
||||
* @return true, when successfully removed
|
||||
*/
|
||||
void removeRecipe( IInscriberRecipe toBeRemovedRecipe );
|
||||
boolean removeRecipe( IInscriberRecipe toBeRemovedRecipe );
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
|
||||
import appeng.api.config.TunnelType;
|
||||
|
||||
@@ -47,6 +48,7 @@ public interface IP2PTunnelRegistry
|
||||
*/
|
||||
void addNewAttunement( @Nonnull ItemStack trigger, @Nullable TunnelType type );
|
||||
void addNewAttunement( @Nonnull String ModId, @Nullable TunnelType type );
|
||||
void addNewAttunement( @Nonnull Capability<?> cap, @Nullable TunnelType type );
|
||||
|
||||
/**
|
||||
* returns null if no attunement can be found.
|
||||
|
||||
@@ -48,6 +48,7 @@ public interface IRecipeHandlerRegistry
|
||||
* @param name name of crafthandler
|
||||
* @param handler class of crafthandler
|
||||
*/
|
||||
@Deprecated
|
||||
void addNewCraftHandler( String name, Class<? extends ICraftHandler> handler );
|
||||
|
||||
/**
|
||||
@@ -65,11 +66,13 @@ public interface IRecipeHandlerRegistry
|
||||
* @return A recipe handler by name, returns null on failure.
|
||||
*/
|
||||
@Nullable
|
||||
@Deprecated
|
||||
ICraftHandler getCraftHandlerFor( String name );
|
||||
|
||||
/**
|
||||
* @return a new recipe handler, which can be used to parse, and read recipe files.
|
||||
*/
|
||||
@Deprecated
|
||||
IRecipeHandler createNewRecipehandler();
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -27,6 +27,7 @@ package appeng.api.implementations.items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.energy.IAEPowerStorage;
|
||||
|
||||
|
||||
@@ -42,27 +43,27 @@ public interface IAEItemPowerStorage
|
||||
*
|
||||
* @return amount unable to be stored
|
||||
*/
|
||||
double injectAEPower( ItemStack is, double amt );
|
||||
double injectAEPower( ItemStack stack, double amount, Actionable mode );
|
||||
|
||||
/**
|
||||
* Attempt to extract power from the device, it will extract what it can and
|
||||
* return it.
|
||||
*
|
||||
* @param amt to be extracted power from device
|
||||
* @param amount to be extracted power from device
|
||||
*
|
||||
* @return what it could extract
|
||||
*/
|
||||
double extractAEPower( ItemStack is, double amt );
|
||||
double extractAEPower( ItemStack stack, double amount, Actionable mode );
|
||||
|
||||
/**
|
||||
* @return the current maximum power ( this can change :P )
|
||||
*/
|
||||
double getAEMaxPower( ItemStack is );
|
||||
double getAEMaxPower( ItemStack stack );
|
||||
|
||||
/**
|
||||
* @return the current AE Power Level, this may exceed getMEMaxPower()
|
||||
*/
|
||||
double getAECurrentPower( ItemStack is );
|
||||
double getAECurrentPower( ItemStack stack );
|
||||
|
||||
/**
|
||||
* Control the power flow by telling what the network can do, either add? or
|
||||
@@ -70,5 +71,5 @@ public interface IAEItemPowerStorage
|
||||
*
|
||||
* @return access restriction of network
|
||||
*/
|
||||
AccessRestriction getPowerFlow( ItemStack is );
|
||||
AccessRestriction getPowerFlow( ItemStack stack );
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.implementations.TransitionResult;
|
||||
import appeng.api.storage.ISpatialDimension;
|
||||
import appeng.api.util.WorldCoord;
|
||||
|
||||
|
||||
@@ -57,7 +58,7 @@ public interface ISpatialStorageCell
|
||||
*
|
||||
* @return the world for this cell
|
||||
*/
|
||||
World getWorld( ItemStack is );
|
||||
ISpatialDimension getSpatialDimension();
|
||||
|
||||
/**
|
||||
* get the currently stored size.
|
||||
@@ -69,22 +70,13 @@ public interface ISpatialStorageCell
|
||||
WorldCoord getStoredSize( ItemStack is );
|
||||
|
||||
/**
|
||||
* Minimum coordinates in its world for the storage cell.
|
||||
* get the currently stored Dimension id.
|
||||
*
|
||||
* @param is spatial storage cell
|
||||
*
|
||||
* @return minimum coordinate of dimension
|
||||
* @return dimension id or -1
|
||||
*/
|
||||
WorldCoord getMin( ItemStack is );
|
||||
|
||||
/**
|
||||
* Maximum coordinates in its world for the storage cell.
|
||||
*
|
||||
* @param is spatial storage cell
|
||||
*
|
||||
* @return maximum coordinate of dimension
|
||||
*/
|
||||
WorldCoord getMax( ItemStack is );
|
||||
int getStoredDimensionID( ItemStack is );
|
||||
|
||||
/**
|
||||
* Perform a spatial swap with the contents of the cell, and the world.
|
||||
@@ -93,9 +85,9 @@ public interface ISpatialStorageCell
|
||||
* @param w world of spatial
|
||||
* @param min min coord
|
||||
* @param max max coord
|
||||
* @param doTransition transition
|
||||
* @param playerId owner of current grid or -1
|
||||
*
|
||||
* @return result of transition
|
||||
*/
|
||||
TransitionResult doSpatialTransition( ItemStack is, World w, WorldCoord min, WorldCoord max, boolean doTransition );
|
||||
TransitionResult doSpatialTransition( ItemStack is, World w, WorldCoord min, WorldCoord max, int playerId );
|
||||
}
|
||||
+26
-21
@@ -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,39 +21,44 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package appeng.api.storage.data;
|
||||
package appeng.api.networking;
|
||||
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import appeng.api.features.IItemComparison;
|
||||
import appeng.api.exceptions.FailedConnectionException;
|
||||
|
||||
|
||||
/**
|
||||
* Don't cast this... either compare with it, or copy it.
|
||||
*
|
||||
* Don't Implement.
|
||||
* A helper responsible for creating new {@link IGridNode}, {@link IGridConnection} or potentially similar tasks.
|
||||
*
|
||||
* @author yueh
|
||||
* @version rv5
|
||||
* @since rv5
|
||||
*/
|
||||
public interface IAETagCompound
|
||||
public interface IGridHelper
|
||||
{
|
||||
|
||||
/**
|
||||
* @return a copy ( the copy will not be a IAETagCompound, it will be a NBTTagCompound )
|
||||
* 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
|
||||
*/
|
||||
NBTTagCompound getNBTTagCompoundCopy();
|
||||
IGridNode createGridNode( IGridBlock block );
|
||||
|
||||
/**
|
||||
* compare to other NBTTagCompounds or IAETagCompounds
|
||||
* 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
|
||||
*
|
||||
* @param a compared object
|
||||
*
|
||||
* @return true, if they are the same.
|
||||
* @throws appeng.api.exceptions.FailedConnectionException
|
||||
*/
|
||||
@Override
|
||||
boolean equals( Object a );
|
||||
IGridConnection createGridConnection( IGridNode a, IGridNode b ) throws FailedConnectionException;
|
||||
|
||||
/**
|
||||
* @return the special comparison for this tag
|
||||
*/
|
||||
IItemComparison getSpecialComparison();
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
package appeng.api.networking.crafting;
|
||||
|
||||
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IBaseMonitor;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
||||
@@ -40,7 +40,7 @@ public interface ICraftingCPU extends IBaseMonitor<IAEItemStack>
|
||||
/**
|
||||
* @return the action source for the CPU.
|
||||
*/
|
||||
BaseActionSource getActionSource();
|
||||
IActionSource getActionSource();
|
||||
|
||||
/**
|
||||
* @return the available storage in bytes
|
||||
|
||||
@@ -33,7 +33,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridCache;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public interface ICraftingGrid extends IGridCache
|
||||
* @return a future which will at an undetermined point in the future get you the {@link ICraftingJob} do not wait
|
||||
* on this, your be waiting forever.
|
||||
*/
|
||||
Future<ICraftingJob> beginCraftingJob( World world, IGrid grid, BaseActionSource actionSrc, IAEItemStack craftWhat, ICraftingCallback callback );
|
||||
Future<ICraftingJob> beginCraftingJob( World world, IGrid grid, IActionSource actionSrc, IAEItemStack craftWhat, ICraftingCallback callback );
|
||||
|
||||
/**
|
||||
* Submit the job to the Crafting system for processing.
|
||||
@@ -82,7 +82,7 @@ public interface ICraftingGrid extends IGridCache
|
||||
* {@link ICraftingRequester} methods. if you send null, this object should be discarded after verifying the
|
||||
* return state.
|
||||
*/
|
||||
ICraftingLink submitJob( ICraftingJob job, ICraftingRequester requestingMachine, ICraftingCPU target, boolean prioritizePower, BaseActionSource src );
|
||||
ICraftingLink submitJob( ICraftingJob job, ICraftingRequester requestingMachine, ICraftingCPU target, boolean prioritizePower, IActionSource src );
|
||||
|
||||
/**
|
||||
* @return list of all the crafting cpus on the grid
|
||||
|
||||
@@ -24,7 +24,10 @@
|
||||
package appeng.api.networking.energy;
|
||||
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
|
||||
@@ -35,17 +38,91 @@ import appeng.api.config.Actionable;
|
||||
public interface IEnergyGridProvider
|
||||
{
|
||||
/**
|
||||
* internal use only
|
||||
*
|
||||
* Can return a list of providers behind the current.
|
||||
*
|
||||
* An example would be something acting as proxy between different {@link IEnergyGrid}s.
|
||||
*
|
||||
* This can contain duplicate entries, AE will ensure that each provider is only visited once.
|
||||
*
|
||||
* internal use only
|
||||
*/
|
||||
double extractAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen );
|
||||
@Nonnull
|
||||
Collection<IEnergyGridProvider> providers();
|
||||
|
||||
/**
|
||||
* internal use only
|
||||
*
|
||||
* Extracts the requested amount from the provider.
|
||||
*
|
||||
* This should never forward a call to another {@link IEnergyGridProvider}, instead return them via
|
||||
* {@link IEnergyGridProvider#providers()}
|
||||
*
|
||||
* @return the used amount
|
||||
*/
|
||||
double injectAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen );
|
||||
@Nonnegative
|
||||
double extractProviderPower( @Nonnegative double amt, @Nonnull Actionable mode );
|
||||
|
||||
/**
|
||||
* Injects the offered amount into the provider.
|
||||
*
|
||||
* This should never forward a call to another {@link IEnergyGridProvider}, instead return them via
|
||||
* {@link IEnergyGridProvider#providers()}
|
||||
*
|
||||
* internal use only
|
||||
*
|
||||
* @return the leftover amount
|
||||
*/
|
||||
@Nonnegative
|
||||
double injectProviderPower( @Nonnegative double amt, @Nonnull Actionable mode );
|
||||
|
||||
/**
|
||||
* internal use only
|
||||
*
|
||||
* Returns the current demand of an provider.
|
||||
*
|
||||
* This should never forward a call to another {@link IEnergyGridProvider}, instead return them via
|
||||
* {@link IEnergyGridProvider#providers()}
|
||||
*
|
||||
*
|
||||
* @param d the max amount offered, the demand should never exceed it.
|
||||
* @return the total amount demanded
|
||||
*/
|
||||
double getEnergyDemand( double d, Set<IEnergyGrid> seen );
|
||||
@Nonnegative
|
||||
double getProviderEnergyDemand( @Nonnegative double d );
|
||||
|
||||
/**
|
||||
* internal use only
|
||||
*
|
||||
* AE currently uses this to enqueue the next visited provider.
|
||||
*
|
||||
* There is no guarantee that this works on in a perfect way.
|
||||
* It can be limited to the returns of the past {@link IEnergyGridProvider#providers()}, but not any future one
|
||||
* discovered by visiting further providers.
|
||||
*
|
||||
* E.g. inject into the the lowest one first or extract from the highest one.
|
||||
*
|
||||
* @return the current stored amount.
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Nonnegative
|
||||
double getProviderStoredEnergy();
|
||||
|
||||
/**
|
||||
* internal use only
|
||||
*
|
||||
* AE currently uses this to enqueue the next visited provider.
|
||||
*
|
||||
* There is no guarantee that this works on in a perfect way.
|
||||
* It can be limited to the returns of the past {@link IEnergyGridProvider#providers()}, but not any future one
|
||||
* discovered by visiting further providers.
|
||||
*
|
||||
* E.g. inject into the the lowest one first or extract from the highest one.
|
||||
*
|
||||
* @return the maximum amount stored.
|
||||
*/
|
||||
@Nonnegative
|
||||
double getProviderMaxEnergy();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -24,11 +24,10 @@
|
||||
package appeng.api.networking.security;
|
||||
|
||||
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
|
||||
|
||||
public interface IActionHost extends IGridHost
|
||||
public interface IActionHost
|
||||
{
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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.networking.security;
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
|
||||
/**
|
||||
* The source of any action.
|
||||
*
|
||||
* This can either be a {@link EntityPlayer} or an {@link IActionHost}.
|
||||
*
|
||||
* In most cases this is used for security checks, but can be used to validate the source itself.
|
||||
*
|
||||
*/
|
||||
public interface IActionSource
|
||||
{
|
||||
|
||||
/**
|
||||
* If present, AE will consider the player being the source for the action.
|
||||
*
|
||||
* This will take precedence over {@link IActionSource#machine()} in any case.
|
||||
*
|
||||
* @return An optional player issuing the action.
|
||||
*/
|
||||
@Nonnull
|
||||
Optional<EntityPlayer> player();
|
||||
|
||||
/**
|
||||
* If present, it indicates the {@link IActionHost} of the source.
|
||||
*
|
||||
* Should {@link IActionSource#player()} be absent, it will consider a machine as source.
|
||||
*
|
||||
* It is recommended to include the machine even when a player is present.
|
||||
*
|
||||
* @return An optional machine issuing the action or acting as proxy for a player.
|
||||
*/
|
||||
@Nonnull
|
||||
Optional<IActionHost> machine();
|
||||
|
||||
/**
|
||||
* An {@link IActionSource} can have multiple optional contexts.
|
||||
*
|
||||
* It is strongly recommended to limit the uses for absolutely necessary cases.
|
||||
*
|
||||
* Currently there are no public contexts made available by AE.
|
||||
* An example would be the context interfaces use internally to avoid looping items between each other.
|
||||
*/
|
||||
@Nonnull
|
||||
<T> Optional<T> context( @Nonnull Class<T> key );
|
||||
}
|
||||
@@ -1,44 +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.networking.security;
|
||||
|
||||
/**
|
||||
* TODO: Consider refactoring.
|
||||
*/
|
||||
public class MachineSource extends BaseActionSource
|
||||
{
|
||||
|
||||
public final IActionHost via;
|
||||
|
||||
public MachineSource( final IActionHost v )
|
||||
{
|
||||
this.via = v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMachine()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,49 +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.networking.security;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
/**
|
||||
* TODO: Consider refactoring.
|
||||
*/
|
||||
public class PlayerSource extends BaseActionSource
|
||||
{
|
||||
|
||||
public final EntityPlayer player;
|
||||
public final IActionHost via;
|
||||
|
||||
public PlayerSource( final EntityPlayer p, final IActionHost v )
|
||||
{
|
||||
this.player = p;
|
||||
this.via = v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlayer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -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>>
|
||||
{
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
package appeng.api.networking.storage;
|
||||
|
||||
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
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, BaseActionSource src, StorageChannel chan );
|
||||
void onStackChange( IItemList<?> o, IAEStack<?> fullStack, IAEStack<?> diffStack, IActionSource src, IStorageChannel<?> chan );
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ package appeng.api.networking.storage;
|
||||
|
||||
import appeng.api.networking.IGridCache;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
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, BaseActionSource src );
|
||||
void postAlterationOfStoredItems( IStorageChannel<?> chan, Iterable<? extends IAEStack<?>> input, IActionSource src );
|
||||
|
||||
/**
|
||||
* Used to add a cell provider to the storage system
|
||||
|
||||
@@ -26,11 +26,11 @@ 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;
|
||||
|
||||
@Deprecated
|
||||
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,10 +26,10 @@ 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;
|
||||
|
||||
@Deprecated
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ package appeng.api.recipes;
|
||||
/**
|
||||
* Represents the AE2 Recipe Loading/Reading Class
|
||||
*/
|
||||
@Deprecated
|
||||
public interface IRecipeHandler
|
||||
{
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.io.BufferedReader;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
@Deprecated
|
||||
public interface IRecipeLoader
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
@@ -25,7 +25,7 @@ package appeng.api.storage;
|
||||
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
|
||||
@@ -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, BaseActionSource 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, BaseActionSource 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(...)
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
package appeng.api.storage;
|
||||
|
||||
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
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, BaseActionSource 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,41 @@
|
||||
/*
|
||||
* 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.api.storage;
|
||||
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public interface ISpatialDimension
|
||||
{
|
||||
World getWorld();
|
||||
|
||||
int createNewCellDimension( BlockPos contentSize, int playerId );
|
||||
|
||||
void deleteCellDimension( int cellDimId );
|
||||
|
||||
boolean isCellDimension( int cellDimID );
|
||||
|
||||
int getCellDimensionOwner( int cellDimId );
|
||||
|
||||
BlockPos getCellDimensionOrigin( int cellDimId );
|
||||
|
||||
BlockPos getCellContentSize( int cellDimId );
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* 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>>
|
||||
{
|
||||
|
||||
/**
|
||||
* Can be used as factor for transferring stacks of a channel.
|
||||
*
|
||||
* E.g. used by IO Ports to transfer 1000 mB, not 1 mB to match the
|
||||
* item channel transferring a full bucket per operation.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
default int transferFactor()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.BaseActionSource;
|
||||
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, BaseActionSource src );
|
||||
|
||||
/**
|
||||
* use energy from energy, to inject input items into cell, at the request of src
|
||||
*
|
||||
* @param energy to be added energy source
|
||||
* @param cell injected cell
|
||||
* @param input to be injected items
|
||||
* @param src action source
|
||||
*
|
||||
* @return items that failed to insert.
|
||||
*/
|
||||
IAEItemStack poweredInsert( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack input, BaseActionSource 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();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ package appeng.api.storage;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
|
||||
|
||||
/**
|
||||
@@ -22,5 +22,5 @@ public interface IStorageMonitorableAccessor
|
||||
* @return Null if the network cannot be accessed by the given action source (i.e. security doesn't permit it).
|
||||
*/
|
||||
@Nullable
|
||||
IStorageMonitorable getInventory( BaseActionSource src );
|
||||
IStorageMonitorable getInventory( IActionSource src );
|
||||
}
|
||||
|
||||
@@ -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.storage;
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
public enum StorageChannel
|
||||
{
|
||||
/**
|
||||
* AE2's Default Storage.
|
||||
*/
|
||||
ITEMS( IAEItemStack.class ),
|
||||
|
||||
/**
|
||||
* AE2's Fluid Based Storage ( mainly added to better support ExtraCells )
|
||||
*/
|
||||
FLUIDS( IAEFluidStack.class );
|
||||
|
||||
public final Class<? extends IAEStack> type;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
-15
@@ -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,21 +21,14 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package appeng.api.networking.security;
|
||||
package appeng.api.storage.channels;
|
||||
|
||||
/**
|
||||
* TODO: Consider refactoring.
|
||||
*/
|
||||
public class BaseActionSource
|
||||
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
|
||||
|
||||
public interface IFluidStorageChannel extends IStorageChannel<IAEFluidStack>
|
||||
{
|
||||
|
||||
public boolean isPlayer()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isMachine()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
{
|
||||
@@ -46,7 +46,7 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
|
||||
*
|
||||
* @return new ItemStack
|
||||
*/
|
||||
ItemStack getItemStack();
|
||||
ItemStack createItemStack();
|
||||
|
||||
/**
|
||||
* is there NBT Data for this item?
|
||||
@@ -105,4 +105,11 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
|
||||
* @return true if it is the same type (same item, damage, nbt)
|
||||
*/
|
||||
boolean isSameType( ItemStack stored );
|
||||
|
||||
/**
|
||||
* DO NOT MODIFY THIS STACK! NEVER. If you think about it .. DON'T
|
||||
*
|
||||
* @return definition stack
|
||||
*/
|
||||
ItemStack getDefinition();
|
||||
}
|
||||
@@ -28,13 +28,14 @@ import java.io.IOException;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
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>
|
||||
public interface IAEStack<T extends IAEStack<T>>
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -42,7 +43,7 @@ public interface IAEStack<StackType extends IAEStack>
|
||||
*
|
||||
* @param is added item
|
||||
*/
|
||||
void add( StackType is );
|
||||
void add( T is );
|
||||
|
||||
/**
|
||||
* number of items in the stack.
|
||||
@@ -56,7 +57,7 @@ public interface IAEStack<StackType extends IAEStack>
|
||||
*
|
||||
* @param stackSize , ItemStack.stackSize = N
|
||||
*/
|
||||
StackType setStackSize( long stackSize );
|
||||
T setStackSize( long stackSize );
|
||||
|
||||
/**
|
||||
* Same as getStackSize, but for requestable items. ( LP )
|
||||
@@ -70,7 +71,7 @@ public interface IAEStack<StackType extends IAEStack>
|
||||
*
|
||||
* @return basically itemStack.stackSize = N but for setStackSize items.
|
||||
*/
|
||||
StackType setCountRequestable( long countRequestable );
|
||||
T setCountRequestable( long countRequestable );
|
||||
|
||||
/**
|
||||
* true, if the item can be crafted.
|
||||
@@ -84,12 +85,12 @@ public interface IAEStack<StackType extends IAEStack>
|
||||
*
|
||||
* @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.
|
||||
@@ -173,21 +174,14 @@ public interface IAEStack<StackType extends IAEStack>
|
||||
*
|
||||
* @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();
|
||||
|
||||
/**
|
||||
* obtain the NBT Data for the item.
|
||||
*
|
||||
* @return nbt data
|
||||
*/
|
||||
IAETagCompound getTagCompound();
|
||||
T empty();
|
||||
|
||||
/**
|
||||
* @return true if the stack is a {@link IAEItemStack}
|
||||
@@ -202,16 +196,12 @@ public interface IAEStack<StackType extends IAEStack>
|
||||
/**
|
||||
* @return ITEM or FLUID
|
||||
*/
|
||||
StorageChannel getChannel();
|
||||
IStorageChannel<T> getChannel();
|
||||
|
||||
/**
|
||||
* @return true if it should show the crafting label.
|
||||
* Returns itemstack for display and similar purposes. Always has a count of 1.
|
||||
*
|
||||
* @return itemstack
|
||||
*/
|
||||
boolean getShowCraftingLabel();
|
||||
|
||||
/**
|
||||
* Used internally to show that it should show a Crafting label instead of a "1"
|
||||
*/
|
||||
void setShowCraftingLabel( boolean showCraftingLabel );
|
||||
|
||||
ItemStack asItemStackRepresentation();
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -46,6 +46,11 @@ public enum AECableType
|
||||
*/
|
||||
SMART,
|
||||
|
||||
/**
|
||||
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
||||
*/
|
||||
DENSE_COVERED,
|
||||
|
||||
/**
|
||||
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
||||
*/
|
||||
@@ -55,6 +60,7 @@ public enum AECableType
|
||||
GLASS,
|
||||
COVERED,
|
||||
SMART,
|
||||
DENSE_COVERED,
|
||||
DENSE_SMART
|
||||
};
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -31,6 +31,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
@@ -66,67 +67,39 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
|
||||
.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
||||
}
|
||||
|
||||
private double getMaxEnergyCapacity()
|
||||
@Override
|
||||
public double injectAEPower( final ItemStack is, double amount, Actionable mode )
|
||||
{
|
||||
final Block blockID = Block.getBlockFromItem( this );
|
||||
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell();
|
||||
return energyCell.maybeBlock().map( block ->
|
||||
final double internalCurrentPower = this.getInternal( is );
|
||||
final double internalMaxPower = this.getAEMaxPower( is );
|
||||
final double required = internalMaxPower - internalCurrentPower;
|
||||
final double overflow = Math.max( 0, amount - required );
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
if( blockID == block )
|
||||
{
|
||||
return 200000;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 8 * 200000;
|
||||
}
|
||||
} ).orElse( 0 );
|
||||
final double toAdd = Math.min( required, amount );
|
||||
final double newPowerStored = internalCurrentPower + toAdd;
|
||||
|
||||
this.setInternal( is, newPowerStored );
|
||||
}
|
||||
|
||||
return overflow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double injectAEPower( final ItemStack is, double amt )
|
||||
public double extractAEPower( final ItemStack is, double amount, Actionable mode )
|
||||
{
|
||||
double internalCurrentPower = this.getInternal( is );
|
||||
final double internalMaxPower = this.getMaxEnergyCapacity();
|
||||
internalCurrentPower += amt;
|
||||
if( internalCurrentPower > internalMaxPower )
|
||||
final double internalCurrentPower = this.getInternal( is );
|
||||
final double fulfillable = Math.min( amount, internalCurrentPower );
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
amt = internalCurrentPower - internalMaxPower;
|
||||
internalCurrentPower = internalMaxPower;
|
||||
this.setInternal( is, internalCurrentPower );
|
||||
return amt;
|
||||
final double newPowerStored = internalCurrentPower - fulfillable;
|
||||
|
||||
this.setInternal( is, newPowerStored );
|
||||
}
|
||||
|
||||
this.setInternal( is, internalCurrentPower );
|
||||
return 0;
|
||||
}
|
||||
|
||||
private double getInternal( final ItemStack is )
|
||||
{
|
||||
final NBTTagCompound nbt = Platform.openNbtData( is );
|
||||
return nbt.getDouble( "internalCurrentPower" );
|
||||
}
|
||||
|
||||
private void setInternal( final ItemStack is, final double amt )
|
||||
{
|
||||
final NBTTagCompound nbt = Platform.openNbtData( is );
|
||||
nbt.setDouble( "internalCurrentPower", amt );
|
||||
}
|
||||
|
||||
@Override
|
||||
public double extractAEPower( final ItemStack is, double amt )
|
||||
{
|
||||
double internalCurrentPower = this.getInternal( is );
|
||||
if( internalCurrentPower > amt )
|
||||
{
|
||||
internalCurrentPower -= amt;
|
||||
this.setInternal( is, internalCurrentPower );
|
||||
return amt;
|
||||
}
|
||||
|
||||
amt = internalCurrentPower;
|
||||
this.setInternal( is, 0 );
|
||||
return amt;
|
||||
return fulfillable;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,4 +119,34 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
|
||||
{
|
||||
return AccessRestriction.WRITE;
|
||||
}
|
||||
|
||||
private double getMaxEnergyCapacity()
|
||||
{
|
||||
final Block blockID = Block.getBlockFromItem( this );
|
||||
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell();
|
||||
|
||||
return energyCell.maybeBlock().map( block ->
|
||||
{
|
||||
if( blockID == block )
|
||||
{
|
||||
return 200000;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 8 * 200000;
|
||||
}
|
||||
} ).orElse( 0 );
|
||||
}
|
||||
|
||||
private double getInternal( final ItemStack is )
|
||||
{
|
||||
final NBTTagCompound nbt = Platform.openNbtData( is );
|
||||
return nbt.getDouble( "internalCurrentPower" );
|
||||
}
|
||||
|
||||
private void setInternal( final ItemStack is, final double amt )
|
||||
{
|
||||
final NBTTagCompound nbt = Platform.openNbtData( is );
|
||||
nbt.setDouble( "internalCurrentPower", amt );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -32,6 +33,7 @@ import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
|
||||
@@ -164,4 +166,16 @@ public class BlockCrank extends AEBaseTileBlock
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceTorchOnTop( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape( IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face )
|
||||
{
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,13 +37,17 @@ import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.entity.EntityIds;
|
||||
import appeng.entity.EntityTinyTNTPrimed;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
|
||||
@@ -54,15 +58,24 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||
public BlockTinyTNT()
|
||||
{
|
||||
super( Material.TNT );
|
||||
this.setLightOpacity( 1 );
|
||||
|
||||
this.boundingBox = new AxisAlignedBB( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
|
||||
this.setLightOpacity( 2 );
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
|
||||
this.setSoundType( SoundType.GROUND );
|
||||
this.setHardness( 0F );
|
||||
|
||||
// TODO: 1.11
|
||||
// EntityRegistry.registerModEntity( EntityTinyTNTPrimed.class, "EntityTinyTNTPrimed", EntityIds.get(
|
||||
// EntityTinyTNTPrimed.class ), AppEng.instance(), 16, 4, true );
|
||||
EntityRegistry.registerModEntity( new ResourceLocation( AppEng.MOD_ID, EntityTinyTNTPrimed.class.getName() ), EntityTinyTNTPrimed.class,
|
||||
"EntityTinyTNTPrimed", EntityIds.get( EntityTinyTNTPrimed.class ), AppEng.instance(), 16, 4, true );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube( IBlockState state )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -74,13 +74,8 @@ public class BlockDrive extends AEBaseTileBlock
|
||||
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
TileDrive te = this.getTileEntity( world, pos );
|
||||
if( te == null )
|
||||
{
|
||||
return super.getExtendedState( state, world, pos );
|
||||
}
|
||||
|
||||
IExtendedBlockState extState = (IExtendedBlockState) super.getExtendedState( state, world, pos );
|
||||
return extState.withProperty( SLOTS_STATE, DriveSlotsState.fromChestOrDrive( te ) );
|
||||
return extState.withProperty( SLOTS_STATE, te == null ? DriveSlotsState.createEmpty( 10 ) : DriveSlotsState.fromChestOrDrive( te ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,9 +47,9 @@ import appeng.util.Platform;
|
||||
public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
|
||||
{
|
||||
|
||||
private static final double AABB_OFFSET_BOTTOM = .0625d;
|
||||
private static final double AABB_OFFSET_SIDES = 0;
|
||||
private static final double AABB_OFFSET_TOP = .125d;
|
||||
private static final double AABB_OFFSET_BOTTOM = 0.00;
|
||||
private static final double AABB_OFFSET_SIDES = 0.06;
|
||||
private static final double AABB_OFFSET_TOP = 0.125;
|
||||
|
||||
public enum SkyChestType
|
||||
{
|
||||
@@ -111,18 +111,18 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
|
||||
o = sk.getUp();
|
||||
}
|
||||
|
||||
final double offsetX = o.getFrontOffsetX() == 0 ? AABB_OFFSET_BOTTOM : AABB_OFFSET_SIDES;
|
||||
final double offsetY = o.getFrontOffsetY() == 0 ? AABB_OFFSET_BOTTOM : AABB_OFFSET_SIDES;
|
||||
final double offsetZ = o.getFrontOffsetZ() == 0 ? AABB_OFFSET_BOTTOM : AABB_OFFSET_SIDES;
|
||||
final double offsetX = o.getFrontOffsetX() == 0 ? AABB_OFFSET_SIDES : 0.0;
|
||||
final double offsetY = o.getFrontOffsetY() == 0 ? AABB_OFFSET_SIDES : 0.0;
|
||||
final double offsetZ = o.getFrontOffsetZ() == 0 ? AABB_OFFSET_SIDES : 0.0;
|
||||
|
||||
// x/z needs to be multiplied by -1, thus we simply add not substract.
|
||||
final double minX = Math.max( 0.0, offsetX + o.getFrontOffsetX() * AABB_OFFSET_TOP );
|
||||
final double minY = Math.max( 0.0, offsetY - o.getFrontOffsetY() * AABB_OFFSET_TOP );
|
||||
final double minZ = Math.max( 0.0, offsetZ + o.getFrontOffsetZ() * AABB_OFFSET_TOP );
|
||||
// for x/z top and bottom is swapped
|
||||
final double minX = Math.max( 0.0, offsetX + ( o.getFrontOffsetX() < 0 ? AABB_OFFSET_BOTTOM : ( o.getFrontOffsetX() * AABB_OFFSET_TOP ) ) );
|
||||
final double minY = Math.max( 0.0, offsetY + ( o.getFrontOffsetY() < 0 ? AABB_OFFSET_TOP : ( o.getFrontOffsetY() * AABB_OFFSET_BOTTOM ) ) );
|
||||
final double minZ = Math.max( 0.0, offsetZ + ( o.getFrontOffsetZ() < 0 ? AABB_OFFSET_BOTTOM : ( o.getFrontOffsetZ() * AABB_OFFSET_TOP ) ) );
|
||||
|
||||
final double maxX = Math.min( 1.0, ( 1.0 - offsetX ) + o.getFrontOffsetX() * AABB_OFFSET_TOP );
|
||||
final double maxY = Math.min( 1.0, ( 1.0 - offsetY ) - o.getFrontOffsetY() * AABB_OFFSET_TOP );
|
||||
final double maxZ = Math.min( 1.0, ( 1.0 - offsetZ ) + o.getFrontOffsetZ() * AABB_OFFSET_TOP );
|
||||
final double maxX = Math.min( 1.0, 1.0 - offsetX - ( o.getFrontOffsetX() < 0 ? AABB_OFFSET_TOP : ( o.getFrontOffsetX() * AABB_OFFSET_BOTTOM ) ) );
|
||||
final double maxY = Math.min( 1.0, 1.0 - offsetY - ( o.getFrontOffsetY() < 0 ? AABB_OFFSET_BOTTOM : ( o.getFrontOffsetY() * AABB_OFFSET_TOP ) ) );
|
||||
final double maxZ = Math.min( 1.0, 1.0 - offsetZ - ( o.getFrontOffsetZ() < 0 ? AABB_OFFSET_TOP : ( o.getFrontOffsetZ() * AABB_OFFSET_BOTTOM ) ) );
|
||||
|
||||
return new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ );
|
||||
}
|
||||
|
||||
@@ -75,4 +75,14 @@ public class DriveSlotsState
|
||||
}
|
||||
return new DriveSlotsState( slots );
|
||||
}
|
||||
|
||||
public static DriveSlotsState createEmpty( int slotCount )
|
||||
{
|
||||
DriveSlotState[] slots = new DriveSlotState[slotCount];
|
||||
for( int i = 0; i < slotCount; i++ )
|
||||
{
|
||||
slots[i] = DriveSlotState.EMPTY;
|
||||
}
|
||||
return new DriveSlotsState( slots );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -42,11 +42,13 @@ import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.block.AEBaseItemBlock;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.bootstrap.components.IBlockRegistrationComponent;
|
||||
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||
import appeng.bootstrap.components.IPreInitComponent;
|
||||
import appeng.bootstrap.definitions.TileEntityDefinition;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.core.Registration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.ActivityState;
|
||||
import appeng.core.features.BlockDefinition;
|
||||
@@ -65,13 +67,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
||||
|
||||
private final Supplier<? extends Block> blockSupplier;
|
||||
|
||||
private final List<BiConsumer<Block, Item>> preInitCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<BiConsumer<Block, Item>> initCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<BiConsumer<Block, Item>> modelRegCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<BiConsumer<Block, Item>> postInitCallbacks = new ArrayList<>();
|
||||
private final List<BiFunction<Block, Item, IBootstrapComponent>> bootstrapComponents = new ArrayList<>();
|
||||
|
||||
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
|
||||
|
||||
@@ -103,30 +99,9 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDefinitionBuilder preInit( BiConsumer<Block, Item> callback )
|
||||
public BlockDefinitionBuilder bootstrap( BiFunction<Block, Item, IBootstrapComponent> callback )
|
||||
{
|
||||
this.preInitCallbacks.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDefinitionBuilder init( BiConsumer<Block, Item> callback )
|
||||
{
|
||||
this.initCallbacks.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDefinitionBuilder modelRegInit( BiConsumer<Block, Item> callback )
|
||||
{
|
||||
this.modelRegCallbacks.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDefinitionBuilder postInit( BiConsumer<Block, Item> callback )
|
||||
{
|
||||
this.postInitCallbacks.add( callback );
|
||||
this.bootstrapComponents.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -221,22 +196,16 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
||||
}
|
||||
|
||||
// Register the item and block with the game
|
||||
this.factory.addPreInit( side ->
|
||||
this.factory.addBootstrapComponent( (IBlockRegistrationComponent) ( side, registry ) -> registry.register( block ) );
|
||||
if( item != null )
|
||||
{
|
||||
Registration.addBlockToRegister( block );
|
||||
if( item != null )
|
||||
{
|
||||
Registration.addItemToRegister( item );
|
||||
}
|
||||
} );
|
||||
this.factory.addBootstrapComponent( (IItemRegistrationComponent) ( side, registry ) -> registry.register( item ) );
|
||||
}
|
||||
|
||||
block.setCreativeTab( this.creativeTab );
|
||||
|
||||
// Register all extra handlers
|
||||
this.preInitCallbacks.forEach( consumer -> this.factory.addPreInit( side -> consumer.accept( block, item ) ) );
|
||||
this.initCallbacks.forEach( consumer -> this.factory.addInit( side -> consumer.accept( block, item ) ) );
|
||||
this.modelRegCallbacks.forEach( consumer -> this.factory.addModelReg( side -> consumer.accept( block, item ) ) );
|
||||
this.postInitCallbacks.forEach( consumer -> this.factory.addPostInit( side -> consumer.accept( block, item ) ) );
|
||||
this.bootstrapComponents.forEach( component -> this.factory.addBootstrapComponent( component.apply( block, item ) ) );
|
||||
|
||||
if( this.tileEntityDefinition != null && block instanceof AEBaseTileBlock )
|
||||
{
|
||||
@@ -268,7 +237,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
||||
|
||||
if( block instanceof AEBaseTileBlock )
|
||||
{
|
||||
this.factory.addPreInit( side ->
|
||||
this.factory.addBootstrapComponent( (IPreInitComponent) side ->
|
||||
{
|
||||
AEBaseTile.registerTileItem(
|
||||
this.tileEntityDefinition == null ? ( (AEBaseTileBlock) block ).getTileEntityClass() : this.tileEntityDefinition.getTileEntityClass(),
|
||||
|
||||
@@ -110,13 +110,13 @@ class BlockRendering implements IBlockRendering
|
||||
|
||||
if( this.modelCustomizer != null )
|
||||
{
|
||||
factory.modelOverrideComponent.addOverride( block.getRegistryName().getResourcePath(), this.modelCustomizer );
|
||||
factory.addModelOverride( block.getRegistryName().getResourcePath(), this.modelCustomizer );
|
||||
}
|
||||
else if( block instanceof AEBaseTileBlock )
|
||||
{
|
||||
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
|
||||
// extended props
|
||||
factory.modelOverrideComponent.addOverride( block.getRegistryName().getResourcePath(), ( l, m ) -> new AutoRotatingModel( m ) );
|
||||
factory.addModelOverride( block.getRegistryName().getResourcePath(), ( l, m ) -> new AutoRotatingModel( m ) );
|
||||
}
|
||||
|
||||
// TODO : 1.12
|
||||
|
||||
@@ -20,10 +20,18 @@ package appeng.bootstrap;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -33,11 +41,7 @@ import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
import appeng.bootstrap.components.BuiltInModelComponent;
|
||||
import appeng.bootstrap.components.InitComponent;
|
||||
import appeng.bootstrap.components.ModelOverrideComponent;
|
||||
import appeng.bootstrap.components.ModelRegComponent;
|
||||
import appeng.bootstrap.components.PostInitComponent;
|
||||
import appeng.bootstrap.components.PreInitComponent;
|
||||
import appeng.bootstrap.components.TileEntityComponent;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.ActivityState;
|
||||
@@ -51,10 +55,10 @@ public class FeatureFactory
|
||||
|
||||
private final AEFeature[] defaultFeatures;
|
||||
|
||||
private final List<IBootstrapComponent> bootstrapComponents;
|
||||
private final Map<Class<? extends IBootstrapComponent>, List<IBootstrapComponent>> bootstrapComponents;
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
ModelOverrideComponent modelOverrideComponent;
|
||||
private ModelOverrideComponent modelOverrideComponent;
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
private BuiltInModelComponent builtInModelComponent;
|
||||
@@ -64,18 +68,18 @@ public class FeatureFactory
|
||||
public FeatureFactory()
|
||||
{
|
||||
this.defaultFeatures = new AEFeature[] { AEFeature.CORE };
|
||||
this.bootstrapComponents = new ArrayList<>();
|
||||
this.bootstrapComponents = new HashMap<>();
|
||||
|
||||
this.tileEntityComponent = new TileEntityComponent();
|
||||
this.bootstrapComponents.add( this.tileEntityComponent );
|
||||
this.addBootstrapComponent( this.tileEntityComponent );
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
this.modelOverrideComponent = new ModelOverrideComponent();
|
||||
this.bootstrapComponents.add( this.modelOverrideComponent );
|
||||
this.addBootstrapComponent( this.modelOverrideComponent );
|
||||
|
||||
this.builtInModelComponent = new BuiltInModelComponent();
|
||||
this.bootstrapComponents.add( this.builtInModelComponent );
|
||||
this.addBootstrapComponent( this.builtInModelComponent );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,29 +127,16 @@ public class FeatureFactory
|
||||
return new FeatureFactory( this, features );
|
||||
}
|
||||
|
||||
void addBootstrapComponent( IBootstrapComponent component )
|
||||
public void addBootstrapComponent( IBootstrapComponent component )
|
||||
{
|
||||
this.bootstrapComponents.add( component );
|
||||
Arrays.stream( component.getClass().getInterfaces() )
|
||||
.filter( i -> IBootstrapComponent.class.isAssignableFrom( i ) )
|
||||
.forEach( i -> this.addBootstrapComponent( (Class<? extends IBootstrapComponent>) i, component ) );
|
||||
}
|
||||
|
||||
void addPreInit( PreInitComponent component )
|
||||
private <T extends IBootstrapComponent> void addBootstrapComponent( Class<? extends IBootstrapComponent> eventType, T component )
|
||||
{
|
||||
this.bootstrapComponents.add( component );
|
||||
}
|
||||
|
||||
void addInit( InitComponent component )
|
||||
{
|
||||
this.bootstrapComponents.add( component );
|
||||
}
|
||||
|
||||
void addModelReg( ModelRegComponent component )
|
||||
{
|
||||
this.bootstrapComponents.add( component );
|
||||
}
|
||||
|
||||
void addPostInit( PostInitComponent component )
|
||||
{
|
||||
this.bootstrapComponents.add( component );
|
||||
bootstrapComponents.computeIfAbsent( eventType, c -> new ArrayList<IBootstrapComponent>() ).add( component );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@@ -154,8 +145,14 @@ public class FeatureFactory
|
||||
this.builtInModelComponent.addModel( path, model );
|
||||
}
|
||||
|
||||
public List<IBootstrapComponent> getBootstrapComponents()
|
||||
@SideOnly( Side.CLIENT )
|
||||
void addModelOverride( String resourcePath, BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer )
|
||||
{
|
||||
return this.bootstrapComponents;
|
||||
this.modelOverrideComponent.addOverride( resourcePath, customizer );
|
||||
}
|
||||
|
||||
public <T extends IBootstrapComponent> Iterator<T> getBootstrapComponents( Class<T> eventType )
|
||||
{
|
||||
return (Iterator<T>) this.bootstrapComponents.getOrDefault( eventType, Collections.emptyList() ).iterator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.bootstrap;
|
||||
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -33,14 +33,7 @@ import appeng.core.features.AEFeature;
|
||||
|
||||
public interface IBlockBuilder
|
||||
{
|
||||
|
||||
IBlockBuilder preInit( BiConsumer<Block, Item> callback );
|
||||
|
||||
IBlockBuilder init( BiConsumer<Block, Item> callback );
|
||||
|
||||
IBlockBuilder modelRegInit( BiConsumer<Block, Item> callback );
|
||||
|
||||
IBlockBuilder postInit( BiConsumer<Block, Item> callback );
|
||||
IBlockBuilder bootstrap( BiFunction<Block, Item, IBootstrapComponent> component );
|
||||
|
||||
IBlockBuilder features( AEFeature... features );
|
||||
|
||||
|
||||
@@ -19,28 +19,10 @@
|
||||
package appeng.bootstrap;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
|
||||
/**
|
||||
* Bootstrap components can be registered to take part in the various initialization phases of Forge.
|
||||
* See the individual subclasses for a specific forge initalization event.
|
||||
*/
|
||||
public interface IBootstrapComponent
|
||||
{
|
||||
|
||||
default void preInitialize( Side side )
|
||||
{
|
||||
}
|
||||
|
||||
default void modelReg( Side side )
|
||||
{
|
||||
}
|
||||
|
||||
default void initialize( Side side )
|
||||
{
|
||||
}
|
||||
|
||||
default void postInitialize( Side side )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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.bootstrap;
|
||||
|
||||
|
||||
import net.minecraft.advancements.ICriterionInstance;
|
||||
import net.minecraft.advancements.ICriterionTrigger;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface ICriterionTriggerRegistry
|
||||
{
|
||||
void register( ICriterionTrigger<? extends ICriterionInstance> trigger );
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.bootstrap;
|
||||
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -36,12 +36,7 @@ import appeng.core.features.ItemDefinition;
|
||||
*/
|
||||
public interface IItemBuilder
|
||||
{
|
||||
|
||||
IItemBuilder preInit( Consumer<Item> callback );
|
||||
|
||||
IItemBuilder init( Consumer<Item> callback );
|
||||
|
||||
IItemBuilder postInit( Consumer<Item> callback );
|
||||
IItemBuilder bootstrap( Function<Item, IBootstrapComponent> component );
|
||||
|
||||
IItemBuilder features( AEFeature... features );
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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.bootstrap;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
|
||||
public interface IModelRegistry
|
||||
{
|
||||
void registerItemVariants( Item item, ResourceLocation... names );
|
||||
|
||||
void setCustomModelResourceLocation( Item item, int metadata, ModelResourceLocation model );
|
||||
|
||||
void setCustomMeshDefinition( Item item, ItemMeshDefinition meshDefinition );
|
||||
|
||||
void setCustomStateMapper( Block block, IStateMapper mapper );
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
@@ -33,10 +33,11 @@ import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||
import appeng.bootstrap.components.IPostInitComponent;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.core.Registration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.ItemDefinition;
|
||||
import appeng.util.Platform;
|
||||
@@ -53,13 +54,7 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
|
||||
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
|
||||
|
||||
private final List<Consumer<Item>> preInitCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<Consumer<Item>> initCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<Consumer<Item>> modelRegCallbacks = new ArrayList<>();
|
||||
|
||||
private final List<Consumer<Item>> postInitCallbacks = new ArrayList<>();
|
||||
private final List<Function<Item, IBootstrapComponent>> boostrapComponents = new ArrayList<>();
|
||||
|
||||
private Supplier<IBehaviorDispenseItem> dispenserBehaviorSupplier;
|
||||
|
||||
@@ -80,23 +75,9 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemDefinitionBuilder preInit( Consumer<Item> callback )
|
||||
public IItemBuilder bootstrap( Function<Item, IBootstrapComponent> component )
|
||||
{
|
||||
this.preInitCallbacks.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemDefinitionBuilder init( Consumer<Item> callback )
|
||||
{
|
||||
this.initCallbacks.add( callback );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemDefinitionBuilder postInit( Consumer<Item> callback )
|
||||
{
|
||||
this.postInitCallbacks.add( callback );
|
||||
this.boostrapComponents.add( component );
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -163,22 +144,19 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
item.setCreativeTab( this.creativeTab );
|
||||
|
||||
// Register all extra handlers
|
||||
this.preInitCallbacks.forEach( consumer -> this.factory.addPreInit( side -> consumer.accept( item ) ) );
|
||||
this.initCallbacks.forEach( consumer -> this.factory.addInit( side -> consumer.accept( item ) ) );
|
||||
this.modelRegCallbacks.forEach( consumer -> this.factory.addModelReg( side -> consumer.accept( item ) ) );
|
||||
this.postInitCallbacks.forEach( consumer -> this.factory.addPostInit( side -> consumer.accept( item ) ) );
|
||||
this.boostrapComponents.forEach( component -> component.apply( item ) );
|
||||
|
||||
// Register custom dispenser behavior if requested
|
||||
if( this.dispenserBehaviorSupplier != null )
|
||||
{
|
||||
this.factory.addPostInit( side ->
|
||||
this.factory.addBootstrapComponent( (IPostInitComponent) side ->
|
||||
{
|
||||
IBehaviorDispenseItem behavior = this.dispenserBehaviorSupplier.get();
|
||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item, behavior );
|
||||
} );
|
||||
}
|
||||
|
||||
this.factory.addPreInit( side -> Registration.addItemToRegister( item ) );
|
||||
this.factory.addBootstrapComponent( (IItemRegistrationComponent) ( side, reg ) -> reg.register( item ) );
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
@@ -187,4 +165,5 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
|
||||
return definition;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -128,15 +128,13 @@ class ItemRendering implements IItemRendering
|
||||
Block block = ( (ItemBlock) item ).getBlock();
|
||||
|
||||
// We can only do this once the blocks are actually registered...
|
||||
StateMapperHelper helper = new StateMapperHelper( block.getRegistryName() );
|
||||
StateMapperHelper helper = new StateMapperHelper( item.getRegistryName() );
|
||||
model = helper.getModelResourceLocation( block.getDefaultState() );
|
||||
}
|
||||
else
|
||||
{
|
||||
model = new ModelResourceLocation( item.getRegistryName(), "inventory" );
|
||||
resources.add( model );
|
||||
}
|
||||
|
||||
factory.addBootstrapComponent( new ItemModelComponent( item, ImmutableMap.of( 0, model ) ) );
|
||||
}
|
||||
|
||||
@@ -147,17 +145,12 @@ class ItemRendering implements IItemRendering
|
||||
{
|
||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, resources ) );
|
||||
}
|
||||
else if( !this.itemModels.isEmpty() || this.itemMeshDefinition != null )
|
||||
else if( this.itemMeshDefinition != null )
|
||||
{
|
||||
// Adding an empty variant list here will prevent Vanilla from trying to load the default item model in this
|
||||
// case
|
||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
|
||||
}
|
||||
else if( item instanceof ItemBlock )
|
||||
{
|
||||
// The default for block items is to register the block model
|
||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
|
||||
}
|
||||
|
||||
if( this.itemColor != null )
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
|
||||
public class BlockColorComponent implements InitComponent
|
||||
public class BlockColorComponent implements IInitComponent
|
||||
{
|
||||
|
||||
private final Block block;
|
||||
|
||||
@@ -33,7 +33,7 @@ import appeng.client.render.model.BuiltInModelLoader;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public class BuiltInModelComponent implements PreInitComponent
|
||||
public class BuiltInModelComponent implements IPreInitComponent
|
||||
{
|
||||
|
||||
private final Map<String, IModel> builtInModels = new HashMap<>();
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IBlockRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
void blockRegistration( Side side, IForgeRegistry<Block> blockRegistry );
|
||||
}
|
||||
+1
-4
@@ -25,10 +25,7 @@ import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface InitComponent extends IBootstrapComponent
|
||||
public interface IInitComponent extends IBootstrapComponent
|
||||
{
|
||||
|
||||
@Override
|
||||
void initialize( Side side );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IItemRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
void itemRegistration( Side side, IForgeRegistry<Item> itemRegistry );
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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.bootstrap.components;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
|
||||
|
||||
/**
|
||||
* @author GuntherDW
|
||||
*/
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IModelRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
void modelRegistration( Side side, IModelRegistry registry );
|
||||
}
|
||||
+6
-8
@@ -16,18 +16,16 @@
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.tile;
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@Retention( RetentionPolicy.RUNTIME )
|
||||
public @interface TileEvent
|
||||
@FunctionalInterface
|
||||
public interface IOreDictComponent extends IBootstrapComponent
|
||||
{
|
||||
|
||||
TileEventType value();
|
||||
void oreRegistration( Side side );
|
||||
}
|
||||
+1
-3
@@ -25,9 +25,7 @@ import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface PostInitComponent extends IBootstrapComponent
|
||||
public interface IPostInitComponent extends IBootstrapComponent
|
||||
{
|
||||
|
||||
@Override
|
||||
void postInitialize( Side side );
|
||||
}
|
||||
+1
-4
@@ -25,10 +25,7 @@ import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface PreInitComponent extends IBootstrapComponent
|
||||
public interface IPreInitComponent extends IBootstrapComponent
|
||||
{
|
||||
|
||||
@Override
|
||||
void preInitialize( Side side );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IRecipeRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
void recipeRegistration( Side side, IForgeRegistry<IRecipe> recipeRegistry );
|
||||
}
|
||||
@@ -25,7 +25,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
|
||||
public class ItemColorComponent implements InitComponent
|
||||
public class ItemColorComponent implements IInitComponent
|
||||
{
|
||||
|
||||
private final Item item;
|
||||
|
||||
@@ -21,17 +21,18 @@ package appeng.bootstrap.components;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
|
||||
|
||||
/**
|
||||
* Registers a custom item mesh definition that can be used to dynamically determine the item model based on
|
||||
* item stack properties.
|
||||
*/
|
||||
public class ItemMeshDefinitionComponent implements InitComponent
|
||||
public class ItemMeshDefinitionComponent implements IModelRegistrationComponent
|
||||
{
|
||||
|
||||
private final Item item;
|
||||
@@ -45,8 +46,8 @@ public class ItemMeshDefinitionComponent implements InitComponent
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize( Side side )
|
||||
public void modelRegistration( Side side, IModelRegistry registry )
|
||||
{
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( this.item, this.meshDefinition );
|
||||
registry.setCustomMeshDefinition( this.item, this.meshDefinition );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,18 +23,18 @@ import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemModelMesher;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
|
||||
|
||||
/**
|
||||
* Registers the models that should by used for an item, including the ability to
|
||||
* distinguish by meta.
|
||||
*/
|
||||
public class ItemModelComponent implements InitComponent
|
||||
public class ItemModelComponent implements IModelRegistrationComponent
|
||||
{
|
||||
|
||||
private final Item item;
|
||||
@@ -48,13 +48,11 @@ public class ItemModelComponent implements InitComponent
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize( Side side )
|
||||
public void modelRegistration( Side side, IModelRegistry registry )
|
||||
{
|
||||
ItemModelMesher itemMesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
|
||||
|
||||
this.modelsByMeta.forEach( ( meta, model ) ->
|
||||
{
|
||||
itemMesher.register( this.item, meta, model );
|
||||
registry.setCustomModelResourceLocation( this.item, meta, model );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user