Compare commits
187 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 883d9ba49b | |||
| fe8d824526 | |||
| d2250b115f | |||
| e5ab9df086 | |||
| 96af371882 | |||
| bde76d1fb1 | |||
| eb4caaa688 | |||
| 3ba04b3831 | |||
| 7cd8b72bb7 | |||
| 2182b6e37c | |||
| 5d26b98ab8 | |||
| 979531afb7 | |||
| dcf7de9000 | |||
| 87999dbf27 | |||
| c2d18ce013 | |||
| 046a27bf4c | |||
| 841bc6e356 | |||
| e72b5b369c | |||
| d635a87f01 | |||
| 51481d3e30 | |||
| 77e11c7a24 | |||
| 3056bb6ffb | |||
| edc0cef2bb | |||
| 4bd2797f5e | |||
| f37dfd0a24 | |||
| 937ea00e9d | |||
| b431d5d681 | |||
| 0ef854ca4b | |||
| 2c6e50d48a | |||
| dcd94b1cfa | |||
| 89de98f71e | |||
| d16677224a | |||
| 89bebc4385 | |||
| 987ea8d39d | |||
| f4212a86c3 | |||
| 3c4a0cae11 | |||
| 2894a7caa0 | |||
| 044e639827 | |||
| d7b97fa7b8 | |||
| 62435a65f1 | |||
| bf4818cf97 | |||
| 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 |
@@ -14,6 +14,7 @@
|
|||||||
* [Building](#building)
|
* [Building](#building)
|
||||||
* [Contribution](#contribution)
|
* [Contribution](#contribution)
|
||||||
* [API](#applied-energistics-2-api)
|
* [API](#applied-energistics-2-api)
|
||||||
|
* [CraftTweaker](#applied-energistics-2-crafttweaker)
|
||||||
* [Localization](#applied-energistics-2-localization)
|
* [Localization](#applied-energistics-2-localization)
|
||||||
* [Credits](#credits)
|
* [Credits](#credits)
|
||||||
|
|
||||||
@@ -26,17 +27,18 @@ A Mod about Matter, Energy and using them to conquer the world..
|
|||||||
* [Website](http://ae-mod.info/)
|
* [Website](http://ae-mod.info/)
|
||||||
* [IRC #appliedenergistics on esper.net](http://webchat.esper.net/?channels=appliedenergistics&prompt=1)
|
* [IRC #appliedenergistics on esper.net](http://webchat.esper.net/?channels=appliedenergistics&prompt=1)
|
||||||
* [GitHub](https://github.com/AppliedEnergistics/Applied-Energistics-2)
|
* [GitHub](https://github.com/AppliedEnergistics/Applied-Energistics-2)
|
||||||
|
* [Discord](https://discord.gg/DJ9hVAN)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
* Applied Energistics 2 API
|
* Applied Energistics 2 API
|
||||||
- (c) 2013 - 2017 AlgorithmX2 et al
|
- (c) 2013 - 2018 AlgorithmX2 et al
|
||||||
- [](http://opensource.org/licenses/MIT)
|
- [](http://opensource.org/licenses/MIT)
|
||||||
* Applied Energistics 2
|
* Applied Energistics 2
|
||||||
- (c) 2013 - 2017 AlgorithmX2 et al
|
- (c) 2013 - 2018 AlgorithmX2 et al
|
||||||
- [](https://raw.githubusercontent.com/AppliedEnergistics/Applied-Energistics-2/rv2/LICENSE)
|
- [](https://raw.githubusercontent.com/AppliedEnergistics/Applied-Energistics-2/rv2/LICENSE)
|
||||||
* Textures and Models
|
* Textures and Models
|
||||||
- (c) 2013 - 2017 AlgorithmX2 et al
|
- (c) 2013 - 2018 AlgorithmX2 et al
|
||||||
- [](https://creativecommons.org/licenses/by-nc-sa/3.0/)
|
- [](https://creativecommons.org/licenses/by-nc-sa/3.0/)
|
||||||
* Text and Translations
|
* Text and Translations
|
||||||
- [](https://creativecommons.org/publicdomain/zero/1.0/)
|
- [](https://creativecommons.org/publicdomain/zero/1.0/)
|
||||||
@@ -145,14 +147,65 @@ Universal builds obtained [Here](http://ae2.ae-mod.info/Downloads/) should work
|
|||||||
When compiling against the AE2 API you can use gradle dependencies, just add
|
When compiling against the AE2 API you can use gradle dependencies, just add
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "appeng:appliedenergistics2:rv_-_____-__:dev"
|
compile "appeng:appliedenergistics2:rv_-_____-__:api"
|
||||||
}
|
}
|
||||||
|
|
||||||
or add the compile line to your existing dependencies task to your build.gradle
|
or add the compile line to your existing dependencies task to your build.gradle
|
||||||
|
|
||||||
Where the __ are filled in with the correct version criteria; AE2 is available from the default forge maven so no additional repositories are necessary.
|
Where the __ are filled in with the correct version criteria; AE2 is available from the default forge maven so no additional repositories are necessary.
|
||||||
|
|
||||||
An example string would be `appeng:appliedenergistics2:rv2-alpha-30:dev`
|
An example string would be `appeng:appliedenergistics2:rv5-stable-1:api` for the API only or `appeng:appliedenergistics2:rv5-stable-1` for the whole mod.
|
||||||
|
|
||||||
|
## 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
|
## Applied Energistics 2 Localization
|
||||||
|
|
||||||
|
|||||||
+6
-3
@@ -45,6 +45,12 @@ apply from: 'gradle/scripts/optional.gradle'
|
|||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
targetCompatibility = 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
|
version = aeversion + "-" + aechannel + "-" + aebuild
|
||||||
group = aegroup
|
group = aegroup
|
||||||
archivesBaseName = aebasename
|
archivesBaseName = aebasename
|
||||||
@@ -52,7 +58,6 @@ archivesBaseName = aebasename
|
|||||||
// Add Coremod Manifest
|
// Add Coremod Manifest
|
||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest {
|
||||||
attributes 'FMLCorePluginContainsFMLMod': 'true'
|
|
||||||
attributes 'FMLAT': 'appeng_at.cfg'
|
attributes 'FMLAT': 'appeng_at.cfg'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,8 +73,6 @@ jar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
coreMod = "appeng.coremod.AppEngCore"
|
|
||||||
|
|
||||||
version = minecraft_version + "-" + forge_version
|
version = minecraft_version + "-" + forge_version
|
||||||
|
|
||||||
replaceIn "AEConfig.java"
|
replaceIn "AEConfig.java"
|
||||||
|
|||||||
+16
-9
@@ -7,20 +7,27 @@ aebasename=appliedenergistics2
|
|||||||
#########################################################
|
#########################################################
|
||||||
# Versions #
|
# Versions #
|
||||||
#########################################################
|
#########################################################
|
||||||
minecraft_version=1.12
|
minecraft_version=1.12.2
|
||||||
mcp_mappings=snapshot_20170704
|
mcp_mappings=snapshot_20171003
|
||||||
forge_version=14.21.1.2412
|
forge_version=14.23.3.2655
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# Installable #
|
# Installable #
|
||||||
#########################################################
|
#########################################################
|
||||||
hwyla_version=1.8.19-B33_1.12
|
hwyla_version=1.8.26-B41_1.12.2
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# Provided APIs #
|
# Provided APIs #
|
||||||
#########################################################
|
#########################################################
|
||||||
jei_version=4.7.1.69
|
jei_version=4.10.0.198
|
||||||
tesla_version=1.0.61
|
tesla_version=1.0.63
|
||||||
ic2_version=2.8.7-ex112
|
ic2_version=2.8.73-ex112
|
||||||
rf_version=2.0.0.1
|
top_version=1.12-1.4.23-16
|
||||||
top_version=1.12-1.4.8-2
|
cofhcore_version=1.12.2-4.5.2.19
|
||||||
|
crafttweaker_version=4.1.8.9
|
||||||
|
|
||||||
|
#########################################################
|
||||||
|
# Deployment #
|
||||||
|
#########################################################
|
||||||
|
website_version=1.12.2
|
||||||
|
curse_versions=1.12.2
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ repositories {
|
|||||||
|
|
||||||
maven {
|
maven {
|
||||||
name = "Tesla repo"
|
name = "Tesla repo"
|
||||||
url "http://maven.epoxide.xyz"
|
url "http://maven.mcmoddev.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
maven {
|
maven {
|
||||||
@@ -58,6 +58,16 @@ repositories {
|
|||||||
name 'tehnut'
|
name 'tehnut'
|
||||||
url "http://tehnut.info/maven"
|
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 {
|
configurations {
|
||||||
@@ -69,17 +79,15 @@ dependencies {
|
|||||||
mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||||
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
|
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
|
||||||
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
|
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
|
||||||
// mods "com.github.mcjty:compatlayer:${compatlayer_version}"
|
|
||||||
|
|
||||||
// compile against provided APIs
|
// compile against provided APIs
|
||||||
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
|
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
|
||||||
compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||||
compileOnly "net.darkhax.tesla:Tesla-${minecraft_version}:${tesla_version}"
|
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
|
||||||
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||||
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
||||||
|
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
|
||||||
// deobfCompile "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
|
||||||
deobfCompile "cofh:RedstoneFlux:${minecraft_version}-${rf_version}:universal"
|
|
||||||
|
|
||||||
// at runtime, use the full JEI jar
|
// at runtime, use the full JEI jar
|
||||||
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
||||||
|
|||||||
@@ -25,14 +25,13 @@ package appeng.api;
|
|||||||
|
|
||||||
|
|
||||||
import appeng.api.definitions.IDefinitions;
|
import appeng.api.definitions.IDefinitions;
|
||||||
import appeng.api.exceptions.FailedConnection;
|
|
||||||
import appeng.api.features.IRegistryContainer;
|
import appeng.api.features.IRegistryContainer;
|
||||||
import appeng.api.networking.IGridBlock;
|
import appeng.api.networking.IGridHelper;
|
||||||
import appeng.api.networking.IGridConnection;
|
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
import appeng.api.parts.IPartHelper;
|
import appeng.api.parts.IPartHelper;
|
||||||
import appeng.api.storage.IStorageHelper;
|
import appeng.api.storage.IStorageHelper;
|
||||||
|
|
||||||
|
|
||||||
@AEInjectable
|
@AEInjectable
|
||||||
public interface IAppEngApi
|
public interface IAppEngApi
|
||||||
{
|
{
|
||||||
@@ -42,36 +41,23 @@ public interface IAppEngApi
|
|||||||
IRegistryContainer registries();
|
IRegistryContainer registries();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return helper for working with storage data types.
|
* @return A helper for working with storage data types.
|
||||||
*/
|
*/
|
||||||
IStorageHelper storage();
|
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();
|
IPartHelper partHelper();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return an accessible list of all AE definitions
|
* @return An accessible list of all AE definitions
|
||||||
*/
|
*/
|
||||||
IDefinitions 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
|
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 ) ),
|
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 ) ),
|
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 ) );
|
SCHEDULING_MODE( EnumSet.allOf( SchedulingMode.class ) );
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ public enum TunnelType
|
|||||||
{
|
{
|
||||||
ME, // Network Tunnel
|
ME, // Network Tunnel
|
||||||
IC2_POWER, // EU Tunnel
|
IC2_POWER, // EU Tunnel
|
||||||
RF_POWER, // RF Tunnel
|
|
||||||
FE_POWER, // Forge Energy tunnel
|
FE_POWER, // Forge Energy tunnel
|
||||||
REDSTONE, // Redstone Tunnel
|
REDSTONE, // Redstone Tunnel
|
||||||
FLUID, // Fluid Tunnel
|
FLUID, // Fluid Tunnel
|
||||||
|
|||||||
@@ -148,6 +148,8 @@ public interface IBlocks
|
|||||||
|
|
||||||
ITileDefinition iface();
|
ITileDefinition iface();
|
||||||
|
|
||||||
|
ITileDefinition fluidIface();
|
||||||
|
|
||||||
ITileDefinition cellWorkbench();
|
ITileDefinition cellWorkbench();
|
||||||
|
|
||||||
ITileDefinition iOPort();
|
ITileDefinition iOPort();
|
||||||
|
|||||||
@@ -88,6 +88,14 @@ public interface IItems
|
|||||||
|
|
||||||
IItemDefinition cell64k();
|
IItemDefinition cell64k();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell1k();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell4k();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell16k();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell64k();
|
||||||
|
|
||||||
IItemDefinition spatialCell2();
|
IItemDefinition spatialCell2();
|
||||||
|
|
||||||
IItemDefinition spatialCell16();
|
IItemDefinition spatialCell16();
|
||||||
|
|||||||
@@ -134,4 +134,12 @@ public interface IMaterials
|
|||||||
IItemDefinition qESingularity();
|
IItemDefinition qESingularity();
|
||||||
|
|
||||||
IItemDefinition blankPattern();
|
IItemDefinition blankPattern();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell1kPart();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell4kPart();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell16kPart();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell64kPart();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ public interface IParts
|
|||||||
|
|
||||||
AEColoredItemDefinition cableGlass();
|
AEColoredItemDefinition cableGlass();
|
||||||
|
|
||||||
AEColoredItemDefinition cableDense();
|
AEColoredItemDefinition cableDenseCovered();
|
||||||
|
|
||||||
|
AEColoredItemDefinition cableDenseSmart();
|
||||||
|
|
||||||
AEColoredItemDefinition lumenCableSmart();
|
AEColoredItemDefinition lumenCableSmart();
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ public interface IParts
|
|||||||
|
|
||||||
AEColoredItemDefinition lumenCableGlass();
|
AEColoredItemDefinition lumenCableGlass();
|
||||||
|
|
||||||
AEColoredItemDefinition lumenCableDense();
|
AEColoredItemDefinition lumenDenseCableSmart();
|
||||||
|
|
||||||
IItemDefinition quartzFiber();
|
IItemDefinition quartzFiber();
|
||||||
|
|
||||||
@@ -62,6 +64,8 @@ public interface IParts
|
|||||||
|
|
||||||
IItemDefinition iface();
|
IItemDefinition iface();
|
||||||
|
|
||||||
|
IItemDefinition fluidIface();
|
||||||
|
|
||||||
IItemDefinition levelEmitter();
|
IItemDefinition levelEmitter();
|
||||||
|
|
||||||
IItemDefinition annihilationPlane();
|
IItemDefinition annihilationPlane();
|
||||||
@@ -80,8 +84,6 @@ public interface IParts
|
|||||||
|
|
||||||
IItemDefinition p2PTunnelEU();
|
IItemDefinition p2PTunnelEU();
|
||||||
|
|
||||||
IItemDefinition p2PTunnelRF();
|
|
||||||
|
|
||||||
IItemDefinition p2PTunnelFE();
|
IItemDefinition p2PTunnelFE();
|
||||||
|
|
||||||
IItemDefinition p2PTunnelLight();
|
IItemDefinition p2PTunnelLight();
|
||||||
@@ -107,4 +109,18 @@ public interface IParts
|
|||||||
IItemDefinition storageMonitor();
|
IItemDefinition storageMonitor();
|
||||||
|
|
||||||
IItemDefinition conversionMonitor();
|
IItemDefinition conversionMonitor();
|
||||||
|
|
||||||
|
IItemDefinition fluidTerminal();
|
||||||
|
|
||||||
|
IItemDefinition fluidImportBus();
|
||||||
|
|
||||||
|
IItemDefinition fluidExportBus();
|
||||||
|
|
||||||
|
IItemDefinition fluidStorageBus();
|
||||||
|
|
||||||
|
IItemDefinition fluidLevelEmitter();
|
||||||
|
|
||||||
|
IItemDefinition fluidAnnihilationPlane();
|
||||||
|
|
||||||
|
IItemDefinition fluidFormationnPlane();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ package appeng.api.exceptions;
|
|||||||
|
|
||||||
public class CoreInaccessibleException extends RuntimeException
|
public class CoreInaccessibleException extends RuntimeException
|
||||||
{
|
{
|
||||||
|
private static final long serialVersionUID = -7434641554655517242L;
|
||||||
|
|
||||||
public CoreInaccessibleException( final String message )
|
public CoreInaccessibleException( final String message )
|
||||||
{
|
{
|
||||||
super( message );
|
super( message );
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import appeng.api.networking.IGridNode;
|
|||||||
* @version rv3
|
* @version rv3
|
||||||
* @since rv3
|
* @since rv3
|
||||||
*/
|
*/
|
||||||
public class ExistingConnectionException extends FailedConnection
|
public class ExistingConnectionException extends FailedConnectionException
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = 2975450379720353182L;
|
private static final long serialVersionUID = 2975450379720353182L;
|
||||||
|
|||||||
+3
-3
@@ -40,16 +40,16 @@ import appeng.api.networking.IGridNode;
|
|||||||
* @version rv3
|
* @version rv3
|
||||||
* @since rv0
|
* @since rv0
|
||||||
*/
|
*/
|
||||||
public class FailedConnection extends Exception
|
public class FailedConnectionException extends Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = -2544208090248293753L;
|
private static final long serialVersionUID = -2544208090248293753L;
|
||||||
|
|
||||||
public FailedConnection()
|
public FailedConnectionException()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public FailedConnection( String message )
|
public FailedConnectionException( String message )
|
||||||
{
|
{
|
||||||
super( message );
|
super( message );
|
||||||
}
|
}
|
||||||
+4
-2
@@ -19,9 +19,11 @@
|
|||||||
package appeng.api.exceptions;
|
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 );
|
super( message );
|
||||||
}
|
}
|
||||||
+2
-2
@@ -24,12 +24,12 @@
|
|||||||
package appeng.api.exceptions;
|
package appeng.api.exceptions;
|
||||||
|
|
||||||
|
|
||||||
public class MissingIngredientError extends Exception
|
public class MissingIngredientException extends Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = -998858343831371697L;
|
private static final long serialVersionUID = -998858343831371697L;
|
||||||
|
|
||||||
public MissingIngredientError( final String n )
|
public MissingIngredientException( final String n )
|
||||||
{
|
{
|
||||||
super( n );
|
super( n );
|
||||||
}
|
}
|
||||||
+2
-2
@@ -24,12 +24,12 @@
|
|||||||
package appeng.api.exceptions;
|
package appeng.api.exceptions;
|
||||||
|
|
||||||
|
|
||||||
public class ModNotInstalled extends Exception
|
public class ModNotInstalledException extends Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = -9052435206368425494L;
|
private static final long serialVersionUID = -9052435206368425494L;
|
||||||
|
|
||||||
public ModNotInstalled( final String t )
|
public ModNotInstalledException( final String t )
|
||||||
{
|
{
|
||||||
super( t );
|
super( t );
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ package appeng.api.exceptions;
|
|||||||
* @version rv3
|
* @version rv3
|
||||||
* @since rv3
|
* @since rv3
|
||||||
*/
|
*/
|
||||||
public class NullNodeConnectionException extends FailedConnection
|
public class NullNodeConnectionException extends FailedConnectionException
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = -2143719383495321764L;
|
private static final long serialVersionUID = -2143719383495321764L;
|
||||||
|
|||||||
+2
-2
@@ -24,12 +24,12 @@
|
|||||||
package appeng.api.exceptions;
|
package appeng.api.exceptions;
|
||||||
|
|
||||||
|
|
||||||
public class RecipeError extends Exception
|
public class RecipeException extends Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = -6602870588617670262L;
|
private static final long serialVersionUID = -6602870588617670262L;
|
||||||
|
|
||||||
public RecipeError( final String n )
|
public RecipeException( final String n )
|
||||||
{
|
{
|
||||||
super( n );
|
super( n );
|
||||||
}
|
}
|
||||||
+2
-2
@@ -24,12 +24,12 @@
|
|||||||
package appeng.api.exceptions;
|
package appeng.api.exceptions;
|
||||||
|
|
||||||
|
|
||||||
public class RegistrationError extends Exception
|
public class RegistrationException extends Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = -6602870588617670263L;
|
private static final long serialVersionUID = -6602870588617670263L;
|
||||||
|
|
||||||
public RegistrationError( final String n )
|
public RegistrationException( final String n )
|
||||||
{
|
{
|
||||||
super( n );
|
super( n );
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ package appeng.api.exceptions;
|
|||||||
* @version rv3
|
* @version rv3
|
||||||
* @since rv3
|
* @since rv3
|
||||||
*/
|
*/
|
||||||
public class SecurityConnectionException extends FailedConnection
|
public class SecurityConnectionException extends FailedConnectionException
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 5048714900434215426L;
|
private static final long serialVersionUID = 5048714900434215426L;
|
||||||
private static final String DEFAULT_MESSAGE = "Connection failed due to different security realms.";
|
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
|
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.
|
* An immutable list of the currently registered recipes.
|
||||||
*
|
*
|
||||||
@@ -47,44 +55,9 @@ public interface IGrinderRegistry
|
|||||||
Collection<IGrinderRecipe> getRecipes();
|
Collection<IGrinderRecipe> getRecipes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new recipe with a single input and output and how many turns it requires.
|
* Add a new recipe to the registry.
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
void addRecipe( @Nonnull ItemStack in, @Nonnull ItemStack out, int turns );
|
boolean addRecipe( IGrinderRecipe recipe );
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the specific from the recipe list.
|
* Remove the specific from the recipe list.
|
||||||
|
|||||||
@@ -31,11 +31,19 @@ import net.minecraft.item.ItemStack;
|
|||||||
* Lets you manipulate Inscriber Recipes, by adding or editing existing ones.
|
* Lets you manipulate Inscriber Recipes, by adding or editing existing ones.
|
||||||
*
|
*
|
||||||
* @author thatsIch
|
* @author thatsIch
|
||||||
* @version rv3
|
* @version rv5
|
||||||
* @since rv2
|
* @since rv2
|
||||||
*/
|
*/
|
||||||
public interface IInscriberRegistry
|
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.
|
* An immutable copy of currently registered recipes.
|
||||||
*
|
*
|
||||||
@@ -65,29 +73,25 @@ public interface IInscriberRegistry
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
Set<ItemStack> getInputs();
|
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.
|
* add a new recipe the easy way, duplicates will not be added.
|
||||||
* Added recipes will be automatically added to the optionals and inputs.
|
* Added recipes will be automatically added to the optionals and inputs.
|
||||||
*
|
*
|
||||||
* @param recipe new recipe
|
* @param recipe new recipe
|
||||||
*
|
*
|
||||||
|
* @return true, when successfully added
|
||||||
|
*
|
||||||
* @throws IllegalArgumentException if null is added
|
* @throws IllegalArgumentException if null is added
|
||||||
*/
|
*/
|
||||||
void addRecipe( IInscriberRecipe recipe );
|
boolean addRecipe( IInscriberRecipe recipe );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all equal recipes from the registry.
|
* Removes all equal recipes from the registry.
|
||||||
*
|
*
|
||||||
* @param toBeRemovedRecipe to be removed recipe, can be null, makes just no sense.
|
* @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 javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
|
|
||||||
import appeng.api.config.TunnelType;
|
import appeng.api.config.TunnelType;
|
||||||
|
|
||||||
@@ -47,6 +48,7 @@ public interface IP2PTunnelRegistry
|
|||||||
*/
|
*/
|
||||||
void addNewAttunement( @Nonnull ItemStack trigger, @Nullable TunnelType type );
|
void addNewAttunement( @Nonnull ItemStack trigger, @Nullable TunnelType type );
|
||||||
void addNewAttunement( @Nonnull String ModId, @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.
|
* returns null if no attunement can be found.
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public interface IRecipeHandlerRegistry
|
|||||||
* @param name name of crafthandler
|
* @param name name of crafthandler
|
||||||
* @param handler class of crafthandler
|
* @param handler class of crafthandler
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
void addNewCraftHandler( String name, Class<? extends ICraftHandler> handler );
|
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.
|
* @return A recipe handler by name, returns null on failure.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@Deprecated
|
||||||
ICraftHandler getCraftHandlerFor( String name );
|
ICraftHandler getCraftHandlerFor( String name );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a new recipe handler, which can be used to parse, and read recipe files.
|
* @return a new recipe handler, which can be used to parse, and read recipe files.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
IRecipeHandler createNewRecipehandler();
|
IRecipeHandler createNewRecipehandler();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ import appeng.api.storage.ICellRegistry;
|
|||||||
/**
|
/**
|
||||||
* @author AlgorithmX2
|
* @author AlgorithmX2
|
||||||
* @author thatsIch
|
* @author thatsIch
|
||||||
* @version rv2
|
* @author yueh
|
||||||
|
* @version rv5
|
||||||
* @since rv0
|
* @since rv0
|
||||||
*/
|
*/
|
||||||
@AEInjectable
|
@AEInjectable
|
||||||
@@ -76,6 +77,11 @@ public interface IRegistryContainer
|
|||||||
*/
|
*/
|
||||||
IInscriberRegistry inscriber();
|
IInscriberRegistry inscriber();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manage charger via API
|
||||||
|
*/
|
||||||
|
IChargerRegistry charger();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get access to the locatable registry
|
* get access to the locatable registry
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ package appeng.api.implementations.items;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.api.config.AccessRestriction;
|
import appeng.api.config.AccessRestriction;
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.networking.energy.IAEPowerStorage;
|
import appeng.api.networking.energy.IAEPowerStorage;
|
||||||
|
|
||||||
|
|
||||||
@@ -42,27 +43,27 @@ public interface IAEItemPowerStorage
|
|||||||
*
|
*
|
||||||
* @return amount unable to be stored
|
* @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
|
* Attempt to extract power from the device, it will extract what it can and
|
||||||
* return it.
|
* return it.
|
||||||
*
|
*
|
||||||
* @param amt to be extracted power from device
|
* @param amount to be extracted power from device
|
||||||
*
|
*
|
||||||
* @return what it could extract
|
* @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 )
|
* @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()
|
* @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
|
* 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
|
* @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 net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.implementations.TransitionResult;
|
import appeng.api.implementations.TransitionResult;
|
||||||
|
import appeng.api.storage.ISpatialDimension;
|
||||||
import appeng.api.util.WorldCoord;
|
import appeng.api.util.WorldCoord;
|
||||||
|
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ public interface ISpatialStorageCell
|
|||||||
*
|
*
|
||||||
* @return the world for this cell
|
* @return the world for this cell
|
||||||
*/
|
*/
|
||||||
World getWorld( ItemStack is );
|
ISpatialDimension getSpatialDimension();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the currently stored size.
|
* get the currently stored size.
|
||||||
@@ -69,22 +70,13 @@ public interface ISpatialStorageCell
|
|||||||
WorldCoord getStoredSize( ItemStack is );
|
WorldCoord getStoredSize( ItemStack is );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimum coordinates in its world for the storage cell.
|
* get the currently stored Dimension id.
|
||||||
*
|
*
|
||||||
* @param is spatial storage cell
|
* @param is spatial storage cell
|
||||||
*
|
*
|
||||||
* @return minimum coordinate of dimension
|
* @return dimension id or -1
|
||||||
*/
|
*/
|
||||||
WorldCoord getMin( ItemStack is );
|
int getStoredDimensionID( 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 );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform a spatial swap with the contents of the cell, and the world.
|
* 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 w world of spatial
|
||||||
* @param min min coord
|
* @param min min coord
|
||||||
* @param max max coord
|
* @param max max coord
|
||||||
* @param doTransition transition
|
* @param playerId owner of current grid or -1
|
||||||
*
|
*
|
||||||
* @return result of transition
|
* @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 );
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,8 @@ package appeng.api.implementations.items;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.api.storage.ICellWorkbenchItem;
|
import appeng.api.storage.ICellWorkbenchItem;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.IStorageChannel;
|
||||||
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,7 +41,7 @@ import appeng.api.storage.data.IAEItemStack;
|
|||||||
*
|
*
|
||||||
* The standard AE implementation only provides 1-63 Types
|
* The standard AE implementation only provides 1-63 Types
|
||||||
*/
|
*/
|
||||||
public interface IStorageCell extends ICellWorkbenchItem
|
public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,7 +83,7 @@ public interface IStorageCell extends ICellWorkbenchItem
|
|||||||
*
|
*
|
||||||
* @return true to preventAdditionOfItem
|
* @return true to preventAdditionOfItem
|
||||||
*/
|
*/
|
||||||
boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition );
|
boolean isBlackListed( ItemStack cellItem, T requestedAddition );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows you to specify if this storage cell can be stored inside other
|
* Allows you to specify if this storage cell can be stored inside other
|
||||||
@@ -109,4 +110,9 @@ public interface IStorageCell extends ICellWorkbenchItem
|
|||||||
* @return drain in ae/t this storage cell will use.
|
* @return drain in ae/t this storage cell will use.
|
||||||
*/
|
*/
|
||||||
double getIdleDrain();
|
double getIdleDrain();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the type of channel your cell should be part of
|
||||||
|
*/
|
||||||
|
IStorageChannel<T> getChannel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.networking.events.MENetworkEvent;
|
import appeng.api.networking.events.MENetworkEvent;
|
||||||
import appeng.api.util.IReadOnlyCollection;
|
import appeng.api.util.IReadOnlyCollection;
|
||||||
|
|
||||||
@@ -43,7 +45,8 @@ public interface IGrid
|
|||||||
*
|
*
|
||||||
* @return the IGridCache you requested.
|
* @return the IGridCache you requested.
|
||||||
*/
|
*/
|
||||||
<C extends IGridCache> C getCache( Class<? extends IGridCache> iface );
|
@Nonnull
|
||||||
|
<C extends IGridCache> C getCache( @Nonnull Class<? extends IGridCache> iface );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post an event into the network event bus.
|
* Post an event into the network event bus.
|
||||||
@@ -52,7 +55,8 @@ public interface IGrid
|
|||||||
*
|
*
|
||||||
* @return returns ev back to original poster
|
* @return returns ev back to original poster
|
||||||
*/
|
*/
|
||||||
MENetworkEvent postEvent( MENetworkEvent ev );
|
@Nonnull
|
||||||
|
MENetworkEvent postEvent( @Nonnull MENetworkEvent ev );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post an event into the network event bus, but direct it at a single node.
|
* Post an event into the network event bus, but direct it at a single node.
|
||||||
@@ -61,7 +65,8 @@ public interface IGrid
|
|||||||
*
|
*
|
||||||
* @return returns ev back to original poster
|
* @return returns ev back to original poster
|
||||||
*/
|
*/
|
||||||
MENetworkEvent postEventTo( IGridNode node, MENetworkEvent ev );
|
@Nonnull
|
||||||
|
MENetworkEvent postEventTo( @Nonnull IGridNode node, @Nonnull MENetworkEvent ev );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get a list of the diversity of classes, you can use this to better detect which machines your interested in,
|
* get a list of the diversity of classes, you can use this to better detect which machines your interested in,
|
||||||
@@ -69,6 +74,7 @@ public interface IGrid
|
|||||||
*
|
*
|
||||||
* @return IReadOnlyCollection of all available host types (Of Type IGridHost).
|
* @return IReadOnlyCollection of all available host types (Of Type IGridHost).
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IReadOnlyCollection<Class<? extends IGridHost>> getMachinesClasses();
|
IReadOnlyCollection<Class<? extends IGridHost>> getMachinesClasses();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,11 +84,13 @@ public interface IGrid
|
|||||||
*
|
*
|
||||||
* @return IMachineSet of all nodes belonging to hosts of specified class.
|
* @return IMachineSet of all nodes belonging to hosts of specified class.
|
||||||
*/
|
*/
|
||||||
IMachineSet getMachines( Class<? extends IGridHost> gridHostClass );
|
@Nonnull
|
||||||
|
IMachineSet getMachines( @Nonnull Class<? extends IGridHost> gridHostClass );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return IReadOnlyCollection for all nodes on the network, node visitors are preferred.
|
* @return IReadOnlyCollection for all nodes on the network, node visitors are preferred.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IReadOnlyCollection<IGridNode> getNodes();
|
IReadOnlyCollection<IGridNode> getNodes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,5 +101,6 @@ public interface IGrid
|
|||||||
/**
|
/**
|
||||||
* @return the node considered the pivot point of the grid.
|
* @return the node considered the pivot point of the grid.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGridNode getPivot();
|
IGridNode getPivot();
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,10 @@ package appeng.api.networking;
|
|||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnegative;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
@@ -49,6 +53,7 @@ public interface IGridBlock
|
|||||||
*
|
*
|
||||||
* @return ae/t to use.
|
* @return ae/t to use.
|
||||||
*/
|
*/
|
||||||
|
@Nonnegative
|
||||||
double getIdlePowerUsage();
|
double getIdlePowerUsage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,10 +61,11 @@ public interface IGridBlock
|
|||||||
*
|
*
|
||||||
* @return Set of flags for this IGridBlock
|
* @return Set of flags for this IGridBlock
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
EnumSet<GridFlags> getFlags();
|
EnumSet<GridFlags> getFlags();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generally speaking you will return true for this, the one exception is buses, or worm holes where the node
|
* Generally speaking you will return true for this, the one exception is buses, or worm holes where the node
|
||||||
* represents something that isn't a real connection in the world, but rather one represented internally to the
|
* represents something that isn't a real connection in the world, but rather one represented internally to the
|
||||||
* block.
|
* block.
|
||||||
*
|
*
|
||||||
@@ -68,37 +74,46 @@ public interface IGridBlock
|
|||||||
boolean isWorldAccessible();
|
boolean isWorldAccessible();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Must not return when {@link #isWorldAccessible()} is true.
|
||||||
|
* Otherwise the behavior is unspecified.
|
||||||
|
*
|
||||||
* @return current location of this node
|
* @return current location of this node
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
DimensionalCoord getLocation();
|
DimensionalCoord getLocation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Transparent, or a valid color, NULL IS NOT A VALID RETURN
|
* @return Transparent, or a valid color, NULL IS NOT A VALID RETURN
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
AEColor getGridColor();
|
AEColor getGridColor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies your IGridBlock that changes were made to your connections
|
* Notifies your IGridBlock that changes were made to your connections
|
||||||
*/
|
*/
|
||||||
void onGridNotification( GridNotification notification );
|
void onGridNotification( @Nonnull GridNotification notification );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update Blocks network/connection/booting status. grid,
|
* Update Blocks network/connection/booting status. grid,
|
||||||
*
|
*
|
||||||
* @param grid grid
|
* @param grid grid
|
||||||
* @param channelsInUse used channels
|
* @param channelsInUse used channels
|
||||||
|
* @deprecated to be removed in rv7
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
void setNetworkStatus( IGrid grid, int channelsInUse );
|
void setNetworkStatus( IGrid grid, int channelsInUse );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine which sides of the block can be connected too, only used when isWorldAccessible returns true, not used
|
* Determine which sides of the block can be connected too, only used when isWorldAccessible returns true, not used
|
||||||
* for {@link IPart} implementations.
|
* for {@link IPart} implementations.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
EnumSet<EnumFacing> getConnectableSides();
|
EnumSet<EnumFacing> getConnectableSides();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the IGridHost for the node, this will be an IGridPart or a TileEntity generally speaking.
|
* @return the IGridHost for the node, this will be an IGridPart or a TileEntity generally speaking.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGridHost getMachine();
|
IGridHost getMachine();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,5 +126,6 @@ public interface IGridBlock
|
|||||||
*
|
*
|
||||||
* @return the render item stack to use to render this node, null is valid, and will not show this node.
|
* @return the render item stack to use to render this node, null is valid, and will not show this node.
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
ItemStack getMachineRepresentation();
|
ItemStack getMachineRepresentation();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows you to create a network wise service, AE2 uses these for providing
|
* Allows you to create a network wise service, AE2 uses these for providing
|
||||||
* item, spatial, and tunnel services.
|
* item, spatial, and tunnel services.
|
||||||
@@ -50,7 +53,7 @@ public interface IGridCache
|
|||||||
* @param gridNode removed from that grid
|
* @param gridNode removed from that grid
|
||||||
* @param machine to be removed machine
|
* @param machine to be removed machine
|
||||||
*/
|
*/
|
||||||
void removeNode( IGridNode gridNode, IGridHost machine );
|
void removeNode( @Nonnull IGridNode gridNode, @Nonnull IGridHost machine );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* informs you cache that a machine was added to the grid.
|
* informs you cache that a machine was added to the grid.
|
||||||
@@ -62,7 +65,7 @@ public interface IGridCache
|
|||||||
* @param gridNode added to grid node
|
* @param gridNode added to grid node
|
||||||
* @param machine to be added machine
|
* @param machine to be added machine
|
||||||
*/
|
*/
|
||||||
void addNode( IGridNode gridNode, IGridHost machine );
|
void addNode( @Nonnull IGridNode gridNode, @Nonnull IGridHost machine );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a grid splits into two grids, AE will call a split as it
|
* Called when a grid splits into two grids, AE will call a split as it
|
||||||
@@ -71,7 +74,7 @@ public interface IGridCache
|
|||||||
*
|
*
|
||||||
* @param destinationStorage storage which receives half of old grid
|
* @param destinationStorage storage which receives half of old grid
|
||||||
*/
|
*/
|
||||||
void onSplit( IGridStorage destinationStorage );
|
void onSplit( @Nonnull IGridStorage destinationStorage );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when two grids merge into one, AE will call a join as it
|
* Called when two grids merge into one, AE will call a join as it
|
||||||
@@ -80,12 +83,12 @@ public interface IGridCache
|
|||||||
*
|
*
|
||||||
* @param sourceStorage old storage
|
* @param sourceStorage old storage
|
||||||
*/
|
*/
|
||||||
void onJoin( IGridStorage sourceStorage );
|
void onJoin( @Nonnull IGridStorage sourceStorage );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when saving changes,
|
* Called when saving changes,
|
||||||
*
|
*
|
||||||
* @param destinationStorage storage
|
* @param destinationStorage storage
|
||||||
*/
|
*/
|
||||||
void populateGridStorage( IGridStorage destinationStorage );
|
void populateGridStorage( @Nonnull IGridStorage destinationStorage );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,9 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,14 +40,14 @@ public interface IGridCacheRegistry
|
|||||||
*
|
*
|
||||||
* @param iface grid cache class
|
* @param iface grid cache class
|
||||||
*/
|
*/
|
||||||
void registerGridCache( Class<? extends IGridCache> iface, Class<? extends IGridCache> implementation );
|
void registerGridCache( @Nonnull Class<? extends IGridCache> iface, @Nonnull Class<? extends IGridCache> implementation );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* requests a new INSTANCE of a grid cache for use, used internally
|
* requests a new INSTANCE of a grid cache for use, used internally
|
||||||
*
|
*
|
||||||
* @param grid grid
|
* @param grid grid
|
||||||
*
|
*
|
||||||
* @return a new HashMap of IGridCaches from the registry, called from IGrid when constructing a new grid.
|
* @return a new Map of IGridCaches from the registry, called from IGrid when constructing a new grid.
|
||||||
*/
|
*/
|
||||||
HashMap<Class<? extends IGridCache>, IGridCache> createCacheInstance( IGrid grid );
|
Map<Class<? extends IGridCache>, IGridCache> createCacheInstance( IGrid grid );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
|
|
||||||
|
|
||||||
@@ -45,6 +47,7 @@ public interface IGridConnection
|
|||||||
*
|
*
|
||||||
* @return the IGridNode which represents the opposite side of the connection.
|
* @return the IGridNode which represents the opposite side of the connection.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGridNode getOtherSide( IGridNode gridNode );
|
IGridNode getOtherSide( IGridNode gridNode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,6 +57,7 @@ public interface IGridConnection
|
|||||||
*
|
*
|
||||||
* @return the direction of the connection, only valid for in world connections.
|
* @return the direction of the connection, only valid for in world connections.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
AEPartLocation getDirection( IGridNode gridNode );
|
AEPartLocation getDirection( IGridNode gridNode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,11 +69,13 @@ public interface IGridConnection
|
|||||||
/**
|
/**
|
||||||
* @return node A
|
* @return node A
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGridNode a();
|
IGridNode a();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return node B
|
* @return node B
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGridNode b();
|
IGridNode b();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
public interface IGridConnectionVisitor extends IGridVisitor
|
public interface IGridConnectionVisitor extends IGridVisitor
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -32,5 +35,5 @@ public interface IGridConnectionVisitor extends IGridVisitor
|
|||||||
*
|
*
|
||||||
* @param n the connection.
|
* @param n the connection.
|
||||||
*/
|
*/
|
||||||
void visitConnection( IGridConnection n );
|
void visitConnection( @Nonnull IGridConnection n );
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-18
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* The MIT License (MIT)
|
* 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
|
* 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
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
@@ -21,39 +21,48 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* 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 javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.features.IItemComparison;
|
import appeng.api.exceptions.FailedConnectionException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Don't cast this... either compare with it, or copy it.
|
* A helper responsible for creating new {@link IGridNode}, {@link IGridConnection} or potentially similar tasks.
|
||||||
*
|
*
|
||||||
* Don't Implement.
|
* @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();
|
@Nonnull
|
||||||
|
IGridNode createGridNode( @Nonnull IGridBlock block );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* compare to other NBTTagCompounds or IAETagCompounds
|
* Create a direct connection between two {@link IGridNode}.
|
||||||
*
|
*
|
||||||
* @param a compared object
|
* This will be considered as having a distance of 1, regardless of the location of both nodes.
|
||||||
*
|
*
|
||||||
* @return true, if they are the same.
|
* @param a to be connected gridnode
|
||||||
|
* @param b to be connected gridnode
|
||||||
|
*
|
||||||
|
* @throws appeng.api.exceptions.FailedConnectionException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Nonnull
|
||||||
boolean equals( Object a );
|
IGridConnection createGridConnection( @Nonnull IGridNode a, @Nonnull IGridNode b ) throws FailedConnectionException;
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the special comparison for this tag
|
|
||||||
*/
|
|
||||||
IItemComparison getSpecialComparison();
|
|
||||||
}
|
}
|
||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
import appeng.api.parts.IPart;
|
import appeng.api.parts.IPart;
|
||||||
@@ -49,7 +52,8 @@ public interface IGridHost
|
|||||||
* @return a new IGridNode, create these with
|
* @return a new IGridNode, create these with
|
||||||
* AEApi.INSTANCE().createGridNode( MyIGridBlock )
|
* AEApi.INSTANCE().createGridNode( MyIGridBlock )
|
||||||
*/
|
*/
|
||||||
IGridNode getGridNode( AEPartLocation dir );
|
@Nullable
|
||||||
|
IGridNode getGridNode( @Nonnull AEPartLocation dir );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines how cables render when they connect to this block. Priority is
|
* Determines how cables render when they connect to this block. Priority is
|
||||||
@@ -57,7 +61,8 @@ public interface IGridHost
|
|||||||
*
|
*
|
||||||
* @param dir direction
|
* @param dir direction
|
||||||
*/
|
*/
|
||||||
AECableType getCableConnectionType( AEPartLocation dir );
|
@Nonnull
|
||||||
|
AECableType getCableConnectionType( @Nonnull AEPartLocation dir );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* break this host, its violating security rules, just break your block, or part.
|
* break this host, its violating security rules, just break your block, or part.
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ package appeng.api.networking;
|
|||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An extension of IGridBlock, only means something when your getFlags() contains REQUIRE_CHANNEL, when done properly it
|
* An extension of IGridBlock, only means something when your getFlags() contains REQUIRE_CHANNEL, when done properly it
|
||||||
@@ -40,5 +42,6 @@ public interface IGridMultiblock extends IGridBlock
|
|||||||
*
|
*
|
||||||
* @return an iterator that will iterate all the nodes for the multiblock. ( read-only iterator expected. )
|
* @return an iterator that will iterate all the nodes for the multiblock. ( read-only iterator expected. )
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
Iterator<IGridNode> getMultiblockNodes();
|
Iterator<IGridNode> getMultiblockNodes();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ package appeng.api.networking;
|
|||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@@ -50,7 +52,7 @@ public interface IGridNode
|
|||||||
*
|
*
|
||||||
* @param visitor visitor
|
* @param visitor visitor
|
||||||
*/
|
*/
|
||||||
void beginVisit( IGridVisitor visitor );
|
void beginVisit( @Nonnull IGridVisitor visitor );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* inform the node that your IGridBlock has changed its internal state, and force the node to update.
|
* inform the node that your IGridBlock has changed its internal state, and force the node to update.
|
||||||
@@ -68,6 +70,7 @@ public interface IGridNode
|
|||||||
*
|
*
|
||||||
* @return grid host
|
* @return grid host
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGridHost getMachine();
|
IGridHost getMachine();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,6 +78,7 @@ public interface IGridNode
|
|||||||
*
|
*
|
||||||
* @return grid
|
* @return grid
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGrid getGrid();
|
IGrid getGrid();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,11 +90,13 @@ public interface IGridNode
|
|||||||
/**
|
/**
|
||||||
* @return the world the node is located in
|
* @return the world the node is located in
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
World getWorld();
|
World getWorld();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a set of the connected sides, INTERNAL represents an invisible connection
|
* @return a set of the connected sides, INTERNAL represents an invisible connection
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
EnumSet<AEPartLocation> getConnectedSides();
|
EnumSet<AEPartLocation> getConnectedSides();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -98,11 +104,13 @@ public interface IGridNode
|
|||||||
*
|
*
|
||||||
* @return grid connections
|
* @return grid connections
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IReadOnlyCollection<IGridConnection> getConnections();
|
IReadOnlyCollection<IGridConnection> getConnections();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the IGridBlock for this node
|
* @return the IGridBlock for this node
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGridBlock getGridBlock();
|
IGridBlock getGridBlock();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -122,7 +130,7 @@ public interface IGridNode
|
|||||||
* @param name nbt name
|
* @param name nbt name
|
||||||
* @param nodeData to be loaded data
|
* @param nodeData to be loaded data
|
||||||
*/
|
*/
|
||||||
void loadFromNBT( String name, NBTTagCompound nodeData );
|
void loadFromNBT( @Nonnull String name, @Nonnull NBTTagCompound nodeData );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this should be called for each node you maintain, you can save all your nodes to the same tag with different
|
* this should be called for each node you maintain, you can save all your nodes to the same tag with different
|
||||||
@@ -131,7 +139,7 @@ public interface IGridNode
|
|||||||
* @param name nbt name
|
* @param name nbt name
|
||||||
* @param nodeData to be saved data
|
* @param nodeData to be saved data
|
||||||
*/
|
*/
|
||||||
void saveToNBT( String name, NBTTagCompound nodeData );
|
void saveToNBT( @Nonnull String name, @Nonnull NBTTagCompound nodeData );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return if the node's channel requirements are currently met, use this for display purposes, use isActive for
|
* @return if the node's channel requirements are currently met, use this for display purposes, use isActive for
|
||||||
@@ -146,7 +154,7 @@ public interface IGridNode
|
|||||||
*
|
*
|
||||||
* @return true if has flag
|
* @return true if has flag
|
||||||
*/
|
*/
|
||||||
boolean hasFlag( GridFlags flag );
|
boolean hasFlag( @Nonnull GridFlags flag );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the ownerID this represents the person who placed the node.
|
* @return the ownerID this represents the person who placed the node.
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
|
||||||
@@ -33,6 +35,7 @@ public interface IGridStorage
|
|||||||
/**
|
/**
|
||||||
* @return an NBTTagCompound that can be read, and written too.
|
* @return an NBTTagCompound that can be read, and written too.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
NBTTagCompound dataObject();
|
NBTTagCompound dataObject();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple Visitor pattern access to network nodes.
|
* Simple Visitor pattern access to network nodes.
|
||||||
*/
|
*/
|
||||||
@@ -39,5 +42,5 @@ public interface IGridVisitor
|
|||||||
*
|
*
|
||||||
* @return true to continue visiting nodes beyond this node.
|
* @return true to continue visiting nodes beyond this node.
|
||||||
*/
|
*/
|
||||||
boolean visitNode( IGridNode n );
|
boolean visitNode( @Nonnull IGridNode n );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.util.IReadOnlyCollection;
|
import appeng.api.util.IReadOnlyCollection;
|
||||||
|
|
||||||
|
|
||||||
@@ -33,5 +35,6 @@ public interface IMachineSet extends IReadOnlyCollection<IGridNode>
|
|||||||
/**
|
/**
|
||||||
* @return the machine class for this set.
|
* @return the machine class for this set.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
Class<? extends IGridHost> getMachineClass();
|
Class<? extends IGridHost> getMachineClass();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
package appeng.api.networking.crafting;
|
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.networking.storage.IBaseMonitor;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ public interface ICraftingCPU extends IBaseMonitor<IAEItemStack>
|
|||||||
/**
|
/**
|
||||||
* @return the action source for the CPU.
|
* @return the action source for the CPU.
|
||||||
*/
|
*/
|
||||||
BaseActionSource getActionSource();
|
IActionSource getActionSource();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the available storage in bytes
|
* @return the available storage in bytes
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking.crafting;
|
package appeng.api.networking.crafting;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
public interface ICraftingCallback
|
public interface ICraftingCallback
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -32,5 +35,5 @@ public interface ICraftingCallback
|
|||||||
*
|
*
|
||||||
* @param job - final job
|
* @param job - final job
|
||||||
*/
|
*/
|
||||||
void calculationComplete( ICraftingJob job );
|
void calculationComplete( @Nonnull ICraftingJob job );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import net.minecraft.world.World;
|
|||||||
|
|
||||||
import appeng.api.networking.IGrid;
|
import appeng.api.networking.IGrid;
|
||||||
import appeng.api.networking.IGridCache;
|
import appeng.api.networking.IGridCache;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
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
|
* @return a future which will at an undetermined point in the future get you the {@link ICraftingJob} do not wait
|
||||||
* on this, your be waiting forever.
|
* on this, your be waiting forever.
|
||||||
*/
|
*/
|
||||||
Future<ICraftingJob> beginCraftingJob( World world, IGrid grid, BaseActionSource actionSrc, IAEItemStack craftWhat, ICraftingCallback callback );
|
Future<ICraftingJob> beginCraftingJob( World world, IGrid grid, IActionSource actionSrc, IAEItemStack craftWhat, ICraftingCallback callback );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit the job to the Crafting system for processing.
|
* 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
|
* {@link ICraftingRequester} methods. if you send null, this object should be discarded after verifying the
|
||||||
* return state.
|
* 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
|
* @return list of all the crafting cpus on the grid
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking.energy;
|
package appeng.api.networking.energy;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.config.AccessRestriction;
|
import appeng.api.config.AccessRestriction;
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
|
|
||||||
@@ -42,7 +44,7 @@ public interface IAEPowerStorage extends IEnergySource
|
|||||||
*
|
*
|
||||||
* @return amount of power which was unable to be stored
|
* @return amount of power which was unable to be stored
|
||||||
*/
|
*/
|
||||||
double injectAEPower( double amt, Actionable mode );
|
double injectAEPower( double amt, @Nonnull Actionable mode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the current maximum power ( this can change :P )
|
* @return the current maximum power ( this can change :P )
|
||||||
@@ -67,5 +69,6 @@ public interface IAEPowerStorage extends IEnergySource
|
|||||||
*
|
*
|
||||||
* @return access restriction what the network can do
|
* @return access restriction what the network can do
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
AccessRestriction getPowerFlow();
|
AccessRestriction getPowerFlow();
|
||||||
}
|
}
|
||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking.energy;
|
package appeng.api.networking.energy;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnegative;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.networking.IGridCache;
|
import appeng.api.networking.IGridCache;
|
||||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||||
@@ -38,17 +41,20 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
|
|||||||
/**
|
/**
|
||||||
* @return the current calculated idle energy drain each tick, is used internally to drain power for each tick.
|
* @return the current calculated idle energy drain each tick, is used internally to drain power for each tick.
|
||||||
*/
|
*/
|
||||||
|
@Nonnegative
|
||||||
double getIdlePowerUsage();
|
double getIdlePowerUsage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the average power drain over the past 10 ticks, includes idle usage during this time, and all use of
|
* @return the average power drain over the past 10 ticks, includes idle usage during this time, and all use of
|
||||||
* extractPower.
|
* extractPower.
|
||||||
*/
|
*/
|
||||||
|
@Nonnegative
|
||||||
double getAvgPowerUsage();
|
double getAvgPowerUsage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the average energy injected into the system per tick, for the last 10 ticks.
|
* @return the average energy injected into the system per tick, for the last 10 ticks.
|
||||||
*/
|
*/
|
||||||
|
@Nonnegative
|
||||||
double getAvgPowerInjection();
|
double getAvgPowerInjection();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,13 +85,15 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
|
|||||||
*
|
*
|
||||||
* @return the amount of power that the network has OVER the limit.
|
* @return the amount of power that the network has OVER the limit.
|
||||||
*/
|
*/
|
||||||
double injectPower( double amt, Actionable mode );
|
@Nonnegative
|
||||||
|
double injectPower( @Nonnegative double amt, @Nonnull Actionable mode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this is should be considered an estimate, and not relied upon for real calculations.
|
* this is should be considered an estimate, and not relied upon for real calculations.
|
||||||
*
|
*
|
||||||
* @return estimated available power.
|
* @return estimated available power.
|
||||||
*/
|
*/
|
||||||
|
@Nonnegative
|
||||||
double getStoredPower();
|
double getStoredPower();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,6 +101,7 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
|
|||||||
*
|
*
|
||||||
* @return estimated available power.
|
* @return estimated available power.
|
||||||
*/
|
*/
|
||||||
|
@Nonnegative
|
||||||
double getMaxStoredPower();
|
double getMaxStoredPower();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,5 +110,6 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
|
|||||||
*
|
*
|
||||||
* @return Amount of power required to charge the grid, in AE.
|
* @return Amount of power required to charge the grid, in AE.
|
||||||
*/
|
*/
|
||||||
double getEnergyDemand( double maxRequired );
|
@Nonnegative
|
||||||
|
double getEnergyDemand( @Nonnegative double maxRequired );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,10 @@
|
|||||||
package appeng.api.networking.energy;
|
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;
|
import appeng.api.config.Actionable;
|
||||||
|
|
||||||
@@ -35,17 +38,91 @@ import appeng.api.config.Actionable;
|
|||||||
public interface IEnergyGridProvider
|
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
|
* internal use only
|
||||||
*/
|
*/
|
||||||
double extractAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen );
|
@Nonnull
|
||||||
|
Collection<IEnergyGridProvider> providers();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* internal use only
|
* 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
|
* 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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking.energy;
|
package appeng.api.networking.energy;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnegative;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.PowerMultiplier;
|
import appeng.api.config.PowerMultiplier;
|
||||||
|
|
||||||
@@ -39,5 +42,6 @@ public interface IEnergySource
|
|||||||
*
|
*
|
||||||
* @return returns extracted power.
|
* @return returns extracted power.
|
||||||
*/
|
*/
|
||||||
double extractAEPower( double amt, Actionable mode, PowerMultiplier usePowerMultiplier );
|
@Nonnegative
|
||||||
|
double extractAEPower( @Nonnegative double amt, @Nonnull Actionable mode, @Nonnull PowerMultiplier usePowerMultiplier );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking.energy;
|
package appeng.api.networking.energy;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnegative;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DO NOT IMPLEMENT.
|
* DO NOT IMPLEMENT.
|
||||||
*
|
*
|
||||||
@@ -39,7 +42,7 @@ public interface IEnergyWatcher
|
|||||||
* @param amount
|
* @param amount
|
||||||
* @return true, if successfully added.
|
* @return true, if successfully added.
|
||||||
*/
|
*/
|
||||||
boolean add( double amount );
|
boolean add( @Nonnegative double amount );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a specific threshold from the watcher.
|
* Remove a specific threshold from the watcher.
|
||||||
@@ -47,7 +50,7 @@ public interface IEnergyWatcher
|
|||||||
* @param amount
|
* @param amount
|
||||||
* @return true, if successfully removed.
|
* @return true, if successfully removed.
|
||||||
*/
|
*/
|
||||||
boolean remove( double amount );
|
boolean remove( @Nonnegative double amount );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all thresholds and resets the watcher to a clean state.
|
* Removes all thresholds and resets the watcher to a clean state.
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking.energy;
|
package appeng.api.networking.energy;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
public interface IEnergyWatcherHost
|
public interface IEnergyWatcherHost
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -33,12 +36,12 @@ public interface IEnergyWatcherHost
|
|||||||
*
|
*
|
||||||
* @param newWatcher new watcher
|
* @param newWatcher new watcher
|
||||||
*/
|
*/
|
||||||
void updateWatcher( IEnergyWatcher newWatcher );
|
void updateWatcher( @Nonnull IEnergyWatcher newWatcher );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a threshold is crossed.
|
* Called when a threshold is crossed.
|
||||||
*
|
*
|
||||||
* @param energyGrid grid
|
* @param energyGrid grid
|
||||||
*/
|
*/
|
||||||
void onThresholdPass( IEnergyGrid energyGrid );
|
void onThresholdPass( @Nonnull IEnergyGrid energyGrid );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ package appeng.api.networking.events;
|
|||||||
|
|
||||||
|
|
||||||
import appeng.api.storage.IMEMonitor;
|
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 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.monitor = o;
|
||||||
this.channel = chan;
|
this.channel = chan;
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking.pathing;
|
package appeng.api.networking.pathing;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.networking.IGridCache;
|
import appeng.api.networking.IGridCache;
|
||||||
|
|
||||||
|
|
||||||
@@ -39,6 +41,7 @@ public interface IPathingGrid extends IGridCache
|
|||||||
* @return the controller state of the network, useful if you want to
|
* @return the controller state of the network, useful if you want to
|
||||||
* require a controller for a feature.
|
* require a controller for a feature.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
ControllerState getControllerState();
|
ControllerState getControllerState();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,11 +24,12 @@
|
|||||||
package appeng.api.networking.security;
|
package appeng.api.networking.security;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.networking.IGridHost;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
|
|
||||||
|
|
||||||
public interface IActionHost extends IGridHost
|
public interface IActionHost
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,5 +40,6 @@ public interface IActionHost extends IGridHost
|
|||||||
* @return the the gridnode that actions from this IGridHost are preformed
|
* @return the the gridnode that actions from this IGridHost are preformed
|
||||||
* by.
|
* by.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGridNode getActionableNode();
|
IGridNode getActionableNode();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 );
|
||||||
|
}
|
||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking.security;
|
package appeng.api.networking.security;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnegative;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
@@ -46,7 +49,7 @@ public interface ISecurityGrid extends IGridCache
|
|||||||
*
|
*
|
||||||
* @return true if the player has permissions.
|
* @return true if the player has permissions.
|
||||||
*/
|
*/
|
||||||
boolean hasPermission( EntityPlayer player, SecurityPermissions perm );
|
boolean hasPermission( @Nonnull EntityPlayer player, @Nonnull SecurityPermissions perm );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a player has permissions.
|
* Check if a player has permissions.
|
||||||
@@ -56,7 +59,7 @@ public interface ISecurityGrid extends IGridCache
|
|||||||
*
|
*
|
||||||
* @return true if the player has permissions.
|
* @return true if the player has permissions.
|
||||||
*/
|
*/
|
||||||
boolean hasPermission( int playerID, SecurityPermissions perm );
|
boolean hasPermission( @Nonnegative int playerID, @Nonnull SecurityPermissions perm );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return PlayerID of the admin, or owner, this is the person who placed the security block.
|
* @return PlayerID of the admin, or owner, this is the person who placed the security block.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ package appeng.api.networking.security;
|
|||||||
|
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.Map;
|
||||||
|
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ public interface ISecurityProvider
|
|||||||
*
|
*
|
||||||
* @param playerPerms player permissions
|
* @param playerPerms player permissions
|
||||||
*/
|
*/
|
||||||
void readPermissions( HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms );
|
void readPermissions( Map<Integer, EnumSet<SecurityPermissions>> playerPerms );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return is security on or off?
|
* @return is security on or off?
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ package appeng.api.networking.security;
|
|||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
|
|
||||||
|
|
||||||
@@ -41,5 +43,5 @@ public interface ISecurityRegistry
|
|||||||
* @param playerID player id
|
* @param playerID player id
|
||||||
* @param permissions permissions of player
|
* @param permissions permissions of player
|
||||||
*/
|
*/
|
||||||
void addPlayer( int playerID, EnumSet<SecurityPermissions> permissions );
|
void addPlayer( int playerID, @Nonnull EnumSet<SecurityPermissions> permissions );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
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;
|
package appeng.api.networking.storage;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.storage.StorageChannel;
|
import appeng.api.storage.IStorageChannel;
|
||||||
import appeng.api.storage.data.IAEStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
|
|
||||||
@@ -50,5 +50,5 @@ public interface IStackWatcherHost
|
|||||||
* @param src action source
|
* @param src action source
|
||||||
* @param chan storage channel
|
* @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.IGridCache;
|
||||||
import appeng.api.networking.IGridHost;
|
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.ICellContainer;
|
||||||
import appeng.api.storage.ICellProvider;
|
import appeng.api.storage.ICellProvider;
|
||||||
|
import appeng.api.storage.IStorageChannel;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.IStorageMonitorable;
|
||||||
import appeng.api.storage.StorageChannel;
|
|
||||||
import appeng.api.storage.data.IAEStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ public interface IStorageGrid extends IGridCache, IStorageMonitorable
|
|||||||
*
|
*
|
||||||
* @param input injected items
|
* @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
|
* Used to add a cell provider to the storage system
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking.ticking;
|
package appeng.api.networking.ticking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
|
|
||||||
|
|
||||||
@@ -45,18 +47,18 @@ public interface IGridTickable
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* You can return null, if you wish to tick using MC's ticking mechanism, or
|
* Return a valid TickingRequest to tell AE a guide for which type of
|
||||||
* you can return a valid TickingRequest to tell AE a guide for which type
|
* responsiveness your device wants.
|
||||||
* of responsiveness your device wants.
|
|
||||||
*
|
*
|
||||||
* this will be called for your tile any time your tile changes grids, this
|
* This will be called for your tile any time your tile changes grids, this
|
||||||
* can happen at any time, so if your using the sleep feature you may wish
|
* can happen at any time, so if your using the sleep feature you may wish
|
||||||
* to preserve your sleep, in the result of this method. or you can simply
|
* to preserve your sleep, in the result of this method. or you can simply
|
||||||
* reset it.
|
* reset it.
|
||||||
*
|
*
|
||||||
* @return null or a valid new TickingRequest
|
* @return a valid new TickingRequest
|
||||||
*/
|
*/
|
||||||
TickingRequest getTickingRequest( IGridNode node );
|
@Nonnull
|
||||||
|
TickingRequest getTickingRequest( @Nonnull IGridNode node );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AE lets you adjust your tick rate based on the results of your tick, if
|
* AE lets you adjust your tick rate based on the results of your tick, if
|
||||||
@@ -67,11 +69,12 @@ public interface IGridTickable
|
|||||||
*
|
*
|
||||||
* Note: this is never called if you return null from getTickingRequest.
|
* Note: this is never called if you return null from getTickingRequest.
|
||||||
*
|
*
|
||||||
* @param TicksSinceLastCall the number of world ticks that were skipped since your last
|
* @param ticksSinceLastCall the number of world ticks that were skipped since your last
|
||||||
* tick, you can use this to adjust speed of processing or adjust
|
* tick, you can use this to adjust speed of processing or adjust
|
||||||
* your tick rate.
|
* your tick rate.
|
||||||
*
|
*
|
||||||
* @return tick rate adjustment.
|
* @return tick rate adjustment.
|
||||||
*/
|
*/
|
||||||
TickRateModulation tickingRequest( IGridNode node, int TicksSinceLastCall );
|
@Nonnull
|
||||||
|
TickRateModulation tickingRequest( @Nonnull IGridNode node, int ticksSinceLastCall );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking.ticking;
|
package appeng.api.networking.ticking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.networking.IGridCache;
|
import appeng.api.networking.IGridCache;
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
|
|
||||||
@@ -42,7 +44,7 @@ public interface ITickManager extends IGridCache
|
|||||||
*
|
*
|
||||||
* @param node gridnode
|
* @param node gridnode
|
||||||
*/
|
*/
|
||||||
boolean alertDevice( IGridNode node );
|
boolean alertDevice( @Nonnull IGridNode node );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* disables ticking for your device.
|
* disables ticking for your device.
|
||||||
@@ -51,7 +53,7 @@ public interface ITickManager extends IGridCache
|
|||||||
*
|
*
|
||||||
* @return if the call was successful.
|
* @return if the call was successful.
|
||||||
*/
|
*/
|
||||||
boolean sleepDevice( IGridNode node );
|
boolean sleepDevice( @Nonnull IGridNode node );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* enables ticking for your device, undoes a sleepDevice call.
|
* enables ticking for your device, undoes a sleepDevice call.
|
||||||
@@ -60,5 +62,5 @@ public interface ITickManager extends IGridCache
|
|||||||
*
|
*
|
||||||
* @return if the call was successful.
|
* @return if the call was successful.
|
||||||
*/
|
*/
|
||||||
boolean wakeDevice( IGridNode node );
|
boolean wakeDevice( @Nonnull IGridNode node );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ package appeng.api.recipes;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import appeng.api.exceptions.MissingIngredientError;
|
import appeng.api.exceptions.MissingIngredientException;
|
||||||
import appeng.api.exceptions.RecipeError;
|
import appeng.api.exceptions.RecipeException;
|
||||||
import appeng.api.exceptions.RegistrationError;
|
import appeng.api.exceptions.RegistrationException;
|
||||||
|
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public interface ICraftHandler
|
public interface ICraftHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -40,15 +40,15 @@ public interface ICraftHandler
|
|||||||
* @param input parsed inputs
|
* @param input parsed inputs
|
||||||
* @param output parsed outputs
|
* @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.
|
* called when all recipes are parsed, and your required to register your recipe.
|
||||||
*
|
*
|
||||||
* @throws RegistrationError
|
* @throws RegistrationException
|
||||||
* @throws MissingIngredientError
|
* @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 net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.api.exceptions.MissingIngredientError;
|
import appeng.api.exceptions.MissingIngredientException;
|
||||||
import appeng.api.exceptions.RegistrationError;
|
import appeng.api.exceptions.RegistrationException;
|
||||||
|
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public interface IIngredient
|
public interface IIngredient
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -39,10 +39,10 @@ public interface IIngredient
|
|||||||
*
|
*
|
||||||
* @return a single ItemStack for the recipe handler.
|
* @return a single ItemStack for the recipe handler.
|
||||||
*
|
*
|
||||||
* @throws RegistrationError
|
* @throws RegistrationException
|
||||||
* @throws MissingIngredientError
|
* @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
|
* 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.
|
* @return an array of ItemStacks for the recipe handler.
|
||||||
*
|
*
|
||||||
* @throws RegistrationError
|
* @throws RegistrationException
|
||||||
* @throws MissingIngredientError
|
* @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
|
* 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.
|
* Bakes the lists in for faster runtime look-ups.
|
||||||
*
|
*
|
||||||
* @throws MissingIngredientError
|
* @throws MissingIngredientException
|
||||||
* @throws RegistrationError
|
* @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
|
* Represents the AE2 Recipe Loading/Reading Class
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface IRecipeHandler
|
public interface IRecipeHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import java.io.BufferedReader;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public interface IRecipeLoader
|
public interface IRecipeLoader
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
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
|
* @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
|
* 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 is item
|
||||||
* @param chan storage channel
|
* @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.
|
* 0 - cell is missing.
|
||||||
@@ -86,10 +87,10 @@ public interface ICellHandler
|
|||||||
*
|
*
|
||||||
* @return get the status of the cell based on its contents.
|
* @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.
|
* @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 );
|
||||||
}
|
}
|
||||||
@@ -28,10 +28,10 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
|
||||||
|
|
||||||
public interface ICellInventory extends IMEInventory<IAEItemStack>
|
public interface ICellInventory<T extends IAEStack<T>> extends IMEInventory<T>
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ package appeng.api.storage;
|
|||||||
|
|
||||||
|
|
||||||
import appeng.api.config.IncludeExclude;
|
import appeng.api.config.IncludeExclude;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
|
||||||
|
|
||||||
public interface ICellInventoryHandler extends IMEInventoryHandler<IAEItemStack>
|
public interface ICellInventoryHandler<T extends IAEStack<T>> extends IMEInventoryHandler<T>
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public interface ICellProvider
|
|||||||
*
|
*
|
||||||
* @return a valid list of handlers, NEVER NULL
|
* @return a valid list of handlers, NEVER NULL
|
||||||
*/
|
*/
|
||||||
List<IMEInventoryHandler> getCellArray( StorageChannel channel );
|
List<IMEInventoryHandler> getCellArray( IStorageChannel<?> channel );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the storage's priority.
|
* the storage's priority.
|
||||||
|
|||||||
@@ -24,9 +24,14 @@
|
|||||||
package appeng.api.storage;
|
package appeng.api.storage;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
|
|
||||||
import appeng.api.IAppEngApi;
|
import appeng.api.IAppEngApi;
|
||||||
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,9 +46,12 @@ public interface ICellRegistry
|
|||||||
/**
|
/**
|
||||||
* Register a new handler.
|
* Register a new handler.
|
||||||
*
|
*
|
||||||
|
* Never be call before {@link FMLInitializationEvent} was handled by AE2.
|
||||||
|
* Will throw an exception otherwise.
|
||||||
|
*
|
||||||
* @param handler cell handler
|
* @param handler cell handler
|
||||||
*/
|
*/
|
||||||
void addCellHandler( ICellHandler handler );
|
void addCellHandler( @Nonnull ICellHandler handler );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return true, if you can get a InventoryHandler for the item passed.
|
* return true, if you can get a InventoryHandler for the item passed.
|
||||||
@@ -62,6 +70,7 @@ public interface ICellRegistry
|
|||||||
*
|
*
|
||||||
* @return the handler registered for this item type.
|
* @return the handler registered for this item type.
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
ICellHandler getHandler( ItemStack is );
|
ICellHandler getHandler( ItemStack is );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,5 +82,6 @@ public interface ICellRegistry
|
|||||||
*
|
*
|
||||||
* @return new IMEInventoryHandler, or null if there isn't one.
|
* @return new IMEInventoryHandler, or null if there isn't one.
|
||||||
*/
|
*/
|
||||||
IMEInventoryHandler getCellInventory( ItemStack is, ISaveProvider host, StorageChannel chan );
|
@Nullable
|
||||||
|
<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.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.IAEStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
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
|
* If you want to request a stack of an item, you should should determine that prior to requesting the stack from the
|
||||||
* inventory.
|
* 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.
|
* @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
|
* 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
|
* @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.
|
* 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
|
* @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
|
* @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
|
* 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.
|
* 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
|
* @return if its prioritized
|
||||||
*/
|
*/
|
||||||
boolean isPrioritized( StackType input );
|
boolean isPrioritized( T input );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* determine if an item can be accepted and stored.
|
* 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
|
* @return if the item can be added
|
||||||
*/
|
*/
|
||||||
boolean canAccept( StackType input );
|
boolean canAccept( T input );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* determine what the priority of the inventory is.
|
* determine what the priority of the inventory is.
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import appeng.api.storage.data.IAEStack;
|
|||||||
import appeng.api.storage.data.IItemList;
|
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
|
@Override
|
||||||
@Deprecated
|
@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(...)
|
* Get access to the full item list of the network, preferred over {@link IMEInventory} .getAvailableItems(...)
|
||||||
|
|||||||
@@ -24,12 +24,12 @@
|
|||||||
package appeng.api.storage;
|
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.networking.storage.IBaseMonitor;
|
||||||
import appeng.api.storage.data.IAEStack;
|
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
|
* @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.
|
* 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
|
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;
|
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.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
|
|
||||||
import appeng.api.networking.crafting.ICraftingLink;
|
import appeng.api.networking.crafting.ICraftingLink;
|
||||||
import appeng.api.networking.crafting.ICraftingRequester;
|
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.IAEFluidStack;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
|
||||||
|
|
||||||
public interface IStorageHelper
|
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.
|
* load a crafting link from nbt data.
|
||||||
*
|
*
|
||||||
@@ -53,73 +90,4 @@ public interface IStorageHelper
|
|||||||
*/
|
*/
|
||||||
ICraftingLink loadCraftingLink( NBTTagCompound data, ICraftingRequester req );
|
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;
|
package appeng.api.storage;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,13 +34,6 @@ import appeng.api.storage.data.IAEItemStack;
|
|||||||
public interface IStorageMonitorable
|
public interface IStorageMonitorable
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
<T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel );
|
||||||
* Access the item inventory for the monitorable storage.
|
|
||||||
*/
|
|
||||||
IMEMonitor<IAEItemStack> getItemInventory();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Access the fluid inventory for the monitorable storage.
|
|
||||||
*/
|
|
||||||
IMEMonitor<IAEFluidStack> getFluidInventory();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ package appeng.api.storage;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
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).
|
* @return Null if the network cannot be accessed by the given action source (i.e. security doesn't permit it).
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@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)
|
* 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
|
* 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
|
* 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.
|
* 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.
|
import appeng.api.storage.IStorageChannel;
|
||||||
*/
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
public class BaseActionSource
|
|
||||||
|
|
||||||
|
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.
|
* Don't Implement.
|
||||||
*
|
*
|
||||||
* Construct with Util.createFluidStack( FluidStack )
|
* Construct with AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class).createStack( FluidStack )
|
||||||
*/
|
*/
|
||||||
public interface IAEFluidStack extends IAEStack<IAEFluidStack>
|
public interface IAEFluidStack extends IAEStack<IAEFluidStack>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import net.minecraft.item.ItemStack;
|
|||||||
*
|
*
|
||||||
* Don't Implement.
|
* Don't Implement.
|
||||||
*
|
*
|
||||||
* Construct with Util.createItemStack( ItemStack )
|
* Construct with AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class).createStack( ItemStack )
|
||||||
*/
|
*/
|
||||||
public interface IAEItemStack extends IAEStack<IAEItemStack>
|
public interface IAEItemStack extends IAEStack<IAEItemStack>
|
||||||
{
|
{
|
||||||
@@ -46,7 +46,7 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
|
|||||||
*
|
*
|
||||||
* @return new ItemStack
|
* @return new ItemStack
|
||||||
*/
|
*/
|
||||||
ItemStack getItemStack();
|
ItemStack createItemStack();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* is there NBT Data for this item?
|
* 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)
|
* @return true if it is the same type (same item, damage, nbt)
|
||||||
*/
|
*/
|
||||||
boolean isSameType( ItemStack stored );
|
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 io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
import appeng.api.config.FuzzyMode;
|
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
|
* @param is added item
|
||||||
*/
|
*/
|
||||||
void add( StackType is );
|
void add( T is );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* number of items in the stack.
|
* number of items in the stack.
|
||||||
@@ -56,7 +57,7 @@ public interface IAEStack<StackType extends IAEStack>
|
|||||||
*
|
*
|
||||||
* @param stackSize , ItemStack.stackSize = N
|
* @param stackSize , ItemStack.stackSize = N
|
||||||
*/
|
*/
|
||||||
StackType setStackSize( long stackSize );
|
T setStackSize( long stackSize );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as getStackSize, but for requestable items. ( LP )
|
* 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.
|
* @return basically itemStack.stackSize = N but for setStackSize items.
|
||||||
*/
|
*/
|
||||||
StackType setCountRequestable( long countRequestable );
|
T setCountRequestable( long countRequestable );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* true, if the item can be crafted.
|
* true, if the item can be crafted.
|
||||||
@@ -84,12 +85,12 @@ public interface IAEStack<StackType extends IAEStack>
|
|||||||
*
|
*
|
||||||
* @param isCraftable can item be crafted
|
* @param isCraftable can item be crafted
|
||||||
*/
|
*/
|
||||||
StackType setCraftable( boolean isCraftable );
|
T setCraftable( boolean isCraftable );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clears, requestable, craftable, and stack sizes.
|
* clears, requestable, craftable, and stack sizes.
|
||||||
*/
|
*/
|
||||||
StackType reset();
|
T reset();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns true, if the item can be crafted, requested, or extracted.
|
* returns true, if the item can be crafted, requested, or extracted.
|
||||||
@@ -148,16 +149,14 @@ public interface IAEStack<StackType extends IAEStack>
|
|||||||
boolean equals( Object obj );
|
boolean equals( Object obj );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* compare stacks using fuzzy logic
|
* Compare the same subtype of {@link IAEStack} with another using a fuzzy comparison.
|
||||||
*
|
*
|
||||||
* a IAEItemStack to another AEItemStack or a ItemStack.
|
* @param other The stack to compare.
|
||||||
*
|
* @param mode Which {@link FuzzyMode} should be used.
|
||||||
* @param st stacks
|
|
||||||
* @param mode used fuzzy mode
|
|
||||||
*
|
*
|
||||||
* @return true if two stacks are equal based on AE Fuzzy Comparison.
|
* @return true if two stacks are equal based on AE Fuzzy Comparison.
|
||||||
*/
|
*/
|
||||||
boolean fuzzyComparison( Object st, FuzzyMode mode );
|
boolean fuzzyComparison( T other, FuzzyMode mode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Slower for disk saving, but smaller/more efficient for packets.
|
* Slower for disk saving, but smaller/more efficient for packets.
|
||||||
@@ -173,21 +172,14 @@ public interface IAEStack<StackType extends IAEStack>
|
|||||||
*
|
*
|
||||||
* @return a new Stack, which is copied from the original.
|
* @return a new Stack, which is copied from the original.
|
||||||
*/
|
*/
|
||||||
StackType copy();
|
T copy();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create an empty stack.
|
* create an empty stack.
|
||||||
*
|
*
|
||||||
* @return a new stack, which represents an empty copy of the original.
|
* @return a new stack, which represents an empty copy of the original.
|
||||||
*/
|
*/
|
||||||
StackType empty();
|
T empty();
|
||||||
|
|
||||||
/**
|
|
||||||
* obtain the NBT Data for the item.
|
|
||||||
*
|
|
||||||
* @return nbt data
|
|
||||||
*/
|
|
||||||
IAETagCompound getTagCompound();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if the stack is a {@link IAEItemStack}
|
* @return true if the stack is a {@link IAEItemStack}
|
||||||
@@ -202,16 +194,12 @@ public interface IAEStack<StackType extends IAEStack>
|
|||||||
/**
|
/**
|
||||||
* @return ITEM or FLUID
|
* @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();
|
ItemStack asItemStackRepresentation();
|
||||||
|
|
||||||
/**
|
|
||||||
* Used internally to show that it should show a Crafting label instead of a "1"
|
|
||||||
*/
|
|
||||||
void setShowCraftingLabel( boolean showCraftingLabel );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,9 +34,8 @@ import appeng.api.config.FuzzyMode;
|
|||||||
*
|
*
|
||||||
* Don't Implement.
|
* 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
|
* @param option added stack
|
||||||
*/
|
*/
|
||||||
void add( StackType option ); // adds stack as is
|
void add( T option ); // adds stack as is
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param i compared item
|
* @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
|
* @return a stack equivalent to the stack passed in, but with the correct stack size information, or null if its
|
||||||
* not present
|
* not present
|
||||||
*/
|
*/
|
||||||
StackType findPrecise( StackType i );
|
T findPrecise( T i );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param input compared item
|
* @param input compared item
|
||||||
*
|
*
|
||||||
* @return a list of relevant fuzzy matched stacks
|
* @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
|
* @return true if there are no items in the list
|
||||||
|
|||||||
@@ -26,15 +26,20 @@ package appeng.api.storage.data;
|
|||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import appeng.api.storage.IStorageChannel;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a list of items in AE.
|
* Represents a list of items in AE.
|
||||||
*
|
*
|
||||||
* Don't Implement.
|
* 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
|
* @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.
|
* 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
|
* @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
|
* 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
|
* @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
|
* @return the first item in the list
|
||||||
*/
|
*/
|
||||||
StackType getFirstItem();
|
T getFirstItem();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the number of items in the list
|
* @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.
|
* allows you to iterate the list.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
Iterator<StackType> iterator();
|
Iterator<T> iterator();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* resets stack sizes to 0.
|
* resets stack sizes to 0.
|
||||||
|
|||||||
+10
-12
@@ -21,24 +21,22 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package appeng.api.networking.security;
|
package appeng.api.util;
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Consider refactoring.
|
public enum AECableSize
|
||||||
*/
|
|
||||||
public class MachineSource extends BaseActionSource
|
|
||||||
{
|
{
|
||||||
|
NONE,
|
||||||
|
NORMAL,
|
||||||
|
DENSE;
|
||||||
|
|
||||||
public final IActionHost via;
|
public static AECableSize min( AECableSize a, AECableSize b )
|
||||||
|
|
||||||
public MachineSource( final IActionHost v )
|
|
||||||
{
|
{
|
||||||
this.via = v;
|
return a.compareTo( b ) < 0 ? a : b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public static AECableSize max( AECableSize a, AECableSize b )
|
||||||
public boolean isMachine()
|
|
||||||
{
|
{
|
||||||
return true;
|
return a.compareTo( b ) > 0 ? a : b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,33 +29,132 @@ public enum AECableType
|
|||||||
/**
|
/**
|
||||||
* No Cable present.
|
* No Cable present.
|
||||||
*/
|
*/
|
||||||
NONE,
|
NONE( AECableVariant.NONE, AECableSize.NONE ),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connections to this block should render as glass.
|
* Connections to this block should render as glass.
|
||||||
*/
|
*/
|
||||||
GLASS,
|
GLASS( AECableVariant.GLASS, AECableSize.NORMAL ),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connections to this block should render as covered.
|
* Connections to this block should render as covered.
|
||||||
*/
|
*/
|
||||||
COVERED,
|
COVERED( AECableVariant.COVERED, AECableSize.NORMAL ),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connections to this block should render as smart.
|
* Connections to this block should render as smart.
|
||||||
*/
|
*/
|
||||||
SMART,
|
SMART( AECableVariant.SMART, AECableSize.NORMAL ),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
||||||
*/
|
*/
|
||||||
DENSE_SMART;
|
DENSE_COVERED( AECableVariant.COVERED, AECableSize.DENSE ),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
||||||
|
*/
|
||||||
|
DENSE_SMART( AECableVariant.SMART, AECableSize.DENSE );
|
||||||
|
|
||||||
public static final AECableType[] VALIDCABLES = {
|
public static final AECableType[] VALIDCABLES = {
|
||||||
GLASS,
|
GLASS,
|
||||||
COVERED,
|
COVERED,
|
||||||
SMART,
|
SMART,
|
||||||
|
DENSE_COVERED,
|
||||||
DENSE_SMART
|
DENSE_SMART
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private final AECableVariant variant;
|
||||||
|
private final AECableSize size;
|
||||||
|
|
||||||
|
private AECableType( AECableVariant variant, AECableSize size )
|
||||||
|
{
|
||||||
|
this.variant = variant;
|
||||||
|
this.size = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AECableSize size()
|
||||||
|
{
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AECableVariant variant()
|
||||||
|
{
|
||||||
|
return variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValid()
|
||||||
|
{
|
||||||
|
return this.variant != AECableVariant.NONE && this.size != AECableSize.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDense()
|
||||||
|
{
|
||||||
|
return this.size == AECableSize.DENSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSmart()
|
||||||
|
{
|
||||||
|
return this.variant == AECableVariant.SMART;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AECableType min( AECableType a, AECableType b )
|
||||||
|
{
|
||||||
|
final AECableVariant v = AECableVariant.min( a.variant(), b.variant() );
|
||||||
|
final AECableSize s = AECableSize.min( a.size(), b.size() );
|
||||||
|
|
||||||
|
return AECableType.from( v, s );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AECableType max( AECableType a, AECableType b )
|
||||||
|
{
|
||||||
|
final AECableVariant v = AECableVariant.max( a.variant(), b.variant() );
|
||||||
|
final AECableSize s = AECableSize.max( a.size(), b.size() );
|
||||||
|
|
||||||
|
return AECableType.from( v, s );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static AECableType from( AECableVariant variant, AECableSize size )
|
||||||
|
{
|
||||||
|
switch( variant )
|
||||||
|
{
|
||||||
|
case GLASS:
|
||||||
|
switch( size )
|
||||||
|
{
|
||||||
|
case NORMAL:
|
||||||
|
return GLASS;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case COVERED:
|
||||||
|
switch( size )
|
||||||
|
{
|
||||||
|
case NORMAL:
|
||||||
|
return COVERED;
|
||||||
|
case DENSE:
|
||||||
|
return DENSE_COVERED;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case SMART:
|
||||||
|
switch( size )
|
||||||
|
{
|
||||||
|
case NORMAL:
|
||||||
|
return SMART;
|
||||||
|
case DENSE:
|
||||||
|
return DENSE_SMART;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 AlgorithmX2
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.api.util;
|
||||||
|
|
||||||
|
|
||||||
|
public enum AECableVariant
|
||||||
|
{
|
||||||
|
NONE,
|
||||||
|
GLASS,
|
||||||
|
COVERED,
|
||||||
|
SMART;
|
||||||
|
|
||||||
|
public static AECableVariant min( AECableVariant a, AECableVariant b )
|
||||||
|
{
|
||||||
|
return a.compareTo( b ) < 0 ? a : b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AECableVariant max( AECableVariant a, AECableVariant b )
|
||||||
|
{
|
||||||
|
return a.compareTo( b ) > 0 ? a : b;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -100,14 +100,12 @@ public abstract class AEBaseBlock extends Block
|
|||||||
return new BlockStateContainer( this, this.getAEStates() );
|
return new BlockStateContainer( this, this.getAEStates() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( "deprecation" )
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean isNormalCube( IBlockState state )
|
public final boolean isNormalCube( IBlockState state )
|
||||||
{
|
{
|
||||||
return this.isFullSize() && this.isOpaque();
|
return this.isFullSize() && this.isOpaque();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( "deprecation" )
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox( IBlockState state, IBlockAccess source, BlockPos pos )
|
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 );
|
return super.getSelectedBoundingBox( state, w, pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( "deprecation" )
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean isOpaqueCube( IBlockState state )
|
public final boolean isOpaqueCube( IBlockState state )
|
||||||
{
|
{
|
||||||
@@ -281,14 +278,12 @@ public abstract class AEBaseBlock extends Block
|
|||||||
return super.collisionRayTrace( state, w, pos, a, b );
|
return super.collisionRayTrace( state, w, pos, a, b );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( "deprecation" )
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasComparatorInputOverride( IBlockState state )
|
public boolean hasComparatorInputOverride( IBlockState state )
|
||||||
{
|
{
|
||||||
return this.isInventory();
|
return this.isInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( "deprecation" )
|
|
||||||
@Override
|
@Override
|
||||||
public int getComparatorInputOverride( IBlockState state, final World worldIn, final BlockPos pos )
|
public int getComparatorInputOverride( IBlockState state, final World worldIn, final BlockPos pos )
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user