Compare commits

...

84 Commits

Author SHA1 Message Date
Flithor b82df25c75 Update zh_cn.lang (#3137) 2017-10-21 00:47:07 +02:00
fscan cc9b33b473 Implement Advancements (#3160)
Improvements welcome.
2017-10-20 23:54:18 +02:00
fscan 5496b746ea Fix Tiny TNT (#3162) 2017-10-20 23:52:55 +02:00
fscan f80f623ccf Fix AESharedItemStack#compareNBT to get consistent ordering. (#3169) 2017-10-20 23:25:18 +02:00
yueh cba6c5500f Fixes inscriber crash with name presses. 2017-10-16 21:41:44 +02:00
Florian Scandella bc8268af94 readd the non-fortune version 2017-10-15 16:07:12 +02:00
Florian Scandella 297cd16702 cleanup BlockQuartzOre and circumvent Forge bug 2017-10-15 15:53:31 +02:00
Florian Scandella 41711e50b9 Check for null in UpgradeInventory#saveChanges. Fixes #3159 2017-10-14 23:53:34 +02:00
Florian Scandella 2bfb8b75e8 Return correct item defintion. 2017-10-14 19:06:57 +02:00
yueh 58e96aa3de Fixes new modes not being considered JEI modes. 2017-10-14 14:39:05 +02:00
fscan 4f07b63b13 API cleanups (#3155)
* Remove obsolete api and fix some warning
* Move MEMonitorHandler to internal code and fix some warnings
* Rename exceptions to conform to naming scheme
2017-10-14 14:15:28 +02:00
yueh 905dd6c888 Added a clientside config to keep or clear the search filter when opening. (#3154)
Closes #3153.
2017-10-14 14:13:18 +02:00
yueh ab7f35a9ee Further StorageChannel refactoring (#3152)
Updated Drives to support more than Item and Fluid cells.
Use Collections.emptyList() instead of creating empty ArrayLists.
Fixes a NPE with uninitialized ME Chests.

Fixes #3150
2017-10-14 14:12:24 +02:00
yueh 6e81f698c0 Refactored StorageChannel enum into an interface (#3138)
This replaces the static enum with a more dynamic interface providing
factory methods for handling network storage.
2017-10-08 17:59:30 +02:00
fscan 8ad8ce68b5 Added optional TE wrench support. (#3145) 2017-10-08 17:58:57 +02:00
yueh 644194d0d6 Updated Forge to 1.12.2 RB (#3141)
* Updated Forge to 1.12.2 RB

Updated mappings to the MDK defaults for 1.12.2
Updated related depdencies

* With Forge 14.23 not available for < 1.12.2, we have to drop support.

With one potential fix for TE corruption, this step should be
reasonable.
2017-10-08 17:34:05 +02:00
yueh 95b27f490c Added Registry for customized charger rates. (#3139)
* Added Registry for customized charger rates.
* Added rates for all chargable items/block.
* Charger and Inscriber now store 1.6k AE each instead of 1.5k
* A crank applies 160 AE instead of 150
* Charged certus now requires 1.6k instead of 1.5k
2017-10-08 17:33:06 +02:00
fscan 6032c0328e Fixes #3143: Queue network list updates in onTick (#3144) 2017-10-08 15:12:27 +02:00
fscan e8d554d69d Fix Inscriber recipe registration (#3131)
Fixes #3129
2017-10-02 22:03:22 +02:00
fscan 1e15b23506 Rework AEItemStack (#3091)
* Use itemstack as itemdef
* HIGH_TAG/LOW_TAG should be compared both directions
* Remove getTagCompound
* Make Itemlist implementation independent
* Cache item id for performance reasons
* Add preconditions to saveguard against external meddling
* Chache itemDamage
* Remove IAEStackSearchKey for now, rename getDisplayStack
2017-09-30 17:18:30 +02:00
yueh 2ed7a5598a Improved IGrinderRegistry (#3110)
* Improved IGrinderRegistry

Added a builder for grinder recipes similar to IInscriberRegistry.
Replaced different add methods with this builder.
IIinscriberRegistry#addRecipe and removeRecipe now return true on success.
2017-09-29 20:32:59 +02:00
yueh 1c05dd5834 Further improvments for the energygrid. (#3107)
* Further improvments for the enerygrid.

Simplified quartz fiber.
Removed different Actionable code paths and replaced with a unified
approach.
Dropped lastProvider/Requester, it simply iterates over all, but still
drops them when necessary.
2017-09-29 20:32:20 +02:00
Florian Scandella 632d124359 Fix ArithmeticException in PartP2PFEPower 2017-09-26 22:14:04 +02:00
yueh 829c18e2bb Make UVLLoader a bit more robust (#3102)
Catch all parsing exceptions instead of propagating them upwards as
these are meaningless for the actual test.
Renamed uvlMarker to ae2_uvl_marker just in case some other mod uses the
same key.
2017-09-21 20:42:23 +02:00
yueh d3a5be7ed6 Fixes #3105: Dupe bug due to forge default itemhandler implementation. (#3106) 2017-09-21 20:41:30 +02:00
Florian Scandella 217cbf0982 we dont use scala ... 2017-09-17 13:38:44 +02:00
fscan 4dd0a4cd96 Improve terminal search box (#3064)
Uses exsting JEI filter in JEI mode.
Preselects text for easy delete/change without using rightclick.
QoL improvements for focus handling.
2017-09-16 17:44:16 +02:00
Florian Scandella 54c0ce43ea fix fluid p2p voiding excess liquids 2017-09-14 18:38:29 +02:00
yueh bd8f43acbf Updated to forge 1.12.1 RB. (#3087)
Updated related deps.
2017-09-12 13:23:17 +02:00
yueh 970630a90d Refactored the BaseActionSource (#3063)
* Refactored the BaseActionSource

It now uses an interface `IActionSource` instead of a concrete class and further
subclasses. 

Instead of relying on a specific class for a certain action type, it now
uses methods with Optional as return values to determine a player or
machine issuing an action. Refer to the JavaDocs for the exact behaviour.

* `IActionHost` no longer extends `IGridHost`

It never used the additional functionality and if needed the `IGridNode`
will also provide a reference to the corresponding `IGridHost`.

Due to most crafting related GUIs being hardcoded to `IGridHost`, 
they no longer work when `IActionHost` is not extending it. Actually
`IActionHost` is the better solution for it, as it prevents us from looking
the grid up via the `IGridHost` and potentially finding a wrong grid.

* Interfaces now only lock the currently worked slot.

This allows `DualityInterface#onChangeInventory` to update slots of the same interface, should they be the source for a requested item and therefore updating their working set accordingly to queue further crafting requests for unfulfilled stack requirements.
2017-09-12 11:39:00 +02:00
yueh 771a944058 Fixes #3081: Fixes blocking mode blocking on empty inventory. (#3082) 2017-09-11 12:03:32 +02:00
Florian Scandella db1cd8c312 Cache the STORAGE_MONITORABLE_ACCESSOR Capability to reduce the amount of MENetworkCellArrayUpdates 2017-09-09 13:04:21 +02:00
fscan 375e1efb15 We don't need the showCraftingLabel flag, as IAEStack is perfectly fine with 0 size stacks. (#3071)
Adjust rendering code to use ItemStack with size 1 where required.
2017-09-09 12:58:22 +02:00
yueh 955fcac92a Correctly handle the grid power storage during onJoin/onSplit. 2017-09-03 13:40:30 +02:00
Florian Scandella 216e2cb1e3 Fix matter condenser input slot 2017-09-03 04:45:17 +02:00
Florian Scandella 53f5724657 Set stack size to 1 for rendering 2017-09-02 01:06:25 +02:00
Florian Scandella a3269826f9 cleanup inventory change handling 2017-08-31 14:01:46 +02:00
Florian Scandella 1a918be658 only calculate difference when it's the same item 2017-08-29 22:52:59 +02:00
Florian Scandella 90130e72aa call saveChanges when inventory changes. 2017-08-29 22:52:06 +02:00
Florian Scandella c8f10d92bb use index not slotNumber 2017-08-29 21:20:18 +02:00
fscan 548af3c6cc Use standard inheritance to propagage NBT events (#3058)
* Remove the old annotation system
* Use TileEntity#onLoad instead of onChunkLoad event
* Do not call invalidate in onChunkUnload and validate in onLoad
2017-08-28 09:34:09 +02:00
yueh 98b9380494 Fixes machines not extracting power from the local grid.
There is currently no difference between an external grid and the local
machines trying to extract power from the grid. Thus preventing any
external grid from stealing power also does prevent machines from
extracting, if there is no other provider available.

Also a small change to use a priorityqueue with the lowest percentage
stored first. This can better utilize the upper limit by reaching it
faster and exiting earlier.
2017-08-27 15:01:07 +02:00
fscan bbf4d4a9ce Spatial rework (#3048)
* Moved all spatial cells into a single dimension instead of one dimension per cell

Each cell will now be backed by a single region file each. So  backups and restores can still be done on a per cell level.

Old cells will not be migrated.

* Moved custom cell tracking to a capability based one on the world

The size and owner of a cell is now stored inside the capabilities of the world/dimension not a custom system and we can rely on forge handling the persistence of it.

* Added the cell id to the actual item tooltip, as this is now a real identifier and not an arbitrary dimension id.

* Added vanilla banners to the whitelist

* Added unittests to the dimension manager to ensure the algorithm mapping to the correct region file

* Updated the API to conform with the new dimenion/types/biomes registration and mappings

* Fixed a couple of bugs related to world/dimension/biome registration 

* Fixed a bug when transfering certain blocks due to passing missing/incorrect blockstate
2017-08-24 11:24:33 +02:00
yueh 1513ba3f6a Performance improvements for the energygrid (#3051)
* Performance improvements for the energygrid

Reworked the old recursive approach to a queue based loop.
Extract will try to prefer the next grid with the hightest amount of
stored energy.
Inject will try to prefer the grid with the lowest percentage stored.
Other operations are first come, first serve.

* Added a local buffer storage to EnergyGrid

This replaces the old not really working buffer with a special
IAEPowerStorage acting as buffer/proxy for the local energy demand as
well as temporary overflow should something provide more energy than
requested.

Currently it set to hold a maximum of 200 AE (+ optional overflow until
consumed). It will only be used locally, no other grid can use it to
avoid starving the neighbor grids before finding a energy cell.

* Fixes IExternalPowerSink

All implementations currently depend on the network demand being a valid
source, which might not be true.

Further it can cause the sink to iterate the network twice (demand and
inject) and both again for simulate and modulate.

Also it did not return the actual leftover amount instead of relying on
the demand matching it.

* Minor fixes related to removing nodes from a grid.

The grid did remove IStackWatcherHost not IEnergyWatcherHost, this was
fine for AE2 as only level emitters use it and they implement both.
But not for potential addons.

Also they would potentually not being removed as the are indexed by the
gridnodes not the machine.

Fixes #1004
2017-08-24 11:06:31 +02:00
yueh f03f8ec432 Remove RF dependency 2017-08-22 11:07:00 +02:00
Florian Scandella e1dcd588b7 add particle texture to charged quartz 2017-08-21 20:11:20 +02:00
fscan 8338a7d13e Fixes #3049: JEI recipe transfer can voiding items (#3053) 2017-08-21 14:39:29 +02:00
yueh b8e685b1b6 Fixes #3040: Cache recipe and revalidate it (#3042)
* Fixes #3040: Cache recipe and revalidate it

This caches the last used recipe instead of only the result. Which
allows to revalidate the crafting grid against the recipe itself before
hitting the CraftingManager again. Therefore avoiding a high performance
hit for recipe lookups, just find the potential same recipe again.

* Remove old recipe lookup as forge provides it now.

* Further optimizations.

These are a bit quick'n'dirty and need a better solution with a full
container/gui refactoring. But for now they provide some great benefits
in terms of performance.
2017-08-20 21:31:30 +02:00
yueh d84500c5b7 Fixes FE P2P tunnel drain issues
Only queue drain on modulate, also queue it for extracting from the
input side.
2017-08-20 14:35:31 +02:00
yueh a1679c944b Added SCS size to the Spatial IO Port. (#3045)
Uses the same format as the cells display in their tooltip for easy comparison.
2017-08-20 13:14:27 +02:00
fscan a3a39201d1 Missed vibration chamber when fixing the others. (#3050) 2017-08-19 21:31:16 +02:00
Emanuele Torre d788da687e Update it_it.lang (#3041) 2017-08-18 10:31:15 +02:00
yueh 030e0c6a14 Updated gradle.properties for deploying to multiple minecraft versions 2017-08-18 00:47:31 +02:00
fscan 8e4265aa33 P2P Tunnel improvements (#3039)
* Fix P2P Tunnels randomly resetting to ME
* Allow one way push and pull. Outputs can pull from the input side, input can push into outputs.
2017-08-18 00:44:19 +02:00
Gunther De Wachter 80eaa032b9 Fixes #3011: placing the last part in off-hand clearing main hand as well 2017-08-17 22:19:50 +02:00
yueh bee9c70497 Added 1.12.1 as accepted version. 2017-08-17 21:17:55 +02:00
yueh c4fa21c193 Removes coremod (#3038)
From now on every integration must not rely on method stripping through
a coremod or @Optional. Notable example for a very good solution is IC2.

As consequence this drops all support for RF and mods must support on of
our supported energy types. At the time of writing, ForgeEnergy and
IC2/EU.
2017-08-17 21:16:57 +02:00
Gunther De Wachter 8a7450168b Updated JEI plugin to newer API methods. 2017-08-17 20:41:20 +02:00
Gunther De Wachter 7cb641cdc8 Fix shift clicking memory card still triggering off-hand item/block usage. 2017-08-17 20:41:20 +02:00
Gunther De Wachter b5b8050c4c Added workaround for sorting items on amount with fake amount when showing crafting label 2017-08-17 20:41:20 +02:00
Gunther De Wachter e65083b045 Fixed dropping items on the ground when clicking on a crafting label with items in hand 2017-08-17 20:41:20 +02:00
yueh b61219ef88 Covered dense cables (#3030)
* Renamed all dense smart cable related things to include smart
* Added dense covered cables
* Added abstract PartDenseCable to reduce redundant code
* Added dense covered recipes

* Ensures ItemPart ordering to be consitent.

Now takes the metadata into account to preserve the ordering for colored
items instead of just the part type name and depend on the insertion
order of a hashmap.
2017-08-17 18:41:39 +02:00
yueh 4f9fd1b369 IC2 rework to avoid a coremod or @Optional (#3034)
* IC2 rework to avoid a coremod or @Optional

Updated IC2 dependency

Refactored IC2 itemcharging to use an IBackupElectricManager.
Allows charging any ae powered item by using an IBackupElectricManager
instead of having to implement IElectricItem and stripping it by some
sort.

Updated IAEItemPowerStorage to use Actionable for an easier handling
with power APIs supporting a simulation.

Refactored EU P2P to avoid method stripping
Use a modified internal BasicSinkSource instead of implementing
IEnergySource and IEnergySink directly on the tunnel.

Removed the superfluous EU P2P layers.

* Removed internalBattery due to being too complex

* Creative Energy Cell is not a chargeable item
2017-08-17 17:35:34 +02:00
yueh 630fae3f73 Fixes #3024: Crash on recipe lookup for disabled features (#3026)
* Fixes #3024: Crash on recipe lookup for disabled features

Adds a new recipe condition for a single AEFeature or a list of them.
Moved the factories to their own package, in preparation of phasing out
the old recipe handling.
2017-08-17 17:17:26 +02:00
yueh 488ef1b544 Fixes recipes to use correct ingredients
Fluix Pearls instead of Fluix Crystals for spatial related items.
Fluix cables for most items, not any cable to avoid loops or unwanted
crafting steps.
2017-08-17 15:12:34 +02:00
fscan 098ee2f000 Making charged certus ore glow again (#3035) 2017-08-17 11:01:31 +02:00
fscan 04d2b06c0d Ignore MOVE_REGION when clicking on crafting slots (#3032)
Exclude crafting slots from list of slots to move on space click.

Fixes #3031
2017-08-15 15:07:42 +02:00
fscan ac48ab02fc Fix crash in clearStack (#3033) 2017-08-15 15:05:12 +02:00
fscan 9022150e38 Fill existing stacks first when adding to player inventory. (#3025) 2017-08-14 11:03:53 +02:00
yueh 65c6d2249a Fixes encoding issues with spatial cell names 2017-08-13 19:02:03 +02:00
yueh 8e7f79a9ea Ensure gradle uses UTF-8 2017-08-12 16:35:38 +02:00
fscan 95b48b9438 Registration rework (#3018)
Refactored component registration.

Fixes #3008: crank rendering
2017-08-12 15:02:50 +02:00
yueh cdd76b7b22 Added helpers for hex and color output. (#3027) 2017-08-12 14:52:31 +02:00
fscan 3e2bc0e038 Inscriber improvements and fixes (#3028) 2017-08-12 14:52:01 +02:00
yueh eec3e59eea Add missing annotations 2017-08-11 21:44:30 +02:00
yueh e39855b48f Use qualified method and field access 2017-08-11 21:43:47 +02:00
yueh cdcab7d91c Organise Imports 2017-08-11 21:42:26 +02:00
yueh 27ad2c2b96 Code format 2017-08-11 21:41:51 +02:00
yueh 542a2e5d5a Fixes NPE due to using wrong field. 2017-08-11 21:33:57 +02:00
fscan 3b58f5e8da fix me io port (#3019) 2017-08-09 10:39:07 +02:00
fscan 092afad4a5 Correctly detect redstone updates on all sides. (#3017) 2017-08-09 10:30:44 +02:00
Gunther De Wachter 6aa810d62a Re-add a missing piece of IC2 integration code.
This should fix a bunch of IC2 spam in the console and allow items to be charged in IC2 blocks.
2017-08-07 10:15:26 +02:00
Gunther De Wachter 41d98f9944 Fixed ME Chest visually not updating its cell state 2017-08-05 11:43:57 +02:00
Gunther De Wachter 1b198979fd Fixed export bus never speeding up. 2017-08-05 10:45:13 +02:00
669 changed files with 9192 additions and 9618 deletions
+6 -3
View File
@@ -45,6 +45,12 @@ apply from: 'gradle/scripts/optional.gradle'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
// ensure everything uses UTF-8 and not some random codepage chosen by gradle
compileJava.options.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
version = aeversion + "-" + aechannel + "-" + aebuild
group = aegroup
archivesBaseName = aebasename
@@ -52,7 +58,6 @@ archivesBaseName = aebasename
// Add Coremod Manifest
jar {
manifest {
attributes 'FMLCorePluginContainsFMLMod': 'true'
attributes 'FMLAT': 'appeng_at.cfg'
}
@@ -68,8 +73,6 @@ jar {
}
minecraft {
coreMod = "appeng.coremod.AppEngCore"
version = minecraft_version + "-" + forge_version
replaceIn "AEConfig.java"
+14 -8
View File
@@ -7,20 +7,26 @@ aebasename=appliedenergistics2
#########################################################
# Versions #
#########################################################
minecraft_version=1.12
mcp_mappings=snapshot_20170704
forge_version=14.21.1.2412
minecraft_version=1.12.2
mcp_mappings=snapshot_20171003
forge_version=14.23.0.2491
#########################################################
# Installable #
#########################################################
hwyla_version=1.8.19-B33_1.12
hwyla_version=1.8.20-B35_1.12
#########################################################
# Provided APIs #
#########################################################
jei_version=4.7.1.69
jei_version=4.8.0.105
tesla_version=1.0.61
ic2_version=2.8.7-ex112
rf_version=2.0.0.1
top_version=1.12-1.4.8-2
ic2_version=2.8.19-ex112
top_version=1.12-1.4.18-10
cofhcore_version=1.12-4.+
#########################################################
# Deployment #
#########################################################
website_version=1.12.2
curse_versions=1.12.2
+2 -5
View File
@@ -69,17 +69,14 @@ dependencies {
mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
// mods "com.github.mcjty:compatlayer:${compatlayer_version}"
// compile against provided APIs
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
compileOnly "net.darkhax.tesla:Tesla-${minecraft_version}:${tesla_version}"
compileOnly "net.darkhax.tesla:Tesla-1.12:${tesla_version}"
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
// deobfCompile "mcp.mobius.waila:Hwyla:${hwyla_version}"
deobfCompile "cofh:RedstoneFlux:${minecraft_version}-${rf_version}:universal"
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
// at runtime, use the full JEI jar
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
+10 -24
View File
@@ -25,14 +25,13 @@ package appeng.api;
import appeng.api.definitions.IDefinitions;
import appeng.api.exceptions.FailedConnection;
import appeng.api.features.IRegistryContainer;
import appeng.api.networking.IGridBlock;
import appeng.api.networking.IGridConnection;
import appeng.api.networking.IGridHelper;
import appeng.api.networking.IGridNode;
import appeng.api.parts.IPartHelper;
import appeng.api.storage.IStorageHelper;
@AEInjectable
public interface IAppEngApi
{
@@ -42,36 +41,23 @@ public interface IAppEngApi
IRegistryContainer registries();
/**
* @return helper for working with storage data types.
* @return A helper for working with storage data types.
*/
IStorageHelper storage();
/**
* @return helper for working with grids, and buses.
* @return A helper to create {@link IGridNode} and other grid related objects.
*/
IGridHelper grid();
/**
* @return A helper for working with grids, and buses.
*/
IPartHelper partHelper();
/**
* @return an accessible list of all AE definitions
* @return An accessible list of all AE definitions
*/
IDefinitions definitions();
/**
* create a grid node for your {@link appeng.api.networking.IGridHost}
*
* @param block grid block
*
* @return grid node of block
*/
IGridNode createGridNode( IGridBlock block );
/**
* create a connection between two {@link appeng.api.networking.IGridNode}
*
* @param a to be connected gridnode
* @param b to be connected gridnode
*
* @throws appeng.api.exceptions.FailedConnection
*/
IGridConnection createGridConnection( IGridNode a, IGridNode b ) throws FailedConnection;
}
@@ -1,64 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.client;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.util.EnumFacing;
/**
* TODO: Needs to be moved to an internal class. API is only allowed to contain interfaces and/or data.
*
* @deprecated
*/
@Deprecated
public class BakingPipeline<F, T> implements BakingPipelineElement<F, T>
{
private final ImmutableList<BakingPipelineElement<?, ?>> pipeline;
public BakingPipeline( BakingPipelineElement<?, ?>... pipeline )
{
this.pipeline = ImmutableList.copyOf( pipeline );
}
/**
* TODO: fix generics
*/
@Override
public List pipe( List things, IBakedModel parent, IBlockState state, EnumFacing side, long rand )
{
for( BakingPipelineElement pipe : this.pipeline )
{
things = pipe.pipe( things, parent, state, side, rand );
}
return things;
}
}
@@ -1,39 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.client;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.util.EnumFacing;
public interface BakingPipelineElement<F, T>
{
public List<T> pipe( List<F> elements, IBakedModel parent, IBlockState state, EnumFacing side, long rand );
}
@@ -26,5 +26,5 @@ package appeng.api.config;
public enum SearchBoxMode
{
AUTOSEARCH, MANUAL_SEARCH, JEI_AUTOSEARCH, JEI_MANUAL_SEARCH
AUTOSEARCH, AUTOSEARCH_KEEP, MANUAL_SEARCH, MANUAL_SEARCH_KEEP, JEI_AUTOSEARCH, JEI_AUTOSEARCH_KEEP, JEI_MANUAL_SEARCH, JEI_MANUAL_SEARCH_KEEP
}
+35 -11
View File
@@ -33,29 +33,53 @@ public enum Settings
{
LEVEL_EMITTER_MODE( EnumSet.allOf( LevelEmitterMode.class ) ),
REDSTONE_EMITTER( EnumSet.of( RedstoneMode.HIGH_SIGNAL, RedstoneMode.LOW_SIGNAL ) ), REDSTONE_CONTROLLED( EnumSet.allOf( RedstoneMode.class ) ),
REDSTONE_EMITTER( EnumSet.of( RedstoneMode.HIGH_SIGNAL, RedstoneMode.LOW_SIGNAL ) ),
REDSTONE_CONTROLLED( EnumSet.allOf( RedstoneMode.class ) ),
CONDENSER_OUTPUT( EnumSet.allOf( CondenserOutput.class ) ),
POWER_UNITS( EnumSet.allOf( PowerUnits.class ) ), ACCESS( EnumSet.of( AccessRestriction.READ_WRITE, AccessRestriction.READ, AccessRestriction.WRITE ) ),
POWER_UNITS( EnumSet.allOf( PowerUnits.class ) ),
SORT_DIRECTION( EnumSet.allOf( SortDir.class ) ), SORT_BY( EnumSet.allOf( SortOrder.class ) ),
ACCESS( EnumSet.of( AccessRestriction.READ_WRITE, AccessRestriction.READ, AccessRestriction.WRITE ) ),
SEARCH_TOOLTIPS( EnumSet.of( YesNo.YES, YesNo.NO ) ), VIEW_MODE( EnumSet.allOf( ViewItems.class ) ), SEARCH_MODE( EnumSet.allOf( SearchBoxMode.class ) ),
SORT_DIRECTION( EnumSet.allOf( SortDir.class ) ),
ACTIONS( EnumSet.allOf( ActionItems.class ) ), IO_DIRECTION( EnumSet.of( RelativeDirection.LEFT, RelativeDirection.RIGHT ) ),
SORT_BY( EnumSet.allOf( SortOrder.class ) ),
BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ), OPERATION_MODE( EnumSet.allOf( OperationMode.class ) ),
SEARCH_TOOLTIPS( EnumSet.of( YesNo.YES, YesNo.NO ) ),
FULLNESS_MODE( EnumSet.allOf( FullnessMode.class ) ), CRAFT_ONLY( EnumSet.of( YesNo.YES, YesNo.NO ) ),
VIEW_MODE( EnumSet.allOf( ViewItems.class ) ),
FUZZY_MODE( EnumSet.allOf( FuzzyMode.class ) ), LEVEL_TYPE( EnumSet.allOf( LevelType.class ) ),
SEARCH_MODE( EnumSet.allOf( SearchBoxMode.class ) ),
TERMINAL_STYLE( EnumSet.of( TerminalStyle.TALL, TerminalStyle.SMALL ) ), COPY_MODE( EnumSet.allOf( CopyMode.class ) ),
ACTIONS( EnumSet.allOf( ActionItems.class ) ),
INTERFACE_TERMINAL( EnumSet.of( YesNo.YES, YesNo.NO ) ), CRAFT_VIA_REDSTONE( EnumSet.of( YesNo.YES, YesNo.NO ) ),
IO_DIRECTION( EnumSet.of( RelativeDirection.LEFT, RelativeDirection.RIGHT ) ),
STORAGE_FILTER( EnumSet.allOf( StorageFilter.class ) ), PLACE_BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
OPERATION_MODE( EnumSet.allOf( OperationMode.class ) ),
FULLNESS_MODE( EnumSet.allOf( FullnessMode.class ) ),
CRAFT_ONLY( EnumSet.of( YesNo.YES, YesNo.NO ) ),
FUZZY_MODE( EnumSet.allOf( FuzzyMode.class ) ),
LEVEL_TYPE( EnumSet.allOf( LevelType.class ) ),
TERMINAL_STYLE( EnumSet.of( TerminalStyle.TALL, TerminalStyle.SMALL ) ),
COPY_MODE( EnumSet.allOf( CopyMode.class ) ),
INTERFACE_TERMINAL( EnumSet.of( YesNo.YES, YesNo.NO ) ),
CRAFT_VIA_REDSTONE( EnumSet.of( YesNo.YES, YesNo.NO ) ),
STORAGE_FILTER( EnumSet.allOf( StorageFilter.class ) ),
PLACE_BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
SCHEDULING_MODE( EnumSet.allOf( SchedulingMode.class ) );
@@ -28,7 +28,6 @@ public enum TunnelType
{
ME, // Network Tunnel
IC2_POWER, // EU Tunnel
RF_POWER, // RF Tunnel
FE_POWER, // Forge Energy tunnel
REDSTONE, // Redstone Tunnel
FLUID, // Fluid Tunnel
@@ -38,7 +38,9 @@ public interface IParts
AEColoredItemDefinition cableGlass();
AEColoredItemDefinition cableDense();
AEColoredItemDefinition cableDenseCovered();
AEColoredItemDefinition cableDenseSmart();
AEColoredItemDefinition lumenCableSmart();
@@ -46,7 +48,7 @@ public interface IParts
AEColoredItemDefinition lumenCableGlass();
AEColoredItemDefinition lumenCableDense();
AEColoredItemDefinition lumenDenseCableSmart();
IItemDefinition quartzFiber();
@@ -80,8 +82,6 @@ public interface IParts
IItemDefinition p2PTunnelEU();
IItemDefinition p2PTunnelRF();
IItemDefinition p2PTunnelFE();
IItemDefinition p2PTunnelLight();
@@ -21,6 +21,8 @@ package appeng.api.exceptions;
public class CoreInaccessibleException extends RuntimeException
{
private static final long serialVersionUID = -7434641554655517242L;
public CoreInaccessibleException( final String message )
{
super( message );
@@ -37,7 +37,7 @@ import appeng.api.networking.IGridNode;
* @version rv3
* @since rv3
*/
public class ExistingConnectionException extends FailedConnection
public class ExistingConnectionException extends FailedConnectionException
{
private static final long serialVersionUID = 2975450379720353182L;
@@ -40,16 +40,16 @@ import appeng.api.networking.IGridNode;
* @version rv3
* @since rv0
*/
public class FailedConnection extends Exception
public class FailedConnectionException extends Exception
{
private static final long serialVersionUID = -2544208090248293753L;
public FailedConnection()
public FailedConnectionException()
{
}
public FailedConnection( String message )
public FailedConnectionException( String message )
{
super( message );
}
@@ -19,9 +19,11 @@
package appeng.api.exceptions;
public class MissingDefinition extends RuntimeException
public class MissingDefinitionException extends RuntimeException
{
public MissingDefinition( final String message )
private static final long serialVersionUID = -6547396584255825761L;
public MissingDefinitionException( final String message )
{
super( message );
}
@@ -24,12 +24,12 @@
package appeng.api.exceptions;
public class MissingIngredientError extends Exception
public class MissingIngredientException extends Exception
{
private static final long serialVersionUID = -998858343831371697L;
public MissingIngredientError( final String n )
public MissingIngredientException( final String n )
{
super( n );
}
@@ -24,12 +24,12 @@
package appeng.api.exceptions;
public class ModNotInstalled extends Exception
public class ModNotInstalledException extends Exception
{
private static final long serialVersionUID = -9052435206368425494L;
public ModNotInstalled( final String t )
public ModNotInstalledException( final String t )
{
super( t );
}
@@ -34,7 +34,7 @@ package appeng.api.exceptions;
* @version rv3
* @since rv3
*/
public class NullNodeConnectionException extends FailedConnection
public class NullNodeConnectionException extends FailedConnectionException
{
private static final long serialVersionUID = -2143719383495321764L;
@@ -24,12 +24,12 @@
package appeng.api.exceptions;
public class RecipeError extends Exception
public class RecipeException extends Exception
{
private static final long serialVersionUID = -6602870588617670262L;
public RecipeError( final String n )
public RecipeException( final String n )
{
super( n );
}
@@ -24,12 +24,12 @@
package appeng.api.exceptions;
public class RegistrationError extends Exception
public class RegistrationException extends Exception
{
private static final long serialVersionUID = -6602870588617670263L;
public RegistrationError( final String n )
public RegistrationException( final String n )
{
super( n );
}
@@ -34,7 +34,7 @@ package appeng.api.exceptions;
* @version rv3
* @since rv3
*/
public class SecurityConnectionException extends FailedConnection
public class SecurityConnectionException extends FailedConnectionException
{
private static final long serialVersionUID = 5048714900434215426L;
private static final String DEFAULT_MESSAGE = "Connection failed due to different security realms.";
@@ -0,0 +1,84 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2017 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.features;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import net.minecraft.item.Item;
import appeng.api.implementations.items.IAEItemPowerStorage;
/**
* A registry to allow mapping {@link Item}s to a specific charge rate when being placed inside a charger.
*
* The registry is used in favor of an additional method for {@link IAEItemPowerStorage} with a fixed value per item.
* This allows more flexibility for other charger like machines to choose their own values when needed.
*
* There is no guarantee that this is charged per tick, it only represents the value per operation.
* By default this is one charging operation every 10 ticks in case of an AE2 charger.
*
* @author yueh
* @version rv5
* @since rv5
*/
public interface IChargerRegistry
{
/**
* Fetch a charge rate for a specific item.
*
* The specific item does not need to have a mapping registered at all.
* In this case it will use a default value of 160 AE.
*
* @param item A {@link Item} implementing {@link IAEItemPowerStorage}.
* @return custom rate or default of 160
*/
@Nonnegative
double getChargeRate( @Nonnull Item item );
/**
* Register a custom charge rate for a specific item.
*
* Capped at 16000 to avoid extracting too much energy from a network for each operation.
* This is done silently without any feedback or exception.
* Further the cap is not fixed, it can change at any time in the future should power issues arise.
*
* @param item A {@link Item} implementing {@link IAEItemPowerStorage}.
* @param chargeRate the custom rate, must be > 0, capped to 16000d
*/
void addChargeRate( @Nonnull Item item, @Nonnegative double chargeRate );
/**
* Remove the custom rate for a specific item.
*
* It will revert to the default value afterwards.
*
* @param item A {@link Item} implementing {@link IAEItemPowerStorage}.
*/
void removeChargeRate( @Nonnull Item item );
}
@@ -0,0 +1,115 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.features;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
/**
* Builder for a grinder recipe.
*
* The only default value provided are turns at a value of 8.
*
* @author yueh
* @version rv5
* @since rv5
*/
public interface IGrinderRecipeBuilder
{
/**
* Creates an grinder recipe with inputs.
* Needs to be invoked.
*
* @param input new input for the recipe
*
* @return currently used builder
*/
@Nonnull
IGrinderRecipeBuilder withInput( @Nonnull ItemStack input );
/**
* Creates an grinder recipe with output.
* Needs to be invoked.
*
* @param output new output for the recipe
*
* @return currently used builder
*/
@Nonnull
IGrinderRecipeBuilder withOutput( @Nonnull ItemStack output );
/**
* Creates an grinder recipe with the first optional output and its chance.
*
* @param optional new first optional for the recipe
* @param chance chance for the first optional output, must be within 0.0 - 1.0
*
* @return currently used builder
*/
@Nonnull
IGrinderRecipeBuilder withFirstOptional( @Nonnull ItemStack optional, float chance );
/**
* Creates an grinder recipe with the second optional output and its chance.
*
* @param optional new second optional for the recipe
* @param chance chance for the second optional output, must be within 0.0 - 1.0
*
* @return currently used builder
*/
@Nonnull
IGrinderRecipeBuilder withSecondOptional( @Nonnull ItemStack optional, float chance );
/**
* Creates an grinder recipe with the amount of turns as cost.
*
* Defaults to 8 when not called.
*
* @param turns new turns for the recipe, must be > 0
*
* @return currently used builder
*/
@Nonnull
IGrinderRecipeBuilder withTurns( @Nonnegative int turns );
/**
* Finalizes the process of making the recipe.
* Needs to be invoked to fetch grinder recipe.
*
* @return valid grinder recipe
*
* @throws IllegalStateException when input is not defined
* @throws IllegalStateException when input has no size
* @throws IllegalStateException when output is not defined
* @throws IllegalStateException when both optionals are not defined
* @throws IllegalStateException when process type is not defined
*/
@Nonnull
IGrinderRecipe build();
}
@@ -38,6 +38,14 @@ import net.minecraft.item.ItemStack;
public interface IGrinderRegistry
{
/**
* Extensible way to create a grinder recipe.
*
* @return builder for grinder recipes
*/
@Nonnull
IGrinderRecipeBuilder builder();
/**
* An immutable list of the currently registered recipes.
*
@@ -47,48 +55,13 @@ public interface IGrinderRegistry
Collection<IGrinderRecipe> getRecipes();
/**
* Add a new recipe with a single input and output and how many turns it requires.
*
* Will ignore duplicate recipes with the same input item.
*
* @param in The {@link ItemStack} to grind.
* @param out The {@link ItemStack} to output.
* @param turns Amount of turns to turn the input into the output, with turns > 0.
* Add a new recipe to the registry.
*/
void addRecipe( @Nonnull ItemStack in, @Nonnull ItemStack out, int turns );
/**
* Add a new recipe with an input, output and a single optional output.
*
* Will ignore duplicate recipes with the same input item.
*
* @param in The {@link ItemStack} to grind.
* @param out The {@link ItemStack} to output.
* @param optional The optional {@link ItemStack} to output of a certain chance.
* @param chance Chance to get the optional output within 0.0 - 1.0
* @param turns Amount of turns to turn the input into the output, with turns > 0.
*/
void addRecipe( @Nonnull ItemStack in, @Nonnull ItemStack out, @Nonnull ItemStack optional, float chance, int turns );
/**
* add a new recipe with optional outputs, duplicates will not be added.
*
* Will ignore duplicate recipes with the same input item.
*
* @param in The {@link ItemStack} to grind.
* @param out The {@link ItemStack} to output.
* @param optional The first optional {@link ItemStack} to output of a certain chance.
* @param chance Chance to get the first optional output within 0.0 - 1.0
* @param optional2 The second optional {@link ItemStack} to output of a certain chance.
* @param chance2 chance to get the second optional output within 0.0 - 1.0
* @param turns Amount of turns to turn the input into the output, with turns > 0.
*
*/
void addRecipe( @Nonnull ItemStack in, @Nonnull ItemStack out, @Nonnull ItemStack optional, float chance, @Nonnull ItemStack optional2, float chance2, int turns );
boolean addRecipe( IGrinderRecipe recipe );
/**
* Remove the specific from the recipe list.
*
*
* @param recipe The recipe to be removed.
* @return true, if it was removed
*/
@@ -106,11 +79,11 @@ public interface IGrinderRegistry
/**
* Allows do add a custom ratio from an ore to dust when being grinded.
*
*
* The default ratio is 1 ore to 2 dusts.
*
*
* These have to be added before any recipe is registered. Otherwise it will use the default value.
*
*
* @param oredictName The name of the ore;
* @param ratio The amount, must be > 0;
*/
@@ -118,9 +91,9 @@ public interface IGrinderRegistry
/**
* Remove a custom ratio for a specific ore name.
*
*
* Will use the default of 2 value afterwards.
*
*
* @param oredictName The name of the ore;
*/
boolean removeDustRatio( @Nonnull String oredictName );
@@ -31,11 +31,19 @@ import net.minecraft.item.ItemStack;
* Lets you manipulate Inscriber Recipes, by adding or editing existing ones.
*
* @author thatsIch
* @version rv3
* @version rv5
* @since rv2
*/
public interface IInscriberRegistry
{
/**
* Extensible way to create an inscriber recipe.
*
* @return builder for inscriber recipes
*/
@Nonnull
IInscriberRecipeBuilder builder();
/**
* An immutable copy of currently registered recipes.
*
@@ -65,29 +73,25 @@ public interface IInscriberRegistry
@Nonnull
Set<ItemStack> getInputs();
/**
* Extensible way to create an inscriber recipe.
*
* @return builder for inscriber recipes
*/
@Nonnull
IInscriberRecipeBuilder builder();
/**
* add a new recipe the easy way, duplicates will not be added.
* Added recipes will be automatically added to the optionals and inputs.
*
* @param recipe new recipe
*
* @return true, when successfully added
*
* @throws IllegalArgumentException if null is added
*/
void addRecipe( IInscriberRecipe recipe );
boolean addRecipe( IInscriberRecipe recipe );
/**
* Removes all equal recipes from the registry.
*
*
* @param toBeRemovedRecipe to be removed recipe, can be null, makes just no sense.
*
* @return true, when successfully removed
*/
void removeRecipe( IInscriberRecipe toBeRemovedRecipe );
boolean removeRecipe( IInscriberRecipe toBeRemovedRecipe );
}
@@ -34,7 +34,8 @@ import appeng.api.storage.ICellRegistry;
/**
* @author AlgorithmX2
* @author thatsIch
* @version rv2
* @author yueh
* @version rv5
* @since rv0
*/
@AEInjectable
@@ -76,6 +77,11 @@ public interface IRegistryContainer
*/
IInscriberRegistry inscriber();
/**
* Manage charger via API
*/
IChargerRegistry charger();
/**
* get access to the locatable registry
*/
@@ -27,6 +27,7 @@ package appeng.api.implementations.items;
import net.minecraft.item.ItemStack;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.networking.energy.IAEPowerStorage;
@@ -42,27 +43,27 @@ public interface IAEItemPowerStorage
*
* @return amount unable to be stored
*/
double injectAEPower( ItemStack is, double amt );
double injectAEPower( ItemStack stack, double amount, Actionable mode );
/**
* Attempt to extract power from the device, it will extract what it can and
* return it.
*
* @param amt to be extracted power from device
* @param amount to be extracted power from device
*
* @return what it could extract
*/
double extractAEPower( ItemStack is, double amt );
double extractAEPower( ItemStack stack, double amount, Actionable mode );
/**
* @return the current maximum power ( this can change :P )
*/
double getAEMaxPower( ItemStack is );
double getAEMaxPower( ItemStack stack );
/**
* @return the current AE Power Level, this may exceed getMEMaxPower()
*/
double getAECurrentPower( ItemStack is );
double getAECurrentPower( ItemStack stack );
/**
* Control the power flow by telling what the network can do, either add? or
@@ -70,5 +71,5 @@ public interface IAEItemPowerStorage
*
* @return access restriction of network
*/
AccessRestriction getPowerFlow( ItemStack is );
AccessRestriction getPowerFlow( ItemStack stack );
}
@@ -29,6 +29,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import appeng.api.implementations.TransitionResult;
import appeng.api.storage.ISpatialDimension;
import appeng.api.util.WorldCoord;
@@ -57,7 +58,7 @@ public interface ISpatialStorageCell
*
* @return the world for this cell
*/
World getWorld( ItemStack is );
ISpatialDimension getSpatialDimension();
/**
* get the currently stored size.
@@ -69,22 +70,13 @@ public interface ISpatialStorageCell
WorldCoord getStoredSize( ItemStack is );
/**
* Minimum coordinates in its world for the storage cell.
* get the currently stored Dimension id.
*
* @param is spatial storage cell
*
* @return minimum coordinate of dimension
* @return dimension id or -1
*/
WorldCoord getMin( ItemStack is );
/**
* Maximum coordinates in its world for the storage cell.
*
* @param is spatial storage cell
*
* @return maximum coordinate of dimension
*/
WorldCoord getMax( ItemStack is );
int getStoredDimensionID( ItemStack is );
/**
* Perform a spatial swap with the contents of the cell, and the world.
@@ -93,9 +85,9 @@ public interface ISpatialStorageCell
* @param w world of spatial
* @param min min coord
* @param max max coord
* @param doTransition transition
* @param playerId owner of current grid or -1
*
* @return result of transition
*/
TransitionResult doSpatialTransition( ItemStack is, World w, WorldCoord min, WorldCoord max, boolean doTransition );
TransitionResult doSpatialTransition( ItemStack is, World w, WorldCoord min, WorldCoord max, int playerId );
}
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
* Copyright (c) 2017 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
@@ -21,39 +21,44 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.storage.data;
package appeng.api.networking;
import net.minecraft.nbt.NBTTagCompound;
import appeng.api.features.IItemComparison;
import appeng.api.exceptions.FailedConnectionException;
/**
* Don't cast this... either compare with it, or copy it.
*
* Don't Implement.
* A helper responsible for creating new {@link IGridNode}, {@link IGridConnection} or potentially similar tasks.
*
* @author yueh
* @version rv5
* @since rv5
*/
public interface IAETagCompound
public interface IGridHelper
{
/**
* @return a copy ( the copy will not be a IAETagCompound, it will be a NBTTagCompound )
* Create a grid node for your {@link IGridHost}
*
* The passed {@link IGridBlock} represents the definition for properties like connectable sides.
* Refer to its documentation for further details.
*
* @param block grid block
*
* @return grid node of block
*/
NBTTagCompound getNBTTagCompoundCopy();
IGridNode createGridNode( IGridBlock block );
/**
* compare to other NBTTagCompounds or IAETagCompounds
* Create a direct connection between two {@link IGridNode}.
*
* This will be considered as having a distance of 1, regardless of the location of both nodes.
*
* @param a to be connected gridnode
* @param b to be connected gridnode
*
* @param a compared object
*
* @return true, if they are the same.
* @throws appeng.api.exceptions.FailedConnectionException
*/
@Override
boolean equals( Object a );
IGridConnection createGridConnection( IGridNode a, IGridNode b ) throws FailedConnectionException;
/**
* @return the special comparison for this tag
*/
IItemComparison getSpecialComparison();
}
@@ -24,7 +24,7 @@
package appeng.api.networking.crafting;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.IActionSource;
import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.storage.data.IAEItemStack;
@@ -40,7 +40,7 @@ public interface ICraftingCPU extends IBaseMonitor<IAEItemStack>
/**
* @return the action source for the CPU.
*/
BaseActionSource getActionSource();
IActionSource getActionSource();
/**
* @return the available storage in bytes
@@ -33,7 +33,7 @@ import net.minecraft.world.World;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridCache;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.IActionSource;
import appeng.api.storage.data.IAEItemStack;
@@ -63,7 +63,7 @@ public interface ICraftingGrid extends IGridCache
* @return a future which will at an undetermined point in the future get you the {@link ICraftingJob} do not wait
* on this, your be waiting forever.
*/
Future<ICraftingJob> beginCraftingJob( World world, IGrid grid, BaseActionSource actionSrc, IAEItemStack craftWhat, ICraftingCallback callback );
Future<ICraftingJob> beginCraftingJob( World world, IGrid grid, IActionSource actionSrc, IAEItemStack craftWhat, ICraftingCallback callback );
/**
* Submit the job to the Crafting system for processing.
@@ -82,7 +82,7 @@ public interface ICraftingGrid extends IGridCache
* {@link ICraftingRequester} methods. if you send null, this object should be discarded after verifying the
* return state.
*/
ICraftingLink submitJob( ICraftingJob job, ICraftingRequester requestingMachine, ICraftingCPU target, boolean prioritizePower, BaseActionSource src );
ICraftingLink submitJob( ICraftingJob job, ICraftingRequester requestingMachine, ICraftingCPU target, boolean prioritizePower, IActionSource src );
/**
* @return list of all the crafting cpus on the grid
@@ -24,7 +24,10 @@
package appeng.api.networking.energy;
import java.util.Set;
import java.util.Collection;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import appeng.api.config.Actionable;
@@ -35,17 +38,91 @@ import appeng.api.config.Actionable;
public interface IEnergyGridProvider
{
/**
* internal use only
*
* Can return a list of providers behind the current.
*
* An example would be something acting as proxy between different {@link IEnergyGrid}s.
*
* This can contain duplicate entries, AE will ensure that each provider is only visited once.
*
* internal use only
*/
double extractAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen );
@Nonnull
Collection<IEnergyGridProvider> providers();
/**
* internal use only
*
* Extracts the requested amount from the provider.
*
* This should never forward a call to another {@link IEnergyGridProvider}, instead return them via
* {@link IEnergyGridProvider#providers()}
*
* @return the used amount
*/
double injectAEPower( double amt, Actionable mode, Set<IEnergyGrid> seen );
@Nonnegative
double extractProviderPower( @Nonnegative double amt, @Nonnull Actionable mode );
/**
* Injects the offered amount into the provider.
*
* This should never forward a call to another {@link IEnergyGridProvider}, instead return them via
* {@link IEnergyGridProvider#providers()}
*
* internal use only
*
* @return the leftover amount
*/
@Nonnegative
double injectProviderPower( @Nonnegative double amt, @Nonnull Actionable mode );
/**
* internal use only
*
* Returns the current demand of an provider.
*
* This should never forward a call to another {@link IEnergyGridProvider}, instead return them via
* {@link IEnergyGridProvider#providers()}
*
*
* @param d the max amount offered, the demand should never exceed it.
* @return the total amount demanded
*/
double getEnergyDemand( double d, Set<IEnergyGrid> seen );
@Nonnegative
double getProviderEnergyDemand( @Nonnegative double d );
/**
* internal use only
*
* AE currently uses this to enqueue the next visited provider.
*
* There is no guarantee that this works on in a perfect way.
* It can be limited to the returns of the past {@link IEnergyGridProvider#providers()}, but not any future one
* discovered by visiting further providers.
*
* E.g. inject into the the lowest one first or extract from the highest one.
*
* @return the current stored amount.
*
*
*/
@Nonnegative
double getProviderStoredEnergy();
/**
* internal use only
*
* AE currently uses this to enqueue the next visited provider.
*
* There is no guarantee that this works on in a perfect way.
* It can be limited to the returns of the past {@link IEnergyGridProvider#providers()}, but not any future one
* discovered by visiting further providers.
*
* E.g. inject into the the lowest one first or extract from the highest one.
*
* @return the maximum amount stored.
*/
@Nonnegative
double getProviderMaxEnergy();
}
@@ -25,7 +25,7 @@ package appeng.api.networking.events;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.IStorageChannel;
/**
@@ -40,9 +40,9 @@ public class MENetworkStorageEvent extends MENetworkEvent
{
public final IMEMonitor monitor;
public final StorageChannel channel;
public final IStorageChannel channel;
public MENetworkStorageEvent( final IMEMonitor o, final StorageChannel chan )
public MENetworkStorageEvent( final IMEMonitor o, final IStorageChannel chan )
{
this.monitor = o;
this.channel = chan;
@@ -24,11 +24,10 @@
package appeng.api.networking.security;
import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
public interface IActionHost extends IGridHost
public interface IActionHost
{
/**
@@ -0,0 +1,77 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.networking.security;
import java.util.Optional;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.EntityPlayer;
/**
* The source of any action.
*
* This can either be a {@link EntityPlayer} or an {@link IActionHost}.
*
* In most cases this is used for security checks, but can be used to validate the source itself.
*
*/
public interface IActionSource
{
/**
* If present, AE will consider the player being the source for the action.
*
* This will take precedence over {@link IActionSource#machine()} in any case.
*
* @return An optional player issuing the action.
*/
@Nonnull
Optional<EntityPlayer> player();
/**
* If present, it indicates the {@link IActionHost} of the source.
*
* Should {@link IActionSource#player()} be absent, it will consider a machine as source.
*
* It is recommended to include the machine even when a player is present.
*
* @return An optional machine issuing the action or acting as proxy for a player.
*/
@Nonnull
Optional<IActionHost> machine();
/**
* An {@link IActionSource} can have multiple optional contexts.
*
* It is strongly recommended to limit the uses for absolutely necessary cases.
*
* Currently there are no public contexts made available by AE.
* An example would be the context interfaces use internally to avoid looping items between each other.
*/
@Nonnull
<T> Optional<T> context( @Nonnull Class<T> key );
}
@@ -1,44 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.networking.security;
/**
* TODO: Consider refactoring.
*/
public class MachineSource extends BaseActionSource
{
public final IActionHost via;
public MachineSource( final IActionHost v )
{
this.via = v;
}
@Override
public boolean isMachine()
{
return true;
}
}
@@ -1,49 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.networking.security;
import net.minecraft.entity.player.EntityPlayer;
/**
* TODO: Consider refactoring.
*/
public class PlayerSource extends BaseActionSource
{
public final EntityPlayer player;
public final IActionHost via;
public PlayerSource( final EntityPlayer p, final IActionHost v )
{
this.player = p;
this.via = v;
}
@Override
public boolean isPlayer()
{
return true;
}
}
@@ -28,7 +28,7 @@ import appeng.api.storage.IMEMonitorHandlerReceiver;
import appeng.api.storage.data.IAEStack;
public interface IBaseMonitor<T extends IAEStack>
public interface IBaseMonitor<T extends IAEStack<T>>
{
/**
@@ -24,8 +24,8 @@
package appeng.api.networking.storage;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.StorageChannel;
import appeng.api.networking.security.IActionSource;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
@@ -50,5 +50,5 @@ public interface IStackWatcherHost
* @param src action source
* @param chan storage channel
*/
void onStackChange( IItemList o, IAEStack fullStack, IAEStack diffStack, BaseActionSource src, StorageChannel chan );
void onStackChange( IItemList<?> o, IAEStack<?> fullStack, IAEStack<?> diffStack, IActionSource src, IStorageChannel<?> chan );
}
@@ -26,11 +26,11 @@ package appeng.api.networking.storage;
import appeng.api.networking.IGridCache;
import appeng.api.networking.IGridHost;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.IActionSource;
import appeng.api.storage.ICellContainer;
import appeng.api.storage.ICellProvider;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.IStorageMonitorable;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEStack;
@@ -50,7 +50,7 @@ public interface IStorageGrid extends IGridCache, IStorageMonitorable
*
* @param input injected items
*/
void postAlterationOfStoredItems( StorageChannel chan, Iterable<? extends IAEStack> input, BaseActionSource src );
void postAlterationOfStoredItems( IStorageChannel<?> chan, Iterable<? extends IAEStack<?>> input, IActionSource src );
/**
* Used to add a cell provider to the storage system
@@ -26,9 +26,9 @@ package appeng.api.recipes;
import java.util.List;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError;
import appeng.api.exceptions.RegistrationError;
import appeng.api.exceptions.MissingIngredientException;
import appeng.api.exceptions.RecipeException;
import appeng.api.exceptions.RegistrationException;
public interface ICraftHandler
@@ -40,15 +40,15 @@ public interface ICraftHandler
* @param input parsed inputs
* @param output parsed outputs
*
* @throws RecipeError
* @throws RecipeException
*/
void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError;
void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeException;
/**
* called when all recipes are parsed, and your required to register your recipe.
*
* @throws RegistrationError
* @throws MissingIngredientError
* @throws RegistrationException
* @throws MissingIngredientException
*/
void register() throws RegistrationError, MissingIngredientError;
void register() throws RegistrationException, MissingIngredientException;
}
@@ -26,8 +26,8 @@ package appeng.api.recipes;
import net.minecraft.item.ItemStack;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RegistrationError;
import appeng.api.exceptions.MissingIngredientException;
import appeng.api.exceptions.RegistrationException;
public interface IIngredient
@@ -39,10 +39,10 @@ public interface IIngredient
*
* @return a single ItemStack for the recipe handler.
*
* @throws RegistrationError
* @throws MissingIngredientError
* @throws RegistrationException
* @throws MissingIngredientException
*/
ItemStack getItemStack() throws RegistrationError, MissingIngredientError;
ItemStack getItemStack() throws RegistrationException, MissingIngredientException;
/**
* Acquire a list of all the input stacks for the current recipe, this is for handlers that support
@@ -50,10 +50,10 @@ public interface IIngredient
*
* @return an array of ItemStacks for the recipe handler.
*
* @throws RegistrationError
* @throws MissingIngredientError
* @throws RegistrationException
* @throws MissingIngredientException
*/
ItemStack[] getItemStackSet() throws RegistrationError, MissingIngredientError;
ItemStack[] getItemStackSet() throws RegistrationException, MissingIngredientException;
/**
* If you wish to support air, you must test before getting the ItemStack, or ItemStackSet
@@ -85,8 +85,8 @@ public interface IIngredient
/**
* Bakes the lists in for faster runtime look-ups.
*
* @throws MissingIngredientError
* @throws RegistrationError
* @throws MissingIngredientException
* @throws RegistrationException
*/
void bake() throws RegistrationError, MissingIngredientError;
void bake() throws RegistrationException, MissingIngredientException;
}
@@ -28,6 +28,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.implementations.tiles.IChestOrDrive;
import appeng.api.storage.data.IAEStack;
/**
@@ -56,7 +57,7 @@ public interface ICellHandler
*
* @return a new IMEHandler for the provided item
*/
IMEInventoryHandler getCellInventory( ItemStack is, ISaveProvider host, StorageChannel channel );
<T extends IAEStack<T>> IMEInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> channel );
/**
* Called when the storage cell is planed in an ME Chest and the user tries to open the terminal side, if your item
@@ -70,7 +71,7 @@ public interface ICellHandler
* @param is item
* @param chan storage channel
*/
void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan );
<T extends IAEStack<T>> void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler<T> inv, ItemStack is, IStorageChannel<T> chan );
/**
* 0 - cell is missing.
@@ -86,10 +87,10 @@ public interface ICellHandler
*
* @return get the status of the cell based on its contents.
*/
int getStatusForCell( ItemStack is, IMEInventory handler );
<T extends IAEStack<T>> int getStatusForCell( ItemStack is, IMEInventory<T> handler );
/**
* @return the ae/t to drain for this storage cell inside a chest/drive.
*/
double cellIdleDrain( ItemStack is, IMEInventory handler );
<T extends IAEStack<T>> double cellIdleDrain( ItemStack is, IMEInventory<T> handler );
}
@@ -42,7 +42,7 @@ public interface ICellProvider
*
* @return a valid list of handlers, NEVER NULL
*/
List<IMEInventoryHandler> getCellArray( StorageChannel channel );
List<IMEInventoryHandler> getCellArray( IStorageChannel<?> channel );
/**
* the storage's priority.
@@ -27,6 +27,7 @@ package appeng.api.storage;
import net.minecraft.item.ItemStack;
import appeng.api.IAppEngApi;
import appeng.api.storage.data.IAEStack;
/**
@@ -73,5 +74,5 @@ public interface ICellRegistry
*
* @return new IMEInventoryHandler, or null if there isn't one.
*/
IMEInventoryHandler getCellInventory( ItemStack is, ISaveProvider host, StorageChannel chan );
<T extends IAEStack<T>> IMEInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> chan );
}
@@ -25,7 +25,7 @@ package appeng.api.storage;
import appeng.api.config.Actionable;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.IActionSource;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
@@ -40,7 +40,7 @@ import appeng.api.storage.data.IItemList;
* If you want to request a stack of an item, you should should determine that prior to requesting the stack from the
* inventory.
*/
public interface IMEInventory<StackType extends IAEStack>
public interface IMEInventory<T extends IAEStack<T>>
{
/**
@@ -52,7 +52,7 @@ public interface IMEInventory<StackType extends IAEStack>
*
* @return returns the number of items not added.
*/
StackType injectItems( StackType input, Actionable type, BaseActionSource src );
T injectItems( T input, Actionable type, IActionSource src );
/**
* Extract the specified item from the ME Inventory
@@ -62,7 +62,7 @@ public interface IMEInventory<StackType extends IAEStack>
*
* @return returns the number of items extracted, null
*/
StackType extractItems( StackType request, Actionable mode, BaseActionSource src );
T extractItems( T request, Actionable mode, IActionSource src );
/**
* request a full report of all available items, storage.
@@ -71,10 +71,10 @@ public interface IMEInventory<StackType extends IAEStack>
*
* @return returns same list that was passed in, is passed out
*/
IItemList<StackType> getAvailableItems( IItemList<StackType> out );
IItemList<T> getAvailableItems( IItemList<T> out );
/**
* @return the type of channel your handler should be part of
*/
StorageChannel getChannel();
IStorageChannel<T> getChannel();
}
@@ -32,9 +32,9 @@ import appeng.api.storage.data.IAEStack;
* Thin logic layer that can be swapped with different IMEInventory implementations, used to handle features related to
* storage, that are Separate from the storage medium itself.
*
* @param <StackType>
* @param <T>
*/
public interface IMEInventoryHandler<StackType extends IAEStack> extends IMEInventory<StackType>
public interface IMEInventoryHandler<T extends IAEStack<T>> extends IMEInventory<T>
{
/**
@@ -52,7 +52,7 @@ public interface IMEInventoryHandler<StackType extends IAEStack> extends IMEInve
*
* @return if its prioritized
*/
boolean isPrioritized( StackType input );
boolean isPrioritized( T input );
/**
* determine if an item can be accepted and stored.
@@ -61,7 +61,7 @@ public interface IMEInventoryHandler<StackType extends IAEStack> extends IMEInve
*
* @return if the item can be added
*/
boolean canAccept( StackType input );
boolean canAccept( T input );
/**
* determine what the priority of the inventory is.
@@ -29,7 +29,7 @@ import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
public interface IMEMonitor<T extends IAEStack> extends IMEInventoryHandler<T>, IBaseMonitor<T>
public interface IMEMonitor<T extends IAEStack<T>> extends IMEInventoryHandler<T>, IBaseMonitor<T>
{
/**
@@ -37,7 +37,7 @@ public interface IMEMonitor<T extends IAEStack> extends IMEInventoryHandler<T>,
*/
@Override
@Deprecated
IItemList<T> getAvailableItems( IItemList out );
IItemList<T> getAvailableItems( IItemList<T> out );
/**
* Get access to the full item list of the network, preferred over {@link IMEInventory} .getAvailableItems(...)
@@ -24,12 +24,12 @@
package appeng.api.storage;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.IActionSource;
import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.storage.data.IAEStack;
public interface IMEMonitorHandlerReceiver<StackType extends IAEStack>
public interface IMEMonitorHandlerReceiver<T extends IAEStack<T>>
{
/**
@@ -46,7 +46,7 @@ public interface IMEMonitorHandlerReceiver<StackType extends IAEStack>
*
* @param change done change
*/
void postChange( IBaseMonitor<StackType> monitor, Iterable<StackType> change, BaseActionSource actionSource );
void postChange( IBaseMonitor<T> monitor, Iterable<T> change, IActionSource actionSource );
/**
* called when the list updates its contents, this is mostly for handling power events.
@@ -27,5 +27,5 @@ package appeng.api.storage;
public interface ISaveProvider
{
void saveChanges( IMEInventory cellInventory );
void saveChanges( IMEInventory<?> cellInventory );
}
@@ -0,0 +1,41 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2017, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.api.storage;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface ISpatialDimension
{
World getWorld();
int createNewCellDimension( BlockPos contentSize, int playerId );
void deleteCellDimension( int cellDimId );
boolean isCellDimension( int cellDimID );
int getCellDimensionOwner( int cellDimId );
BlockPos getCellDimensionOrigin( int cellDimId );
BlockPos getCellContentSize( int cellDimId );
}
@@ -0,0 +1,103 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.storage;
import java.io.IOException;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack;
import appeng.api.networking.energy.IEnergySource;
import appeng.api.networking.security.IActionSource;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
public interface IStorageChannel<T extends IAEStack<T>>
{
/**
* Create a new {@link IItemList} of the specific type.
*
* @return
*/
@Nonnull
IItemList<T> createList();
/**
* Create a new {@link IAEStack} subtype of the specific object.
*
* The parameter is unbound to allow a slightly more flexible approach.
* But the general intention is about converting an {@link ItemStack} into the corresponding {@link IAEItemStack}.
* Another valid case might be to use it instead of {@link IAEStack#copy()}, but this might not be supported by all
* types.
*
* @param input The object to turn into an {@link IAEStack}
* @return The converted stack or null
*/
@Nullable
T createStack( @Nonnull Object input );
/**
*
* @param input
* @return
* @throws IOException
*/
@Nullable
T readFromPacket( @Nonnull ByteBuf input ) throws IOException;
/**
* use energy from energy, to remove request items from cell, at the request of src.
*
* @param energy to be drained energy source
* @param cell cell of requested items
* @param request requested items
* @param src action source
*
* @return items that successfully extracted.
*/
@Nullable
T poweredExtraction( @Nonnull IEnergySource energy, @Nonnull IMEInventory<T> cell, @Nonnull T request, @Nonnull IActionSource src );
/**
* use energy from energy, to inject input items into cell, at the request of src
*
* @param energy to be added energy source
* @param cell injected cell
* @param input to be injected items
* @param src action source
*
* @return items that failed to insert.
*/
@Nullable
T poweredInsert( @Nonnull IEnergySource energy, @Nonnull IMEInventory<T> cell, @Nonnull T input, @Nonnull IActionSource src );
}
@@ -24,26 +24,63 @@
package appeng.api.storage;
import java.io.IOException;
import java.util.Collection;
import io.netty.buffer.ByteBuf;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
import appeng.api.networking.crafting.ICraftingLink;
import appeng.api.networking.crafting.ICraftingRequester;
import appeng.api.networking.energy.IEnergySource;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.storage.data.IAEStack;
public interface IStorageHelper
{
/**
* Register a new storage channel.
*
* AE2 already provides native channels for {@link IAEItemStack} and {@link IAEFluidStack}.
*
* Each {@link IAEStack} subtype can only have a single factory instance. Overwriting is not intended.
* Each subtype should be a direct one, this might be enforced at any time.
*
* Channel class and factory instance can be used interchangeable as identifier. In most cases the factory instance
* is used as key as having direct access the methods is more beneficial compared to being forced to query the
* registry each time.
*
* Caching the factory instance in a field or local variable is perfectly for performance reasons. But do not use
* any AE2 internal field as they can change randomly between releases.
*
* @param channel The channel type, must be a subtype of {@link IStorageChannel}
* @param factory An instance implementing the channel, must be be an instance of channel
*/
@Nonnull
<T extends IAEStack<T>, C extends IStorageChannel<T>> void registerStorageChannel( @Nonnull Class<C> channel, @Nonnull C factory );
/**
* Fetch the factory instance for a specific storage channel.
*
* Channel must be a direct subtype of {@link IStorageChannel}.
*
* @throws NullPointerException when fetching an unregistered channel.
* @param channel The channel type
* @return the factory instance
*/
@Nonnull
<T extends IAEStack<T>, C extends IStorageChannel<T>> C getStorageChannel( @Nonnull Class<C> channel );
/**
* An unmodifiable collection of all registered factory instance.
*
* This is mainly used as helper to let storage grids construct their internal storage for each type.
*/
@Nonnull
Collection<IStorageChannel<? extends IAEStack<?>>> storageChannels();
/**
* load a crafting link from nbt data.
*
@@ -53,73 +90,4 @@ public interface IStorageHelper
*/
ICraftingLink loadCraftingLink( NBTTagCompound data, ICraftingRequester req );
/**
* @param is An ItemStack
*
* @return a new INSTANCE of {@link IAEItemStack} from a MC {@link ItemStack}
*/
IAEItemStack createItemStack( ItemStack is );
/**
* @param is A FluidStack
*
* @return a new INSTANCE of {@link IAEFluidStack} from a Forge {@link FluidStack}
*/
IAEFluidStack createFluidStack( FluidStack is );
/**
* @return a new INSTANCE of {@link IItemList} for items
*/
IItemList<IAEItemStack> createItemList();
/**
* @return a new INSTANCE of {@link IItemList} for fluids
*/
IItemList<IAEFluidStack> createFluidList();
/**
* Read a AE Item Stack from a byte stream, returns a AE item stack or null.
*
* @param input to be loaded data
*
* @return item based of data
*
* @throws IOException if file could not be read
*/
IAEItemStack readItemFromPacket( ByteBuf input ) throws IOException;
/**
* Read a AE Fluid Stack from a byte stream, returns a AE fluid stack or null.
*
* @param input to be loaded data
*
* @return fluid based on data
*
* @throws IOException if file could not be written
*/
IAEFluidStack readFluidFromPacket( ByteBuf input ) throws IOException;
/**
* use energy from energy, to remove request items from cell, at the request of src.
*
* @param energy to be drained energy source
* @param cell cell of requested items
* @param request requested items
* @param src action source
*
* @return items that successfully extracted.
*/
IAEItemStack poweredExtraction( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack request, BaseActionSource src );
/**
* use energy from energy, to inject input items into cell, at the request of src
*
* @param energy to be added energy source
* @param cell injected cell
* @param input to be injected items
* @param src action source
*
* @return items that failed to insert.
*/
IAEItemStack poweredInsert( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack input, BaseActionSource src );
}
@@ -24,8 +24,7 @@
package appeng.api.storage;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
/**
@@ -35,13 +34,6 @@ import appeng.api.storage.data.IAEItemStack;
public interface IStorageMonitorable
{
/**
* Access the item inventory for the monitorable storage.
*/
IMEMonitor<IAEItemStack> getItemInventory();
<T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel );
/**
* Access the fluid inventory for the monitorable storage.
*/
IMEMonitor<IAEFluidStack> getFluidInventory();
}
@@ -4,7 +4,7 @@ package appeng.api.storage;
import javax.annotation.Nullable;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.IActionSource;
/**
@@ -22,5 +22,5 @@ public interface IStorageMonitorableAccessor
* @return Null if the network cannot be accessed by the given action source (i.e. security doesn't permit it).
*/
@Nullable
IStorageMonitorable getInventory( BaseActionSource src );
IStorageMonitorable getInventory( IActionSource src );
}
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
* Copyright (c) 2017 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
@@ -21,21 +21,14 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.networking.security;
package appeng.api.storage.channels;
/**
* TODO: Consider refactoring.
*/
public class BaseActionSource
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.data.IAEFluidStack;
public interface IFluidStorageChannel extends IStorageChannel<IAEFluidStack>
{
public boolean isPlayer()
{
return false;
}
public boolean isMachine()
{
return false;
}
}
@@ -0,0 +1,34 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2017 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.storage.channels;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.data.IAEItemStack;
public interface IItemStorageChannel extends IStorageChannel<IAEItemStack>
{
}
@@ -37,7 +37,7 @@ import net.minecraftforge.fluids.FluidStack;
*
* Don't Implement.
*
* Construct with Util.createFluidStack( FluidStack )
* Construct with AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class).createStack( FluidStack )
*/
public interface IAEFluidStack extends IAEStack<IAEFluidStack>
{
@@ -36,7 +36,7 @@ import net.minecraft.item.ItemStack;
*
* Don't Implement.
*
* Construct with Util.createItemStack( ItemStack )
* Construct with AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class).createStack( ItemStack )
*/
public interface IAEItemStack extends IAEStack<IAEItemStack>
{
@@ -46,7 +46,7 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
*
* @return new ItemStack
*/
ItemStack getItemStack();
ItemStack createItemStack();
/**
* is there NBT Data for this item?
@@ -105,4 +105,11 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
* @return true if it is the same type (same item, damage, nbt)
*/
boolean isSameType( ItemStack stored );
/**
* DO NOT MODIFY THIS STACK! NEVER. If you think about it .. DON'T
*
* @return definition stack
*/
ItemStack getDefinition();
}
@@ -28,13 +28,14 @@ import java.io.IOException;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.IStorageChannel;
public interface IAEStack<StackType extends IAEStack>
public interface IAEStack<T extends IAEStack<T>>
{
/**
@@ -42,7 +43,7 @@ public interface IAEStack<StackType extends IAEStack>
*
* @param is added item
*/
void add( StackType is );
void add( T is );
/**
* number of items in the stack.
@@ -56,7 +57,7 @@ public interface IAEStack<StackType extends IAEStack>
*
* @param stackSize , ItemStack.stackSize = N
*/
StackType setStackSize( long stackSize );
T setStackSize( long stackSize );
/**
* Same as getStackSize, but for requestable items. ( LP )
@@ -70,7 +71,7 @@ public interface IAEStack<StackType extends IAEStack>
*
* @return basically itemStack.stackSize = N but for setStackSize items.
*/
StackType setCountRequestable( long countRequestable );
T setCountRequestable( long countRequestable );
/**
* true, if the item can be crafted.
@@ -84,12 +85,12 @@ public interface IAEStack<StackType extends IAEStack>
*
* @param isCraftable can item be crafted
*/
StackType setCraftable( boolean isCraftable );
T setCraftable( boolean isCraftable );
/**
* clears, requestable, craftable, and stack sizes.
*/
StackType reset();
T reset();
/**
* returns true, if the item can be crafted, requested, or extracted.
@@ -173,21 +174,14 @@ public interface IAEStack<StackType extends IAEStack>
*
* @return a new Stack, which is copied from the original.
*/
StackType copy();
T copy();
/**
* create an empty stack.
*
* @return a new stack, which represents an empty copy of the original.
*/
StackType empty();
/**
* obtain the NBT Data for the item.
*
* @return nbt data
*/
IAETagCompound getTagCompound();
T empty();
/**
* @return true if the stack is a {@link IAEItemStack}
@@ -202,16 +196,12 @@ public interface IAEStack<StackType extends IAEStack>
/**
* @return ITEM or FLUID
*/
StorageChannel getChannel();
IStorageChannel<T> getChannel();
/**
* @return true if it should show the crafting label.
* Returns itemstack for display and similar purposes. Always has a count of 1.
*
* @return itemstack
*/
boolean getShowCraftingLabel();
/**
* Used internally to show that it should show a Crafting label instead of a "1"
*/
void setShowCraftingLabel( boolean showCraftingLabel );
ItemStack asItemStackRepresentation();
}
@@ -34,9 +34,8 @@ import appeng.api.config.FuzzyMode;
*
* Don't Implement.
*
* Construct with Util.createItemList()
*/
public interface IItemContainer<StackType extends IAEStack>
public interface IItemContainer<T extends IAEStack<T>>
{
/**
@@ -44,7 +43,7 @@ public interface IItemContainer<StackType extends IAEStack>
*
* @param option added stack
*/
void add( StackType option ); // adds stack as is
void add( T option ); // adds stack as is
/**
* @param i compared item
@@ -52,14 +51,14 @@ public interface IItemContainer<StackType extends IAEStack>
* @return a stack equivalent to the stack passed in, but with the correct stack size information, or null if its
* not present
*/
StackType findPrecise( StackType i );
T findPrecise( T i );
/**
* @param input compared item
*
* @return a list of relevant fuzzy matched stacks
*/
Collection<StackType> findFuzzy( StackType input, FuzzyMode fuzzy );
Collection<T> findFuzzy( T input, FuzzyMode fuzzy );
/**
* @return true if there are no items in the list
@@ -26,15 +26,20 @@ package appeng.api.storage.data;
import java.util.Iterator;
import appeng.api.storage.IStorageChannel;
/**
* Represents a list of items in AE.
*
* Don't Implement.
*
* Construct with Util.createItemList()
* Construct with
* - For items: AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class).createList()
* - For fluids: AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class).createList()
* - Replace with the corresponding {@link IStorageChannel} type for non native channels
*/
public interface IItemList<StackType extends IAEStack> extends IItemContainer<StackType>, Iterable<StackType>
public interface IItemList<T extends IAEStack<T>> extends IItemContainer<T>, Iterable<T>
{
/**
@@ -43,14 +48,14 @@ public interface IItemList<StackType extends IAEStack> extends IItemContainer<St
*
* @param option stacktype option
*/
void addStorage( StackType option ); // adds a stack as stored
void addStorage( T option ); // adds a stack as stored
/**
* add a stack to the list as craftable, this will merge the stack with an item already in the list if found.
*
* @param option stacktype option
*/
void addCrafting( StackType option );
void addCrafting( T option );
/**
* add a stack to the list, stack size is used to add to requestable, this will merge the stack with an item already
@@ -58,12 +63,12 @@ public interface IItemList<StackType extends IAEStack> extends IItemContainer<St
*
* @param option stacktype option
*/
void addRequestable( StackType option ); // adds a stack as requestable
void addRequestable( T option ); // adds a stack as requestable
/**
* @return the first item in the list
*/
StackType getFirstItem();
T getFirstItem();
/**
* @return the number of items in the list
@@ -74,7 +79,7 @@ public interface IItemList<StackType extends IAEStack> extends IItemContainer<St
* allows you to iterate the list.
*/
@Override
Iterator<StackType> iterator();
Iterator<T> iterator();
/**
* resets stack sizes to 0.
@@ -46,6 +46,11 @@ public enum AECableType
*/
SMART,
/**
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
*/
DENSE_COVERED,
/**
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
*/
@@ -55,6 +60,7 @@ public enum AECableType
GLASS,
COVERED,
SMART,
DENSE_COVERED,
DENSE_SMART
};
@@ -100,14 +100,12 @@ public abstract class AEBaseBlock extends Block
return new BlockStateContainer( this, this.getAEStates() );
}
@SuppressWarnings( "deprecation" )
@Override
public final boolean isNormalCube( IBlockState state )
{
return this.isFullSize() && this.isOpaque();
}
@SuppressWarnings( "deprecation" )
@Override
public AxisAlignedBB getBoundingBox( IBlockState state, IBlockAccess source, BlockPos pos )
{
@@ -226,7 +224,6 @@ public abstract class AEBaseBlock extends Block
return super.getSelectedBoundingBox( state, w, pos );
}
@SuppressWarnings( "deprecation" )
@Override
public final boolean isOpaqueCube( IBlockState state )
{
@@ -281,14 +278,12 @@ public abstract class AEBaseBlock extends Block
return super.collisionRayTrace( state, w, pos, a, b );
}
@SuppressWarnings( "deprecation" )
@Override
public boolean hasComparatorInputOverride( IBlockState state )
{
return this.isInventory();
}
@SuppressWarnings( "deprecation" )
@Override
public int getComparatorInputOverride( IBlockState state, final World worldIn, final BlockPos pos )
{
@@ -67,7 +67,6 @@ public class AEBaseItemBlock extends ItemBlock
@Override
@SideOnly( Side.CLIENT )
@SuppressWarnings( "unchecked" )
public final void addInformation( final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips )
{
this.addCheckedInformation( itemStack, world, toolTip, advancedTooltips );
@@ -31,6 +31,7 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.PowerUnits;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.implementations.items.IAEItemPowerStorage;
@@ -66,67 +67,39 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
}
private double getMaxEnergyCapacity()
@Override
public double injectAEPower( final ItemStack is, double amount, Actionable mode )
{
final Block blockID = Block.getBlockFromItem( this );
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell();
return energyCell.maybeBlock().map( block ->
final double internalCurrentPower = this.getInternal( is );
final double internalMaxPower = this.getAEMaxPower( is );
final double required = internalMaxPower - internalCurrentPower;
final double overflow = Math.max( 0, amount - required );
if( mode == Actionable.MODULATE )
{
if( blockID == block )
{
return 200000;
}
else
{
return 8 * 200000;
}
} ).orElse( 0 );
final double toAdd = Math.min( required, amount );
final double newPowerStored = internalCurrentPower + toAdd;
this.setInternal( is, newPowerStored );
}
return overflow;
}
@Override
public double injectAEPower( final ItemStack is, double amt )
public double extractAEPower( final ItemStack is, double amount, Actionable mode )
{
double internalCurrentPower = this.getInternal( is );
final double internalMaxPower = this.getMaxEnergyCapacity();
internalCurrentPower += amt;
if( internalCurrentPower > internalMaxPower )
final double internalCurrentPower = this.getInternal( is );
final double fulfillable = Math.min( amount, internalCurrentPower );
if( mode == Actionable.MODULATE )
{
amt = internalCurrentPower - internalMaxPower;
internalCurrentPower = internalMaxPower;
this.setInternal( is, internalCurrentPower );
return amt;
final double newPowerStored = internalCurrentPower - fulfillable;
this.setInternal( is, newPowerStored );
}
this.setInternal( is, internalCurrentPower );
return 0;
}
private double getInternal( final ItemStack is )
{
final NBTTagCompound nbt = Platform.openNbtData( is );
return nbt.getDouble( "internalCurrentPower" );
}
private void setInternal( final ItemStack is, final double amt )
{
final NBTTagCompound nbt = Platform.openNbtData( is );
nbt.setDouble( "internalCurrentPower", amt );
}
@Override
public double extractAEPower( final ItemStack is, double amt )
{
double internalCurrentPower = this.getInternal( is );
if( internalCurrentPower > amt )
{
internalCurrentPower -= amt;
this.setInternal( is, internalCurrentPower );
return amt;
}
amt = internalCurrentPower;
this.setInternal( is, 0 );
return amt;
return fulfillable;
}
@Override
@@ -146,4 +119,34 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
{
return AccessRestriction.WRITE;
}
private double getMaxEnergyCapacity()
{
final Block blockID = Block.getBlockFromItem( this );
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell();
return energyCell.maybeBlock().map( block ->
{
if( blockID == block )
{
return 200000;
}
else
{
return 8 * 200000;
}
} ).orElse( 0 );
}
private double getInternal( final ItemStack is )
{
final NBTTagCompound nbt = Platform.openNbtData( is );
return nbt.getDouble( "internalCurrentPower" );
}
private void setInternal( final ItemStack is, final double amt )
{
final NBTTagCompound nbt = Platform.openNbtData( is );
nbt.setDouble( "internalCurrentPower", amt );
}
}
@@ -37,13 +37,17 @@ import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import appeng.block.AEBaseBlock;
import appeng.core.AppEng;
import appeng.entity.EntityIds;
import appeng.entity.EntityTinyTNTPrimed;
import appeng.helpers.ICustomCollision;
@@ -54,15 +58,24 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
public BlockTinyTNT()
{
super( Material.TNT );
this.setLightOpacity( 1 );
this.boundingBox = new AxisAlignedBB( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
this.setFullSize( this.setOpaque( false ) );
this.setLightOpacity( 2 );
this.setFullSize( false );
this.setOpaque( false );
this.setSoundType( SoundType.GROUND );
this.setHardness( 0F );
// TODO: 1.11
// EntityRegistry.registerModEntity( EntityTinyTNTPrimed.class, "EntityTinyTNTPrimed", EntityIds.get(
// EntityTinyTNTPrimed.class ), AppEng.instance(), 16, 4, true );
EntityRegistry.registerModEntity( new ResourceLocation( AppEng.MOD_ID, EntityTinyTNTPrimed.class.getName() ), EntityTinyTNTPrimed.class,
"EntityTinyTNTPrimed", EntityIds.get( EntityTinyTNTPrimed.class ), AppEng.instance(), 16, 4, true );
}
@Override
public boolean isFullCube( IBlockState state )
{
return false;
}
@Override
@@ -101,6 +101,7 @@ public class BlockCableBus extends AEBaseTileBlock
// this will actually be overwritten later through setupTile and the
// combined layers
this.setTileEntity( TileCableBus.class );
this.useNeighborBrightness = true;
}
@Override
@@ -97,7 +97,6 @@ public class BlockController extends AEBaseTileBlock
* controllers and the network state of this controller (offline, online, conflicted). This is used to
* get a rudimentary connected texture feel for the controller based on how it is placed.
*/
@SuppressWarnings( "deprecation" )
@Override
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
{
@@ -160,7 +159,6 @@ public class BlockController extends AEBaseTileBlock
return state.getValue( CONTROLLER_STATE ).ordinal();
}
@SuppressWarnings( "deprecation" )
@Override
public IBlockState getStateFromMeta( final int meta )
{
@@ -174,7 +172,6 @@ public class BlockController extends AEBaseTileBlock
return BlockRenderLayer.CUTOUT;
}
@SuppressWarnings( "deprecation" )
@Override
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
@@ -23,7 +23,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
@@ -42,11 +42,13 @@ import appeng.api.definitions.IBlockDefinition;
import appeng.block.AEBaseBlock;
import appeng.block.AEBaseItemBlock;
import appeng.block.AEBaseTileBlock;
import appeng.bootstrap.components.IBlockRegistrationComponent;
import appeng.bootstrap.components.IItemRegistrationComponent;
import appeng.bootstrap.components.IPreInitComponent;
import appeng.bootstrap.definitions.TileEntityDefinition;
import appeng.core.AEConfig;
import appeng.core.AppEng;
import appeng.core.CreativeTab;
import appeng.core.Registration;
import appeng.core.features.AEFeature;
import appeng.core.features.ActivityState;
import appeng.core.features.BlockDefinition;
@@ -65,13 +67,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
private final Supplier<? extends Block> blockSupplier;
private final List<BiConsumer<Block, Item>> preInitCallbacks = new ArrayList<>();
private final List<BiConsumer<Block, Item>> initCallbacks = new ArrayList<>();
private final List<BiConsumer<Block, Item>> modelRegCallbacks = new ArrayList<>();
private final List<BiConsumer<Block, Item>> postInitCallbacks = new ArrayList<>();
private final List<BiFunction<Block, Item, IBootstrapComponent>> bootstrapComponents = new ArrayList<>();
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
@@ -103,30 +99,9 @@ class BlockDefinitionBuilder implements IBlockBuilder
}
@Override
public BlockDefinitionBuilder preInit( BiConsumer<Block, Item> callback )
public BlockDefinitionBuilder bootstrap( BiFunction<Block, Item, IBootstrapComponent> callback )
{
this.preInitCallbacks.add( callback );
return this;
}
@Override
public BlockDefinitionBuilder init( BiConsumer<Block, Item> callback )
{
this.initCallbacks.add( callback );
return this;
}
@Override
public BlockDefinitionBuilder modelRegInit( BiConsumer<Block, Item> callback )
{
this.modelRegCallbacks.add( callback );
return this;
}
@Override
public BlockDefinitionBuilder postInit( BiConsumer<Block, Item> callback )
{
this.postInitCallbacks.add( callback );
this.bootstrapComponents.add( callback );
return this;
}
@@ -221,22 +196,16 @@ class BlockDefinitionBuilder implements IBlockBuilder
}
// Register the item and block with the game
this.factory.addPreInit( side ->
this.factory.addBootstrapComponent( (IBlockRegistrationComponent) ( side, registry ) -> registry.register( block ) );
if( item != null )
{
Registration.addBlockToRegister( block );
if( item != null )
{
Registration.addItemToRegister( item );
}
} );
this.factory.addBootstrapComponent( (IItemRegistrationComponent) ( side, registry ) -> registry.register( item ) );
}
block.setCreativeTab( this.creativeTab );
// Register all extra handlers
this.preInitCallbacks.forEach( consumer -> this.factory.addPreInit( side -> consumer.accept( block, item ) ) );
this.initCallbacks.forEach( consumer -> this.factory.addInit( side -> consumer.accept( block, item ) ) );
this.modelRegCallbacks.forEach( consumer -> this.factory.addModelReg( ( side, reg ) -> consumer.accept( block, item ) ) );
this.postInitCallbacks.forEach( consumer -> this.factory.addPostInit( side -> consumer.accept( block, item ) ) );
this.bootstrapComponents.forEach( component -> this.factory.addBootstrapComponent( component.apply( block, item ) ) );
if( this.tileEntityDefinition != null && block instanceof AEBaseTileBlock )
{
@@ -268,7 +237,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
if( block instanceof AEBaseTileBlock )
{
this.factory.addPreInit( side ->
this.factory.addBootstrapComponent( (IPreInitComponent) side ->
{
AEBaseTile.registerTileItem(
this.tileEntityDefinition == null ? ( (AEBaseTileBlock) block ).getTileEntityClass() : this.tileEntityDefinition.getTileEntityClass(),
@@ -110,13 +110,13 @@ class BlockRendering implements IBlockRendering
if( this.modelCustomizer != null )
{
factory.modelOverrideComponent.addOverride( block.getRegistryName().getResourcePath(), this.modelCustomizer );
factory.addModelOverride( block.getRegistryName().getResourcePath(), this.modelCustomizer );
}
else if( block instanceof AEBaseTileBlock )
{
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
// extended props
factory.modelOverrideComponent.addOverride( block.getRegistryName().getResourcePath(), ( l, m ) -> new AutoRotatingModel( m ) );
factory.addModelOverride( block.getRegistryName().getResourcePath(), ( l, m ) -> new AutoRotatingModel( m ) );
}
// TODO : 1.12
@@ -20,10 +20,18 @@ package appeng.bootstrap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Supplier;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.fml.relauncher.Side;
@@ -33,10 +41,6 @@ import appeng.api.definitions.IItemDefinition;
import appeng.api.util.AEColor;
import appeng.api.util.AEColoredItemDefinition;
import appeng.bootstrap.components.BuiltInModelComponent;
import appeng.bootstrap.components.IInitComponent;
import appeng.bootstrap.components.IModelRegistrationComponent;
import appeng.bootstrap.components.IPostInitComponent;
import appeng.bootstrap.components.IPreInitComponent;
import appeng.bootstrap.components.ModelOverrideComponent;
import appeng.bootstrap.components.TileEntityComponent;
import appeng.core.features.AEFeature;
@@ -51,10 +55,10 @@ public class FeatureFactory
private final AEFeature[] defaultFeatures;
private final List<IBootstrapComponent> bootstrapComponents;
private final Map<Class<? extends IBootstrapComponent>, List<IBootstrapComponent>> bootstrapComponents;
@SideOnly( Side.CLIENT )
ModelOverrideComponent modelOverrideComponent;
private ModelOverrideComponent modelOverrideComponent;
@SideOnly( Side.CLIENT )
private BuiltInModelComponent builtInModelComponent;
@@ -64,18 +68,18 @@ public class FeatureFactory
public FeatureFactory()
{
this.defaultFeatures = new AEFeature[] { AEFeature.CORE };
this.bootstrapComponents = new ArrayList<>();
this.bootstrapComponents = new HashMap<>();
this.tileEntityComponent = new TileEntityComponent();
this.bootstrapComponents.add( this.tileEntityComponent );
this.addBootstrapComponent( this.tileEntityComponent );
if( Platform.isClient() )
{
this.modelOverrideComponent = new ModelOverrideComponent();
this.bootstrapComponents.add( this.modelOverrideComponent );
this.addBootstrapComponent( this.modelOverrideComponent );
this.builtInModelComponent = new BuiltInModelComponent();
this.bootstrapComponents.add( this.builtInModelComponent );
this.addBootstrapComponent( this.builtInModelComponent );
}
}
@@ -123,29 +127,16 @@ public class FeatureFactory
return new FeatureFactory( this, features );
}
void addBootstrapComponent( IBootstrapComponent component )
public void addBootstrapComponent( IBootstrapComponent component )
{
this.bootstrapComponents.add( component );
Arrays.stream( component.getClass().getInterfaces() )
.filter( i -> IBootstrapComponent.class.isAssignableFrom( i ) )
.forEach( i -> this.addBootstrapComponent( (Class<? extends IBootstrapComponent>) i, component ) );
}
void addPreInit( IPreInitComponent component )
private <T extends IBootstrapComponent> void addBootstrapComponent( Class<? extends IBootstrapComponent> eventType, T component )
{
this.bootstrapComponents.add( component );
}
void addInit( IInitComponent component )
{
this.bootstrapComponents.add( component );
}
void addModelReg( IModelRegistrationComponent component )
{
this.bootstrapComponents.add( component );
}
void addPostInit( IPostInitComponent component )
{
this.bootstrapComponents.add( component );
bootstrapComponents.computeIfAbsent( eventType, c -> new ArrayList<IBootstrapComponent>() ).add( component );
}
@SideOnly( Side.CLIENT )
@@ -154,8 +145,14 @@ public class FeatureFactory
this.builtInModelComponent.addModel( path, model );
}
public List<IBootstrapComponent> getBootstrapComponents()
@SideOnly( Side.CLIENT )
void addModelOverride( String resourcePath, BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer )
{
return this.bootstrapComponents;
this.modelOverrideComponent.addOverride( resourcePath, customizer );
}
public <T extends IBootstrapComponent> Iterator<T> getBootstrapComponents( Class<T> eventType )
{
return (Iterator<T>) this.bootstrapComponents.getOrDefault( eventType, Collections.emptyList() ).iterator();
}
}
@@ -19,7 +19,7 @@
package appeng.bootstrap;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Function;
import net.minecraft.block.Block;
@@ -33,14 +33,7 @@ import appeng.core.features.AEFeature;
public interface IBlockBuilder
{
IBlockBuilder preInit( BiConsumer<Block, Item> callback );
IBlockBuilder init( BiConsumer<Block, Item> callback );
IBlockBuilder modelRegInit( BiConsumer<Block, Item> callback );
IBlockBuilder postInit( BiConsumer<Block, Item> callback );
IBlockBuilder bootstrap( BiFunction<Block, Item, IBootstrapComponent> component );
IBlockBuilder features( AEFeature... features );
@@ -19,28 +19,10 @@
package appeng.bootstrap;
import net.minecraftforge.fml.relauncher.Side;
/**
* Bootstrap components can be registered to take part in the various initialization phases of Forge.
* See the individual subclasses for a specific forge initalization event.
*/
public interface IBootstrapComponent
{
default void preInitialize( Side side )
{
}
default void modelRegistration( Side side, IModelRegistry registry )
{
}
default void initialize( Side side )
{
}
default void postInitialize( Side side )
{
}
}
@@ -0,0 +1,30 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2017, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.bootstrap;
import net.minecraft.advancements.ICriterionInstance;
import net.minecraft.advancements.ICriterionTrigger;
@FunctionalInterface
public interface ICriterionTriggerRegistry
{
void register( ICriterionTrigger<? extends ICriterionInstance> trigger );
}
@@ -19,7 +19,7 @@
package appeng.bootstrap;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import net.minecraft.creativetab.CreativeTabs;
@@ -36,12 +36,7 @@ import appeng.core.features.ItemDefinition;
*/
public interface IItemBuilder
{
IItemBuilder preInit( Consumer<Item> callback );
IItemBuilder init( Consumer<Item> callback );
IItemBuilder postInit( Consumer<Item> callback );
IItemBuilder bootstrap( Function<Item, IBootstrapComponent> component );
IItemBuilder features( AEFeature... features );
@@ -23,7 +23,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import net.minecraft.block.BlockDispenser;
@@ -33,10 +33,11 @@ import net.minecraft.item.Item;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.bootstrap.components.IItemRegistrationComponent;
import appeng.bootstrap.components.IPostInitComponent;
import appeng.core.AEConfig;
import appeng.core.AppEng;
import appeng.core.CreativeTab;
import appeng.core.Registration;
import appeng.core.features.AEFeature;
import appeng.core.features.ItemDefinition;
import appeng.util.Platform;
@@ -53,13 +54,7 @@ class ItemDefinitionBuilder implements IItemBuilder
private final EnumSet<AEFeature> features = EnumSet.noneOf( AEFeature.class );
private final List<Consumer<Item>> preInitCallbacks = new ArrayList<>();
private final List<Consumer<Item>> initCallbacks = new ArrayList<>();
private final List<Consumer<Item>> modelRegCallbacks = new ArrayList<>();
private final List<Consumer<Item>> postInitCallbacks = new ArrayList<>();
private final List<Function<Item, IBootstrapComponent>> boostrapComponents = new ArrayList<>();
private Supplier<IBehaviorDispenseItem> dispenserBehaviorSupplier;
@@ -80,23 +75,9 @@ class ItemDefinitionBuilder implements IItemBuilder
}
@Override
public ItemDefinitionBuilder preInit( Consumer<Item> callback )
public IItemBuilder bootstrap( Function<Item, IBootstrapComponent> component )
{
this.preInitCallbacks.add( callback );
return this;
}
@Override
public ItemDefinitionBuilder init( Consumer<Item> callback )
{
this.initCallbacks.add( callback );
return this;
}
@Override
public ItemDefinitionBuilder postInit( Consumer<Item> callback )
{
this.postInitCallbacks.add( callback );
this.boostrapComponents.add( component );
return this;
}
@@ -163,22 +144,19 @@ class ItemDefinitionBuilder implements IItemBuilder
item.setCreativeTab( this.creativeTab );
// Register all extra handlers
this.preInitCallbacks.forEach( consumer -> this.factory.addPreInit( side -> consumer.accept( item ) ) );
this.initCallbacks.forEach( consumer -> this.factory.addInit( side -> consumer.accept( item ) ) );
this.modelRegCallbacks.forEach( consumer -> this.factory.addModelReg( ( side, reg ) -> consumer.accept( item ) ) );
this.postInitCallbacks.forEach( consumer -> this.factory.addPostInit( side -> consumer.accept( item ) ) );
this.boostrapComponents.forEach( component -> component.apply( item ) );
// Register custom dispenser behavior if requested
if( this.dispenserBehaviorSupplier != null )
{
this.factory.addPostInit( side ->
this.factory.addBootstrapComponent( (IPostInitComponent) side ->
{
IBehaviorDispenseItem behavior = this.dispenserBehaviorSupplier.get();
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item, behavior );
} );
}
this.factory.addPreInit( side -> Registration.addItemToRegister( item ) );
this.factory.addBootstrapComponent( (IItemRegistrationComponent) ( side, reg ) -> reg.register( item ) );
if( Platform.isClient() )
{
@@ -187,4 +165,5 @@ class ItemDefinitionBuilder implements IItemBuilder
return definition;
}
}
@@ -128,15 +128,13 @@ class ItemRendering implements IItemRendering
Block block = ( (ItemBlock) item ).getBlock();
// We can only do this once the blocks are actually registered...
StateMapperHelper helper = new StateMapperHelper( block.getRegistryName() );
StateMapperHelper helper = new StateMapperHelper( item.getRegistryName() );
model = helper.getModelResourceLocation( block.getDefaultState() );
}
else
{
model = new ModelResourceLocation( item.getRegistryName(), "inventory" );
resources.add( model );
}
factory.addBootstrapComponent( new ItemModelComponent( item, ImmutableMap.of( 0, model ) ) );
}
@@ -147,17 +145,12 @@ class ItemRendering implements IItemRendering
{
factory.addBootstrapComponent( new ItemVariantsComponent( item, resources ) );
}
else if( !this.itemModels.isEmpty() || this.itemMeshDefinition != null )
else if( this.itemMeshDefinition != null )
{
// Adding an empty variant list here will prevent Vanilla from trying to load the default item model in this
// case
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
}
else if( item instanceof ItemBlock )
{
// The default for block items is to register the block model
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
}
if( this.itemColor != null )
{
@@ -0,0 +1,16 @@
package appeng.bootstrap.components;
import net.minecraft.block.Block;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.registries.IForgeRegistry;
import appeng.bootstrap.IBootstrapComponent;
@FunctionalInterface
public interface IBlockRegistrationComponent extends IBootstrapComponent
{
void blockRegistration( Side side, IForgeRegistry<Block> blockRegistry );
}
@@ -27,8 +27,5 @@ import appeng.bootstrap.IBootstrapComponent;
@FunctionalInterface
public interface IInitComponent extends IBootstrapComponent
{
@Override
void initialize( Side side );
}
@@ -0,0 +1,16 @@
package appeng.bootstrap.components;
import net.minecraft.item.Item;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.registries.IForgeRegistry;
import appeng.bootstrap.IBootstrapComponent;
@FunctionalInterface
public interface IItemRegistrationComponent extends IBootstrapComponent
{
void itemRegistration( Side side, IForgeRegistry<Item> itemRegistry );
}
@@ -32,8 +32,5 @@ import appeng.bootstrap.IModelRegistry;
@FunctionalInterface
public interface IModelRegistrationComponent extends IBootstrapComponent
{
@Override
void modelRegistration( Side side, IModelRegistry registry );
}
@@ -16,18 +16,16 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.tile;
package appeng.bootstrap.components;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import net.minecraftforge.fml.relauncher.Side;
import appeng.tile.events.TileEventType;
import appeng.bootstrap.IBootstrapComponent;
@Retention( RetentionPolicy.RUNTIME )
public @interface TileEvent
@FunctionalInterface
public interface IOreDictComponent extends IBootstrapComponent
{
TileEventType value();
void oreRegistration( Side side );
}
@@ -27,7 +27,5 @@ import appeng.bootstrap.IBootstrapComponent;
@FunctionalInterface
public interface IPostInitComponent extends IBootstrapComponent
{
@Override
void postInitialize( Side side );
}
@@ -27,8 +27,5 @@ import appeng.bootstrap.IBootstrapComponent;
@FunctionalInterface
public interface IPreInitComponent extends IBootstrapComponent
{
@Override
void preInitialize( Side side );
}
@@ -0,0 +1,16 @@
package appeng.bootstrap.components;
import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.registries.IForgeRegistry;
import appeng.bootstrap.IBootstrapComponent;
@FunctionalInterface
public interface IRecipeRegistrationComponent extends IBootstrapComponent
{
void recipeRegistration( Side side, IForgeRegistry<IRecipe> recipeRegistry );
}
@@ -28,6 +28,7 @@ import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.energy.IEnergyStorage;
import appeng.api.storage.ISpatialDimension;
import appeng.api.storage.IStorageMonitorableAccessor;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
@@ -45,6 +46,8 @@ public final class Capabilities
public static Capability<IStorageMonitorableAccessor> STORAGE_MONITORABLE_ACCESSOR;
public static Capability<ISpatialDimension> SPATIAL_DIMENSION;
public static Capability<ITeslaConsumer> TESLA_CONSUMER;
public static Capability<ITeslaHolder> TESLA_HOLDER;
@@ -57,6 +60,7 @@ public final class Capabilities
public static void register()
{
CapabilityManager.INSTANCE.register( IStorageMonitorableAccessor.class, createNullStorage(), NullMENetworkAccessor::new );
CapabilityManager.INSTANCE.register( ISpatialDimension.class, createNullStorage(), NullSpatialDimension::new );
}
@CapabilityInject( IStorageMonitorableAccessor.class )
@@ -65,6 +69,12 @@ public final class Capabilities
STORAGE_MONITORABLE_ACCESSOR = cap;
}
@CapabilityInject( ISpatialDimension.class )
private static void capISpatialDimensionRegistered( Capability<ISpatialDimension> cap )
{
SPATIAL_DIMENSION = cap;
}
@CapabilityInject( ITeslaConsumer.class )
private static void capITeslaConsumerRegistered( Capability<ITeslaConsumer> cap )
{
@@ -19,7 +19,7 @@
package appeng.capabilities;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.IActionSource;
import appeng.api.storage.IStorageMonitorable;
import appeng.api.storage.IStorageMonitorableAccessor;
@@ -28,7 +28,7 @@ class NullMENetworkAccessor implements IStorageMonitorableAccessor
{
@Override
public IStorageMonitorable getInventory( BaseActionSource src )
public IStorageMonitorable getInventory( IActionSource src )
{
return null;
}
@@ -16,24 +16,55 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.rf;
package appeng.capabilities;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import appeng.api.storage.ISpatialDimension;
/**
* @author GuntherDW
*/
public class RFModule implements IIntegrationModule
class NullSpatialDimension implements ISpatialDimension
{
public RFModule()
@Override
public int createNewCellDimension( BlockPos size, int owner )
{
IntegrationHelper.testClassExistence( this, cofh.redstoneflux.api.IEnergyContainerItem.class );
IntegrationHelper.testClassExistence( this, cofh.redstoneflux.api.IEnergyProvider.class );
IntegrationHelper.testClassExistence( this, cofh.redstoneflux.api.IEnergyConnection.class );
IntegrationHelper.testClassExistence( this, cofh.redstoneflux.api.IEnergyContainerItem.class );
return -1;
}
@Override
public void deleteCellDimension( int cellStorageId )
{
}
@Override
public int getCellDimensionOwner( int cellStorageId )
{
return -1;
}
@Override
public BlockPos getCellDimensionOrigin( int cellStorageId )
{
return null;
}
@Override
public World getWorld()
{
return null;
}
@Override
public boolean isCellDimension( int cellDimID )
{
return false;
}
@Override
public BlockPos getCellContentSize( int cellDimId )
{
return null;
}
}
@@ -62,7 +62,6 @@ import appeng.core.AppEng;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketAssemblerAnimation;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.coremod.MissingCoreMod;
import appeng.entity.EntityFloatingItem;
import appeng.entity.EntityTinyTNTPrimed;
import appeng.entity.RenderFloatingItem;
@@ -241,12 +240,6 @@ public class ClientHelper extends ServerHelper
mc.world.markBlockRangeForRenderUpdate( x - range, y - range, z - range, x + range, y + range, z + range );
}
@Override
public void missingCoreMod()
{
throw new MissingCoreMod();
}
@SubscribeEvent
public void postPlayerRender( final RenderLivingEvent.Pre p )
{
+3 -23
View File
@@ -84,7 +84,6 @@ import appeng.helpers.InventoryAction;
public abstract class AEBaseGui extends GuiContainer
{
private static boolean switchingGuis;
private final List<InternalSlotME> meSlots = new LinkedList<>();
// drag y
private final Set<Slot> drag_click = new HashSet<>();
@@ -94,13 +93,10 @@ public abstract class AEBaseGui extends GuiContainer
private Stopwatch dbl_clickTimer = Stopwatch.createStarted();
private ItemStack dbl_whichItem = ItemStack.EMPTY;
private Slot bl_clicked;
private boolean subGui;
public AEBaseGui( final Container container )
{
super( container );
this.subGui = switchingGuis;
switchingGuis = false;
}
protected static String join( final Collection<String> toolTip, final String delimiter )
@@ -123,11 +119,6 @@ public abstract class AEBaseGui extends GuiContainer
}
}
public boolean isSubGui()
{
return this.subGui;
}
@Override
public void initGui()
{
@@ -149,7 +140,6 @@ public abstract class AEBaseGui extends GuiContainer
}
}
@SuppressWarnings( "unchecked" )
private List<Slot> getInventorySlots()
{
return this.inventorySlots.inventorySlots;
@@ -455,7 +445,8 @@ public abstract class AEBaseGui extends GuiContainer
action = ( mouseButton == 1 ) ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
stack = ( (SlotME) slot ).getAEStack();
if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getShowCraftingLabel() )
if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getStackSize() == 0 && player.inventory.getItemStack()
.isEmpty() )
{
action = InventoryAction.AUTO_CRAFT;
}
@@ -587,7 +578,6 @@ public abstract class AEBaseGui extends GuiContainer
public void onGuiClosed()
{
super.onGuiClosed();
this.subGui = true; // in case the gui is reopened later ( i'm looking at you NEI )
}
protected Slot getSlot( final int mouseX, final int mouseY )
@@ -715,7 +705,7 @@ public abstract class AEBaseGui extends GuiContainer
// Annoying but easier than trying to splice into render item
super.drawSlot( new Size1Slot( (SlotME) s ) );
this.stackSizeRenderer.renderStackSize( this.fontRenderer, ( (SlotME) s ).getAEStack(), s.getStack(), s.xPos, s.yPos );
this.stackSizeRenderer.renderStackSize( this.fontRenderer, ( (SlotME) s ).getAEStack(), s.xPos, s.yPos );
}
catch( final Exception err )
@@ -870,14 +860,4 @@ public abstract class AEBaseGui extends GuiContainer
{
return this.meSlots;
}
public static final synchronized boolean isSwitchingGuis()
{
return switchingGuis;
}
public static final synchronized void setSwitchingGuis( final boolean switchingGuis )
{
AEBaseGui.switchingGuis = switchingGuis;
}
}
@@ -120,7 +120,6 @@ public abstract class AEBaseMEGui extends AEBaseGui
ITooltipFlag.TooltipFlags tooltipFlag = this.mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL;
if( myStack != null )
{
@SuppressWarnings( "unchecked" )
final List<String> currentToolTip = stack.getTooltip( this.mc.player, tooltipFlag );
if( myStack.getStackSize() > BigNumber || ( myStack.getStackSize() > 1 && stack.isItemDamaged() ) )
@@ -37,6 +37,7 @@ import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.client.gui.AEBaseGui;
@@ -62,9 +63,9 @@ public class GuiCraftConfirm extends AEBaseGui
private final int rows = 5;
private final IItemList<IAEItemStack> storage = AEApi.instance().storage().createItemList();
private final IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList();
private final IItemList<IAEItemStack> missing = AEApi.instance().storage().createItemList();
private final IItemList<IAEItemStack> storage = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> pending = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final IItemList<IAEItemStack> missing = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final List<IAEItemStack> visual = new ArrayList<>();
@@ -352,11 +353,11 @@ public class GuiCraftConfirm extends AEBaseGui
final int posX = x * ( 1 + sectionLength ) + xo + sectionLength - 19;
final int posY = y * offY + yo;
final ItemStack is = refStack.copy().getItemStack();
final ItemStack is = refStack.asItemStackRepresentation();
if( this.tooltip == z - viewStart )
{
dspToolTip = Platform.getItemDisplayName( is );
dspToolTip = Platform.getItemDisplayName( refStack );
if( lineList.size() > 0 )
{
@@ -39,6 +39,7 @@ import appeng.api.AEApi;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AEColor;
@@ -84,9 +85,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
private final ContainerCraftingCPU craftingCpu;
private IItemList<IAEItemStack> storage = AEApi.instance().storage().createItemList();
private IItemList<IAEItemStack> active = AEApi.instance().storage().createItemList();
private IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList();
private IItemList<IAEItemStack> storage = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private IItemList<IAEItemStack> active = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private IItemList<IAEItemStack> pending = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private List<IAEItemStack> visual = new ArrayList<>();
private GuiButton cancel;
@@ -110,9 +111,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
public void clearItems()
{
this.storage = AEApi.instance().storage().createItemList();
this.active = AEApi.instance().storage().createItemList();
this.pending = AEApi.instance().storage().createItemList();
this.storage = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.active = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.pending = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
this.visual = new ArrayList<>();
}
@@ -309,11 +310,11 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
final int posX = x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19;
final int posY = y * offY + ITEMSTACK_TOP_OFFSET;
final ItemStack is = refStack.copy().getItemStack();
final ItemStack is = refStack.asItemStackRepresentation();
if( this.tooltip == z - viewStart )
{
dspToolTip = Platform.getItemDisplayName( is );
dspToolTip = Platform.getItemDisplayName( refStack );
if( lineList.size() > 0 )
{
@@ -39,6 +39,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import appeng.api.AEApi;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.MEGuiTextField;
@@ -347,7 +348,9 @@ public class GuiInterfaceTerminal extends AEBaseGui
final ItemStack parsedItemStack = new ItemStack( outTag.getCompoundTagAt( i ) );
if( !parsedItemStack.isEmpty() )
{
final String displayName = Platform.getItemDisplayName( AEApi.instance().storage().createItemStack( parsedItemStack ) ).toLowerCase();
final String displayName = Platform
.getItemDisplayName( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( parsedItemStack ) )
.toLowerCase();
if( displayName.contains( searchTerm ) )
{
return true;
@@ -60,6 +60,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.integration.Integrations;
import appeng.parts.reporting.AbstractPartTerminal;
import appeng.tile.misc.TileSecurityStation;
import appeng.util.IConfigManagerHost;
@@ -291,6 +292,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.buttonList.add(
this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance().getConfigManager().getSetting(
Settings.SEARCH_MODE ) ) );
offset += 20;
if( !( this instanceof GuiMEPortableCell ) || this instanceof GuiWirelessTerm )
@@ -304,6 +306,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.searchField.setEnableBackgroundDrawing( false );
this.searchField.setMaxStringLength( 25 );
this.searchField.setTextColor( 0xFFFFFF );
this.searchField.setSelectionColor( 0xFF99FF99 );
this.searchField.setVisible( true );
if( this.viewCell || this instanceof GuiWirelessTerm )
@@ -313,13 +316,25 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.craftingStatusBtn.setHideEdge( 13 );
}
// Enum setting = AEConfig.instance().getSetting( "Terminal", SearchBoxMode.class, SearchBoxMode.AUTOSEARCH );
final Enum setting = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
this.searchField.setFocused( SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.JEI_AUTOSEARCH == setting );
final Enum searchModeSetting = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
if( this.isSubGui() )
final boolean isAutoFocus = SearchBoxMode.AUTOSEARCH == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH == searchModeSetting || SearchBoxMode.AUTOSEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH_KEEP == searchModeSetting;
final boolean isManualFocus = SearchBoxMode.MANUAL_SEARCH == searchModeSetting || SearchBoxMode.JEI_MANUAL_SEARCH == searchModeSetting || SearchBoxMode.MANUAL_SEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_MANUAL_SEARCH_KEEP == searchModeSetting;
final boolean isKeepFilter = SearchBoxMode.AUTOSEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH_KEEP == searchModeSetting || SearchBoxMode.MANUAL_SEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_MANUAL_SEARCH_KEEP == searchModeSetting;
final boolean isJEIEnabled = SearchBoxMode.JEI_AUTOSEARCH == searchModeSetting || SearchBoxMode.JEI_MANUAL_SEARCH == searchModeSetting;
this.searchField.setFocused( isAutoFocus );
this.searchField.setCanLoseFocus( isManualFocus );
if( isJEIEnabled )
{
memoryText = Integrations.jei().getSearchText();
}
if( isKeepFilter && memoryText != null && !memoryText.isEmpty() )
{
this.searchField.setText( memoryText );
this.searchField.selectAll();
this.repo.setSearchString( memoryText );
this.repo.updateView();
this.setScrollBar();
@@ -351,6 +366,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
craftingGridOffsetX -= 25;
craftingGridOffsetY -= 6;
}
@Override
@@ -363,12 +379,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
@Override
protected void mouseClicked( final int xCoord, final int yCoord, final int btn ) throws IOException
{
final Enum searchMode = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
if( searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.JEI_AUTOSEARCH )
{
this.searchField.mouseClicked( xCoord, yCoord, btn );
}
this.searchField.mouseClicked( xCoord, yCoord, btn );
if( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) )
{
@@ -180,7 +180,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
if( this.tooltip == z - viewStart )
{
toolTip = Platform.getItemDisplayName( this.repo.getItem( z ) );
toolTip = Platform.getItemDisplayName( refStack );
toolTip += ( '\n' + GuiText.Installed.getLocal() + ": " + ( refStack.getStackSize() ) );
if( refStack.getCountRequestable() > 0 )
@@ -192,7 +192,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
toolPosY = y * 18 + yo;
}
this.drawItem( posX, posY, this.repo.getItem( z ) );
this.drawItem( posX, posY, refStack.asItemStackRepresentation() );
x++;
@@ -78,12 +78,23 @@ public class GuiSpatialIOPort extends AEBaseGui
this.fontRenderer.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getCurrentPower(), false ), 13, 21,
4210752 );
this.fontRenderer.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getMaxPower(), false ), 13, 31, 4210752 );
this.fontRenderer.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getRequiredPower(), false ), 13, 78,
this.fontRenderer.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.getRequiredPower(), false ), 13, 73,
4210752 );
this.fontRenderer.drawString( GuiText.Efficiency.getLocal() + ": " + ( ( (float) this.container.getEfficency() ) / 100 ) + '%', 13, 88, 4210752 );
this.fontRenderer.drawString( GuiText.Efficiency.getLocal() + ": " + ( ( (float) this.container.getEfficency() ) / 100 ) + '%', 13, 83, 4210752 );
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.SpatialIOPort.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96, 4210752 );
if( this.container.xSize != 0 && this.container.ySize != 0 && this.container.zSize != 0 )
{
final String text = GuiText.SCSSize.getLocal() + ": " + this.container.xSize + "x" + this.container.ySize + "x" + this.container.zSize;
this.fontRenderer.drawString( text, 13, 93, 4210752 );
}
else
{
this.fontRenderer.drawString( GuiText.SCSSize.getLocal() + ": " + GuiText.SCSSInvalid.getLocal(), 13, 93, 4210752 );
}
}
@Override
@@ -110,6 +110,13 @@ public class GuiImgButton extends GuiButton implements ITooltip
this.registerApp( 16 * 2 + 5, Settings.SEARCH_MODE, SearchBoxMode.JEI_AUTOSEARCH, ButtonToolTips.SearchMode, ButtonToolTips.SearchMode_JEIAuto );
this.registerApp( 16 * 2 + 6, Settings.SEARCH_MODE, SearchBoxMode.JEI_MANUAL_SEARCH, ButtonToolTips.SearchMode,
ButtonToolTips.SearchMode_JEIStandard );
this.registerApp( 16 * 2 + 7, Settings.SEARCH_MODE, SearchBoxMode.AUTOSEARCH_KEEP, ButtonToolTips.SearchMode, ButtonToolTips.SearchMode_AutoKeep );
this.registerApp( 16 * 2 + 8, Settings.SEARCH_MODE, SearchBoxMode.MANUAL_SEARCH_KEEP, ButtonToolTips.SearchMode,
ButtonToolTips.SearchMode_StandardKeep );
this.registerApp( 16 * 2 + 9, Settings.SEARCH_MODE, SearchBoxMode.JEI_AUTOSEARCH_KEEP, ButtonToolTips.SearchMode,
ButtonToolTips.SearchMode_JEIAutoKeep );
this.registerApp( 16 * 2 + 10, Settings.SEARCH_MODE, SearchBoxMode.JEI_MANUAL_SEARCH_KEEP, ButtonToolTips.SearchMode,
ButtonToolTips.SearchMode_JEIStandardKeep );
this.registerApp( 16 * 5 + 3, Settings.LEVEL_TYPE, LevelType.ENERGY_LEVEL, ButtonToolTips.LevelType, ButtonToolTips.LevelType_Energy );
this.registerApp( 16 * 4 + 3, Settings.LEVEL_TYPE, LevelType.ITEM_LEVEL, ButtonToolTips.LevelType, ButtonToolTips.LevelType_Item );
@@ -21,6 +21,10 @@ package appeng.client.gui.widgets;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
/**
@@ -39,6 +43,7 @@ public class MEGuiTextField extends GuiTextField
private final int _yPos;
private final int _width;
private final int _height;
private int selectionColor = 0xFF00FF00;
/**
* Uses the values to instantiate a padded version of a text field.
@@ -66,8 +71,11 @@ public class MEGuiTextField extends GuiTextField
super.mouseClicked( xPos, yPos, button );
final boolean requiresFocus = this.isMouseIn( xPos, yPos );
if( !this.isFocused() )
{
this.setFocused( requiresFocus );
}
this.setFocused( requiresFocus );
return true;
}
@@ -86,4 +94,69 @@ public class MEGuiTextField extends GuiTextField
return withinXRange && withinYRange;
}
public void selectAll()
{
this.setCursorPosition( 0 );
this.setSelectionPos( this.getMaxStringLength() );
}
public void setSelectionColor( int color )
{
this.selectionColor = color;
}
@Override
public void drawSelectionBox( int startX, int startY, int endX, int endY )
{
if( startX < endX )
{
int i = startX;
startX = endX;
endX = i;
}
startX += 1;
endX -= 1;
if( startY < endY )
{
int j = startY;
startY = endY;
endY = j;
}
startY -= PADDING;
if( endX > this.x + this.width )
{
endX = this.x + this.width;
}
if( startX > this.x + this.width )
{
startX = this.x + this.width;
}
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
float red = (float) ( this.selectionColor >> 16 & 255 ) / 255.0F;
float blue = (float) ( this.selectionColor >> 8 & 255 ) / 255.0F;
float green = (float) ( this.selectionColor & 255 ) / 255.0F;
float alpha = (float) ( this.selectionColor >> 24 & 255 ) / 255.0F;
GlStateManager.color( red, green, blue, alpha );
GlStateManager.disableTexture2D();
GlStateManager.enableColorLogic();
GlStateManager.colorLogicOp( GlStateManager.LogicOp.OR_REVERSE );
bufferbuilder.begin( 7, DefaultVertexFormats.POSITION );
bufferbuilder.pos( (double) startX, (double) endY, 0.0D ).endVertex();
bufferbuilder.pos( (double) endX, (double) endY, 0.0D ).endVertex();
bufferbuilder.pos( (double) endX, (double) startY, 0.0D ).endVertex();
bufferbuilder.pos( (double) startX, (double) startY, 0.0D ).endVertex();
tessellator.draw();
GlStateManager.disableColorLogic();
GlStateManager.enableTexture2D();
}
}
@@ -42,7 +42,7 @@ public class InternalSlotME
ItemStack getStack()
{
return this.repo.getItem( this.offset );
return this.getAEStack() == null ? ItemStack.EMPTY : this.getAEStack().asItemStackRepresentation();
}
IAEItemStack getAEStack()

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