mirror of
https://github.com/GTNewHorizons/WirelessCraftingTerminal.git
synced 2026-11-26 06:42:55 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27759a5343 | ||
|
|
4c9e6da515 | ||
|
|
f36cba7094 |
No files matched your search
@@ -1,2 +0,0 @@
|
|||||||
# Ignore spotlessApply reformat
|
|
||||||
d8da552c3601fc920acd7afce95f391ffef74140
|
|
||||||
+27
-36
@@ -1,44 +1,35 @@
|
|||||||
* text eol=lf
|
* text eol=lf
|
||||||
|
|
||||||
*.[jJ][aA][rR] binary
|
*.jar binary
|
||||||
|
|
||||||
*.[pP][nN][gG] binary
|
*.png binary
|
||||||
*.[jJ][pP][gG] binary
|
*.jpg binary
|
||||||
*.[jJ][pP][eE][gG] binary
|
*.jpeg binary
|
||||||
*.[gG][iI][fF] binary
|
*.gif binary
|
||||||
*.[tT][iI][fF] binary
|
*.tif binary
|
||||||
*.[tT][iI][fF][fF] binary
|
*.tiff binary
|
||||||
*.[iI][cC][oO] binary
|
*.ico binary
|
||||||
*.[sS][vV][gG] text
|
*.svg text
|
||||||
*.[eE][pP][sS] binary
|
*.eps binary
|
||||||
*.[xX][cC][fF] binary
|
|
||||||
|
|
||||||
*.[kK][aA][rR] binary
|
*.kar binary
|
||||||
*.[mM]4[aA] binary
|
*.m4a binary
|
||||||
*.[mM][iI][dD] binary
|
*.mid binary
|
||||||
*.[mM][iI][dD][iI] binary
|
*.midi binary
|
||||||
*.[mM][pP]3 binary
|
*.mp3 binary
|
||||||
*.[oO][gG][gG] binary
|
*.ogg binary
|
||||||
*.[rR][aA] binary
|
*.ra binary
|
||||||
|
|
||||||
*.7[zZ] binary
|
*.7z binary
|
||||||
*.[gG][zZ] binary
|
*.gz binary
|
||||||
*.[tT][aA][rR] binary
|
*.tar binary
|
||||||
*.[tT][gG][zZ] binary
|
*.tgz binary
|
||||||
*.[zZ][iI][pP] binary
|
*.zip binary
|
||||||
|
|
||||||
*.[tT][cC][nN] binary
|
*.patch -text
|
||||||
*.[sS][oO] binary
|
|
||||||
*.[dD][lL][lL] binary
|
|
||||||
*.[dD][yY][lL][iI][bB] binary
|
|
||||||
*.[pP][sS][dD] binary
|
|
||||||
*.[tT][tT][fF] binary
|
|
||||||
*.[oO][tT][fF] binary
|
|
||||||
|
|
||||||
*.[pP][aA][tT][cC][hH] -text
|
*.bat text eol=crlf
|
||||||
|
*.cmd text eol=crlf
|
||||||
|
*.ps1 text eol=crlf
|
||||||
|
|
||||||
*.[bB][aA][tT] text eol=crlf
|
*autogenerated binary
|
||||||
*.[cC][mM][dD] text eol=crlf
|
|
||||||
*.[pP][sS]1 text eol=crlf
|
|
||||||
|
|
||||||
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
|
|
||||||
Executable
+51
@@ -0,0 +1,51 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# bashsupport disable=BP5006 # Global environment variables
|
||||||
|
RUNDIR="run" \
|
||||||
|
CRASH="crash-reports" \
|
||||||
|
SERVERLOG="server.log"
|
||||||
|
|
||||||
|
# enable nullglob to get 0 results when no match rather than the pattern
|
||||||
|
shopt -s nullglob
|
||||||
|
|
||||||
|
# store matches in array
|
||||||
|
crash_reports=("$RUNDIR/$CRASH/crash"*.txt)
|
||||||
|
|
||||||
|
# if array not empty there are crash_reports
|
||||||
|
if [ "${#crash_reports[@]}" -gt 0 ]; then
|
||||||
|
# get the latest crash_report from array
|
||||||
|
latest_crash_report="${crash_reports[-1]}"
|
||||||
|
{
|
||||||
|
printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}"
|
||||||
|
cat "$latest_crash_report"
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then
|
||||||
|
{
|
||||||
|
printf 'Fatal errors detected:\n'
|
||||||
|
cat server.log
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' \
|
||||||
|
"$SERVERLOG"; then
|
||||||
|
{
|
||||||
|
printf 'Server force stopped:'
|
||||||
|
cat server.log
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep --quiet --perl-regexp --only-matching '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then
|
||||||
|
{
|
||||||
|
printf 'Server did not finish startup:'
|
||||||
|
cat server.log
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf 'No crash reports detected'
|
||||||
|
exit 0
|
||||||
@@ -3,9 +3,9 @@ name: Build and test
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master, main, release/** ]
|
branches: [ master, main ]
|
||||||
push:
|
push:
|
||||||
branches: [ master, main, release/** ]
|
branches: [ master, main ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-test:
|
build-and-test:
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
name: Optimize images
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches: [ master, main, release/** ]
|
|
||||||
paths:
|
|
||||||
- "**/*.png"
|
|
||||||
|
|
||||||
push:
|
|
||||||
branches: [ master, main, release/** ]
|
|
||||||
paths:
|
|
||||||
- "**/*.png"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
optimize-images:
|
|
||||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
|
|
||||||
secrets: inherit
|
|
||||||
+1093
-3
File diff suppressed because it is too large.
Load diff
+7
-7
@@ -1,11 +1,11 @@
|
|||||||
// Add your dependencies here
|
// Add your dependencies here
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-999-GTNH:dev")
|
compile("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-99-GTNH:dev")
|
||||||
|
compile("com.github.GTNewHorizons:Baubles:1.0.1.14:dev")
|
||||||
implementation("com.github.GTNewHorizons:Baubles-Expanded:2.2.11-GTNH:dev")
|
compile("curse.maven:cofh-core-69162:2388751")
|
||||||
implementation("com.github.GTNewHorizons:Baubles-Expanded:2.2.11-GTNH:dev")
|
compile("com.github.GTNewHorizons:NotEnoughItems:2.2.27-GTNH:dev")
|
||||||
compileOnly("curse.maven:cofh-core-69162:2388751")
|
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.4:dev")
|
||||||
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.8.91-GTNH:dev")
|
compileOnly("com.github.GTNewHorizons:MouseTweaks:2.4.5-GTNH:dev") { transitive = false }
|
||||||
compileOnly("com.github.GTNewHorizons:EnderIO:2.10.23:dev") { transitive = false }
|
compileOnly("com.github.GTNewHorizons:EnderIO:2.3.1.43:dev") { transitive = false }
|
||||||
}
|
}
|
||||||
+25
-199
@@ -1,238 +1,64 @@
|
|||||||
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
|
|
||||||
# LOCAL to test local config updates.
|
|
||||||
gtnh.settings.blowdryerTag = 0.2.0
|
|
||||||
|
|
||||||
# Human-readable mod name, available for mcmod.info population.
|
|
||||||
modName = AE2 Wireless Crafting Terminal
|
modName = AE2 Wireless Crafting Terminal
|
||||||
|
|
||||||
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||||
# Conventionally lowercase.
|
|
||||||
modId = ae2wct
|
modId = ae2wct
|
||||||
|
|
||||||
# Root package of the mod, used to find various classes in other properties,
|
|
||||||
# mcmod.info substitution, enabling assertions in run tasks, etc.
|
|
||||||
modGroup = net.p455w0rd.wirelesscraftingterminal
|
modGroup = net.p455w0rd.wirelesscraftingterminal
|
||||||
|
|
||||||
# Whether to use modGroup as the maven publishing group.
|
# WHY is there no version field?
|
||||||
# When false, com.github.GTNewHorizons is used.
|
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
||||||
useModGroupForPublishing = false
|
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
||||||
|
|
||||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
# Will update your build.gradle automatically whenever an update is available
|
||||||
autoUpdateBuildScript = false
|
autoUpdateBuildScript = false
|
||||||
|
|
||||||
# Version of Minecraft to target
|
|
||||||
minecraftVersion = 1.7.10
|
minecraftVersion = 1.7.10
|
||||||
|
|
||||||
# Version of Minecraft Forge to target
|
|
||||||
forgeVersion = 10.13.4.1614
|
forgeVersion = 10.13.4.1614
|
||||||
|
|
||||||
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
|
# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you
|
||||||
channel = stable
|
# restart Minecraft in development. Choose this dependent on your mod:
|
||||||
|
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
||||||
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
|
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
||||||
mappingsVersion = 12
|
|
||||||
|
|
||||||
# Defines other MCP mappings for dependency deobfuscation.
|
|
||||||
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
|
||||||
|
|
||||||
# Select a default username for testing your mod. You can always override this per-run by running
|
|
||||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
|
||||||
developmentEnvironmentUserName = Developer
|
developmentEnvironmentUserName = Developer
|
||||||
|
|
||||||
# Enables modern Java syntax support. Valid values:
|
# Define a source file of your project with:
|
||||||
# - false: No modern syntax, Java 8 only
|
|
||||||
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
|
||||||
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
|
||||||
# - modern: Native modern Java bytecode, no downgrading
|
|
||||||
enableModernJavaSyntax = jabel
|
|
||||||
|
|
||||||
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
|
||||||
# and should *not* be used in most situations. -1 disables this.
|
|
||||||
# forceToolchainVersion = -1
|
|
||||||
|
|
||||||
# Target JVM version for JVM Downgrader bytecode downgrading.
|
|
||||||
# Only used when enableModernJavaSyntax = jvmDowngrader
|
|
||||||
# downgradeTargetVersion = 8
|
|
||||||
|
|
||||||
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
|
||||||
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
|
||||||
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
|
||||||
# jvmDowngraderMultiReleaseVersions = 21,25
|
|
||||||
|
|
||||||
# Specifies how JVM Downgrader API stubs are provided. Options:
|
|
||||||
# - shade: Shade minimized stubs into the jar
|
|
||||||
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
|
||||||
# - external: Another dependency provides stubs (no constraint, no warning)
|
|
||||||
# - (empty): Warning reminding you to configure stubs
|
|
||||||
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
|
||||||
# jvmDowngraderStubsProvider =
|
|
||||||
|
|
||||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
|
||||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
|
||||||
enableGenericInjection = false
|
|
||||||
|
|
||||||
# Generate a class with a String field for the mod version named as defined below.
|
|
||||||
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
|
||||||
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
|
|
||||||
generateGradleTokenClass =
|
|
||||||
|
|
||||||
# Name of the token containing the project's current version to generate/replace.
|
|
||||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
|
||||||
|
|
||||||
# [DEPRECATED] Mod ID replacement token.
|
|
||||||
gradleTokenModId =
|
|
||||||
|
|
||||||
# [DEPRECATED] Mod name replacement token.
|
|
||||||
gradleTokenModName =
|
|
||||||
|
|
||||||
# [DEPRECATED] Mod Group replacement token.
|
|
||||||
gradleTokenGroupName =
|
|
||||||
|
|
||||||
# [DEPRECATED]
|
|
||||||
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
|
||||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||||
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's
|
||||||
# version in @Mod([...], version = VERSION, [...]).
|
# version in @Mod([...], version = VERSION, [...])
|
||||||
# Leave these properties empty to skip individual token replacements.
|
# Leave these properties empty to skip individual token replacements
|
||||||
replaceGradleTokenInFile = Reference.java
|
replaceGradleTokenInFile = Reference.java
|
||||||
|
gradleTokenModId =
|
||||||
|
gradleTokenModName =
|
||||||
|
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||||
|
gradleTokenGroupName =
|
||||||
|
|
||||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||||
# leave this property empty.
|
# leave this property empty.
|
||||||
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
|
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
||||||
apiPackage = api
|
apiPackage = api
|
||||||
|
|
||||||
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
|
||||||
# There can be multiple files in a space-separated list.
|
# Example value: mymodid_at.cfg
|
||||||
# Example value: mymodid_at.cfg nei_at.cfg
|
|
||||||
accessTransformersFile =
|
accessTransformersFile =
|
||||||
|
|
||||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||||
usesMixins = false
|
usesMixins = false
|
||||||
|
|
||||||
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
|
|
||||||
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
|
|
||||||
# Mixin classes will have access to "main" classes, but not the other way around.
|
|
||||||
separateMixinSourceSet =
|
|
||||||
|
|
||||||
# Adds some debug arguments like verbose output and class export.
|
|
||||||
usesMixinDebug = false
|
|
||||||
|
|
||||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||||
mixinPlugin =
|
mixinPlugin =
|
||||||
|
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||||
# Specify the package that contains all of your Mixins. The package must exist or
|
|
||||||
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
|
|
||||||
# it must match with this or the build will fail.
|
|
||||||
mixinsPackage =
|
mixinsPackage =
|
||||||
|
|
||||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||||
# This parameter is for legacy compatibility only
|
# This parameter is for legacy compatibility only
|
||||||
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
||||||
coreModClass =
|
coreModClass =
|
||||||
|
|
||||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||||
containsMixinsAndOrCoreModOnly = false
|
containsMixinsAndOrCoreModOnly = false
|
||||||
|
|
||||||
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
|
||||||
forceEnableMixins = false
|
# responsibility check the licence and request permission for distribution, if required.
|
||||||
|
|
||||||
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
|
|
||||||
# responsibility to check the license and request permission for distribution if required.
|
|
||||||
usesShadowedDependencies = false
|
usesShadowedDependencies = false
|
||||||
|
|
||||||
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
|
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
|
||||||
# their own classes, making the minimization unreliable.
|
|
||||||
minimizeShadowedDependencies = true
|
|
||||||
|
|
||||||
# If disabled, won't rename the shadowed classes.
|
|
||||||
relocateShadowedDependencies = true
|
|
||||||
|
|
||||||
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
|
||||||
includeWellKnownRepositories = true
|
|
||||||
|
|
||||||
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
|
|
||||||
# list of strings, with the acceptable keys being(case does not matter):
|
|
||||||
# cursemaven
|
|
||||||
# modrinth
|
|
||||||
excludeWellKnownRepositories =
|
|
||||||
|
|
||||||
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
|
||||||
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
|
||||||
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
|
||||||
usesMavenPublishing = true
|
|
||||||
|
|
||||||
# Maven repository to publish the mod to.
|
|
||||||
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
|
|
||||||
|
|
||||||
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
|
||||||
#
|
|
||||||
# The project's ID on Modrinth. Can be either the slug or the ID.
|
|
||||||
# Leave this empty if you don't want to publish to Modrinth.
|
|
||||||
modrinthProjectId =
|
|
||||||
|
|
||||||
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
|
||||||
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
|
||||||
# Where scope can be one of [required, optional, incompatible, embedded],
|
|
||||||
# type can be one of [project, version],
|
|
||||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
|
||||||
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
|
||||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
|
||||||
modrinthRelations =
|
|
||||||
|
|
||||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
|
||||||
#
|
|
||||||
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
|
||||||
# Leave this empty if you don't want to publish on CurseForge.
|
|
||||||
curseForgeProjectId =
|
|
||||||
|
|
||||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
|
||||||
# Syntax: type1:name1;type2:name2;...
|
|
||||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
|
||||||
# and the name is the CurseForge project slug of the other mod.
|
|
||||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
|
||||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
|
||||||
curseForgeRelations =
|
|
||||||
|
|
||||||
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
|
||||||
# projects. New projects should not use this parameter.
|
# projects. New projects should not use this parameter.
|
||||||
customArchiveBaseName = WirelessCraftingTerminal
|
customArchiveBaseName = WirelessCraftingTerminal
|
||||||
|
|
||||||
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
|
|
||||||
# runClientWorkingDirectory = run/client
|
|
||||||
|
|
||||||
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
|
|
||||||
# runServerWorkingDirectory = run/server
|
|
||||||
|
|
||||||
# Optional parameter to have the build automatically fail if an illegal version is used.
|
|
||||||
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
|
||||||
# The check is ONLY performed if the version is a git tag.
|
|
||||||
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
|
|
||||||
# versionPattern =
|
|
||||||
|
|
||||||
# Uncomment to prevent the source code from being published.
|
|
||||||
# noPublishedSources = true
|
|
||||||
|
|
||||||
# Uncomment this to disable Spotless checks.
|
|
||||||
# This should only be uncommented to keep it easier to sync with upstream/other forks.
|
|
||||||
# That is, if there is no other active fork/upstream, NEVER change this.
|
|
||||||
# disableSpotless = true
|
|
||||||
|
|
||||||
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
|
|
||||||
# disableCheckstyle = true
|
|
||||||
|
|
||||||
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
|
|
||||||
# (force use delegated build).
|
|
||||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
|
||||||
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
|
|
||||||
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
|
|
||||||
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
|
|
||||||
# ideaOverrideBuildType = idea
|
|
||||||
|
|
||||||
# Whether IDEA should run spotless checks when pressing the Build button.
|
|
||||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
|
||||||
# ideaCheckSpotlessOnBuild = true
|
|
||||||
|
|
||||||
# Non-GTNH properties
|
|
||||||
org.gradle.configuration-cache = true
|
|
||||||
org.gradle.parallel = true
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#This file is generated by updateDaemonJvm
|
|
||||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
|
||||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
|
||||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
|
||||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
|
||||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/d4fd992c9557644e637ebe98263e0ae7/redirect
|
|
||||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/faa12903720d410b387cc69ccafb1a74/redirect
|
|
||||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
|
||||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
|
||||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a4c09dd2e2d7079373d30e524bbc2829/redirect
|
|
||||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/8e1d9ee5d0f13e442218f6884a306da1/redirect
|
|
||||||
toolchainVersion=25
|
|
||||||
Vendored
BIN
Binary file not shown.
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
|
||||||
networkTimeout=10000
|
|
||||||
validateDistributionUrl=true
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright © 2015 the original authors.
|
# Copyright 2015 the original author or authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -15,114 +15,80 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
##
|
||||||
# Gradle start up script for POSIX generated by Gradle.
|
## Gradle start up script for UN*X
|
||||||
#
|
##
|
||||||
# Important for running:
|
|
||||||
#
|
|
||||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
|
||||||
# noncompliant, but you have some other compliant shell such as ksh or
|
|
||||||
# bash, then to run this script, type that shell name before the whole
|
|
||||||
# command line, like:
|
|
||||||
#
|
|
||||||
# ksh Gradle
|
|
||||||
#
|
|
||||||
# Busybox and similar reduced shells will NOT work, because this script
|
|
||||||
# requires all of these POSIX shell features:
|
|
||||||
# * functions;
|
|
||||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
|
||||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
|
||||||
# * compound commands having a testable exit status, especially «case»;
|
|
||||||
# * various built-in commands including «command», «set», and «ulimit».
|
|
||||||
#
|
|
||||||
# Important for patching:
|
|
||||||
#
|
|
||||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
|
||||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
|
||||||
#
|
|
||||||
# The "traditional" practice of packing multiple parameters into a
|
|
||||||
# space-separated string is a well documented source of bugs and security
|
|
||||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
|
||||||
# options in "$@", and eventually passing that to Java.
|
|
||||||
#
|
|
||||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
|
||||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
|
||||||
# see the in-line comments for details.
|
|
||||||
#
|
|
||||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
|
||||||
# Darwin, MinGW, and NonStop.
|
|
||||||
#
|
|
||||||
# (3) This script is generated from the Groovy template
|
|
||||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
|
||||||
# within the Gradle project.
|
|
||||||
#
|
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
|
||||||
#
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
app_path=$0
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
# Need this for daisy-chained symlinks.
|
while [ -h "$PRG" ] ; do
|
||||||
while
|
ls=`ls -ld "$PRG"`
|
||||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
[ -h "$app_path" ]
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
do
|
PRG="$link"
|
||||||
ls=$( ls -ld "$app_path" )
|
else
|
||||||
link=${ls#*' -> '}
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
case $link in #(
|
fi
|
||||||
/*) app_path=$link ;; #(
|
|
||||||
*) app_path=$APP_HOME$link ;;
|
|
||||||
esac
|
|
||||||
done
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
# This is normally unused
|
APP_NAME="Gradle"
|
||||||
# shellcheck disable=SC2034
|
APP_BASE_NAME=`basename "$0"`
|
||||||
APP_BASE_NAME=${0##*/}
|
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD="maximum"
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
} >&2
|
}
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
} >&2
|
}
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "$( uname )" in #(
|
case "`uname`" in
|
||||||
CYGWIN* ) cygwin=true ;; #(
|
CYGWIN* )
|
||||||
Darwin* ) darwin=true ;; #(
|
cygwin=true
|
||||||
MSYS* | MINGW* ) msys=true ;; #(
|
;;
|
||||||
NONSTOP* ) nonstop=true ;;
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
else
|
else
|
||||||
JAVACMD=$JAVA_HOME/bin/java
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
@@ -131,118 +97,92 @@ Please set the JAVA_HOME variable in your environment to match the
|
|||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
JAVACMD="java"
|
||||||
if ! command -v java >/dev/null 2>&1
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
then
|
|
||||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
case $MAX_FD in #(
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
max*)
|
if [ $? -eq 0 ] ; then
|
||||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
# shellcheck disable=SC2039,SC3045
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
fi
|
||||||
warn "Could not query maximum file descriptor limit"
|
ulimit -n $MAX_FD
|
||||||
esac
|
if [ $? -ne 0 ] ; then
|
||||||
case $MAX_FD in #(
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
'' | soft) :;; #(
|
fi
|
||||||
*)
|
else
|
||||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
# shellcheck disable=SC2039,SC3045
|
fi
|
||||||
ulimit -n "$MAX_FD" ||
|
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
|
||||||
esac
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Collect all arguments for the java command, stacking in reverse order:
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
# * args from the command line
|
if $darwin; then
|
||||||
# * the main class name
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
# * -classpath
|
fi
|
||||||
# * -D...appname settings
|
|
||||||
# * --module-path (only if needed)
|
|
||||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if "$cygwin" || "$msys" ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
SEP=""
|
||||||
for arg do
|
for dir in $ROOTDIRSRAW ; do
|
||||||
if
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
case $arg in #(
|
SEP="|"
|
||||||
-*) false ;; # don't mess with options #(
|
|
||||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
|
||||||
[ -e "$t" ] ;; #(
|
|
||||||
*) false ;;
|
|
||||||
esac
|
|
||||||
then
|
|
||||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
|
||||||
fi
|
|
||||||
# Roll the args list around exactly as many times as the number of
|
|
||||||
# args, so each arg winds up back in the position where it started, but
|
|
||||||
# possibly modified.
|
|
||||||
#
|
|
||||||
# NB: a `for` loop captures its iteration list before it begins, so
|
|
||||||
# changing the positional parameters here affects neither the number of
|
|
||||||
# iterations, nor the values presented in `arg`.
|
|
||||||
shift # remove old arg
|
|
||||||
set -- "$@" "$arg" # push replacement arg
|
|
||||||
done
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=$(save "$@")
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
# Collect all arguments for the java command:
|
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||||
# and any embedded shellness will be escaped.
|
cd "$(dirname "$0")"
|
||||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
|
||||||
# treated as '${Hostname}' itself on the command line.
|
|
||||||
|
|
||||||
set -- \
|
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
|
||||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
|
||||||
"$@"
|
|
||||||
|
|
||||||
# Stop when "xargs" is not available.
|
|
||||||
if ! command -v xargs >/dev/null 2>&1
|
|
||||||
then
|
|
||||||
die "xargs is not available"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
|
||||||
#
|
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
|
||||||
#
|
|
||||||
# In Bash we could simply go:
|
|
||||||
#
|
|
||||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
|
||||||
# set -- "${ARGS[@]}" "$@"
|
|
||||||
#
|
|
||||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
|
||||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
|
||||||
# character that might be a shell metacharacter, then use eval to reverse
|
|
||||||
# that process (while maintaining the separation between arguments), and wrap
|
|
||||||
# the whole thing up as a single "set" statement.
|
|
||||||
#
|
|
||||||
# This will of course break if any of these variables contains a newline or
|
|
||||||
# an unmatched quote.
|
|
||||||
#
|
|
||||||
|
|
||||||
eval "set -- $(
|
|
||||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
|
||||||
xargs -n1 |
|
|
||||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
|
||||||
tr '\n' ' '
|
|
||||||
)" '"$@"'
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
Vendored
+34
-27
@@ -13,10 +13,8 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
@rem SPDX-License-Identifier: Apache-2.0
|
|
||||||
@rem
|
|
||||||
|
|
||||||
@if "%DEBUG%"=="" @echo off
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -27,14 +25,10 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%"=="" set DIRNAME=.
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
@rem This is normally unused
|
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
|
||||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@@ -43,13 +37,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if %ERRORLEVEL% equ 0 goto execute
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
echo. 1>&2
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
echo. 1>&2
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation. 1>&2
|
echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
@@ -57,35 +51,48 @@ goto fail
|
|||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
echo. 1>&2
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
echo. 1>&2
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation. 1>&2
|
echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windows variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
set EXIT_CODE=%ERRORLEVEL%
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
exit /b 1
|
||||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
|
||||||
exit /b %EXIT_CODE%
|
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|||||||
+10
-1
@@ -1,5 +1,14 @@
|
|||||||
// Add any additional repositories for your dependencies here
|
// Add any additional repositories for your dependencies here
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
maven {
|
||||||
|
name = "GTNH Maven"
|
||||||
|
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url "https://cursemaven.com"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url = "https://jitpack.io"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+6
-19
@@ -1,23 +1,10 @@
|
|||||||
|
|
||||||
pluginManagement {
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
// RetroFuturaGradle
|
|
||||||
name "GTNH Maven"
|
|
||||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
|
||||||
mavenContent {
|
|
||||||
includeGroup("com.gtnewhorizons")
|
|
||||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gradlePluginPortal()
|
|
||||||
mavenCentral()
|
|
||||||
mavenLocal()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.24'
|
id 'com.diffplug.blowdryerSetup' version '1.6.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply plugin: 'com.diffplug.blowdryerSetup'
|
||||||
|
|
||||||
|
blowdryerSetup {
|
||||||
|
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.5')
|
||||||
|
//devLocal '.' // Use this when testing config updates locally
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.api;
|
package net.p455w0rd.wirelesscraftingterminal.api;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
public interface IWCTInteractionHelper {
|
public interface IWCTInteractionHelper {
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.api;
|
package net.p455w0rd.wirelesscraftingterminal.api;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public interface IWCTItemDescription {
|
public interface IWCTItemDescription {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the damage, or meta, value of the item.
|
* Gets the damage, or meta, value of the item.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package net.p455w0rd.wirelesscraftingterminal.api;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public abstract class IWCTItems {
|
public abstract class IWCTItems {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WirelessCraftingTerminal
|
* WirelessCraftingTerminal
|
||||||
*/
|
*/
|
||||||
@@ -17,13 +16,16 @@ public abstract class IWCTItems {
|
|||||||
public IWCTItemDescription InfinityBoosterCard;
|
public IWCTItemDescription InfinityBoosterCard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for the creat6ive tab TODO: remove unneeded item and just add the icon properly
|
* Used for the creat6ive tab
|
||||||
|
* TODO: remove unneeded item and just
|
||||||
|
* add the icon properly
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public IWCTItemDescription WCTDummyIcon;
|
public IWCTItemDescription WCTDummyIcon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Item used solely for infinity booster card slot background icon
|
* Item used solely for infinity booster
|
||||||
|
* card slot background icon
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public IWCTItemDescription WCTBoosterBGIcon;
|
public IWCTItemDescription WCTBoosterBGIcon;
|
||||||
|
|||||||
+5
-6
@@ -1,21 +1,20 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.api;
|
package net.p455w0rd.wirelesscraftingterminal.api;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import appeng.api.features.IWirelessTermHandler;
|
import appeng.api.features.IWirelessTermHandler;
|
||||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the required functionality of a wireless terminal. Presumably this interface would be implemented on an
|
* Provides the required functionality of a wireless terminal.
|
||||||
* Item, but that is not a requirement.
|
* Presumably this interface would be implemented on an Item, but that is
|
||||||
|
* not a requirement.
|
||||||
*
|
*
|
||||||
* @author Nividica
|
* @author Nividica
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IWirelessCraftingTermHandler extends IWirelessTermHandler, IAEItemPowerStorage {
|
public interface IWirelessCraftingTermHandler extends IWirelessTermHandler, IAEItemPowerStorage {
|
||||||
|
|
||||||
// public interface IWirelessCraftingTermHandler extends INetworkEncodable, IAEItemPowerStorage {
|
// public interface IWirelessCraftingTermHandler extends INetworkEncodable, IAEItemPowerStorage {
|
||||||
/**
|
/**
|
||||||
* Gets the tag used to store the terminal data.
|
* Gets the tag used to store the terminal data.
|
||||||
|
|||||||
+1
-2
@@ -1,10 +1,9 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.api;
|
package net.p455w0rd.wirelesscraftingterminal.api;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||||
import appeng.core.features.IAEFeature;
|
import appeng.core.features.IAEFeature;
|
||||||
import cofh.api.energy.IEnergyContainerItem;
|
import cofh.api.energy.IEnergyContainerItem;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public interface IWirelessCraftingTerminalItem
|
public interface IWirelessCraftingTerminalItem
|
||||||
extends IWirelessCraftingTermHandler, IAEItemPowerStorage, IAEFeature, IEnergyContainerItem {
|
extends IWirelessCraftingTermHandler, IAEItemPowerStorage, IAEFeature, IEnergyContainerItem {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.api;
|
package net.p455w0rd.wirelesscraftingterminal.api;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@@ -9,15 +8,15 @@ public abstract class WCTApi {
|
|||||||
|
|
||||||
protected static WCTApi api = null;
|
protected static WCTApi api = null;
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
@Nullable
|
@Nullable
|
||||||
public static WCTApi instance() {
|
public static WCTApi instance() {
|
||||||
// Have we already retrieved the api?
|
// Have we already retrieved the api?
|
||||||
if (WCTApi.api == null) {
|
if (WCTApi.api == null) {
|
||||||
try {
|
try {
|
||||||
// Attempt to locate the API implementation
|
// Attempt to locate the API implementation
|
||||||
Class clazz = Class
|
Class clazz =
|
||||||
.forName("net.p455w0rd.wirelesscraftingterminal.implementation.WCTAPIImplementation");
|
Class.forName("net.p455w0rd.wirelesscraftingterminal.implementation.WCTAPIImplementation");
|
||||||
|
|
||||||
// Get the instance method
|
// Get the instance method
|
||||||
Method instanceAccessor = clazz.getMethod("instance");
|
Method instanceAccessor = clazz.getMethod("instance");
|
||||||
|
|||||||
+3
-4
@@ -1,10 +1,9 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.api.grid;
|
package net.p455w0rd.wirelesscraftingterminal.api.grid;
|
||||||
|
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.api.storage.ITerminalHost;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the requirements for a terminal that wishes to issue AE2 crafting jobs.
|
* Defines the requirements for a terminal that wishes to issue AE2 crafting jobs.
|
||||||
*
|
*
|
||||||
@@ -12,7 +11,6 @@ import appeng.api.storage.ITerminalHost;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface ICraftingIssuerHost extends ITerminalHost {
|
public interface ICraftingIssuerHost extends ITerminalHost {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the icon for this terminal.
|
* Gets the icon for this terminal.
|
||||||
*
|
*
|
||||||
@@ -21,7 +19,8 @@ public interface ICraftingIssuerHost extends ITerminalHost {
|
|||||||
ItemStack getIcon();
|
ItemStack getIcon();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launches the terminal's GUI. Used to return to the gui after crafting is confirmed or canceled.
|
* Launches the terminal's GUI.
|
||||||
|
* Used to return to the gui after crafting is confirmed or canceled.
|
||||||
*/
|
*/
|
||||||
void launchGUI(EntityPlayer player);
|
void launchGUI(EntityPlayer player);
|
||||||
}
|
}
|
||||||
-1
@@ -1,7 +1,6 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.api.gui;
|
package net.p455w0rd.wirelesscraftingterminal.api.gui;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.api.grid.ICraftingIssuerHost;
|
import net.p455w0rd.wirelesscraftingterminal.api.grid.ICraftingIssuerHost;
|
||||||
|
|
||||||
public interface ICraftingIssuerContainer {
|
public interface ICraftingIssuerContainer {
|
||||||
|
|||||||
+5
-3
@@ -6,10 +6,12 @@ import appeng.api.networking.IGridNode;
|
|||||||
public interface WCTIActionHost extends IGridHost {
|
public interface WCTIActionHost extends IGridHost {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to for calculating security rules, you must supply a node from your IGridHost for the security test, this
|
* Used to for calculating security rules, you must supply a node from your
|
||||||
* should be the primary node for the machine, unless the action is preformed by a non primary node.
|
* IGridHost for the security test, this should be the primary node for the
|
||||||
|
* machine, unless the action is preformed by a non primary node.
|
||||||
*
|
*
|
||||||
* @return the the gridnode that actions from this IGridHost are preformed by.
|
* @return the the gridnode that actions from this IGridHost are preformed
|
||||||
|
* by.
|
||||||
*/
|
*/
|
||||||
IGridNode getActionableNode();
|
IGridNode getActionableNode();
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -1,9 +1,8 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.api.networking.security;
|
package net.p455w0rd.wirelesscraftingterminal.api.networking.security;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
|
|
||||||
import appeng.api.networking.security.IActionHost;
|
import appeng.api.networking.security.IActionHost;
|
||||||
import appeng.api.networking.security.PlayerSource;
|
import appeng.api.networking.security.PlayerSource;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
public class WCTPlayerSource extends PlayerSource {
|
public class WCTPlayerSource extends PlayerSource {
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ import net.p455w0rd.wirelesscraftingterminal.api.exceptions.RegistrationError;
|
|||||||
public interface IIngredient {
|
public interface IIngredient {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acquire a single input stack for the current recipe, if more then one ItemStack is possible a RegistrationError
|
* Acquire a single input stack for the current recipe, if more then one
|
||||||
* exception will be thrown, ignore these and let the system handle the error.
|
* ItemStack is possible a RegistrationError exception will be thrown,
|
||||||
|
* ignore these and let the system handle the error.
|
||||||
*
|
*
|
||||||
* @return a single ItemStack for the recipe handler.
|
* @return a single ItemStack for the recipe handler.
|
||||||
*
|
*
|
||||||
@@ -18,8 +19,8 @@ public interface IIngredient {
|
|||||||
ItemStack getItemStack() throws RegistrationError, MissingIngredientError;
|
ItemStack getItemStack() throws RegistrationError, MissingIngredientError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acquire a list of all the input stacks for the current recipe, this is for handlers that support multiple inputs
|
* Acquire a list of all the input stacks for the current recipe, this is
|
||||||
* per slot.
|
* for handlers that support multiple inputs per slot.
|
||||||
*
|
*
|
||||||
* @return an array of ItemStacks for the recipe handler.
|
* @return an array of ItemStacks for the recipe handler.
|
||||||
*
|
*
|
||||||
@@ -29,14 +30,16 @@ public interface IIngredient {
|
|||||||
ItemStack[] getItemStackSet() throws RegistrationError, MissingIngredientError;
|
ItemStack[] getItemStackSet() throws RegistrationError, MissingIngredientError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If you wish to support air, you must test before getting the ItemStack, or ItemStackSet
|
* If you wish to support air, you must test before getting the ItemStack,
|
||||||
|
* or ItemStackSet
|
||||||
*
|
*
|
||||||
* @return true if this slot contains no ItemStack, this is passed as "_"
|
* @return true if this slot contains no ItemStack, this is passed as "_"
|
||||||
*/
|
*/
|
||||||
boolean isAir();
|
boolean isAir();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The Name Space of the item. Prefer getItemStack or getItemStackSet
|
* @return The Name Space of the item. Prefer getItemStack or
|
||||||
|
* getItemStackSet
|
||||||
*/
|
*/
|
||||||
String getNameSpace();
|
String getNameSpace();
|
||||||
|
|
||||||
@@ -46,12 +49,14 @@ public interface IIngredient {
|
|||||||
String getItemName();
|
String getItemName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The Damage Value of the item. Prefer getItemStack or getItemStackSet
|
* @return The Damage Value of the item. Prefer getItemStack or
|
||||||
|
* getItemStackSet
|
||||||
*/
|
*/
|
||||||
int getDamageValue();
|
int getDamageValue();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The Damage Value of the item. Prefer getItemStack or getItemStackSet
|
* @return The Damage Value of the item. Prefer getItemStack or
|
||||||
|
* getItemStackSet
|
||||||
*/
|
*/
|
||||||
int getQty();
|
int getQty();
|
||||||
|
|
||||||
|
|||||||
-1
@@ -3,6 +3,5 @@ package net.p455w0rd.wirelesscraftingterminal.api.recipes.game;
|
|||||||
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.RegistrationError;
|
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.RegistrationError;
|
||||||
|
|
||||||
public interface IRecipeBakeable {
|
public interface IRecipeBakeable {
|
||||||
|
|
||||||
void bake() throws RegistrationError;
|
void bake() throws RegistrationError;
|
||||||
}
|
}
|
||||||
+3
-4
@@ -3,7 +3,6 @@ package net.p455w0rd.wirelesscraftingterminal.api.recipes.game;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
@@ -14,7 +13,6 @@ import net.p455w0rd.wirelesscraftingterminal.api.exceptions.RegistrationError;
|
|||||||
import net.p455w0rd.wirelesscraftingterminal.api.recipes.IIngredient;
|
import net.p455w0rd.wirelesscraftingterminal.api.recipes.IIngredient;
|
||||||
|
|
||||||
public class ShapedRecipe implements IRecipe, IRecipeBakeable {
|
public class ShapedRecipe implements IRecipe, IRecipeBakeable {
|
||||||
|
|
||||||
// Added in for future ease of change, but hard coded for now.
|
// Added in for future ease of change, but hard coded for now.
|
||||||
private static final int MAX_CRAFT_GRID_WIDTH = 3;
|
private static final int MAX_CRAFT_GRID_WIDTH = 3;
|
||||||
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
|
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
|
||||||
@@ -197,8 +195,9 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable {
|
|||||||
if (input == null && target != null || input != null && target == null) {
|
if (input == null && target != null || input != null && target == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return (target.getItem() == input.getItem() && (target.getItemDamage() == OreDictionary.WILDCARD_VALUE
|
return (target.getItem() == input.getItem()
|
||||||
|| target.getItemDamage() == input.getItemDamage()));
|
&& (target.getItemDamage() == OreDictionary.WILDCARD_VALUE
|
||||||
|
|| target.getItemDamage() == input.getItemDamage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShapedRecipe setMirrored(final boolean mirror) {
|
public ShapedRecipe setMirrored(final boolean mirror) {
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package net.p455w0rd.wirelesscraftingterminal.client.gui;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.definitions.IDefinitions;
|
||||||
|
import appeng.api.definitions.IParts;
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
|
import appeng.container.implementations.ContainerCraftAmount;
|
||||||
|
import appeng.helpers.Reflected;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.items.ItemWirelessCraftingTerminal;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
|
public class GuiCraftAmount extends appeng.client.gui.implementations.GuiCraftAmount {
|
||||||
|
private GuiTabButton originalGuiBtn;
|
||||||
|
|
||||||
|
private ItemStack myIcon;
|
||||||
|
|
||||||
|
private int originalGui;
|
||||||
|
|
||||||
|
@Reflected
|
||||||
|
public GuiCraftAmount(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||||
|
super(inventoryPlayer, te);
|
||||||
|
ItemStack is = new ItemStack(ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem());
|
||||||
|
((ItemWirelessCraftingTerminal) is.getItem()).injectAEPower(is, 6400001);
|
||||||
|
myIcon = is;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "unused"})
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
// Remove the autogenerated button which takes you to the AE2 wireless terminal GUI
|
||||||
|
if (this.buttonList.get(this.buttonList.size() - 1) instanceof GuiTabButton) {
|
||||||
|
this.buttonList.remove(this.buttonList.size() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
final Object target = ((ContainerCraftAmount) this.inventorySlots).getTarget();
|
||||||
|
final IDefinitions definitions = AEApi.instance().definitions();
|
||||||
|
final IParts parts = definitions.parts();
|
||||||
|
|
||||||
|
if (target instanceof WirelessTerminalGuiObject) {
|
||||||
|
this.originalGui = Reference.GUI_WCT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.originalGui > 0 && myIcon != null) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.originalGuiBtn = new GuiTabButton(
|
||||||
|
this.guiLeft + 154, this.guiTop - 4, myIcon, myIcon.getDisplayName(), itemRender));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
|
||||||
|
if (btn == this.originalGuiBtn) {
|
||||||
|
NetworkHandler.instance.sendToServer(new PacketSwitchGuis(this.originalGui));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package net.p455w0rd.wirelesscraftingterminal.client.gui;
|
||||||
|
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
|
public class GuiCraftConfirm extends appeng.client.gui.implementations.GuiCraftConfirm {
|
||||||
|
public GuiCraftConfirm(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||||
|
super(inventoryPlayer, te);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void switchToOriginalGUI() {
|
||||||
|
NetworkHandler.instance.sendToServer(new PacketSwitchGuis(Reference.GUI_WCT));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package net.p455w0rd.wirelesscraftingterminal.client.gui;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.definitions.IDefinitions;
|
||||||
|
import appeng.api.definitions.IParts;
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
|
import appeng.container.implementations.ContainerCraftingStatus;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.items.ItemWirelessCraftingTerminal;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
|
public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraftingStatus {
|
||||||
|
private GuiTabButton originalGuiBtn;
|
||||||
|
private int originalGui;
|
||||||
|
private ItemStack myIcon = null;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public GuiCraftingStatus(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||||
|
super(inventoryPlayer, te);
|
||||||
|
|
||||||
|
ContainerCraftingStatus status = (ContainerCraftingStatus) this.inventorySlots;
|
||||||
|
final Object target = status.getTarget();
|
||||||
|
final IDefinitions definitions = AEApi.instance().definitions();
|
||||||
|
final IParts parts = definitions.parts();
|
||||||
|
|
||||||
|
if (target instanceof WirelessTerminalGuiObject) {
|
||||||
|
for (final ItemStack wirelessTerminalStack :
|
||||||
|
definitions.items().wirelessTerminal().maybeStack(1).asSet()) {
|
||||||
|
this.myIcon = wirelessTerminalStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack is = new ItemStack(ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem());
|
||||||
|
((ItemWirelessCraftingTerminal) is.getItem()).injectAEPower(is, 6400001);
|
||||||
|
myIcon = is;
|
||||||
|
|
||||||
|
this.originalGui = Reference.GUI_WCT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
|
||||||
|
if (btn == this.originalGuiBtn) {
|
||||||
|
NetworkHandler.instance.sendToServer(new PacketSwitchGuis(this.originalGui));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
|
||||||
|
if (this.myIcon != null) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.originalGuiBtn = new GuiTabButton(
|
||||||
|
this.guiLeft + 213,
|
||||||
|
this.guiTop - 4,
|
||||||
|
this.myIcon,
|
||||||
|
this.myIcon.getDisplayName(),
|
||||||
|
itemRender));
|
||||||
|
this.originalGuiBtn.setHideEdge(13);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.client.gui;
|
package net.p455w0rd.wirelesscraftingterminal.client.gui;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.IModGuiFactory;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
|
||||||
import cpw.mods.fml.client.IModGuiFactory;
|
|
||||||
|
|
||||||
public class GuiFactory implements IModGuiFactory {
|
public class GuiFactory implements IModGuiFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerMagnet;
|
|||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMagnetFilter;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMagnetFilter;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
public class GuiMagnet extends GuiContainer {
|
public class GuiMagnet extends GuiContainer {
|
||||||
@@ -22,7 +21,7 @@ public class GuiMagnet extends GuiContainer {
|
|||||||
public boolean ignoreNBT = false;
|
public boolean ignoreNBT = false;
|
||||||
public boolean ignoreMeta = false;
|
public boolean ignoreMeta = false;
|
||||||
public boolean useOreDict = false;
|
public boolean useOreDict = false;
|
||||||
private final ItemStack magnetItem;
|
private ItemStack magnetItem;
|
||||||
private WCTGuiCheckBox ignoreNBTBox;
|
private WCTGuiCheckBox ignoreNBTBox;
|
||||||
private WCTGuiCheckBox ignoreMetaBox;
|
private WCTGuiCheckBox ignoreMetaBox;
|
||||||
private WCTGuiCheckBox useOreDictBox;
|
private WCTGuiCheckBox useOreDictBox;
|
||||||
@@ -59,28 +58,13 @@ public class GuiMagnet extends GuiContainer {
|
|||||||
this.modeBtn = new WCTGuiButton(0, this.guiLeft + 104, this.guiTop + 4, 64, 14, getLabel(this.mode)));
|
this.modeBtn = new WCTGuiButton(0, this.guiLeft + 104, this.guiTop + 4, 64, 14, getLabel(this.mode)));
|
||||||
this.buttonList.add(
|
this.buttonList.add(
|
||||||
this.ignoreNBTBox = new WCTGuiCheckBox(
|
this.ignoreNBTBox = new WCTGuiCheckBox(
|
||||||
1,
|
1, this.guiLeft + 61, this.guiTop + 20, "Ignore NBT Data", this.ignoreNBT, 107));
|
||||||
this.guiLeft + 61,
|
|
||||||
this.guiTop + 20,
|
|
||||||
"Ignore NBT Data",
|
|
||||||
this.ignoreNBT,
|
|
||||||
107));
|
|
||||||
this.buttonList.add(
|
this.buttonList.add(
|
||||||
this.ignoreMetaBox = new WCTGuiCheckBox(
|
this.ignoreMetaBox = new WCTGuiCheckBox(
|
||||||
2,
|
2, this.guiLeft + 61, this.guiTop + 32, "Ignore Meta Data", this.ignoreMeta, 107));
|
||||||
this.guiLeft + 61,
|
|
||||||
this.guiTop + 32,
|
|
||||||
"Ignore Meta Data",
|
|
||||||
this.ignoreMeta,
|
|
||||||
107));
|
|
||||||
this.buttonList.add(
|
this.buttonList.add(
|
||||||
this.useOreDictBox = new WCTGuiCheckBox(
|
this.useOreDictBox = new WCTGuiCheckBox(
|
||||||
3,
|
3, this.guiLeft + 61, this.guiTop + 44, "Use Ore Dictionary", this.useOreDict, 107));
|
||||||
this.guiLeft + 61,
|
|
||||||
this.guiTop + 44,
|
|
||||||
"Use Ore Dictionary",
|
|
||||||
this.useOreDict,
|
|
||||||
107));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String getLabel(boolean filterMode) {
|
String getLabel(boolean filterMode) {
|
||||||
|
|||||||
+790
-90
@@ -1,110 +1,423 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.client.gui;
|
package net.p455w0rd.wirelesscraftingterminal.client.gui;
|
||||||
|
|
||||||
|
import appeng.api.config.ActionItems;
|
||||||
|
import appeng.api.config.SearchBoxMode;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.config.TerminalStyle;
|
||||||
|
import appeng.api.config.YesNo;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.api.util.IConfigurableObject;
|
||||||
|
import appeng.client.ActionKey;
|
||||||
|
import appeng.client.gui.AEBaseGui;
|
||||||
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
import appeng.client.gui.widgets.GuiScrollbar;
|
||||||
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
|
import appeng.client.gui.widgets.ISortSource;
|
||||||
|
import appeng.client.gui.widgets.MEGuiTextField;
|
||||||
|
import appeng.client.me.InternalSlotME;
|
||||||
|
import appeng.client.me.ItemRepo;
|
||||||
|
import appeng.client.me.SlotME;
|
||||||
|
import appeng.container.AEBaseContainer;
|
||||||
|
import appeng.container.slot.AppEngSlot;
|
||||||
|
import appeng.container.slot.SlotCraftingMatrix;
|
||||||
|
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.CommonHelper;
|
||||||
|
import appeng.core.localization.ButtonToolTips;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.helpers.InventoryAction;
|
||||||
|
import appeng.util.IConfigManagerHost;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import codechicken.nei.TextField;
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
|
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.widgets.GuiTrashButton;
|
import net.p455w0rd.wirelesscraftingterminal.client.gui.widgets.GuiTrashButton;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotTrash;
|
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotTrash;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketEmptyTrash;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketEmptyTrash;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketInventoryAction;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketInventoryAction;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
import yalter.mousetweaks.api.IMTModGuiContainer;
|
||||||
|
|
||||||
import appeng.api.config.ActionItems;
|
@Optional.Interface(modid = "MouseTweaks", iface = "yalter.mousetweaks.api.IMTModGuiContainer")
|
||||||
import appeng.api.config.Settings;
|
public class GuiWirelessCraftingTerminal extends AEBaseGui
|
||||||
import appeng.api.parts.ICraftingTerminal;
|
implements ISortSource, IConfigManagerHost, IMTModGuiContainer {
|
||||||
import appeng.client.gui.implementations.GuiMEMonitorable;
|
|
||||||
import appeng.client.gui.slots.VirtualMEPinSlot;
|
|
||||||
import appeng.client.gui.widgets.GuiImgButton;
|
|
||||||
import appeng.container.slot.AppEngSlot;
|
|
||||||
import appeng.container.slot.SlotCraftingMatrix;
|
|
||||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
|
||||||
import appeng.core.localization.ColorUtils;
|
|
||||||
import appeng.core.localization.GuiText;
|
|
||||||
import appeng.helpers.InventoryAction;
|
|
||||||
|
|
||||||
public class GuiWirelessCraftingTerminal extends GuiMEMonitorable {
|
|
||||||
|
|
||||||
private float xSize_lo;
|
private float xSize_lo;
|
||||||
private float ySize_lo;
|
private float ySize_lo;
|
||||||
|
public static int tick = 0,
|
||||||
final ResourceLocation BackgroundTexture = new ResourceLocation(
|
GUI_HEIGHT = 240,
|
||||||
Reference.MODID,
|
GUI_WIDTH = 230,
|
||||||
"textures/gui/crafting_viewcell.png");
|
AE_ROW_HEIGHT = 18,
|
||||||
|
AE_NUM_ROWS = 0,
|
||||||
|
GUI_UPPER_HEIGHT = 35,
|
||||||
|
GUI_SEARCH_ROW = 35,
|
||||||
|
SEARCH_X = 80,
|
||||||
|
SEARCH_Y = 4,
|
||||||
|
SEARCH_WIDTH = 88,
|
||||||
|
SEARCH_HEIGHT = 12,
|
||||||
|
SEARCH_MAXCHARS = 15,
|
||||||
|
GUI_LOWER_HEIGHT,
|
||||||
|
AE_TOTAL_ROWS_HEIGHT,
|
||||||
|
BUTTON_SEARCH_MODE_POS_X = -18,
|
||||||
|
BUTTON_SEARCH_MODE_POS_Y = 68,
|
||||||
|
BUTTON_SIZE = 16,
|
||||||
|
NEI_EXTRA_SPACE = 30,
|
||||||
|
slotYOffset;
|
||||||
|
protected static final int BUTTON_SEARCH_MODE_ID = 5;
|
||||||
|
protected static final long TOOLTIP_UPDATE_INTERVAL = 3000L;
|
||||||
|
private int currScreenWidth, currScreenHeight;
|
||||||
|
private static final String bgTexturePath = "gui/crafting_viewcell.png";
|
||||||
private final ContainerWirelessCraftingTerminal containerWCT;
|
private final ContainerWirelessCraftingTerminal containerWCT;
|
||||||
|
private boolean isFullScreen, init = true, reInit, wasResized = false;
|
||||||
|
public static GuiWirelessCraftingTerminal INSTANCE;
|
||||||
|
private static boolean switchingGuis;
|
||||||
public static int craftingGridOffsetX = 80;
|
public static int craftingGridOffsetX = 80;
|
||||||
public static int craftingGridOffsetY;
|
public static int craftingGridOffsetY;
|
||||||
|
private static String memoryText = "";
|
||||||
|
private final ItemRepo repo;
|
||||||
|
private final int offsetX = 8;
|
||||||
|
private final IConfigManager configSrc;
|
||||||
|
private GuiTabButton craftingStatusBtn;
|
||||||
|
private MEGuiTextField searchField;
|
||||||
|
private int perRow = 9;
|
||||||
|
private boolean customSortOrder = true;
|
||||||
|
private GuiImgButton ViewBox;
|
||||||
|
private GuiImgButton SortByBox;
|
||||||
|
private GuiImgButton SortDirBox;
|
||||||
|
private GuiImgButton searchBoxSettings;
|
||||||
private GuiImgButton clearBtn;
|
private GuiImgButton clearBtn;
|
||||||
private GuiTrashButton trashBtn;
|
private GuiTrashButton trashBtn;
|
||||||
|
private GuiImgButton terminalStyleBox;
|
||||||
|
private GuiImgButton searchStringSave;
|
||||||
|
private boolean isAutoFocus = false;
|
||||||
|
private int currentMouseX = 0;
|
||||||
|
private int currentMouseY = 0;
|
||||||
|
public boolean devicePowered = false;
|
||||||
|
private boolean isNEIEnabled;
|
||||||
|
private boolean wasTextboxFocused = false;
|
||||||
|
private int screenResTicks = 0;
|
||||||
|
private int reservedSpace = 0;
|
||||||
|
private int maxRows = Integer.MAX_VALUE;
|
||||||
|
private int standardSize;
|
||||||
|
private final int lowerTextureOffset = 0;
|
||||||
|
private int rows = 0;
|
||||||
|
private final ItemStack[] myCurrentViewCells = new ItemStack[5];
|
||||||
|
|
||||||
private final GuiText hostName;
|
public GuiWirelessCraftingTerminal(Container container) {
|
||||||
|
super(container);
|
||||||
public GuiWirelessCraftingTerminal(final InventoryPlayer inventoryPlayer, ICraftingTerminal host) {
|
GuiWirelessCraftingTerminal.INSTANCE = this;
|
||||||
super(inventoryPlayer, host, new ContainerWirelessCraftingTerminal(inventoryPlayer, host));
|
this.xSize = GUI_WIDTH;
|
||||||
this.hostName = host.getHostName();
|
this.ySize = GUI_HEIGHT;
|
||||||
|
this.standardSize = this.xSize;
|
||||||
this.setReservedSpace(73);
|
this.setReservedSpace(73);
|
||||||
this.offsetRepoX -= 1;
|
this.containerWCT = (ContainerWirelessCraftingTerminal) container;
|
||||||
|
this.setScrollBar(new GuiScrollbar());
|
||||||
this.containerWCT = (ContainerWirelessCraftingTerminal) this.inventorySlots;
|
this.repo = new ItemRepo(getScrollBar(), this);
|
||||||
|
this.configSrc = ((IConfigurableObject) this.inventorySlots).getConfigManager();
|
||||||
|
this.devicePowered = containerWCT.isPowered();
|
||||||
((ContainerWirelessCraftingTerminal) this.inventorySlots).setGui(this);
|
((ContainerWirelessCraftingTerminal) this.inventorySlots).setGui(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void postUpdate(final List<IAEItemStack> list) {
|
||||||
|
for (final IAEItemStack is : list) {
|
||||||
|
this.repo.postUpdate(is);
|
||||||
|
}
|
||||||
|
this.repo.updateView();
|
||||||
|
this.setScrollBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setScrollBar() {
|
||||||
|
this.getScrollBar().setTop(18).setLeft(174).setHeight(this.rows * 18 - 2);
|
||||||
|
this.getScrollBar()
|
||||||
|
.setRange(
|
||||||
|
0, (this.repo.size() + this.perRow - 1) / this.perRow - this.rows, Math.max(1, this.rows / 6));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
@Override
|
@Override
|
||||||
protected void actionPerformed(final GuiButton btn) {
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
if (this.clearBtn == btn) {
|
if (btn == this.craftingStatusBtn) {
|
||||||
Slot s = null;
|
NetworkHandler.instance.sendToServer(new PacketSwitchGuis(Reference.GUI_CRAFTING_STATUS));
|
||||||
final Container c = this.inventorySlots;
|
|
||||||
for (final Object j : c.inventorySlots) {
|
|
||||||
if (j instanceof SlotCraftingMatrix) {
|
|
||||||
s = (Slot) j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s != null) {
|
|
||||||
final PacketInventoryAction p = new PacketInventoryAction(InventoryAction.MOVE_REGION, s.slotNumber, 0);
|
|
||||||
NetworkHandler.instance.sendToServer(p);
|
|
||||||
}
|
|
||||||
} else if (this.trashBtn == btn) {
|
|
||||||
Slot s = null;
|
|
||||||
final Container c = this.inventorySlots;
|
|
||||||
for (final Object j : c.inventorySlots) {
|
|
||||||
if (j instanceof SlotTrash) {
|
|
||||||
s = (Slot) j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s != null) {
|
|
||||||
if (s.getHasStack()) {
|
|
||||||
containerWCT.trashSlot.clearStack();
|
|
||||||
NetworkHandler.instance.sendToServer(new PacketEmptyTrash());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
super.actionPerformed(btn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (btn instanceof GuiImgButton) {
|
||||||
|
final boolean backwards = Mouse.isButtonDown(1);
|
||||||
|
|
||||||
|
final GuiImgButton iBtn = (GuiImgButton) btn;
|
||||||
|
if (iBtn.getSetting() != Settings.ACTIONS) {
|
||||||
|
final Enum cv = iBtn.getCurrentValue();
|
||||||
|
final Enum next =
|
||||||
|
Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
|
||||||
|
|
||||||
|
if (btn == this.terminalStyleBox) {
|
||||||
|
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||||
|
}
|
||||||
|
if (btn == this.searchBoxSettings) {
|
||||||
|
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||||
|
} else if (btn == this.searchStringSave) {
|
||||||
|
AEConfig.instance.preserveSearchBar = next == YesNo.YES;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
NetworkHandler.instance.sendToServer(
|
||||||
|
new PacketValueConfig(iBtn.getSetting().name(), next.name()));
|
||||||
|
} catch (final IOException e) {
|
||||||
|
WCTLog.debug(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
iBtn.set(next);
|
||||||
|
|
||||||
|
if (next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class) {
|
||||||
|
this.reinitalize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.clearBtn == btn) {
|
||||||
|
Slot s = null;
|
||||||
|
final Container c = this.inventorySlots;
|
||||||
|
for (final Object j : c.inventorySlots) {
|
||||||
|
if (j instanceof SlotCraftingMatrix) {
|
||||||
|
s = (Slot) j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s != null) {
|
||||||
|
final PacketInventoryAction p =
|
||||||
|
new PacketInventoryAction(InventoryAction.MOVE_REGION, s.slotNumber, 0);
|
||||||
|
NetworkHandler.instance.sendToServer(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (btn instanceof GuiTrashButton) {
|
||||||
|
if (this.trashBtn == btn) {
|
||||||
|
Slot s = null;
|
||||||
|
final Container c = this.inventorySlots;
|
||||||
|
for (final Object j : c.inventorySlots) {
|
||||||
|
if (j instanceof SlotTrash) {
|
||||||
|
s = (Slot) j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s != null) {
|
||||||
|
if (s.getHasStack()) {
|
||||||
|
containerWCT.trashSlot.clearStack();
|
||||||
|
NetworkHandler.instance.sendToServer(new PacketEmptyTrash());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void handleMouseClick(Slot slot, int slotIdx, int ctrlDown, int mouseButton) {
|
||||||
|
// Handle autocraft requests ourselves to spawn the right GUI classes
|
||||||
|
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||||
|
|
||||||
|
if (slot instanceof SlotME) {
|
||||||
|
InventoryAction action = null;
|
||||||
|
IAEItemStack stack = null;
|
||||||
|
|
||||||
|
switch (mouseButton) {
|
||||||
|
case 0: // pickup / set-down.
|
||||||
|
action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
||||||
|
stack = ((SlotME) slot).getAEStack();
|
||||||
|
|
||||||
|
if (stack != null
|
||||||
|
&& action == InventoryAction.PICKUP_OR_SET_DOWN
|
||||||
|
&& stack.getStackSize() == 0
|
||||||
|
&& player.inventory.getItemStack() == null) {
|
||||||
|
action = InventoryAction.AUTO_CRAFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 3: // creative dupe:
|
||||||
|
stack = ((SlotME) slot).getAEStack();
|
||||||
|
if (stack != null && stack.isCraftable()) {
|
||||||
|
action = InventoryAction.AUTO_CRAFT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
if (action == InventoryAction.AUTO_CRAFT) {
|
||||||
|
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||||
|
final PacketInventoryAction p =
|
||||||
|
new PacketInventoryAction(action, this.inventorySlots.inventorySlots.size(), 0);
|
||||||
|
NetworkHandler.instance.sendToServer(p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void reinitalize() {
|
||||||
|
this.buttonList.clear();
|
||||||
|
this.initGui();
|
||||||
|
}
|
||||||
|
|
||||||
|
int getReservedSpace() {
|
||||||
|
return this.reservedSpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setReservedSpace(final int reservedSpace) {
|
||||||
|
this.reservedSpace = reservedSpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStandardSize() {
|
||||||
|
return this.standardSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setStandardSize(final int standardSize) {
|
||||||
|
this.standardSize = standardSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the GUI
|
* Initializes the GUI
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
super.initGui();
|
super.initGui();
|
||||||
|
|
||||||
|
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.isNEIEnabled = Loader.isModLoaded("NotEnoughItems");
|
||||||
|
int top = isNEIEnabled ? 22 : 0;
|
||||||
|
final int magicNumber = 114 + 1;
|
||||||
|
final int extraSpace = this.height - magicNumber - top - this.reservedSpace;
|
||||||
|
this.rows = (int) Math.floor(extraSpace / 18);
|
||||||
|
if (this.rows > this.maxRows) {
|
||||||
|
top += (this.rows - this.maxRows) * 18 / 2;
|
||||||
|
this.rows = this.maxRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNEIEnabled) {
|
||||||
|
this.rows--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.rows < 3) {
|
||||||
|
this.rows = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getMeSlots().clear();
|
||||||
|
for (int y = 0; y < this.rows; y++) {
|
||||||
|
for (int x = 0; x < this.perRow; x++) {
|
||||||
|
this.getMeSlots()
|
||||||
|
.add(new InternalSlotME(this.repo, x + y * this.perRow, this.offsetX + x * 18, 18 + y * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL) {
|
||||||
|
this.xSize = this.standardSize + ((this.perRow - 9) * 18);
|
||||||
|
} else {
|
||||||
|
this.xSize = this.standardSize;
|
||||||
|
}
|
||||||
|
super.initGui();
|
||||||
|
|
||||||
|
this.ySize = magicNumber + this.rows * 18 + this.reservedSpace;
|
||||||
|
final int unusedSpace = this.height - this.ySize;
|
||||||
|
this.guiTop = (int) Math.floor(unusedSpace / (unusedSpace < 0 ? 3.8f : 2.0f));
|
||||||
|
int offset = this.guiTop + 8;
|
||||||
|
|
||||||
|
this.buttonList.clear();
|
||||||
this.buttonList.add(
|
this.buttonList.add(
|
||||||
this.clearBtn = new GuiImgButton(
|
this.clearBtn = new GuiImgButton(
|
||||||
this.guiLeft + 134,
|
this.guiLeft + 134, this.guiTop + this.ySize - 160, Settings.ACTIONS, ActionItems.STASH));
|
||||||
this.guiTop + this.ySize - 160,
|
|
||||||
Settings.ACTIONS,
|
|
||||||
ActionItems.STASH));
|
|
||||||
this.buttonList.add(this.trashBtn = new GuiTrashButton(this.guiLeft + 98, this.guiTop + this.ySize - 104));
|
this.buttonList.add(this.trashBtn = new GuiTrashButton(this.guiLeft + 98, this.guiTop + this.ySize - 104));
|
||||||
this.clearBtn.setHalfSize(true);
|
this.clearBtn.setHalfSize(true);
|
||||||
|
if (this.customSortOrder) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.SortByBox = new GuiImgButton(
|
||||||
|
this.guiLeft - 18, offset, Settings.SORT_BY, this.configSrc.getSetting(Settings.SORT_BY)));
|
||||||
|
offset += 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.buttonList.add(
|
||||||
|
this.ViewBox = new GuiImgButton(
|
||||||
|
this.guiLeft - 18, offset, Settings.VIEW_MODE, this.configSrc.getSetting(Settings.VIEW_MODE)));
|
||||||
|
offset += 20;
|
||||||
|
|
||||||
|
this.buttonList.add(
|
||||||
|
this.SortDirBox = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
offset,
|
||||||
|
Settings.SORT_DIRECTION,
|
||||||
|
this.configSrc.getSetting(Settings.SORT_DIRECTION)));
|
||||||
|
offset += 20;
|
||||||
|
|
||||||
|
this.buttonList.add(
|
||||||
|
this.searchBoxSettings = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
offset,
|
||||||
|
Settings.SEARCH_MODE,
|
||||||
|
AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE)));
|
||||||
|
offset += 20;
|
||||||
|
|
||||||
|
this.buttonList.add(
|
||||||
|
this.searchStringSave = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
offset,
|
||||||
|
Settings.SAVE_SEARCH,
|
||||||
|
AEConfig.instance.preserveSearchBar ? YesNo.YES : YesNo.NO));
|
||||||
|
offset += 20;
|
||||||
|
|
||||||
|
this.buttonList.add(
|
||||||
|
this.terminalStyleBox = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
offset,
|
||||||
|
Settings.TERMINAL_STYLE,
|
||||||
|
AEConfig.instance.settings.getSetting(Settings.TERMINAL_STYLE)));
|
||||||
|
|
||||||
|
this.searchField = new MEGuiTextField(SEARCH_WIDTH, SEARCH_HEIGHT);
|
||||||
|
this.searchField.x = SEARCH_X;
|
||||||
|
this.searchField.y = SEARCH_Y;
|
||||||
|
|
||||||
|
this.buttonList.add(
|
||||||
|
this.craftingStatusBtn = new GuiTabButton(
|
||||||
|
this.guiLeft + 169,
|
||||||
|
this.guiTop - 4,
|
||||||
|
2 + 11 * 16,
|
||||||
|
GuiText.CraftingStatus.getLocal(),
|
||||||
|
itemRender));
|
||||||
|
this.craftingStatusBtn.setHideEdge(13);
|
||||||
|
|
||||||
|
final Enum searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||||
|
this.isAutoFocus = SearchBoxMode.AUTOSEARCH == searchMode || SearchBoxMode.NEI_AUTOSEARCH == searchMode;
|
||||||
|
|
||||||
|
this.searchField.setFocused(this.isAutoFocus);
|
||||||
|
|
||||||
|
if (AEConfig.instance.preserveSearchBar || this.isSubGui()) {
|
||||||
|
this.searchField.setText(memoryText);
|
||||||
|
this.repo.setSearchString(memoryText);
|
||||||
|
}
|
||||||
|
if (this.isSubGui()) {
|
||||||
|
this.repo.updateView();
|
||||||
|
this.setScrollBar();
|
||||||
|
}
|
||||||
|
|
||||||
craftingGridOffsetX = Integer.MAX_VALUE;
|
craftingGridOffsetX = Integer.MAX_VALUE;
|
||||||
craftingGridOffsetY = Integer.MAX_VALUE;
|
craftingGridOffsetY = Integer.MAX_VALUE;
|
||||||
@@ -126,9 +439,84 @@ public class GuiWirelessCraftingTerminal extends GuiMEMonitorable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getMaxRows() {
|
||||||
|
return AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL
|
||||||
|
? 6
|
||||||
|
: Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void repositionSlot(final AppEngSlot s) {
|
||||||
|
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called every tick. It is used in this instance to detect screen size
|
||||||
|
* changes to automatically update the gui height.
|
||||||
|
* <p>
|
||||||
|
* reInit variable is used to call initGui() on the next tick. It has to be
|
||||||
|
* called this way to update correctly.
|
||||||
|
*
|
||||||
|
* @author p455w0rd
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected int getPinButtonY() {
|
public void updateScreen() {
|
||||||
return super.getPinButtonY() + 31;
|
this.devicePowered = containerWCT.isPowered();
|
||||||
|
this.repo.setPower(devicePowered);
|
||||||
|
|
||||||
|
super.updateScreen();
|
||||||
|
if (this.init) {
|
||||||
|
this.currScreenWidth = this.mc.displayWidth;
|
||||||
|
this.currScreenHeight = this.mc.displayHeight;
|
||||||
|
this.isFullScreen = this.mc.isFullScreen();
|
||||||
|
this.reInit = true;
|
||||||
|
this.init = false;
|
||||||
|
}
|
||||||
|
++screenResTicks;
|
||||||
|
if (screenResTicks == 20) {
|
||||||
|
this.wasTextboxFocused = this.searchField.isFocused();
|
||||||
|
screenResTicks = 0;
|
||||||
|
}
|
||||||
|
if (this.reInit) {
|
||||||
|
if (tick != 1) {
|
||||||
|
tick++;
|
||||||
|
} else {
|
||||||
|
this.initGui();
|
||||||
|
this.setScrollBar();
|
||||||
|
if (this.wasResized) {
|
||||||
|
this.searchField.setFocused(this.wasTextboxFocused);
|
||||||
|
this.searchField.setText(this.repo.getSearchString());
|
||||||
|
this.wasTextboxFocused = false;
|
||||||
|
this.wasResized = false;
|
||||||
|
}
|
||||||
|
this.reInit = false;
|
||||||
|
tick = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasScreenResChanged()) {
|
||||||
|
this.reInit = true;
|
||||||
|
this.wasResized = true;
|
||||||
|
}
|
||||||
|
if (!this.mc.thePlayer.isEntityAlive() || this.mc.thePlayer.isDead) {
|
||||||
|
this.mc.thePlayer.closeScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detects if the window has been resized
|
||||||
|
*
|
||||||
|
* @return True if window has been resized
|
||||||
|
* @author p455w0rd
|
||||||
|
*/
|
||||||
|
private boolean hasScreenResChanged() {
|
||||||
|
if ((this.currScreenWidth != this.mc.displayWidth)
|
||||||
|
|| (this.currScreenHeight != this.mc.displayHeight)
|
||||||
|
|| (this.isFullScreen != this.mc.isFullScreen())) {
|
||||||
|
this.currScreenWidth = this.mc.displayWidth;
|
||||||
|
this.currScreenHeight = this.mc.displayHeight;
|
||||||
|
this.isFullScreen = this.mc.isFullScreen();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,33 +529,23 @@ public class GuiWirelessCraftingTerminal extends GuiMEMonitorable {
|
|||||||
this.ySize_lo = (float) mouseY;
|
this.ySize_lo = (float) mouseY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
protected String getGuiDisplayName(String in) {
|
String s = LocaleHandler.WirelessTermLabel.getLocal();
|
||||||
return in;
|
this.mc.fontRenderer.drawString(s, 7, 5, 4210752);
|
||||||
}
|
this.mc.fontRenderer.drawString(I18n.format("container.inventory"), 7, this.ySize - 172 + 3, 4210752);
|
||||||
|
if (this.searchField != null) {
|
||||||
/**
|
this.searchField.drawTextBox();
|
||||||
* Same as {@link GuiMEMonitorable#drawFG} but without the "Inventory" label, which overlaps the player model.
|
}
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
|
||||||
this.fontRendererObj.drawString(
|
|
||||||
this.getGuiDisplayName(this.hostName.getLocal()),
|
|
||||||
8,
|
|
||||||
6,
|
|
||||||
ColorUtils.guiTextColorGray.getColor());
|
|
||||||
|
|
||||||
VirtualMEPinSlot.drawSlotsBackground(this.pinSlots, this.mc, this.zLevel);
|
|
||||||
|
|
||||||
this.currentMouseX = mouseX;
|
this.currentMouseX = mouseX;
|
||||||
this.currentMouseY = mouseY;
|
this.currentMouseY = mouseY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
// draw "over inventory area"
|
this.bindMyTexture(bgTexturePath);
|
||||||
this.mc.getTextureManager().bindTexture(BackgroundTexture);
|
|
||||||
final int x_width = 199;
|
final int x_width = 199;
|
||||||
|
|
||||||
|
// draw "over inventory area"
|
||||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, x_width, 18);
|
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, x_width, 18);
|
||||||
|
|
||||||
for (int x = 0; x < this.rows; x++) {
|
for (int x = 0; x < this.rows; x++) {
|
||||||
@@ -177,13 +555,13 @@ public class GuiWirelessCraftingTerminal extends GuiMEMonitorable {
|
|||||||
// draw player inv
|
// draw player inv
|
||||||
this.drawTexturedModalRect(
|
this.drawTexturedModalRect(
|
||||||
offsetX,
|
offsetX,
|
||||||
offsetY + 16 + this.rows * 18,
|
offsetY + 16 + this.rows * 18 + this.lowerTextureOffset,
|
||||||
0,
|
0,
|
||||||
106 - 18 - 18,
|
106 - 18 - 18,
|
||||||
x_width,
|
x_width,
|
||||||
99 + this.getReservedSpace());
|
99 + this.reservedSpace - this.lowerTextureOffset);
|
||||||
|
|
||||||
// draw view cells background
|
// draw view cells
|
||||||
this.drawTexturedModalRect(offsetX + x_width, offsetY, x_width, 0, 32, 104);
|
this.drawTexturedModalRect(offsetX + x_width, offsetY, x_width, 0, 32, 104);
|
||||||
|
|
||||||
if (Reference.WCT_BOOSTER_ENABLED) {
|
if (Reference.WCT_BOOSTER_ENABLED) {
|
||||||
@@ -197,8 +575,330 @@ public class GuiWirelessCraftingTerminal extends GuiMEMonitorable {
|
|||||||
(float) ((this.guiTop + this.rows * 18) + 50) - this.ySize_lo,
|
(float) ((this.guiTop + this.rows * 18) + 50) - this.ySize_lo,
|
||||||
this.mc.thePlayer);
|
this.mc.thePlayer);
|
||||||
|
|
||||||
this.searchField.drawTextBox();
|
boolean update = false;
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
if (myCurrentViewCells[i] != containerWCT.getCellViewSlot(i).getStack()) {
|
||||||
|
update = true;
|
||||||
|
myCurrentViewCells[i] = containerWCT.getCellViewSlot(i).getStack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.updateViewCells();
|
if (update) {
|
||||||
|
repo.setViewCell(myCurrentViewCells);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||||
|
|
||||||
|
if (!this.isAutoFocus) {
|
||||||
|
this.searchField.mouseClicked(xCoord - this.guiLeft, yCoord - this.guiTop, btn);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (btn == 1 && this.searchField.isMouseIn(xCoord - this.guiLeft, yCoord - this.guiTop)) {
|
||||||
|
this.searchField.setText("");
|
||||||
|
this.repo.setSearchString("");
|
||||||
|
this.repo.updateView();
|
||||||
|
this.setScrollBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
super.mouseClicked(xCoord, yCoord, btn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGuiClosed() {
|
||||||
|
super.onGuiClosed();
|
||||||
|
Keyboard.enableRepeatEvents(false);
|
||||||
|
if (this.searchField.getText() != null) {
|
||||||
|
memoryText = this.searchField.getText();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean enableSpaceClicking() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void keyTyped(final char character, final int key) {
|
||||||
|
if (!this.checkHotbarKeys(key)) {
|
||||||
|
if (isNEIFocused()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CommonHelper.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();
|
||||||
|
} else {
|
||||||
|
super.keyTyped(character, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isPowered() {
|
||||||
|
return this.repo.hasPower();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bindMyTexture(final String file) {
|
||||||
|
final ResourceLocation loc = new ResourceLocation(Reference.MODID, "textures/" + file);
|
||||||
|
this.mc.getTextureManager().bindTexture(loc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> handleItemTooltip(
|
||||||
|
final ItemStack stack, final int mouseX, final int mouseY, final List<String> currentToolTip) {
|
||||||
|
if (stack != null) {
|
||||||
|
final Slot s = this.getSlot(mouseX, mouseY);
|
||||||
|
if (s instanceof SlotME) {
|
||||||
|
final int BigNumber = AEConfig.instance.useTerminalUseLargeFont() ? 999 : 9999;
|
||||||
|
|
||||||
|
IAEItemStack myStack = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
final SlotME theSlotField = (SlotME) s;
|
||||||
|
myStack = theSlotField.getAEStack();
|
||||||
|
} catch (final Throwable ignore) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (myStack != null) {
|
||||||
|
if (myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged())) {
|
||||||
|
final String local = ButtonToolTips.ItemsStored.getLocal();
|
||||||
|
final String formattedAmount =
|
||||||
|
NumberFormat.getNumberInstance(Locale.US).format(myStack.getStackSize());
|
||||||
|
final String format = String.format(local, formattedAmount);
|
||||||
|
|
||||||
|
currentToolTip.add("\u00a77" + format);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (myStack.getCountRequestable() > 0) {
|
||||||
|
final String local = ButtonToolTips.ItemsRequestable.getLocal();
|
||||||
|
final String formattedAmount =
|
||||||
|
NumberFormat.getNumberInstance(Locale.US).format(myStack.getCountRequestable());
|
||||||
|
final String format = String.format(local, formattedAmount);
|
||||||
|
|
||||||
|
currentToolTip.add("\u00a77" + format);
|
||||||
|
}
|
||||||
|
} else if (stack.stackSize > BigNumber || (stack.stackSize > 1 && stack.isItemDamaged())) {
|
||||||
|
final String local = ButtonToolTips.ItemsStored.getLocal();
|
||||||
|
final String formattedAmount =
|
||||||
|
NumberFormat.getNumberInstance(Locale.US).format(stack.stackSize);
|
||||||
|
final String format = String.format(local, formattedAmount);
|
||||||
|
|
||||||
|
currentToolTip.add("\u00a77" + format);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return currentToolTip;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
|
@Override
|
||||||
|
protected void renderToolTip(final ItemStack stack, final int x, final int y) {
|
||||||
|
final Slot s = this.getSlot(x, y);
|
||||||
|
if (s instanceof SlotME && stack != null) {
|
||||||
|
final int BigNumber = AEConfig.instance.useTerminalUseLargeFont() ? 999 : 9999;
|
||||||
|
|
||||||
|
IAEItemStack myStack = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
final SlotME theSlotField = (SlotME) s;
|
||||||
|
myStack = theSlotField.getAEStack();
|
||||||
|
} catch (final Throwable ignore) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (myStack != null) {
|
||||||
|
final List<String> currentToolTip =
|
||||||
|
stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||||
|
|
||||||
|
if (myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged())) {
|
||||||
|
currentToolTip.add("Items Stored: "
|
||||||
|
+ NumberFormat.getNumberInstance(Locale.US).format(myStack.getStackSize()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (myStack.getCountRequestable() > 0) {
|
||||||
|
currentToolTip.add("Items Requestable: "
|
||||||
|
+ NumberFormat.getNumberInstance(Locale.US).format(myStack.getCountRequestable()));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.drawTooltip(x, y, 0, join(currentToolTip, "\n"));
|
||||||
|
} else if (stack.stackSize > BigNumber) {
|
||||||
|
final List var4 = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||||
|
var4.add("Items Stored: "
|
||||||
|
+ NumberFormat.getNumberInstance(Locale.US).format(stack.stackSize));
|
||||||
|
this.drawTooltip(x, y, 0, join(var4, "\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.renderToolTip(stack, x, y);
|
||||||
|
// super.drawItemStackTooltip( stack, x, y );
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
@Override
|
||||||
|
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {
|
||||||
|
if (this.SortByBox != null) {
|
||||||
|
this.SortByBox.set(this.configSrc.getSetting(Settings.SORT_BY));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.SortDirBox != null) {
|
||||||
|
this.SortDirBox.set(this.configSrc.getSetting(Settings.SORT_DIRECTION));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.ViewBox != null) {
|
||||||
|
this.ViewBox.set(this.configSrc.getSetting(Settings.VIEW_MODE));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.repo.updateView();
|
||||||
|
this.setScrollBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCustomSortOrder() {
|
||||||
|
return this.customSortOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setCustomSortOrder(final boolean customSortOrder) {
|
||||||
|
this.customSortOrder = customSortOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
@Override
|
||||||
|
public Enum getSortBy() {
|
||||||
|
return this.configSrc.getSetting(Settings.SORT_BY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
@Override
|
||||||
|
public Enum getSortDir() {
|
||||||
|
return this.configSrc.getSetting(Settings.SORT_DIRECTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
@Override
|
||||||
|
public Enum getSortDisplay() {
|
||||||
|
return this.configSrc.getSetting(Settings.VIEW_MODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isOverSearchField(int x, int y) {
|
||||||
|
return searchField.isMouseIn(x - guiLeft, y - guiTop);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSearchString(String memoryText) {
|
||||||
|
this.searchField.setText(memoryText);
|
||||||
|
this.repo.setSearchString(memoryText);
|
||||||
|
this.repo.updateView();
|
||||||
|
this.setScrollBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("SameParameterValue")
|
||||||
|
protected boolean isPointInRegion(int rectX, int rectY, int rectWidth, int rectHeight, int pointX, int pointY) {
|
||||||
|
int i = this.guiLeft;
|
||||||
|
int j = this.guiTop;
|
||||||
|
pointX -= i;
|
||||||
|
pointY -= j;
|
||||||
|
return pointX >= rectX - 1
|
||||||
|
&& pointX < rectX + rectWidth + 1
|
||||||
|
&& pointY >= rectY - 1
|
||||||
|
&& pointY < rectY + rectHeight + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isNEIFocused() {
|
||||||
|
if (!Loader.isModLoaded("NotEnoughItems")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
final Class<? super Object> c =
|
||||||
|
ReflectionHelper.getClass(this.getClass().getClassLoader(), "codechicken.nei.LayoutManager");
|
||||||
|
final Field fldSearchField = c.getField("searchField");
|
||||||
|
final TextField searchField = (TextField) fldSearchField.get(c);
|
||||||
|
return searchField.focused();
|
||||||
|
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// MouseTweaks compat
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "MouseTweaks")
|
||||||
|
public int getAPIVersion() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "MouseTweaks")
|
||||||
|
public String getModName() {
|
||||||
|
return Reference.NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "MouseTweaks")
|
||||||
|
public boolean isMouseTweaksDisabled() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "MouseTweaks")
|
||||||
|
public boolean isWheelTweakDisabled() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "MouseTweaks")
|
||||||
|
public boolean isCraftingOutputSlot(Object modContainer, Object slot) {
|
||||||
|
return slot == containerWCT.getSlot(ContainerWirelessCraftingTerminal.CRAFT_RESULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "MouseTweaks")
|
||||||
|
public Object getModContainer() {
|
||||||
|
return containerWCT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "MouseTweaks")
|
||||||
|
public int getModSlotCount(Object modContainer) {
|
||||||
|
return containerWCT.inventorySlots.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "MouseTweaks")
|
||||||
|
public Object getModSlot(Object modContainer, int slotNumber) {
|
||||||
|
return slotNumber < containerWCT.inventorySlots.size() ? containerWCT.inventorySlots.get(slotNumber) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "MouseTweaks")
|
||||||
|
public Object getModSelectedSlot(Object modContainer, int slotCount) {
|
||||||
|
Slot s = getSlot(currentMouseX, currentMouseY);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "MouseTweaks")
|
||||||
|
public void clickModSlot(Object modContainer, Object slotO, int mouseButton, boolean shiftPressed) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "MouseTweaks")
|
||||||
|
public void disableRMBDragIfRequired(Object modContainer, Object firstSlot, boolean shouldClick) {}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,15 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.client.gui;
|
package net.p455w0rd.wirelesscraftingterminal.client.gui;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.config.GuiConfig;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraftforge.common.config.ConfigElement;
|
import net.minecraftforge.common.config.ConfigElement;
|
||||||
import net.minecraftforge.common.config.Configuration;
|
import net.minecraftforge.common.config.Configuration;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.handlers.ConfigHandler;
|
import net.p455w0rd.wirelesscraftingterminal.handlers.ConfigHandler;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
import cpw.mods.fml.client.config.GuiConfig;
|
|
||||||
|
|
||||||
public class WCTGuiConfig extends GuiConfig {
|
public class WCTGuiConfig extends GuiConfig {
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public WCTGuiConfig(GuiScreen guiScreen) {
|
public WCTGuiConfig(GuiScreen guiScreen) {
|
||||||
super(
|
super(
|
||||||
guiScreen,
|
guiScreen,
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.client.gui;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
|
|
||||||
|
|
||||||
import appeng.container.PrimaryGui;
|
|
||||||
|
|
||||||
public class WCTPrimaryGui extends PrimaryGui {
|
|
||||||
|
|
||||||
public WCTPrimaryGui(Object gui, ItemStack guiIcon, TileEntity te, ForgeDirection side) {
|
|
||||||
super(gui, guiIcon, te, side);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void open(EntityPlayer player) {
|
|
||||||
WCTGuiHandler.launchGui(
|
|
||||||
(int) this.gui,
|
|
||||||
player,
|
|
||||||
player.worldObj,
|
|
||||||
(int) player.posX,
|
|
||||||
(int) player.posY,
|
|
||||||
(int) player.posZ);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+4
-9
@@ -1,15 +1,13 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.client.gui.widgets;
|
package net.p455w0rd.wirelesscraftingterminal.client.gui.widgets;
|
||||||
|
|
||||||
|
import appeng.client.gui.widgets.ITooltip;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import appeng.client.gui.widgets.ITooltip;
|
|
||||||
|
|
||||||
public class GuiTrashButton extends GuiButton implements ITooltip {
|
public class GuiTrashButton extends GuiButton implements ITooltip {
|
||||||
|
|
||||||
public GuiTrashButton(int x, int y) {
|
public GuiTrashButton(int x, int y) {
|
||||||
@@ -28,7 +26,8 @@ public class GuiTrashButton extends GuiButton implements ITooltip {
|
|||||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
mc.renderEngine.bindTexture(new ResourceLocation("appliedenergistics2", "textures/guis/states.png"));
|
mc.renderEngine.bindTexture(new ResourceLocation("appliedenergistics2", "textures/guis/states.png"));
|
||||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
|
this.field_146123_n = par2 >= this.xPosition
|
||||||
|
&& par3 >= this.yPosition
|
||||||
&& par2 < this.xPosition + this.width
|
&& par2 < this.xPosition + this.width
|
||||||
&& par3 < this.yPosition + this.height;
|
&& par3 < this.yPosition + this.height;
|
||||||
this.drawTexturedModalRect(0, 0, 256 - 16, 256 - 16, 16, 16);
|
this.drawTexturedModalRect(0, 0, 256 - 16, 256 - 16, 16, 16);
|
||||||
@@ -40,11 +39,7 @@ public class GuiTrashButton extends GuiButton implements ITooltip {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return EnumChatFormatting.WHITE + ""
|
return EnumChatFormatting.WHITE + "" + LocaleHandler.EmptyTrash.getLocal() + "\n" + EnumChatFormatting.GRAY + ""
|
||||||
+ LocaleHandler.EmptyTrash.getLocal()
|
|
||||||
+ "\n"
|
|
||||||
+ EnumChatFormatting.GRAY
|
|
||||||
+ ""
|
|
||||||
+ LocaleHandler.EmptyTrashDesc.getLocal();
|
+ LocaleHandler.EmptyTrashDesc.getLocal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-13
@@ -5,21 +5,19 @@ import net.minecraft.client.gui.FontRenderer;
|
|||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.renderer.OpenGlHelper;
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
public class WCTGuiButton extends GuiButton {
|
public class WCTGuiButton extends GuiButton {
|
||||||
|
|
||||||
protected static final ResourceLocation buttonTextures = new ResourceLocation(
|
protected static final ResourceLocation buttonTextures =
|
||||||
"minecraft",
|
new ResourceLocation("minecraft", "textures/gui/widgets.png");
|
||||||
"textures/gui/widgets.png");
|
|
||||||
|
|
||||||
public WCTGuiButton(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_, String p_i1020_4_) {
|
public WCTGuiButton(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_, String p_i1020_4_) {
|
||||||
this(p_i1020_1_, p_i1020_2_, p_i1020_3_, 200, 20, p_i1020_4_);
|
this(p_i1020_1_, p_i1020_2_, p_i1020_3_, 200, 20, p_i1020_4_);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WCTGuiButton(int p_i1021_1_, int p_i1021_2_, int p_i1021_3_, int p_i1021_4_, int p_i1021_5_,
|
public WCTGuiButton(
|
||||||
String p_i1021_6_) {
|
int p_i1021_1_, int p_i1021_2_, int p_i1021_3_, int p_i1021_4_, int p_i1021_5_, String p_i1021_6_) {
|
||||||
super(p_i1021_1_, p_i1021_2_, p_i1021_3_, p_i1021_4_, p_i1021_5_, p_i1021_6_);
|
super(p_i1021_1_, p_i1021_2_, p_i1021_3_, p_i1021_4_, p_i1021_5_, p_i1021_6_);
|
||||||
this.width = 200;
|
this.width = 200;
|
||||||
this.height = 20;
|
this.height = 20;
|
||||||
@@ -39,7 +37,8 @@ public class WCTGuiButton extends GuiButton {
|
|||||||
FontRenderer fontrenderer = p_146112_1_.fontRenderer;
|
FontRenderer fontrenderer = p_146112_1_.fontRenderer;
|
||||||
p_146112_1_.getTextureManager().bindTexture(buttonTextures);
|
p_146112_1_.getTextureManager().bindTexture(buttonTextures);
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition
|
this.field_146123_n = p_146112_2_ >= this.xPosition
|
||||||
|
&& p_146112_3_ >= this.yPosition
|
||||||
&& p_146112_2_ < this.xPosition + this.width
|
&& p_146112_2_ < this.xPosition + this.width
|
||||||
&& p_146112_3_ < this.yPosition + this.height;
|
&& p_146112_3_ < this.yPosition + this.height;
|
||||||
int k = this.getHoverState(this.field_146123_n);
|
int k = this.getHoverState(this.field_146123_n);
|
||||||
@@ -63,12 +62,7 @@ public class WCTGuiButton extends GuiButton {
|
|||||||
this.width - 2,
|
this.width - 2,
|
||||||
2);
|
2);
|
||||||
this.drawTexturedModalRect(
|
this.drawTexturedModalRect(
|
||||||
this.xPosition,
|
this.xPosition, this.yPosition + (this.height - 1), 200 - this.width, 65 + k * 20, this.width, 1);
|
||||||
this.yPosition + (this.height - 1),
|
|
||||||
200 - this.width,
|
|
||||||
65 + k * 20,
|
|
||||||
this.width,
|
|
||||||
1);
|
|
||||||
this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_);
|
this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_);
|
||||||
int l = 14737632;
|
int l = 14737632;
|
||||||
|
|
||||||
|
|||||||
+15
-13
@@ -1,10 +1,9 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.client.gui.widgets;
|
package net.p455w0rd.wirelesscraftingterminal.client.gui.widgets;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
|
||||||
|
|
||||||
import cpw.mods.fml.client.config.GuiCheckBox;
|
import cpw.mods.fml.client.config.GuiCheckBox;
|
||||||
import cpw.mods.fml.client.config.GuiUtils;
|
import cpw.mods.fml.client.config.GuiUtils;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
|
||||||
public class WCTGuiCheckBox extends GuiCheckBox {
|
public class WCTGuiCheckBox extends GuiCheckBox {
|
||||||
|
|
||||||
@@ -23,7 +22,8 @@ public class WCTGuiCheckBox extends GuiCheckBox {
|
|||||||
@Override
|
@Override
|
||||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||||
if (this.visible) {
|
if (this.visible) {
|
||||||
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
|
this.field_146123_n = mouseX >= this.xPosition
|
||||||
|
&& mouseY >= this.yPosition
|
||||||
&& mouseX < this.xPosition + this.boxWidth
|
&& mouseX < this.xPosition + this.boxWidth
|
||||||
&& mouseY < this.yPosition + this.height;
|
&& mouseY < this.yPosition + this.height;
|
||||||
GuiUtils.drawContinuousTexturedBox(
|
GuiUtils.drawContinuousTexturedBox(
|
||||||
@@ -49,25 +49,27 @@ public class WCTGuiCheckBox extends GuiCheckBox {
|
|||||||
} else {
|
} else {
|
||||||
color = 4210752;
|
color = 4210752;
|
||||||
}
|
}
|
||||||
if (this.isChecked) this.drawCenteredString(
|
if (this.isChecked)
|
||||||
mc.fontRenderer,
|
this.drawCenteredString(
|
||||||
"✔",
|
mc.fontRenderer,
|
||||||
this.xPosition + (this.width - this.boxWidth) + this.boxWidth / 2 + 1,
|
"✔",
|
||||||
this.yPosition + 1,
|
this.xPosition + (this.width - this.boxWidth) + this.boxWidth / 2 + 1,
|
||||||
0x00FF00);
|
this.yPosition + 1,
|
||||||
|
0x00FF00);
|
||||||
|
|
||||||
this.drawStringNoShadow(mc.fontRenderer, displayString, xPosition, yPosition + 2, color);
|
this.drawStringNoShadow(mc.fontRenderer, displayString, xPosition, yPosition + 2, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawStringNoShadow(FontRenderer p_73731_1_, String p_73731_2_, int p_73731_3_, int p_73731_4_,
|
public void drawStringNoShadow(
|
||||||
int p_73731_5_) {
|
FontRenderer p_73731_1_, String p_73731_2_, int p_73731_3_, int p_73731_4_, int p_73731_5_) {
|
||||||
p_73731_1_.drawString(p_73731_2_, p_73731_3_, p_73731_4_, p_73731_5_);
|
p_73731_1_.drawString(p_73731_2_, p_73731_3_, p_73731_4_, p_73731_5_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mousePressed(Minecraft p_146116_1_, int p_146116_2_, int p_146116_3_) {
|
public boolean mousePressed(Minecraft p_146116_1_, int p_146116_2_, int p_146116_3_) {
|
||||||
if (this.enabled && this.visible
|
if (this.enabled
|
||||||
|
&& this.visible
|
||||||
&& p_146116_2_ >= this.xPosition
|
&& p_146116_2_ >= this.xPosition
|
||||||
&& p_146116_3_ >= this.yPosition
|
&& p_146116_3_ >= this.yPosition
|
||||||
&& p_146116_2_ < this.xPosition + this.width
|
&& p_146116_2_ < this.xPosition + this.width
|
||||||
|
|||||||
@@ -1,72 +1,113 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.common;
|
package net.p455w0rd.wirelesscraftingterminal.common;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||||
|
import appeng.container.AEBaseContainer;
|
||||||
|
import appeng.container.ContainerOpenContext;
|
||||||
|
import appeng.container.implementations.ContainerCraftingStatus;
|
||||||
|
import cpw.mods.fml.common.network.IGuiHandler;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
|
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftAmount;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftingStatus;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiMagnet;
|
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiMagnet;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal;
|
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftAmount;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerMagnet;
|
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerMagnet;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.helpers.WTCGuiObject;
|
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.container.AEBaseContainer;
|
|
||||||
import appeng.container.ContainerOpenContext;
|
|
||||||
import cpw.mods.fml.common.network.IGuiHandler;
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntObjectPair;
|
|
||||||
|
|
||||||
public class WCTGuiHandler implements IGuiHandler {
|
public class WCTGuiHandler implements IGuiHandler {
|
||||||
|
|
||||||
public void registerRenderers() {}
|
public void registerRenderers() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getServerGuiElement(int guiId, EntityPlayer player, World world, int x, int y, int z) {
|
public Object getServerGuiElement(int guiId, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance()
|
||||||
|
.registries()
|
||||||
|
.wireless()
|
||||||
|
.getWirelessTerminalHandler(RandomUtils.getWirelessTerm(player.inventory));
|
||||||
|
if (wh != null) {
|
||||||
|
final WirelessTerminalGuiObject obj = new WirelessTerminalGuiObject(
|
||||||
|
wh, RandomUtils.getWirelessTerm(player.inventory), player, world, x, y, z);
|
||||||
|
if (obj != null) {
|
||||||
|
final IPortableCell terminal = obj;
|
||||||
|
|
||||||
|
if (guiId == Reference.GUI_WCT) {
|
||||||
|
return updateGui(
|
||||||
|
new ContainerWirelessCraftingTerminal(player, player.inventory),
|
||||||
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
ForgeDirection.UNKNOWN,
|
||||||
|
obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guiId == Reference.GUI_CRAFTING_STATUS) {
|
||||||
|
return updateGui(
|
||||||
|
new ContainerCraftingStatus(player.inventory, terminal),
|
||||||
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
ForgeDirection.UNKNOWN,
|
||||||
|
obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guiId == Reference.GUI_CRAFT_AMOUNT) {
|
||||||
|
return updateGui(
|
||||||
|
new ContainerCraftAmount(player, terminal), world, x, y, z, ForgeDirection.UNKNOWN, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guiId == Reference.GUI_CRAFT_CONFIRM) {
|
||||||
|
return updateGui(
|
||||||
|
new ContainerCraftConfirm(player, terminal), world, x, y, z, ForgeDirection.UNKNOWN, obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (guiId == Reference.GUI_MAGNET) {
|
if (guiId == Reference.GUI_MAGNET) {
|
||||||
return new ContainerMagnet(player, player.inventory);
|
return new ContainerMagnet(player, player.inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance().registries().wireless()
|
return null;
|
||||||
.getWirelessTerminalHandler(RandomUtils.getWirelessTerm(player.inventory));
|
|
||||||
if (wh == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
final IntObjectPair<ItemStack> termItem = RandomUtils.getWirelessTermWithSlot(player.inventory);
|
|
||||||
final WTCGuiObject term = new WTCGuiObject(wh, termItem.second(), player, world, x, y, z, termItem.firstInt());
|
|
||||||
|
|
||||||
return switch (guiId) {
|
|
||||||
case Reference.GUI_WCT -> updateGui(
|
|
||||||
new ContainerWirelessCraftingTerminal(player.inventory, term),
|
|
||||||
world,
|
|
||||||
x,
|
|
||||||
y,
|
|
||||||
z,
|
|
||||||
ForgeDirection.UNKNOWN,
|
|
||||||
term);
|
|
||||||
default -> null;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getClientGuiElement(int guiId, EntityPlayer player, World world, int x, int y, int z) {
|
public Object getClientGuiElement(int guiId, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance().registries().wireless()
|
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance()
|
||||||
|
.registries()
|
||||||
|
.wireless()
|
||||||
.getWirelessTerminalHandler(RandomUtils.getWirelessTerm(player.inventory));
|
.getWirelessTerminalHandler(RandomUtils.getWirelessTerm(player.inventory));
|
||||||
if (wh != null && guiId == Reference.GUI_WCT) {
|
if (wh != null) {
|
||||||
final IntObjectPair<ItemStack> termItem = RandomUtils.getWirelessTermWithSlot(player.inventory);
|
final WirelessTerminalGuiObject obj = new WirelessTerminalGuiObject(
|
||||||
final WTCGuiObject obj = new WTCGuiObject(
|
wh, RandomUtils.getWirelessTerm(player.inventory), player, world, x, y, z);
|
||||||
wh,
|
if (obj != null) {
|
||||||
termItem.second(),
|
final IPortableCell terminal = obj;
|
||||||
player,
|
|
||||||
world,
|
if (guiId == Reference.GUI_WCT) {
|
||||||
x,
|
return new GuiWirelessCraftingTerminal(
|
||||||
y,
|
new ContainerWirelessCraftingTerminal(player, player.inventory));
|
||||||
z,
|
}
|
||||||
termItem.firstInt());
|
|
||||||
return new GuiWirelessCraftingTerminal(player.inventory, obj);
|
if (guiId == Reference.GUI_CRAFTING_STATUS) {
|
||||||
|
return new GuiCraftingStatus(player.inventory, terminal);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guiId == Reference.GUI_CRAFT_AMOUNT) {
|
||||||
|
return new GuiCraftAmount(player.inventory, terminal);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guiId == Reference.GUI_CRAFT_CONFIRM) {
|
||||||
|
return new GuiCraftConfirm(player.inventory, terminal);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (guiId == Reference.GUI_MAGNET) {
|
if (guiId == Reference.GUI_MAGNET) {
|
||||||
return new GuiMagnet(new ContainerMagnet(player, player.inventory));
|
return new GuiMagnet(new ContainerMagnet(player, player.inventory));
|
||||||
@@ -75,13 +116,19 @@ public class WCTGuiHandler implements IGuiHandler {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void launchGui(final int ID, final EntityPlayer player, final World world, final int x, final int y,
|
public static void launchGui(
|
||||||
final int z) {
|
final int ID, final EntityPlayer player, final World world, final int x, final int y, final int z) {
|
||||||
player.openGui(WirelessCraftingTerminal.INSTANCE, ID, world, x, y, z);
|
player.openGui(WirelessCraftingTerminal.INSTANCE, ID, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object updateGui(final Object newContainer, final World w, final int x, final int y, final int z,
|
private Object updateGui(
|
||||||
final ForgeDirection side, final Object myItem) {
|
final Object newContainer,
|
||||||
|
final World w,
|
||||||
|
final int x,
|
||||||
|
final int y,
|
||||||
|
final int z,
|
||||||
|
final ForgeDirection side,
|
||||||
|
final Object myItem) {
|
||||||
if (newContainer instanceof AEBaseContainer) {
|
if (newContainer instanceof AEBaseContainer) {
|
||||||
final AEBaseContainer bc = (AEBaseContainer) newContainer;
|
final AEBaseContainer bc = (AEBaseContainer) newContainer;
|
||||||
bc.setOpenContext(new ContainerOpenContext(myItem));
|
bc.setOpenContext(new ContainerOpenContext(myItem));
|
||||||
|
|||||||
+27
-31
@@ -1,8 +1,20 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.common;
|
package net.p455w0rd.wirelesscraftingterminal.common;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.features.IWirelessTermHandler;
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.LoaderState;
|
||||||
|
import cpw.mods.fml.common.Mod;
|
||||||
|
import cpw.mods.fml.common.Mod.EventHandler;
|
||||||
|
import cpw.mods.fml.common.Mod.Instance;
|
||||||
|
import cpw.mods.fml.common.SidedProxy;
|
||||||
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.creativetab.CreativeTabWCT;
|
import net.p455w0rd.wirelesscraftingterminal.creativetab.CreativeTabWCT;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.handlers.AchievementHandler;
|
import net.p455w0rd.wirelesscraftingterminal.handlers.AchievementHandler;
|
||||||
@@ -13,38 +25,18 @@ import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
|
|||||||
import net.p455w0rd.wirelesscraftingterminal.proxy.CommonProxy;
|
import net.p455w0rd.wirelesscraftingterminal.proxy.CommonProxy;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.features.IWirelessTermHandler;
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.Loader;
|
|
||||||
import cpw.mods.fml.common.LoaderState;
|
|
||||||
import cpw.mods.fml.common.Mod;
|
|
||||||
import cpw.mods.fml.common.Mod.EventHandler;
|
|
||||||
import cpw.mods.fml.common.Mod.Instance;
|
|
||||||
import cpw.mods.fml.common.SidedProxy;
|
|
||||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
|
||||||
|
|
||||||
@Mod(
|
@Mod(
|
||||||
modid = Reference.MODID,
|
modid = Reference.MODID,
|
||||||
acceptedMinecraftVersions = "[1.7.10]",
|
acceptedMinecraftVersions = "[1.7.10]",
|
||||||
name = Reference.NAME,
|
name = Reference.NAME,
|
||||||
version = Reference.VERSION,
|
version = Reference.VERSION,
|
||||||
guiFactory = Reference.GUI_FACTORY,
|
guiFactory = Reference.GUI_FACTORY,
|
||||||
dependencies = "" + "required-after:Forge@["
|
dependencies = "" + "required-after:Forge@[" + net.minecraftforge.common.ForgeVersion.majorVersion
|
||||||
+ net.minecraftforge.common.ForgeVersion.majorVersion
|
|
||||||
+ '.' // majorVersion
|
+ '.' // majorVersion
|
||||||
+ net.minecraftforge.common.ForgeVersion.minorVersion
|
+ net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion
|
||||||
+ '.' // minorVersion
|
+ net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion
|
||||||
+ net.minecraftforge.common.ForgeVersion.revisionVersion
|
+ net.minecraftforge.common.ForgeVersion.buildVersion + ",);"
|
||||||
+ '.' // revisionVersion
|
+ "required-after:appliedenergistics2@[rv3-beta-1,);after:NotEnoughItems;")
|
||||||
+ net.minecraftforge.common.ForgeVersion.buildVersion
|
|
||||||
+ ",);"
|
|
||||||
+ "required-after:"
|
|
||||||
+ "appliedenergistics2@[rv3-beta-754,);after:"
|
|
||||||
+ "NotEnoughItems;")
|
|
||||||
public class WirelessCraftingTerminal {
|
public class WirelessCraftingTerminal {
|
||||||
|
|
||||||
private static LoaderState WCTState = LoaderState.NOINIT;
|
private static LoaderState WCTState = LoaderState.NOINIT;
|
||||||
@@ -58,32 +50,36 @@ public class WirelessCraftingTerminal {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
|
long stopwatch = WCTLog.beginSection("PreInit");
|
||||||
WirelessCraftingTerminal.WCTState = LoaderState.PREINITIALIZATION;
|
WirelessCraftingTerminal.WCTState = LoaderState.PREINITIALIZATION;
|
||||||
WirelessCraftingTerminal.INSTANCE = this;
|
WirelessCraftingTerminal.INSTANCE = this;
|
||||||
creativeTab = new CreativeTabWCT(CreativeTabs.getNextID(), Reference.MODID).setNoScrollbar();
|
creativeTab = new CreativeTabWCT(CreativeTabs.getNextID(), Reference.MODID).setNoScrollbar();
|
||||||
WirelessCraftingTerminal.proxy.registerItems();
|
WirelessCraftingTerminal.proxy.registerItems();
|
||||||
ConfigHandler.init(new File(event.getModConfigurationDirectory(), Reference.CONFIG_FILE));
|
ConfigHandler.init(new File(event.getModConfigurationDirectory(), Reference.CONFIG_FILE));
|
||||||
FMLCommonHandler.instance().bus().register(proxy);
|
FMLCommonHandler.instance().bus().register(proxy);
|
||||||
AEApi.instance().registries().wireless()
|
AEApi.instance().registries().wireless().registerWirelessHandler((IWirelessTermHandler)
|
||||||
.registerWirelessHandler((IWirelessTermHandler) ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem());
|
ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem());
|
||||||
|
WCTLog.endSection("PreInit", stopwatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void init(FMLInitializationEvent event) {
|
public void init(FMLInitializationEvent event) {
|
||||||
|
long stopwatch = WCTLog.beginSection("Init");
|
||||||
IntegrationRegistry.INSTANCE.init();
|
IntegrationRegistry.INSTANCE.init();
|
||||||
WirelessCraftingTerminal.WCTState = LoaderState.INITIALIZATION;
|
WirelessCraftingTerminal.WCTState = LoaderState.INITIALIZATION;
|
||||||
if (!Loader.isModLoaded("dreamcraft")) {
|
RecipeHandler.loadRecipes(!Reference.WCT_MINETWEAKER_OVERRIDE);
|
||||||
RecipeHandler.loadRecipes(!Reference.WCT_MINETWEAKER_OVERRIDE);
|
|
||||||
}
|
|
||||||
AchievementHandler.init();
|
AchievementHandler.init();
|
||||||
|
WCTLog.endSection("Init", stopwatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void postInit(final FMLPostInitializationEvent event) {
|
public void postInit(final FMLPostInitializationEvent event) {
|
||||||
|
long stopwatch = WCTLog.beginSection("PostInit");
|
||||||
IntegrationRegistry.INSTANCE.postInit();
|
IntegrationRegistry.INSTANCE.postInit();
|
||||||
NetworkRegistry.INSTANCE.registerGuiHandler(WirelessCraftingTerminal.INSTANCE, new WCTGuiHandler());
|
NetworkRegistry.INSTANCE.registerGuiHandler(WirelessCraftingTerminal.INSTANCE, new WCTGuiHandler());
|
||||||
NetworkHandler.instance = new NetworkHandler("WCT");
|
NetworkHandler.instance = new NetworkHandler("WCT");
|
||||||
WirelessCraftingTerminal.proxy.removeItemsFromNEI();
|
WirelessCraftingTerminal.proxy.removeItemsFromNEI();
|
||||||
|
WCTLog.endSection("PostInit", stopwatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LoaderState getLoaderState() {
|
public static LoaderState getLoaderState() {
|
||||||
|
|||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
package net.p455w0rd.wirelesscraftingterminal.common.container;
|
||||||
|
|
||||||
|
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
|
public class ContainerCraftAmount extends appeng.container.implementations.ContainerCraftAmount {
|
||||||
|
public ContainerCraftAmount(EntityPlayer player, IPortableCell terminal) {
|
||||||
|
super(player.inventory, terminal);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openConfirmationGUI(EntityPlayer player, TileEntity te) {
|
||||||
|
int x = (int) player.posX;
|
||||||
|
int y = (int) player.posY;
|
||||||
|
int z = (int) player.posZ;
|
||||||
|
WCTGuiHandler.launchGui(Reference.GUI_CRAFT_CONFIRM, player, player.worldObj, x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package net.p455w0rd.wirelesscraftingterminal.common.container;
|
||||||
|
|
||||||
|
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
|
public class ContainerCraftConfirm extends appeng.container.implementations.ContainerCraftConfirm {
|
||||||
|
private final EntityPlayer player;
|
||||||
|
|
||||||
|
public ContainerCraftConfirm(EntityPlayer player, IPortableCell terminal) {
|
||||||
|
super(player.inventory, terminal);
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void switchToOriginalGUI() {
|
||||||
|
int x = (int) player.posX;
|
||||||
|
int y = (int) player.posY;
|
||||||
|
int z = (int) player.posZ;
|
||||||
|
WCTGuiHandler.launchGui(Reference.GUI_WCT, player, player.worldObj, x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
-15
@@ -3,7 +3,6 @@ package net.p455w0rd.wirelesscraftingterminal.common.container;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@@ -26,7 +25,11 @@ public class ContainerMagnet extends Container {
|
|||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private final Set distributeSlotSet = new HashSet();
|
private final Set distributeSlotSet = new HashSet();
|
||||||
|
|
||||||
private final int PLAYER_INV_START = 0, PLAYER_INV_END = 26, HOTBAR_START = 27, HOTBAR_END = 35, FILTERS_START = 36,
|
private final int PLAYER_INV_START = 0,
|
||||||
|
PLAYER_INV_END = 26,
|
||||||
|
HOTBAR_START = 27,
|
||||||
|
HOTBAR_END = 35,
|
||||||
|
FILTERS_START = 36,
|
||||||
FILTERS_END = 62;
|
FILTERS_END = 62;
|
||||||
|
|
||||||
public ContainerMagnet(EntityPlayer player, InventoryPlayer inventoryPlayer) {
|
public ContainerMagnet(EntityPlayer player, InventoryPlayer inventoryPlayer) {
|
||||||
@@ -81,7 +84,7 @@ public class ContainerMagnet extends Container {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
@Override
|
@Override
|
||||||
public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player) {
|
public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player) {
|
||||||
if (slotNum >= this.inventorySlots.size()) {
|
if (slotNum >= this.inventorySlots.size()) {
|
||||||
@@ -100,7 +103,8 @@ public class ContainerMagnet extends Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mouseButton == 1) {
|
if (mouseButton == 1) {
|
||||||
player.dropPlayerItemWithRandomChoice(inventoryplayer.getItemStack().splitStack(1), true);
|
player.dropPlayerItemWithRandomChoice(
|
||||||
|
inventoryplayer.getItemStack().splitStack(1), true);
|
||||||
|
|
||||||
if (inventoryplayer.getItemStack().stackSize == 0) {
|
if (inventoryplayer.getItemStack().stackSize == 0) {
|
||||||
inventoryplayer.setItemStack((ItemStack) null);
|
inventoryplayer.setItemStack((ItemStack) null);
|
||||||
@@ -113,7 +117,7 @@ public class ContainerMagnet extends Container {
|
|||||||
// Click+drag stack
|
// Click+drag stack
|
||||||
else if (modifier == 5) {
|
else if (modifier == 5) {
|
||||||
// if (isInFilters(slotNum)) {
|
// if (isInFilters(slotNum)) {
|
||||||
// return null;
|
// return null;
|
||||||
// }
|
// }
|
||||||
int currentDistributeState = this.distributeState;
|
int currentDistributeState = this.distributeState;
|
||||||
this.distributeState = checkForPressedButton(mouseButton);
|
this.distributeState = checkForPressedButton(mouseButton);
|
||||||
@@ -135,7 +139,8 @@ public class ContainerMagnet extends Container {
|
|||||||
} else if (this.distributeState == 1) {
|
} else if (this.distributeState == 1) {
|
||||||
Slot slot = (Slot) this.inventorySlots.get(slotNum);
|
Slot slot = (Slot) this.inventorySlots.get(slotNum);
|
||||||
|
|
||||||
if (slot != null && stackFitsInSlot(slot, inventoryplayer.getItemStack(), true)
|
if (slot != null
|
||||||
|
&& stackFitsInSlot(slot, inventoryplayer.getItemStack(), true)
|
||||||
&& slot.isItemValid(inventoryplayer.getItemStack())
|
&& slot.isItemValid(inventoryplayer.getItemStack())
|
||||||
&& inventoryplayer.getItemStack().stackSize > this.distributeSlotSet.size()
|
&& inventoryplayer.getItemStack().stackSize > this.distributeSlotSet.size()
|
||||||
&& this.canDragIntoSlot(slot)) {
|
&& this.canDragIntoSlot(slot)) {
|
||||||
@@ -150,7 +155,8 @@ public class ContainerMagnet extends Container {
|
|||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Slot slot1 = (Slot) iterator.next();
|
Slot slot1 = (Slot) iterator.next();
|
||||||
|
|
||||||
if (slot1 != null && stackFitsInSlot(slot1, inventoryplayer.getItemStack(), true)
|
if (slot1 != null
|
||||||
|
&& stackFitsInSlot(slot1, inventoryplayer.getItemStack(), true)
|
||||||
&& slot1.isItemValid(inventoryplayer.getItemStack())
|
&& slot1.isItemValid(inventoryplayer.getItemStack())
|
||||||
&& inventoryplayer.getItemStack().stackSize >= this.distributeSlotSet.size()
|
&& inventoryplayer.getItemStack().stackSize >= this.distributeSlotSet.size()
|
||||||
&& this.canDragIntoSlot(slot1)) {
|
&& this.canDragIntoSlot(slot1)) {
|
||||||
@@ -231,12 +237,12 @@ public class ContainerMagnet extends Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public static void setSlotStack(Set slotSet, int stackSizeSelector, ItemStack stackToResize,
|
public static void setSlotStack(
|
||||||
int currentSlotStackSize) {
|
Set slotSet, int stackSizeSelector, ItemStack stackToResize, int currentSlotStackSize) {
|
||||||
switch (stackSizeSelector) {
|
switch (stackSizeSelector) {
|
||||||
case 0:
|
case 0:
|
||||||
stackToResize.stackSize = MathHelper
|
stackToResize.stackSize =
|
||||||
.floor_float((float) stackToResize.stackSize / (float) slotSet.size());
|
MathHelper.floor_float((float) stackToResize.stackSize / (float) slotSet.size());
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
stackToResize.stackSize = 1;
|
stackToResize.stackSize = 1;
|
||||||
@@ -248,7 +254,8 @@ public class ContainerMagnet extends Container {
|
|||||||
public static boolean stackFitsInSlot(Slot slot, ItemStack itemStack, boolean sizeMatters) {
|
public static boolean stackFitsInSlot(Slot slot, ItemStack itemStack, boolean sizeMatters) {
|
||||||
boolean flag1 = slot == null || !slot.getHasStack();
|
boolean flag1 = slot == null || !slot.getHasStack();
|
||||||
|
|
||||||
if (slot != null && slot.getHasStack()
|
if (slot != null
|
||||||
|
&& slot.getHasStack()
|
||||||
&& itemStack != null
|
&& itemStack != null
|
||||||
&& itemStack.isItemEqual(slot.getStack())
|
&& itemStack.isItemEqual(slot.getStack())
|
||||||
&& ItemStack.areItemStackTagsEqual(slot.getStack(), itemStack)) {
|
&& ItemStack.areItemStackTagsEqual(slot.getStack(), itemStack)) {
|
||||||
@@ -432,7 +439,8 @@ public class ContainerMagnet extends Container {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemstack1 != null && itemstack1.getItem() == stack.getItem()
|
if (itemstack1 != null
|
||||||
|
&& itemstack1.getItem() == stack.getItem()
|
||||||
&& (!stack.getHasSubtypes() || stack.getItemDamage() == itemstack1.getItemDamage())
|
&& (!stack.getHasSubtypes() || stack.getItemDamage() == itemstack1.getItemDamage())
|
||||||
&& ItemStack.areItemStackTagsEqual(stack, itemstack1)) {
|
&& ItemStack.areItemStackTagsEqual(stack, itemstack1)) {
|
||||||
int l = itemstack1.stackSize + stack.stackSize;
|
int l = itemstack1.stackSize + stack.stackSize;
|
||||||
@@ -474,8 +482,7 @@ public class ContainerMagnet extends Container {
|
|||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
putStackInSlot(
|
putStackInSlot(
|
||||||
k,
|
k, new ItemStack(stack.getItem(), slot.getSlotStackLimit(), stack.getItemDamage()));
|
||||||
new ItemStack(stack.getItem(), slot.getSlotStackLimit(), stack.getItemDamage()));
|
|
||||||
stack.stackSize -= slot.getSlotStackLimit();
|
stack.stackSize -= slot.getSlotStackLimit();
|
||||||
magnetInventory.markDirty();
|
magnetInventory.markDirty();
|
||||||
flag1 = true;
|
flag1 = true;
|
||||||
|
|||||||
+1142
-112
File diff suppressed because it is too large.
Load diff
+10
-4
@@ -1,10 +1,9 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.common.container.slot;
|
package net.p455w0rd.wirelesscraftingterminal.common.container.slot;
|
||||||
|
|
||||||
|
import appeng.container.slot.SlotFake;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.container.slot.SlotFake;
|
|
||||||
|
|
||||||
public class OptionalSlotFake extends SlotFake {
|
public class OptionalSlotFake extends SlotFake {
|
||||||
|
|
||||||
private final int srcX;
|
private final int srcX;
|
||||||
@@ -13,8 +12,15 @@ public class OptionalSlotFake extends SlotFake {
|
|||||||
private final IOptionalSlotHost host;
|
private final IOptionalSlotHost host;
|
||||||
private boolean renderDisabled = true;
|
private boolean renderDisabled = true;
|
||||||
|
|
||||||
public OptionalSlotFake(final IInventory inv, final IOptionalSlotHost containerBus, final int idx, final int x,
|
public OptionalSlotFake(
|
||||||
final int y, final int offX, final int offY, final int groupNum) {
|
final IInventory inv,
|
||||||
|
final IOptionalSlotHost containerBus,
|
||||||
|
final int idx,
|
||||||
|
final int x,
|
||||||
|
final int y,
|
||||||
|
final int offX,
|
||||||
|
final int offY,
|
||||||
|
final int groupNum) {
|
||||||
super(inv, idx, x + offX * 18, y + offY * 18);
|
super(inv, idx, x + offX * 18, y + offY * 18);
|
||||||
this.srcX = x;
|
this.srcX = x;
|
||||||
this.srcY = y;
|
this.srcY = y;
|
||||||
|
|||||||
+5
-5
@@ -1,5 +1,7 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.common.container.slot;
|
package net.p455w0rd.wirelesscraftingterminal.common.container.slot;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
@@ -7,14 +9,12 @@ import net.minecraft.item.ItemArmor;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class SlotArmor extends appeng.container.slot.AppEngSlot {
|
public class SlotArmor extends appeng.container.slot.AppEngSlot {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The armor type that can be placed on that slot, it uses the same values of armorType field on ItemArmor. Probably
|
* The armor type that can be placed on that slot, it uses the same values
|
||||||
* could've done just as well with vanilla armor slot class. if so, this will be removed in the future.
|
* of armorType field on ItemArmor. Probably could've done just as well
|
||||||
|
* with vanilla armor slot class. if so, this will be removed in the future.
|
||||||
*/
|
*/
|
||||||
final int armorType;
|
final int armorType;
|
||||||
|
|
||||||
|
|||||||
+3
-4
@@ -1,15 +1,14 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.common.container.slot;
|
package net.p455w0rd.wirelesscraftingterminal.common.container.slot;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemBoosterBGIcon;
|
import net.p455w0rd.wirelesscraftingterminal.items.ItemBoosterBGIcon;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemInfinityBooster;
|
import net.p455w0rd.wirelesscraftingterminal.items.ItemInfinityBooster;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class SlotBooster extends appeng.container.slot.AppEngSlot {
|
public class SlotBooster extends appeng.container.slot.AppEngSlot {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+4
-7
@@ -25,11 +25,6 @@ public class SlotTrash extends appeng.container.slot.AppEngSlot {
|
|||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getDisplayStack() {
|
|
||||||
return this.getStack();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getHasStack() {
|
public boolean getHasStack() {
|
||||||
return itemStack != null;
|
return itemStack != null;
|
||||||
@@ -89,7 +84,8 @@ public class SlotTrash extends appeng.container.slot.AppEngSlot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void readNBT() {
|
public void readNBT() {
|
||||||
NBTTagCompound nbtTagCompound = RandomUtils.getWirelessTerm(entityPlayer.inventory).getTagCompound();
|
NBTTagCompound nbtTagCompound =
|
||||||
|
RandomUtils.getWirelessTerm(entityPlayer.inventory).getTagCompound();
|
||||||
NBTTagList tagList = nbtTagCompound.getTagList(this.name, 10);
|
NBTTagList tagList = nbtTagCompound.getTagList(this.name, 10);
|
||||||
NBTTagCompound tagCompound = tagList.getCompoundTagAt(0);
|
NBTTagCompound tagCompound = tagList.getCompoundTagAt(0);
|
||||||
if (tagCompound != null) {
|
if (tagCompound != null) {
|
||||||
@@ -98,7 +94,8 @@ public class SlotTrash extends appeng.container.slot.AppEngSlot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeNBT() {
|
public void writeNBT() {
|
||||||
NBTTagCompound nbtTagCompound = RandomUtils.getWirelessTerm(entityPlayer.inventory).getTagCompound();
|
NBTTagCompound nbtTagCompound =
|
||||||
|
RandomUtils.getWirelessTerm(entityPlayer.inventory).getTagCompound();
|
||||||
NBTTagList tagList = new NBTTagList();
|
NBTTagList tagList = new NBTTagList();
|
||||||
if (itemStack != null) {
|
if (itemStack != null) {
|
||||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||||
|
|||||||
+1
-2
@@ -1,10 +1,9 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.common.container.slot;
|
package net.p455w0rd.wirelesscraftingterminal.common.container.slot;
|
||||||
|
|
||||||
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
|
|
||||||
import appeng.container.slot.SlotRestrictedInput;
|
|
||||||
|
|
||||||
public class SlotViewCell extends SlotRestrictedInput {
|
public class SlotViewCell extends SlotRestrictedInput {
|
||||||
|
|
||||||
public SlotViewCell(IInventory inv, int index, int xPos, int yPos, InventoryPlayer playerInv) {
|
public SlotViewCell(IInventory inv, int index, int xPos, int yPos, InventoryPlayer playerInv) {
|
||||||
|
|||||||
+17
-12
@@ -1,18 +1,17 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.common.inventory;
|
package net.p455w0rd.wirelesscraftingterminal.common.inventory;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.inventory.Container;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagList;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTerminalItem;
|
|
||||||
|
|
||||||
import appeng.api.storage.IMEInventory;
|
import appeng.api.storage.IMEInventory;
|
||||||
import appeng.me.storage.MEIInventoryWrapper;
|
import appeng.me.storage.MEIInventoryWrapper;
|
||||||
import appeng.tile.inventory.AppEngInternalInventory;
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
import appeng.tile.inventory.IAEAppEngInventory;
|
import appeng.tile.inventory.IAEAppEngInventory;
|
||||||
import appeng.tile.inventory.InvOperation;
|
import appeng.tile.inventory.InvOperation;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTerminalItem;
|
||||||
|
|
||||||
public class WCTInventoryCrafting extends AppEngInternalInventory {
|
public class WCTInventoryCrafting extends AppEngInternalInventory {
|
||||||
|
|
||||||
@@ -134,11 +133,17 @@ public class WCTInventoryCrafting extends AppEngInternalInventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @Override public ItemStack decrStackSize(int slot, int amount) { if (this.stackList[slot] != null) { ItemStack
|
* @Override public ItemStack decrStackSize(int slot, int amount) { if
|
||||||
* itemstack; if (this.stackList[slot].stackSize <= amount) { itemstack = this.stackList[slot]; this.stackList[slot]
|
* (this.stackList[slot] != null) { ItemStack itemstack; if
|
||||||
* = null; this.eventHandler.onCraftMatrixChanged(this); return itemstack; } else { itemstack =
|
* (this.stackList[slot].stackSize <= amount) { itemstack =
|
||||||
* this.stackList[slot].splitStack(amount); if (this.stackList[slot].stackSize == 0) { this.stackList[slot] = null;
|
* this.stackList[slot]; this.stackList[slot] = null;
|
||||||
* } this.eventHandler.onCraftMatrixChanged(this); return itemstack; } } else { return getStackInSlot(slot); } }
|
* this.eventHandler.onCraftMatrixChanged(this); return itemstack; } else {
|
||||||
|
* itemstack = this.stackList[slot].splitStack(amount);
|
||||||
|
*
|
||||||
|
* if (this.stackList[slot].stackSize == 0) { this.stackList[slot] = null; }
|
||||||
|
*
|
||||||
|
* this.eventHandler.onCraftMatrixChanged(this); return itemstack; } } else
|
||||||
|
* { return getStackInSlot(slot); } }
|
||||||
*/
|
*/
|
||||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||||
this.stackList[slot] = stack;
|
this.stackList[slot] = stack;
|
||||||
|
|||||||
+1
-2
@@ -1,13 +1,12 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.common.inventory;
|
package net.p455w0rd.wirelesscraftingterminal.common.inventory;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
|
|
||||||
public class WCTInventoryViewCell implements IInventory {
|
public class WCTInventoryViewCell implements IInventory {
|
||||||
|
|
||||||
private final String name = "ViewCells";
|
private final String name = "ViewCells";
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.common.utils;
|
package net.p455w0rd.wirelesscraftingterminal.common.utils;
|
||||||
|
|
||||||
import static appeng.util.Platform.baublesSlotsOffset;
|
import baubles.api.BaublesApi;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -11,17 +12,8 @@ import net.minecraft.util.EnumChatFormatting;
|
|||||||
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTerminalItem;
|
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTerminalItem;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
|
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
|
||||||
|
|
||||||
import baubles.api.BaublesApi;
|
|
||||||
import cpw.mods.fml.common.Loader;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntObjectImmutablePair;
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntObjectPair;
|
|
||||||
|
|
||||||
public class RandomUtils {
|
public class RandomUtils {
|
||||||
|
|
||||||
public static boolean isBaublesLoaded = Loader.isModLoaded("Baubles");
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public static String color(String color) {
|
public static String color(String color) {
|
||||||
switch (color) {
|
switch (color) {
|
||||||
@@ -69,72 +61,27 @@ public class RandomUtils {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
IInventory handler = BaublesApi.getBaubles(playerInv.player);
|
||||||
if (isBaublesLoaded) {
|
if (handler != null) {
|
||||||
IInventory handler = BaublesApi.getBaubles(playerInv.player);
|
invSize = handler.getSizeInventory();
|
||||||
if (handler != null) {
|
for (int i = 0; i < invSize; ++i) {
|
||||||
invSize = handler.getSizeInventory();
|
ItemStack item = handler.getStackInSlot(i);
|
||||||
for (int i = 0; i < invSize; ++i) {
|
if (item == null) {
|
||||||
ItemStack item = handler.getStackInSlot(i);
|
continue;
|
||||||
if (item == null) {
|
}
|
||||||
continue;
|
if (item.getItem() instanceof IWirelessCraftingTerminalItem) {
|
||||||
}
|
wirelessTerm = item;
|
||||||
if (item.getItem() instanceof IWirelessCraftingTerminalItem) {
|
break;
|
||||||
wirelessTerm = item;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return wirelessTerm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IntObjectPair<ItemStack> getWirelessTermWithSlot(InventoryPlayer playerInv) {
|
|
||||||
if (playerInv.player.getHeldItem() != null
|
|
||||||
&& playerInv.player.getHeldItem().getItem() instanceof IWirelessCraftingTerminalItem) {
|
|
||||||
return new IntObjectImmutablePair<>(playerInv.player.inventory.currentItem, playerInv.player.getHeldItem());
|
|
||||||
}
|
|
||||||
IntObjectPair<ItemStack> wirelessTerm = null;
|
|
||||||
|
|
||||||
int invSize = playerInv.getSizeInventory();
|
|
||||||
if (invSize <= 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < invSize; ++i) {
|
|
||||||
ItemStack item = playerInv.getStackInSlot(i);
|
|
||||||
if (item == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (item.getItem() instanceof IWirelessCraftingTerminalItem) {
|
|
||||||
wirelessTerm = new IntObjectImmutablePair<>(i, item);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isBaublesLoaded) {
|
|
||||||
IInventory handler = BaublesApi.getBaubles(playerInv.player);
|
|
||||||
if (handler != null) {
|
|
||||||
invSize = handler.getSizeInventory();
|
|
||||||
for (int i = 0; i < invSize; ++i) {
|
|
||||||
ItemStack item = handler.getStackInSlot(i);
|
|
||||||
if (item == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (item.getItem() instanceof IWirelessCraftingTerminalItem) {
|
|
||||||
wirelessTerm = new IntObjectImmutablePair<>(i + baublesSlotsOffset, item);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return wirelessTerm;
|
return wirelessTerm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getMagnet(InventoryPlayer playerInv) {
|
public static ItemStack getMagnet(InventoryPlayer playerInv) {
|
||||||
// Is player holding a Magnet Card?
|
// Is player holding a Magnet Card?
|
||||||
if (playerInv.player.getHeldItem() != null && playerInv.player.getHeldItem().getItem() instanceof ItemMagnet) {
|
if (playerInv.player.getHeldItem() != null
|
||||||
|
&& playerInv.player.getHeldItem().getItem() instanceof ItemMagnet) {
|
||||||
return playerInv.player.getHeldItem();
|
return playerInv.player.getHeldItem();
|
||||||
}
|
}
|
||||||
// if not true, try to return first magnet card from first
|
// if not true, try to return first magnet card from first
|
||||||
@@ -182,7 +129,9 @@ public class RandomUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isMagnetInstalled(InventoryPlayer ip) {
|
public static boolean isMagnetInstalled(InventoryPlayer ip) {
|
||||||
NBTTagCompound magnetNBTForm = RandomUtils.getWirelessTerm(ip).getTagCompound().getTagList("MagnetSlot", 10)
|
NBTTagCompound magnetNBTForm = RandomUtils.getWirelessTerm(ip)
|
||||||
|
.getTagCompound()
|
||||||
|
.getTagList("MagnetSlot", 10)
|
||||||
.getCompoundTagAt(0);
|
.getCompoundTagAt(0);
|
||||||
if (magnetNBTForm != null) {
|
if (magnetNBTForm != null) {
|
||||||
ItemStack magnetItem = ItemStack.loadItemStackFromNBT(magnetNBTForm);
|
ItemStack magnetItem = ItemStack.loadItemStackFromNBT(magnetNBTForm);
|
||||||
|
|||||||
@@ -1,23 +1,44 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.common.utils;
|
package net.p455w0rd.wirelesscraftingterminal.common.utils;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
public class WCTLog {
|
public class WCTLog {
|
||||||
|
|
||||||
public static final Logger log = LogManager.getLogger("Wireless Crafting Terminal");
|
public static final Logger log = LogManager.getLogger("Wireless Crafting Terminal");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the section header.
|
||||||
|
*/
|
||||||
|
public static long beginSection(final String section) {
|
||||||
|
log.info(String.format("-=-=-=-=-=-=-=[START] %s=-=-=-=-=-=-=-", section));
|
||||||
|
return System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs a debug statement.
|
* Logs a debug statement.
|
||||||
|
*
|
||||||
|
* @param format
|
||||||
|
* @param data
|
||||||
*/
|
*/
|
||||||
public static void debug(final String format, final Object... data) {
|
public static void debug(final String format, final Object... data) {
|
||||||
log.debug(String.format(format, data));
|
log.debug(String.format(format, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the section footer.
|
||||||
|
*/
|
||||||
|
public static void endSection(final String section, final long sectionStartTime) {
|
||||||
|
log.info(String.format(
|
||||||
|
"-=-=-=-=-=-=-=[FINISH] %s in %dms=-=-=-=-=-=-=-",
|
||||||
|
section, (System.currentTimeMillis() - sectionStartTime)));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs basic info.
|
* Logs basic info.
|
||||||
|
*
|
||||||
|
* @param format
|
||||||
|
* @param data
|
||||||
*/
|
*/
|
||||||
public static void info(final String format, final Object... data) {
|
public static void info(final String format, final Object... data) {
|
||||||
log.info(String.format(format, data));
|
log.info(String.format(format, data));
|
||||||
@@ -25,6 +46,9 @@ public class WCTLog {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs an error.
|
* Logs an error.
|
||||||
|
*
|
||||||
|
* @param format
|
||||||
|
* @param data
|
||||||
*/
|
*/
|
||||||
public static void severe(final String format, final Object... data) {
|
public static void severe(final String format, final Object... data) {
|
||||||
log.error(String.format(format, data));
|
log.error(String.format(format, data));
|
||||||
@@ -32,6 +56,9 @@ public class WCTLog {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs a warning.
|
* Logs a warning.
|
||||||
|
*
|
||||||
|
* @param format
|
||||||
|
* @param data
|
||||||
*/
|
*/
|
||||||
public static void warning(final String format, final Object... data) {
|
public static void warning(final String format, final Object... data) {
|
||||||
log.warn(String.format(format, data));
|
log.warn(String.format(format, data));
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.core.sync;
|
package net.p455w0rd.wirelesscraftingterminal.core.sync;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
||||||
|
|
||||||
public abstract class WCTPacket {
|
public abstract class WCTPacket {
|
||||||
|
|
||||||
|
|||||||
+23
-10
@@ -1,31 +1,40 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.core.sync;
|
package net.p455w0rd.wirelesscraftingterminal.core.sync;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.handler.codec.DecoderException;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketConfigSync;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketConfigSync;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketCraftRequest;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketEmptyTrash;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketEmptyTrash;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketInventoryAction;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketInventoryAction;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMEInventoryUpdate;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMagnetFilter;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMagnetFilter;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketNEIRecipe;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketNEIRecipe;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketOpenGui;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketOpenGui;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSetMagnet;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSetMagnet;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis;
|
||||||
import io.netty.buffer.ByteBuf;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
|
||||||
import io.netty.handler.codec.DecoderException;
|
|
||||||
|
|
||||||
public class WCTPacketHandlerBase {
|
public class WCTPacketHandlerBase {
|
||||||
|
private static final Map<Class<? extends WCTPacket>, PacketTypes> REVERSE_LOOKUP =
|
||||||
private static final Map<Class<? extends WCTPacket>, PacketTypes> REVERSE_LOOKUP = new HashMap<Class<? extends WCTPacket>, WCTPacketHandlerBase.PacketTypes>();
|
new HashMap<Class<? extends WCTPacket>, WCTPacketHandlerBase.PacketTypes>();
|
||||||
|
|
||||||
public enum PacketTypes {
|
public enum PacketTypes {
|
||||||
|
|
||||||
PACKET_INVENTORY_ACTION(PacketInventoryAction.class),
|
PACKET_INVENTORY_ACTION(PacketInventoryAction.class),
|
||||||
|
|
||||||
|
PACKET_ME_INVENTORY_UPDATE(PacketMEInventoryUpdate.class),
|
||||||
|
|
||||||
|
PACKET_VALUE_CONFIG(PacketValueConfig.class),
|
||||||
|
|
||||||
|
PACKET_SWITCH_GUIS(PacketSwitchGuis.class),
|
||||||
|
|
||||||
PACKET_RECIPE_NEI(PacketNEIRecipe.class),
|
PACKET_RECIPE_NEI(PacketNEIRecipe.class),
|
||||||
|
|
||||||
|
PACKET_CRAFTING_REQUEST(PacketCraftRequest.class),
|
||||||
|
|
||||||
PACKET_MAGNETFILTER_MODE(PacketMagnetFilter.class),
|
PACKET_MAGNETFILTER_MODE(PacketMagnetFilter.class),
|
||||||
|
|
||||||
PACKET_OPENWIRELESSTERM(PacketOpenGui.class),
|
PACKET_OPENWIRELESSTERM(PacketOpenGui.class),
|
||||||
@@ -45,7 +54,10 @@ public class WCTPacketHandlerBase {
|
|||||||
Constructor<? extends WCTPacket> x = null;
|
Constructor<? extends WCTPacket> x = null;
|
||||||
try {
|
try {
|
||||||
x = this.packetClass.getConstructor(ByteBuf.class);
|
x = this.packetClass.getConstructor(ByteBuf.class);
|
||||||
} catch (final NoSuchMethodException ignored) {} catch (final SecurityException ignored) {} catch (final DecoderException ignored) {}
|
} catch (final NoSuchMethodException ignored) {
|
||||||
|
} catch (final SecurityException ignored) {
|
||||||
|
} catch (final DecoderException ignored) {
|
||||||
|
}
|
||||||
|
|
||||||
this.packetConstructor = x;
|
this.packetConstructor = x;
|
||||||
REVERSE_LOOKUP.put(this.packetClass, this);
|
REVERSE_LOOKUP.put(this.packetClass, this);
|
||||||
@@ -64,8 +76,9 @@ public class WCTPacketHandlerBase {
|
|||||||
return REVERSE_LOOKUP.get(c);
|
return REVERSE_LOOKUP.get(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WCTPacket parsePacket(final ByteBuf in) throws InstantiationException, IllegalAccessException,
|
public WCTPacket parsePacket(final ByteBuf in)
|
||||||
IllegalArgumentException, InvocationTargetException {
|
throws InstantiationException, IllegalAccessException, IllegalArgumentException,
|
||||||
|
InvocationTargetException {
|
||||||
return this.packetConstructor.newInstance(in);
|
return this.packetConstructor.newInstance(in);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -1,4 +1,3 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
|
package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
|
||||||
|
|
||||||
public interface INetworkInfo {
|
public interface INetworkInfo {}
|
||||||
}
|
|
||||||
+1
-2
@@ -1,8 +1,7 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
|
package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
public interface IPacketHandler {
|
public interface IPacketHandler {
|
||||||
|
|
||||||
|
|||||||
+3
-4
@@ -1,15 +1,14 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
|
package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.network.NetHandlerPlayServer;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
import cpw.mods.fml.common.network.FMLEventChannel;
|
import cpw.mods.fml.common.network.FMLEventChannel;
|
||||||
import cpw.mods.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent;
|
import cpw.mods.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent;
|
||||||
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.network.NetHandlerPlayServer;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||||
|
|
||||||
public class NetworkHandler {
|
public class NetworkHandler {
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -1,16 +1,14 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
|
package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacketHandlerBase;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacketHandlerBase;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
|
|
||||||
public class WCTClientPacketHandler extends WCTPacketHandlerBase implements IPacketHandler {
|
public class WCTClientPacketHandler extends WCTPacketHandlerBase implements IPacketHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-4
@@ -1,15 +1,13 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
|
package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacketHandlerBase;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacketHandlerBase;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
|
|
||||||
public final class WCTServerPacketHandler extends WCTPacketHandlerBase implements IPacketHandler {
|
public final class WCTServerPacketHandler extends WCTPacketHandlerBase implements IPacketHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+3
-7
@@ -1,5 +1,7 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
||||||
@@ -7,10 +9,6 @@ import net.p455w0rd.wirelesscraftingterminal.handlers.ConfigHandler;
|
|||||||
import net.p455w0rd.wirelesscraftingterminal.handlers.RecipeHandler;
|
import net.p455w0rd.wirelesscraftingterminal.handlers.RecipeHandler;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Loader;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import io.netty.buffer.Unpooled;
|
|
||||||
|
|
||||||
public class PacketConfigSync extends WCTPacket {
|
public class PacketConfigSync extends WCTPacket {
|
||||||
|
|
||||||
int wirelessTermMaxPower, boosterDropChance;
|
int wirelessTermMaxPower, boosterDropChance;
|
||||||
@@ -59,9 +57,7 @@ public class PacketConfigSync extends WCTPacket {
|
|||||||
Reference.WCT_MINETWEAKER_OVERRIDE = this.mineTweakerOverride;
|
Reference.WCT_MINETWEAKER_OVERRIDE = this.mineTweakerOverride;
|
||||||
ConfigHandler.removeBooster();
|
ConfigHandler.removeBooster();
|
||||||
ConfigHandler.removeBoosterIcon();
|
ConfigHandler.removeBoosterIcon();
|
||||||
if (!Loader.isModLoaded("dreamcraft")) {
|
RecipeHandler.loadRecipes(mtChanged);
|
||||||
RecipeHandler.loadRecipes(mtChanged);
|
|
||||||
}
|
|
||||||
mtChanged = false;
|
mtChanged = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+81
@@ -0,0 +1,81 @@
|
|||||||
|
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
||||||
|
|
||||||
|
import appeng.api.networking.IGrid;
|
||||||
|
import appeng.api.networking.IGridHost;
|
||||||
|
import appeng.api.networking.crafting.ICraftingGrid;
|
||||||
|
import appeng.api.networking.crafting.ICraftingJob;
|
||||||
|
import appeng.container.implementations.ContainerCraftAmount;
|
||||||
|
import appeng.container.implementations.ContainerCraftConfirm;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
|
public class PacketCraftRequest extends WCTPacket {
|
||||||
|
|
||||||
|
private final long amount;
|
||||||
|
private final boolean heldShift;
|
||||||
|
|
||||||
|
public PacketCraftRequest(final ByteBuf stream) {
|
||||||
|
this.heldShift = stream.readBoolean();
|
||||||
|
this.amount = stream.readLong();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PacketCraftRequest(final int craftAmt, final boolean shift) {
|
||||||
|
this.amount = craftAmt;
|
||||||
|
this.heldShift = shift;
|
||||||
|
|
||||||
|
final ByteBuf data = Unpooled.buffer();
|
||||||
|
|
||||||
|
data.writeInt(this.getPacketID());
|
||||||
|
data.writeBoolean(shift);
|
||||||
|
data.writeLong(this.amount);
|
||||||
|
|
||||||
|
this.configureWrite(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serverPacketData(final INetworkInfo manager, final WCTPacket packet, final EntityPlayer player) {
|
||||||
|
if (player.openContainer instanceof ContainerCraftAmount) {
|
||||||
|
final ContainerCraftAmount cca = (ContainerCraftAmount) player.openContainer;
|
||||||
|
final Object target = cca.getTarget();
|
||||||
|
if (target instanceof IGridHost) {
|
||||||
|
final IGrid g = cca.getGrid();
|
||||||
|
if (g == null || cca.getItemToCraft() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cca.getItemToCraft().setStackSize(this.amount);
|
||||||
|
|
||||||
|
Future<ICraftingJob> futureJob = null;
|
||||||
|
try {
|
||||||
|
final ICraftingGrid cg = g.getCache(ICraftingGrid.class);
|
||||||
|
futureJob = cg.beginCraftingJob(
|
||||||
|
cca.getWorld(), cca.getGrid(), cca.getActionSrc(), cca.getItemToCraft(), null);
|
||||||
|
|
||||||
|
int x = (int) player.posX;
|
||||||
|
int y = (int) player.posY;
|
||||||
|
int z = (int) player.posZ;
|
||||||
|
|
||||||
|
WCTGuiHandler.launchGui(Reference.GUI_CRAFT_CONFIRM, player, player.worldObj, x, y, z);
|
||||||
|
|
||||||
|
if (player.openContainer instanceof ContainerCraftConfirm) {
|
||||||
|
final ContainerCraftConfirm ccc = (ContainerCraftConfirm) player.openContainer;
|
||||||
|
ccc.setAutoStart(this.heldShift);
|
||||||
|
ccc.setJob(futureJob);
|
||||||
|
cca.detectAndSendChanges();
|
||||||
|
}
|
||||||
|
} catch (final Throwable e) {
|
||||||
|
if (futureJob != null) {
|
||||||
|
futureJob.cancel(true);
|
||||||
|
}
|
||||||
|
// WCTLog.debug(e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-3
@@ -1,5 +1,7 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@@ -8,9 +10,6 @@ import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
|||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import io.netty.buffer.Unpooled;
|
|
||||||
|
|
||||||
public class PacketEmptyTrash extends WCTPacket {
|
public class PacketEmptyTrash extends WCTPacket {
|
||||||
|
|
||||||
public PacketEmptyTrash(final ByteBuf stream) {}
|
public PacketEmptyTrash(final ByteBuf stream) {}
|
||||||
|
|||||||
+63
-17
@@ -1,23 +1,25 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.inventory.Container;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
|
||||||
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.client.ClientHelper;
|
import appeng.client.ClientHelper;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
|
import appeng.container.ContainerOpenContext;
|
||||||
|
import appeng.container.implementations.ContainerCraftAmount;
|
||||||
import appeng.helpers.InventoryAction;
|
import appeng.helpers.InventoryAction;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
|
import java.io.IOException;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
public class PacketInventoryAction extends WCTPacket {
|
public class PacketInventoryAction extends WCTPacket {
|
||||||
|
|
||||||
@@ -92,16 +94,60 @@ public class PacketInventoryAction extends WCTPacket {
|
|||||||
public void serverPacketData(final INetworkInfo manager, final WCTPacket packet, final EntityPlayer player) {
|
public void serverPacketData(final INetworkInfo manager, final WCTPacket packet, final EntityPlayer player) {
|
||||||
final EntityPlayerMP sender = (EntityPlayerMP) player;
|
final EntityPlayerMP sender = (EntityPlayerMP) player;
|
||||||
Container baseContainer = sender.openContainer;
|
Container baseContainer = sender.openContainer;
|
||||||
|
ContainerOpenContext context = null;
|
||||||
if (baseContainer instanceof ContainerWirelessCraftingTerminal) {
|
|
||||||
if (RandomUtils.getWirelessTerm(player.inventory) == null)
|
|
||||||
((ContainerWirelessCraftingTerminal) baseContainer).setValidContainer(false);
|
|
||||||
else((ContainerWirelessCraftingTerminal) baseContainer).doAction(sender, this.action, this.slot, this.id);
|
|
||||||
}
|
|
||||||
if (baseContainer instanceof AEBaseContainer) {
|
if (baseContainer instanceof AEBaseContainer) {
|
||||||
((AEBaseContainer) baseContainer).doAction(sender, this.action, this.slot, this.id);
|
context = ((AEBaseContainer) baseContainer).getOpenContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.action == InventoryAction.AUTO_CRAFT) {
|
||||||
|
// if( context != null )
|
||||||
|
// {
|
||||||
|
// final TileEntity te = context.getTile();
|
||||||
|
|
||||||
|
int x = (int) player.posX;
|
||||||
|
int y = (int) player.posY;
|
||||||
|
int z = (int) player.posZ;
|
||||||
|
|
||||||
|
WCTGuiHandler.launchGui(Reference.GUI_CRAFT_AMOUNT, player, player.worldObj, x, y, z);
|
||||||
|
|
||||||
|
if (sender.openContainer instanceof ContainerCraftAmount) {
|
||||||
|
final ContainerCraftAmount cca = (ContainerCraftAmount) sender.openContainer;
|
||||||
|
|
||||||
|
if (baseContainer instanceof ContainerWirelessCraftingTerminal) {
|
||||||
|
if (((ContainerWirelessCraftingTerminal) baseContainer).getTargetStack() != null) {
|
||||||
|
cca.getCraftingItem()
|
||||||
|
.putStack(((ContainerWirelessCraftingTerminal) baseContainer)
|
||||||
|
.getTargetStack()
|
||||||
|
.getItemStack());
|
||||||
|
cca.setItemToCraft(((ContainerWirelessCraftingTerminal) baseContainer).getTargetStack());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (baseContainer instanceof AEBaseContainer) {
|
||||||
|
if (((AEBaseContainer) baseContainer).getTargetStack() != null) {
|
||||||
|
cca.getCraftingItem()
|
||||||
|
.putStack(((AEBaseContainer) baseContainer)
|
||||||
|
.getTargetStack()
|
||||||
|
.getItemStack());
|
||||||
|
cca.setItemToCraft(((AEBaseContainer) baseContainer).getTargetStack());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cca.detectAndSendChanges();
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
} else {
|
||||||
|
if (baseContainer instanceof ContainerWirelessCraftingTerminal) {
|
||||||
|
if (RandomUtils.getWirelessTerm(player.inventory) == null)
|
||||||
|
((ContainerWirelessCraftingTerminal) baseContainer).setValidContainer(false);
|
||||||
|
else
|
||||||
|
((ContainerWirelessCraftingTerminal) baseContainer)
|
||||||
|
.doAction(sender, this.action, this.slot, this.id);
|
||||||
|
}
|
||||||
|
if (baseContainer instanceof AEBaseContainer) {
|
||||||
|
((AEBaseContainer) baseContainer).doAction(sender, this.action, this.slot, this.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+156
@@ -0,0 +1,156 @@
|
|||||||
|
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
||||||
|
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.util.item.AEItemStack;
|
||||||
|
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.nio.BufferOverflowException;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
|
import java.util.zip.GZIPOutputStream;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
||||||
|
|
||||||
|
public class PacketMEInventoryUpdate extends WCTPacket {
|
||||||
|
private static final int UNCOMPRESSED_PACKET_BYTE_LIMIT = 16 * 1024 * 1024;
|
||||||
|
private static final int OPERATION_BYTE_LIMIT = 2 * 1024;
|
||||||
|
private static final int TEMP_BUFFER_SIZE = 1024;
|
||||||
|
private static final int STREAM_MASK = 0xff;
|
||||||
|
|
||||||
|
// input.
|
||||||
|
@Nullable
|
||||||
|
private final List<IAEItemStack> list;
|
||||||
|
// output...
|
||||||
|
private final byte ref;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private final ByteBuf data;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private final GZIPOutputStream compressFrame;
|
||||||
|
|
||||||
|
private int writtenBytes = 0;
|
||||||
|
private boolean empty = true;
|
||||||
|
|
||||||
|
// automatic.
|
||||||
|
public PacketMEInventoryUpdate(final ByteBuf stream) throws IOException {
|
||||||
|
this.data = null;
|
||||||
|
this.compressFrame = null;
|
||||||
|
this.list = new LinkedList<IAEItemStack>();
|
||||||
|
this.ref = stream.readByte();
|
||||||
|
|
||||||
|
final GZIPInputStream gzReader = new GZIPInputStream(new InputStream() {
|
||||||
|
@Override
|
||||||
|
public int read() throws IOException {
|
||||||
|
if (stream.readableBytes() <= 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return stream.readByte() & STREAM_MASK;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
final ByteBuf uncompressed = Unpooled.buffer(stream.readableBytes());
|
||||||
|
final byte[] tmp = new byte[TEMP_BUFFER_SIZE];
|
||||||
|
while (gzReader.available() != 0) {
|
||||||
|
final int bytes = gzReader.read(tmp);
|
||||||
|
if (bytes > 0) {
|
||||||
|
uncompressed.writeBytes(tmp, 0, bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gzReader.close();
|
||||||
|
|
||||||
|
while (uncompressed.readableBytes() > 0) {
|
||||||
|
this.list.add(AEItemStack.loadItemStackFromPacket(uncompressed));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.empty = this.list.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
// api
|
||||||
|
public PacketMEInventoryUpdate() throws IOException {
|
||||||
|
this((byte) 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// api
|
||||||
|
public PacketMEInventoryUpdate(final byte ref) throws IOException {
|
||||||
|
this.ref = ref;
|
||||||
|
this.data = Unpooled.buffer(OPERATION_BYTE_LIMIT);
|
||||||
|
this.data.writeInt(this.getPacketID());
|
||||||
|
this.data.writeByte(this.ref);
|
||||||
|
|
||||||
|
this.compressFrame = new GZIPOutputStream(new OutputStream() {
|
||||||
|
@Override
|
||||||
|
public void write(final int value) throws IOException {
|
||||||
|
PacketMEInventoryUpdate.this.data.writeByte(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.list = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void clientPacketData(final INetworkInfo network, final WCTPacket packet, final EntityPlayer player) {
|
||||||
|
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||||
|
|
||||||
|
if (gs instanceof GuiCraftConfirm) {
|
||||||
|
((GuiCraftConfirm) gs).postUpdate(this.list, this.ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gs instanceof GuiWirelessCraftingTerminal) {
|
||||||
|
((GuiWirelessCraftingTerminal) gs).postUpdate(this.list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public FMLProxyPacket getProxy() {
|
||||||
|
try {
|
||||||
|
this.compressFrame.close();
|
||||||
|
|
||||||
|
this.configureWrite(this.data);
|
||||||
|
return super.getProxy();
|
||||||
|
} catch (final IOException e) {
|
||||||
|
WCTLog.debug(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void appendItem(final IAEItemStack is) throws IOException, BufferOverflowException {
|
||||||
|
final ByteBuf tmp = Unpooled.buffer(OPERATION_BYTE_LIMIT);
|
||||||
|
is.writeToPacket(tmp);
|
||||||
|
|
||||||
|
this.compressFrame.flush();
|
||||||
|
if (this.writtenBytes + tmp.readableBytes() > UNCOMPRESSED_PACKET_BYTE_LIMIT) {
|
||||||
|
throw new BufferOverflowException();
|
||||||
|
} else {
|
||||||
|
this.writtenBytes += tmp.readableBytes();
|
||||||
|
this.compressFrame.write(tmp.array(), 0, tmp.readableBytes());
|
||||||
|
this.empty = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLength() {
|
||||||
|
return this.data.readableBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return this.empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-3
@@ -1,5 +1,7 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@@ -8,9 +10,6 @@ import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
|||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
|
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import io.netty.buffer.Unpooled;
|
|
||||||
|
|
||||||
public class PacketMagnetFilter extends WCTPacket {
|
public class PacketMagnetFilter extends WCTPacket {
|
||||||
|
|
||||||
// 0 = initialize
|
// 0 = initialize
|
||||||
|
|||||||
+36
-44
@@ -1,28 +1,5 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.inventory.Container;
|
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
|
||||||
import net.minecraft.nbt.CompressedStreamTools;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagList;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.helpers.WTCGuiObject;
|
|
||||||
|
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
@@ -43,7 +20,27 @@ import appeng.util.item.AEItemStack;
|
|||||||
import appeng.util.prioitylist.IPartitionList;
|
import appeng.util.prioitylist.IPartitionList;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import it.unimi.dsi.fastutil.ints.IntObjectPair;
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
import net.minecraft.nbt.CompressedStreamTools;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||||
|
|
||||||
public class PacketNEIRecipe extends WCTPacket {
|
public class PacketNEIRecipe extends WCTPacket {
|
||||||
|
|
||||||
@@ -83,7 +80,7 @@ public class PacketNEIRecipe extends WCTPacket {
|
|||||||
configureWrite(data);
|
configureWrite(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
@Override
|
@Override
|
||||||
public void serverPacketData(final INetworkInfo manager, final WCTPacket packet, final EntityPlayer player) {
|
public void serverPacketData(final INetworkInfo manager, final WCTPacket packet, final EntityPlayer player) {
|
||||||
final EntityPlayerMP pmp = (EntityPlayerMP) player;
|
final EntityPlayerMP pmp = (EntityPlayerMP) player;
|
||||||
@@ -94,15 +91,13 @@ public class PacketNEIRecipe extends WCTPacket {
|
|||||||
IGridNode node = cct.getNetworkNode();
|
IGridNode node = cct.getNetworkNode();
|
||||||
|
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
IntObjectPair<ItemStack> termItem = RandomUtils.getWirelessTermWithSlot(player.inventory);
|
WirelessTerminalGuiObject obj = ContainerWirelessCraftingTerminal.getGuiObject(
|
||||||
WTCGuiObject obj = ContainerWirelessCraftingTerminal.getGuiObject(
|
RandomUtils.getWirelessTerm(player.inventory),
|
||||||
termItem.second(),
|
|
||||||
player,
|
player,
|
||||||
player.worldObj,
|
player.worldObj,
|
||||||
(int) player.posX,
|
(int) player.posX,
|
||||||
(int) player.posY,
|
(int) player.posY,
|
||||||
(int) player.posZ,
|
(int) player.posZ);
|
||||||
termItem.firstInt());
|
|
||||||
node = obj.getActionableNode(true);
|
node = obj.getActionableNode(true);
|
||||||
}
|
}
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
@@ -145,16 +140,15 @@ public class PacketNEIRecipe extends WCTPacket {
|
|||||||
ItemStack currentItem = craftMatrix.getStackInSlot(x);
|
ItemStack currentItem = craftMatrix.getStackInSlot(x);
|
||||||
if (currentItem != null) {
|
if (currentItem != null) {
|
||||||
testInv.setInventorySlotContents(x, currentItem);
|
testInv.setInventorySlotContents(x, currentItem);
|
||||||
final ItemStack newItemStack = r.matches(testInv, pmp.worldObj)
|
final ItemStack newItemStack =
|
||||||
? r.getCraftingResult(testInv)
|
r.matches(testInv, pmp.worldObj) ? r.getCraftingResult(testInv) : null;
|
||||||
: null;
|
|
||||||
testInv.setInventorySlotContents(x, patternItem);
|
testInv.setInventorySlotContents(x, patternItem);
|
||||||
|
|
||||||
if (newItemStack == null || !Platform.isSameItemPrecise(newItemStack, is)) {
|
if (newItemStack == null || !Platform.isSameItemPrecise(newItemStack, is)) {
|
||||||
final IAEItemStack in = AEItemStack.create(currentItem);
|
final IAEItemStack in = AEItemStack.create(currentItem);
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
final IAEItemStack out = Platform
|
final IAEItemStack out =
|
||||||
.poweredInsert(energy, storage, in, cct.getActionSource());
|
Platform.poweredInsert(energy, storage, in, cct.getActionSource());
|
||||||
if (out != null) {
|
if (out != null) {
|
||||||
craftMatrix.setInventorySlotContents(x, out.getItemStack());
|
craftMatrix.setInventorySlotContents(x, out.getItemStack());
|
||||||
} else {
|
} else {
|
||||||
@@ -196,10 +190,7 @@ public class PacketNEIRecipe extends WCTPacket {
|
|||||||
if (filter == null || filter.isListed(request)) {
|
if (filter == null || filter.isListed(request)) {
|
||||||
request.setStackSize(1);
|
request.setStackSize(1);
|
||||||
final IAEItemStack out = Platform.poweredExtraction(
|
final IAEItemStack out = Platform.poweredExtraction(
|
||||||
energy,
|
energy, storage, request, cct.getActionSource());
|
||||||
storage,
|
|
||||||
request,
|
|
||||||
cct.getActionSource());
|
|
||||||
if (out != null) {
|
if (out != null) {
|
||||||
whichItem = out.getItemStack();
|
whichItem = out.getItemStack();
|
||||||
break;
|
break;
|
||||||
@@ -228,17 +219,18 @@ public class PacketNEIRecipe extends WCTPacket {
|
|||||||
/**
|
/**
|
||||||
* Tries to extract an item from the player inventory. Does account for fuzzy items.
|
* Tries to extract an item from the player inventory. Does account for fuzzy items.
|
||||||
*
|
*
|
||||||
* @param player the {@link EntityPlayer} to extract from
|
* @param player the {@link EntityPlayer} to extract from
|
||||||
* @param mode the {@link Actionable} to simulate or modulate the operation
|
* @param mode the {@link Actionable} to simulate or modulate the operation
|
||||||
* @param patternItem which {@link ItemStack} to extract
|
* @param patternItem which {@link ItemStack} to extract
|
||||||
* @return null or a found {@link ItemStack}
|
* @return null or a found {@link ItemStack}
|
||||||
*/
|
*/
|
||||||
private ItemStack extractItemFromPlayerInventory(final EntityPlayer player, final Actionable mode,
|
private ItemStack extractItemFromPlayerInventory(
|
||||||
final ItemStack patternItem) {
|
final EntityPlayer player, final Actionable mode, final ItemStack patternItem) {
|
||||||
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
|
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
|
||||||
final AEItemStack request = AEItemStack.create(patternItem);
|
final AEItemStack request = AEItemStack.create(patternItem);
|
||||||
// final boolean isSimulated = mode == Actionable.SIMULATE;
|
// final boolean isSimulated = mode == Actionable.SIMULATE;
|
||||||
final boolean checkFuzzy = request.isOre() || patternItem.getItemDamage() == OreDictionary.WILDCARD_VALUE
|
final boolean checkFuzzy = request.isOre()
|
||||||
|
|| patternItem.getItemDamage() == OreDictionary.WILDCARD_VALUE
|
||||||
|| patternItem.hasTagCompound()
|
|| patternItem.hasTagCompound()
|
||||||
|| patternItem.isItemStackDamageable();
|
|| patternItem.isItemStackDamageable();
|
||||||
|
|
||||||
|
|||||||
+3
-9
@@ -1,14 +1,13 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ContainerPlayer;
|
import net.minecraft.inventory.ContainerPlayer;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
|
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import io.netty.buffer.Unpooled;
|
|
||||||
|
|
||||||
public class PacketOpenGui extends WCTPacket {
|
public class PacketOpenGui extends WCTPacket {
|
||||||
|
|
||||||
private final int whichGui;
|
private final int whichGui;
|
||||||
@@ -30,12 +29,7 @@ public class PacketOpenGui extends WCTPacket {
|
|||||||
public void serverPacketData(final INetworkInfo manager, final WCTPacket packet, final EntityPlayer player) {
|
public void serverPacketData(final INetworkInfo manager, final WCTPacket packet, final EntityPlayer player) {
|
||||||
if (player.openContainer instanceof ContainerPlayer) {
|
if (player.openContainer instanceof ContainerPlayer) {
|
||||||
WCTGuiHandler.launchGui(
|
WCTGuiHandler.launchGui(
|
||||||
this.whichGui,
|
this.whichGui, player, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||||
player,
|
|
||||||
player.worldObj,
|
|
||||||
(int) player.posX,
|
|
||||||
(int) player.posY,
|
|
||||||
(int) player.posZ);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+21
-15
@@ -1,15 +1,15 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ChatComponentTranslation;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
|
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ChatComponentText;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
|
||||||
|
|
||||||
public class PacketSetMagnet extends WCTPacket {
|
public class PacketSetMagnet extends WCTPacket {
|
||||||
|
|
||||||
@@ -38,16 +38,22 @@ public class PacketSetMagnet extends WCTPacket {
|
|||||||
if (magnetItem != null) {
|
if (magnetItem != null) {
|
||||||
|
|
||||||
if (magnetItem.getItemDamage() == 2) {
|
if (magnetItem.getItemDamage() == 2) {
|
||||||
RandomUtils.getWirelessTerm(player.inventory).getTagCompound().getTagList("MagnetSlot", 10)
|
RandomUtils.getWirelessTerm(player.inventory)
|
||||||
.getCompoundTagAt(0).setShort("Damage", (short) 0);
|
.getTagCompound()
|
||||||
player.addChatMessage(new ChatComponentTranslation("chatmessages.ae2wct.MagnetMode1"));
|
.getTagList("MagnetSlot", 10)
|
||||||
|
.getCompoundTagAt(0)
|
||||||
|
.setShort("Damage", (short) 0);
|
||||||
|
player.addChatMessage(new ChatComponentText(LocaleHandler.MagnetMode1.getLocal()));
|
||||||
} else {
|
} else {
|
||||||
RandomUtils.getWirelessTerm(player.inventory).getTagCompound().getTagList("MagnetSlot", 10)
|
RandomUtils.getWirelessTerm(player.inventory)
|
||||||
.getCompoundTagAt(0).setShort("Damage", (short) (magnetItem.getItemDamage() + 1));
|
.getTagCompound()
|
||||||
|
.getTagList("MagnetSlot", 10)
|
||||||
|
.getCompoundTagAt(0)
|
||||||
|
.setShort("Damage", (short) (magnetItem.getItemDamage() + 1));
|
||||||
if (magnetItem.getItemDamage() == 0) {
|
if (magnetItem.getItemDamage() == 0) {
|
||||||
player.addChatMessage(new ChatComponentTranslation("chatmessages.ae2wct.MagnetMode2"));
|
player.addChatMessage(new ChatComponentText(LocaleHandler.MagnetMode2.getLocal()));
|
||||||
} else {
|
} else {
|
||||||
player.addChatMessage(new ChatComponentTranslation("chatmessages.ae2wct.MagnetMode3"));
|
player.addChatMessage(new ChatComponentText(LocaleHandler.MagnetMode3.getLocal()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+51
@@ -0,0 +1,51 @@
|
|||||||
|
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
||||||
|
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
||||||
|
|
||||||
|
public class PacketSwitchGuis extends WCTPacket {
|
||||||
|
|
||||||
|
private final int newGui;
|
||||||
|
|
||||||
|
// automatic.
|
||||||
|
public PacketSwitchGuis(final ByteBuf stream) {
|
||||||
|
this.newGui = stream.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
// api
|
||||||
|
public PacketSwitchGuis(final int newGui) {
|
||||||
|
this.newGui = newGui;
|
||||||
|
|
||||||
|
if (Platform.isClient()) {
|
||||||
|
GuiWirelessCraftingTerminal.setSwitchingGuis(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
final ByteBuf data = Unpooled.buffer();
|
||||||
|
|
||||||
|
data.writeInt(this.getPacketID());
|
||||||
|
data.writeInt(newGui);
|
||||||
|
|
||||||
|
this.configureWrite(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serverPacketData(final INetworkInfo manager, final WCTPacket packet, final EntityPlayer player) {
|
||||||
|
World world = player.worldObj;
|
||||||
|
int x = (int) player.posX;
|
||||||
|
int y = (int) player.posY;
|
||||||
|
int z = (int) player.posZ;
|
||||||
|
WCTGuiHandler.launchGui(newGui, player, world, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clientPacketData(final INetworkInfo network, final WCTPacket packet, final EntityPlayer player) {
|
||||||
|
GuiWirelessCraftingTerminal.setSwitchingGuis(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
+111
@@ -0,0 +1,111 @@
|
|||||||
|
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
||||||
|
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.api.util.IConfigurableObject;
|
||||||
|
import appeng.container.AEBaseContainer;
|
||||||
|
import appeng.helpers.IMouseWheelItem;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
||||||
|
|
||||||
|
public class PacketValueConfig extends WCTPacket {
|
||||||
|
|
||||||
|
private final String Name;
|
||||||
|
private final String Value;
|
||||||
|
|
||||||
|
// automatic.
|
||||||
|
public PacketValueConfig(final ByteBuf stream) throws IOException {
|
||||||
|
final DataInputStream dis = new DataInputStream(
|
||||||
|
new ByteArrayInputStream(stream.array(), stream.readerIndex(), stream.readableBytes()));
|
||||||
|
this.Name = dis.readUTF();
|
||||||
|
this.Value = dis.readUTF();
|
||||||
|
}
|
||||||
|
|
||||||
|
// api
|
||||||
|
public PacketValueConfig(final String name, final String value) throws IOException {
|
||||||
|
this.Name = name;
|
||||||
|
this.Value = value;
|
||||||
|
|
||||||
|
final ByteBuf data = Unpooled.buffer();
|
||||||
|
|
||||||
|
data.writeInt(this.getPacketID());
|
||||||
|
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||||
|
final DataOutputStream dos = new DataOutputStream(bos);
|
||||||
|
dos.writeUTF(name);
|
||||||
|
dos.writeUTF(value);
|
||||||
|
data.writeBytes(bos.toByteArray());
|
||||||
|
this.configureWrite(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void serverPacketData(final INetworkInfo manager, final WCTPacket packet, final EntityPlayer player) {
|
||||||
|
final Container c = player.openContainer;
|
||||||
|
|
||||||
|
if (this.Name.equals("Item")
|
||||||
|
&& RandomUtils.getWirelessTerm(player.inventory) != null
|
||||||
|
&& RandomUtils.getWirelessTerm(player.inventory).getItem() instanceof IMouseWheelItem) {
|
||||||
|
final ItemStack is = RandomUtils.getWirelessTerm(player.inventory);
|
||||||
|
final IMouseWheelItem si = (IMouseWheelItem) is.getItem();
|
||||||
|
si.onWheel(is, this.Value.equals("WheelUp"));
|
||||||
|
} else if (c instanceof IConfigurableObject) {
|
||||||
|
final IConfigManager cm = ((IConfigurableObject) c).getConfigManager();
|
||||||
|
|
||||||
|
for (final Settings e : cm.getSettings()) {
|
||||||
|
if (e.name().equals(this.Name)) {
|
||||||
|
final Enum<?> def = cm.getSetting(e);
|
||||||
|
|
||||||
|
try {
|
||||||
|
cm.putSetting(e, Enum.valueOf(def.getClass(), this.Value));
|
||||||
|
} catch (final IllegalArgumentException err) {
|
||||||
|
// :P
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void clientPacketData(final INetworkInfo network, final WCTPacket packet, final EntityPlayer player) {
|
||||||
|
final Container c = player.openContainer;
|
||||||
|
|
||||||
|
if (this.Name.equals("CustomName")) {
|
||||||
|
if (c instanceof AEBaseContainer) {
|
||||||
|
((AEBaseContainer) c).setCustomName(this.Value);
|
||||||
|
}
|
||||||
|
} else if (this.Name.startsWith("SyncDat.")) {
|
||||||
|
if (c instanceof AEBaseContainer) {
|
||||||
|
((AEBaseContainer) c).stringSync(Integer.parseInt(this.Name.substring(8)), this.Value);
|
||||||
|
}
|
||||||
|
} else if (c instanceof IConfigurableObject) {
|
||||||
|
final IConfigManager cm = ((IConfigurableObject) c).getConfigManager();
|
||||||
|
|
||||||
|
for (final Settings e : cm.getSettings()) {
|
||||||
|
if (e.name().equals(this.Name)) {
|
||||||
|
final Enum<?> def = cm.getSetting(e);
|
||||||
|
|
||||||
|
try {
|
||||||
|
cm.putSetting(e, Enum.valueOf(def.getClass(), this.Value));
|
||||||
|
} catch (final IllegalArgumentException err) {
|
||||||
|
// :P
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,13 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.creativetab;
|
package net.p455w0rd.wirelesscraftingterminal.creativetab;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
|
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemWirelessCraftingTerminal;
|
import net.p455w0rd.wirelesscraftingterminal.items.ItemWirelessCraftingTerminal;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class CreativeTabWCT extends CreativeTabs {
|
public class CreativeTabWCT extends CreativeTabs {
|
||||||
|
|
||||||
public CreativeTabWCT(int id, String unlocalizedName) {
|
public CreativeTabWCT(int id, String unlocalizedName) {
|
||||||
|
|||||||
+4
-17
@@ -17,24 +17,11 @@ public class AchievementHandler {
|
|||||||
new ItemStack(ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem(), 1),
|
new ItemStack(ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem(), 1),
|
||||||
(Achievement) null);
|
(Achievement) null);
|
||||||
public static final Achievement boosterAch = new Achievement(
|
public static final Achievement boosterAch = new Achievement(
|
||||||
"achievment.boosterAchievement",
|
"achievment.boosterAchievement", "boosterAchievement", 0, 2, ItemEnum.BOOSTER_ICON.getItem(), wctAch);
|
||||||
"boosterAchievement",
|
|
||||||
0,
|
|
||||||
2,
|
|
||||||
ItemEnum.BOOSTER_ICON.getItem(),
|
|
||||||
wctAch);
|
|
||||||
public static final Achievement magnetAch = new Achievement(
|
public static final Achievement magnetAch = new Achievement(
|
||||||
"achievement.magnetAchievement",
|
"achievement.magnetAchievement", "magnetAchievement", 2, 0, ItemEnum.MAGNET_CARD.getItem(), wctAch);
|
||||||
"magnetAchievement",
|
private static final AchievementPage achPage =
|
||||||
2,
|
new AchievementPage("Wireless Crafting Term", wctAch, boosterAch, magnetAch);
|
||||||
0,
|
|
||||||
ItemEnum.MAGNET_CARD.getItem(),
|
|
||||||
wctAch);
|
|
||||||
private static final AchievementPage achPage = new AchievementPage(
|
|
||||||
"Wireless Crafting Term",
|
|
||||||
wctAch,
|
|
||||||
boosterAch,
|
|
||||||
magnetAch);
|
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
registerAchievements();
|
registerAchievements();
|
||||||
|
|||||||
@@ -1,22 +1,20 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.handlers;
|
package net.p455w0rd.wirelesscraftingterminal.handlers;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import net.minecraftforge.common.config.Configuration;
|
import net.minecraftforge.common.config.Configuration;
|
||||||
import net.minecraftforge.common.config.Property;
|
import net.minecraftforge.common.config.Property;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.WirelessCraftingTerminal;
|
import net.p455w0rd.wirelesscraftingterminal.common.WirelessCraftingTerminal;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
|
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
|
||||||
import cpw.mods.fml.common.Loader;
|
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
|
|
||||||
public class ConfigHandler {
|
public class ConfigHandler {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A big part of what goes on here is reloading the cfg on-the-fly since Ender-Core adds the abilitty to modify
|
* A big part of what goes on here is reloading the cfg on-the-fly
|
||||||
* config stuff while in game, I figured I'd add support for such possibilities
|
* since Ender-Core adds the abilitty to modify config stuff while in game,
|
||||||
|
* I figured I'd add support for such possibilities
|
||||||
*/
|
*/
|
||||||
public static Configuration config;
|
public static Configuration config;
|
||||||
public static boolean enableInfinityBooster;
|
public static boolean enableInfinityBooster;
|
||||||
@@ -55,17 +53,18 @@ public class ConfigHandler {
|
|||||||
String mineTweakerOverrideDesc = LocaleHandler.MineTweakerOverride.getLocal();
|
String mineTweakerOverrideDesc = LocaleHandler.MineTweakerOverride.getLocal();
|
||||||
String doVersionCheckDesc = LocaleHandler.DoVersionCheck.getLocal();
|
String doVersionCheckDesc = LocaleHandler.DoVersionCheck.getLocal();
|
||||||
String saveSearchStringDesc = LocaleHandler.SaveSearchString.getLocal();
|
String saveSearchStringDesc = LocaleHandler.SaveSearchString.getLocal();
|
||||||
enableInfinityBooster = config
|
enableInfinityBooster =
|
||||||
.getBoolean("enableInfinityBooster", Configuration.CATEGORY_GENERAL, true, boosterDesc);
|
config.getBoolean("enableInfinityBooster", Configuration.CATEGORY_GENERAL, true, boosterDesc);
|
||||||
enableEasyMode = config.getBoolean("enableEasyMode", Configuration.CATEGORY_GENERAL, false, easyModeDesc);
|
enableEasyMode = config.getBoolean("enableEasyMode", Configuration.CATEGORY_GENERAL, false, easyModeDesc);
|
||||||
boosterDropsEnabled = config
|
boosterDropsEnabled =
|
||||||
.getBoolean("boosterDropsEnabled", Configuration.CATEGORY_GENERAL, true, boosterDropEnabledDesc);
|
config.getBoolean("boosterDropsEnabled", Configuration.CATEGORY_GENERAL, true, boosterDropEnabledDesc);
|
||||||
mineTweakerOverride = config
|
mineTweakerOverride = config.getBoolean(
|
||||||
.getBoolean("mineTweakerOverride", Configuration.CATEGORY_GENERAL, false, mineTweakerOverrideDesc);
|
"mineTweakerOverride", Configuration.CATEGORY_GENERAL, false, mineTweakerOverrideDesc);
|
||||||
doVersionCheck = config.getBoolean("doVersionCheck", Configuration.CATEGORY_GENERAL, true, doVersionCheckDesc);
|
doVersionCheck = config.getBoolean("doVersionCheck", Configuration.CATEGORY_GENERAL, true, doVersionCheckDesc);
|
||||||
/*
|
/*
|
||||||
* I did the max power cfg loading like this because while using Configuration#getInt did enforce the min/max
|
* I did the max power cfg loading like this because while using
|
||||||
* values in-game, it didn't properly update the config file
|
* Configuration#getInt did enforce the min/max values in-game, it
|
||||||
|
* didn't properly update the config file
|
||||||
*/
|
*/
|
||||||
Property pwrCfgKey = config.get(Configuration.CATEGORY_GENERAL, "ae2wctMaxPower", Reference.WCT_MAX_POWER);
|
Property pwrCfgKey = config.get(Configuration.CATEGORY_GENERAL, "ae2wctMaxPower", Reference.WCT_MAX_POWER);
|
||||||
pwrCfgKey.comment = pwrDesc;
|
pwrCfgKey.comment = pwrDesc;
|
||||||
@@ -85,8 +84,8 @@ public class ConfigHandler {
|
|||||||
doSave = true;
|
doSave = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Property boosterDropKey = config
|
Property boosterDropKey =
|
||||||
.get(Configuration.CATEGORY_GENERAL, "boosterDropChance", Reference.WCT_BOOSTER_DROPCHANCE);
|
config.get(Configuration.CATEGORY_GENERAL, "boosterDropChance", Reference.WCT_BOOSTER_DROPCHANCE);
|
||||||
boosterDropKey.comment = boosterDropDesc;
|
boosterDropKey.comment = boosterDropDesc;
|
||||||
boosterDropKey.setDefaultValue(Reference.WCT_BOOSTER_DROPCHANCE);
|
boosterDropKey.setDefaultValue(Reference.WCT_BOOSTER_DROPCHANCE);
|
||||||
|
|
||||||
@@ -125,9 +124,7 @@ public class ConfigHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void reloadRecipes() {
|
public static void reloadRecipes() {
|
||||||
if (!Loader.isModLoaded("dreamcraft")) {
|
RecipeHandler.loadRecipes(mtChanged);
|
||||||
RecipeHandler.loadRecipes(mtChanged);
|
|
||||||
}
|
|
||||||
mtChanged = false;
|
mtChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.handlers;
|
package net.p455w0rd.wirelesscraftingterminal.handlers;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
|
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
@@ -12,16 +18,8 @@ import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
|||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketOpenGui;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketOpenGui;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSetMagnet;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSetMagnet;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
|
||||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class KeybindHandler {
|
public class KeybindHandler {
|
||||||
|
|
||||||
@@ -30,9 +28,9 @@ public class KeybindHandler {
|
|||||||
public static KeyBinding changeMagnetMode;
|
public static KeyBinding changeMagnetMode;
|
||||||
|
|
||||||
public static void registerKeybinds() {
|
public static void registerKeybinds() {
|
||||||
openTerminal = new KeyBinding("ae2wct.OpenTerminal", Keyboard.CHAR_NONE, "key.categories.ae2wct");
|
openTerminal = new KeyBinding("key.OpenTerminal", Keyboard.CHAR_NONE, "key.categories.ae2wct");
|
||||||
openMagnetFilter = new KeyBinding("ae2wct.OpenMagnetFilter", Keyboard.CHAR_NONE, "key.categories.ae2wct");
|
openMagnetFilter = new KeyBinding("key.OpenMagnetFilter", Keyboard.CHAR_NONE, "key.categories.ae2wct");
|
||||||
changeMagnetMode = new KeyBinding("ae2wct.SwitchMagnetMode", Keyboard.CHAR_NONE, "key.categories.ae2wct");
|
changeMagnetMode = new KeyBinding("key.SwitchMagnetMode", Keyboard.CHAR_NONE, "key.categories.ae2wct");
|
||||||
ClientRegistry.registerKeyBinding(openTerminal);
|
ClientRegistry.registerKeyBinding(openTerminal);
|
||||||
ClientRegistry.registerKeyBinding(openMagnetFilter);
|
ClientRegistry.registerKeyBinding(openMagnetFilter);
|
||||||
ClientRegistry.registerKeyBinding(changeMagnetMode);
|
ClientRegistry.registerKeyBinding(changeMagnetMode);
|
||||||
@@ -53,6 +51,13 @@ public class KeybindHandler {
|
|||||||
IWirelessCraftingTerminalItem wirelessTerm = (IWirelessCraftingTerminalItem) is.getItem();
|
IWirelessCraftingTerminalItem wirelessTerm = (IWirelessCraftingTerminalItem) is.getItem();
|
||||||
if (wirelessTerm != null && wirelessTerm.isWirelessCraftingEnabled(is)) {
|
if (wirelessTerm != null && wirelessTerm.isWirelessCraftingEnabled(is)) {
|
||||||
if (!FMLClientHandler.instance().isGUIOpen(GuiWirelessCraftingTerminal.class)) {
|
if (!FMLClientHandler.instance().isGUIOpen(GuiWirelessCraftingTerminal.class)) {
|
||||||
|
for (int i = 0; i < p.inventory.mainInventory.length; ++i) {
|
||||||
|
if (p.inventory.mainInventory[i] != null
|
||||||
|
&& p.inventory.mainInventory[i].getItem() == wirelessTerm) {
|
||||||
|
p.inventory.currentItem = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
NetworkHandler.instance.sendToServer(new PacketOpenGui(Reference.GUI_WCT));
|
NetworkHandler.instance.sendToServer(new PacketOpenGui(Reference.GUI_WCT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package net.p455w0rd.wirelesscraftingterminal.handlers;
|
|||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
|
|
||||||
public enum LocaleHandler {
|
public enum LocaleHandler {
|
||||||
|
|
||||||
TitleDesc,
|
TitleDesc,
|
||||||
InfinityBoosterDesc,
|
InfinityBoosterDesc,
|
||||||
WirelessTermLabel("gui.labels.ae2wct"),
|
WirelessTermLabel("gui.labels.ae2wct"),
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.handlers;
|
package net.p455w0rd.wirelesscraftingterminal.handlers;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
@@ -12,8 +12,6 @@ import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
|||||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
|
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
|
||||||
|
|
||||||
public class RecipeHandler {
|
public class RecipeHandler {
|
||||||
|
|
||||||
public static ArrayList<IRecipe> easyRecipeList = new ArrayList<IRecipe>();
|
public static ArrayList<IRecipe> easyRecipeList = new ArrayList<IRecipe>();
|
||||||
@@ -30,53 +28,88 @@ public class RecipeHandler {
|
|||||||
// EASY MODE RECIPES
|
// EASY MODE RECIPES
|
||||||
|
|
||||||
// Wireless Crafting Terminal
|
// Wireless Crafting Terminal
|
||||||
easyRecipeList.add(
|
easyRecipeList.add(new ShapedOreRecipe(ItemEnum.WIRELESS_CRAFTING_TERMINAL.getStack(), new Object[] {
|
||||||
new ShapedOreRecipe(
|
"a",
|
||||||
ItemEnum.WIRELESS_CRAFTING_TERMINAL.getStack(),
|
"b",
|
||||||
new Object[] { "a", "b", "c", Character.valueOf('a'), new ItemStack(multiMaterial, 1, 41),
|
"c",
|
||||||
Character.valueOf('b'), new ItemStack(multiPart, 1, 360), Character.valueOf('c'),
|
Character.valueOf('a'),
|
||||||
new ItemStack(ae2WirelessTerm, 1, 0) }));
|
new ItemStack(multiMaterial, 1, 41),
|
||||||
|
Character.valueOf('b'),
|
||||||
|
new ItemStack(multiPart, 1, 360),
|
||||||
|
Character.valueOf('c'),
|
||||||
|
new ItemStack(ae2WirelessTerm, 1, 0)
|
||||||
|
}));
|
||||||
|
|
||||||
// Magnet Card
|
// Magnet Card
|
||||||
easyRecipeList.add(
|
easyRecipeList.add(new ShapedOreRecipe(ItemEnum.MAGNET_CARD.getStack(), new Object[] {
|
||||||
new ShapedOreRecipe(
|
"a b",
|
||||||
ItemEnum.MAGNET_CARD.getStack(),
|
"cdc",
|
||||||
new Object[] { "a b", "cdc", "ccc", Character.valueOf('a'), "dustRedstone",
|
"ccc",
|
||||||
Character.valueOf('b'), "gemLapis", Character.valueOf('c'), "ingotIron",
|
Character.valueOf('a'),
|
||||||
Character.valueOf('d'), new ItemStack(multiMaterial, 1, 28) }));
|
"dustRedstone",
|
||||||
|
Character.valueOf('b'),
|
||||||
|
"gemLapis",
|
||||||
|
Character.valueOf('c'),
|
||||||
|
"ingotIron",
|
||||||
|
Character.valueOf('d'),
|
||||||
|
new ItemStack(multiMaterial, 1, 28)
|
||||||
|
}));
|
||||||
|
|
||||||
// Infinity Booster Card
|
// Infinity Booster Card
|
||||||
easyRecipeList.add(
|
easyRecipeList.add(new ShapedOreRecipe(ItemEnum.BOOSTER_CARD.getStack(), new Object[] {
|
||||||
new ShapedOreRecipe(
|
"abc",
|
||||||
ItemEnum.BOOSTER_CARD.getStack(),
|
"ded",
|
||||||
new Object[] { "abc", "ded", "cba", Character.valueOf('a'), new ItemStack(blockSpatialIO, 1, 0),
|
"cba",
|
||||||
Character.valueOf('b'), new ItemStack(multiMaterial, 1, 42), Character.valueOf('c'),
|
Character.valueOf('a'),
|
||||||
new ItemStack(blockCraftingStorage, 1, 3), Character.valueOf('d'),
|
new ItemStack(blockSpatialIO, 1, 0),
|
||||||
new ItemStack(multiMaterial, 1, 48), Character.valueOf('e'),
|
Character.valueOf('b'),
|
||||||
new ItemStack(itemWAP, 1, 0) }));
|
new ItemStack(multiMaterial, 1, 42),
|
||||||
|
Character.valueOf('c'),
|
||||||
|
new ItemStack(blockCraftingStorage, 1, 3),
|
||||||
|
Character.valueOf('d'),
|
||||||
|
new ItemStack(multiMaterial, 1, 48),
|
||||||
|
Character.valueOf('e'),
|
||||||
|
new ItemStack(itemWAP, 1, 0)
|
||||||
|
}));
|
||||||
|
|
||||||
// ==================
|
// ==================
|
||||||
// HARD MODE RECIPES
|
// HARD MODE RECIPES
|
||||||
|
|
||||||
// Wireless Crafting Terminal
|
// Wireless Crafting Terminal
|
||||||
hardRecipeList.add(
|
hardRecipeList.add(new ShapedOreRecipe(ItemEnum.WIRELESS_CRAFTING_TERMINAL.getStack(), new Object[] {
|
||||||
new ShapedOreRecipe(
|
"aba",
|
||||||
ItemEnum.WIRELESS_CRAFTING_TERMINAL.getStack(),
|
"cdc",
|
||||||
new Object[] { "aba", "cdc", "efe", Character.valueOf('a'), new ItemStack(multiMaterial, 1, 9),
|
"efe",
|
||||||
Character.valueOf('b'), new ItemStack(itemWAP, 1, 0), Character.valueOf('c'),
|
Character.valueOf('a'),
|
||||||
new ItemStack(multiMaterial, 1, 12), Character.valueOf('d'),
|
new ItemStack(multiMaterial, 1, 9),
|
||||||
new ItemStack(multiPart, 1, 360), Character.valueOf('e'),
|
Character.valueOf('b'),
|
||||||
new ItemStack(multiMaterial, 1, 38), Character.valueOf('f'),
|
new ItemStack(itemWAP, 1, 0),
|
||||||
new ItemStack(multiMaterial, 1, 47) }));
|
Character.valueOf('c'),
|
||||||
|
new ItemStack(multiMaterial, 1, 12),
|
||||||
|
Character.valueOf('d'),
|
||||||
|
new ItemStack(multiPart, 1, 360),
|
||||||
|
Character.valueOf('e'),
|
||||||
|
new ItemStack(multiMaterial, 1, 38),
|
||||||
|
Character.valueOf('f'),
|
||||||
|
new ItemStack(multiMaterial, 1, 47)
|
||||||
|
}));
|
||||||
|
|
||||||
// Magnet Card
|
// Magnet Card
|
||||||
hardRecipeList.add(
|
hardRecipeList.add(new ShapedOreRecipe(ItemEnum.MAGNET_CARD.getStack(), new Object[] {
|
||||||
new ShapedOreRecipe(
|
"abc",
|
||||||
ItemEnum.MAGNET_CARD.getStack(),
|
"ded",
|
||||||
new Object[] { "abc", "ded", "ddd", Character.valueOf('a'), "blockRedstone",
|
"ddd",
|
||||||
Character.valueOf('b'), new ItemStack(multiPart, 1, 300), Character.valueOf('c'),
|
Character.valueOf('a'),
|
||||||
"blockLapis", Character.valueOf('d'), "blockIron", Character.valueOf('e'),
|
"blockRedstone",
|
||||||
new ItemStack(multiMaterial, 1, 28) }));
|
Character.valueOf('b'),
|
||||||
|
new ItemStack(multiPart, 1, 300),
|
||||||
|
Character.valueOf('c'),
|
||||||
|
"blockLapis",
|
||||||
|
Character.valueOf('d'),
|
||||||
|
"blockIron",
|
||||||
|
Character.valueOf('e'),
|
||||||
|
new ItemStack(multiMaterial, 1, 28)
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -93,7 +126,8 @@ public class RecipeHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remove old recipes
|
// remove old recipes
|
||||||
Iterator<IRecipe> iterator = CraftingManager.getInstance().getRecipeList().iterator();
|
Iterator<IRecipe> iterator =
|
||||||
|
CraftingManager.getInstance().getRecipeList().iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
ItemStack r = iterator.next().getRecipeOutput();
|
ItemStack r = iterator.next().getRecipeOutput();
|
||||||
for (IRecipe recipe : recipeList2) {
|
for (IRecipe recipe : recipeList2) {
|
||||||
|
|||||||
+8
-14
@@ -1,22 +1,20 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.handlers;
|
package net.p455w0rd.wirelesscraftingterminal.handlers;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ChatComponentText;
|
import net.minecraft.util.ChatComponentText;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.util.IChatComponent;
|
import net.minecraft.util.IChatComponent;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
|
||||||
|
|
||||||
public class VersionCheckHandler {
|
public class VersionCheckHandler {
|
||||||
|
|
||||||
int timer = 150;
|
int timer = 150;
|
||||||
@@ -45,12 +43,8 @@ public class VersionCheckHandler {
|
|||||||
if (!fetchVersion().equals(Reference.VERSION) && !Reference.WCT_HASCHECKEDVERSION) {
|
if (!fetchVersion().equals(Reference.VERSION) && !Reference.WCT_HASCHECKEDVERSION) {
|
||||||
Reference.WCT_HASCHECKEDVERSION = true;
|
Reference.WCT_HASCHECKEDVERSION = true;
|
||||||
player.addChatMessage(
|
player.addChatMessage(
|
||||||
new ChatComponentText(
|
new ChatComponentText(EnumChatFormatting.BLUE + "-=-=-=-=-=[" + EnumChatFormatting.WHITE
|
||||||
EnumChatFormatting.BLUE + "-=-=-=-=-=["
|
+ "Wireless Crafting Terminal" + EnumChatFormatting.BLUE + "]=-=-=-=-=-"));
|
||||||
+ EnumChatFormatting.WHITE
|
|
||||||
+ "Wireless Crafting Terminal"
|
|
||||||
+ EnumChatFormatting.BLUE
|
|
||||||
+ "]=-=-=-=-=-"));
|
|
||||||
player.addChatMessage(new ChatComponentText(LocaleHandler.NewVersionAvailable.getLocal()));
|
player.addChatMessage(new ChatComponentText(LocaleHandler.NewVersionAvailable.getLocal()));
|
||||||
IChatComponent component = IChatComponent.Serializer.func_150699_a(LocaleHandler.ClickString.getLocal());
|
IChatComponent component = IChatComponent.Serializer.func_150699_a(LocaleHandler.ClickString.getLocal());
|
||||||
player.addChatComponentMessage(component);
|
player.addChatComponentMessage(component);
|
||||||
@@ -63,9 +57,9 @@ public class VersionCheckHandler {
|
|||||||
private String fetchVersion() {
|
private String fetchVersion() {
|
||||||
try {
|
try {
|
||||||
InputStream in = new URL(
|
InputStream in = new URL(
|
||||||
new String(
|
new String(
|
||||||
"https://raw.githubusercontent.com/p455w0rd/WirelessCraftingTerminal/master/latestversionrv3.txt"))
|
"https://raw.githubusercontent.com/p455w0rd/WirelessCraftingTerminal/master/latestversionrv3.txt"))
|
||||||
.openStream();
|
.openStream();
|
||||||
BufferedReader r = new BufferedReader(new InputStreamReader(in));
|
BufferedReader r = new BufferedReader(new InputStreamReader(in));
|
||||||
return r.readLine();
|
return r.readLine();
|
||||||
} catch (MalformedURLException ignored) {
|
} catch (MalformedURLException ignored) {
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ import java.lang.annotation.Target;
|
|||||||
* Marker interface to help identify invocation of reflection
|
* Marker interface to help identify invocation of reflection
|
||||||
*/
|
*/
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@Target({ ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE, ElementType.METHOD })
|
@Target({ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE, ElementType.METHOD})
|
||||||
public @interface Reflected {}
|
public @interface Reflected {}
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.helpers;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.api.networking.security.WCTIActionHost;
|
|
||||||
|
|
||||||
import appeng.api.features.IWirelessTermHandler;
|
|
||||||
import appeng.api.networking.IGridNode;
|
|
||||||
import appeng.items.contents.WirelessCraftingTerminalGuiObject;
|
|
||||||
|
|
||||||
public class WTCGuiObject extends WirelessCraftingTerminalGuiObject implements WCTIActionHost {
|
|
||||||
|
|
||||||
private final int slotIndex;
|
|
||||||
|
|
||||||
public WTCGuiObject(IWirelessTermHandler wh, ItemStack is, EntityPlayer ep, World w, int x, int y, int z,
|
|
||||||
final int slotIndex) {
|
|
||||||
super(wh, is, ep, w, x, y, z);
|
|
||||||
this.slotIndex = slotIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IGridNode getActionableNode(boolean ignoreRange) {
|
|
||||||
IGridNode node = this.getActionableNode();
|
|
||||||
if (node != null) return node;
|
|
||||||
if (ignoreRange && this.getGrid() != null) {
|
|
||||||
return this.getGrid().getPivot();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getInventorySlot() {
|
|
||||||
return this.slotIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+344
@@ -0,0 +1,344 @@
|
|||||||
|
package net.p455w0rd.wirelesscraftingterminal.helpers;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.config.AccessRestriction;
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
|
import appeng.api.config.PowerMultiplier;
|
||||||
|
import appeng.api.features.ILocatable;
|
||||||
|
import appeng.api.features.IWirelessTermHandler;
|
||||||
|
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||||
|
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||||
|
import appeng.api.implementations.tiles.IWirelessAccessPoint;
|
||||||
|
import appeng.api.networking.IGrid;
|
||||||
|
import appeng.api.networking.IGridHost;
|
||||||
|
import appeng.api.networking.IGridNode;
|
||||||
|
import appeng.api.networking.IMachineSet;
|
||||||
|
import appeng.api.networking.security.BaseActionSource;
|
||||||
|
import appeng.api.networking.security.IActionHost;
|
||||||
|
import appeng.api.networking.storage.IStorageGrid;
|
||||||
|
import appeng.api.storage.IMEMonitor;
|
||||||
|
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||||
|
import appeng.api.storage.StorageChannel;
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.api.util.AECableType;
|
||||||
|
import appeng.api.util.DimensionalCoord;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.container.interfaces.IInventorySlotAware;
|
||||||
|
import appeng.tile.networking.TileWireless;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTerminalItem;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.api.networking.security.WCTIActionHost;
|
||||||
|
|
||||||
|
public class WirelessTerminalGuiObject
|
||||||
|
implements IActionHost, IPortableCell, IInventorySlotAware, WCTIActionHost, IGuiItemObject {
|
||||||
|
|
||||||
|
private final ItemStack effectiveItem;
|
||||||
|
private final IWirelessTermHandler wth;
|
||||||
|
private final String encryptionKey;
|
||||||
|
private final EntityPlayer myPlayer;
|
||||||
|
private IGrid targetGrid;
|
||||||
|
private IStorageGrid sg;
|
||||||
|
private IMEMonitor<IAEItemStack> itemStorage;
|
||||||
|
private IWirelessAccessPoint myWap;
|
||||||
|
private double sqRange = Double.MAX_VALUE;
|
||||||
|
private double myRange = Double.MAX_VALUE;
|
||||||
|
private final int inventorySlot;
|
||||||
|
|
||||||
|
public WirelessTerminalGuiObject(
|
||||||
|
final IWirelessTermHandler wh,
|
||||||
|
final ItemStack is,
|
||||||
|
final EntityPlayer ep,
|
||||||
|
final World w,
|
||||||
|
final int x,
|
||||||
|
final int y,
|
||||||
|
final int z) {
|
||||||
|
this.encryptionKey = wh.getEncryptionKey(is);
|
||||||
|
this.effectiveItem = is;
|
||||||
|
this.myPlayer = ep;
|
||||||
|
this.wth = wh;
|
||||||
|
this.inventorySlot = x;
|
||||||
|
ILocatable obj = null;
|
||||||
|
try {
|
||||||
|
final long encKey = Long.parseLong(this.encryptionKey);
|
||||||
|
obj = AEApi.instance().registries().locatable().getLocatableBy(encKey);
|
||||||
|
} catch (final NumberFormatException err) {
|
||||||
|
// :P
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj instanceof IGridHost) {
|
||||||
|
final IGridNode n = ((IGridHost) obj).getGridNode(ForgeDirection.UNKNOWN);
|
||||||
|
if (n != null) {
|
||||||
|
this.targetGrid = n.getGrid();
|
||||||
|
if (this.targetGrid != null) {
|
||||||
|
this.sg = this.targetGrid.getCache(IStorageGrid.class);
|
||||||
|
if (this.sg != null) {
|
||||||
|
this.itemStorage = this.sg.getItemInventory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Whether an infinity booster card is installed on the WCT.
|
||||||
|
*/
|
||||||
|
private boolean checkForBooster() {
|
||||||
|
if (effectiveItem != null && effectiveItem.getItem() instanceof IWirelessCraftingTerminalItem) {
|
||||||
|
IWirelessCraftingTerminalItem wct = (IWirelessCraftingTerminalItem) effectiveItem.getItem();
|
||||||
|
return wct.checkForBooster(effectiveItem);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IGrid getTargetGrid() {
|
||||||
|
return this.targetGrid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getRange() {
|
||||||
|
return this.myRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMEMonitor<IAEItemStack> getItemInventory() {
|
||||||
|
if (this.sg == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return this.sg.getItemInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMEMonitor<IAEFluidStack> getFluidInventory() {
|
||||||
|
if (this.sg == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return this.sg.getFluidInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addListener(final IMEMonitorHandlerReceiver<IAEItemStack> l, final Object verificationToken) {
|
||||||
|
if (this.itemStorage != null) {
|
||||||
|
this.itemStorage.addListener(l, verificationToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeListener(final IMEMonitorHandlerReceiver<IAEItemStack> l) {
|
||||||
|
if (this.itemStorage != null) {
|
||||||
|
this.itemStorage.removeListener(l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
@Override
|
||||||
|
public IItemList<IAEItemStack> getAvailableItems(final IItemList out) {
|
||||||
|
if (this.itemStorage != null) {
|
||||||
|
return this.itemStorage.getAvailableItems(out);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IItemList<IAEItemStack> getStorageList() {
|
||||||
|
if (this.itemStorage != null) {
|
||||||
|
return this.itemStorage.getStorageList();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AccessRestriction getAccess() {
|
||||||
|
if (this.itemStorage != null) {
|
||||||
|
return this.itemStorage.getAccess();
|
||||||
|
}
|
||||||
|
return AccessRestriction.NO_ACCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPrioritized(final IAEItemStack input) {
|
||||||
|
if (this.itemStorage != null) {
|
||||||
|
return this.itemStorage.isPrioritized(input);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canAccept(final IAEItemStack input) {
|
||||||
|
if (this.itemStorage != null) {
|
||||||
|
return this.itemStorage.canAccept(input);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPriority() {
|
||||||
|
if (this.itemStorage != null) {
|
||||||
|
return this.itemStorage.getPriority();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSlot() {
|
||||||
|
if (this.itemStorage != null) {
|
||||||
|
return this.itemStorage.getSlot();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean validForPass(final int i) {
|
||||||
|
return this.itemStorage.validForPass(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IAEItemStack injectItems(final IAEItemStack input, final Actionable type, final BaseActionSource src) {
|
||||||
|
if (this.itemStorage != null) {
|
||||||
|
return this.itemStorage.injectItems(input, type, src);
|
||||||
|
}
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IAEItemStack extractItems(final IAEItemStack request, final Actionable mode, final BaseActionSource src) {
|
||||||
|
if (this.itemStorage != null) {
|
||||||
|
return this.itemStorage.extractItems(request, mode, src);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StorageChannel getChannel() {
|
||||||
|
if (this.itemStorage != null) {
|
||||||
|
return this.itemStorage.getChannel();
|
||||||
|
}
|
||||||
|
return StorageChannel.ITEMS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double extractAEPower(final double amt, final Actionable mode, final PowerMultiplier usePowerMultiplier) {
|
||||||
|
if (this.wth != null && this.effectiveItem != null) {
|
||||||
|
if (mode == Actionable.SIMULATE) {
|
||||||
|
return this.wth.hasPower(this.myPlayer, amt, this.effectiveItem) ? amt : 0;
|
||||||
|
}
|
||||||
|
return this.wth.usePower(this.myPlayer, amt, this.effectiveItem) ? amt : 0;
|
||||||
|
}
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getItemStack() {
|
||||||
|
return this.effectiveItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IConfigManager getConfigManager() {
|
||||||
|
return this.wth.getConfigManager(this.effectiveItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IGridNode getGridNode(final ForgeDirection dir) {
|
||||||
|
return this.getActionableNode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AECableType getCableConnectionType(final ForgeDirection dir) {
|
||||||
|
return AECableType.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void securityBreak() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IGridNode getActionableNode() {
|
||||||
|
return getActionableNode(checkForBooster());
|
||||||
|
}
|
||||||
|
|
||||||
|
public IGridNode getActionableNode(boolean ignoreRange) {
|
||||||
|
this.rangeCheck(ignoreRange);
|
||||||
|
if (this.myWap != null) {
|
||||||
|
// return this.getTargetGrid().getPivot();
|
||||||
|
return this.myWap.getActionableNode();
|
||||||
|
} else {
|
||||||
|
if (ignoreRange && this.getTargetGrid() != null) {
|
||||||
|
return this.getTargetGrid().getPivot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean rangeCheck() {
|
||||||
|
return rangeCheck(checkForBooster());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean rangeCheck(boolean ignoreRange) {
|
||||||
|
this.sqRange = this.myRange = Double.MAX_VALUE;
|
||||||
|
|
||||||
|
if (this.targetGrid != null && this.itemStorage != null) {
|
||||||
|
if (this.myWap != null) {
|
||||||
|
if (this.myWap.getGrid() == this.targetGrid) {
|
||||||
|
if (this.testWap(this.myWap)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
final IMachineSet tw = this.targetGrid.getMachines(TileWireless.class);
|
||||||
|
|
||||||
|
this.myWap = null;
|
||||||
|
|
||||||
|
for (final IGridNode n : tw) {
|
||||||
|
final IWirelessAccessPoint wap = (IWirelessAccessPoint) n.getMachine();
|
||||||
|
if (this.testWap(wap, ignoreRange)) {
|
||||||
|
this.myWap = wap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.myWap != null;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean testWap(final IWirelessAccessPoint wap) {
|
||||||
|
return testWap(wap, checkForBooster());
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean testWap(final IWirelessAccessPoint wap, boolean ignoreRange) {
|
||||||
|
double rangeLimit = wap.getRange();
|
||||||
|
rangeLimit *= rangeLimit;
|
||||||
|
|
||||||
|
final DimensionalCoord dc = wap.getLocation();
|
||||||
|
|
||||||
|
if (dc.getWorld() == this.myPlayer.worldObj) {
|
||||||
|
final double offX = dc.x - this.myPlayer.posX;
|
||||||
|
final double offY = dc.y - this.myPlayer.posY;
|
||||||
|
final double offZ = dc.z - this.myPlayer.posZ;
|
||||||
|
|
||||||
|
final double r = offX * offX + offY * offY + offZ * offZ;
|
||||||
|
if (r < rangeLimit && this.sqRange > r && !ignoreRange) {
|
||||||
|
if (wap.isActive()) {
|
||||||
|
this.sqRange = r;
|
||||||
|
this.myRange = Math.sqrt(r);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (wap.isActive() && ignoreRange) {
|
||||||
|
this.sqRange = r;
|
||||||
|
this.myRange = Math.sqrt(r);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInventorySlot() {
|
||||||
|
return this.inventorySlot;
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-2
@@ -1,13 +1,12 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.implementation;
|
package net.p455w0rd.wirelesscraftingterminal.implementation;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.LoaderState;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.api.IWCTInteractionHelper;
|
import net.p455w0rd.wirelesscraftingterminal.api.IWCTInteractionHelper;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.api.IWCTItems;
|
import net.p455w0rd.wirelesscraftingterminal.api.IWCTItems;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.api.WCTApi;
|
import net.p455w0rd.wirelesscraftingterminal.api.WCTApi;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.WirelessCraftingTerminal;
|
import net.p455w0rd.wirelesscraftingterminal.common.WirelessCraftingTerminal;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
||||||
|
|
||||||
import cpw.mods.fml.common.LoaderState;
|
|
||||||
|
|
||||||
public class WCTAPIImplementation extends WCTApi {
|
public class WCTAPIImplementation extends WCTApi {
|
||||||
|
|
||||||
private final WCTItems items;
|
private final WCTItems items;
|
||||||
|
|||||||
+8
-6
@@ -1,8 +1,11 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.implementation;
|
package net.p455w0rd.wirelesscraftingterminal.implementation;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.api.IWCTInteractionHelper;
|
import net.p455w0rd.wirelesscraftingterminal.api.IWCTInteractionHelper;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
|
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||||
@@ -11,14 +14,13 @@ import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketOpenGui;
|
|||||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemWirelessCraftingTerminal;
|
import net.p455w0rd.wirelesscraftingterminal.items.ItemWirelessCraftingTerminal;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
|
|
||||||
public class WCTInteractionHelper implements IWCTInteractionHelper {
|
public class WCTInteractionHelper implements IWCTInteractionHelper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openWirelessCraftingTerminalGui(final EntityPlayer player) {
|
public void openWirelessCraftingTerminalGui(final EntityPlayer player) {
|
||||||
if (player == null || player instanceof EntityPlayerMP
|
if ((player == null)
|
||||||
|
|| (player instanceof FakePlayer)
|
||||||
|
|| (player instanceof EntityPlayerMP)
|
||||||
|| FMLCommonHandler.instance().getSide() == Side.SERVER) {
|
|| FMLCommonHandler.instance().getSide() == Side.SERVER) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -41,8 +43,8 @@ public class WCTInteractionHelper implements IWCTInteractionHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isTerminalLinked(final IWirelessCraftingTermHandler wirelessTerminal,
|
public static boolean isTerminalLinked(
|
||||||
final ItemStack wirelessTerminalItemstack) {
|
final IWirelessCraftingTermHandler wirelessTerminal, final ItemStack wirelessTerminalItemstack) {
|
||||||
return (!wirelessTerminal.getEncryptionKey(wirelessTerminalItemstack).isEmpty());
|
return (!wirelessTerminal.getEncryptionKey(wirelessTerminalItemstack).isEmpty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,13 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.integration;
|
package net.p455w0rd.wirelesscraftingterminal.integration;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.Loader;
|
import cpw.mods.fml.common.Loader;
|
||||||
import crazypants.enderio.enchantment.EnchantmentSoulBound;
|
import crazypants.enderio.enchantment.EnchantmentSoulBound;
|
||||||
import crazypants.enderio.enchantment.Enchantments;
|
import crazypants.enderio.enchantment.Enchantments;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author p455w0rd
|
* @author p455w0rd
|
||||||
|
|||||||
-1
@@ -1,7 +1,6 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.integration;
|
package net.p455w0rd.wirelesscraftingterminal.integration;
|
||||||
|
|
||||||
public interface IIntegrationModule {
|
public interface IIntegrationModule {
|
||||||
|
|
||||||
void init() throws Throwable;
|
void init() throws Throwable;
|
||||||
|
|
||||||
void postInit();
|
void postInit();
|
||||||
|
|||||||
+9
-10
@@ -1,12 +1,10 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.integration;
|
package net.p455w0rd.wirelesscraftingterminal.integration;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.ModNotInstalled;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.Loader;
|
import cpw.mods.fml.common.Loader;
|
||||||
import cpw.mods.fml.common.ModAPIManager;
|
import cpw.mods.fml.common.ModAPIManager;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.ModNotInstalled;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
||||||
|
|
||||||
public final class IntegrationNode {
|
public final class IntegrationNode {
|
||||||
|
|
||||||
@@ -24,8 +22,8 @@ public final class IntegrationNode {
|
|||||||
private Object instance;
|
private Object instance;
|
||||||
private IIntegrationModule mod = null;
|
private IIntegrationModule mod = null;
|
||||||
|
|
||||||
public IntegrationNode(final String displayName, final String modID, final IntegrationType shortName,
|
public IntegrationNode(
|
||||||
final String name) {
|
final String displayName, final String modID, final IntegrationType shortName, final String name) {
|
||||||
this.displayName = displayName;
|
this.displayName = displayName;
|
||||||
this.shortName = shortName;
|
this.shortName = shortName;
|
||||||
this.modID = modID;
|
this.modID = modID;
|
||||||
@@ -55,12 +53,13 @@ public final class IntegrationNode {
|
|||||||
switch (stage) {
|
switch (stage) {
|
||||||
case PRE_INIT:
|
case PRE_INIT:
|
||||||
final ModAPIManager apiManager = ModAPIManager.INSTANCE;
|
final ModAPIManager apiManager = ModAPIManager.INSTANCE;
|
||||||
boolean enabled = this.modID == null || Loader.isModLoaded(this.modID)
|
boolean enabled =
|
||||||
|| apiManager.hasAPI(this.modID);
|
this.modID == null || Loader.isModLoaded(this.modID) || apiManager.hasAPI(this.modID);
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
this.classValue = this.getClass().getClassLoader().loadClass(this.name);
|
this.classValue = this.getClass().getClassLoader().loadClass(this.name);
|
||||||
this.mod = (IIntegrationModule) this.classValue.getConstructor().newInstance();
|
this.mod = (IIntegrationModule)
|
||||||
|
this.classValue.getConstructor().newInstance();
|
||||||
final Field f = this.classValue.getField("instance");
|
final Field f = this.classValue.getField("instance");
|
||||||
f.set(this.classValue, this.setInstance(this.mod));
|
f.set(this.classValue, this.setInstance(this.mod));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+5
-8
@@ -1,15 +1,12 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.integration;
|
package net.p455w0rd.wirelesscraftingterminal.integration;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public enum IntegrationRegistry {
|
public enum IntegrationRegistry {
|
||||||
|
|
||||||
INSTANCE;
|
INSTANCE;
|
||||||
|
|
||||||
private static final String PACKAGE_PREFIX = "net.p455w0rd.wirelesscraftingterminal.integration.modules.";
|
private static final String PACKAGE_PREFIX = "net.p455w0rd.wirelesscraftingterminal.integration.modules.";
|
||||||
@@ -56,8 +53,8 @@ public enum IntegrationRegistry {
|
|||||||
builder.append(", ");
|
builder.append(", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
final String integrationState = node.getShortName() + ":"
|
final String integrationState =
|
||||||
+ (node.getState() == IntegrationStage.FAILED ? "OFF" : "ON");
|
node.getShortName() + ":" + (node.getState() == IntegrationStage.FAILED ? "OFF" : "ON");
|
||||||
builder.append(integrationState);
|
builder.append(integrationState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.integration;
|
package net.p455w0rd.wirelesscraftingterminal.integration;
|
||||||
|
|
||||||
public enum IntegrationType {
|
public enum IntegrationType {
|
||||||
|
|
||||||
RFItem(IntegrationSide.BOTH, "RedstoneFlux Power - Items", "CoFHAPI"),
|
RFItem(IntegrationSide.BOTH, "RedstoneFlux Power - Items", "CoFHAPI"),
|
||||||
|
|
||||||
// Waila( IntegrationSide.BOTH, "Waila", "Waila" ),
|
// Waila( IntegrationSide.BOTH, "Waila", "Waila" ),
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.integration.modules;
|
package net.p455w0rd.wirelesscraftingterminal.integration.modules;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.container.slot.SlotCraftingMatrix;
|
||||||
|
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||||
|
import appeng.integration.modules.NEIHelpers.NEIAEShapelessRecipeHandler;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import codechicken.nei.PositionedStack;
|
||||||
|
import codechicken.nei.api.API;
|
||||||
|
import codechicken.nei.api.IOverlayHandler;
|
||||||
|
import codechicken.nei.api.IStackPositioner;
|
||||||
|
import codechicken.nei.guihook.GuiContainerManager;
|
||||||
|
import codechicken.nei.guihook.IContainerTooltipHandler;
|
||||||
|
import codechicken.nei.recipe.IRecipeHandler;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
@@ -21,21 +33,9 @@ import net.p455w0rd.wirelesscraftingterminal.integration.IIntegrationModule;
|
|||||||
import net.p455w0rd.wirelesscraftingterminal.integration.IntegrationHelper;
|
import net.p455w0rd.wirelesscraftingterminal.integration.IntegrationHelper;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.integration.abstraction.INEI;
|
import net.p455w0rd.wirelesscraftingterminal.integration.abstraction.INEI;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers.NEIAEShapedRecipeHandler;
|
import net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers.NEIAEShapedRecipeHandler;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers.NEIGUIHandler;
|
||||||
import appeng.container.slot.SlotCraftingMatrix;
|
|
||||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
|
||||||
import appeng.integration.modules.NEIHelpers.NEIAEShapelessRecipeHandler;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import codechicken.nei.PositionedStack;
|
|
||||||
import codechicken.nei.api.API;
|
|
||||||
import codechicken.nei.api.IOverlayHandler;
|
|
||||||
import codechicken.nei.api.IStackPositioner;
|
|
||||||
import codechicken.nei.guihook.GuiContainerManager;
|
|
||||||
import codechicken.nei.guihook.IContainerTooltipHandler;
|
|
||||||
import codechicken.nei.recipe.IRecipeHandler;
|
|
||||||
|
|
||||||
public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
|
public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
|
||||||
|
|
||||||
@Reflected
|
@Reflected
|
||||||
public static NEI instance;
|
public static NEI instance;
|
||||||
|
|
||||||
@@ -69,6 +69,7 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
|
|||||||
"crafting");
|
"crafting");
|
||||||
API.registerRecipeHandler(new NEIAEShapedRecipeHandler());
|
API.registerRecipeHandler(new NEIAEShapedRecipeHandler());
|
||||||
API.registerRecipeHandler(new NEIAEShapelessRecipeHandler());
|
API.registerRecipeHandler(new NEIAEShapelessRecipeHandler());
|
||||||
|
API.registerNEIGuiHandler(new NEIGUIHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -93,12 +94,7 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
|
|||||||
|
|
||||||
GuiContainerManager.drawItems.renderItemAndEffectIntoGUI(fontRenderer, mc.getTextureManager(), stack, x, y);
|
GuiContainerManager.drawItems.renderItemAndEffectIntoGUI(fontRenderer, mc.getTextureManager(), stack, x, y);
|
||||||
GuiContainerManager.drawItems.renderItemOverlayIntoGUI(
|
GuiContainerManager.drawItems.renderItemOverlayIntoGUI(
|
||||||
fontRenderer,
|
fontRenderer, mc.getTextureManager(), stack, x, y, String.valueOf(stack.stackSize));
|
||||||
mc.getTextureManager(),
|
|
||||||
stack,
|
|
||||||
x,
|
|
||||||
y,
|
|
||||||
String.valueOf(stack.stackSize));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -112,6 +108,32 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> handleTooltip(
|
||||||
|
final GuiContainer arg0, final int arg1, final int arg2, final List<String> current) {
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> handleItemDisplayName(
|
||||||
|
final GuiContainer arg0, final ItemStack arg1, final List<String> current) {
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> handleItemTooltip(
|
||||||
|
final GuiContainer guiScreen,
|
||||||
|
final ItemStack stack,
|
||||||
|
final int mouseX,
|
||||||
|
final int mouseY,
|
||||||
|
final List<String> currentToolTip) {
|
||||||
|
if (guiScreen instanceof GuiWirelessCraftingTerminal) {
|
||||||
|
return ((GuiWirelessCraftingTerminal) guiScreen).handleItemTooltip(stack, mouseX, mouseY, currentToolTip);
|
||||||
|
}
|
||||||
|
|
||||||
|
return currentToolTip;
|
||||||
|
}
|
||||||
|
|
||||||
static final int NEI_REGULAR_SLOT_OFFSET_X = 25;
|
static final int NEI_REGULAR_SLOT_OFFSET_X = 25;
|
||||||
static final int NEI_REGULAR_SLOT_OFFSET_Y = 6;
|
static final int NEI_REGULAR_SLOT_OFFSET_Y = 6;
|
||||||
|
|
||||||
@@ -124,10 +146,10 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
|
|||||||
|
|
||||||
for (final PositionedStack positionedStack : stacks) {
|
for (final PositionedStack positionedStack : stacks) {
|
||||||
if (positionedStack.items != null && positionedStack.items.length > 0) {
|
if (positionedStack.items != null && positionedStack.items.length > 0) {
|
||||||
positionedStack.relx += ContainerWirelessCraftingTerminal.CRAFTING_SLOT_X_POS
|
positionedStack.relx +=
|
||||||
- NEI.NEI_REGULAR_SLOT_OFFSET_X;
|
ContainerWirelessCraftingTerminal.CRAFTING_SLOT_X_POS - NEI.NEI_REGULAR_SLOT_OFFSET_X;
|
||||||
positionedStack.rely += ContainerWirelessCraftingTerminal.CRAFTING_SLOT_Y_POS
|
positionedStack.rely +=
|
||||||
- NEI.NEI_REGULAR_SLOT_OFFSET_Y;
|
ContainerWirelessCraftingTerminal.CRAFTING_SLOT_Y_POS - NEI.NEI_REGULAR_SLOT_OFFSET_Y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return stacks;
|
return stacks;
|
||||||
@@ -135,20 +157,57 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class WCTOverlayHandler implements IOverlayHandler {
|
public class WCTOverlayHandler implements IOverlayHandler {
|
||||||
|
/**
|
||||||
|
* Reduces regular slot offsets to 0, 1, or 2
|
||||||
|
*/
|
||||||
|
private static final int REGULAR_SLOT_INDEX_DIVISOR = 18;
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
/**
|
||||||
|
* Adds NEI ingredients to the WCT crafting grid.
|
||||||
|
*
|
||||||
|
* @param ingredient
|
||||||
|
* @param overlayItems
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean addCraftingItems(final PositionedStack ingredient, final IAEItemStack[] overlayItems) {
|
||||||
|
// Calculate the slot positions
|
||||||
|
int slotX =
|
||||||
|
(ingredient.relx - NEI.NEI_REGULAR_SLOT_OFFSET_X) / WCTOverlayHandler.REGULAR_SLOT_INDEX_DIVISOR;
|
||||||
|
int slotY =
|
||||||
|
(ingredient.rely - NEI.NEI_REGULAR_SLOT_OFFSET_Y) / WCTOverlayHandler.REGULAR_SLOT_INDEX_DIVISOR;
|
||||||
|
// Calculate the slot index
|
||||||
|
int slotIndex = slotX + (slotY * 3);
|
||||||
|
// Add the item to the list
|
||||||
|
overlayItems[slotIndex] = AEApi.instance().storage().createItemStack(ingredient.item);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean addIngredientToItems(final PositionedStack ingredient, final IAEItemStack[] overlayItems) {
|
||||||
|
// Pass to regular handler
|
||||||
|
return this.addCraftingItems(ingredient, overlayItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addItemsToGUI(final IAEItemStack[] overlayItems) {
|
||||||
|
// Send the list to the server
|
||||||
|
// Packet_S_WCT.sendSetCrafting_NEI(Minecraft.getMinecraft().thePlayer,
|
||||||
|
// overlayItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
@Override
|
@Override
|
||||||
public void overlayRecipe(final GuiContainer gui, final IRecipeHandler recipe, final int recipeIndex,
|
public void overlayRecipe(
|
||||||
final boolean shift) {
|
final GuiContainer gui, final IRecipeHandler recipe, final int recipeIndex, final boolean shift) {
|
||||||
try {
|
try {
|
||||||
final List ingredients = recipe.getIngredientStacks(recipeIndex);
|
final List ingredients = recipe.getIngredientStacks(recipeIndex);
|
||||||
this.overlayRecipe(gui, ingredients, shift);
|
this.overlayRecipe(gui, ingredients, shift);
|
||||||
} catch (final Exception ignored) {} catch (final Error ignored) {}
|
} catch (final Exception ignored) {
|
||||||
|
} catch (final Error ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void overlayRecipe(final GuiContainer gui, final List<PositionedStack> ingredients,
|
private void overlayRecipe(
|
||||||
final boolean shift) {
|
final GuiContainer gui, final List<PositionedStack> ingredients, final boolean shift) {
|
||||||
try {
|
try {
|
||||||
final NBTTagCompound recipe = new NBTTagCompound();
|
final NBTTagCompound recipe = new NBTTagCompound();
|
||||||
|
|
||||||
@@ -188,7 +247,9 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
|
|||||||
|
|
||||||
NetworkHandler.instance.sendToServer(new PacketNEIRecipe(recipe));
|
NetworkHandler.instance.sendToServer(new PacketNEIRecipe(recipe));
|
||||||
}
|
}
|
||||||
} catch (final Exception ignored) {} catch (final Error ignored) {}
|
} catch (final Exception ignored) {
|
||||||
|
} catch (final Error ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+37
-28
@@ -1,20 +1,5 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers;
|
package net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers;
|
||||||
|
|
||||||
import java.awt.Rectangle;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
|
||||||
import net.minecraft.client.gui.inventory.GuiCrafting;
|
|
||||||
import net.minecraft.inventory.Container;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.MissingIngredientError;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.RegistrationError;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.api.recipes.IIngredient;
|
|
||||||
import net.p455w0rd.wirelesscraftingterminal.api.recipes.game.ShapedRecipe;
|
|
||||||
|
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import codechicken.nei.NEIClientUtils;
|
import codechicken.nei.NEIClientUtils;
|
||||||
@@ -26,6 +11,19 @@ import codechicken.nei.api.IRecipeOverlayRenderer;
|
|||||||
import codechicken.nei.api.IStackPositioner;
|
import codechicken.nei.api.IStackPositioner;
|
||||||
import codechicken.nei.recipe.RecipeInfo;
|
import codechicken.nei.recipe.RecipeInfo;
|
||||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiCrafting;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.MissingIngredientError;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.RegistrationError;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.api.recipes.IIngredient;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.api.recipes.game.ShapedRecipe;
|
||||||
|
|
||||||
public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler {
|
public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler {
|
||||||
|
|
||||||
@@ -68,16 +66,30 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @Override public void loadUsageRecipes( final ItemStack ingredient ) { final List<IRecipe> recipes =
|
@Override
|
||||||
* CraftingManager.getInstance().getRecipeList(); for( final IRecipe recipe : recipes ) { if( ( recipe instanceof
|
public void loadUsageRecipes( final ItemStack ingredient )
|
||||||
* ShapedRecipe ) ) { final CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe ); if( (
|
{
|
||||||
* (ShapedRecipe) recipe ).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) )
|
final List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||||
* { cachedRecipe.computeVisuals(); if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) ) {
|
for( final IRecipe recipe : recipes )
|
||||||
* cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient ); this.arecipes.add( cachedRecipe );
|
{
|
||||||
* } } } } }
|
if( ( recipe instanceof ShapedRecipe ) )
|
||||||
*/
|
{
|
||||||
|
final CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe );
|
||||||
|
|
||||||
|
if( ( (ShapedRecipe) recipe ).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) )
|
||||||
|
{
|
||||||
|
cachedRecipe.computeVisuals();
|
||||||
|
if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||||
|
{
|
||||||
|
cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient );
|
||||||
|
this.arecipes.add( cachedRecipe );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getGuiTexture() {
|
public String getGuiTexture() {
|
||||||
return "textures/gui/container/crafting_table.png";
|
return "textures/gui/container/crafting_table.png";
|
||||||
@@ -159,10 +171,7 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler {
|
|||||||
try {
|
try {
|
||||||
final ItemStack[] is = ing.getItemStackSet();
|
final ItemStack[] is = ing.getItemStackSet();
|
||||||
final PositionedStack stack = new PositionedStack(
|
final PositionedStack stack = new PositionedStack(
|
||||||
useSingleItems ? Platform.findPreferred(is) : is,
|
useSingleItems ? Platform.findPreferred(is) : is, 25 + x * 18, 6 + y * 18, false);
|
||||||
25 + x * 18,
|
|
||||||
6 + y * 18,
|
|
||||||
false);
|
|
||||||
stack.setMaxSize(1);
|
stack.setMaxSize(1);
|
||||||
this.ingredients.add(stack);
|
this.ingredients.add(stack);
|
||||||
} catch (final RegistrationError ignored) {
|
} catch (final RegistrationError ignored) {
|
||||||
|
|||||||
+15
-13
@@ -1,8 +1,13 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers;
|
package net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers;
|
||||||
|
|
||||||
|
import appeng.container.slot.SlotCraftingMatrix;
|
||||||
|
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import codechicken.nei.PositionedStack;
|
||||||
|
import codechicken.nei.api.IOverlayHandler;
|
||||||
|
import codechicken.nei.recipe.IRecipeHandler;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -12,25 +17,20 @@ import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTermi
|
|||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketNEIRecipe;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketNEIRecipe;
|
||||||
|
|
||||||
import appeng.container.slot.SlotCraftingMatrix;
|
|
||||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import codechicken.nei.PositionedStack;
|
|
||||||
import codechicken.nei.api.IOverlayHandler;
|
|
||||||
import codechicken.nei.recipe.IRecipeHandler;
|
|
||||||
|
|
||||||
public class NEICraftingHandler implements IOverlayHandler {
|
public class NEICraftingHandler implements IOverlayHandler {
|
||||||
|
|
||||||
public NEICraftingHandler(final int x, final int y) {}
|
public NEICraftingHandler(final int x, final int y) {}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
@Override
|
@Override
|
||||||
public void overlayRecipe(final GuiContainer gui, final IRecipeHandler recipe, final int recipeIndex,
|
public void overlayRecipe(
|
||||||
final boolean shift) {
|
final GuiContainer gui, final IRecipeHandler recipe, final int recipeIndex, final boolean shift) {
|
||||||
try {
|
try {
|
||||||
final List ingredients = recipe.getIngredientStacks(recipeIndex);
|
final List ingredients = recipe.getIngredientStacks(recipeIndex);
|
||||||
this.overlayRecipe(gui, ingredients, shift);
|
this.overlayRecipe(gui, ingredients, shift);
|
||||||
} catch (final Exception ignored) {} catch (final Error ignored) {}
|
} catch (final Exception ignored) {
|
||||||
|
} catch (final Error ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -74,6 +74,8 @@ public class NEICraftingHandler implements IOverlayHandler {
|
|||||||
|
|
||||||
NetworkHandler.instance.sendToServer(new PacketNEIRecipe(recipe));
|
NetworkHandler.instance.sendToServer(new PacketNEIRecipe(recipe));
|
||||||
}
|
}
|
||||||
} catch (final Exception ignored) {} catch (final Error ignored) {}
|
} catch (final Exception ignored) {
|
||||||
|
} catch (final Error ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
package net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers;
|
||||||
|
|
||||||
|
import codechicken.nei.api.INEIGuiAdapter;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal;
|
||||||
|
|
||||||
|
public class NEIGUIHandler extends INEIGuiAdapter {
|
||||||
|
|
||||||
|
protected Pattern SPECIAL_REGEX_CHARS = Pattern.compile("[{}()\\[\\].+*?^$\\\\|]");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button) {
|
||||||
|
if (gui instanceof GuiWirelessCraftingTerminal && draggedStack != null && draggedStack.getItem() != null) {
|
||||||
|
GuiWirelessCraftingTerminal gmm = (GuiWirelessCraftingTerminal) gui;
|
||||||
|
if (gmm.isOverSearchField(mousex, mousey)) {
|
||||||
|
gmm.setSearchString(SPECIAL_REGEX_CHARS
|
||||||
|
.matcher(draggedStack.getDisplayName())
|
||||||
|
.replaceAll("\\\\$0"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.handleDragNDrop(gui, mousex, mousey, draggedStack, button);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,6 @@ import net.p455w0rd.wirelesscraftingterminal.integration.IIntegrationModule;
|
|||||||
import net.p455w0rd.wirelesscraftingterminal.integration.IntegrationHelper;
|
import net.p455w0rd.wirelesscraftingterminal.integration.IntegrationHelper;
|
||||||
|
|
||||||
public class RFItem implements IIntegrationModule {
|
public class RFItem implements IIntegrationModule {
|
||||||
|
|
||||||
@Reflected
|
@Reflected
|
||||||
public static RFItem instance;
|
public static RFItem instance;
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -1,8 +1,7 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.integration.modules.helpers;
|
package net.p455w0rd.wirelesscraftingterminal.integration.modules.helpers;
|
||||||
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
|
|
||||||
import cofh.api.energy.IEnergyReceiver;
|
import cofh.api.energy.IEnergyReceiver;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class NullRFHandler implements IEnergyReceiver {
|
public class NullRFHandler implements IEnergyReceiver {
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.items;
|
package net.p455w0rd.wirelesscraftingterminal.items;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class ItemBoosterBGIcon extends Item {
|
public class ItemBoosterBGIcon extends Item {
|
||||||
|
|
||||||
public static IIcon[] boosterIcon;
|
public static IIcon[] boosterIcon;
|
||||||
@@ -23,7 +22,8 @@ public class ItemBoosterBGIcon extends Item {
|
|||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@Override
|
@Override
|
||||||
public void registerIcons(IIconRegister register) {
|
public void registerIcons(IIconRegister register) {
|
||||||
boosterIcon[0] = register.registerIcon(Reference.MODID + ":" + this.getUnlocalizedName().substring(5));
|
boosterIcon[0] = register.registerIcon(
|
||||||
|
Reference.MODID + ":" + this.getUnlocalizedName().substring(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public enum ItemEnum {
|
public enum ItemEnum {
|
||||||
|
|
||||||
BOOSTER_CARD("infinityBoosterCard", new ItemInfinityBooster().setUnlocalizedName("infinityBoosterCard")),
|
BOOSTER_CARD("infinityBoosterCard", new ItemInfinityBooster().setUnlocalizedName("infinityBoosterCard")),
|
||||||
BOOSTER_ICON("infinityBoosterIcon", new ItemInfinityBooster().hasEffect(true)),
|
BOOSTER_ICON("infinityBoosterIcon", new ItemInfinityBooster().hasEffect(true)),
|
||||||
WIRELESS_CRAFTING_TERMINAL("wirelessCraftingTerminal", new ItemWirelessCraftingTerminal()),
|
WIRELESS_CRAFTING_TERMINAL("wirelessCraftingTerminal", new ItemWirelessCraftingTerminal()),
|
||||||
|
|||||||
@@ -1,22 +1,18 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.items;
|
package net.p455w0rd.wirelesscraftingterminal.items;
|
||||||
|
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
import org.apache.commons.lang3.text.WordUtils;
|
import org.apache.commons.lang3.text.WordUtils;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import com.google.common.base.Splitter;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class ItemInfinityBooster extends Item {
|
public class ItemInfinityBooster extends Item {
|
||||||
|
|
||||||
public boolean showEffect = false;
|
public boolean showEffect = false;
|
||||||
@@ -43,13 +39,14 @@ public class ItemInfinityBooster extends Item {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack is, EntityPlayer player, List list, boolean par4) {
|
public void addInformation(ItemStack is, EntityPlayer player, List list, boolean par4) {
|
||||||
String shift = LocaleHandler.PressShift.getLocal().replace(
|
String shift = LocaleHandler.PressShift.getLocal()
|
||||||
"Shift",
|
.replace(
|
||||||
color("yellow") + "" + color("bold") + "" + color("italics") + "Shift" + color("gray"));
|
"Shift",
|
||||||
|
color("yellow") + "" + color("bold") + "" + color("italics") + "Shift" + color("gray"));
|
||||||
list.add(color("aqua") + "==============================");
|
list.add(color("aqua") + "==============================");
|
||||||
if (isShiftKeyDown()) {
|
if (isShiftKeyDown()) {
|
||||||
String info = LocaleHandler.InfinityBoosterDesc.getLocal();
|
String info = LocaleHandler.InfinityBoosterDesc.getLocal();
|
||||||
|
|||||||
@@ -1,9 +1,22 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.items;
|
package net.p455w0rd.wirelesscraftingterminal.items;
|
||||||
|
|
||||||
|
import appeng.api.config.SecurityPermissions;
|
||||||
|
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||||
|
import appeng.api.networking.IGrid;
|
||||||
|
import appeng.api.networking.energy.IEnergyGrid;
|
||||||
|
import appeng.api.networking.energy.IEnergySource;
|
||||||
|
import appeng.api.networking.security.BaseActionSource;
|
||||||
|
import appeng.api.networking.security.ISecurityGrid;
|
||||||
|
import appeng.api.storage.IMEInventoryHandler;
|
||||||
|
import appeng.api.storage.IMEMonitor;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.item.EntityXPOrb;
|
import net.minecraft.entity.item.EntityXPOrb;
|
||||||
@@ -23,30 +36,14 @@ import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
|||||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMagnetFilter;
|
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMagnetFilter;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.handlers.KeybindHandler;
|
import net.p455w0rd.wirelesscraftingterminal.handlers.KeybindHandler;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.helpers.WTCGuiObject;
|
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
import org.apache.commons.lang3.text.WordUtils;
|
import org.apache.commons.lang3.text.WordUtils;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import com.google.common.base.Splitter;
|
|
||||||
|
|
||||||
import appeng.api.config.SecurityPermissions;
|
|
||||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
|
||||||
import appeng.api.networking.IGrid;
|
|
||||||
import appeng.api.networking.energy.IEnergyGrid;
|
|
||||||
import appeng.api.networking.energy.IEnergySource;
|
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
|
||||||
import appeng.api.networking.security.ISecurityGrid;
|
|
||||||
import appeng.api.storage.IMEInventoryHandler;
|
|
||||||
import appeng.api.storage.IMEMonitor;
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Jotato's amazing magnet item from QuantumFlux adapted for use in the Wireless Crafting Terminal
|
* Jotato's amazing magnet item from QuantumFlux adapted for use in the Wireless
|
||||||
|
* Crafting Terminal
|
||||||
*
|
*
|
||||||
* @author p455w0rd, Jotato
|
* @author p455w0rd, Jotato
|
||||||
*
|
*
|
||||||
@@ -54,7 +51,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||||||
public class ItemMagnet extends Item {
|
public class ItemMagnet extends Item {
|
||||||
|
|
||||||
private int distanceFromPlayer;
|
private int distanceFromPlayer;
|
||||||
public WTCGuiObject obj;
|
public WirelessTerminalGuiObject obj;
|
||||||
public IPortableCell civ;
|
public IPortableCell civ;
|
||||||
public IEnergySource powerSrc;
|
public IEnergySource powerSrc;
|
||||||
public IMEMonitor<IAEItemStack> monitor;
|
public IMEMonitor<IAEItemStack> monitor;
|
||||||
@@ -114,31 +111,22 @@ public class ItemMagnet extends Item {
|
|||||||
if (isActivated(itemStack)) {
|
if (isActivated(itemStack)) {
|
||||||
String boundKey = Keyboard.getKeyName(KeybindHandler.openMagnetFilter.getKeyCode());
|
String boundKey = Keyboard.getKeyName(KeybindHandler.openMagnetFilter.getKeyCode());
|
||||||
if (!boundKey.equals("NONE")) {
|
if (!boundKey.equals("NONE")) {
|
||||||
list.add(
|
list.add(color("italics") + LocaleHandler.OrPress.getLocal() + " " + color("yellow") + color("bold")
|
||||||
color("italics") + LocaleHandler.OrPress
|
+ "[" + boundKey + "]");
|
||||||
.getLocal() + " " + color("yellow") + color("bold") + "[" + boundKey + "]");
|
|
||||||
}
|
}
|
||||||
String boundKey2 = Keyboard.getKeyName(KeybindHandler.changeMagnetMode.getKeyCode());
|
String boundKey2 = Keyboard.getKeyName(KeybindHandler.changeMagnetMode.getKeyCode());
|
||||||
if (!boundKey2.equals("NONE")) {
|
if (!boundKey2.equals("NONE")) {
|
||||||
list.add(
|
list.add(color("italics") + LocaleHandler.Press.getLocal() + " " + color("yellow") + color("bold")
|
||||||
color("italics") + LocaleHandler.Press.getLocal()
|
+ "[" + boundKey2 + "] " + color("gray") + color("italics")
|
||||||
+ " "
|
+ LocaleHandler.ToSwitchMode.getLocal());
|
||||||
+ color("yellow")
|
|
||||||
+ color("bold")
|
|
||||||
+ "["
|
|
||||||
+ boundKey2
|
|
||||||
+ "] "
|
|
||||||
+ color("gray")
|
|
||||||
+ color("italics")
|
|
||||||
+ LocaleHandler.ToSwitchMode.getLocal());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list.add("");
|
list.add("");
|
||||||
list.add(
|
list.add(LocaleHandler.Status.getLocal() + ": "
|
||||||
LocaleHandler.Status.getLocal() + ": "
|
+ (isActivated(is)
|
||||||
+ (isActivated(is) ? color("green") + LocaleHandler.Active.getLocal()
|
? color("green") + LocaleHandler.Active.getLocal()
|
||||||
: color("red") + LocaleHandler.Inactive.getLocal()));
|
: color("red") + LocaleHandler.Inactive.getLocal()));
|
||||||
if (is.getItemDamage() == 1) {
|
if (is.getItemDamage() == 1) {
|
||||||
list.add(color("white") + " " + LocaleHandler.MagnetActiveDesc1.getLocal());
|
list.add(color("white") + " " + LocaleHandler.MagnetActiveDesc1.getLocal());
|
||||||
} else if (is.getItemDamage() == 2) {
|
} else if (is.getItemDamage() == 2) {
|
||||||
@@ -192,13 +180,13 @@ public class ItemMagnet extends Item {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) {
|
public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) {
|
||||||
if (player.isSneaking() && !world.isRemote) {
|
if (!world.isRemote) {
|
||||||
switchMagnetMode(item, player);
|
if (player.isSneaking()) {
|
||||||
} else {
|
switchMagnetMode(item, player);
|
||||||
if (!RandomUtils.isMagnetInitialized(item) && world.isRemote) {
|
} else {
|
||||||
NetworkHandler.instance.sendToServer(new PacketMagnetFilter(0, true));
|
if (!RandomUtils.isMagnetInitialized(item)) {
|
||||||
}
|
NetworkHandler.instance.sendToServer(new PacketMagnetFilter(0, true));
|
||||||
if (!world.isRemote) {
|
}
|
||||||
int x = (int) player.posX;
|
int x = (int) player.posX;
|
||||||
int y = (int) player.posY;
|
int y = (int) player.posY;
|
||||||
int z = (int) player.posZ;
|
int z = (int) player.posZ;
|
||||||
@@ -241,12 +229,13 @@ public class ItemMagnet extends Item {
|
|||||||
// List<ItemStack> filteredList = getFilteredItems(getItemStack());
|
// List<ItemStack> filteredList = getFilteredItems(getItemStack());
|
||||||
// items
|
// items
|
||||||
Iterator<? extends Entity> iterator = getEntitiesInRange(
|
Iterator<? extends Entity> iterator = getEntitiesInRange(
|
||||||
EntityItem.class,
|
EntityItem.class,
|
||||||
world,
|
world,
|
||||||
(int) player.posX,
|
(int) player.posX,
|
||||||
(int) player.posY,
|
(int) player.posY,
|
||||||
(int) player.posZ,
|
(int) player.posZ,
|
||||||
distanceFromPlayer).iterator();
|
distanceFromPlayer)
|
||||||
|
.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
EntityItem itemToGet = (EntityItem) iterator.next();
|
EntityItem itemToGet = (EntityItem) iterator.next();
|
||||||
if (itemToGet.func_145800_j() != null && itemToGet.func_145800_j().equals(player.getCommandSenderName())) {
|
if (itemToGet.func_145800_j() != null && itemToGet.func_145800_j().equals(player.getCommandSenderName())) {
|
||||||
@@ -273,12 +262,13 @@ public class ItemMagnet extends Item {
|
|||||||
|
|
||||||
// xp
|
// xp
|
||||||
iterator = getEntitiesInRange(
|
iterator = getEntitiesInRange(
|
||||||
EntityXPOrb.class,
|
EntityXPOrb.class,
|
||||||
world,
|
world,
|
||||||
(int) player.posX,
|
(int) player.posX,
|
||||||
(int) player.posY,
|
(int) player.posY,
|
||||||
(int) player.posZ,
|
(int) player.posZ,
|
||||||
distanceFromPlayer).iterator();
|
distanceFromPlayer)
|
||||||
|
.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
EntityXPOrb xpToGet = (EntityXPOrb) iterator.next();
|
EntityXPOrb xpToGet = (EntityXPOrb) iterator.next();
|
||||||
if (xpToGet.isDead || xpToGet.isInvisible()) {
|
if (xpToGet.isDead || xpToGet.isInvisible()) {
|
||||||
@@ -298,8 +288,8 @@ public class ItemMagnet extends Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doVanillaPickup(EntityItem itemToGet, EntityPlayer player, ItemStack itemStackToGet, World world,
|
public void doVanillaPickup(
|
||||||
int stackSize) {
|
EntityItem itemToGet, EntityPlayer player, ItemStack itemStackToGet, World world, int stackSize) {
|
||||||
if (pickupTimer < 100) {
|
if (pickupTimer < 100) {
|
||||||
pickupTimer++;
|
pickupTimer++;
|
||||||
return;
|
return;
|
||||||
@@ -373,7 +363,8 @@ public class ItemMagnet extends Item {
|
|||||||
}
|
}
|
||||||
// ignore nothing/don't use oredict--must be exact match
|
// ignore nothing/don't use oredict--must be exact match
|
||||||
else {
|
else {
|
||||||
if (isMetaEqual(is, thisStack) && ItemStack.areItemStackTagsEqual(is, thisStack)
|
if (isMetaEqual(is, thisStack)
|
||||||
|
&& ItemStack.areItemStackTagsEqual(is, thisStack)
|
||||||
&& is.getItem() == thisStack.getItem()) {
|
&& is.getItem() == thisStack.getItem()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -387,12 +378,12 @@ public class ItemMagnet extends Item {
|
|||||||
return is1.getItemDamage() == is2.getItemDamage();
|
return is1.getItemDamage() == is2.getItemDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasNetworkAccess(final SecurityPermissions perm, final boolean requirePower, EntityPlayer player,
|
public boolean hasNetworkAccess(
|
||||||
ItemStack wirelessTerm) {
|
final SecurityPermissions perm, final boolean requirePower, EntityPlayer player, ItemStack wirelessTerm) {
|
||||||
if (player.capabilities.isCreativeMode) {
|
if (player.capabilities.isCreativeMode) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final IGrid g = obj.getGrid();
|
final IGrid g = obj.getTargetGrid();
|
||||||
if (g != null) {
|
if (g != null) {
|
||||||
if (requirePower) {
|
if (requirePower) {
|
||||||
final IEnergyGrid eg = g.getCache(IEnergyGrid.class);
|
final IEnergyGrid eg = g.getCache(IEnergyGrid.class);
|
||||||
@@ -432,8 +423,13 @@ public class ItemMagnet extends Item {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean doInject(IAEItemStack ais, int stackSize, EntityPlayer player, EntityItem itemToGet,
|
public boolean doInject(
|
||||||
ItemStack itemStackToGet, World world) {
|
IAEItemStack ais,
|
||||||
|
int stackSize,
|
||||||
|
EntityPlayer player,
|
||||||
|
EntityItem itemToGet,
|
||||||
|
ItemStack itemStackToGet,
|
||||||
|
World world) {
|
||||||
ais = Platform.poweredInsert(powerSrc, cellInv, ais, mySrc);
|
ais = Platform.poweredInsert(powerSrc, cellInv, ais, mySrc);
|
||||||
if (ais != null) {
|
if (ais != null) {
|
||||||
player.onItemPickup(itemToGet, stackSize);
|
player.onItemPickup(itemToGet, stackSize);
|
||||||
@@ -479,17 +475,12 @@ public class ItemMagnet extends Item {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<? extends Entity> getEntitiesInRange(Class<?> entityType, World world, int x, int y, int z,
|
public static List<? extends Entity> getEntitiesInRange(
|
||||||
int distance) {
|
Class<?> entityType, World world, int x, int y, int z, int distance) {
|
||||||
return world.getEntitiesWithinAABB(
|
return world.getEntitiesWithinAABB(
|
||||||
entityType,
|
entityType,
|
||||||
AxisAlignedBB.getBoundingBox(
|
AxisAlignedBB.getBoundingBox(
|
||||||
x - distance,
|
x - distance, y - distance, z - distance, x + distance, y + distance, z + distance));
|
||||||
y - distance,
|
|
||||||
z - distance,
|
|
||||||
x + distance,
|
|
||||||
y + distance,
|
|
||||||
z + distance));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getStack() {
|
public ItemStack getStack() {
|
||||||
|
|||||||
+98
-86
@@ -1,7 +1,19 @@
|
|||||||
package net.p455w0rd.wirelesscraftingterminal.items;
|
package net.p455w0rd.wirelesscraftingterminal.items;
|
||||||
|
|
||||||
|
import appeng.api.config.*;
|
||||||
|
import appeng.api.features.IWirelessTermHandler;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.items.tools.powered.powersink.AERootPoweredItem;
|
||||||
|
import appeng.util.ConfigManager;
|
||||||
|
import appeng.util.IConfigManagerHost;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import baubles.api.BaubleType;
|
||||||
|
import baubles.api.IBauble;
|
||||||
|
import com.google.common.base.Optional;
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
@@ -14,46 +26,25 @@ import net.minecraft.nbt.NBTTagList;
|
|||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTerminalItem;
|
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTerminalItem;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
|
import net.p455w0rd.wirelesscraftingterminal.api.WCTApi;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.integration.EnderIO;
|
import net.p455w0rd.wirelesscraftingterminal.integration.EnderIO;
|
||||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||||
|
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
|
||||||
|
|
||||||
import appeng.api.config.AccessRestriction;
|
|
||||||
import appeng.api.config.PowerUnits;
|
|
||||||
import appeng.api.config.Settings;
|
|
||||||
import appeng.api.config.SortDir;
|
|
||||||
import appeng.api.config.SortOrder;
|
|
||||||
import appeng.api.config.ViewItems;
|
|
||||||
import appeng.api.features.IWirelessTermHandler;
|
|
||||||
import appeng.api.util.IConfigManager;
|
|
||||||
import appeng.core.AppEng;
|
|
||||||
import appeng.items.tools.powered.powersink.AERootPoweredItem;
|
|
||||||
import appeng.util.ConfigManager;
|
|
||||||
import appeng.util.IConfigManagerHost;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import baubles.api.BaubleType;
|
|
||||||
import baubles.api.expanded.IBaubleExpanded;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
@cpw.mods.fml.common.Optional.Interface(iface = "baubles.api.expanded.IBaubleExpanded", modid = "Baubles|Expanded")
|
|
||||||
public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
||||||
implements IWirelessCraftingTerminalItem, IWirelessTermHandler, IBaubleExpanded {
|
implements IWirelessCraftingTerminalItem, IWirelessTermHandler, IBauble {
|
||||||
|
|
||||||
public static final String LINK_KEY_STRING = "key";
|
public static final String LINK_KEY_STRING = "key";
|
||||||
|
public static double GLOBAL_POWER_MULTIPLIER = PowerMultiplier.CONFIG.multiplier;
|
||||||
private static final String POWER_NBT_KEY = "internalCurrentPower";
|
private static final String POWER_NBT_KEY = "internalCurrentPower";
|
||||||
private static final String BOOSTER_SLOT_NBT = "BoosterSlot";
|
private static final String BOOSTER_SLOT_NBT = "BoosterSlot";
|
||||||
private static final String MAGNET_SLOT_NBT = "MagnetSlot";
|
private static final String MAGNET_SLOT_NBT = "MagnetSlot";
|
||||||
private EntityPlayer entityPlayer;
|
private EntityPlayer entityPlayer;
|
||||||
|
|
||||||
public ItemWirelessCraftingTerminal() {
|
public ItemWirelessCraftingTerminal() {
|
||||||
super(Reference.WCT_MAX_POWER, Optional.absent());
|
super(Reference.WCT_MAX_POWER, Optional.<String>absent());
|
||||||
setUnlocalizedName("wirelessCraftingTerminal");
|
setUnlocalizedName("wirelessCraftingTerminal");
|
||||||
setTextureName(Reference.MODID + ":wirelessCraftingTerminal");
|
setTextureName(Reference.MODID + ":wirelessCraftingTerminal");
|
||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
@@ -88,37 +79,62 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method return the type of bauble this is.
|
||||||
|
* Type is used to determine the slots it can go into.
|
||||||
|
*
|
||||||
|
* @param itemstack
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String[] getBaubleTypes(ItemStack itemstack) {
|
public BaubleType getBaubleType(ItemStack itemstack) {
|
||||||
return new String[] { AppEng.BAUBLESLOT };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@cpw.mods.fml.common.Optional.Method(modid = "Baubles")
|
|
||||||
public BaubleType getBaubleType(ItemStack itemStack) {
|
|
||||||
return BaubleType.RING;
|
return BaubleType.RING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called once per tick if the bauble is being worn by a player
|
||||||
|
*
|
||||||
|
* @param itemstack
|
||||||
|
* @param player
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
@cpw.mods.fml.common.Optional.Method(modid = "Baubles")
|
public void onWornTick(ItemStack itemstack, EntityLivingBase player) {}
|
||||||
public void onWornTick(ItemStack itemstack, EntityLivingBase player) { /**/ }
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called when the bauble is equipped by a player
|
||||||
|
*
|
||||||
|
* @param itemstack
|
||||||
|
* @param player
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
@cpw.mods.fml.common.Optional.Method(modid = "Baubles")
|
public void onEquipped(ItemStack itemstack, EntityLivingBase player) {}
|
||||||
public void onEquipped(ItemStack itemstack, EntityLivingBase player) { /**/ }
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called when the bauble is unequipped by a player
|
||||||
|
*
|
||||||
|
* @param itemstack
|
||||||
|
* @param player
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
@cpw.mods.fml.common.Optional.Method(modid = "Baubles")
|
public void onUnequipped(ItemStack itemstack, EntityLivingBase player) {}
|
||||||
public void onUnequipped(ItemStack itemstack, EntityLivingBase player) { /**/ }
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* can this bauble be placed in a bauble slot
|
||||||
|
*
|
||||||
|
* @param itemstack
|
||||||
|
* @param player
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
@cpw.mods.fml.common.Optional.Method(modid = "Baubles")
|
|
||||||
public boolean canEquip(ItemStack itemstack, EntityLivingBase player) {
|
public boolean canEquip(ItemStack itemstack, EntityLivingBase player) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can this bauble be removed from a bauble slot
|
||||||
|
*
|
||||||
|
* @param itemstack
|
||||||
|
* @param player
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
@cpw.mods.fml.common.Optional.Method(modid = "Baubles")
|
|
||||||
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) {
|
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -146,16 +162,16 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpdate(final ItemStack is, final World w, final Entity e, int i, boolean f) {
|
public void onUpdate(final ItemStack is, final World w, final Entity e, int i, boolean f) {
|
||||||
if (!(e instanceof EntityPlayer p)) {
|
if (!(e instanceof EntityPlayer)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
EntityPlayer p = (EntityPlayer) e;
|
||||||
if (entityPlayer == null) {
|
if (entityPlayer == null) {
|
||||||
entityPlayer = p;
|
entityPlayer = p;
|
||||||
}
|
}
|
||||||
|
ItemStack wirelessTerminal = null;
|
||||||
InventoryPlayer inv = p.inventory;
|
InventoryPlayer inv = p.inventory;
|
||||||
ItemStack wirelessTerminal = RandomUtils.getWirelessTerm(inv);
|
wirelessTerminal = RandomUtils.getWirelessTerm(inv);
|
||||||
if (wirelessTerminal == null || !(wirelessTerminal.getItem() instanceof IWirelessCraftingTerminalItem)) {
|
if (wirelessTerminal == null || !(wirelessTerminal.getItem() instanceof IWirelessCraftingTerminalItem)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -164,16 +180,10 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer player) {
|
public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer player) {
|
||||||
if (!world.isRemote) {
|
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||||
WCTGuiHandler.launchGui(
|
// Open the gui
|
||||||
Reference.GUI_WCT,
|
WCTApi.instance().interact().openWirelessCraftingTerminalGui(player);
|
||||||
player,
|
|
||||||
player.worldObj,
|
|
||||||
(int) player.posX,
|
|
||||||
(int) player.posY,
|
|
||||||
(int) player.posZ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,7 +216,7 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHandle(final ItemStack is) {
|
public boolean canHandle(final ItemStack is) {
|
||||||
return is != null && is.getItem() instanceof IWirelessCraftingTerminalItem;
|
return is.getItem() instanceof IWirelessCraftingTerminalItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -219,17 +229,15 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
|||||||
return getAECurrentPower(is) >= amt;
|
return getAECurrentPower(is) >= amt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasInfinityRange(ItemStack is) {
|
|
||||||
return this.checkForBooster(is);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IConfigManager getConfigManager(final ItemStack target) {
|
public IConfigManager getConfigManager(final ItemStack target) {
|
||||||
final ConfigManager out = new ConfigManager(new IConfigManagerHost() {
|
final ConfigManager out = new ConfigManager(new IConfigManagerHost() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {
|
public void updateSetting(
|
||||||
|
final IConfigManager manager,
|
||||||
|
@SuppressWarnings("rawtypes") final Enum settingName,
|
||||||
|
@SuppressWarnings("rawtypes") final Enum newValue) {
|
||||||
final NBTTagCompound data = Platform.openNbtData(target);
|
final NBTTagCompound data = Platform.openNbtData(target);
|
||||||
manager.writeToNBT(data);
|
manager.writeToNBT(data);
|
||||||
}
|
}
|
||||||
@@ -243,58 +251,61 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
@Override
|
@Override
|
||||||
public void getCheckedSubItems(Item item, CreativeTabs creativeTab, List itemList) {
|
public void getCheckedSubItems(Item item, CreativeTabs creativeTab, List itemList) {
|
||||||
itemList.add(new ItemStack(item));
|
List itemList2 = itemList;
|
||||||
|
itemList2.add(new ItemStack(item));
|
||||||
ItemStack is = new ItemStack(item);
|
ItemStack is = new ItemStack(item);
|
||||||
injectAEPower(is, Reference.WCT_MAX_POWER);
|
injectAEPower(is, Reference.WCT_MAX_POWER);
|
||||||
itemList.add(is);
|
itemList2.add(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean showDurabilityBar(ItemStack is) {
|
public boolean showDurabilityBar(ItemStack is) {
|
||||||
double aeCurrPower = getAECurrentPower(is);
|
double aeCurrPower = getAECurrentPower(is);
|
||||||
double aeMaxPower = getAEMaxPower(is);
|
double aeMaxPower = getAEMaxPower(is);
|
||||||
return (int) aeCurrPower < (int) aeMaxPower;
|
if ((int) aeCurrPower >= (int) aeMaxPower) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@Override
|
@Override
|
||||||
public void addCheckedInformation(ItemStack is, EntityPlayer player, List list, boolean displayMore) {
|
public void addCheckedInformation(ItemStack is, EntityPlayer player, List list, boolean displayMore) {
|
||||||
String shift = LocaleHandler.PressShift.getLocal()
|
String shift = LocaleHandler.PressShift.getLocal()
|
||||||
.replace("Shift", color("yellow") + color("bold") + color("italics") + "Shift" + color("gray"));
|
.replace(
|
||||||
|
"Shift",
|
||||||
|
color("yellow") + "" + color("bold") + "" + color("italics") + "Shift" + color("gray"));
|
||||||
final NBTTagCompound tag = ensureTagCompound(is);
|
final NBTTagCompound tag = ensureTagCompound(is);
|
||||||
|
|
||||||
String encKey = tag.getString("key");
|
String encKey = tag.getString("key");
|
||||||
String pctTxtColor = color("white");
|
String pctTxtColor = color("white") + "";
|
||||||
double aeCurrPower = getAECurrentPower(is);
|
double aeCurrPower = getAECurrentPower(is);
|
||||||
double aeCurrPowerPct = (int) Math.floor(aeCurrPower / Reference.WCT_MAX_POWER * 1e4) / 1e2;
|
double aeCurrPowerPct = (int) Math.floor(aeCurrPower / Reference.WCT_MAX_POWER * 1e4) / 1e2;
|
||||||
if ((int) aeCurrPowerPct >= 75) {
|
if ((int) aeCurrPowerPct >= 75) {
|
||||||
pctTxtColor = color("green");
|
pctTxtColor = color("green") + "";
|
||||||
}
|
}
|
||||||
if ((int) aeCurrPowerPct <= 5) {
|
if ((int) aeCurrPowerPct <= 5) {
|
||||||
pctTxtColor = color("red");
|
pctTxtColor = color("red") + "";
|
||||||
}
|
}
|
||||||
list.add(color("aqua") + "==============================");
|
list.add(color("aqua") + "==============================");
|
||||||
list.add(
|
list.add(StatCollector.translateToLocal("gui.appliedenergistics2.StoredEnergy") + ": " + pctTxtColor
|
||||||
StatCollector.translateToLocal("gui.appliedenergistics2.StoredEnergy") + ": "
|
+ (int) aeCurrPower + " AE - " + aeCurrPowerPct + "%");
|
||||||
+ pctTxtColor
|
|
||||||
+ (int) aeCurrPower
|
|
||||||
+ " AE - "
|
|
||||||
+ aeCurrPowerPct
|
|
||||||
+ "%");
|
|
||||||
if (isShiftKeyDown()) {
|
if (isShiftKeyDown()) {
|
||||||
String linked = color("red") + StatCollector.translateToLocal("gui.appliedenergistics2.Unlinked");
|
String linked = color("red") + StatCollector.translateToLocal("gui.appliedenergistics2.Unlinked");
|
||||||
if (encKey != null && !encKey.isEmpty()) {
|
if (encKey != null && !encKey.isEmpty()) {
|
||||||
linked = color("blue") + StatCollector.translateToLocal("gui.appliedenergistics2.Linked");
|
linked = color("blue") + StatCollector.translateToLocal("gui.appliedenergistics2.Linked");
|
||||||
}
|
}
|
||||||
list.add(LocaleHandler.LinkStatus.getLocal() + ": " + linked);
|
list.add(LocaleHandler.LinkStatus.getLocal() + ": " + linked);
|
||||||
String boosterStatus = (checkForBooster(is) ? color("green") + LocaleHandler.Installed.getLocal()
|
String boosterStatus = (checkForBooster(is)
|
||||||
: color("red") + LocaleHandler.NotInstalled.getLocal());
|
? color("green") + "" + LocaleHandler.Installed.getLocal()
|
||||||
String magnetStatus = (isMagnetInstalled(is) ? color("green") + LocaleHandler.Installed.getLocal()
|
: color("red") + "" + LocaleHandler.NotInstalled.getLocal());
|
||||||
: color("red") + LocaleHandler.NotInstalled.getLocal());
|
String magnetStatus = (isMagnetInstalled(is)
|
||||||
|
? color("green") + "" + LocaleHandler.Installed.getLocal()
|
||||||
|
: color("red") + "" + LocaleHandler.NotInstalled.getLocal());
|
||||||
if (Reference.WCT_BOOSTER_ENABLED) {
|
if (Reference.WCT_BOOSTER_ENABLED) {
|
||||||
list.add(getItemName("infinityBoosterCard") + ": " + boosterStatus);
|
list.add(getItemName("infinityBoosterCard") + ": " + boosterStatus);
|
||||||
}
|
}
|
||||||
@@ -356,7 +367,10 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
|||||||
}
|
}
|
||||||
|
|
||||||
private NBTTagCompound ensureTagCompound(ItemStack is) {
|
private NBTTagCompound ensureTagCompound(ItemStack is) {
|
||||||
return RandomUtils.getTag(is);
|
if (!is.hasTagCompound()) {
|
||||||
|
is.setTagCompound(new NBTTagCompound());
|
||||||
|
}
|
||||||
|
return is.getTagCompound();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -443,8 +457,7 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
|||||||
double currentAEPower = getAECurrentPower(container);
|
double currentAEPower = getAECurrentPower(container);
|
||||||
if ((int) currentAEPower < Reference.WCT_MAX_POWER) {
|
if ((int) currentAEPower < Reference.WCT_MAX_POWER) {
|
||||||
int leftOver = (int) PowerUnits.AE.convertTo(
|
int leftOver = (int) PowerUnits.AE.convertTo(
|
||||||
PowerUnits.RF,
|
PowerUnits.RF, injectAEPower(container, PowerUnits.RF.convertTo(PowerUnits.AE, maxReceive)));
|
||||||
injectAEPower(container, PowerUnits.RF.convertTo(PowerUnits.AE, maxReceive)));
|
|
||||||
return maxReceive - leftOver;
|
return maxReceive - leftOver;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -465,8 +478,7 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return (int) PowerUnits.AE.convertTo(
|
return (int) PowerUnits.AE.convertTo(
|
||||||
PowerUnits.RF,
|
PowerUnits.RF, extractAEPower(container, PowerUnits.RF.convertTo(PowerUnits.AE, maxExtract)));
|
||||||
extractAEPower(container, PowerUnits.RF.convertTo(PowerUnits.AE, maxExtract)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loaded 100 of 124 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user