Compare commits
107 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0c88d1e7ee | |||
| d88f550eb0 | |||
| e21c59b326 | |||
| d8af8d26be | |||
| 02426bc101 | |||
| 11f8471772 | |||
| d35b720a16 | |||
| 7a5b84c10a | |||
| 800860d4e6 | |||
| ac81418684 | |||
| 7daad58607 | |||
| 038ca23523 | |||
| 37d8833b95 | |||
| fdcba13369 | |||
| b1ac0adfd8 | |||
| 7ba2893635 | |||
| ed8baf8c15 | |||
| 758377ed5d | |||
| a2091d10fe | |||
| fed12cb99f | |||
| 66c365d11f | |||
| 044f4c9ed3 | |||
| 91a74813d9 | |||
| a0b645a0a7 | |||
| d439fb2915 | |||
| 7efd4d872f | |||
| 1b09760631 | |||
| 04daadceed | |||
| 4d3df96350 | |||
| d7e2ae8fcb | |||
| 73f471e685 | |||
| 390ad875ee | |||
| e5f43bf315 | |||
| 8a72ebca89 | |||
| ad1eff2adb | |||
| 9e252df8d9 | |||
| 67584083c6 | |||
| c1c7e94cf6 | |||
| 85dec35366 | |||
| d5372a5ff6 | |||
| c8eb792d38 | |||
| f4ef7edf86 | |||
| 67c733b418 | |||
| fe4db2eb98 | |||
| 2891014cf6 | |||
| e809c688df | |||
| 71a9bb2532 | |||
| 3363acb7db | |||
| 8f6f35b9cf | |||
| ff75f34333 | |||
| e2c0129037 | |||
| 7fe7f4b1c2 | |||
| 693487504c | |||
| 883d9ba49b | |||
| fe8d824526 | |||
| d2250b115f | |||
| e5ab9df086 | |||
| 96af371882 | |||
| bde76d1fb1 | |||
| eb4caaa688 | |||
| 3ba04b3831 | |||
| 7cd8b72bb7 | |||
| 2182b6e37c | |||
| 5d26b98ab8 | |||
| 979531afb7 | |||
| dcf7de9000 | |||
| 87999dbf27 | |||
| c2d18ce013 | |||
| 046a27bf4c | |||
| 841bc6e356 | |||
| e72b5b369c | |||
| d635a87f01 | |||
| 51481d3e30 | |||
| 77e11c7a24 | |||
| 3056bb6ffb | |||
| edc0cef2bb | |||
| 4bd2797f5e | |||
| f37dfd0a24 | |||
| 937ea00e9d | |||
| b431d5d681 | |||
| 0ef854ca4b | |||
| 2c6e50d48a | |||
| dcd94b1cfa | |||
| 89de98f71e | |||
| d16677224a | |||
| 89bebc4385 | |||
| 987ea8d39d | |||
| f4212a86c3 | |||
| 3c4a0cae11 | |||
| 2894a7caa0 | |||
| 044e639827 | |||
| d7b97fa7b8 | |||
| 62435a65f1 | |||
| bf4818cf97 | |||
| 3e09c49e03 | |||
| 9481c9a7d7 | |||
| ccefb47581 | |||
| 59af05aeb1 | |||
| b32834e2b3 | |||
| 6c7cbb7ee1 | |||
| 84c065ff28 | |||
| c9b92a81a3 | |||
| eed4776c6f | |||
| 22807bc619 | |||
| ae352c093e | |||
| 36d6681eac | |||
| 6cffe93970 |
@@ -0,0 +1,30 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: You found a bug or encountered a crash? Please report it here.
|
||||
|
||||
---
|
||||
|
||||
<!-- Provide a summary of the issue in the Title above, please do not "[Tag]" it. -->
|
||||
|
||||
**Describe the bug**
|
||||
<!-- Always use the most recent version from ae-mod.info, it might already be fixed. -->
|
||||
|
||||
**To Reproduce**
|
||||
<!-- Please provide the steps to reproduce it, otherwise we might not be able to fix it. -->
|
||||
|
||||
**Expected behavior**
|
||||
<!-- A clear and concise description of what you expected to happen. -->
|
||||
|
||||
**Additional context**
|
||||
<!-- Screenshots, crashlogs, etc. -->
|
||||
<!-- A complete crashlog is required when reporting a crash. No excerpts. -->
|
||||
<!-- Please use pastebin or gist for posting the complete crashlog. -->
|
||||
|
||||
**Environment**
|
||||
<!-- Include as many relevant details about the environment -->
|
||||
<!-- Like the used version, SP/MP, other mods and their version -->
|
||||
<!-- The following ones are required, please note "latest" is not a version -->
|
||||
|
||||
- Minecraft Version:
|
||||
- AE2 Version:
|
||||
- Forge Version:
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
name: Feature Request
|
||||
about: A feature request or suggestion to improve Applied Energistics 2
|
||||
|
||||
---
|
||||
|
||||
<!-- Provide a summary of the issue in the Title above, please do not "[Tag]" it. -->
|
||||
|
||||
**Describe the feature**
|
||||
<!-- Tell us how it should work. -->
|
||||
|
||||
**Reasons why it should be considered**
|
||||
<!-- This can help us in various degrees, e.g. to determine if it fits our design ideas. -->
|
||||
|
||||
**Additional Context**
|
||||
<!-- Use this for further details, e.g. screenshots, links to mods for integrations. -->
|
||||
<!-- Features will only be considered for the latest/next version. -->
|
||||
+19
-6
@@ -7,14 +7,27 @@ jdk:
|
||||
- openjdk8
|
||||
|
||||
before_cache:
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
||||
- rm -f $HOME/.gradle/caches/minecraft/deobfedDeps/providedDummy.jar
|
||||
- rm -f $HOME/.gradle/caches/minecraft/deobfedDeps/compileDummy.jar
|
||||
- rm -f $HOME/.gradle/caches/minecraft/ForgeVersion.json
|
||||
- rm -f $HOME/.gradle/caches/minecraft/ForgeVersion.json.etag
|
||||
- rm -fr $HOME/.gradle/caches/minecraft/deobfedDeps
|
||||
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.bin
|
||||
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.lock
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.gradle/caches/
|
||||
- $HOME/.gradle/wrapper/
|
||||
- '$HOME/.m2/repository'
|
||||
- '$HOME/.sonar/cache'
|
||||
- '$HOME/.gradle/wrapper'
|
||||
- '$HOME/.gradle/caches'
|
||||
|
||||
addons:
|
||||
sonarcloud:
|
||||
organization: "appliedenergistics"
|
||||
|
||||
install: "./gradlew setupCIWorkspace"
|
||||
script: "./gradlew build test"
|
||||
script:
|
||||
- "./gradlew build"
|
||||
- "./gradlew test"
|
||||
- "./gradlew sonarqube"
|
||||
|
||||
@@ -27,17 +27,18 @@ A Mod about Matter, Energy and using them to conquer the world..
|
||||
* [Website](http://ae-mod.info/)
|
||||
* [IRC #appliedenergistics on esper.net](http://webchat.esper.net/?channels=appliedenergistics&prompt=1)
|
||||
* [GitHub](https://github.com/AppliedEnergistics/Applied-Energistics-2)
|
||||
* [Discord](https://discord.gg/GygKjjm)
|
||||
|
||||
## License
|
||||
|
||||
* Applied Energistics 2 API
|
||||
- (c) 2013 - 2017 AlgorithmX2 et al
|
||||
- (c) 2013 - 2018 AlgorithmX2 et al
|
||||
- [](http://opensource.org/licenses/MIT)
|
||||
* Applied Energistics 2
|
||||
- (c) 2013 - 2017 AlgorithmX2 et al
|
||||
- (c) 2013 - 2018 AlgorithmX2 et al
|
||||
- [](https://raw.githubusercontent.com/AppliedEnergistics/Applied-Energistics-2/rv2/LICENSE)
|
||||
* Textures and Models
|
||||
- (c) 2013 - 2017 AlgorithmX2 et al
|
||||
- (c) 2013 - 2018 AlgorithmX2 et al
|
||||
- [](https://creativecommons.org/licenses/by-nc-sa/3.0/)
|
||||
* Text and Translations
|
||||
- [](https://creativecommons.org/publicdomain/zero/1.0/)
|
||||
@@ -146,14 +147,14 @@ Universal builds obtained [Here](http://ae2.ae-mod.info/Downloads/) should work
|
||||
When compiling against the AE2 API you can use gradle dependencies, just add
|
||||
|
||||
dependencies {
|
||||
compile "appeng:appliedenergistics2:rv_-_____-__:dev"
|
||||
compile "appeng:appliedenergistics2:rv_-_____-__:api"
|
||||
}
|
||||
|
||||
or add the compile line to your existing dependencies task to your build.gradle
|
||||
|
||||
Where the __ are filled in with the correct version criteria; AE2 is available from the default forge maven so no additional repositories are necessary.
|
||||
|
||||
An example string would be `appeng:appliedenergistics2:rv2-alpha-30:dev`
|
||||
An example string would be `appeng:appliedenergistics2:rv5-stable-1:api` for the API only or `appeng:appliedenergistics2:rv5-stable-1` for the whole mod.
|
||||
|
||||
## Applied Energistics 2 CraftTweaker
|
||||
|
||||
|
||||
+7
-1
@@ -30,7 +30,13 @@ buildscript {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "org.sonarqube" version "2.6"
|
||||
}
|
||||
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
apply plugin: 'jacoco'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
@@ -112,4 +118,4 @@ processResources
|
||||
|
||||
// move access transformer to META-INF
|
||||
rename '(.+_at.cfg)', 'META-INF/$1'
|
||||
}
|
||||
}
|
||||
|
||||
+10
-8
@@ -9,22 +9,24 @@ aebasename=appliedenergistics2
|
||||
#########################################################
|
||||
minecraft_version=1.12.2
|
||||
mcp_mappings=snapshot_20171003
|
||||
forge_version=14.23.1.2554
|
||||
forge_version=14.23.5.2768
|
||||
|
||||
#########################################################
|
||||
# Installable #
|
||||
#########################################################
|
||||
hwyla_version=1.8.20-B35_1.12
|
||||
hwyla_version=1.8.26-B41_1.12.2
|
||||
|
||||
#########################################################
|
||||
# Provided APIs #
|
||||
#########################################################
|
||||
jei_version=4.8.0.105
|
||||
tesla_version=1.0.61
|
||||
ic2_version=2.8.19-ex112
|
||||
top_version=1.12-1.4.18-10
|
||||
cofhcore_version=1.12-4.+
|
||||
crafttweaker_version=4.0.10.310
|
||||
jei_version=4.13.0.219
|
||||
tesla_version=1.0.63
|
||||
ic2_version=2.8.73-ex112
|
||||
top_version=1.12-1.4.23-16
|
||||
cofhcore_version=1.12.2-4.5.2.19
|
||||
crafttweaker_version=4.1.8.9
|
||||
inventorytweaks_version=1.63
|
||||
ctm_version=0.3.0.15
|
||||
|
||||
#########################################################
|
||||
# Deployment #
|
||||
|
||||
@@ -31,7 +31,7 @@ repositories {
|
||||
|
||||
maven {
|
||||
name = "Tesla repo"
|
||||
url "http://maven.epoxide.xyz"
|
||||
url "http://maven.mcmoddev.com"
|
||||
}
|
||||
|
||||
maven {
|
||||
@@ -48,7 +48,7 @@ repositories {
|
||||
name 'tterrag maven'
|
||||
url "http://maven.tterrag.com/"
|
||||
}
|
||||
|
||||
|
||||
maven { // McJtyLib
|
||||
name 'mcjty'
|
||||
url "http://maven.k-4u.nl/"
|
||||
@@ -58,11 +58,21 @@ repositories {
|
||||
name 'tehnut'
|
||||
url "http://tehnut.info/maven"
|
||||
}
|
||||
|
||||
|
||||
maven { // CraftTweaker
|
||||
name 'jared maven'
|
||||
url "http://maven.blamejared.com/"
|
||||
}
|
||||
|
||||
maven { // modmaven, maven proxy
|
||||
name 'modmaven'
|
||||
url "https://modmaven.k-4u.nl/"
|
||||
}
|
||||
|
||||
maven {
|
||||
name = "CurseForge"
|
||||
url = "https://minecraft.curseforge.com/api/maven/"
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
@@ -78,11 +88,13 @@ dependencies {
|
||||
// compile against provided APIs
|
||||
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
|
||||
compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||
compileOnly "net.darkhax.tesla:Tesla-1.12:${tesla_version}"
|
||||
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
|
||||
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
||||
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
|
||||
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
|
||||
compileOnly "inventory-tweaks:InventoryTweaks:${inventorytweaks_version}:api"
|
||||
compileOnly "team.chisel.ctm:CTM:MC1.12-${ctm_version}"
|
||||
|
||||
// at runtime, use the full JEI jar
|
||||
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-2
@@ -1,6 +1,5 @@
|
||||
#Tue Jul 04 22:38:49 CEST 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
@@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
@@ -154,11 +154,19 @@ if $cygwin ; then
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
Vendored
-6
@@ -49,7 +49,6 @@ goto fail
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
@@ -60,11 +59,6 @@ set _SKIP=2
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
@@ -30,6 +30,7 @@ import appeng.api.networking.IGridHelper;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.parts.IPartHelper;
|
||||
import appeng.api.storage.IStorageHelper;
|
||||
import appeng.api.util.IClientHelper;
|
||||
|
||||
|
||||
@AEInjectable
|
||||
@@ -60,4 +61,9 @@ public interface IAppEngApi
|
||||
*/
|
||||
IDefinitions definitions();
|
||||
|
||||
/**
|
||||
* @return Utility methods primarily useful for client side stuff
|
||||
*/
|
||||
IClientHelper client();
|
||||
|
||||
}
|
||||
@@ -37,12 +37,16 @@ public enum Upgrades
|
||||
/**
|
||||
* Gold Tier Upgrades.
|
||||
*/
|
||||
CAPACITY( 0 ), REDSTONE( 0 ), CRAFTING( 0 ),
|
||||
CAPACITY( 0 ),
|
||||
REDSTONE( 0 ),
|
||||
CRAFTING( 0 ),
|
||||
|
||||
/**
|
||||
* Diamond Tier Upgrades.
|
||||
*/
|
||||
FUZZY( 1 ), SPEED( 1 ), INVERTER( 1 );
|
||||
FUZZY( 1 ),
|
||||
SPEED( 1 ),
|
||||
INVERTER( 1 );
|
||||
|
||||
private final int tier;
|
||||
private final Map<ItemStack, Integer> supportedMax = new HashMap<>();
|
||||
|
||||
@@ -148,6 +148,8 @@ public interface IBlocks
|
||||
|
||||
ITileDefinition iface();
|
||||
|
||||
ITileDefinition fluidIface();
|
||||
|
||||
ITileDefinition cellWorkbench();
|
||||
|
||||
ITileDefinition iOPort();
|
||||
|
||||
@@ -88,6 +88,14 @@ public interface IItems
|
||||
|
||||
IItemDefinition cell64k();
|
||||
|
||||
IItemDefinition fluidCell1k();
|
||||
|
||||
IItemDefinition fluidCell4k();
|
||||
|
||||
IItemDefinition fluidCell16k();
|
||||
|
||||
IItemDefinition fluidCell64k();
|
||||
|
||||
IItemDefinition spatialCell2();
|
||||
|
||||
IItemDefinition spatialCell16();
|
||||
|
||||
@@ -134,4 +134,12 @@ public interface IMaterials
|
||||
IItemDefinition qESingularity();
|
||||
|
||||
IItemDefinition blankPattern();
|
||||
|
||||
IItemDefinition fluidCell1kPart();
|
||||
|
||||
IItemDefinition fluidCell4kPart();
|
||||
|
||||
IItemDefinition fluidCell16kPart();
|
||||
|
||||
IItemDefinition fluidCell64kPart();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public interface IParts
|
||||
AEColoredItemDefinition cableGlass();
|
||||
|
||||
AEColoredItemDefinition cableDenseCovered();
|
||||
|
||||
|
||||
AEColoredItemDefinition cableDenseSmart();
|
||||
|
||||
AEColoredItemDefinition lumenCableSmart();
|
||||
@@ -64,6 +64,8 @@ public interface IParts
|
||||
|
||||
IItemDefinition iface();
|
||||
|
||||
IItemDefinition fluidIface();
|
||||
|
||||
IItemDefinition levelEmitter();
|
||||
|
||||
IItemDefinition annihilationPlane();
|
||||
@@ -107,4 +109,18 @@ public interface IParts
|
||||
IItemDefinition storageMonitor();
|
||||
|
||||
IItemDefinition conversionMonitor();
|
||||
|
||||
IItemDefinition fluidTerminal();
|
||||
|
||||
IItemDefinition fluidImportBus();
|
||||
|
||||
IItemDefinition fluidExportBus();
|
||||
|
||||
IItemDefinition fluidStorageBus();
|
||||
|
||||
IItemDefinition fluidLevelEmitter();
|
||||
|
||||
IItemDefinition fluidAnnihilationPlane();
|
||||
|
||||
IItemDefinition fluidFormationnPlane();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,9 @@ public interface IP2PTunnelRegistry
|
||||
* @param type - the type of tunnel. Nullable, but then ignored
|
||||
*/
|
||||
void addNewAttunement( @Nonnull ItemStack trigger, @Nullable TunnelType type );
|
||||
|
||||
void addNewAttunement( @Nonnull String ModId, @Nullable TunnelType type );
|
||||
|
||||
void addNewAttunement( @Nonnull Capability<?> cap, @Nullable TunnelType type );
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,6 +35,6 @@ import appeng.api.networking.IGridHost;
|
||||
public interface INetworkTool extends IGuiItemObject
|
||||
{
|
||||
IGridHost getGridHost(); // null for most purposes.
|
||||
|
||||
|
||||
IItemHandler getInventory();
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
|
||||
|
||||
/**
|
||||
* Memory Card API
|
||||
@@ -41,13 +43,18 @@ public interface IMemoryCard
|
||||
* Configures the data stored on the memory card, the SettingsName, will be
|
||||
* localized when displayed.
|
||||
*
|
||||
* The data can contain an optional string with the key "tooltip", which will be used as
|
||||
* unlocalized string to display it after the settings name.
|
||||
*
|
||||
* The data can contain an optional intArray using "colorCode" to be displayed on the model itself.
|
||||
* It needs to have exactly 8 elements representing the ordinal of the matching {@link AEColor}.
|
||||
* The first 4 values represent the top row, left to right. The second 4 the bottom row.
|
||||
*
|
||||
* @param is item
|
||||
* @param SettingsName unlocalized string that represents the tile entity.
|
||||
* @param data may contain a String called "tooltip" which is is a
|
||||
* unlocalized string displayed after the settings name, optional
|
||||
* but can be used to add details to the card for later.
|
||||
* @param settingsName unlocalized string that represents the tile entity.
|
||||
* @param data the NBT tag, refer to the normal comment for special keys.
|
||||
*/
|
||||
void setMemoryCardContents( ItemStack is, String SettingsName, NBTTagCompound data );
|
||||
void setMemoryCardContents( ItemStack is, String settingsName, NBTTagCompound data );
|
||||
|
||||
/**
|
||||
* returns the settings name provided by a previous call to
|
||||
@@ -68,6 +75,17 @@ public interface IMemoryCard
|
||||
*/
|
||||
NBTTagCompound getData( ItemStack is );
|
||||
|
||||
/**
|
||||
* This represent as 4x2 grid of {@link AEColor} without transparent/fluix color.
|
||||
*
|
||||
* First 4 colors are used for the top row, second for the bottom one.
|
||||
*
|
||||
* @param is item
|
||||
*
|
||||
* @return a hash representation of the memory card content
|
||||
*/
|
||||
AEColor[] getColorCode( ItemStack is );
|
||||
|
||||
/**
|
||||
* notify the user of a outcome related to the memory card.
|
||||
*
|
||||
|
||||
@@ -24,10 +24,13 @@
|
||||
package appeng.api.implementations.items;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.storage.ICellWorkbenchItem;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
/**
|
||||
@@ -40,7 +43,7 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
*
|
||||
* The standard AE implementation only provides 1-63 Types
|
||||
*/
|
||||
public interface IStorageCell extends ICellWorkbenchItem
|
||||
public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -51,7 +54,7 @@ public interface IStorageCell extends ICellWorkbenchItem
|
||||
*
|
||||
* @return number of bytes
|
||||
*/
|
||||
int getBytes( ItemStack cellItem );
|
||||
int getBytes( @Nonnull ItemStack cellItem );
|
||||
|
||||
/**
|
||||
* Determines the number of bytes used for any type included on the cell.
|
||||
@@ -60,7 +63,7 @@ public interface IStorageCell extends ICellWorkbenchItem
|
||||
*
|
||||
* @return number of bytes
|
||||
*/
|
||||
int getBytesPerType( ItemStack cellItem );
|
||||
int getBytesPerType( @Nonnull ItemStack cellItem );
|
||||
|
||||
/**
|
||||
* Must be between 1 and 63, indicates how many types you want to store on
|
||||
@@ -70,7 +73,7 @@ public interface IStorageCell extends ICellWorkbenchItem
|
||||
*
|
||||
* @return number of types
|
||||
*/
|
||||
int getTotalTypes( ItemStack cellItem );
|
||||
int getTotalTypes( @Nonnull ItemStack cellItem );
|
||||
|
||||
/**
|
||||
* Allows you to fine tune which items are allowed on a given cell, if you
|
||||
@@ -82,7 +85,7 @@ public interface IStorageCell extends ICellWorkbenchItem
|
||||
*
|
||||
* @return true to preventAdditionOfItem
|
||||
*/
|
||||
boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition );
|
||||
boolean isBlackListed( @Nonnull ItemStack cellItem, @Nonnull T requestedAddition );
|
||||
|
||||
/**
|
||||
* Allows you to specify if this storage cell can be stored inside other
|
||||
@@ -103,10 +106,16 @@ public interface IStorageCell extends ICellWorkbenchItem
|
||||
*
|
||||
* @return if the ItemStack should behavior as a storage cell.
|
||||
*/
|
||||
boolean isStorageCell( ItemStack i );
|
||||
boolean isStorageCell( @Nonnull ItemStack i );
|
||||
|
||||
/**
|
||||
* @return drain in ae/t this storage cell will use.
|
||||
*/
|
||||
double getIdleDrain();
|
||||
|
||||
/**
|
||||
* @return the type of channel your cell should be part of
|
||||
*/
|
||||
@Nonnull
|
||||
IStorageChannel<T> getChannel();
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
package appeng.api.implementations.tiles;
|
||||
|
||||
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
package appeng.api.implementations.tiles;
|
||||
|
||||
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
package appeng.api.networking;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.networking.events.MENetworkEvent;
|
||||
import appeng.api.util.IReadOnlyCollection;
|
||||
|
||||
@@ -43,7 +45,8 @@ public interface IGrid
|
||||
*
|
||||
* @return the IGridCache you requested.
|
||||
*/
|
||||
<C extends IGridCache> C getCache( Class<? extends IGridCache> iface );
|
||||
@Nonnull
|
||||
<C extends IGridCache> C getCache( @Nonnull Class<? extends IGridCache> iface );
|
||||
|
||||
/**
|
||||
* Post an event into the network event bus.
|
||||
@@ -52,7 +55,8 @@ public interface IGrid
|
||||
*
|
||||
* @return returns ev back to original poster
|
||||
*/
|
||||
MENetworkEvent postEvent( MENetworkEvent ev );
|
||||
@Nonnull
|
||||
MENetworkEvent postEvent( @Nonnull MENetworkEvent ev );
|
||||
|
||||
/**
|
||||
* Post an event into the network event bus, but direct it at a single node.
|
||||
@@ -61,7 +65,8 @@ public interface IGrid
|
||||
*
|
||||
* @return returns ev back to original poster
|
||||
*/
|
||||
MENetworkEvent postEventTo( IGridNode node, MENetworkEvent ev );
|
||||
@Nonnull
|
||||
MENetworkEvent postEventTo( @Nonnull IGridNode node, @Nonnull MENetworkEvent ev );
|
||||
|
||||
/**
|
||||
* get a list of the diversity of classes, you can use this to better detect which machines your interested in,
|
||||
@@ -69,6 +74,7 @@ public interface IGrid
|
||||
*
|
||||
* @return IReadOnlyCollection of all available host types (Of Type IGridHost).
|
||||
*/
|
||||
@Nonnull
|
||||
IReadOnlyCollection<Class<? extends IGridHost>> getMachinesClasses();
|
||||
|
||||
/**
|
||||
@@ -78,11 +84,13 @@ public interface IGrid
|
||||
*
|
||||
* @return IMachineSet of all nodes belonging to hosts of specified class.
|
||||
*/
|
||||
IMachineSet getMachines( Class<? extends IGridHost> gridHostClass );
|
||||
@Nonnull
|
||||
IMachineSet getMachines( @Nonnull Class<? extends IGridHost> gridHostClass );
|
||||
|
||||
/**
|
||||
* @return IReadOnlyCollection for all nodes on the network, node visitors are preferred.
|
||||
*/
|
||||
@Nonnull
|
||||
IReadOnlyCollection<IGridNode> getNodes();
|
||||
|
||||
/**
|
||||
@@ -93,5 +101,6 @@ public interface IGrid
|
||||
/**
|
||||
* @return the node considered the pivot point of the grid.
|
||||
*/
|
||||
@Nonnull
|
||||
IGridNode getPivot();
|
||||
}
|
||||
@@ -26,6 +26,10 @@ package appeng.api.networking;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
@@ -49,6 +53,7 @@ public interface IGridBlock
|
||||
*
|
||||
* @return ae/t to use.
|
||||
*/
|
||||
@Nonnegative
|
||||
double getIdlePowerUsage();
|
||||
|
||||
/**
|
||||
@@ -56,10 +61,11 @@ public interface IGridBlock
|
||||
*
|
||||
* @return Set of flags for this IGridBlock
|
||||
*/
|
||||
@Nonnull
|
||||
EnumSet<GridFlags> getFlags();
|
||||
|
||||
/**
|
||||
* generally speaking you will return true for this, the one exception is buses, or worm holes where the node
|
||||
* Generally speaking you will return true for this, the one exception is buses, or worm holes where the node
|
||||
* represents something that isn't a real connection in the world, but rather one represented internally to the
|
||||
* block.
|
||||
*
|
||||
@@ -68,37 +74,46 @@ public interface IGridBlock
|
||||
boolean isWorldAccessible();
|
||||
|
||||
/**
|
||||
* Must not return when {@link #isWorldAccessible()} is true.
|
||||
* Otherwise the behavior is unspecified.
|
||||
*
|
||||
* @return current location of this node
|
||||
*/
|
||||
@Nonnull
|
||||
DimensionalCoord getLocation();
|
||||
|
||||
/**
|
||||
* @return Transparent, or a valid color, NULL IS NOT A VALID RETURN
|
||||
*/
|
||||
@Nonnull
|
||||
AEColor getGridColor();
|
||||
|
||||
/**
|
||||
* Notifies your IGridBlock that changes were made to your connections
|
||||
*/
|
||||
void onGridNotification( GridNotification notification );
|
||||
void onGridNotification( @Nonnull GridNotification notification );
|
||||
|
||||
/**
|
||||
* Update Blocks network/connection/booting status. grid,
|
||||
*
|
||||
* @param grid grid
|
||||
* @param channelsInUse used channels
|
||||
* @deprecated to be removed in rv7
|
||||
*/
|
||||
@Deprecated
|
||||
void setNetworkStatus( IGrid grid, int channelsInUse );
|
||||
|
||||
/**
|
||||
* Determine which sides of the block can be connected too, only used when isWorldAccessible returns true, not used
|
||||
* for {@link IPart} implementations.
|
||||
*/
|
||||
@Nonnull
|
||||
EnumSet<EnumFacing> getConnectableSides();
|
||||
|
||||
/**
|
||||
* @return the IGridHost for the node, this will be an IGridPart or a TileEntity generally speaking.
|
||||
*/
|
||||
@Nonnull
|
||||
IGridHost getMachine();
|
||||
|
||||
/**
|
||||
@@ -111,5 +126,6 @@ public interface IGridBlock
|
||||
*
|
||||
* @return the render item stack to use to render this node, null is valid, and will not show this node.
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack getMachineRepresentation();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
package appeng.api.networking;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
/**
|
||||
* Allows you to create a network wise service, AE2 uses these for providing
|
||||
* item, spatial, and tunnel services.
|
||||
@@ -50,7 +53,7 @@ public interface IGridCache
|
||||
* @param gridNode removed from that grid
|
||||
* @param machine to be removed machine
|
||||
*/
|
||||
void removeNode( IGridNode gridNode, IGridHost machine );
|
||||
void removeNode( @Nonnull IGridNode gridNode, @Nonnull IGridHost machine );
|
||||
|
||||
/**
|
||||
* informs you cache that a machine was added to the grid.
|
||||
@@ -62,7 +65,7 @@ public interface IGridCache
|
||||
* @param gridNode added to grid node
|
||||
* @param machine to be added machine
|
||||
*/
|
||||
void addNode( IGridNode gridNode, IGridHost machine );
|
||||
void addNode( @Nonnull IGridNode gridNode, @Nonnull IGridHost machine );
|
||||
|
||||
/**
|
||||
* Called when a grid splits into two grids, AE will call a split as it
|
||||
@@ -71,7 +74,7 @@ public interface IGridCache
|
||||
*
|
||||
* @param destinationStorage storage which receives half of old grid
|
||||
*/
|
||||
void onSplit( IGridStorage destinationStorage );
|
||||
void onSplit( @Nonnull IGridStorage destinationStorage );
|
||||
|
||||
/**
|
||||
* Called when two grids merge into one, AE will call a join as it
|
||||
@@ -80,12 +83,12 @@ public interface IGridCache
|
||||
*
|
||||
* @param sourceStorage old storage
|
||||
*/
|
||||
void onJoin( IGridStorage sourceStorage );
|
||||
void onJoin( @Nonnull IGridStorage sourceStorage );
|
||||
|
||||
/**
|
||||
* Called when saving changes,
|
||||
*
|
||||
* @param destinationStorage storage
|
||||
*/
|
||||
void populateGridStorage( IGridStorage destinationStorage );
|
||||
void populateGridStorage( @Nonnull IGridStorage destinationStorage );
|
||||
}
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
package appeng.api.networking;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
/**
|
||||
@@ -38,14 +40,14 @@ public interface IGridCacheRegistry
|
||||
*
|
||||
* @param iface grid cache class
|
||||
*/
|
||||
void registerGridCache( Class<? extends IGridCache> iface, Class<? extends IGridCache> implementation );
|
||||
void registerGridCache( @Nonnull Class<? extends IGridCache> iface, @Nonnull Class<? extends IGridCache> implementation );
|
||||
|
||||
/**
|
||||
* requests a new INSTANCE of a grid cache for use, used internally
|
||||
*
|
||||
* @param grid grid
|
||||
*
|
||||
* @return a new HashMap of IGridCaches from the registry, called from IGrid when constructing a new grid.
|
||||
* @return a new Map of IGridCaches from the registry, called from IGrid when constructing a new grid.
|
||||
*/
|
||||
HashMap<Class<? extends IGridCache>, IGridCache> createCacheInstance( IGrid grid );
|
||||
Map<Class<? extends IGridCache>, IGridCache> createCacheInstance( IGrid grid );
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
package appeng.api.networking;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
|
||||
|
||||
@@ -45,6 +47,7 @@ public interface IGridConnection
|
||||
*
|
||||
* @return the IGridNode which represents the opposite side of the connection.
|
||||
*/
|
||||
@Nonnull
|
||||
IGridNode getOtherSide( IGridNode gridNode );
|
||||
|
||||
/**
|
||||
@@ -54,6 +57,7 @@ public interface IGridConnection
|
||||
*
|
||||
* @return the direction of the connection, only valid for in world connections.
|
||||
*/
|
||||
@Nonnull
|
||||
AEPartLocation getDirection( IGridNode gridNode );
|
||||
|
||||
/**
|
||||
@@ -65,11 +69,13 @@ public interface IGridConnection
|
||||
/**
|
||||
* @return node A
|
||||
*/
|
||||
@Nonnull
|
||||
IGridNode a();
|
||||
|
||||
/**
|
||||
* @return node B
|
||||
*/
|
||||
@Nonnull
|
||||
IGridNode b();
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
package appeng.api.networking;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public interface IGridConnectionVisitor extends IGridVisitor
|
||||
{
|
||||
|
||||
@@ -32,5 +35,5 @@ public interface IGridConnectionVisitor extends IGridVisitor
|
||||
*
|
||||
* @param n the connection.
|
||||
*/
|
||||
void visitConnection( IGridConnection n );
|
||||
void visitConnection( @Nonnull IGridConnection n );
|
||||
}
|
||||
|
||||
@@ -24,12 +24,14 @@
|
||||
package appeng.api.networking;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.exceptions.FailedConnectionException;
|
||||
|
||||
|
||||
/**
|
||||
* A helper responsible for creating new {@link IGridNode}, {@link IGridConnection} or potentially similar tasks.
|
||||
*
|
||||
*
|
||||
* @author yueh
|
||||
* @version rv5
|
||||
* @since rv5
|
||||
@@ -39,7 +41,7 @@ public interface IGridHelper
|
||||
|
||||
/**
|
||||
* Create a grid node for your {@link IGridHost}
|
||||
*
|
||||
*
|
||||
* The passed {@link IGridBlock} represents the definition for properties like connectable sides.
|
||||
* Refer to its documentation for further details.
|
||||
*
|
||||
@@ -47,18 +49,20 @@ public interface IGridHelper
|
||||
*
|
||||
* @return grid node of block
|
||||
*/
|
||||
IGridNode createGridNode( IGridBlock block );
|
||||
@Nonnull
|
||||
IGridNode createGridNode( @Nonnull IGridBlock block );
|
||||
|
||||
/**
|
||||
* Create a direct connection between two {@link IGridNode}.
|
||||
*
|
||||
*
|
||||
* This will be considered as having a distance of 1, regardless of the location of both nodes.
|
||||
*
|
||||
*
|
||||
* @param a to be connected gridnode
|
||||
* @param b to be connected gridnode
|
||||
*
|
||||
* @throws appeng.api.exceptions.FailedConnectionException
|
||||
*/
|
||||
IGridConnection createGridConnection( IGridNode a, IGridNode b ) throws FailedConnectionException;
|
||||
@Nonnull
|
||||
IGridConnection createGridConnection( @Nonnull IGridNode a, @Nonnull IGridNode b ) throws FailedConnectionException;
|
||||
|
||||
}
|
||||
@@ -24,6 +24,9 @@
|
||||
package appeng.api.networking;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
@@ -49,7 +52,8 @@ public interface IGridHost
|
||||
* @return a new IGridNode, create these with
|
||||
* AEApi.INSTANCE().createGridNode( MyIGridBlock )
|
||||
*/
|
||||
IGridNode getGridNode( AEPartLocation dir );
|
||||
@Nullable
|
||||
IGridNode getGridNode( @Nonnull AEPartLocation dir );
|
||||
|
||||
/**
|
||||
* Determines how cables render when they connect to this block. Priority is
|
||||
@@ -57,7 +61,8 @@ public interface IGridHost
|
||||
*
|
||||
* @param dir direction
|
||||
*/
|
||||
AECableType getCableConnectionType( AEPartLocation dir );
|
||||
@Nonnull
|
||||
AECableType getCableConnectionType( @Nonnull AEPartLocation dir );
|
||||
|
||||
/**
|
||||
* break this host, its violating security rules, just break your block, or part.
|
||||
|
||||
@@ -26,6 +26,8 @@ package appeng.api.networking;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
/**
|
||||
* An extension of IGridBlock, only means something when your getFlags() contains REQUIRE_CHANNEL, when done properly it
|
||||
@@ -40,5 +42,6 @@ public interface IGridMultiblock extends IGridBlock
|
||||
*
|
||||
* @return an iterator that will iterate all the nodes for the multiblock. ( read-only iterator expected. )
|
||||
*/
|
||||
@Nonnull
|
||||
Iterator<IGridNode> getMultiblockNodes();
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ package appeng.api.networking;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -50,7 +52,7 @@ public interface IGridNode
|
||||
*
|
||||
* @param visitor visitor
|
||||
*/
|
||||
void beginVisit( IGridVisitor visitor );
|
||||
void beginVisit( @Nonnull IGridVisitor visitor );
|
||||
|
||||
/**
|
||||
* inform the node that your IGridBlock has changed its internal state, and force the node to update.
|
||||
@@ -68,6 +70,7 @@ public interface IGridNode
|
||||
*
|
||||
* @return grid host
|
||||
*/
|
||||
@Nonnull
|
||||
IGridHost getMachine();
|
||||
|
||||
/**
|
||||
@@ -75,6 +78,7 @@ public interface IGridNode
|
||||
*
|
||||
* @return grid
|
||||
*/
|
||||
@Nonnull
|
||||
IGrid getGrid();
|
||||
|
||||
/**
|
||||
@@ -86,11 +90,13 @@ public interface IGridNode
|
||||
/**
|
||||
* @return the world the node is located in
|
||||
*/
|
||||
@Nonnull
|
||||
World getWorld();
|
||||
|
||||
/**
|
||||
* @return a set of the connected sides, INTERNAL represents an invisible connection
|
||||
*/
|
||||
@Nonnull
|
||||
EnumSet<AEPartLocation> getConnectedSides();
|
||||
|
||||
/**
|
||||
@@ -98,11 +104,13 @@ public interface IGridNode
|
||||
*
|
||||
* @return grid connections
|
||||
*/
|
||||
@Nonnull
|
||||
IReadOnlyCollection<IGridConnection> getConnections();
|
||||
|
||||
/**
|
||||
* @return the IGridBlock for this node
|
||||
*/
|
||||
@Nonnull
|
||||
IGridBlock getGridBlock();
|
||||
|
||||
/**
|
||||
@@ -122,7 +130,7 @@ public interface IGridNode
|
||||
* @param name nbt name
|
||||
* @param nodeData to be loaded data
|
||||
*/
|
||||
void loadFromNBT( String name, NBTTagCompound nodeData );
|
||||
void loadFromNBT( @Nonnull String name, @Nonnull NBTTagCompound nodeData );
|
||||
|
||||
/**
|
||||
* this should be called for each node you maintain, you can save all your nodes to the same tag with different
|
||||
@@ -131,7 +139,7 @@ public interface IGridNode
|
||||
* @param name nbt name
|
||||
* @param nodeData to be saved data
|
||||
*/
|
||||
void saveToNBT( String name, NBTTagCompound nodeData );
|
||||
void saveToNBT( @Nonnull String name, @Nonnull NBTTagCompound nodeData );
|
||||
|
||||
/**
|
||||
* @return if the node's channel requirements are currently met, use this for display purposes, use isActive for
|
||||
@@ -146,7 +154,7 @@ public interface IGridNode
|
||||
*
|
||||
* @return true if has flag
|
||||
*/
|
||||
boolean hasFlag( GridFlags flag );
|
||||
boolean hasFlag( @Nonnull GridFlags flag );
|
||||
|
||||
/**
|
||||
* @return the ownerID this represents the person who placed the node.
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
package appeng.api.networking;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
|
||||
@@ -33,6 +35,7 @@ public interface IGridStorage
|
||||
/**
|
||||
* @return an NBTTagCompound that can be read, and written too.
|
||||
*/
|
||||
@Nonnull
|
||||
NBTTagCompound dataObject();
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
package appeng.api.networking;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
/**
|
||||
* Simple Visitor pattern access to network nodes.
|
||||
*/
|
||||
@@ -39,5 +42,5 @@ public interface IGridVisitor
|
||||
*
|
||||
* @return true to continue visiting nodes beyond this node.
|
||||
*/
|
||||
boolean visitNode( IGridNode n );
|
||||
boolean visitNode( @Nonnull IGridNode n );
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
package appeng.api.networking;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.util.IReadOnlyCollection;
|
||||
|
||||
|
||||
@@ -33,5 +35,6 @@ public interface IMachineSet extends IReadOnlyCollection<IGridNode>
|
||||
/**
|
||||
* @return the machine class for this set.
|
||||
*/
|
||||
@Nonnull
|
||||
Class<? extends IGridHost> getMachineClass();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
package appeng.api.networking.crafting;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public interface ICraftingCallback
|
||||
{
|
||||
|
||||
@@ -32,5 +35,5 @@ public interface ICraftingCallback
|
||||
*
|
||||
* @param job - final job
|
||||
*/
|
||||
void calculationComplete( ICraftingJob job );
|
||||
void calculationComplete( @Nonnull ICraftingJob job );
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
package appeng.api.networking.energy;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
|
||||
@@ -42,7 +44,7 @@ public interface IAEPowerStorage extends IEnergySource
|
||||
*
|
||||
* @return amount of power which was unable to be stored
|
||||
*/
|
||||
double injectAEPower( double amt, Actionable mode );
|
||||
double injectAEPower( double amt, @Nonnull Actionable mode );
|
||||
|
||||
/**
|
||||
* @return the current maximum power ( this can change :P )
|
||||
@@ -67,5 +69,6 @@ public interface IAEPowerStorage extends IEnergySource
|
||||
*
|
||||
* @return access restriction what the network can do
|
||||
*/
|
||||
@Nonnull
|
||||
AccessRestriction getPowerFlow();
|
||||
}
|
||||
@@ -24,6 +24,9 @@
|
||||
package appeng.api.networking.energy;
|
||||
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.IGridCache;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
@@ -38,17 +41,20 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
|
||||
/**
|
||||
* @return the current calculated idle energy drain each tick, is used internally to drain power for each tick.
|
||||
*/
|
||||
@Nonnegative
|
||||
double getIdlePowerUsage();
|
||||
|
||||
/**
|
||||
* @return the average power drain over the past 10 ticks, includes idle usage during this time, and all use of
|
||||
* extractPower.
|
||||
*/
|
||||
@Nonnegative
|
||||
double getAvgPowerUsage();
|
||||
|
||||
/**
|
||||
* @return the average energy injected into the system per tick, for the last 10 ticks.
|
||||
*/
|
||||
@Nonnegative
|
||||
double getAvgPowerInjection();
|
||||
|
||||
/**
|
||||
@@ -79,13 +85,15 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
|
||||
*
|
||||
* @return the amount of power that the network has OVER the limit.
|
||||
*/
|
||||
double injectPower( double amt, Actionable mode );
|
||||
@Nonnegative
|
||||
double injectPower( @Nonnegative double amt, @Nonnull Actionable mode );
|
||||
|
||||
/**
|
||||
* this is should be considered an estimate, and not relied upon for real calculations.
|
||||
*
|
||||
* @return estimated available power.
|
||||
*/
|
||||
@Nonnegative
|
||||
double getStoredPower();
|
||||
|
||||
/**
|
||||
@@ -93,6 +101,7 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
|
||||
*
|
||||
* @return estimated available power.
|
||||
*/
|
||||
@Nonnegative
|
||||
double getMaxStoredPower();
|
||||
|
||||
/**
|
||||
@@ -101,5 +110,6 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
|
||||
*
|
||||
* @return Amount of power required to charge the grid, in AE.
|
||||
*/
|
||||
double getEnergyDemand( double maxRequired );
|
||||
@Nonnegative
|
||||
double getEnergyDemand( @Nonnegative double maxRequired );
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
package appeng.api.networking.energy;
|
||||
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
|
||||
@@ -39,5 +42,6 @@ public interface IEnergySource
|
||||
*
|
||||
* @return returns extracted power.
|
||||
*/
|
||||
double extractAEPower( double amt, Actionable mode, PowerMultiplier usePowerMultiplier );
|
||||
@Nonnegative
|
||||
double extractAEPower( @Nonnegative double amt, @Nonnull Actionable mode, @Nonnull PowerMultiplier usePowerMultiplier );
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
package appeng.api.networking.energy;
|
||||
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
|
||||
|
||||
/**
|
||||
* DO NOT IMPLEMENT.
|
||||
*
|
||||
@@ -39,7 +42,7 @@ public interface IEnergyWatcher
|
||||
* @param amount
|
||||
* @return true, if successfully added.
|
||||
*/
|
||||
boolean add( double amount );
|
||||
boolean add( @Nonnegative double amount );
|
||||
|
||||
/**
|
||||
* Remove a specific threshold from the watcher.
|
||||
@@ -47,7 +50,7 @@ public interface IEnergyWatcher
|
||||
* @param amount
|
||||
* @return true, if successfully removed.
|
||||
*/
|
||||
boolean remove( double amount );
|
||||
boolean remove( @Nonnegative double amount );
|
||||
|
||||
/**
|
||||
* Removes all thresholds and resets the watcher to a clean state.
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
package appeng.api.networking.energy;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public interface IEnergyWatcherHost
|
||||
{
|
||||
|
||||
@@ -33,12 +36,12 @@ public interface IEnergyWatcherHost
|
||||
*
|
||||
* @param newWatcher new watcher
|
||||
*/
|
||||
void updateWatcher( IEnergyWatcher newWatcher );
|
||||
void updateWatcher( @Nonnull IEnergyWatcher newWatcher );
|
||||
|
||||
/**
|
||||
* Called when a threshold is crossed.
|
||||
*
|
||||
* @param energyGrid grid
|
||||
*/
|
||||
void onThresholdPass( IEnergyGrid energyGrid );
|
||||
void onThresholdPass( @Nonnull IEnergyGrid energyGrid );
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
package appeng.api.networking.pathing;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.networking.IGridCache;
|
||||
|
||||
|
||||
@@ -39,6 +41,7 @@ public interface IPathingGrid extends IGridCache
|
||||
* @return the controller state of the network, useful if you want to
|
||||
* require a controller for a feature.
|
||||
*/
|
||||
@Nonnull
|
||||
ControllerState getControllerState();
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
package appeng.api.networking.security;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
|
||||
|
||||
@@ -38,5 +40,6 @@ public interface IActionHost
|
||||
* @return the the gridnode that actions from this IGridHost are preformed
|
||||
* by.
|
||||
*/
|
||||
@Nonnull
|
||||
IGridNode getActionableNode();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
package appeng.api.networking.security;
|
||||
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
@@ -46,7 +49,7 @@ public interface ISecurityGrid extends IGridCache
|
||||
*
|
||||
* @return true if the player has permissions.
|
||||
*/
|
||||
boolean hasPermission( EntityPlayer player, SecurityPermissions perm );
|
||||
boolean hasPermission( @Nonnull EntityPlayer player, @Nonnull SecurityPermissions perm );
|
||||
|
||||
/**
|
||||
* Check if a player has permissions.
|
||||
@@ -56,7 +59,7 @@ public interface ISecurityGrid extends IGridCache
|
||||
*
|
||||
* @return true if the player has permissions.
|
||||
*/
|
||||
boolean hasPermission( int playerID, SecurityPermissions perm );
|
||||
boolean hasPermission( @Nonnegative int playerID, @Nonnull SecurityPermissions perm );
|
||||
|
||||
/**
|
||||
* @return PlayerID of the admin, or owner, this is the person who placed the security block.
|
||||
|
||||
@@ -25,7 +25,7 @@ package appeng.api.networking.security;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
|
||||
@@ -48,7 +48,7 @@ public interface ISecurityProvider
|
||||
*
|
||||
* @param playerPerms player permissions
|
||||
*/
|
||||
void readPermissions( HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms );
|
||||
void readPermissions( Map<Integer, EnumSet<SecurityPermissions>> playerPerms );
|
||||
|
||||
/**
|
||||
* @return is security on or off?
|
||||
|
||||
@@ -26,6 +26,8 @@ package appeng.api.networking.security;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
|
||||
|
||||
@@ -41,5 +43,5 @@ public interface ISecurityRegistry
|
||||
* @param playerID player id
|
||||
* @param permissions permissions of player
|
||||
*/
|
||||
void addPlayer( int playerID, EnumSet<SecurityPermissions> permissions );
|
||||
void addPlayer( int playerID, @Nonnull EnumSet<SecurityPermissions> permissions );
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
package appeng.api.networking.ticking;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
|
||||
|
||||
@@ -45,18 +47,18 @@ public interface IGridTickable
|
||||
*/
|
||||
|
||||
/**
|
||||
* You can return null, if you wish to tick using MC's ticking mechanism, or
|
||||
* you can return a valid TickingRequest to tell AE a guide for which type
|
||||
* of responsiveness your device wants.
|
||||
* Return a valid TickingRequest to tell AE a guide for which type of
|
||||
* responsiveness your device wants.
|
||||
*
|
||||
* this will be called for your tile any time your tile changes grids, this
|
||||
* This will be called for your tile any time your tile changes grids, this
|
||||
* can happen at any time, so if your using the sleep feature you may wish
|
||||
* to preserve your sleep, in the result of this method. or you can simply
|
||||
* reset it.
|
||||
*
|
||||
* @return null or a valid new TickingRequest
|
||||
* @return a valid new TickingRequest
|
||||
*/
|
||||
TickingRequest getTickingRequest( IGridNode node );
|
||||
@Nonnull
|
||||
TickingRequest getTickingRequest( @Nonnull IGridNode node );
|
||||
|
||||
/**
|
||||
* AE lets you adjust your tick rate based on the results of your tick, if
|
||||
@@ -67,11 +69,12 @@ public interface IGridTickable
|
||||
*
|
||||
* Note: this is never called if you return null from getTickingRequest.
|
||||
*
|
||||
* @param TicksSinceLastCall the number of world ticks that were skipped since your last
|
||||
* @param ticksSinceLastCall the number of world ticks that were skipped since your last
|
||||
* tick, you can use this to adjust speed of processing or adjust
|
||||
* your tick rate.
|
||||
*
|
||||
* @return tick rate adjustment.
|
||||
*/
|
||||
TickRateModulation tickingRequest( IGridNode node, int TicksSinceLastCall );
|
||||
@Nonnull
|
||||
TickRateModulation tickingRequest( @Nonnull IGridNode node, int ticksSinceLastCall );
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
package appeng.api.networking.ticking;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.networking.IGridCache;
|
||||
import appeng.api.networking.IGridNode;
|
||||
|
||||
@@ -42,7 +44,7 @@ public interface ITickManager extends IGridCache
|
||||
*
|
||||
* @param node gridnode
|
||||
*/
|
||||
boolean alertDevice( IGridNode node );
|
||||
boolean alertDevice( @Nonnull IGridNode node );
|
||||
|
||||
/**
|
||||
* disables ticking for your device.
|
||||
@@ -51,7 +53,7 @@ public interface ITickManager extends IGridCache
|
||||
*
|
||||
* @return if the call was successful.
|
||||
*/
|
||||
boolean sleepDevice( IGridNode node );
|
||||
boolean sleepDevice( @Nonnull IGridNode node );
|
||||
|
||||
/**
|
||||
* enables ticking for your device, undoes a sleepDevice call.
|
||||
@@ -60,5 +62,5 @@ public interface ITickManager extends IGridCache
|
||||
*
|
||||
* @return if the call was successful.
|
||||
*/
|
||||
boolean wakeDevice( IGridNode node );
|
||||
boolean wakeDevice( @Nonnull IGridNode node );
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@@ -209,6 +209,7 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
|
||||
* Called when you right click the part, very similar to Block.onActivateBlock
|
||||
*
|
||||
* @param player right clicking player
|
||||
* @param hand hand used
|
||||
* @param pos position of block
|
||||
*
|
||||
* @return if your activate method performed something.
|
||||
@@ -219,12 +220,41 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
|
||||
* Called when you right click the part, very similar to Block.onActivateBlock
|
||||
*
|
||||
* @param player shift right clicking player
|
||||
* @param hand hand used
|
||||
* @param pos position of block
|
||||
*
|
||||
* @return if your activate method performed something, you should use false unless you really need it.
|
||||
*/
|
||||
boolean onShiftActivate( EntityPlayer player, EnumHand hand, Vec3d pos );
|
||||
|
||||
/**
|
||||
* Called when you left click the part, very similar to Block.onBlockClicked
|
||||
*
|
||||
* @param player left clicking player
|
||||
* @param hand hand used
|
||||
* @param pos position of block
|
||||
*
|
||||
* @return if your activate method performed something, you should use false unless you really need it.
|
||||
*/
|
||||
default boolean onClicked( EntityPlayer player, EnumHand hand, Vec3d pos )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when you shift-left click the part, very similar to Block.onBlockClicked
|
||||
*
|
||||
* @param player shift-left clicking player
|
||||
* @param hand hand used
|
||||
* @param pos position of block
|
||||
*
|
||||
* @return if your activate method performed something, you should use false unless you really need it.
|
||||
*/
|
||||
default boolean onShiftClicked( EntityPlayer player, EnumHand hand, Vec3d pos )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add drops to the items being dropped into the world, if your item stores its contents when wrenched use the
|
||||
* wrenched boolean to control what data is saved vs dropped when it is broken.
|
||||
@@ -325,4 +355,14 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag to be passed to the renderer.
|
||||
*
|
||||
* @return flag or null
|
||||
*/
|
||||
default Long getRenderFlag()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
package appeng.api.parts;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
|
||||
|
||||
public interface IPartBakedModel
|
||||
{
|
||||
List<BakedQuad> getPartQuads( @Nullable Long partFlags, long rand );
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public interface IPartHost extends ICustomCableConnection
|
||||
* @return null if the item failed to add, the side it was placed on other wise ( may different for cables,
|
||||
* {@link AEPartLocation}.UNKNOWN )
|
||||
*/
|
||||
AEPartLocation addPart( ItemStack is, AEPartLocation side, EntityPlayer owner, EnumHand hand );
|
||||
AEPartLocation addPart( ItemStack is, AEPartLocation side, EntityPlayer owner, EnumHand hand );
|
||||
|
||||
/**
|
||||
* Get part by side ( center is {@link AEPartLocation}.UNKNOWN )
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
package appeng.api.parts;
|
||||
|
||||
|
||||
/**
|
||||
* TODO: Consider removing and replacing with capabilities.
|
||||
*/
|
||||
|
||||
@@ -30,6 +30,7 @@ import appeng.api.exceptions.MissingIngredientException;
|
||||
import appeng.api.exceptions.RecipeException;
|
||||
import appeng.api.exceptions.RegistrationException;
|
||||
|
||||
|
||||
@Deprecated
|
||||
public interface ICraftHandler
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.item.ItemStack;
|
||||
import appeng.api.exceptions.MissingIngredientException;
|
||||
import appeng.api.exceptions.RegistrationException;
|
||||
|
||||
|
||||
@Deprecated
|
||||
public interface IIngredient
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.io.BufferedReader;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
@Deprecated
|
||||
public interface IRecipeLoader
|
||||
{
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
package appeng.api.storage;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
public interface ICellGuiHandler
|
||||
{
|
||||
/**
|
||||
* Return true if this handler can show GUI for this channel.
|
||||
*
|
||||
* @param channel Storage channel
|
||||
* @return True if handled, else false.
|
||||
*/
|
||||
<T extends IAEStack<T>> boolean isHandlerFor( IStorageChannel<T> channel );
|
||||
|
||||
/**
|
||||
* Return true to prioritize this handler for the provided {@link ItemStack}.
|
||||
*
|
||||
* @param is Cell ItemStack
|
||||
* @return True, if specialized else false.
|
||||
*/
|
||||
default boolean isSpecializedFor( ItemStack is )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the storage cell is placed in an ME Chest and the user tries to open the terminal side, if your item
|
||||
* is not available via ME Chests simply tell the user they can't use it, or something, other wise you should open
|
||||
* your gui and display the cell to the user.
|
||||
*
|
||||
* @param player player opening chest gui
|
||||
* @param chest to be opened chest
|
||||
* @param cellHandler cell handler
|
||||
* @param inv inventory handler
|
||||
* @param is item
|
||||
* @param chan storage channel
|
||||
*/
|
||||
<T extends IAEStack<T>> void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler<T> inv, ItemStack is, IStorageChannel<T> chan );
|
||||
|
||||
}
|
||||
@@ -24,10 +24,8 @@
|
||||
package appeng.api.storage;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
@@ -52,26 +50,12 @@ public interface ICellHandler
|
||||
*
|
||||
* @param is a storage cell item.
|
||||
* @param host anytime the contents of your storage cell changes it should use this to request a save, please
|
||||
* note, this value can be null.
|
||||
* note, this value can be null. If provided, the host is responsible for persisting the cell content.
|
||||
* @param channel the storage channel requested.
|
||||
*
|
||||
* @return a new IMEHandler for the provided item
|
||||
*/
|
||||
<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
|
||||
* is not available via ME Chests simply tell the user they can't use it, or something, other wise you should open
|
||||
* your gui and display the cell to the user.
|
||||
*
|
||||
* @param player player opening chest gui
|
||||
* @param chest to be opened chest
|
||||
* @param cellHandler cell handler
|
||||
* @param inv inventory handler
|
||||
* @param is item
|
||||
* @param chan storage channel
|
||||
*/
|
||||
<T extends IAEStack<T>> void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler<T> inv, ItemStack is, IStorageChannel<T> chan );
|
||||
<T extends IAEStack<T>> ICellInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> channel );
|
||||
|
||||
/**
|
||||
* 0 - cell is missing.
|
||||
@@ -87,10 +71,31 @@ public interface ICellHandler
|
||||
*
|
||||
* @return get the status of the cell based on its contents.
|
||||
*/
|
||||
<T extends IAEStack<T>> int getStatusForCell( ItemStack is, IMEInventory<T> handler );
|
||||
default <T extends IAEStack<T>> int getStatusForCell( ItemStack is, ICellInventoryHandler<T> handler )
|
||||
{
|
||||
if( handler.getCellInv() != null )
|
||||
{
|
||||
int val = handler.getCellInv().getStatusForCell();
|
||||
|
||||
if( val == 1 && handler.isPreformatted() )
|
||||
{
|
||||
val = 2;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ae/t to drain for this storage cell inside a chest/drive.
|
||||
*/
|
||||
<T extends IAEStack<T>> double cellIdleDrain( ItemStack is, IMEInventory<T> handler );
|
||||
default <T extends IAEStack<T>> double cellIdleDrain( ItemStack is, ICellInventoryHandler<T> handler )
|
||||
{
|
||||
if( handler.getCellInv() != null )
|
||||
{
|
||||
return handler.getCellInv().getIdleDrain();
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
}
|
||||
@@ -28,10 +28,10 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
public interface ICellInventory extends IMEInventory<IAEItemStack>
|
||||
public interface ICellInventory<T extends IAEStack<T>> extends IMEInventory<T>
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -40,7 +40,7 @@ public interface ICellInventory extends IMEInventory<IAEItemStack>
|
||||
ItemStack getItemStack();
|
||||
|
||||
/**
|
||||
* @return idle cost for this Storage Cell
|
||||
* @return the ae/t to drain for this storage cell inside a chest/drive.
|
||||
*/
|
||||
double getIdleDrain();
|
||||
|
||||
@@ -115,7 +115,20 @@ public interface ICellInventory extends IMEInventory<IAEItemStack>
|
||||
int getUnusedItemCount();
|
||||
|
||||
/**
|
||||
* @return the status number for this drive.
|
||||
* 0 - cell is missing.
|
||||
*
|
||||
* 1 - green, ( usually means available room for types or items. )
|
||||
*
|
||||
* 2 - orange, ( usually means available room for items, but not types. )
|
||||
*
|
||||
* 3 - red, ( usually means the cell is 100% full )
|
||||
*
|
||||
* @return get the status of the cell based on its contents.
|
||||
*/
|
||||
int getStatusForCell();
|
||||
|
||||
/**
|
||||
* Tells the cell to persist to NBT
|
||||
*/
|
||||
void persist();
|
||||
}
|
||||
|
||||
@@ -24,17 +24,22 @@
|
||||
package appeng.api.storage;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.api.config.IncludeExclude;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
public interface ICellInventoryHandler extends IMEInventoryHandler<IAEItemStack>
|
||||
public interface ICellInventoryHandler<T extends IAEStack<T>> extends IMEInventoryHandler<T>
|
||||
{
|
||||
|
||||
/**
|
||||
* Get access to the ICellInventory. Can be null for custom cells.
|
||||
*
|
||||
* @return get access to the Cell Inventory.
|
||||
*/
|
||||
ICellInventory getCellInv();
|
||||
@Nullable
|
||||
ICellInventory<T> getCellInv();
|
||||
|
||||
boolean isPreformatted();
|
||||
|
||||
|
||||
@@ -24,7 +24,11 @@
|
||||
package appeng.api.storage;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
|
||||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
@@ -42,9 +46,19 @@ public interface ICellRegistry
|
||||
/**
|
||||
* Register a new handler.
|
||||
*
|
||||
* Never be call before {@link FMLInitializationEvent} was handled by AE2.
|
||||
* Will throw an exception otherwise.
|
||||
*
|
||||
* @param handler cell handler
|
||||
*/
|
||||
void addCellHandler( ICellHandler handler );
|
||||
void addCellHandler( @Nonnull ICellHandler handler );
|
||||
|
||||
/**
|
||||
* Register a new handler
|
||||
*
|
||||
* @param handler cell gui handler
|
||||
*/
|
||||
void addCellGuiHandler( @Nonnull ICellGuiHandler handler );
|
||||
|
||||
/**
|
||||
* return true, if you can get a InventoryHandler for the item passed.
|
||||
@@ -57,22 +71,34 @@ public interface ICellRegistry
|
||||
boolean isCellHandled( ItemStack is );
|
||||
|
||||
/**
|
||||
* get the handler, for the requested type.
|
||||
* get the handler, for the requested item.
|
||||
*
|
||||
* @param is to be checked item
|
||||
*
|
||||
* @return the handler registered for this item type.
|
||||
*/
|
||||
@Nullable
|
||||
ICellHandler getHandler( ItemStack is );
|
||||
|
||||
/**
|
||||
* returns an IMEInventoryHandler for the provided item.
|
||||
* get the handler, for the requested channel.
|
||||
*
|
||||
* @param channel requested channel
|
||||
* @param Cell ItemStack
|
||||
* @return the handler registered for this channel.
|
||||
*/
|
||||
@Nullable
|
||||
<T extends IAEStack<T>> ICellGuiHandler getGuiHandler( IStorageChannel<T> channel, ItemStack is );
|
||||
|
||||
/**
|
||||
* returns an ICellInventoryHandler for the provided item by querying all registered handlers.
|
||||
*
|
||||
* @param is item with inventory handler
|
||||
* @param host can be null, or the hosting tile / part.
|
||||
* @param host can be null. If provided, the host is responsible for persisting the cell content.
|
||||
* @param chan the storage channel to request the handler for.
|
||||
*
|
||||
* @return new IMEInventoryHandler, or null if there isn't one.
|
||||
* @return new ICellInventoryHandler, or null if there isn't one.
|
||||
*/
|
||||
<T extends IAEStack<T>> IMEInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> chan );
|
||||
@Nullable
|
||||
<T extends IAEStack<T>> ICellInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> chan );
|
||||
}
|
||||
@@ -24,8 +24,19 @@
|
||||
package appeng.api.storage;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
/**
|
||||
* Tells the cell provider that changes have been made an the cell must be persisted
|
||||
*
|
||||
*/
|
||||
public interface ISaveProvider
|
||||
{
|
||||
|
||||
void saveChanges( IMEInventory<?> cellInventory );
|
||||
/**
|
||||
* Cell has changed and needs to be changed.
|
||||
*
|
||||
* @param cellInventory can be null for custom cells.
|
||||
*/
|
||||
void saveChanges( @Nullable ICellInventory<?> cellInventory );
|
||||
}
|
||||
|
||||
@@ -32,10 +32,9 @@ import javax.annotation.Nullable;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
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;
|
||||
|
||||
@@ -56,6 +55,17 @@ public interface IStorageChannel<T extends IAEStack<T>>
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of units (eg item count, or millibuckets) that can be stored per byte in a storage cell.
|
||||
* Standard value for items is 8, and for fluids it's 8000
|
||||
*
|
||||
* @return number of units
|
||||
*/
|
||||
default int getUnitsPerByte()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link IItemList} of the specific type.
|
||||
*
|
||||
@@ -68,9 +78,12 @@ public interface IStorageChannel<T extends IAEStack<T>>
|
||||
* 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}.
|
||||
* But the general intention is about converting an {@link ItemStack} or {@link FluidStack} into the corresponding
|
||||
* {@link IAEStack}.
|
||||
* Another valid case might be to use it instead of {@link IAEStack#copy()}, but this might not be supported by all
|
||||
* types.
|
||||
* IAEStacks that use custom items for {@link IAEStack#asItemStackRepresentation()} must also be able to convert
|
||||
* these.
|
||||
*
|
||||
* @param input The object to turn into an {@link IAEStack}
|
||||
* @return The converted stack or null
|
||||
@@ -88,29 +101,11 @@ public interface IStorageChannel<T extends IAEStack<T>>
|
||||
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.
|
||||
* create from nbt data
|
||||
*
|
||||
* @param nbt
|
||||
* @return
|
||||
*/
|
||||
@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 );
|
||||
|
||||
T createFromNBT( @Nonnull NBTTagCompound nbt );
|
||||
}
|
||||
|
||||
@@ -28,10 +28,15 @@ import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.crafting.ICraftingRequester;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
@@ -90,4 +95,38 @@ public interface IStorageHelper
|
||||
*/
|
||||
ICraftingLink loadCraftingLink( NBTTagCompound data, ICraftingRequester req );
|
||||
|
||||
/**
|
||||
* Extracts items from a {@link IMEInventory} respecting power requirements.
|
||||
*
|
||||
* @param energy Energy source.
|
||||
* @param inv Inventory to extract from.
|
||||
* @param request Requested item and count.
|
||||
* @param src Action source.
|
||||
* @param mode Simulate or modulate
|
||||
* @return extracted items or {@code null} of nothing was extracted.
|
||||
*/
|
||||
<T extends IAEStack<T>> T poweredExtraction( final IEnergySource energy, final IMEInventory<T> inv, final T request, final IActionSource src, final Actionable mode );
|
||||
|
||||
/**
|
||||
* Inserts items into a {@link IMEInventory} respecting power requirements.
|
||||
*
|
||||
* @param energy Energy source.
|
||||
* @param inv Inventory to insert into.
|
||||
* @param request Items to insert.
|
||||
* @param src Action source.
|
||||
* @param mode Simulate or modulate
|
||||
* @return items not inserted or {@code null} if everything was inserted.
|
||||
*/
|
||||
<T extends IAEStack<T>> T poweredInsert( final IEnergySource energy, final IMEInventory<T> inv, final T input, final IActionSource src, final Actionable mode );
|
||||
|
||||
/**
|
||||
* Posts alteration of stored items to the provided {@link IStorageGrid}.
|
||||
* This can be used by cell containers to notify the grid of storage cell changes.
|
||||
*
|
||||
* @param gs the storage grid.
|
||||
* @param removedCell the removed cell itemstack
|
||||
* @param addedCell the added cell itemstack
|
||||
* @param src the action source
|
||||
*/
|
||||
void postChanges( @Nonnull final IStorageGrid gs, @Nonnull final ItemStack removedCell, @Nonnull final ItemStack addedCell, @Nonnull final IActionSource src );
|
||||
}
|
||||
|
||||
@@ -149,16 +149,14 @@ public interface IAEStack<T extends IAEStack<T>>
|
||||
boolean equals( Object obj );
|
||||
|
||||
/**
|
||||
* compare stacks using fuzzy logic
|
||||
* Compare the same subtype of {@link IAEStack} with another using a fuzzy comparison.
|
||||
*
|
||||
* a IAEItemStack to another AEItemStack or a ItemStack.
|
||||
*
|
||||
* @param st stacks
|
||||
* @param mode used fuzzy mode
|
||||
* @param other The stack to compare.
|
||||
* @param mode Which {@link FuzzyMode} should be used.
|
||||
*
|
||||
* @return true if two stacks are equal based on AE Fuzzy Comparison.
|
||||
*/
|
||||
boolean fuzzyComparison( Object st, FuzzyMode mode );
|
||||
boolean fuzzyComparison( T other, FuzzyMode mode );
|
||||
|
||||
/**
|
||||
* Slower for disk saving, but smaller/more efficient for packets.
|
||||
@@ -200,7 +198,7 @@ public interface IAEStack<T extends IAEStack<T>>
|
||||
|
||||
/**
|
||||
* Returns itemstack for display and similar purposes. Always has a count of 1.
|
||||
*
|
||||
*
|
||||
* @return itemstack
|
||||
*/
|
||||
ItemStack asItemStackRepresentation();
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013 AlgorithmX2
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package appeng.api.util;
|
||||
|
||||
|
||||
public enum AECableSize
|
||||
{
|
||||
NONE,
|
||||
NORMAL,
|
||||
DENSE;
|
||||
|
||||
public static AECableSize min( AECableSize a, AECableSize b )
|
||||
{
|
||||
return a.compareTo( b ) < 0 ? a : b;
|
||||
}
|
||||
|
||||
public static AECableSize max( AECableSize a, AECableSize b )
|
||||
{
|
||||
return a.compareTo( b ) > 0 ? a : b;
|
||||
}
|
||||
}
|
||||
@@ -29,32 +29,32 @@ public enum AECableType
|
||||
/**
|
||||
* No Cable present.
|
||||
*/
|
||||
NONE,
|
||||
NONE( AECableVariant.NONE, AECableSize.NONE ),
|
||||
|
||||
/**
|
||||
* Connections to this block should render as glass.
|
||||
*/
|
||||
GLASS,
|
||||
GLASS( AECableVariant.GLASS, AECableSize.NORMAL ),
|
||||
|
||||
/**
|
||||
* Connections to this block should render as covered.
|
||||
*/
|
||||
COVERED,
|
||||
COVERED( AECableVariant.COVERED, AECableSize.NORMAL ),
|
||||
|
||||
/**
|
||||
* Connections to this block should render as smart.
|
||||
*/
|
||||
SMART,
|
||||
SMART( AECableVariant.SMART, AECableSize.NORMAL ),
|
||||
|
||||
/**
|
||||
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
||||
*/
|
||||
DENSE_COVERED,
|
||||
DENSE_COVERED( AECableVariant.COVERED, AECableSize.DENSE ),
|
||||
|
||||
/**
|
||||
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
||||
*/
|
||||
DENSE_SMART;
|
||||
DENSE_SMART( AECableVariant.SMART, AECableSize.DENSE );
|
||||
|
||||
public static final AECableType[] VALIDCABLES = {
|
||||
GLASS,
|
||||
@@ -64,4 +64,97 @@ public enum AECableType
|
||||
DENSE_SMART
|
||||
};
|
||||
|
||||
private final AECableVariant variant;
|
||||
private final AECableSize size;
|
||||
|
||||
private AECableType( AECableVariant variant, AECableSize size )
|
||||
{
|
||||
this.variant = variant;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public AECableSize size()
|
||||
{
|
||||
return this.size;
|
||||
}
|
||||
|
||||
public AECableVariant variant()
|
||||
{
|
||||
return this.variant;
|
||||
}
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return this.variant != AECableVariant.NONE && this.size != AECableSize.NONE;
|
||||
}
|
||||
|
||||
public boolean isDense()
|
||||
{
|
||||
return this.size == AECableSize.DENSE;
|
||||
}
|
||||
|
||||
public boolean isSmart()
|
||||
{
|
||||
return this.variant == AECableVariant.SMART;
|
||||
}
|
||||
|
||||
public static AECableType min( AECableType a, AECableType b )
|
||||
{
|
||||
final AECableVariant v = AECableVariant.min( a.variant(), b.variant() );
|
||||
final AECableSize s = AECableSize.min( a.size(), b.size() );
|
||||
|
||||
return AECableType.from( v, s );
|
||||
}
|
||||
|
||||
public static AECableType max( AECableType a, AECableType b )
|
||||
{
|
||||
final AECableVariant v = AECableVariant.max( a.variant(), b.variant() );
|
||||
final AECableSize s = AECableSize.max( a.size(), b.size() );
|
||||
|
||||
return AECableType.from( v, s );
|
||||
}
|
||||
|
||||
private static AECableType from( AECableVariant variant, AECableSize size )
|
||||
{
|
||||
switch( variant )
|
||||
{
|
||||
case GLASS:
|
||||
switch( size )
|
||||
{
|
||||
case NORMAL:
|
||||
return GLASS;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case COVERED:
|
||||
switch( size )
|
||||
{
|
||||
case NORMAL:
|
||||
return COVERED;
|
||||
case DENSE:
|
||||
return DENSE_COVERED;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case SMART:
|
||||
switch( size )
|
||||
{
|
||||
case NORMAL:
|
||||
return SMART;
|
||||
case DENSE:
|
||||
return DENSE_SMART;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013 AlgorithmX2
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package appeng.api.util;
|
||||
|
||||
|
||||
public enum AECableVariant
|
||||
{
|
||||
NONE,
|
||||
GLASS,
|
||||
COVERED,
|
||||
SMART;
|
||||
|
||||
public static AECableVariant min( AECableVariant a, AECableVariant b )
|
||||
{
|
||||
return a.compareTo( b ) < 0 ? a : b;
|
||||
}
|
||||
|
||||
public static AECableVariant max( AECableVariant a, AECableVariant b )
|
||||
{
|
||||
return a.compareTo( b ) > 0 ? a : b;
|
||||
}
|
||||
}
|
||||
@@ -74,25 +74,30 @@ public enum AEColor
|
||||
|
||||
TRANSPARENT( "gui.appliedenergistics2.Fluix", null, 0x1B2344, 0x895CA8, 0xD7BBEC );
|
||||
|
||||
public static final List<AEColor> VALID_COLORS = Arrays.asList( WHITE, ORANGE, MAGENTA, LIGHT_BLUE, YELLOW, LIME, PINK, GRAY, LIGHT_GRAY, CYAN, PURPLE, BLUE, BROWN, GREEN, RED, BLACK );
|
||||
public static final List<AEColor> VALID_COLORS = Arrays.asList( WHITE, ORANGE, MAGENTA, LIGHT_BLUE, YELLOW, LIME, PINK, GRAY, LIGHT_GRAY, CYAN, PURPLE,
|
||||
BLUE, BROWN, GREEN, RED, BLACK );
|
||||
|
||||
/**
|
||||
* The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #blackVariant dark variant} of the apprioriate AE color.
|
||||
* The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #blackVariant dark
|
||||
* variant} of the apprioriate AE color.
|
||||
*/
|
||||
public static final int TINTINDEX_DARK = 1;
|
||||
|
||||
/**
|
||||
* The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #mediumVariant medium variant} of the apprioriate AE color.
|
||||
* The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #mediumVariant medium
|
||||
* variant} of the apprioriate AE color.
|
||||
*/
|
||||
public static final int TINTINDEX_MEDIUM = 2;
|
||||
|
||||
/**
|
||||
* The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #whiteVariant bright variant} of the apprioriate AE color.
|
||||
* The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #whiteVariant bright
|
||||
* variant} of the apprioriate AE color.
|
||||
*/
|
||||
public static final int TINTINDEX_BRIGHT = 3;
|
||||
|
||||
/**
|
||||
* The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get a color between the {@link #mediumVariant medium}
|
||||
* The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get a color between the
|
||||
* {@link #mediumVariant medium}
|
||||
* and {@link #whiteVariant bright variant} of the apprioriate AE color.
|
||||
*/
|
||||
public static final int TINTINDEX_MEDIUM_BRIGHT = 4;
|
||||
@@ -141,7 +146,8 @@ public enum AEColor
|
||||
{
|
||||
switch( tintIndex )
|
||||
{
|
||||
// Please note that tintindex 0 is hardcoded for the block breaking particles. Returning anything other than -1 for tintindex=0 here
|
||||
// Please note that tintindex 0 is hardcoded for the block breaking particles. Returning anything other than
|
||||
// -1 for tintindex=0 here
|
||||
// will cause issues with those particles
|
||||
case 0:
|
||||
return -1;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
package appeng.api.util;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
public interface IClientHelper
|
||||
{
|
||||
/**
|
||||
* Add cell information to the provided list. Used for tooltip content.
|
||||
*
|
||||
* @param handler Cell handler.
|
||||
* @param lines List of lines to add to.
|
||||
*/
|
||||
<T extends IAEStack<T>> void addCellInformation( ICellInventoryHandler<T> handler, List<String> lines );
|
||||
|
||||
}
|
||||
@@ -23,8 +23,10 @@
|
||||
|
||||
package appeng.api.util;
|
||||
|
||||
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
|
||||
|
||||
/**
|
||||
* Implement on Tile or part to customize if the info gui opens, or an action is preformed.
|
||||
*/
|
||||
|
||||
@@ -56,15 +56,18 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
|
||||
double internalCurrentPower = 0;
|
||||
final double internalMaxPower = this.getMaxEnergyCapacity();
|
||||
|
||||
if( tag != null )
|
||||
if( internalMaxPower > 0 )
|
||||
{
|
||||
internalCurrentPower = tag.getDouble( "internalCurrentPower" );
|
||||
if( tag != null )
|
||||
{
|
||||
internalCurrentPower = tag.getDouble( "internalCurrentPower" );
|
||||
}
|
||||
|
||||
final double percent = internalCurrentPower / internalMaxPower;
|
||||
|
||||
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform
|
||||
.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
||||
}
|
||||
|
||||
final double percent = internalCurrentPower / internalMaxPower;
|
||||
|
||||
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform
|
||||
.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -87,7 +87,7 @@ public class BlockMolecularAssembler extends AEBaseTileBlock
|
||||
@Override
|
||||
public boolean canRenderInLayer( IBlockState state, BlockRenderLayer layer )
|
||||
{
|
||||
return layer == BlockRenderLayer.TRANSLUCENT;
|
||||
return layer == BlockRenderLayer.CUTOUT || layer == BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -150,9 +150,9 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
|
||||
{
|
||||
final EnumFacing up = this.getOrientable( world, pos ).getUp();
|
||||
if( !this.canPlaceAt( (World) world, pos, up.getOpposite() ) )
|
||||
if( !this.canPlaceAt( world, pos, up.getOpposite() ) )
|
||||
{
|
||||
this.dropTorch( (World) world, pos );
|
||||
this.dropTorch( world, pos );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,17 +37,13 @@ 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;
|
||||
|
||||
@@ -67,9 +63,6 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||
|
||||
this.setSoundType( SoundType.GROUND );
|
||||
this.setHardness( 0F );
|
||||
|
||||
EntityRegistry.registerModEntity( new ResourceLocation( AppEng.MOD_ID, EntityTinyTNTPrimed.class.getName() ), EntityTinyTNTPrimed.class,
|
||||
"EntityTinyTNTPrimed", EntityIds.get( EntityTinyTNTPrimed.class ), AppEng.instance(), 16, 4, true );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,6 +49,7 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult.Type;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -60,17 +61,22 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.parts.IFacadeContainer;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.parts.SelectedPart;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.UnlistedProperty;
|
||||
import appeng.client.render.cablebus.CableBusBakedModel;
|
||||
import appeng.client.render.cablebus.CableBusRenderState;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketClick;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.integration.abstraction.IAEFacade;
|
||||
import appeng.parts.ICableBusContainer;
|
||||
import appeng.parts.NullCableBusContainer;
|
||||
import appeng.tile.AEBaseTile;
|
||||
@@ -80,7 +86,7 @@ import appeng.tile.networking.TileCableBusTESR;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockCableBus extends AEBaseTileBlock
|
||||
public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
|
||||
{
|
||||
|
||||
public static final UnlistedProperty<CableBusRenderState> RENDER_STATE_PROPERTY = new UnlistedProperty<>( "cable_bus_render_state", CableBusRenderState.class );
|
||||
@@ -119,6 +125,8 @@ public class BlockCableBus extends AEBaseTileBlock
|
||||
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
CableBusRenderState renderState = this.cb( world, pos ).getRenderState();
|
||||
renderState.setWorld( world );
|
||||
renderState.setPos( pos );
|
||||
return ( (IExtendedBlockState) state ).withProperty( RENDER_STATE_PROPERTY, renderState );
|
||||
}
|
||||
|
||||
@@ -314,13 +322,14 @@ public class BlockCableBus extends AEBaseTileBlock
|
||||
for( int l = 0; l < 4; ++l )
|
||||
{
|
||||
// Randomly select one of the textures if the cable bus has more than just one possibility here
|
||||
TextureAtlasSprite texture = Platform.pickRandom( textures );
|
||||
final TextureAtlasSprite texture = Platform.pickRandom( textures );
|
||||
|
||||
final double d0 = pos.getX() + ( j + 0.5D ) / 4.0D;
|
||||
final double d1 = pos.getY() + ( k + 0.5D ) / 4.0D;
|
||||
final double d2 = pos.getZ() + ( l + 0.5D ) / 4.0D;
|
||||
final ParticleDigging particle = new DestroyFX( world, d0, d1, d2, d0 - pos.getX() - 0.5D, d1 - pos
|
||||
.getY() - 0.5D, d2 - pos.getZ() - 0.5D, this.getDefaultState() ).setBlockPos( pos );
|
||||
|
||||
double d0 = (double) pos.getX() + ( (double) j + 0.5D ) / 4.0D;
|
||||
double d1 = (double) pos.getY() + ( (double) k + 0.5D ) / 4.0D;
|
||||
double d2 = (double) pos.getZ() + ( (double) l + 0.5D ) / 4.0D;
|
||||
ParticleDigging particle = new DestroyFX( world, d0, d1, d2, d0 - (double) pos.getX() - 0.5D, d1 - (double) pos
|
||||
.getY() - 0.5D, d2 - (double) pos.getZ() - 0.5D, this.getDefaultState() ).setBlockPos( pos );
|
||||
particle.setParticleTexture( texture );
|
||||
effectRenderer.addEffect( particle );
|
||||
}
|
||||
@@ -353,6 +362,45 @@ public class BlockCableBus extends AEBaseTileBlock
|
||||
return out == null ? NULL_CABLE_BUS : out;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private IFacadeContainer fc( final IBlockAccess w, final BlockPos pos )
|
||||
{
|
||||
final TileEntity te = w.getTileEntity( pos );
|
||||
IFacadeContainer out = null;
|
||||
|
||||
if( te instanceof TileCableBus )
|
||||
{
|
||||
out = ( (TileCableBus) te ).getCableBus().getFacadeContainer();
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockClicked( World worldIn, BlockPos pos, EntityPlayer playerIn )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
final RayTraceResult rtr = Minecraft.getMinecraft().objectMouseOver;
|
||||
if( rtr != null && rtr.typeOfHit == Type.BLOCK && pos.equals( rtr.getBlockPos() ) )
|
||||
{
|
||||
final Vec3d hitVec = rtr.hitVec.subtract( new Vec3d( pos ) );
|
||||
|
||||
if( this.cb( worldIn, pos ).clicked( playerIn, EnumHand.MAIN_HAND, hitVec ) )
|
||||
{
|
||||
NetworkHandler.instance()
|
||||
.sendToServer(
|
||||
new PacketClick( pos, rtr.sideHit, (float) hitVec.x, (float) hitVec.y, (float) hitVec.z, EnumHand.MAIN_HAND, true ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockClickPacket( World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, Vec3d hitVec )
|
||||
{
|
||||
this.cb( worldIn, pos ).clicked( playerIn, hand, hitVec );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
@@ -408,14 +456,25 @@ public class BlockCableBus extends AEBaseTileBlock
|
||||
@Override
|
||||
public boolean canRenderInLayer( IBlockState state, BlockRenderLayer layer )
|
||||
{
|
||||
if( AEApi.instance().partHelper().getCableRenderMode().transparentFacades )
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getFacadeState( IBlockAccess world, BlockPos pos, EnumFacing side )
|
||||
{
|
||||
if( side != null )
|
||||
{
|
||||
return layer == BlockRenderLayer.CUTOUT || layer == BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
return layer == BlockRenderLayer.CUTOUT;
|
||||
IFacadeContainer container = this.fc( world, pos );
|
||||
if( container != null )
|
||||
{
|
||||
IFacadePart facade = container.getFacade( AEPartLocation.fromFacing( side ) );
|
||||
if( facade != null )
|
||||
{
|
||||
return facade.getBlockState();
|
||||
}
|
||||
}
|
||||
}
|
||||
return world.getBlockState( pos );
|
||||
}
|
||||
|
||||
public static Class<? extends AEBaseTile> getNoTesrTile()
|
||||
|
||||
@@ -34,8 +34,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
@@ -108,14 +106,7 @@ public class BlockChest extends AEBaseTileBlock
|
||||
}
|
||||
else
|
||||
{
|
||||
final ItemStack cell = tg.getCell();
|
||||
if( !cell.isEmpty() )
|
||||
{
|
||||
final ICellHandler ch = AEApi.instance().registries().cell().getHandler( cell );
|
||||
|
||||
tg.openGui( p, ch, cell, side );
|
||||
}
|
||||
else
|
||||
if( !tg.openGui( p ) )
|
||||
{
|
||||
p.sendMessage( PlayerMessages.ChestCannotReadStorageCell.get() );
|
||||
}
|
||||
|
||||
@@ -74,13 +74,8 @@ public class BlockDrive extends AEBaseTileBlock
|
||||
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
TileDrive te = this.getTileEntity( world, pos );
|
||||
if( te == null )
|
||||
{
|
||||
return super.getExtendedState( state, world, pos );
|
||||
}
|
||||
|
||||
IExtendedBlockState extState = (IExtendedBlockState) super.getExtendedState( state, world, pos );
|
||||
return extState.withProperty( SLOTS_STATE, DriveSlotsState.fromChestOrDrive( te ) );
|
||||
return extState.withProperty( SLOTS_STATE, te == null ? DriveSlotsState.createEmpty( 10 ) : DriveSlotsState.fromChestOrDrive( te ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -75,4 +75,14 @@ public class DriveSlotsState
|
||||
}
|
||||
return new DriveSlotsState( slots );
|
||||
}
|
||||
|
||||
public static DriveSlotsState createEmpty( int slotCount )
|
||||
{
|
||||
DriveSlotState[] slots = new DriveSlotState[slotCount];
|
||||
for( int i = 0; i < slotCount; i++ )
|
||||
{
|
||||
slots[i] = DriveSlotState.EMPTY;
|
||||
}
|
||||
return new DriveSlotsState( slots );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ public class FeatureFactory
|
||||
|
||||
private <T extends IBootstrapComponent> void addBootstrapComponent( Class<? extends IBootstrapComponent> eventType, T component )
|
||||
{
|
||||
bootstrapComponents.computeIfAbsent( eventType, c -> new ArrayList<IBootstrapComponent>() ).add( component );
|
||||
this.bootstrapComponents.computeIfAbsent( eventType, c -> new ArrayList<IBootstrapComponent>() ).add( component );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
|
||||
@@ -144,7 +144,7 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
item.setCreativeTab( this.creativeTab );
|
||||
|
||||
// Register all extra handlers
|
||||
this.boostrapComponents.forEach( component -> component.apply( item ) );
|
||||
this.boostrapComponents.forEach( component -> this.factory.addBootstrapComponent( component.apply( item ) ) );
|
||||
|
||||
// Register custom dispenser behavior if requested
|
||||
if( this.dispenserBehaviorSupplier != null )
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.common.registry.EntityEntry;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IEntityRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
void entityRegistration( IForgeRegistry<EntityEntry> entityRegistry );
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
package appeng.client;
|
||||
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
|
||||
public enum ActionKey
|
||||
{
|
||||
TOGGLE_FOCUS( Keyboard.KEY_TAB );
|
||||
|
||||
private final int defaultKey;
|
||||
|
||||
private ActionKey( int defaultKey )
|
||||
{
|
||||
this.defaultKey = defaultKey;
|
||||
}
|
||||
|
||||
public String getTranslationKey()
|
||||
{
|
||||
return "key." + this.name().toLowerCase() + ".desc";
|
||||
}
|
||||
|
||||
public int getDefaultKey()
|
||||
{
|
||||
return this.defaultKey;
|
||||
}
|
||||
}
|
||||
@@ -21,15 +21,15 @@ package appeng.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
@@ -42,6 +42,8 @@ import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.common.ForgeModContainer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import appeng.api.parts.CableRenderMode;
|
||||
@@ -75,6 +77,9 @@ import appeng.util.Platform;
|
||||
|
||||
public class ClientHelper extends ServerHelper
|
||||
{
|
||||
private final static String KEY_CATEGORY = "key.appliedenergistics2.category";
|
||||
|
||||
private final EnumMap<ActionKey, KeyBinding> bindings = new EnumMap<>( ActionKey.class );
|
||||
|
||||
@Override
|
||||
public void preinit()
|
||||
@@ -85,30 +90,20 @@ public class ClientHelper extends ServerHelper
|
||||
{
|
||||
ModelLoaderRegistry.registerLoader( UVLModelLoader.INSTANCE );
|
||||
}
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler( EntityTinyTNTPrimed.class, manager -> new RenderTinyTNTPrimed( manager ) );
|
||||
RenderingRegistry.registerEntityRenderingHandler( EntityFloatingItem.class, manager -> new RenderFloatingItem( manager ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
// final Block fluixBlock = GameRegistry.findBlock( "appliedenergistics2", "fluix" );
|
||||
// Item fluixItem = Item.getItemFromBlock( fluixBlock );
|
||||
// ModelResourceLocation itemModelResourceLocation = new ModelResourceLocation( "appliedenergistics2:fluix",
|
||||
// "inventory" );
|
||||
// final int DEFAULT_ITEM_SUBTYPE = 0;
|
||||
// final ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
|
||||
// // mesher.register( fluixItem, DEFAULT_ITEM_SUBTYPE, itemModelResourceLocation );
|
||||
//
|
||||
// final ResourceLocation resource = new ResourceLocation( "appliedenergistics2", "stair.fluix" );
|
||||
// final ModelResourceLocation fluixStairModel = new ModelResourceLocation( resource, "inventory" );
|
||||
// AELog.info( "FluixStairModel: " + fluixStairModel );
|
||||
//
|
||||
// final Set<Item> items = AEApi.instance().definitions().blocks().fluixStairs().maybeItem().asSet();
|
||||
// for( Item item : items )
|
||||
// {
|
||||
// AELog.info( "Registering with %s with unlocalized %s", item, item.getUnlocalizedName() );
|
||||
// mesher.register( item, DEFAULT_ITEM_SUBTYPE, fluixStairModel );
|
||||
// }
|
||||
|
||||
for( ActionKey key : ActionKey.values() )
|
||||
{
|
||||
final KeyBinding binding = new KeyBinding( key.getTranslationKey(), key.getDefaultKey(), KEY_CATEGORY );
|
||||
ClientRegistry.registerKeyBinding( binding );
|
||||
this.bindings.put( key, binding );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -199,11 +194,6 @@ public class ClientHelper extends ServerHelper
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
// RenderingRegistry.registerBlockHandler( WorldRender.INSTANCE );
|
||||
final RenderManager inst = Minecraft.getMinecraft().getRenderManager();
|
||||
|
||||
inst.entityRenderMap.put( EntityTinyTNTPrimed.class, new RenderTinyTNTPrimed( inst ) );
|
||||
inst.entityRenderMap.put( EntityFloatingItem.class, new RenderFloatingItem( inst ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -330,29 +320,20 @@ public class ClientHelper extends ServerHelper
|
||||
final EntityPlayer player = mc.player;
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
final EnumHand hand;
|
||||
if( !player.getHeldItem( EnumHand.MAIN_HAND ).isEmpty() && player.getHeldItem( EnumHand.MAIN_HAND ).getItem() instanceof IMouseWheelItem )
|
||||
{
|
||||
hand = EnumHand.MAIN_HAND;
|
||||
}
|
||||
else if( !player.getHeldItem( EnumHand.OFF_HAND ).isEmpty() && player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem )
|
||||
{
|
||||
hand = EnumHand.OFF_HAND;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
final boolean mainHand = player.getHeldItem( EnumHand.MAIN_HAND ).getItem() instanceof IMouseWheelItem;
|
||||
final boolean offHand = player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem;
|
||||
|
||||
final ItemStack is = player.getHeldItem( hand );
|
||||
try
|
||||
if( mainHand || offHand )
|
||||
{
|
||||
NetworkHandler.instance().sendToServer( new PacketValueConfig( "Item", me.getDwheel() > 0 ? "WheelUp" : "WheelDown" ) );
|
||||
me.setCanceled( true );
|
||||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance().sendToServer( new PacketValueConfig( "Item", me.getDwheel() > 0 ? "WheelUp" : "WheelDown" ) );
|
||||
me.setCanceled( true );
|
||||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -363,4 +344,16 @@ public class ClientHelper extends ServerHelper
|
||||
ParticleTextures.registerSprite( event );
|
||||
InscriberTESR.registerTexture( event );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isKeyPressed( ActionKey key )
|
||||
{
|
||||
return this.bindings.get( key ).isPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActionKey( ActionKey key, int pressedKeyCode )
|
||||
{
|
||||
return this.bindings.get( key ).isActiveAndMatches( pressedKeyCode );
|
||||
}
|
||||
}
|
||||
@@ -22,11 +22,11 @@ package appeng.client.gui;
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -46,6 +46,8 @@ import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ClickType;
|
||||
@@ -54,8 +56,11 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.widgets.GuiCustomSlot;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.gui.widgets.ITooltip;
|
||||
import appeng.client.me.InternalSlotME;
|
||||
@@ -66,7 +71,7 @@ import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.AppEngCraftingSlot;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.AppEngSlot.hasCalculatedValidness;
|
||||
import appeng.container.slot.OptionalSlotFake;
|
||||
import appeng.container.slot.IOptionalSlot;
|
||||
import appeng.container.slot.SlotCraftingTerm;
|
||||
import appeng.container.slot.SlotDisabled;
|
||||
import appeng.container.slot.SlotFake;
|
||||
@@ -79,20 +84,24 @@ import appeng.core.AppEng;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketInventoryAction;
|
||||
import appeng.core.sync.packets.PacketSwapSlots;
|
||||
import appeng.fluids.client.render.FluidStackSizeRenderer;
|
||||
import appeng.fluids.container.slots.IMEFluidSlot;
|
||||
import appeng.helpers.InventoryAction;
|
||||
|
||||
|
||||
public abstract class AEBaseGui extends GuiContainer
|
||||
{
|
||||
private final List<InternalSlotME> meSlots = new LinkedList<>();
|
||||
private final List<InternalSlotME> meSlots = new ArrayList<>();
|
||||
// drag y
|
||||
private final Set<Slot> drag_click = new HashSet<>();
|
||||
private final StackSizeRenderer stackSizeRenderer = new StackSizeRenderer();
|
||||
private final FluidStackSizeRenderer fluidStackSizeRenderer = new FluidStackSizeRenderer();
|
||||
private GuiScrollbar myScrollBar = null;
|
||||
private boolean disableShiftClick = false;
|
||||
private Stopwatch dbl_clickTimer = Stopwatch.createStarted();
|
||||
private ItemStack dbl_whichItem = ItemStack.EMPTY;
|
||||
private Slot bl_clicked;
|
||||
protected final List<GuiCustomSlot> guiSlots = new ArrayList<>();
|
||||
|
||||
public AEBaseGui( final Container container )
|
||||
{
|
||||
@@ -146,35 +155,76 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen( final int mouseX, final int mouseY, final float btn )
|
||||
public void drawScreen( final int mouseX, final int mouseY, final float partialTicks )
|
||||
{
|
||||
super.drawDefaultBackground();
|
||||
super.drawScreen( mouseX, mouseY, btn );
|
||||
super.drawScreen( mouseX, mouseY, partialTicks );
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate( this.guiLeft, this.guiTop, 0.0F );
|
||||
GlStateManager.enableDepth();
|
||||
for( final GuiCustomSlot c : this.guiSlots )
|
||||
{
|
||||
this.drawGuiSlot( c, mouseX, mouseY, partialTicks );
|
||||
}
|
||||
GlStateManager.disableDepth();
|
||||
for( final GuiCustomSlot c : this.guiSlots )
|
||||
{
|
||||
this.drawTooltip( c, mouseX - this.guiLeft, mouseY - this.guiTop );
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
this.renderHoveredToolTip( mouseX, mouseY );
|
||||
|
||||
for( final Object c : this.buttonList )
|
||||
{
|
||||
if( c instanceof ITooltip )
|
||||
{
|
||||
final ITooltip tooltip = (ITooltip) c;
|
||||
final int x = tooltip.xPos(); // ((GuiImgButton) c).x;
|
||||
int y = tooltip.yPos(); // ((GuiImgButton) c).y;
|
||||
this.drawTooltip( (ITooltip) c, mouseX, mouseY );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( x < mouseX && x + tooltip.getWidth() > mouseX && tooltip.isVisible() )
|
||||
protected void drawGuiSlot( GuiCustomSlot slot, int mouseX, int mouseY, float partialTicks )
|
||||
{
|
||||
if( slot.isSlotEnabled() )
|
||||
{
|
||||
final int left = slot.xPos();
|
||||
final int top = slot.yPos();
|
||||
final int right = left + slot.getWidth();
|
||||
final int bottom = top + slot.getHeight();
|
||||
|
||||
slot.drawContent( this.mc, mouseX, mouseY, partialTicks );
|
||||
|
||||
if( this.isPointInRegion( left, top, slot.getWidth(), slot.getHeight(), mouseX, mouseY ) && slot.canClick( this.mc.player ) )
|
||||
{
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.colorMask( true, true, true, false );
|
||||
this.drawGradientRect( left, top, right, bottom, -2130706433, -2130706433 );
|
||||
GlStateManager.colorMask( true, true, true, true );
|
||||
GlStateManager.enableLighting();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void drawTooltip( ITooltip tooltip, int mouseX, int mouseY )
|
||||
{
|
||||
final int x = tooltip.xPos(); // ((GuiImgButton) c).x;
|
||||
int y = tooltip.yPos(); // ((GuiImgButton) c).y;
|
||||
|
||||
if( x < mouseX && x + tooltip.getWidth() > mouseX && tooltip.isVisible() )
|
||||
{
|
||||
if( y < mouseY && y + tooltip.getHeight() > mouseY )
|
||||
{
|
||||
if( y < 15 )
|
||||
{
|
||||
if( y < mouseY && y + tooltip.getHeight() > mouseY )
|
||||
{
|
||||
if( y < 15 )
|
||||
{
|
||||
y = 15;
|
||||
}
|
||||
y = 15;
|
||||
}
|
||||
|
||||
final String msg = tooltip.getMessage();
|
||||
if( msg != null )
|
||||
{
|
||||
this.drawTooltip( x + 11, y + 4, msg );
|
||||
}
|
||||
}
|
||||
final String msg = tooltip.getMessage();
|
||||
if( msg != null )
|
||||
{
|
||||
this.drawTooltip( x + 11, y + 4, msg );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -236,27 +286,36 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
final List<Slot> slots = this.getInventorySlots();
|
||||
for( final Slot slot : slots )
|
||||
{
|
||||
if( slot instanceof OptionalSlotFake )
|
||||
if( slot instanceof IOptionalSlot )
|
||||
{
|
||||
final OptionalSlotFake fs = (OptionalSlotFake) slot;
|
||||
if( fs.renderDisabled() )
|
||||
final IOptionalSlot optionalSlot = (IOptionalSlot) slot;
|
||||
if( optionalSlot.isRenderDisabled() )
|
||||
{
|
||||
if( fs.isSlotEnabled() )
|
||||
final AppEngSlot aeSlot = (AppEngSlot) slot;
|
||||
if( aeSlot.isSlotEnabled() )
|
||||
{
|
||||
this.drawTexturedModalRect( ox + fs.xPos - 1, oy + fs.yPos - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18,
|
||||
this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1,
|
||||
18,
|
||||
18 );
|
||||
}
|
||||
else
|
||||
{
|
||||
GlStateManager.color( 1.0F, 1.0F, 1.0F, 0.4F );
|
||||
GlStateManager.enableBlend();
|
||||
this.drawTexturedModalRect( ox + fs.xPos - 1, oy + fs.yPos - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18,
|
||||
this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1,
|
||||
18,
|
||||
18 );
|
||||
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( final GuiCustomSlot slot : this.guiSlots )
|
||||
{
|
||||
slot.drawBackground( ox, oy );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -277,6 +336,14 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
}
|
||||
}
|
||||
|
||||
for( GuiCustomSlot slot : this.guiSlots )
|
||||
{
|
||||
if( this.isPointInRegion( slot.xPos(), slot.yPos(), slot.getWidth(), slot.getHeight(), xCoord, yCoord ) && slot.canClick( this.mc.player ) )
|
||||
{
|
||||
slot.slotClicked( this.mc.player.inventory.getItemStack(), btn );
|
||||
}
|
||||
}
|
||||
|
||||
if( this.getScrollBar() != null )
|
||||
{
|
||||
this.getScrollBar().click( this, xCoord - this.guiLeft, yCoord - this.guiTop );
|
||||
@@ -488,11 +555,11 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
return;
|
||||
}
|
||||
|
||||
if( !this.disableShiftClick && isShiftKeyDown() )
|
||||
if( !this.disableShiftClick && isShiftKeyDown() && mouseButton == 0 )
|
||||
{
|
||||
this.disableShiftClick = true;
|
||||
|
||||
if( this.dbl_whichItem.isEmpty() || this.bl_clicked != slot || this.dbl_clickTimer.elapsed( TimeUnit.MILLISECONDS ) > 150 )
|
||||
if( this.dbl_whichItem.isEmpty() || this.bl_clicked != slot || this.dbl_clickTimer.elapsed( TimeUnit.MILLISECONDS ) > 250 )
|
||||
{
|
||||
// some simple double click logic.
|
||||
this.bl_clicked = slot;
|
||||
@@ -514,12 +581,13 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
for( final Slot inventorySlot : slots )
|
||||
{
|
||||
if( inventorySlot != null && inventorySlot.canTakeStack(
|
||||
this.mc.player ) && inventorySlot.getHasStack() && inventorySlot.inventory == slot.inventory && Container.canAddItemToSlot(
|
||||
this.mc.player ) && inventorySlot.getHasStack() && inventorySlot.isSameInventory( slot ) && Container.canAddItemToSlot(
|
||||
inventorySlot, this.dbl_whichItem, true ) )
|
||||
{
|
||||
this.handleMouseClick( inventorySlot, inventorySlot.slotNumber, 1, clickType );
|
||||
this.handleMouseClick( inventorySlot, inventorySlot.slotNumber, 0, ClickType.QUICK_MOVE );
|
||||
}
|
||||
}
|
||||
this.dbl_whichItem = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
this.disableShiftClick = false;
|
||||
@@ -715,6 +783,39 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
|
||||
return;
|
||||
}
|
||||
else if( s instanceof IMEFluidSlot && ( (IMEFluidSlot) s ).shouldRenderAsFluid() )
|
||||
{
|
||||
final IMEFluidSlot slot = (IMEFluidSlot) s;
|
||||
final IAEFluidStack fs = slot.getAEFluidStack();
|
||||
|
||||
if( fs != null && this.isPowered() )
|
||||
{
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableBlend();
|
||||
final Fluid fluid = fs.getFluid();
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
|
||||
final TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite( fluid.getStill().toString() );
|
||||
|
||||
// Set color for dynamic fluids
|
||||
// Convert int color to RGB
|
||||
float red = ( fluid.getColor() >> 16 & 255 ) / 255.0F;
|
||||
float green = ( fluid.getColor() >> 8 & 255 ) / 255.0F;
|
||||
float blue = ( fluid.getColor() & 255 ) / 255.0F;
|
||||
GlStateManager.color( red, green, blue );
|
||||
|
||||
this.drawTexturedModalRect( s.xPos, s.yPos, sprite, 16, 16 );
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableBlend();
|
||||
|
||||
this.fluidStackSizeRenderer.renderStackSize( this.fontRenderer, fs, s.xPos, s.yPos );
|
||||
}
|
||||
else if( !this.isPowered() )
|
||||
{
|
||||
drawRect( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111 );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.io.IOException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
@@ -238,7 +237,7 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
final int viewEnd = viewStart + 3 * this.rows;
|
||||
|
||||
String dspToolTip = "";
|
||||
final List<String> lineList = new LinkedList<>();
|
||||
final List<String> lineList = new ArrayList<>();
|
||||
int toolPosX = 0;
|
||||
int toolPosY = 0;
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ package appeng.client.gui.implementations;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -212,7 +211,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
final int viewEnd = viewStart + 3 * 6;
|
||||
|
||||
String dspToolTip = "";
|
||||
final List<String> lineList = new LinkedList<>();
|
||||
final List<String> lineList = new ArrayList<>();
|
||||
int toolPosX = 0;
|
||||
int toolPosY = 0;
|
||||
|
||||
|
||||
@@ -82,8 +82,8 @@ public class GuiInterface extends GuiUpgradeable
|
||||
|
||||
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.Interface.getLocal() ), 8, 6, 4210752 );
|
||||
|
||||
this.fontRenderer.drawString( GuiText.Config.getLocal(), 18, 6 + 11 + 7, 4210752 );
|
||||
this.fontRenderer.drawString( GuiText.StoredItems.getLocal(), 18, 6 + 60 + 7, 4210752 );
|
||||
this.fontRenderer.drawString( GuiText.Config.getLocal(), 8, 6 + 11 + 7, 4210752 );
|
||||
this.fontRenderer.drawString( GuiText.StoredItems.getLocal(), 8, 6 + 60 + 7, 4210752 );
|
||||
this.fontRenderer.drawString( GuiText.Patterns.getLocal(), 8, 6 + 73 + 7, 4210752 );
|
||||
|
||||
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
|
||||
|
||||
@@ -40,6 +40,7 @@ import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.client.ActionKey;
|
||||
import appeng.client.gui.AEBaseMEGui;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
@@ -54,6 +55,7 @@ import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
@@ -95,6 +97,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
private GuiImgButton SortDirBox;
|
||||
private GuiImgButton searchBoxSettings;
|
||||
private GuiImgButton terminalStyleBox;
|
||||
private boolean isAutoFocus = false;
|
||||
private int currentMouseX = 0;
|
||||
private int currentMouseY = 0;
|
||||
|
||||
public GuiMEMonitorable( final InventoryPlayer inventoryPlayer, final ITerminalHost te )
|
||||
{
|
||||
@@ -224,8 +229,10 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
Keyboard.enableRepeatEvents( true );
|
||||
|
||||
this.maxRows = this.getMaxRows();
|
||||
this.perRow = AEConfig.instance().getConfigManager().getSetting(
|
||||
Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ( ( this.width - this.standardSize ) / 18 );
|
||||
this.perRow = AEConfig.instance()
|
||||
.getConfigManager()
|
||||
.getSetting(
|
||||
Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ( ( this.width - this.standardSize ) / 18 );
|
||||
|
||||
final int magicNumber = 114 + 1;
|
||||
final int extraSpace = this.height - magicNumber - this.reservedSpace;
|
||||
@@ -290,8 +297,10 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
offset += 20;
|
||||
|
||||
this.buttonList.add(
|
||||
this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance().getConfigManager().getSetting(
|
||||
Settings.SEARCH_MODE ) ) );
|
||||
this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance()
|
||||
.getConfigManager()
|
||||
.getSetting(
|
||||
Settings.SEARCH_MODE ) ) );
|
||||
|
||||
offset += 20;
|
||||
|
||||
@@ -306,7 +315,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.setSelectionColor( 0xFF008000 );
|
||||
this.searchField.setVisible( true );
|
||||
|
||||
if( this.viewCell || this instanceof GuiWirelessTerm )
|
||||
@@ -318,13 +327,11 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
|
||||
final Enum searchModeSetting = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
||||
|
||||
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;
|
||||
this.isAutoFocus = SearchBoxMode.AUTOSEARCH == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH == searchModeSetting || SearchBoxMode.AUTOSEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH_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 );
|
||||
this.searchField.setFocused( this.isAutoFocus );
|
||||
|
||||
if( isJEIEnabled )
|
||||
{
|
||||
@@ -374,6 +381,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
{
|
||||
this.fontRenderer.drawString( this.getGuiDisplayName( this.myName.getLocal() ), 8, 6, 4210752 );
|
||||
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
|
||||
|
||||
this.currentMouseX = mouseX;
|
||||
this.currentMouseY = mouseY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -470,18 +480,40 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
@Override
|
||||
protected void keyTyped( final char character, final int key ) throws IOException
|
||||
{
|
||||
|
||||
if( !this.checkHotbarKeys( key ) )
|
||||
{
|
||||
if( AppEng.proxy.isActionKey( ActionKey.TOGGLE_FOCUS, key ) )
|
||||
{
|
||||
this.searchField.setFocused( !this.searchField.isFocused() );
|
||||
return;
|
||||
}
|
||||
|
||||
if( this.searchField.isFocused() && key == Keyboard.KEY_RETURN )
|
||||
{
|
||||
this.searchField.setFocused( false );
|
||||
return;
|
||||
}
|
||||
|
||||
if( character == ' ' && this.searchField.getText().isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean mouseInGui = this.isPointInRegion( 0, 0, this.xSize, this.ySize, this.currentMouseX, this.currentMouseY );
|
||||
|
||||
if( this.isAutoFocus && !this.searchField.isFocused() && mouseInGui )
|
||||
{
|
||||
this.searchField.setFocused( true );
|
||||
}
|
||||
|
||||
if( this.searchField.textboxKeyTyped( character, key ) )
|
||||
{
|
||||
this.repo.setSearchString( this.searchField.getText() );
|
||||
this.repo.updateView();
|
||||
this.setScrollBar();
|
||||
// tell forge the key event is handled and should not be sent out
|
||||
this.keyHandled = mouseInGui;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -78,8 +78,9 @@ public class GuiPatternTerm extends GuiMEMonitorable
|
||||
|
||||
if( this.tabCraftButton == btn || this.tabProcessButton == btn )
|
||||
{
|
||||
NetworkHandler.instance().sendToServer(
|
||||
new PacketValueConfig( "PatternTerminal.CraftMode", this.tabProcessButton == btn ? CRAFTMODE_CRFTING : CRAFTMODE_PROCESSING ) );
|
||||
NetworkHandler.instance()
|
||||
.sendToServer(
|
||||
new PacketValueConfig( "PatternTerminal.CraftMode", this.tabProcessButton == btn ? CRAFTMODE_CRFTING : CRAFTMODE_PROCESSING ) );
|
||||
}
|
||||
|
||||
if( this.encodeBtn == btn )
|
||||
@@ -94,8 +95,9 @@ public class GuiPatternTerm extends GuiMEMonitorable
|
||||
|
||||
if( this.substitutionsEnabledBtn == btn || this.substitutionsDisabledBtn == btn )
|
||||
{
|
||||
NetworkHandler.instance().sendToServer(
|
||||
new PacketValueConfig( "PatternTerminal.Substitute", this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE ) );
|
||||
NetworkHandler.instance()
|
||||
.sendToServer(
|
||||
new PacketValueConfig( "PatternTerminal.Substitute", this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE ) );
|
||||
}
|
||||
}
|
||||
catch( final IOException e )
|
||||
|
||||
@@ -25,14 +25,9 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.definitions.IParts;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiNumberBox;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.implementations.ContainerPriority;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
@@ -42,12 +37,6 @@ import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
import appeng.parts.automation.PartFormationPlane;
|
||||
import appeng.parts.misc.PartInterface;
|
||||
import appeng.parts.misc.PartStorageBus;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.tile.storage.TileChest;
|
||||
import appeng.tile.storage.TileDrive;
|
||||
|
||||
|
||||
public class GuiPriority extends AEBaseGui
|
||||
@@ -92,49 +81,11 @@ public class GuiPriority extends AEBaseGui
|
||||
this.buttonList.add( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 69, 32, 20, "-" + c ) );
|
||||
this.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + d ) );
|
||||
|
||||
ItemStack myIcon = null;
|
||||
final Object target = ( (AEBaseContainer) this.inventorySlots ).getTarget();
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IParts parts = definitions.parts();
|
||||
final IBlocks blocks = definitions.blocks();
|
||||
final ContainerPriority con = ( (ContainerPriority) this.inventorySlots );
|
||||
final ItemStack myIcon = con.getPriorityHost().getItemStackRepresentation();
|
||||
this.OriginalGui = con.getPriorityHost().getGuiBridge();
|
||||
|
||||
if( target instanceof PartStorageBus )
|
||||
{
|
||||
myIcon = parts.storageBus().maybeStack( 1 ).orElse( myIcon );
|
||||
this.OriginalGui = GuiBridge.GUI_STORAGEBUS;
|
||||
}
|
||||
|
||||
if( target instanceof PartFormationPlane )
|
||||
{
|
||||
myIcon = parts.formationPlane().maybeStack( 1 ).orElse( myIcon );
|
||||
this.OriginalGui = GuiBridge.GUI_FORMATION_PLANE;
|
||||
}
|
||||
|
||||
if( target instanceof TileDrive )
|
||||
{
|
||||
myIcon = blocks.drive().maybeStack( 1 ).orElse( myIcon );
|
||||
this.OriginalGui = GuiBridge.GUI_DRIVE;
|
||||
}
|
||||
|
||||
if( target instanceof TileChest )
|
||||
{
|
||||
myIcon = blocks.chest().maybeStack( 1 ).orElse( myIcon );
|
||||
this.OriginalGui = GuiBridge.GUI_CHEST;
|
||||
}
|
||||
|
||||
if( target instanceof TileInterface )
|
||||
{
|
||||
myIcon = blocks.iface().maybeStack( 1 ).orElse( myIcon );
|
||||
this.OriginalGui = GuiBridge.GUI_INTERFACE;
|
||||
}
|
||||
|
||||
if( target instanceof PartInterface )
|
||||
{
|
||||
myIcon = parts.iface().maybeStack( 1 ).orElse( myIcon );
|
||||
this.OriginalGui = GuiBridge.GUI_INTERFACE;
|
||||
}
|
||||
|
||||
if( this.OriginalGui != null && myIcon != null )
|
||||
if( this.OriginalGui != null && !myIcon.isEmpty() )
|
||||
{
|
||||
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), this.itemRender ) );
|
||||
}
|
||||
|
||||
@@ -58,11 +58,11 @@ public class GuiVibrationChamber extends AEBaseGui
|
||||
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.VibrationChamber.getLocal() ), 8, 6, 4210752 );
|
||||
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
|
||||
|
||||
this.pb.setFullMsg( this.cvc.getAePerTick() * this.cvc.getCurrentProgress() / 100 + " AE/t" );
|
||||
this.pb.setFullMsg( TileVibrationChamber.POWER_PER_TICK * this.cvc.getCurrentProgress() / TileVibrationChamber.DILATION_SCALING + " AE/t" );
|
||||
|
||||
if( this.cvc.getCurrentProgress() > 0 )
|
||||
if( this.cvc.getRemainingBurnTime() > 0 )
|
||||
{
|
||||
final int i1 = this.cvc.getCurrentProgress();
|
||||
final int i1 = this.cvc.getRemainingBurnTime() * 12 / 100;
|
||||
this.bindTexture( "guis/vibchamber.png" );
|
||||
GlStateManager.color( 1, 1, 1 );
|
||||
final int l = -15;
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
|
||||
package appeng.client.gui.widgets;
|
||||
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
public abstract class GuiCustomSlot extends Gui implements ITooltip
|
||||
{
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int id;
|
||||
|
||||
public GuiCustomSlot( final int id, final int x, final int y )
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public boolean canClick( final EntityPlayer player )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void slotClicked( final ItemStack clickStack, final int mouseButton )
|
||||
{
|
||||
}
|
||||
|
||||
public abstract void drawContent( final Minecraft mc, final int mouseX, final int mouseY, final float partialTicks );
|
||||
|
||||
public void drawBackground( int guileft, int guitop )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int xPos()
|
||||
{
|
||||
return this.x;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yPos()
|
||||
{
|
||||
return this.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth()
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight()
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSlotEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,6 +43,7 @@ public class MEGuiTextField extends GuiTextField
|
||||
private final int _yPos;
|
||||
private final int _width;
|
||||
private final int _height;
|
||||
private final int _fontPad;
|
||||
private int selectionColor = 0xFF00FF00;
|
||||
|
||||
/**
|
||||
@@ -59,6 +60,7 @@ public class MEGuiTextField extends GuiTextField
|
||||
{
|
||||
super( 0, fontRenderer, xPos + PADDING, yPos + PADDING, width - 2 * PADDING - fontRenderer.getCharWidth( '_' ), height - 2 * PADDING );
|
||||
|
||||
this._fontPad = fontRenderer.getCharWidth( '_' );
|
||||
this._xPos = xPos;
|
||||
this._yPos = yPos;
|
||||
this._width = width;
|
||||
@@ -106,9 +108,33 @@ public class MEGuiTextField extends GuiTextField
|
||||
this.selectionColor = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTextBox()
|
||||
{
|
||||
if( this.getVisible() )
|
||||
{
|
||||
if( this.isFocused() )
|
||||
{
|
||||
drawRect( this.x - PADDING + 1, this.y - PADDING + 1, this.x + this.width + this._fontPad + PADDING - 1, this.y + this.height + PADDING - 1,
|
||||
0xFF606060 );
|
||||
}
|
||||
else
|
||||
{
|
||||
drawRect( this.x - PADDING + 1, this.y - PADDING + 1, this.x + this.width + this._fontPad + PADDING - 1, this.y + this.height + PADDING - 1,
|
||||
0xFFA8A8A8 );
|
||||
}
|
||||
super.drawTextBox();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSelectionBox( int startX, int startY, int endX, int endY )
|
||||
{
|
||||
if( !this.isFocused() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( startX < endX )
|
||||
{
|
||||
int i = startX;
|
||||
@@ -141,22 +167,23 @@ public class MEGuiTextField extends GuiTextField
|
||||
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;
|
||||
float red = ( this.selectionColor >> 16 & 255 ) / 255.0F;
|
||||
float blue = ( this.selectionColor >> 8 & 255 ) / 255.0F;
|
||||
float green = ( this.selectionColor & 255 ) / 255.0F;
|
||||
float alpha = ( 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();
|
||||
bufferbuilder.pos( startX, endY, 0.0D ).endVertex();
|
||||
bufferbuilder.pos( endX, endY, 0.0D ).endVertex();
|
||||
bufferbuilder.pos( endX, startY, 0.0D ).endVertex();
|
||||
bufferbuilder.pos( startX, startY, 0.0D ).endVertex();
|
||||
tessellator.draw();
|
||||
GlStateManager.disableColorLogic();
|
||||
GlStateManager.enableTexture2D();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import javax.annotation.Nonnull;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.ItemSorters;
|
||||
|
||||
|
||||
public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
|
||||
@@ -57,7 +56,7 @@ public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
|
||||
@Override
|
||||
public int compareTo( @Nonnull final ClientDCInternalInv o )
|
||||
{
|
||||
return ItemSorters.compareLong( this.sortBy, o.sortBy );
|
||||
return Long.compare( this.sortBy, o.sortBy );
|
||||
}
|
||||
|
||||
public AppEngInternalInventory getInventory()
|
||||
@@ -69,4 +68,4 @@ public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,243 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.me;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.widgets.IScrollSource;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.fluids.util.FluidSorters;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.prioritylist.IPartitionList;
|
||||
|
||||
|
||||
/**
|
||||
* @author BrockWS
|
||||
* @version rv6 - 22/05/2018
|
||||
* @since rv6 22/05/2018
|
||||
*/
|
||||
public class FluidRepo
|
||||
{
|
||||
private final IItemList<IAEFluidStack> list = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createList();
|
||||
private final ArrayList<IAEFluidStack> view = new ArrayList<>();
|
||||
private final IScrollSource src;
|
||||
private final ISortSource sortSrc;
|
||||
|
||||
private int rowSize = 9;
|
||||
|
||||
private String searchString = "";
|
||||
private IPartitionList<IAEFluidStack> myPartitionList;
|
||||
private boolean hasPower;
|
||||
|
||||
public FluidRepo( final IScrollSource src, final ISortSource sortSrc )
|
||||
{
|
||||
this.src = src;
|
||||
this.sortSrc = sortSrc;
|
||||
}
|
||||
|
||||
public void updateView()
|
||||
{
|
||||
this.view.clear();
|
||||
|
||||
this.view.ensureCapacity( this.list.size() );
|
||||
|
||||
String innerSearch = this.searchString;
|
||||
|
||||
boolean searchMod = false;
|
||||
if( innerSearch.startsWith( "@" ) )
|
||||
{
|
||||
searchMod = true;
|
||||
innerSearch = innerSearch.substring( 1 );
|
||||
}
|
||||
|
||||
Pattern m;
|
||||
try
|
||||
{
|
||||
m = Pattern.compile( innerSearch.toLowerCase(), Pattern.CASE_INSENSITIVE );
|
||||
}
|
||||
catch( final Exception ignore1 )
|
||||
{
|
||||
try
|
||||
{
|
||||
m = Pattern.compile( Pattern.quote( innerSearch.toLowerCase() ), Pattern.CASE_INSENSITIVE );
|
||||
}
|
||||
catch( final Exception ignore2 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final Enum viewMode = this.sortSrc.getSortDisplay();
|
||||
final boolean needsZeroCopy = viewMode == ViewItems.CRAFTABLE;
|
||||
final boolean terminalSearchToolTips = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_TOOLTIPS ) != YesNo.NO;
|
||||
|
||||
boolean notDone = false;
|
||||
for( IAEFluidStack fs : this.list )
|
||||
{
|
||||
if( this.myPartitionList != null && !this.myPartitionList.isListed( fs ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( viewMode == ViewItems.CRAFTABLE && !fs.isCraftable() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( viewMode == ViewItems.STORED && fs.getStackSize() == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final String dspName = searchMod ? Platform.getModId( fs ) : Platform.getFluidDisplayName( fs );
|
||||
boolean foundMatchingFluidStack = false;
|
||||
notDone = true;
|
||||
|
||||
if( m.matcher( dspName.toLowerCase() ).find() )
|
||||
{
|
||||
notDone = false;
|
||||
foundMatchingFluidStack = true;
|
||||
}
|
||||
|
||||
if( terminalSearchToolTips && notDone && !searchMod )
|
||||
{
|
||||
final List<String> tooltip = Platform.getTooltip( fs );
|
||||
|
||||
for( final String line : tooltip )
|
||||
{
|
||||
if( m.matcher( line ).find() )
|
||||
{
|
||||
foundMatchingFluidStack = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( foundMatchingFluidStack )
|
||||
{
|
||||
if( needsZeroCopy )
|
||||
{
|
||||
fs = fs.copy();
|
||||
fs.setStackSize( 0 );
|
||||
}
|
||||
|
||||
this.view.add( fs );
|
||||
}
|
||||
}
|
||||
|
||||
final Enum sortBy = this.sortSrc.getSortBy();
|
||||
final Enum sortDir = this.sortSrc.getSortDir();
|
||||
|
||||
FluidSorters.setDirection( (appeng.api.config.SortDir) sortDir );
|
||||
|
||||
if( sortBy == SortOrder.MOD )
|
||||
{
|
||||
Collections.sort( this.view, FluidSorters.CONFIG_BASED_SORT_BY_MOD );
|
||||
}
|
||||
else if( sortBy == SortOrder.AMOUNT )
|
||||
{
|
||||
Collections.sort( this.view, FluidSorters.CONFIG_BASED_SORT_BY_SIZE );
|
||||
}
|
||||
else
|
||||
{
|
||||
Collections.sort( this.view, FluidSorters.CONFIG_BASED_SORT_BY_NAME );
|
||||
}
|
||||
}
|
||||
|
||||
public void postUpdate( final IAEFluidStack is )
|
||||
{
|
||||
final IAEFluidStack st = this.list.findPrecise( is );
|
||||
|
||||
if( st != null )
|
||||
{
|
||||
st.reset();
|
||||
st.add( is );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.list.add( is );
|
||||
}
|
||||
}
|
||||
|
||||
public IAEFluidStack getReferenceFluid( int idx )
|
||||
{
|
||||
idx += this.src.getCurrentScroll() * this.rowSize;
|
||||
|
||||
if( idx >= this.view.size() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return this.view.get( idx );
|
||||
}
|
||||
|
||||
public int size()
|
||||
{
|
||||
return this.view.size();
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
this.list.resetStatus();
|
||||
}
|
||||
|
||||
public boolean hasPower()
|
||||
{
|
||||
return this.hasPower;
|
||||
}
|
||||
|
||||
public void setPower( final boolean hasPower )
|
||||
{
|
||||
this.hasPower = hasPower;
|
||||
}
|
||||
|
||||
public int getRowSize()
|
||||
{
|
||||
return this.rowSize;
|
||||
}
|
||||
|
||||
public void setRowSize( final int rowSize )
|
||||
{
|
||||
this.rowSize = rowSize;
|
||||
}
|
||||
|
||||
public String getSearchString()
|
||||
{
|
||||
return this.searchString;
|
||||
}
|
||||
|
||||
public void setSearchString( @Nonnull final String searchString )
|
||||
{
|
||||
this.searchString = searchString;
|
||||
}
|
||||
}
|
||||
+34
-19
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -16,35 +16,50 @@
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.recipes;
|
||||
package appeng.client.me;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
|
||||
|
||||
/**
|
||||
* @author thatsIch
|
||||
* @version rv3 - 23.08.2015
|
||||
* @since rv3 23.08.2015
|
||||
* @author BrockWS
|
||||
* @version rv6 - 22/05/2018
|
||||
* @since rv6 22/05/2018
|
||||
*/
|
||||
public class CustomRecipeForgeConfiguration implements CustomRecipeConfig
|
||||
public class InternalFluidSlotME
|
||||
{
|
||||
private final boolean isEnabled;
|
||||
|
||||
public CustomRecipeForgeConfiguration( @Nonnull final Configuration config )
|
||||
private final int offset;
|
||||
private final int xPos;
|
||||
private final int yPos;
|
||||
private final FluidRepo repo;
|
||||
|
||||
public InternalFluidSlotME( final FluidRepo def, final int offset, final int displayX, final int displayY )
|
||||
{
|
||||
Preconditions.checkNotNull( config );
|
||||
|
||||
this.isEnabled = config.getBoolean( "enabled", "general", true, "If true, the custom recipes are enabled. Acts as a master switch." );
|
||||
this.repo = def;
|
||||
this.offset = offset;
|
||||
this.xPos = displayX;
|
||||
this.yPos = displayY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isEnabled()
|
||||
IAEFluidStack getAEStack()
|
||||
{
|
||||
return this.isEnabled;
|
||||
return this.repo.getReferenceFluid( this.offset );
|
||||
}
|
||||
|
||||
boolean hasPower()
|
||||
{
|
||||
return this.repo.hasPower();
|
||||
}
|
||||
|
||||
int getxPosition()
|
||||
{
|
||||
return this.xPos;
|
||||
}
|
||||
|
||||
int getyPosition()
|
||||
{
|
||||
return this.yPos;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ package appeng.client.me;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -112,6 +113,8 @@ public class ItemRepo
|
||||
|
||||
final Enum viewMode = this.sortSrc.getSortDisplay();
|
||||
final Enum searchMode = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
||||
final boolean needsZeroCopy = viewMode == ViewItems.CRAFTABLE;
|
||||
|
||||
if( searchMode == SearchBoxMode.JEI_AUTOSEARCH || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH || searchMode == SearchBoxMode.JEI_AUTOSEARCH_KEEP || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH_KEEP )
|
||||
{
|
||||
this.updateJEI( this.searchString );
|
||||
@@ -160,43 +163,46 @@ public class ItemRepo
|
||||
continue;
|
||||
}
|
||||
|
||||
if( viewMode == ViewItems.CRAFTABLE )
|
||||
{
|
||||
is = is.copy();
|
||||
is.setStackSize( 0 );
|
||||
}
|
||||
|
||||
if( viewMode == ViewItems.STORED && is.getStackSize() == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final String dspName = searchMod ? Platform.getModId( is ) : Platform.getItemDisplayName( is );
|
||||
boolean foundMatchingItemStack = false;
|
||||
notDone = true;
|
||||
|
||||
if( m.matcher( dspName.toLowerCase() ).find() )
|
||||
{
|
||||
this.view.add( is );
|
||||
notDone = false;
|
||||
foundMatchingItemStack = true;
|
||||
}
|
||||
|
||||
if( terminalSearchToolTips && notDone && !searchMod )
|
||||
{
|
||||
for( final Object lp : Platform.getTooltip( is ) )
|
||||
final List<String> tooltip = Platform.getTooltip( is );
|
||||
|
||||
for( final String line : tooltip )
|
||||
{
|
||||
if( lp instanceof String && m.matcher( (CharSequence) lp ).find() )
|
||||
if( m.matcher( line ).find() )
|
||||
{
|
||||
this.view.add( is );
|
||||
foundMatchingItemStack = true;
|
||||
notDone = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* if ( terminalSearchMods && notDone ) { if ( m.matcher( Platform.getMod( is.getItemStack() ) ).find() ) {
|
||||
* view.add( is ); notDone = false; } }
|
||||
*/
|
||||
if( foundMatchingItemStack )
|
||||
{
|
||||
if( needsZeroCopy )
|
||||
{
|
||||
is = is.copy();
|
||||
is.setStackSize( 0 );
|
||||
}
|
||||
|
||||
this.view.add( is );
|
||||
}
|
||||
}
|
||||
|
||||
final Enum SortBy = this.sortSrc.getSortBy();
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.me;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.fluids.container.slots.IMEFluidSlot;
|
||||
|
||||
|
||||
/**
|
||||
* @author BrockWS
|
||||
* @version rv6 - 22/05/2018
|
||||
* @since rv6 22/05/2018
|
||||
*/
|
||||
public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot
|
||||
{
|
||||
|
||||
private InternalFluidSlotME slot;
|
||||
|
||||
public SlotFluidME( InternalFluidSlotME slot )
|
||||
{
|
||||
super( null, 0, slot.getxPosition(), slot.getyPosition() );
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack getAEFluidStack()
|
||||
{
|
||||
if( this.slot.hasPower() )
|
||||
{
|
||||
return this.slot.getAEStack();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid( final ItemStack par1ItemStack )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getStack()
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasStack()
|
||||
{
|
||||
if( this.slot.hasPower() )
|
||||
{
|
||||
return this.getAEFluidStack() != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStack( final ItemStack par1ItemStack )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack decrStackSize( final int par1 )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHere( final IInventory inv, final int slotIn )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack( final EntityPlayer par1EntityPlayer )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user