Compare commits

...
15 Commits
Author SHA1 Message Date
Martin Robertz b9ed4fadf1 Merge pull request #27 from GTNewHorizons/firenoo/update
Compat update
2023-05-25 19:34:24 +02:00
Martin Robertz f204823bd9 Update dependencies.gradle 2023-05-25 19:11:20 +02:00
Martin Robertz ed58556f48 Merge pull request #28 from GTNewHorizons/firenoo/update-spotless-fixes
Spotless apply for branch firenoo/update for #27
2023-05-25 19:09:49 +02:00
GitHub GTNH Actions 8f10d413be spotlessApply 2023-05-25 16:44:32 +00:00
Firenoo 9dcc47476c Update dependencies + Fix API incompats
The API has changed since the last update, update.
2023-05-25 08:42:23 -07:00
Firenoo cf14b69af4 Update buildscript + gradle
Signed-off-by: Firenoo <[email protected]>
2023-05-25 08:30:43 -07:00
Martin Robertz e00d328e78 Merge pull request #26 from Pilzinsel64/Pilzinsel64-patch-1
Use more uniquie key names
2023-03-19 21:38:04 +01:00
Pilzinsel64 6d9ac27edc Update KeybindHandler.java
Resolves conflict with other mods (specially AE2FC)
2023-03-19 16:04:06 +01:00
boubou19 8cf8ff33f8 Merge pull request #25 from GTNewHorizons/unregister_recipes
Unregister recipes
2023-02-07 20:54:34 +01:00
boubou19 7acb03bdd5 spotless apply 2023-02-07 20:45:41 +01:00
boubou19 247f366417 don't register recipes if coremod is present 2023-02-07 20:44:54 +01:00
Raven Szewczyk 2c5c1a28c0 [ci skip] upgraded build system 2023-01-31 09:57:15 +00:00
Jason Mitchell af114f19ed [ci skip] Add git-blame-ignore-revs for spotlessApply 2023-01-29 12:16:14 -08:00
Jason Mitchell d8da552c36 [ci skip] spotlessApply with the new settings 2023-01-29 12:16:14 -08:00
Jason Mitchell 67757e72c9 [ci skip] Update buildscript to RetroFuturaGradle 2023-01-29 12:15:45 -08:00
95 changed files with 2168 additions and 1591 deletions

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
# Ignore spotlessApply reformat
d8da552c3601fc920acd7afce95f391ffef74140
+36 -27
View File
@@ -1,35 +1,44 @@
* text eol=lf * text eol=lf
*.jar binary *.[jJ][aA][rR] binary
*.png binary *.[pP][nN][gG] binary
*.jpg binary *.[jJ][pP][gG] binary
*.jpeg binary *.[jJ][pP][eE][gG] binary
*.gif binary *.[gG][iI][fF] binary
*.tif binary *.[tT][iI][fF] binary
*.tiff binary *.[tT][iI][fF][fF] binary
*.ico binary *.[iI][cC][oO] binary
*.svg text *.[sS][vV][gG] text
*.eps binary *.[eE][pP][sS] binary
*.[xX][cC][fF] binary
*.kar binary *.[kK][aA][rR] binary
*.m4a binary *.[mM]4[aA] binary
*.mid binary *.[mM][iI][dD] binary
*.midi binary *.[mM][iI][dD][iI] binary
*.mp3 binary *.[mM][pP]3 binary
*.ogg binary *.[oO][gG][gG] binary
*.ra binary *.[rR][aA] binary
*.7z binary *.7[zZ] binary
*.gz binary *.[gG][zZ] binary
*.tar binary *.[tT][aA][rR] binary
*.tgz binary *.[tT][gG][zZ] binary
*.zip binary *.[zZ][iI][pP] binary
*.patch -text *.[tT][cC][nN] binary
*.[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
*.bat text eol=crlf *.[pP][aA][tT][cC][hH] -text
*.cmd text eol=crlf
*.ps1 text eol=crlf
*autogenerated binary *.[bB][aA][tT] text eol=crlf
*.[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
+880 -465
View File
File diff suppressed because it is too large. Load diff
+6 -7
View File
@@ -1,11 +1,10 @@
// Add your dependencies here // Add your dependencies here
dependencies { dependencies {
compile("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-99-GTNH:dev") api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-216-GTNH:dev")
compile("com.github.GTNewHorizons:Baubles:1.0.1.14:dev") api("com.github.GTNewHorizons:Baubles:1.0.1.14:dev")
compile("curse.maven:cofh-core-69162:2388751") api("curse.maven:cofh-core-69162:2388751")
compile("com.github.GTNewHorizons:NotEnoughItems:2.2.27-GTNH:dev") api("com.github.GTNewHorizons:NotEnoughItems:2.3.51-GTNH:dev")
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.4:dev") compileOnly("com.github.GTNewHorizons:MouseTweaks:2.4.8-GTNH:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:MouseTweaks:2.4.5-GTNH:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:EnderIO:2.4.17:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:EnderIO:2.3.1.43:dev") { transitive = false }
} }
Binary file not shown.
+2 -1
View File
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
Vendored
+171 -115
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env sh #!/bin/sh
# #
# Copyright 2015 the original author or authors. # Copyright © 2015-2021 the original 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.
@@ -17,78 +17,113 @@
# #
############################################################################## ##############################################################################
## #
## Gradle start up script for UN*X # Gradle start up script for POSIX generated by Gradle.
## #
# 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/HEAD/subprojects/plugins/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
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle" # Resolve links: $0 may be a link
APP_BASE_NAME=`basename "$0"` app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 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* ) cygwin=true ;; #(
cygwin=true Darwin* ) darwin=true ;; #(
;; MSYS* | MINGW* ) msys=true ;; #(
Darwin* ) NONSTOP* ) nonstop=true ;;
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 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
@@ -97,7 +132,7 @@ 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
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. which java >/dev/null 2>&1 || 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
@@ -105,84 +140,105 @@ location of your Java installation."
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
MAX_FD_LIMIT=`ulimit -H -n` case $MAX_FD in #(
if [ $? -eq 0 ] ; then max*)
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
MAX_FD="$MAX_FD_LIMIT" # shellcheck disable=SC3045
fi MAX_FD=$( ulimit -H -n ) ||
ulimit -n $MAX_FD warn "Could not query maximum file descriptor limit"
if [ $? -ne 0 ] ; then esac
warn "Could not set maximum file descriptor limit: $MAX_FD" case $MAX_FD in #(
fi '' | soft) :;; #(
else *)
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
fi # shellcheck disable=SC3045
fi ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
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`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
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 esac
fi fi
# Escape application args # Collect all arguments for the java command, stacking in reverse order:
save () { # * args from the command line
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done # * the main class name
echo " " # * -classpath
} # * -D...appname settings
APP_ARGS=$(save "$@") # * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules # For Cygwin or MSYS, switch paths to Windows format before running java
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong JAVACMD=$( cygpath --unix "$JAVACMD" )
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")" # Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) 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
fi fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
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
+15 -23
View File
@@ -14,7 +14,7 @@
@rem limitations under the License. @rem limitations under the License.
@rem @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
@@ -25,10 +25,14 @@
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"
@@ -37,7 +41,7 @@ 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%" == "0" goto init if %ERRORLEVEL% equ 0 goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -51,7 +55,7 @@ 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 init if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -61,38 +65,26 @@ 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 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%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
: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%"=="0" goto mainEnd if %ERRORLEVEL% equ 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!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=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
+21 -3
View File
@@ -1,10 +1,28 @@
pluginManagement {
repositories {
maven {
// RetroFuturaGradle
name "GTNH Maven"
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
mavenContent {
includeGroup("com.gtnewhorizons.retrofuturagradle")
}
}
gradlePluginPortal()
mavenCentral()
mavenLocal()
}
}
plugins { plugins {
id 'com.diffplug.blowdryerSetup' version '1.6.0' id 'com.diffplug.blowdryerSetup' version '1.6.0'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
} }
apply plugin: 'com.diffplug.blowdryerSetup'
blowdryerSetup { blowdryerSetup {
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.5') repoSubfolder 'gtnhShared'
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
//devLocal '.' // Use this when testing config updates locally //devLocal '.' // Use this when testing config updates locally
} }
@@ -1,6 +1,7 @@
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,10 +1,12 @@
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,6 +3,7 @@ package net.p455w0rd.wirelesscraftingterminal.api;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
public abstract class IWCTItems { public abstract class IWCTItems {
/** /**
* WirelessCraftingTerminal * WirelessCraftingTerminal
*/ */
@@ -16,16 +17,13 @@ public abstract class IWCTItems {
public IWCTItemDescription InfinityBoosterCard; public IWCTItemDescription InfinityBoosterCard;
/** /**
* Used for the creat6ive tab * Used for the creat6ive tab TODO: remove unneeded item and just add the icon properly
* TODO: remove unneeded item and just
* add the icon properly
*/ */
@Nonnull @Nonnull
public IWCTItemDescription WCTDummyIcon; public IWCTItemDescription WCTDummyIcon;
/** /**
* Item used solely for infinity booster * Item used solely for infinity booster card slot background icon
* card slot background icon
*/ */
@Nonnull @Nonnull
public IWCTItemDescription WCTBoosterBGIcon; public IWCTItemDescription WCTBoosterBGIcon;
@@ -1,20 +1,21 @@
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. * Provides the required functionality of a wireless terminal. Presumably this interface would be implemented on an
* Presumably this interface would be implemented on an Item, but that is * Item, but that is not a requirement.
* 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,9 +1,10 @@
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,6 +1,7 @@
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;
@@ -8,15 +9,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 clazz = Class
Class.forName("net.p455w0rd.wirelesscraftingterminal.implementation.WCTAPIImplementation"); .forName("net.p455w0rd.wirelesscraftingterminal.implementation.WCTAPIImplementation");
// Get the instance method // Get the instance method
Method instanceAccessor = clazz.getMethod("instance"); Method instanceAccessor = clazz.getMethod("instance");
@@ -1,9 +1,10 @@
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.
* *
@@ -11,6 +12,7 @@ import net.minecraft.item.ItemStack;
* *
*/ */
public interface ICraftingIssuerHost extends ITerminalHost { public interface ICraftingIssuerHost extends ITerminalHost {
/** /**
* Gets the icon for this terminal. * Gets the icon for this terminal.
* *
@@ -19,8 +21,7 @@ public interface ICraftingIssuerHost extends ITerminalHost {
ItemStack getIcon(); ItemStack getIcon();
/** /**
* Launches the terminal's GUI. * Launches the terminal's GUI. Used to return to the gui after crafting is confirmed or canceled.
* Used to return to the gui after crafting is confirmed or canceled.
*/ */
void launchGUI(EntityPlayer player); void launchGUI(EntityPlayer player);
} }
@@ -1,6 +1,7 @@
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 {
@@ -6,12 +6,10 @@ 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 * Used to for calculating security rules, you must supply a node from your IGridHost for the security test, this
* IGridHost for the security test, this should be the primary node for the * should be the primary node for the machine, unless the action is preformed by a non primary node.
* machine, unless the action is preformed by a non primary node.
* *
* @return the the gridnode that actions from this IGridHost are preformed * @return the the gridnode that actions from this IGridHost are preformed by.
* by.
*/ */
IGridNode getActionableNode(); IGridNode getActionableNode();
@@ -1,8 +1,9 @@
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,9 +7,8 @@ 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 * Acquire a single input stack for the current recipe, if more then one ItemStack is possible a RegistrationError
* ItemStack is possible a RegistrationError exception will be thrown, * exception will be thrown, ignore these and let the system handle the error.
* 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.
* *
@@ -19,8 +18,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 * Acquire a list of all the input stacks for the current recipe, this is for handlers that support multiple inputs
* for handlers that support multiple inputs per slot. * per slot.
* *
* @return an array of ItemStacks for the recipe handler. * @return an array of ItemStacks for the recipe handler.
* *
@@ -30,16 +29,14 @@ 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, * If you wish to support air, you must test before getting the ItemStack, or ItemStackSet
* 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 * @return The Name Space of the item. Prefer getItemStack or getItemStackSet
* getItemStackSet
*/ */
String getNameSpace(); String getNameSpace();
@@ -49,14 +46,12 @@ public interface IIngredient {
String getItemName(); String getItemName();
/** /**
* @return The Damage Value of the item. Prefer getItemStack or * @return The Damage Value of the item. Prefer getItemStack or getItemStackSet
* getItemStackSet
*/ */
int getDamageValue(); int getDamageValue();
/** /**
* @return The Damage Value of the item. Prefer getItemStack or * @return The Damage Value of the item. Prefer getItemStack or getItemStackSet
* getItemStackSet
*/ */
int getQty(); int getQty();
@@ -3,5 +3,6 @@ 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,6 +3,7 @@ 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;
@@ -13,6 +14,7 @@ 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;
@@ -195,9 +197,8 @@ 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() return (target.getItem() == input.getItem() && (target.getItemDamage() == OreDictionary.WILDCARD_VALUE
&& (target.getItemDamage() == OreDictionary.WILDCARD_VALUE || target.getItemDamage() == input.getItemDamage()));
|| target.getItemDamage() == input.getItemDamage()));
} }
public ShapedRecipe setMirrored(final boolean mirror) { public ShapedRecipe setMirrored(final boolean mirror) {
@@ -1,12 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.client.gui; 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.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -17,7 +10,16 @@ import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
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 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;
public class GuiCraftAmount extends appeng.client.gui.implementations.GuiCraftAmount { public class GuiCraftAmount extends appeng.client.gui.implementations.GuiCraftAmount {
private GuiTabButton originalGuiBtn; private GuiTabButton originalGuiBtn;
private ItemStack myIcon; private ItemStack myIcon;
@@ -32,7 +34,7 @@ public class GuiCraftAmount extends appeng.client.gui.implementations.GuiCraftAm
myIcon = is; myIcon = is;
} }
@SuppressWarnings({"unchecked", "unused"}) @SuppressWarnings({ "unchecked", "unused" })
@Override @Override
public void initGui() { public void initGui() {
super.initGui(); super.initGui();
@@ -52,7 +54,11 @@ public class GuiCraftAmount extends appeng.client.gui.implementations.GuiCraftAm
if (this.originalGui > 0 && myIcon != null) { if (this.originalGui > 0 && myIcon != null) {
this.buttonList.add( this.buttonList.add(
this.originalGuiBtn = new GuiTabButton( this.originalGuiBtn = new GuiTabButton(
this.guiLeft + 154, this.guiTop - 4, myIcon, myIcon.getDisplayName(), itemRender)); this.guiLeft + 154,
this.guiTop - 4,
myIcon,
myIcon.getDisplayName(),
itemRender));
} }
} }
@@ -1,12 +1,14 @@
package net.p455w0rd.wirelesscraftingterminal.client.gui; package net.p455w0rd.wirelesscraftingterminal.client.gui;
import appeng.api.storage.ITerminalHost;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler; import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis; import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference; import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.storage.ITerminalHost;
public class GuiCraftConfirm extends appeng.client.gui.implementations.GuiCraftConfirm { public class GuiCraftConfirm extends appeng.client.gui.implementations.GuiCraftConfirm {
public GuiCraftConfirm(final InventoryPlayer inventoryPlayer, final ITerminalHost te) { public GuiCraftConfirm(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
super(inventoryPlayer, te); super(inventoryPlayer, te);
} }
@@ -1,11 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.client.gui; 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.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -16,7 +10,15 @@ import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
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 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;
public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraftingStatus { public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraftingStatus {
private GuiTabButton originalGuiBtn; private GuiTabButton originalGuiBtn;
private int originalGui; private int originalGui;
private ItemStack myIcon = null; private ItemStack myIcon = null;
@@ -31,8 +33,7 @@ public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraf
final IParts parts = definitions.parts(); final IParts parts = definitions.parts();
if (target instanceof WirelessTerminalGuiObject) { if (target instanceof WirelessTerminalGuiObject) {
for (final ItemStack wirelessTerminalStack : for (final ItemStack wirelessTerminalStack : definitions.items().wirelessTerminal().maybeStack(1).asSet()) {
definitions.items().wirelessTerminal().maybeStack(1).asSet()) {
this.myIcon = wirelessTerminalStack; this.myIcon = wirelessTerminalStack;
} }
@@ -1,10 +1,12 @@
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,6 +12,7 @@ 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 {
@@ -58,13 +59,28 @@ 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, this.guiLeft + 61, this.guiTop + 20, "Ignore NBT Data", this.ignoreNBT, 107)); 1,
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, this.guiLeft + 61, this.guiTop + 32, "Ignore Meta Data", this.ignoreMeta, 107)); 2,
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, this.guiLeft + 61, this.guiTop + 44, "Use Ore Dictionary", this.useOreDict, 107)); 3,
this.guiLeft + 61,
this.guiTop + 44,
"Use Ore Dictionary",
this.useOreDict,
107));
} }
String getLabel(boolean filterMode) { String getLabel(boolean filterMode) {
@@ -1,5 +1,35 @@
package net.p455w0rd.wirelesscraftingterminal.client.gui; package net.p455w0rd.wirelesscraftingterminal.client.gui;
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.inventory.GuiInventory;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.p455w0rd.wirelesscraftingterminal.client.gui.widgets.GuiTrashButton;
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
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.packets.PacketEmptyTrash;
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 org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import appeng.api.config.ActionItems; import appeng.api.config.ActionItems;
import appeng.api.config.SearchBoxMode; import appeng.api.config.SearchBoxMode;
import appeng.api.config.Settings; import appeng.api.config.Settings;
@@ -33,33 +63,6 @@ import codechicken.nei.TextField;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.ReflectionHelper; 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.inventory.GuiInventory;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.p455w0rd.wirelesscraftingterminal.client.gui.widgets.GuiTrashButton;
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
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.packets.PacketEmptyTrash;
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 org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import yalter.mousetweaks.api.IMTModGuiContainer; import yalter.mousetweaks.api.IMTModGuiContainer;
@Optional.Interface(modid = "MouseTweaks", iface = "yalter.mousetweaks.api.IMTModGuiContainer") @Optional.Interface(modid = "MouseTweaks", iface = "yalter.mousetweaks.api.IMTModGuiContainer")
@@ -68,24 +71,10 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
private float xSize_lo; private float xSize_lo;
private float ySize_lo; private float ySize_lo;
public static int tick = 0, public static int tick = 0, GUI_HEIGHT = 240, GUI_WIDTH = 230, AE_ROW_HEIGHT = 18, AE_NUM_ROWS = 0,
GUI_HEIGHT = 240, GUI_UPPER_HEIGHT = 35, GUI_SEARCH_ROW = 35, SEARCH_X = 80, SEARCH_Y = 4, SEARCH_WIDTH = 88,
GUI_WIDTH = 230, SEARCH_HEIGHT = 12, SEARCH_MAXCHARS = 15, GUI_LOWER_HEIGHT, AE_TOTAL_ROWS_HEIGHT,
AE_ROW_HEIGHT = 18, BUTTON_SEARCH_MODE_POS_X = -18, BUTTON_SEARCH_MODE_POS_Y = 68, BUTTON_SIZE = 16, NEI_EXTRA_SPACE = 30,
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; slotYOffset;
protected static final int BUTTON_SEARCH_MODE_ID = 5; protected static final int BUTTON_SEARCH_MODE_ID = 5;
protected static final long TOOLTIP_UPDATE_INTERVAL = 3000L; protected static final long TOOLTIP_UPDATE_INTERVAL = 3000L;
@@ -152,9 +141,10 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
private void setScrollBar() { private void setScrollBar() {
this.getScrollBar().setTop(18).setLeft(174).setHeight(this.rows * 18 - 2); this.getScrollBar().setTop(18).setLeft(174).setHeight(this.rows * 18 - 2);
this.getScrollBar() this.getScrollBar().setRange(
.setRange( 0,
0, (this.repo.size() + this.perRow - 1) / this.perRow - this.rows, Math.max(1, this.rows / 6)); (this.repo.size() + this.perRow - 1) / this.perRow - this.rows,
Math.max(1, this.rows / 6));
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@@ -170,8 +160,7 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
final GuiImgButton iBtn = (GuiImgButton) btn; final GuiImgButton iBtn = (GuiImgButton) btn;
if (iBtn.getSetting() != Settings.ACTIONS) { if (iBtn.getSetting() != Settings.ACTIONS) {
final Enum cv = iBtn.getCurrentValue(); final Enum cv = iBtn.getCurrentValue();
final Enum next = final Enum next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
if (btn == this.terminalStyleBox) { if (btn == this.terminalStyleBox) {
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next); AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
@@ -182,8 +171,8 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
AEConfig.instance.preserveSearchBar = next == YesNo.YES; AEConfig.instance.preserveSearchBar = next == YesNo.YES;
} else { } else {
try { try {
NetworkHandler.instance.sendToServer( NetworkHandler.instance
new PacketValueConfig(iBtn.getSetting().name(), next.name())); .sendToServer(new PacketValueConfig(iBtn.getSetting().name(), next.name()));
} catch (final IOException e) { } catch (final IOException e) {
WCTLog.debug(e.getMessage()); WCTLog.debug(e.getMessage());
} }
@@ -205,8 +194,10 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
} }
if (s != null) { if (s != null) {
final PacketInventoryAction p = final PacketInventoryAction p = new PacketInventoryAction(
new PacketInventoryAction(InventoryAction.MOVE_REGION, s.slotNumber, 0); InventoryAction.MOVE_REGION,
s.slotNumber,
0);
NetworkHandler.instance.sendToServer(p); NetworkHandler.instance.sendToServer(p);
} }
} }
@@ -245,8 +236,7 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN; action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
stack = ((SlotME) slot).getAEStack(); stack = ((SlotME) slot).getAEStack();
if (stack != null if (stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN
&& action == InventoryAction.PICKUP_OR_SET_DOWN
&& stack.getStackSize() == 0 && stack.getStackSize() == 0
&& player.inventory.getItemStack() == null) { && player.inventory.getItemStack() == null) {
action = InventoryAction.AUTO_CRAFT; action = InventoryAction.AUTO_CRAFT;
@@ -263,8 +253,10 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
} }
if (action == InventoryAction.AUTO_CRAFT) { if (action == InventoryAction.AUTO_CRAFT) {
((AEBaseContainer) this.inventorySlots).setTargetStack(stack); ((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
final PacketInventoryAction p = final PacketInventoryAction p = new PacketInventoryAction(
new PacketInventoryAction(action, this.inventorySlots.inventorySlots.size(), 0); action,
this.inventorySlots.inventorySlots.size(),
0);
NetworkHandler.instance.sendToServer(p); NetworkHandler.instance.sendToServer(p);
return; return;
} }
@@ -296,15 +288,14 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
/** /**
* Initializes the GUI * Initializes the GUI
*/ */
@SuppressWarnings({"unchecked", "rawtypes"}) @SuppressWarnings({ "unchecked", "rawtypes" })
@Override @Override
public void initGui() { public void initGui() {
super.initGui(); super.initGui();
Keyboard.enableRepeatEvents(true); Keyboard.enableRepeatEvents(true);
this.maxRows = this.getMaxRows(); this.maxRows = this.getMaxRows();
this.perRow = AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL this.perRow = AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL ? 9
? 9
: 9 + ((this.width - this.standardSize) / 18); : 9 + ((this.width - this.standardSize) / 18);
this.isNEIEnabled = Loader.isModLoaded("NotEnoughItems"); this.isNEIEnabled = Loader.isModLoaded("NotEnoughItems");
int top = isNEIEnabled ? 22 : 0; int top = isNEIEnabled ? 22 : 0;
@@ -346,19 +337,28 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
this.buttonList.clear(); this.buttonList.clear();
this.buttonList.add( this.buttonList.add(
this.clearBtn = new GuiImgButton( this.clearBtn = new GuiImgButton(
this.guiLeft + 134, this.guiTop + this.ySize - 160, Settings.ACTIONS, ActionItems.STASH)); this.guiLeft + 134,
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) { if (this.customSortOrder) {
this.buttonList.add( this.buttonList.add(
this.SortByBox = new GuiImgButton( this.SortByBox = new GuiImgButton(
this.guiLeft - 18, offset, Settings.SORT_BY, this.configSrc.getSetting(Settings.SORT_BY))); this.guiLeft - 18,
offset,
Settings.SORT_BY,
this.configSrc.getSetting(Settings.SORT_BY)));
offset += 20; offset += 20;
} }
this.buttonList.add( this.buttonList.add(
this.ViewBox = new GuiImgButton( this.ViewBox = new GuiImgButton(
this.guiLeft - 18, offset, Settings.VIEW_MODE, this.configSrc.getSetting(Settings.VIEW_MODE))); this.guiLeft - 18,
offset,
Settings.VIEW_MODE,
this.configSrc.getSetting(Settings.VIEW_MODE)));
offset += 20; offset += 20;
this.buttonList.add( this.buttonList.add(
@@ -440,8 +440,7 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
} }
int getMaxRows() { int getMaxRows() {
return AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL return AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL ? 6
? 6
: Integer.MAX_VALUE; : Integer.MAX_VALUE;
} }
@@ -450,18 +449,17 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
} }
/** /**
* Called every tick. It is used in this instance to detect screen size * Called every tick. It is used in this instance to detect screen size changes to automatically update the gui
* changes to automatically update the gui height. * height.
* <p> * <p>
* reInit variable is used to call initGui() on the next tick. It has to be * reInit variable is used to call initGui() on the next tick. It has to be called this way to update correctly.
* called this way to update correctly.
* *
* @author p455w0rd * @author p455w0rd
*/ */
@Override @Override
public void updateScreen() { public void updateScreen() {
this.devicePowered = containerWCT.isPowered(); this.devicePowered = containerWCT.isPowered();
this.repo.setPower(devicePowered); this.repo.setPowered(devicePowered);
super.updateScreen(); super.updateScreen();
if (this.init) { if (this.init) {
@@ -508,8 +506,7 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
* @author p455w0rd * @author p455w0rd
*/ */
private boolean hasScreenResChanged() { private boolean hasScreenResChanged() {
if ((this.currScreenWidth != this.mc.displayWidth) if ((this.currScreenWidth != this.mc.displayWidth) || (this.currScreenHeight != this.mc.displayHeight)
|| (this.currScreenHeight != this.mc.displayHeight)
|| (this.isFullScreen != this.mc.isFullScreen())) { || (this.isFullScreen != this.mc.isFullScreen())) {
this.currScreenWidth = this.mc.displayWidth; this.currScreenWidth = this.mc.displayWidth;
this.currScreenHeight = this.mc.displayHeight; this.currScreenHeight = this.mc.displayHeight;
@@ -640,8 +637,8 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
return; return;
} }
final boolean mouseInGui = final boolean mouseInGui = this
this.isPointInRegion(0, 0, this.xSize, this.ySize, this.currentMouseX, this.currentMouseY); .isPointInRegion(0, 0, this.xSize, this.ySize, this.currentMouseX, this.currentMouseY);
if (this.isAutoFocus && !this.searchField.isFocused() && mouseInGui) { if (this.isAutoFocus && !this.searchField.isFocused() && mouseInGui) {
this.searchField.setFocused(true); this.searchField.setFocused(true);
} }
@@ -665,8 +662,8 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
this.mc.getTextureManager().bindTexture(loc); this.mc.getTextureManager().bindTexture(loc);
} }
public List<String> handleItemTooltip( public List<String> handleItemTooltip(final ItemStack stack, final int mouseX, final int mouseY,
final ItemStack stack, final int mouseX, final int mouseY, final List<String> currentToolTip) { final List<String> currentToolTip) {
if (stack != null) { if (stack != null) {
final Slot s = this.getSlot(mouseX, mouseY); final Slot s = this.getSlot(mouseX, mouseY);
if (s instanceof SlotME) { if (s instanceof SlotME) {
@@ -677,14 +674,13 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
try { try {
final SlotME theSlotField = (SlotME) s; final SlotME theSlotField = (SlotME) s;
myStack = theSlotField.getAEStack(); myStack = theSlotField.getAEStack();
} catch (final Throwable ignore) { } catch (final Throwable ignore) {}
}
if (myStack != null) { if (myStack != null) {
if (myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged())) { if (myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged())) {
final String local = ButtonToolTips.ItemsStored.getLocal(); final String local = ButtonToolTips.ItemsStored.getLocal();
final String formattedAmount = final String formattedAmount = NumberFormat.getNumberInstance(Locale.US)
NumberFormat.getNumberInstance(Locale.US).format(myStack.getStackSize()); .format(myStack.getStackSize());
final String format = String.format(local, formattedAmount); final String format = String.format(local, formattedAmount);
currentToolTip.add("\u00a77" + format); currentToolTip.add("\u00a77" + format);
@@ -692,16 +688,15 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
if (myStack.getCountRequestable() > 0) { if (myStack.getCountRequestable() > 0) {
final String local = ButtonToolTips.ItemsRequestable.getLocal(); final String local = ButtonToolTips.ItemsRequestable.getLocal();
final String formattedAmount = final String formattedAmount = NumberFormat.getNumberInstance(Locale.US)
NumberFormat.getNumberInstance(Locale.US).format(myStack.getCountRequestable()); .format(myStack.getCountRequestable());
final String format = String.format(local, formattedAmount); final String format = String.format(local, formattedAmount);
currentToolTip.add("\u00a77" + format); currentToolTip.add("\u00a77" + format);
} }
} else if (stack.stackSize > BigNumber || (stack.stackSize > 1 && stack.isItemDamaged())) { } else if (stack.stackSize > BigNumber || (stack.stackSize > 1 && stack.isItemDamaged())) {
final String local = ButtonToolTips.ItemsStored.getLocal(); final String local = ButtonToolTips.ItemsStored.getLocal();
final String formattedAmount = final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(stack.stackSize);
NumberFormat.getNumberInstance(Locale.US).format(stack.stackSize);
final String format = String.format(local, formattedAmount); final String format = String.format(local, formattedAmount);
currentToolTip.add("\u00a77" + format); currentToolTip.add("\u00a77" + format);
@@ -711,9 +706,9 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
return currentToolTip; return currentToolTip;
} }
@SuppressWarnings({"unchecked", "rawtypes"}) @SuppressWarnings({ "unchecked", "rawtypes" })
@Override @Override
protected void renderToolTip(final ItemStack stack, final int x, final int y) { public void renderToolTip(final ItemStack stack, final int x, final int y) {
final Slot s = this.getSlot(x, y); final Slot s = this.getSlot(x, y);
if (s instanceof SlotME && stack != null) { if (s instanceof SlotME && stack != null) {
final int BigNumber = AEConfig.instance.useTerminalUseLargeFont() ? 999 : 9999; final int BigNumber = AEConfig.instance.useTerminalUseLargeFont() ? 999 : 9999;
@@ -723,28 +718,28 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
try { try {
final SlotME theSlotField = (SlotME) s; final SlotME theSlotField = (SlotME) s;
myStack = theSlotField.getAEStack(); myStack = theSlotField.getAEStack();
} catch (final Throwable ignore) { } catch (final Throwable ignore) {}
}
if (myStack != null) { if (myStack != null) {
final List<String> currentToolTip = final List<String> currentToolTip = stack
stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips); .getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
if (myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged())) { if (myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged())) {
currentToolTip.add("Items Stored: " currentToolTip.add(
+ NumberFormat.getNumberInstance(Locale.US).format(myStack.getStackSize())); "Items Stored: "
+ NumberFormat.getNumberInstance(Locale.US).format(myStack.getStackSize()));
} }
if (myStack.getCountRequestable() > 0) { if (myStack.getCountRequestable() > 0) {
currentToolTip.add("Items Requestable: " currentToolTip.add(
+ NumberFormat.getNumberInstance(Locale.US).format(myStack.getCountRequestable())); "Items Requestable: "
+ NumberFormat.getNumberInstance(Locale.US).format(myStack.getCountRequestable()));
} }
this.drawTooltip(x, y, 0, join(currentToolTip, "\n")); this.drawTooltip(x, y, 0, join(currentToolTip, "\n"));
} else if (stack.stackSize > BigNumber) { } else if (stack.stackSize > BigNumber) {
final List var4 = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips); final List var4 = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
var4.add("Items Stored: " var4.add("Items Stored: " + NumberFormat.getNumberInstance(Locale.US).format(stack.stackSize));
+ NumberFormat.getNumberInstance(Locale.US).format(stack.stackSize));
this.drawTooltip(x, y, 0, join(var4, "\n")); this.drawTooltip(x, y, 0, join(var4, "\n"));
return; return;
} }
@@ -815,8 +810,7 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
int j = this.guiTop; int j = this.guiTop;
pointX -= i; pointX -= i;
pointY -= j; pointY -= j;
return pointX >= rectX - 1 return pointX >= rectX - 1 && pointX < rectX + rectWidth + 1
&& pointX < rectX + rectWidth + 1
&& pointY >= rectY - 1 && pointY >= rectY - 1
&& pointY < rectY + rectHeight + 1; && pointY < rectY + rectHeight + 1;
} }
@@ -826,8 +820,8 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
return false; return false;
} }
try { try {
final Class<? super Object> c = final Class<? super Object> c = ReflectionHelper
ReflectionHelper.getClass(this.getClass().getClassLoader(), "codechicken.nei.LayoutManager"); .getClass(this.getClass().getClassLoader(), "codechicken.nei.LayoutManager");
final Field fldSearchField = c.getField("searchField"); final Field fldSearchField = c.getField("searchField");
final TextField searchField = (TextField) fldSearchField.get(c); final TextField searchField = (TextField) fldSearchField.get(c);
return searchField.focused(); return searchField.focused();
@@ -1,15 +1,16 @@
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,13 +1,15 @@
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) {
@@ -26,8 +28,7 @@ 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 this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
&& 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);
@@ -39,7 +40,11 @@ public class GuiTrashButton extends GuiButton implements ITooltip {
@Override @Override
public String getMessage() { public String getMessage() {
return EnumChatFormatting.WHITE + "" + LocaleHandler.EmptyTrash.getLocal() + "\n" + EnumChatFormatting.GRAY + "" return EnumChatFormatting.WHITE + ""
+ LocaleHandler.EmptyTrash.getLocal()
+ "\n"
+ EnumChatFormatting.GRAY
+ ""
+ LocaleHandler.EmptyTrashDesc.getLocal(); + LocaleHandler.EmptyTrashDesc.getLocal();
} }
@@ -5,19 +5,21 @@ 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 = protected static final ResourceLocation buttonTextures = new ResourceLocation(
new ResourceLocation("minecraft", "textures/gui/widgets.png"); "minecraft",
"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( public WCTGuiButton(int p_i1021_1_, int p_i1021_2_, int p_i1021_3_, int p_i1021_4_, int p_i1021_5_,
int p_i1021_1_, int p_i1021_2_, int p_i1021_3_, int p_i1021_4_, int p_i1021_5_, String p_i1021_6_) { 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;
@@ -37,8 +39,7 @@ 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 this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition
&& 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);
@@ -62,7 +63,12 @@ public class WCTGuiButton extends GuiButton {
this.width - 2, this.width - 2,
2); 2);
this.drawTexturedModalRect( this.drawTexturedModalRect(
this.xPosition, this.yPosition + (this.height - 1), 200 - this.width, 65 + k * 20, this.width, 1); this.xPosition,
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;
@@ -1,9 +1,10 @@
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 {
@@ -22,8 +23,7 @@ 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 this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
&& 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,27 +49,25 @@ public class WCTGuiCheckBox extends GuiCheckBox {
} else { } else {
color = 4210752; color = 4210752;
} }
if (this.isChecked) if (this.isChecked) this.drawCenteredString(
this.drawCenteredString( mc.fontRenderer,
mc.fontRenderer, "✔",
"✔", this.xPosition + (this.width - this.boxWidth) + this.boxWidth / 2 + 1,
this.xPosition + (this.width - this.boxWidth) + this.boxWidth / 2 + 1, this.yPosition + 1,
this.yPosition + 1, 0x00FF00);
0x00FF00);
this.drawStringNoShadow(mc.fontRenderer, displayString, xPosition, yPosition + 2, color); this.drawStringNoShadow(mc.fontRenderer, displayString, xPosition, yPosition + 2, color);
} }
} }
public void drawStringNoShadow( public void drawStringNoShadow(FontRenderer p_73731_1_, String p_73731_2_, int p_73731_3_, int p_73731_4_,
FontRenderer p_73731_1_, String p_73731_2_, int p_73731_3_, int p_73731_4_, int p_73731_5_) { 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 if (this.enabled && this.visible
&& 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,11 +1,5 @@
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.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
@@ -23,19 +17,30 @@ import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject; import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference; import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
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;
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() final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance().registries().wireless()
.registries()
.wireless()
.getWirelessTerminalHandler(RandomUtils.getWirelessTerm(player.inventory)); .getWirelessTerminalHandler(RandomUtils.getWirelessTerm(player.inventory));
if (wh != null) { if (wh != null) {
final WirelessTerminalGuiObject obj = new WirelessTerminalGuiObject( final WirelessTerminalGuiObject obj = new WirelessTerminalGuiObject(
wh, RandomUtils.getWirelessTerm(player.inventory), player, world, x, y, z); wh,
RandomUtils.getWirelessTerm(player.inventory),
player,
world,
x,
y,
z);
if (obj != null) { if (obj != null) {
final IPortableCell terminal = obj; final IPortableCell terminal = obj;
@@ -63,12 +68,24 @@ public class WCTGuiHandler implements IGuiHandler {
if (guiId == Reference.GUI_CRAFT_AMOUNT) { if (guiId == Reference.GUI_CRAFT_AMOUNT) {
return updateGui( return updateGui(
new ContainerCraftAmount(player, terminal), world, x, y, z, ForgeDirection.UNKNOWN, obj); new ContainerCraftAmount(player, terminal),
world,
x,
y,
z,
ForgeDirection.UNKNOWN,
obj);
} }
if (guiId == Reference.GUI_CRAFT_CONFIRM) { if (guiId == Reference.GUI_CRAFT_CONFIRM) {
return updateGui( return updateGui(
new ContainerCraftConfirm(player, terminal), world, x, y, z, ForgeDirection.UNKNOWN, obj); new ContainerCraftConfirm(player, terminal),
world,
x,
y,
z,
ForgeDirection.UNKNOWN,
obj);
} }
} }
} }
@@ -81,13 +98,17 @@ public class WCTGuiHandler implements IGuiHandler {
@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() final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance().registries().wireless()
.registries()
.wireless()
.getWirelessTerminalHandler(RandomUtils.getWirelessTerm(player.inventory)); .getWirelessTerminalHandler(RandomUtils.getWirelessTerm(player.inventory));
if (wh != null) { if (wh != null) {
final WirelessTerminalGuiObject obj = new WirelessTerminalGuiObject( final WirelessTerminalGuiObject obj = new WirelessTerminalGuiObject(
wh, RandomUtils.getWirelessTerm(player.inventory), player, world, x, y, z); wh,
RandomUtils.getWirelessTerm(player.inventory),
player,
world,
x,
y,
z);
if (obj != null) { if (obj != null) {
final IPortableCell terminal = obj; final IPortableCell terminal = obj;
@@ -116,19 +137,13 @@ public class WCTGuiHandler implements IGuiHandler {
return null; return null;
} }
public static void launchGui( public static void launchGui(final int ID, final EntityPlayer player, final World world, final int x, final int y,
final int ID, final EntityPlayer player, final World world, final int x, final int y, final int z) { final int z) {
player.openGui(WirelessCraftingTerminal.INSTANCE, ID, world, x, y, z); player.openGui(WirelessCraftingTerminal.INSTANCE, ID, world, x, y, z);
} }
private Object updateGui( private Object updateGui(final Object newContainer, final World w, final int x, final int y, final int z,
final Object newContainer, final ForgeDirection side, final Object myItem) {
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));
@@ -1,18 +1,7 @@
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.common.utils.WCTLog;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler; import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
@@ -25,17 +14,31 @@ 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.*;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
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@[" + net.minecraftforge.common.ForgeVersion.majorVersion dependencies = "" + "required-after:Forge@["
+ net.minecraftforge.common.ForgeVersion.majorVersion
+ '.' // majorVersion + '.' // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion + net.minecraftforge.common.ForgeVersion.minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion + '.' // minorVersion
+ net.minecraftforge.common.ForgeVersion.buildVersion + ",);" + net.minecraftforge.common.ForgeVersion.revisionVersion
+ '.' // revisionVersion
+ net.minecraftforge.common.ForgeVersion.buildVersion
+ ",);"
+ "required-after:appliedenergistics2@[rv3-beta-1,);after:NotEnoughItems;") + "required-after:appliedenergistics2@[rv3-beta-1,);after:NotEnoughItems;")
public class WirelessCraftingTerminal { public class WirelessCraftingTerminal {
@@ -57,8 +60,8 @@ public class WirelessCraftingTerminal {
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().registerWirelessHandler((IWirelessTermHandler) AEApi.instance().registries().wireless()
ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem()); .registerWirelessHandler((IWirelessTermHandler) ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem());
WCTLog.endSection("PreInit", stopwatch); WCTLog.endSection("PreInit", stopwatch);
} }
@@ -67,7 +70,9 @@ public class WirelessCraftingTerminal {
long stopwatch = WCTLog.beginSection("Init"); long stopwatch = WCTLog.beginSection("Init");
IntegrationRegistry.INSTANCE.init(); IntegrationRegistry.INSTANCE.init();
WirelessCraftingTerminal.WCTState = LoaderState.INITIALIZATION; WirelessCraftingTerminal.WCTState = LoaderState.INITIALIZATION;
RecipeHandler.loadRecipes(!Reference.WCT_MINETWEAKER_OVERRIDE); if (!Loader.isModLoaded("dreamcraft")) {
RecipeHandler.loadRecipes(!Reference.WCT_MINETWEAKER_OVERRIDE);
}
AchievementHandler.init(); AchievementHandler.init();
WCTLog.endSection("Init", stopwatch); WCTLog.endSection("Init", stopwatch);
} }
@@ -1,12 +1,14 @@
package net.p455w0rd.wirelesscraftingterminal.common.container; package net.p455w0rd.wirelesscraftingterminal.common.container;
import appeng.api.implementations.guiobjects.IPortableCell;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler; import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference; import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.implementations.guiobjects.IPortableCell;
public class ContainerCraftAmount extends appeng.container.implementations.ContainerCraftAmount { public class ContainerCraftAmount extends appeng.container.implementations.ContainerCraftAmount {
public ContainerCraftAmount(EntityPlayer player, IPortableCell terminal) { public ContainerCraftAmount(EntityPlayer player, IPortableCell terminal) {
super(player.inventory, terminal); super(player.inventory, terminal);
} }
@@ -1,11 +1,13 @@
package net.p455w0rd.wirelesscraftingterminal.common.container; package net.p455w0rd.wirelesscraftingterminal.common.container;
import appeng.api.implementations.guiobjects.IPortableCell;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler; import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference; import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.implementations.guiobjects.IPortableCell;
public class ContainerCraftConfirm extends appeng.container.implementations.ContainerCraftConfirm { public class ContainerCraftConfirm extends appeng.container.implementations.ContainerCraftConfirm {
private final EntityPlayer player; private final EntityPlayer player;
public ContainerCraftConfirm(EntityPlayer player, IPortableCell terminal) { public ContainerCraftConfirm(EntityPlayer player, IPortableCell terminal) {
@@ -3,6 +3,7 @@ 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;
@@ -25,11 +26,7 @@ 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, private final int PLAYER_INV_START = 0, PLAYER_INV_END = 26, HOTBAR_START = 27, HOTBAR_END = 35, FILTERS_START = 36,
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) {
@@ -84,7 +81,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()) {
@@ -103,8 +100,7 @@ public class ContainerMagnet extends Container {
} }
if (mouseButton == 1) { if (mouseButton == 1) {
player.dropPlayerItemWithRandomChoice( player.dropPlayerItemWithRandomChoice(inventoryplayer.getItemStack().splitStack(1), true);
inventoryplayer.getItemStack().splitStack(1), true);
if (inventoryplayer.getItemStack().stackSize == 0) { if (inventoryplayer.getItemStack().stackSize == 0) {
inventoryplayer.setItemStack((ItemStack) null); inventoryplayer.setItemStack((ItemStack) null);
@@ -117,7 +113,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);
@@ -139,8 +135,7 @@ 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 if (slot != null && stackFitsInSlot(slot, inventoryplayer.getItemStack(), true)
&& 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)) {
@@ -155,8 +150,7 @@ public class ContainerMagnet extends Container {
while (iterator.hasNext()) { while (iterator.hasNext()) {
Slot slot1 = (Slot) iterator.next(); Slot slot1 = (Slot) iterator.next();
if (slot1 != null if (slot1 != null && stackFitsInSlot(slot1, inventoryplayer.getItemStack(), true)
&& 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)) {
@@ -237,12 +231,12 @@ public class ContainerMagnet extends Container {
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public static void setSlotStack( public static void setSlotStack(Set slotSet, int stackSizeSelector, ItemStack stackToResize,
Set slotSet, int stackSizeSelector, ItemStack stackToResize, int currentSlotStackSize) { int currentSlotStackSize) {
switch (stackSizeSelector) { switch (stackSizeSelector) {
case 0: case 0:
stackToResize.stackSize = stackToResize.stackSize = MathHelper
MathHelper.floor_float((float) stackToResize.stackSize / (float) slotSet.size()); .floor_float((float) stackToResize.stackSize / (float) slotSet.size());
break; break;
case 1: case 1:
stackToResize.stackSize = 1; stackToResize.stackSize = 1;
@@ -254,8 +248,7 @@ 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 if (slot != null && slot.getHasStack()
&& slot.getHasStack()
&& itemStack != null && itemStack != null
&& itemStack.isItemEqual(slot.getStack()) && itemStack.isItemEqual(slot.getStack())
&& ItemStack.areItemStackTagsEqual(slot.getStack(), itemStack)) { && ItemStack.areItemStackTagsEqual(slot.getStack(), itemStack)) {
@@ -439,8 +432,7 @@ public class ContainerMagnet extends Container {
continue; continue;
} }
if (itemstack1 != null if (itemstack1 != null && itemstack1.getItem() == stack.getItem()
&& 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;
@@ -482,7 +474,8 @@ public class ContainerMagnet extends Container {
break; break;
} else { } else {
putStackInSlot( putStackInSlot(
k, new ItemStack(stack.getItem(), slot.getSlotStackLimit(), stack.getItemDamage())); k,
new ItemStack(stack.getItem(), slot.getSlotStackLimit(), stack.getItemDamage()));
stack.stackSize -= slot.getSlotStackLimit(); stack.stackSize -= slot.getSlotStackLimit();
magnetInventory.markDirty(); magnetInventory.markDirty();
flag1 = true; flag1 = true;
@@ -1,5 +1,53 @@
package net.p455w0rd.wirelesscraftingterminal.common.container; package net.p455w0rd.wirelesscraftingterminal.common.container;
import java.io.IOException;
import java.nio.BufferOverflowException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTerminalItem;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotArmor;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotBooster;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotMagnet;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotTrash;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotViewCell;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryBooster;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryCrafting;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryMagnet;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryTrash;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryViewCell;
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMEInventoryUpdate;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
import net.p455w0rd.wirelesscraftingterminal.items.ItemInfinityBooster;
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier; import appeng.api.config.PowerMultiplier;
@@ -48,59 +96,10 @@ import appeng.util.IConfigManagerHost;
import appeng.util.InventoryAdaptor; import appeng.util.InventoryAdaptor;
import appeng.util.Platform; import appeng.util.Platform;
import appeng.util.inv.AdaptorPlayerHand; import appeng.util.inv.AdaptorPlayerHand;
import java.io.IOException;
import java.nio.BufferOverflowException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTerminalItem;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotArmor;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotBooster;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotMagnet;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotTrash;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotViewCell;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryBooster;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryCrafting;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryMagnet;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryTrash;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryViewCell;
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMEInventoryUpdate;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
import net.p455w0rd.wirelesscraftingterminal.items.ItemInfinityBooster;
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
public class ContainerWirelessCraftingTerminal extends AEBaseContainer public class ContainerWirelessCraftingTerminal extends AEBaseContainer
implements IConfigManagerHost, implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<IAEItemStack>, IAEAppEngInventory,
IConfigurableObject, IContainerCraftingPacket, IViewCellStorage {
IMEMonitorHandlerReceiver<IAEItemStack>,
IAEAppEngInventory,
IContainerCraftingPacket,
IViewCellStorage {
private final ItemStack containerstack; private final ItemStack containerstack;
public final WCTInventoryCrafting craftingGrid; public final WCTInventoryCrafting craftingGrid;
@@ -112,18 +111,10 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
public ItemStack[] craftMatrixInventory; public ItemStack[] craftMatrixInventory;
private final World worldObj; private final World worldObj;
private final EntityPlayer player; private final EntityPlayer player;
public static final int HOTBAR_START = 2, public static final int HOTBAR_START = 2, HOTBAR_END = HOTBAR_START + 8, INV_START = HOTBAR_END + 1,
HOTBAR_END = HOTBAR_START + 8, INV_END = INV_START + 26, ARMOR_START = INV_END + 1, ARMOR_END = ARMOR_START + 3,
INV_START = HOTBAR_END + 1, CRAFT_GRID_START = ARMOR_END + 1, CRAFT_GRID_END = CRAFT_GRID_START + 8, CRAFT_RESULT = CRAFT_GRID_END + 1,
INV_END = INV_START + 26, VIEW_CELL_START = CRAFT_RESULT + 1, VIEW_CELL_END = VIEW_CELL_START + 4, BOOSTER_INDEX = 1,
ARMOR_START = INV_END + 1,
ARMOR_END = ARMOR_START + 3,
CRAFT_GRID_START = ARMOR_END + 1,
CRAFT_GRID_END = CRAFT_GRID_START + 8,
CRAFT_RESULT = CRAFT_GRID_END + 1,
VIEW_CELL_START = CRAFT_RESULT + 1,
VIEW_CELL_END = VIEW_CELL_START + 4,
BOOSTER_INDEX = 1,
MAGNET_INDEX = VIEW_CELL_END + 1; MAGNET_INDEX = VIEW_CELL_END + 1;
public static int CRAFTING_SLOT_X_POS = 80, CRAFTING_SLOT_Y_POS = 83; public static int CRAFTING_SLOT_X_POS = 80, CRAFTING_SLOT_Y_POS = 83;
private SlotBooster boosterSlot; private SlotBooster boosterSlot;
@@ -190,8 +181,13 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
craftMatrixSlot = new SlotCraftingMatrix[9]; craftMatrixSlot = new SlotCraftingMatrix[9];
viewCellSlot = new SlotViewCell[5]; viewCellSlot = new SlotViewCell[5];
this.obj = this.obj = getGuiObject(
getGuiObject(containerstack, player, worldObj, (int) player.posX, (int) player.posY, (int) player.posZ); containerstack,
player,
worldObj,
(int) player.posX,
(int) player.posY,
(int) player.posZ);
this.civ = this.obj; this.civ = this.obj;
final IGridNode node = ((IGridHost) this.obj).getGridNode(ForgeDirection.UNKNOWN); final IGridNode node = ((IGridHost) this.obj).getGridNode(ForgeDirection.UNKNOWN);
this.networkNode = node; this.networkNode = node;
@@ -258,8 +254,12 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
// Add crafting grid slots // Add crafting grid slots
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) { for (int j = 0; j < 3; ++j) {
craftMatrixSlot[k] = craftMatrixSlot[k] = new SlotCraftingMatrix(
new SlotCraftingMatrix(this, this.craftingGrid, j + i * 3, 80 + j * 18, (i * 18) - 76); this,
this.craftingGrid,
j + i * 3,
80 + j * 18,
(i * 18) - 76);
this.addSlotToContainer(craftMatrixSlot[k]); this.addSlotToContainer(craftMatrixSlot[k]);
if (k == 0) { if (k == 0) {
this.firstCraftingSlotNumber = craftMatrixSlot[k].slotNumber; this.firstCraftingSlotNumber = craftMatrixSlot[k].slotNumber;
@@ -456,7 +456,10 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
} }
ais = Platform.poweredExtraction( ais = Platform.poweredExtraction(
this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource()); this.getPowerSource(),
this.getCellInventory(),
ais,
this.getActionSource());
if (ais != null) { if (ais != null) {
adp.addItems(ais.getItemStack()); adp.addItems(ais.getItemStack());
} }
@@ -475,8 +478,8 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
ais.setStackSize(1); ais.setStackSize(1);
final IAEItemStack extracted = ais.copy(); final IAEItemStack extracted = ais.copy();
ais = Platform.poweredInsert( ais = Platform
this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource()); .poweredInsert(this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource());
if (ais == null) { if (ais == null) {
final InventoryAdaptor ia = new AdaptorPlayerHand(player); final InventoryAdaptor ia = new AdaptorPlayerHand(player);
@@ -514,7 +517,10 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
IAEItemStack ais = slotItem.copy(); IAEItemStack ais = slotItem.copy();
ais.setStackSize(1); ais.setStackSize(1);
ais = Platform.poweredExtraction( ais = Platform.poweredExtraction(
this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource()); this.getPowerSource(),
this.getCellInventory(),
ais,
this.getActionSource());
if (ais != null) { if (ais != null) {
final InventoryAdaptor ia = new AdaptorPlayerHand(player); final InventoryAdaptor ia = new AdaptorPlayerHand(player);
@@ -538,7 +544,10 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
IAEItemStack ais = slotItem.copy(); IAEItemStack ais = slotItem.copy();
ais.setStackSize(ais.getItemStack().getMaxStackSize()); ais.setStackSize(ais.getItemStack().getMaxStackSize());
ais = Platform.poweredExtraction( ais = Platform.poweredExtraction(
this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource()); this.getPowerSource(),
this.getCellInventory(),
ais,
this.getActionSource());
if (ais != null) { if (ais != null) {
player.inventory.setItemStack(ais.getItemStack()); player.inventory.setItemStack(ais.getItemStack());
} else { } else {
@@ -548,8 +557,8 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
} }
} else { } else {
IAEItemStack ais = AEApi.instance().storage().createItemStack(player.inventory.getItemStack()); IAEItemStack ais = AEApi.instance().storage().createItemStack(player.inventory.getItemStack());
ais = Platform.poweredInsert( ais = Platform
this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource()); .poweredInsert(this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource());
if (ais != null) { if (ais != null) {
player.inventory.setItemStack(ais.getItemStack()); player.inventory.setItemStack(ais.getItemStack());
} else { } else {
@@ -575,7 +584,10 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
final long stackSize = Math.min(maxSize, ais.getStackSize()); final long stackSize = Math.min(maxSize, ais.getStackSize());
ais.setStackSize((stackSize + 1) >> 1); ais.setStackSize((stackSize + 1) >> 1);
ais = Platform.poweredExtraction( ais = Platform.poweredExtraction(
this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource()); this.getPowerSource(),
this.getCellInventory(),
ais,
this.getActionSource());
} }
if (ais != null) { if (ais != null) {
@@ -588,8 +600,8 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
} else { } else {
IAEItemStack ais = AEApi.instance().storage().createItemStack(player.inventory.getItemStack()); IAEItemStack ais = AEApi.instance().storage().createItemStack(player.inventory.getItemStack());
ais.setStackSize(1); ais.setStackSize(1);
ais = Platform.poweredInsert( ais = Platform
this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource()); .poweredInsert(this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource());
if (ais == null) { if (ais == null) {
final ItemStack is = player.inventory.getItemStack(); final ItemStack is = player.inventory.getItemStack();
is.stackSize--; is.stackSize--;
@@ -631,7 +643,10 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
} }
ais = Platform.poweredExtraction( ais = Platform.poweredExtraction(
this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource()); this.getPowerSource(),
this.getCellInventory(),
ais,
this.getActionSource());
if (ais != null) { if (ais != null) {
adp.addItems(ais.getItemStack()); adp.addItems(ais.getItemStack());
} else { } else {
@@ -663,12 +678,8 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
} }
@Override @Override
public void onChangeInventory( public void onChangeInventory(final IInventory inv, final int slot, final InvOperation mc,
final IInventory inv, final ItemStack removedStack, final ItemStack newStack) {
final int slot,
final InvOperation mc,
final ItemStack removedStack,
final ItemStack newStack) {
// <3 // <3
} }
@@ -713,11 +724,11 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
return viewCellSlot[index]; return viewCellSlot[index];
} }
public static WirelessTerminalGuiObject getGuiObject( public static WirelessTerminalGuiObject getGuiObject(final ItemStack it, final EntityPlayer player, final World w,
final ItemStack it, final EntityPlayer player, final World w, final int x, final int y, final int z) { final int x, final int y, final int z) {
if (it != null) { if (it != null) {
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance().registries()
AEApi.instance().registries().wireless().getWirelessTerminalHandler(it); .wireless().getWirelessTerminalHandler(it);
if (wh != null) { if (wh != null) {
return new WirelessTerminalGuiObject(wh, it, player, w, x, y, z); return new WirelessTerminalGuiObject(wh, it, player, w, x, y, z);
} }
@@ -733,7 +744,9 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
if (this.ticks > 10) { if (this.ticks > 10) {
if (!isBoosterInstalled() || !Reference.WCT_BOOSTER_ENABLED) { if (!isBoosterInstalled() || !Reference.WCT_BOOSTER_ENABLED) {
this.civ.extractAEPower( this.civ.extractAEPower(
this.getPowerMultiplier() * this.ticks, Actionable.MODULATE, PowerMultiplier.CONFIG); this.getPowerMultiplier() * this.ticks,
Actionable.MODULATE,
PowerMultiplier.CONFIG);
} else { } else {
this.civ.extractAEPower((int) (0.5 * this.ticks), Actionable.MODULATE, PowerMultiplier.CONFIG); this.civ.extractAEPower((int) (0.5 * this.ticks), Actionable.MODULATE, PowerMultiplier.CONFIG);
} }
@@ -754,7 +767,8 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
for (final Object crafter : this.crafters) { for (final Object crafter : this.crafters) {
try { try {
NetworkHandler.instance.sendTo( NetworkHandler.instance.sendTo(
new PacketValueConfig(set.name(), sideLocal.name()), (EntityPlayerMP) crafter); new PacketValueConfig(set.name(), sideLocal.name()),
(EntityPlayerMP) crafter);
} catch (final IOException e) { } catch (final IOException e) {
WCTLog.debug(e.getMessage()); WCTLog.debug(e.getMessage());
} }
@@ -801,22 +815,20 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
} }
if (!networkIsPowered()) { if (!networkIsPowered()) {
if (this.isValidContainer()) { if (this.isValidContainer()) {
this.getPlayerInv() this.getPlayerInv().player
.player
.addChatMessage(new ChatComponentText(LocaleHandler.NoNetworkPower.getLocal())); .addChatMessage(new ChatComponentText(LocaleHandler.NoNetworkPower.getLocal()));
} }
this.setValidContainer(false); this.setValidContainer(false);
} }
} else if (!hasAccess(SecurityPermissions.CRAFT, true) } else if (!hasAccess(SecurityPermissions.CRAFT, true) || !hasAccess(SecurityPermissions.EXTRACT, true)
|| !hasAccess(SecurityPermissions.EXTRACT, true)
|| !hasAccess(SecurityPermissions.INJECT, true)) { || !hasAccess(SecurityPermissions.INJECT, true)) {
if (this.isValidContainer()) { if (this.isValidContainer()) {
this.getPlayerInv().player.addChatMessage(PlayerMessages.CommunicationError.get()); this.getPlayerInv().player.addChatMessage(PlayerMessages.CommunicationError.get());
} }
this.setValidContainer(false); this.setValidContainer(false);
} else { } else {
this.setPowerMultiplier(AEConfig.instance.wireless_getDrainRate(this.obj.getRange())); this.setPowerMultiplier(AEConfig.instance.wireless_getDrainRate(this.obj.getRange()));
} }
super.detectAndSendChanges(); super.detectAndSendChanges();
} }
@@ -828,8 +840,7 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
} }
boolean hasStack = getSlotFromInventory(this.boosterInventory, 0).getHasStack(); boolean hasStack = getSlotFromInventory(this.boosterInventory, 0).getHasStack();
if (hasStack) { if (hasStack) {
Item boosterSlotContents = Item boosterSlotContents = getSlotFromInventory(this.boosterInventory, 0).getStack().getItem();
getSlotFromInventory(this.boosterInventory, 0).getStack().getItem();
return boosterSlotContents instanceof ItemInfinityBooster; return boosterSlotContents instanceof ItemInfinityBooster;
} }
return false; return false;
@@ -840,12 +851,9 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
if (slot == null) { if (slot == null) {
return false; return false;
} }
boolean hasStack = boolean hasStack = getSlotFromInventory(this.magnetInventory, MAGNET_INDEX).getHasStack();
getSlotFromInventory(this.magnetInventory, MAGNET_INDEX).getHasStack();
if (hasStack) { if (hasStack) {
Item magnetSlotContents = getSlotFromInventory(this.magnetInventory, MAGNET_INDEX) Item magnetSlotContents = getSlotFromInventory(this.magnetInventory, MAGNET_INDEX).getStack().getItem();
.getStack()
.getItem();
return magnetSlotContents instanceof ItemMagnet; return magnetSlotContents instanceof ItemMagnet;
} }
return false; return false;
@@ -902,9 +910,7 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
} }
@Override @Override
public void postChange( public void postChange(final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change,
final IBaseMonitor<IAEItemStack> monitor,
final Iterable<IAEItemStack> change,
final BaseActionSource source) { final BaseActionSource source) {
for (final IAEItemStack is : change) { for (final IAEItemStack is : change) {
this.items.add(is); this.items.add(is);
@@ -1321,8 +1327,7 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
@Override @Override
public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) { public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) {
try { try {
if (slot >= 0 if (slot >= 0 && getSlot(slot) != null
&& getSlot(slot) != null
&& getSlot(slot).getStack() == RandomUtils.getWirelessTerm(player.inventory)) { && getSlot(slot).getStack() == RandomUtils.getWirelessTerm(player.inventory)) {
return null; return null;
} }
@@ -1353,8 +1358,7 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
continue; continue;
} }
if (itemstack1 != null if (itemstack1 != null && itemstack1.getItem() == stack.getItem()
&& 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;
@@ -1396,7 +1400,8 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
break; break;
} else { } else {
putStackInSlot( putStackInSlot(
k, new ItemStack(stack.getItem(), slot.getSlotStackLimit(), stack.getItemDamage())); k,
new ItemStack(stack.getItem(), slot.getSlotStackLimit(), stack.getItemDamage()));
stack.stackSize -= slot.getSlotStackLimit(); stack.stackSize -= slot.getSlotStackLimit();
boosterInventory.markDirty(); boosterInventory.markDirty();
flag1 = true; flag1 = true;
@@ -1,9 +1,10 @@
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;
@@ -12,15 +13,8 @@ public class OptionalSlotFake extends SlotFake {
private final IOptionalSlotHost host; private final IOptionalSlotHost host;
private boolean renderDisabled = true; private boolean renderDisabled = true;
public OptionalSlotFake( public OptionalSlotFake(final IInventory inv, final IOptionalSlotHost containerBus, final int idx, final int x,
final IInventory inv, final int y, final int offX, final int offY, final int groupNum) {
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;
@@ -1,7 +1,5 @@
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;
@@ -9,12 +7,14 @@ 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 * The armor type that can be placed on that slot, it uses the same values of armorType field on ItemArmor. Probably
* of armorType field on ItemArmor. Probably could've done just as well * could've done just as well with vanilla armor slot class. if so, this will be removed in the future.
* with vanilla armor slot class. if so, this will be removed in the future.
*/ */
final int armorType; final int armorType;
@@ -1,14 +1,15 @@
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 {
/** /**
@@ -84,8 +84,7 @@ public class SlotTrash extends appeng.container.slot.AppEngSlot {
} }
public void readNBT() { public void readNBT() {
NBTTagCompound nbtTagCompound = NBTTagCompound nbtTagCompound = RandomUtils.getWirelessTerm(entityPlayer.inventory).getTagCompound();
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) {
@@ -94,8 +93,7 @@ public class SlotTrash extends appeng.container.slot.AppEngSlot {
} }
public void writeNBT() { public void writeNBT() {
NBTTagCompound nbtTagCompound = NBTTagCompound nbtTagCompound = RandomUtils.getWirelessTerm(entityPlayer.inventory).getTagCompound();
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,9 +1,10 @@
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) {
@@ -1,17 +1,18 @@
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 {
@@ -133,17 +134,11 @@ public class WCTInventoryCrafting extends AppEngInternalInventory {
} }
/* /*
* @Override public ItemStack decrStackSize(int slot, int amount) { if * @Override public ItemStack decrStackSize(int slot, int amount) { if (this.stackList[slot] != null) { ItemStack
* (this.stackList[slot] != null) { ItemStack itemstack; if * itemstack; if (this.stackList[slot].stackSize <= amount) { itemstack = this.stackList[slot]; this.stackList[slot]
* (this.stackList[slot].stackSize <= amount) { itemstack = * = null; this.eventHandler.onCraftMatrixChanged(this); return itemstack; } else { itemstack =
* this.stackList[slot]; this.stackList[slot] = null; * this.stackList[slot].splitStack(amount); if (this.stackList[slot].stackSize == 0) { this.stackList[slot] = null;
* this.eventHandler.onCraftMatrixChanged(this); return itemstack; } else { * } this.eventHandler.onCraftMatrixChanged(this); return itemstack; } } else { return getStackInSlot(slot); } }
* 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,12 +1,13 @@
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,8 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.common.utils; package net.p455w0rd.wirelesscraftingterminal.common.utils;
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;
@@ -12,6 +9,10 @@ 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.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class RandomUtils { public class RandomUtils {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@@ -80,8 +81,7 @@ public class RandomUtils {
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 if (playerInv.player.getHeldItem() != null && playerInv.player.getHeldItem().getItem() instanceof ItemMagnet) {
&& 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
@@ -129,9 +129,7 @@ public class RandomUtils {
} }
public static boolean isMagnetInstalled(InventoryPlayer ip) { public static boolean isMagnetInstalled(InventoryPlayer ip) {
NBTTagCompound magnetNBTForm = RandomUtils.getWirelessTerm(ip) NBTTagCompound magnetNBTForm = RandomUtils.getWirelessTerm(ip).getTagCompound().getTagList("MagnetSlot", 10)
.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,10 +1,12 @@
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");
/** /**
@@ -29,9 +31,11 @@ public class WCTLog {
* Displays the section footer. * Displays the section footer.
*/ */
public static void endSection(final String section, final long sectionStartTime) { public static void endSection(final String section, final long sectionStartTime) {
log.info(String.format( log.info(
"-=-=-=-=-=-=-=[FINISH] %s in %dms=-=-=-=-=-=-=-", String.format(
section, (System.currentTimeMillis() - sectionStartTime))); "-=-=-=-=-=-=-=[FINISH] %s in %dms=-=-=-=-=-=-=-",
section,
(System.currentTimeMillis() - sectionStartTime)));
} }
/** /**
@@ -1,11 +1,12 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync; package net.p455w0rd.wirelesscraftingterminal.core.sync;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo; import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler; import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import io.netty.buffer.ByteBuf;
public abstract class WCTPacket { public abstract class WCTPacket {
private ByteBuf p; private ByteBuf p;
@@ -1,11 +1,10 @@
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.PacketCraftRequest;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketEmptyTrash; import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketEmptyTrash;
@@ -18,11 +17,15 @@ import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSetMagnet;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis; import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig; import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.DecoderException;
public class WCTPacketHandlerBase { public class WCTPacketHandlerBase {
private static final Map<Class<? extends WCTPacket>, PacketTypes> REVERSE_LOOKUP =
new HashMap<Class<? extends WCTPacket>, WCTPacketHandlerBase.PacketTypes>(); private static final Map<Class<? extends WCTPacket>, PacketTypes> REVERSE_LOOKUP = 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_ME_INVENTORY_UPDATE(PacketMEInventoryUpdate.class),
@@ -54,10 +57,7 @@ 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 NoSuchMethodException ignored) {} catch (final SecurityException ignored) {} catch (final DecoderException 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);
@@ -76,9 +76,8 @@ public class WCTPacketHandlerBase {
return REVERSE_LOOKUP.get(c); return REVERSE_LOOKUP.get(c);
} }
public WCTPacket parsePacket(final ByteBuf in) public WCTPacket parsePacket(final ByteBuf in) throws InstantiationException, IllegalAccessException,
throws InstantiationException, IllegalAccessException, IllegalArgumentException, IllegalArgumentException, InvocationTargetException {
InvocationTargetException {
return this.packetConstructor.newInstance(in); return this.packetConstructor.newInstance(in);
} }
} }
@@ -1,3 +1,4 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.network; package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
public interface INetworkInfo {} public interface INetworkInfo {
}
@@ -1,8 +1,9 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.network; package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
public interface IPacketHandler { public interface IPacketHandler {
void onPacketData(INetworkInfo manager, FMLProxyPacket packet, EntityPlayer player); void onPacketData(INetworkInfo manager, FMLProxyPacket packet, EntityPlayer player);
@@ -1,14 +1,15 @@
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 {
@@ -1,14 +1,16 @@
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
@@ -1,13 +1,15 @@
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
@@ -1,7 +1,5 @@
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;
@@ -9,6 +7,10 @@ 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;
@@ -57,7 +59,9 @@ 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();
RecipeHandler.loadRecipes(mtChanged); if (!Loader.isModLoaded("dreamcraft")) {
RecipeHandler.loadRecipes(mtChanged);
}
mtChanged = false; mtChanged = false;
} }
} }
@@ -1,5 +1,13 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets; package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
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;
import appeng.api.networking.IGrid; import appeng.api.networking.IGrid;
import appeng.api.networking.IGridHost; import appeng.api.networking.IGridHost;
import appeng.api.networking.crafting.ICraftingGrid; import appeng.api.networking.crafting.ICraftingGrid;
@@ -8,12 +16,6 @@ import appeng.container.implementations.ContainerCraftAmount;
import appeng.container.implementations.ContainerCraftConfirm; import appeng.container.implementations.ContainerCraftConfirm;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; 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 { public class PacketCraftRequest extends WCTPacket {
@@ -55,7 +57,11 @@ public class PacketCraftRequest extends WCTPacket {
try { try {
final ICraftingGrid cg = g.getCache(ICraftingGrid.class); final ICraftingGrid cg = g.getCache(ICraftingGrid.class);
futureJob = cg.beginCraftingJob( futureJob = cg.beginCraftingJob(
cca.getWorld(), cca.getGrid(), cca.getActionSrc(), cca.getItemToCraft(), null); cca.getWorld(),
cca.getGrid(),
cca.getActionSrc(),
cca.getItemToCraft(),
null);
int x = (int) player.posX; int x = (int) player.posX;
int y = (int) player.posY; int y = (int) player.posY;
@@ -1,7 +1,5 @@
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;
@@ -10,6 +8,9 @@ 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) {}
@@ -1,5 +1,17 @@
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.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;
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;
@@ -10,16 +22,6 @@ 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 {
@@ -115,10 +117,8 @@ public class PacketInventoryAction extends WCTPacket {
if (baseContainer instanceof ContainerWirelessCraftingTerminal) { if (baseContainer instanceof ContainerWirelessCraftingTerminal) {
if (((ContainerWirelessCraftingTerminal) baseContainer).getTargetStack() != null) { if (((ContainerWirelessCraftingTerminal) baseContainer).getTargetStack() != null) {
cca.getCraftingItem() cca.getCraftingItem().putStack(
.putStack(((ContainerWirelessCraftingTerminal) baseContainer) ((ContainerWirelessCraftingTerminal) baseContainer).getTargetStack().getItemStack());
.getTargetStack()
.getItemStack());
cca.setItemToCraft(((ContainerWirelessCraftingTerminal) baseContainer).getTargetStack()); cca.setItemToCraft(((ContainerWirelessCraftingTerminal) baseContainer).getTargetStack());
} }
} }
@@ -126,9 +126,7 @@ public class PacketInventoryAction extends WCTPacket {
if (baseContainer instanceof AEBaseContainer) { if (baseContainer instanceof AEBaseContainer) {
if (((AEBaseContainer) baseContainer).getTargetStack() != null) { if (((AEBaseContainer) baseContainer).getTargetStack() != null) {
cca.getCraftingItem() cca.getCraftingItem()
.putStack(((AEBaseContainer) baseContainer) .putStack(((AEBaseContainer) baseContainer).getTargetStack().getItemStack());
.getTargetStack()
.getItemStack());
cca.setItemToCraft(((AEBaseContainer) baseContainer).getTargetStack()); cca.setItemToCraft(((AEBaseContainer) baseContainer).getTargetStack());
} }
} }
@@ -140,9 +138,8 @@ public class PacketInventoryAction extends WCTPacket {
if (baseContainer instanceof ContainerWirelessCraftingTerminal) { if (baseContainer instanceof ContainerWirelessCraftingTerminal) {
if (RandomUtils.getWirelessTerm(player.inventory) == null) if (RandomUtils.getWirelessTerm(player.inventory) == null)
((ContainerWirelessCraftingTerminal) baseContainer).setValidContainer(false); ((ContainerWirelessCraftingTerminal) baseContainer).setValidContainer(false);
else else((ContainerWirelessCraftingTerminal) baseContainer)
((ContainerWirelessCraftingTerminal) baseContainer) .doAction(sender, this.action, this.slot, this.id);
.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); ((AEBaseContainer) baseContainer).doAction(sender, this.action, this.slot, this.id);
@@ -1,12 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets; 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.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
@@ -15,7 +8,9 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream; import java.util.zip.GZIPOutputStream;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -25,7 +20,16 @@ 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.network.INetworkInfo; import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
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;
public class PacketMEInventoryUpdate extends WCTPacket { public class PacketMEInventoryUpdate extends WCTPacket {
private static final int UNCOMPRESSED_PACKET_BYTE_LIMIT = 16 * 1024 * 1024; private static final int UNCOMPRESSED_PACKET_BYTE_LIMIT = 16 * 1024 * 1024;
private static final int OPERATION_BYTE_LIMIT = 2 * 1024; private static final int OPERATION_BYTE_LIMIT = 2 * 1024;
private static final int TEMP_BUFFER_SIZE = 1024; private static final int TEMP_BUFFER_SIZE = 1024;
@@ -54,6 +58,7 @@ public class PacketMEInventoryUpdate extends WCTPacket {
this.ref = stream.readByte(); this.ref = stream.readByte();
final GZIPInputStream gzReader = new GZIPInputStream(new InputStream() { final GZIPInputStream gzReader = new GZIPInputStream(new InputStream() {
@Override @Override
public int read() throws IOException { public int read() throws IOException {
if (stream.readableBytes() <= 0) { if (stream.readableBytes() <= 0) {
@@ -94,6 +99,7 @@ public class PacketMEInventoryUpdate extends WCTPacket {
this.data.writeByte(this.ref); this.data.writeByte(this.ref);
this.compressFrame = new GZIPOutputStream(new OutputStream() { this.compressFrame = new GZIPOutputStream(new OutputStream() {
@Override @Override
public void write(final int value) throws IOException { public void write(final int value) throws IOException {
PacketMEInventoryUpdate.this.data.writeByte(value); PacketMEInventoryUpdate.this.data.writeByte(value);
@@ -1,7 +1,5 @@
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;
@@ -10,6 +8,9 @@ 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
@@ -1,5 +1,28 @@
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.WirelessTerminalGuiObject;
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;
@@ -20,27 +43,6 @@ 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 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 {
@@ -80,7 +82,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;
@@ -140,15 +142,16 @@ 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 = final ItemStack newItemStack = r.matches(testInv, pmp.worldObj)
r.matches(testInv, pmp.worldObj) ? r.getCraftingResult(testInv) : null; ? r.getCraftingResult(testInv)
: 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 = final IAEItemStack out = Platform
Platform.poweredInsert(energy, storage, in, cct.getActionSource()); .poweredInsert(energy, storage, in, cct.getActionSource());
if (out != null) { if (out != null) {
craftMatrix.setInventorySlotContents(x, out.getItemStack()); craftMatrix.setInventorySlotContents(x, out.getItemStack());
} else { } else {
@@ -190,7 +193,10 @@ 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, storage, request, cct.getActionSource()); energy,
storage,
request,
cct.getActionSource());
if (out != null) { if (out != null) {
whichItem = out.getItemStack(); whichItem = out.getItemStack();
break; break;
@@ -219,18 +225,17 @@ 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( private ItemStack extractItemFromPlayerInventory(final EntityPlayer player, final Actionable mode,
final EntityPlayer player, final Actionable mode, final ItemStack patternItem) { 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() final boolean checkFuzzy = request.isOre() || patternItem.getItemDamage() == OreDictionary.WILDCARD_VALUE
|| patternItem.getItemDamage() == OreDictionary.WILDCARD_VALUE
|| patternItem.hasTagCompound() || patternItem.hasTagCompound()
|| patternItem.isItemStackDamageable(); || patternItem.isItemStackDamageable();
@@ -1,13 +1,14 @@
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;
@@ -29,7 +30,12 @@ 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, player, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ); this.whichGui,
player,
player.worldObj,
(int) player.posX,
(int) player.posY,
(int) player.posZ);
} }
} }
@@ -1,7 +1,5 @@
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.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
@@ -11,6 +9,9 @@ import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler; import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet; import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
public class PacketSetMagnet extends WCTPacket { public class PacketSetMagnet extends WCTPacket {
int magnetDamage; int magnetDamage;
@@ -38,18 +39,12 @@ public class PacketSetMagnet extends WCTPacket {
if (magnetItem != null) { if (magnetItem != null) {
if (magnetItem.getItemDamage() == 2) { if (magnetItem.getItemDamage() == 2) {
RandomUtils.getWirelessTerm(player.inventory) RandomUtils.getWirelessTerm(player.inventory).getTagCompound().getTagList("MagnetSlot", 10)
.getTagCompound() .getCompoundTagAt(0).setShort("Damage", (short) 0);
.getTagList("MagnetSlot", 10)
.getCompoundTagAt(0)
.setShort("Damage", (short) 0);
player.addChatMessage(new ChatComponentText(LocaleHandler.MagnetMode1.getLocal())); player.addChatMessage(new ChatComponentText(LocaleHandler.MagnetMode1.getLocal()));
} else { } else {
RandomUtils.getWirelessTerm(player.inventory) RandomUtils.getWirelessTerm(player.inventory).getTagCompound().getTagList("MagnetSlot", 10)
.getTagCompound() .getCompoundTagAt(0).setShort("Damage", (short) (magnetItem.getItemDamage() + 1));
.getTagList("MagnetSlot", 10)
.getCompoundTagAt(0)
.setShort("Damage", (short) (magnetItem.getItemDamage() + 1));
if (magnetItem.getItemDamage() == 0) { if (magnetItem.getItemDamage() == 0) {
player.addChatMessage(new ChatComponentText(LocaleHandler.MagnetMode2.getLocal())); player.addChatMessage(new ChatComponentText(LocaleHandler.MagnetMode2.getLocal()));
} else { } else {
@@ -1,8 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets; 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.entity.player.EntityPlayer;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal; import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal;
@@ -10,6 +7,10 @@ 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 appeng.util.Platform;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
public class PacketSwitchGuis extends WCTPacket { public class PacketSwitchGuis extends WCTPacket {
private final int newGui; private final int newGui;
@@ -1,5 +1,18 @@
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.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;
import appeng.api.config.Settings; import appeng.api.config.Settings;
import appeng.api.util.IConfigManager; import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject; import appeng.api.util.IConfigurableObject;
@@ -7,17 +20,6 @@ import appeng.container.AEBaseContainer;
import appeng.helpers.IMouseWheelItem; import appeng.helpers.IMouseWheelItem;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; 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 { public class PacketValueConfig extends WCTPacket {
@@ -53,8 +55,7 @@ public class PacketValueConfig 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 Container c = player.openContainer; final Container c = player.openContainer;
if (this.Name.equals("Item") if (this.Name.equals("Item") && RandomUtils.getWirelessTerm(player.inventory) != null
&& RandomUtils.getWirelessTerm(player.inventory) != null
&& RandomUtils.getWirelessTerm(player.inventory).getItem() instanceof IMouseWheelItem) { && RandomUtils.getWirelessTerm(player.inventory).getItem() instanceof IMouseWheelItem) {
final ItemStack is = RandomUtils.getWirelessTerm(player.inventory); final ItemStack is = RandomUtils.getWirelessTerm(player.inventory);
final IMouseWheelItem si = (IMouseWheelItem) is.getItem(); final IMouseWheelItem si = (IMouseWheelItem) is.getItem();
@@ -1,13 +1,14 @@
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) {
@@ -17,11 +17,24 @@ 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", "boosterAchievement", 0, 2, ItemEnum.BOOSTER_ICON.getItem(), wctAch); "achievment.boosterAchievement",
"boosterAchievement",
0,
2,
ItemEnum.BOOSTER_ICON.getItem(),
wctAch);
public static final Achievement magnetAch = new Achievement( public static final Achievement magnetAch = new Achievement(
"achievement.magnetAchievement", "magnetAchievement", 2, 0, ItemEnum.MAGNET_CARD.getItem(), wctAch); "achievement.magnetAchievement",
private static final AchievementPage achPage = "magnetAchievement",
new AchievementPage("Wireless Crafting Term", wctAch, boosterAch, magnetAch); 2,
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,20 +1,22 @@
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 * A big part of what goes on here is reloading the cfg on-the-fly since Ender-Core adds the abilitty to modify
* since Ender-Core adds the abilitty to modify config stuff while in game, * config stuff while in game, I figured I'd add support for such possibilities
* 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;
@@ -53,18 +55,17 @@ 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 = enableInfinityBooster = config
config.getBoolean("enableInfinityBooster", Configuration.CATEGORY_GENERAL, true, boosterDesc); .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 = boosterDropsEnabled = config
config.getBoolean("boosterDropsEnabled", Configuration.CATEGORY_GENERAL, true, boosterDropEnabledDesc); .getBoolean("boosterDropsEnabled", Configuration.CATEGORY_GENERAL, true, boosterDropEnabledDesc);
mineTweakerOverride = config.getBoolean( mineTweakerOverride = config
"mineTweakerOverride", Configuration.CATEGORY_GENERAL, false, mineTweakerOverrideDesc); .getBoolean("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 * I did the max power cfg loading like this because while using Configuration#getInt did enforce the min/max
* Configuration#getInt did enforce the min/max values in-game, it * values in-game, it didn't properly update the config file
* 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;
@@ -84,8 +85,8 @@ public class ConfigHandler {
doSave = true; doSave = true;
} }
Property boosterDropKey = Property boosterDropKey = config
config.get(Configuration.CATEGORY_GENERAL, "boosterDropChance", Reference.WCT_BOOSTER_DROPCHANCE); .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);
@@ -124,7 +125,9 @@ public class ConfigHandler {
} }
public static void reloadRecipes() { public static void reloadRecipes() {
RecipeHandler.loadRecipes(mtChanged); if (!Loader.isModLoaded("dreamcraft")) {
RecipeHandler.loadRecipes(mtChanged);
}
mtChanged = false; mtChanged = false;
} }
@@ -1,11 +1,5 @@
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;
@@ -18,8 +12,16 @@ 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 {
@@ -28,9 +30,9 @@ public class KeybindHandler {
public static KeyBinding changeMagnetMode; public static KeyBinding changeMagnetMode;
public static void registerKeybinds() { public static void registerKeybinds() {
openTerminal = new KeyBinding("key.OpenTerminal", Keyboard.CHAR_NONE, "key.categories.ae2wct"); openTerminal = new KeyBinding("ae2wct.OpenTerminal", Keyboard.CHAR_NONE, "key.categories.ae2wct");
openMagnetFilter = new KeyBinding("key.OpenMagnetFilter", Keyboard.CHAR_NONE, "key.categories.ae2wct"); openMagnetFilter = new KeyBinding("ae2wct.OpenMagnetFilter", Keyboard.CHAR_NONE, "key.categories.ae2wct");
changeMagnetMode = new KeyBinding("key.SwitchMagnetMode", Keyboard.CHAR_NONE, "key.categories.ae2wct"); changeMagnetMode = new KeyBinding("ae2wct.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);
@@ -3,6 +3,7 @@ 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,6 +12,8 @@ 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>();
@@ -28,88 +30,53 @@ public class RecipeHandler {
// EASY MODE RECIPES // EASY MODE RECIPES
// Wireless Crafting Terminal // Wireless Crafting Terminal
easyRecipeList.add(new ShapedOreRecipe(ItemEnum.WIRELESS_CRAFTING_TERMINAL.getStack(), new Object[] { easyRecipeList.add(
"a", new ShapedOreRecipe(
"b", ItemEnum.WIRELESS_CRAFTING_TERMINAL.getStack(),
"c", new Object[] { "a", "b", "c", Character.valueOf('a'), new ItemStack(multiMaterial, 1, 41),
Character.valueOf('a'), Character.valueOf('b'), new ItemStack(multiPart, 1, 360), Character.valueOf('c'),
new ItemStack(multiMaterial, 1, 41), new ItemStack(ae2WirelessTerm, 1, 0) }));
Character.valueOf('b'),
new ItemStack(multiPart, 1, 360),
Character.valueOf('c'),
new ItemStack(ae2WirelessTerm, 1, 0)
}));
// Magnet Card // Magnet Card
easyRecipeList.add(new ShapedOreRecipe(ItemEnum.MAGNET_CARD.getStack(), new Object[] { easyRecipeList.add(
"a b", new ShapedOreRecipe(
"cdc", ItemEnum.MAGNET_CARD.getStack(),
"ccc", new Object[] { "a b", "cdc", "ccc", Character.valueOf('a'), "dustRedstone",
Character.valueOf('a'), Character.valueOf('b'), "gemLapis", Character.valueOf('c'), "ingotIron",
"dustRedstone", Character.valueOf('d'), new ItemStack(multiMaterial, 1, 28) }));
Character.valueOf('b'),
"gemLapis",
Character.valueOf('c'),
"ingotIron",
Character.valueOf('d'),
new ItemStack(multiMaterial, 1, 28)
}));
// Infinity Booster Card // Infinity Booster Card
easyRecipeList.add(new ShapedOreRecipe(ItemEnum.BOOSTER_CARD.getStack(), new Object[] { easyRecipeList.add(
"abc", new ShapedOreRecipe(
"ded", ItemEnum.BOOSTER_CARD.getStack(),
"cba", new Object[] { "abc", "ded", "cba", Character.valueOf('a'), new ItemStack(blockSpatialIO, 1, 0),
Character.valueOf('a'), Character.valueOf('b'), new ItemStack(multiMaterial, 1, 42), Character.valueOf('c'),
new ItemStack(blockSpatialIO, 1, 0), new ItemStack(blockCraftingStorage, 1, 3), Character.valueOf('d'),
Character.valueOf('b'), new ItemStack(multiMaterial, 1, 48), Character.valueOf('e'),
new ItemStack(multiMaterial, 1, 42), new ItemStack(itemWAP, 1, 0) }));
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(new ShapedOreRecipe(ItemEnum.WIRELESS_CRAFTING_TERMINAL.getStack(), new Object[] { hardRecipeList.add(
"aba", new ShapedOreRecipe(
"cdc", ItemEnum.WIRELESS_CRAFTING_TERMINAL.getStack(),
"efe", new Object[] { "aba", "cdc", "efe", Character.valueOf('a'), new ItemStack(multiMaterial, 1, 9),
Character.valueOf('a'), Character.valueOf('b'), new ItemStack(itemWAP, 1, 0), Character.valueOf('c'),
new ItemStack(multiMaterial, 1, 9), new ItemStack(multiMaterial, 1, 12), Character.valueOf('d'),
Character.valueOf('b'), new ItemStack(multiPart, 1, 360), Character.valueOf('e'),
new ItemStack(itemWAP, 1, 0), new ItemStack(multiMaterial, 1, 38), Character.valueOf('f'),
Character.valueOf('c'), new ItemStack(multiMaterial, 1, 47) }));
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(new ShapedOreRecipe(ItemEnum.MAGNET_CARD.getStack(), new Object[] { hardRecipeList.add(
"abc", new ShapedOreRecipe(
"ded", ItemEnum.MAGNET_CARD.getStack(),
"ddd", new Object[] { "abc", "ded", "ddd", Character.valueOf('a'), "blockRedstone",
Character.valueOf('a'), Character.valueOf('b'), new ItemStack(multiPart, 1, 300), Character.valueOf('c'),
"blockRedstone", "blockLapis", Character.valueOf('d'), "blockIron", Character.valueOf('e'),
Character.valueOf('b'), new ItemStack(multiMaterial, 1, 28) }));
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")
@@ -126,8 +93,7 @@ public class RecipeHandler {
} }
// remove old recipes // remove old recipes
Iterator<IRecipe> iterator = Iterator<IRecipe> iterator = CraftingManager.getInstance().getRecipeList().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) {
@@ -1,20 +1,22 @@
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;
@@ -43,8 +45,12 @@ 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(EnumChatFormatting.BLUE + "-=-=-=-=-=[" + EnumChatFormatting.WHITE new ChatComponentText(
+ "Wireless Crafting Terminal" + EnumChatFormatting.BLUE + "]=-=-=-=-=-")); 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);
@@ -57,9 +63,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,5 +1,12 @@
package net.p455w0rd.wirelesscraftingterminal.helpers; package net.p455w0rd.wirelesscraftingterminal.helpers;
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;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.AccessRestriction; import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
@@ -27,12 +34,6 @@ import appeng.api.util.DimensionalCoord;
import appeng.api.util.IConfigManager; import appeng.api.util.IConfigManager;
import appeng.container.interfaces.IInventorySlotAware; import appeng.container.interfaces.IInventorySlotAware;
import appeng.tile.networking.TileWireless; 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 public class WirelessTerminalGuiObject
implements IActionHost, IPortableCell, IInventorySlotAware, WCTIActionHost, IGuiItemObject { implements IActionHost, IPortableCell, IInventorySlotAware, WCTIActionHost, IGuiItemObject {
@@ -49,14 +50,8 @@ public class WirelessTerminalGuiObject
private double myRange = Double.MAX_VALUE; private double myRange = Double.MAX_VALUE;
private final int inventorySlot; private final int inventorySlot;
public WirelessTerminalGuiObject( public WirelessTerminalGuiObject(final IWirelessTermHandler wh, final ItemStack is, final EntityPlayer ep,
final IWirelessTermHandler wh, final World w, final int x, final int y, final int z) {
final ItemStack is,
final EntityPlayer ep,
final World w,
final int x,
final int y,
final int z) {
this.encryptionKey = wh.getEncryptionKey(is); this.encryptionKey = wh.getEncryptionKey(is);
this.effectiveItem = is; this.effectiveItem = is;
this.myPlayer = ep; this.myPlayer = ep;
@@ -133,7 +128,7 @@ public class WirelessTerminalGuiObject
} }
} }
@SuppressWarnings({"rawtypes", "unchecked"}) @SuppressWarnings({ "rawtypes", "unchecked" })
@Override @Override
public IItemList<IAEItemStack> getAvailableItems(final IItemList out) { public IItemList<IAEItemStack> getAvailableItems(final IItemList out) {
if (this.itemStorage != null) { if (this.itemStorage != null) {
@@ -1,12 +1,13 @@
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;
@@ -1,7 +1,5 @@
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;
@@ -14,12 +12,14 @@ 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) if ((player == null) || (player instanceof FakePlayer)
|| (player instanceof FakePlayer)
|| (player instanceof EntityPlayerMP) || (player instanceof EntityPlayerMP)
|| FMLCommonHandler.instance().getSide() == Side.SERVER) { || FMLCommonHandler.instance().getSide() == Side.SERVER) {
return; return;
@@ -43,8 +43,8 @@ public class WCTInteractionHelper implements IWCTInteractionHelper {
} }
} }
public static boolean isTerminalLinked( public static boolean isTerminalLinked(final IWirelessCraftingTermHandler wirelessTerminal,
final IWirelessCraftingTermHandler wirelessTerminal, final ItemStack wirelessTerminalItemstack) { final ItemStack wirelessTerminalItemstack) {
return (!wirelessTerminal.getEncryptionKey(wirelessTerminalItemstack).isEmpty()); return (!wirelessTerminal.getEncryptionKey(wirelessTerminalItemstack).isEmpty());
} }
} }
@@ -1,13 +1,15 @@
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,6 +1,7 @@
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();
@@ -1,10 +1,12 @@
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 {
@@ -22,8 +24,8 @@ public final class IntegrationNode {
private Object instance; private Object instance;
private IIntegrationModule mod = null; private IIntegrationModule mod = null;
public IntegrationNode( public IntegrationNode(final String displayName, final String modID, final IntegrationType shortName,
final String displayName, final String modID, final IntegrationType shortName, final String name) { final String name) {
this.displayName = displayName; this.displayName = displayName;
this.shortName = shortName; this.shortName = shortName;
this.modID = modID; this.modID = modID;
@@ -53,13 +55,12 @@ 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 = boolean enabled = this.modID == null || Loader.isModLoaded(this.modID)
this.modID == null || Loader.isModLoaded(this.modID) || apiManager.hasAPI(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.mod = (IIntegrationModule) this.classValue.getConstructor().newInstance();
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 {
@@ -1,12 +1,15 @@
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.";
@@ -53,8 +56,8 @@ public enum IntegrationRegistry {
builder.append(", "); builder.append(", ");
} }
final String integrationState = final String integrationState = node.getShortName() + ":"
node.getShortName() + ":" + (node.getState() == IntegrationStage.FAILED ? "OFF" : "ON"); + (node.getState() == IntegrationStage.FAILED ? "OFF" : "ON");
builder.append(integrationState); builder.append(integrationState);
} }
@@ -1,6 +1,7 @@
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,21 +1,9 @@
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;
@@ -35,7 +23,22 @@ 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 net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers.NEIGUIHandler;
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;
public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule { public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
@Reflected @Reflected
public static NEI instance; public static NEI instance;
@@ -94,7 +97,12 @@ 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, mc.getTextureManager(), stack, x, y, String.valueOf(stack.stackSize)); fontRenderer,
mc.getTextureManager(),
stack,
x,
y,
String.valueOf(stack.stackSize));
} }
@Override @Override
@@ -109,24 +117,20 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
} }
@Override @Override
public List<String> handleTooltip( public List<String> handleTooltip(final GuiContainer arg0, final int arg1, final int arg2,
final GuiContainer arg0, final int arg1, final int arg2, final List<String> current) { final List<String> current) {
return current; return current;
} }
@Override @Override
public List<String> handleItemDisplayName( public List<String> handleItemDisplayName(final GuiContainer arg0, final ItemStack arg1,
final GuiContainer arg0, final ItemStack arg1, final List<String> current) { final List<String> current) {
return current; return current;
} }
@Override @Override
public List<String> handleItemTooltip( public List<String> handleItemTooltip(final GuiContainer guiScreen, final ItemStack stack, final int mouseX,
final GuiContainer guiScreen, final int mouseY, final List<String> currentToolTip) {
final ItemStack stack,
final int mouseX,
final int mouseY,
final List<String> currentToolTip) {
if (guiScreen instanceof GuiWirelessCraftingTerminal) { if (guiScreen instanceof GuiWirelessCraftingTerminal) {
return ((GuiWirelessCraftingTerminal) guiScreen).handleItemTooltip(stack, mouseX, mouseY, currentToolTip); return ((GuiWirelessCraftingTerminal) guiScreen).handleItemTooltip(stack, mouseX, mouseY, currentToolTip);
} }
@@ -146,10 +150,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 += positionedStack.relx += ContainerWirelessCraftingTerminal.CRAFTING_SLOT_X_POS
ContainerWirelessCraftingTerminal.CRAFTING_SLOT_X_POS - NEI.NEI_REGULAR_SLOT_OFFSET_X; - NEI.NEI_REGULAR_SLOT_OFFSET_X;
positionedStack.rely += positionedStack.rely += ContainerWirelessCraftingTerminal.CRAFTING_SLOT_Y_POS
ContainerWirelessCraftingTerminal.CRAFTING_SLOT_Y_POS - NEI.NEI_REGULAR_SLOT_OFFSET_Y; - NEI.NEI_REGULAR_SLOT_OFFSET_Y;
} }
} }
return stacks; return stacks;
@@ -157,6 +161,7 @@ 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 * Reduces regular slot offsets to 0, 1, or 2
*/ */
@@ -171,10 +176,10 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
*/ */
private boolean addCraftingItems(final PositionedStack ingredient, final IAEItemStack[] overlayItems) { private boolean addCraftingItems(final PositionedStack ingredient, final IAEItemStack[] overlayItems) {
// Calculate the slot positions // Calculate the slot positions
int slotX = int slotX = (ingredient.relx - NEI.NEI_REGULAR_SLOT_OFFSET_X)
(ingredient.relx - NEI.NEI_REGULAR_SLOT_OFFSET_X) / WCTOverlayHandler.REGULAR_SLOT_INDEX_DIVISOR; / WCTOverlayHandler.REGULAR_SLOT_INDEX_DIVISOR;
int slotY = int slotY = (ingredient.rely - NEI.NEI_REGULAR_SLOT_OFFSET_Y)
(ingredient.rely - NEI.NEI_REGULAR_SLOT_OFFSET_Y) / WCTOverlayHandler.REGULAR_SLOT_INDEX_DIVISOR; / WCTOverlayHandler.REGULAR_SLOT_INDEX_DIVISOR;
// Calculate the slot index // Calculate the slot index
int slotIndex = slotX + (slotY * 3); int slotIndex = slotX + (slotY * 3);
// Add the item to the list // Add the item to the list
@@ -193,21 +198,19 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
// overlayItems); // overlayItems);
} }
@SuppressWarnings({"rawtypes", "unchecked"}) @SuppressWarnings({ "rawtypes", "unchecked" })
@Override @Override
public void overlayRecipe( public void overlayRecipe(final GuiContainer gui, final IRecipeHandler recipe, final int recipeIndex,
final GuiContainer gui, final IRecipeHandler recipe, final int recipeIndex, final boolean shift) { 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 Exception ignored) {} catch (final Error ignored) {}
} catch (final Error ignored) {
}
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void overlayRecipe( private void overlayRecipe(final GuiContainer gui, final List<PositionedStack> ingredients,
final GuiContainer gui, final List<PositionedStack> ingredients, final boolean shift) { final boolean shift) {
try { try {
final NBTTagCompound recipe = new NBTTagCompound(); final NBTTagCompound recipe = new NBTTagCompound();
@@ -247,9 +250,7 @@ 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 Exception ignored) {} catch (final Error ignored) {}
} catch (final Error ignored) {
}
} }
} }
} }
@@ -1,5 +1,20 @@
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;
@@ -11,19 +26,6 @@ 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 {
@@ -66,30 +68,16 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler {
} }
} }
} }
/*
@Override
public void loadUsageRecipes( final ItemStack ingredient )
{
final List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for( final IRecipe recipe : recipes )
{
if( ( recipe instanceof ShapedRecipe ) )
{
final CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe );
if( ( (ShapedRecipe) recipe ).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) ) /*
{ * @Override public void loadUsageRecipes( final ItemStack ingredient ) { final List<IRecipe> recipes =
cachedRecipe.computeVisuals(); * CraftingManager.getInstance().getRecipeList(); for( final IRecipe recipe : recipes ) { if( ( recipe instanceof
if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) ) * ShapedRecipe ) ) { final CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe ); if( (
{ * (ShapedRecipe) recipe ).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) )
cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient ); * { cachedRecipe.computeVisuals(); if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) ) {
this.arecipes.add( cachedRecipe ); * 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";
@@ -171,7 +159,10 @@ 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, 25 + x * 18, 6 + y * 18, false); useSingleItems ? Platform.findPreferred(is) : is,
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) {
@@ -1,13 +1,8 @@
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;
@@ -17,20 +12,25 @@ 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( public void overlayRecipe(final GuiContainer gui, final IRecipeHandler recipe, final int recipeIndex,
final GuiContainer gui, final IRecipeHandler recipe, final int recipeIndex, final boolean shift) { 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 Exception ignored) {} catch (final Error ignored) {}
} catch (final Error ignored) {
}
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -74,8 +74,6 @@ public class NEICraftingHandler implements IOverlayHandler {
NetworkHandler.instance.sendToServer(new PacketNEIRecipe(recipe)); NetworkHandler.instance.sendToServer(new PacketNEIRecipe(recipe));
} }
} catch (final Exception ignored) { } catch (final Exception ignored) {} catch (final Error ignored) {}
} catch (final Error ignored) {
}
} }
} }
@@ -1,11 +1,13 @@
package net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers; package net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers;
import codechicken.nei.api.INEIGuiAdapter;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal; import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal;
import codechicken.nei.api.INEIGuiAdapter;
public class NEIGUIHandler extends INEIGuiAdapter { public class NEIGUIHandler extends INEIGuiAdapter {
protected Pattern SPECIAL_REGEX_CHARS = Pattern.compile("[{}()\\[\\].+*?^$\\\\|]"); protected Pattern SPECIAL_REGEX_CHARS = Pattern.compile("[{}()\\[\\].+*?^$\\\\|]");
@@ -15,9 +17,7 @@ public class NEIGUIHandler extends INEIGuiAdapter {
if (gui instanceof GuiWirelessCraftingTerminal && draggedStack != null && draggedStack.getItem() != null) { if (gui instanceof GuiWirelessCraftingTerminal && draggedStack != null && draggedStack.getItem() != null) {
GuiWirelessCraftingTerminal gmm = (GuiWirelessCraftingTerminal) gui; GuiWirelessCraftingTerminal gmm = (GuiWirelessCraftingTerminal) gui;
if (gmm.isOverSearchField(mousex, mousey)) { if (gmm.isOverSearchField(mousex, mousey)) {
gmm.setSearchString(SPECIAL_REGEX_CHARS gmm.setSearchString(SPECIAL_REGEX_CHARS.matcher(draggedStack.getDisplayName()).replaceAll("\\\\$0"));
.matcher(draggedStack.getDisplayName())
.replaceAll("\\\\$0"));
return true; return true;
} }
} }
@@ -5,6 +5,7 @@ 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,8 +1,9 @@
package net.p455w0rd.wirelesscraftingterminal.integration.modules.helpers; package net.p455w0rd.wirelesscraftingterminal.integration.modules.helpers;
import cofh.api.energy.IEnergyReceiver;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import cofh.api.energy.IEnergyReceiver;
public class NullRFHandler implements IEnergyReceiver { public class NullRFHandler implements IEnergyReceiver {
@Override @Override
@@ -1,12 +1,13 @@
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;
@@ -22,8 +23,7 @@ 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( boosterIcon[0] = register.registerIcon(Reference.MODID + ":" + this.getUnlocalizedName().substring(5));
Reference.MODID + ":" + this.getUnlocalizedName().substring(5));
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@@ -4,6 +4,7 @@ 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,18 +1,22 @@
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;
@@ -39,14 +43,13 @@ 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() String shift = LocaleHandler.PressShift.getLocal().replace(
.replace( "Shift",
"Shift", color("yellow") + "" + color("bold") + "" + color("italics") + "Shift" + color("gray"));
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,22 +1,9 @@
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;
@@ -38,12 +25,28 @@ import net.p455w0rd.wirelesscraftingterminal.handlers.KeybindHandler;
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler; import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject; 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 * Jotato's amazing magnet item from QuantumFlux adapted for use in the Wireless Crafting Terminal
* Crafting Terminal
* *
* @author p455w0rd, Jotato * @author p455w0rd, Jotato
* *
@@ -111,22 +114,31 @@ 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(color("italics") + LocaleHandler.OrPress.getLocal() + " " + color("yellow") + color("bold") list.add(
+ "[" + boundKey + "]"); color("italics") + LocaleHandler.OrPress
.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(color("italics") + LocaleHandler.Press.getLocal() + " " + color("yellow") + color("bold") list.add(
+ "[" + boundKey2 + "] " + color("gray") + color("italics") color("italics") + LocaleHandler.Press.getLocal()
+ LocaleHandler.ToSwitchMode.getLocal()); + " "
+ color("yellow")
+ color("bold")
+ "["
+ boundKey2
+ "] "
+ color("gray")
+ color("italics")
+ LocaleHandler.ToSwitchMode.getLocal());
} }
} }
list.add(""); list.add("");
list.add(LocaleHandler.Status.getLocal() + ": " list.add(
+ (isActivated(is) LocaleHandler.Status.getLocal() + ": "
? color("green") + LocaleHandler.Active.getLocal() + (isActivated(is) ? 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) {
@@ -229,13 +241,12 @@ 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) distanceFromPlayer).iterator();
.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())) {
@@ -262,13 +273,12 @@ 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) distanceFromPlayer).iterator();
.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()) {
@@ -288,8 +298,8 @@ public class ItemMagnet extends Item {
} }
} }
public void doVanillaPickup( public void doVanillaPickup(EntityItem itemToGet, EntityPlayer player, ItemStack itemStackToGet, World world,
EntityItem itemToGet, EntityPlayer player, ItemStack itemStackToGet, World world, int stackSize) { int stackSize) {
if (pickupTimer < 100) { if (pickupTimer < 100) {
pickupTimer++; pickupTimer++;
return; return;
@@ -363,8 +373,7 @@ 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) if (isMetaEqual(is, thisStack) && ItemStack.areItemStackTagsEqual(is, thisStack)
&& ItemStack.areItemStackTagsEqual(is, thisStack)
&& is.getItem() == thisStack.getItem()) { && is.getItem() == thisStack.getItem()) {
return true; return true;
} }
@@ -378,8 +387,8 @@ public class ItemMagnet extends Item {
return is1.getItemDamage() == is2.getItemDamage(); return is1.getItemDamage() == is2.getItemDamage();
} }
public boolean hasNetworkAccess( public boolean hasNetworkAccess(final SecurityPermissions perm, final boolean requirePower, EntityPlayer player,
final SecurityPermissions perm, final boolean requirePower, EntityPlayer player, ItemStack wirelessTerm) { ItemStack wirelessTerm) {
if (player.capabilities.isCreativeMode) { if (player.capabilities.isCreativeMode) {
return true; return true;
} }
@@ -423,13 +432,8 @@ public class ItemMagnet extends Item {
return null; return null;
} }
public boolean doInject( public boolean doInject(IAEItemStack ais, int stackSize, EntityPlayer player, EntityItem itemToGet,
IAEItemStack ais, ItemStack itemStackToGet, World world) {
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);
@@ -475,12 +479,17 @@ public class ItemMagnet extends Item {
return true; return true;
} }
public static List<? extends Entity> getEntitiesInRange( public static List<? extends Entity> getEntitiesInRange(Class<?> entityType, World world, int x, int y, int z,
Class<?> entityType, World world, int x, int y, int z, int distance) { int distance) {
return world.getEntitiesWithinAABB( return world.getEntitiesWithinAABB(
entityType, entityType,
AxisAlignedBB.getBoundingBox( AxisAlignedBB.getBoundingBox(
x - distance, y - distance, z - distance, x + distance, y + distance, z + distance)); x - distance,
y - distance,
z - distance,
x + distance,
y + distance,
z + distance));
} }
public ItemStack getStack() { public ItemStack getStack() {
@@ -1,19 +1,7 @@
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;
@@ -31,8 +19,24 @@ 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.*;
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 cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemWirelessCraftingTerminal extends AERootPoweredItem public class ItemWirelessCraftingTerminal extends AERootPoweredItem
implements IWirelessCraftingTerminalItem, IWirelessTermHandler, IBauble { implements IWirelessCraftingTerminalItem, IWirelessTermHandler, IBauble {
@@ -80,8 +84,7 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
} }
/** /**
* This method return the type of bauble this is. * This method return the type of bauble this is. Type is used to determine the slots it can go into.
* Type is used to determine the slots it can go into.
* *
* @param itemstack * @param itemstack
*/ */
@@ -234,8 +237,7 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
final ConfigManager out = new ConfigManager(new IConfigManagerHost() { final ConfigManager out = new ConfigManager(new IConfigManagerHost() {
@Override @Override
public void updateSetting( public void updateSetting(final IConfigManager manager,
final IConfigManager manager,
@SuppressWarnings("rawtypes") final Enum settingName, @SuppressWarnings("rawtypes") final Enum settingName,
@SuppressWarnings("rawtypes") final Enum newValue) { @SuppressWarnings("rawtypes") final Enum newValue) {
final NBTTagCompound data = Platform.openNbtData(target); final NBTTagCompound data = Platform.openNbtData(target);
@@ -251,7 +253,7 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
return out; return out;
} }
@SuppressWarnings({"unchecked", "rawtypes"}) @SuppressWarnings({ "unchecked", "rawtypes" })
@Override @Override
public void getCheckedSubItems(Item item, CreativeTabs creativeTab, List itemList) { public void getCheckedSubItems(Item item, CreativeTabs creativeTab, List itemList) {
List itemList2 = itemList; List itemList2 = itemList;
@@ -271,14 +273,13 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
return true; return true;
} }
@SuppressWarnings({"rawtypes", "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(
.replace( "Shift",
"Shift", color("yellow") + "" + color("bold") + "" + color("italics") + "Shift" + color("gray"));
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");
@@ -292,19 +293,22 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
pctTxtColor = color("red") + ""; pctTxtColor = color("red") + "";
} }
list.add(color("aqua") + "=============================="); list.add(color("aqua") + "==============================");
list.add(StatCollector.translateToLocal("gui.appliedenergistics2.StoredEnergy") + ": " + pctTxtColor list.add(
+ (int) aeCurrPower + " AE - " + aeCurrPowerPct + "%"); StatCollector.translateToLocal("gui.appliedenergistics2.StoredEnergy") + ": "
+ 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) String boosterStatus = (checkForBooster(is) ? color("green") + "" + LocaleHandler.Installed.getLocal()
? color("green") + "" + LocaleHandler.Installed.getLocal()
: color("red") + "" + LocaleHandler.NotInstalled.getLocal()); : color("red") + "" + LocaleHandler.NotInstalled.getLocal());
String magnetStatus = (isMagnetInstalled(is) String magnetStatus = (isMagnetInstalled(is) ? color("green") + "" + LocaleHandler.Installed.getLocal()
? color("green") + "" + LocaleHandler.Installed.getLocal()
: color("red") + "" + LocaleHandler.NotInstalled.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);
@@ -457,7 +461,8 @@ 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, injectAEPower(container, PowerUnits.RF.convertTo(PowerUnits.AE, maxReceive))); PowerUnits.RF,
injectAEPower(container, PowerUnits.RF.convertTo(PowerUnits.AE, maxReceive)));
return maxReceive - leftOver; return maxReceive - leftOver;
} else { } else {
return 0; return 0;
@@ -478,7 +483,8 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
} }
} else { } else {
return (int) PowerUnits.AE.convertTo( return (int) PowerUnits.AE.convertTo(
PowerUnits.RF, extractAEPower(container, PowerUnits.RF.convertTo(PowerUnits.AE, maxExtract))); PowerUnits.RF,
extractAEPower(container, PowerUnits.RF.convertTo(PowerUnits.AE, maxExtract)));
} }
} }
@@ -1,12 +1,13 @@
package net.p455w0rd.wirelesscraftingterminal.proxy; package net.p455w0rd.wirelesscraftingterminal.proxy;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.p455w0rd.wirelesscraftingterminal.handlers.KeybindHandler; import net.p455w0rd.wirelesscraftingterminal.handlers.KeybindHandler;
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum; import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
public class ClientProxy extends CommonProxy { public class ClientProxy extends CommonProxy {
public ClientProxy() { public ClientProxy() {
@@ -1,18 +1,8 @@
package net.p455w0rd.wirelesscraftingterminal.proxy; package net.p455w0rd.wirelesscraftingterminal.proxy;
import appeng.api.AEApi;
import appeng.api.config.SecurityPermissions;
import appeng.api.storage.data.IAEItemStack;
import baubles.api.BaublesApi;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import net.minecraft.entity.boss.EntityDragon; import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither; import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
@@ -42,6 +32,18 @@ import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet; import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference; import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.AEApi;
import appeng.api.config.SecurityPermissions;
import appeng.api.storage.data.IAEItemStack;
import baubles.api.BaublesApi;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
public class CommonProxy { public class CommonProxy {
Achievement wctAch = AchievementHandler.wctAch; Achievement wctAch = AchievementHandler.wctAch;
@@ -137,14 +139,11 @@ public class CommonProxy {
ConfigHandler.reloadRecipes(); ConfigHandler.reloadRecipes();
} }
/* NH fork definitely does not need version checking /*
if ((Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment")) { * NH fork definitely does not need version checking if ((Boolean)
WCTLog.info("Dev environment detected, skipping version check"); * Launch.blackboard.get("fml.deobfuscatedEnvironment")) {
} * WCTLog.info("Dev environment detected, skipping version check"); } else { new VersionCheckHandler(); }
else { */
new VersionCheckHandler();
}
*/
} else { } else {
final PacketConfigSync p = new PacketConfigSync( final PacketConfigSync p = new PacketConfigSync(
Reference.WCT_MAX_POWER, Reference.WCT_MAX_POWER,
@@ -161,7 +160,11 @@ public class CommonProxy {
if (!Reference.WCT_EASYMODE_ENABLED && Reference.WCT_BOOSTER_ENABLED && Reference.WCT_BOOSTERDROP_ENABLED) { if (!Reference.WCT_EASYMODE_ENABLED && Reference.WCT_BOOSTER_ENABLED && Reference.WCT_BOOSTERDROP_ENABLED) {
ItemStack stack = new ItemStack(ItemEnum.BOOSTER_CARD.getItem()); ItemStack stack = new ItemStack(ItemEnum.BOOSTER_CARD.getItem());
EntityItem drop = new EntityItem( EntityItem drop = new EntityItem(
event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, stack); event.entity.worldObj,
event.entity.posX,
event.entity.posY,
event.entity.posZ,
stack);
if (event.entity instanceof EntityDragon) { if (event.entity instanceof EntityDragon) {
event.drops.add(drop); event.drops.add(drop);
} }
@@ -202,7 +205,12 @@ public class CommonProxy {
ItemMagnet magnet = (ItemMagnet) magnetStack.getItem(); ItemMagnet magnet = (ItemMagnet) magnetStack.getItem();
magnet.obj = ContainerWirelessCraftingTerminal.getGuiObject( magnet.obj = ContainerWirelessCraftingTerminal.getGuiObject(
WCTStack, player, world, (int) player.posX, (int) player.posY, (int) player.posZ); WCTStack,
player,
world,
(int) player.posX,
(int) player.posY,
(int) player.posZ);
magnet.civ = magnet.obj; magnet.civ = magnet.obj;
magnet.powerSrc = magnet.civ; magnet.powerSrc = magnet.civ;
magnet.monitor = magnet.civ.getItemInventory(); magnet.monitor = magnet.civ.getItemInventory();
@@ -216,8 +224,7 @@ public class CommonProxy {
List<ItemStack> filteredList = magnet.getFilteredItems(magnetStack); List<ItemStack> filteredList = magnet.getFilteredItems(magnetStack);
IAEItemStack ais = AEApi.instance().storage().createItemStack(stack); IAEItemStack ais = AEApi.instance().storage().createItemStack(stack);
if (magnet.getMode(magnetStack)) { // whitelisting if (magnet.getMode(magnetStack)) { // whitelisting
if (filteredList != null if (filteredList != null && magnet.isItemFiltered(stack, filteredList)
&& magnet.isItemFiltered(stack, filteredList)
&& filteredList.size() > 0) { && filteredList.size() > 0) {
if (magnet.doInject(ais, stack.stackSize, player, itemEntity, stack, world)) { if (magnet.doInject(ais, stack.stackSize, player, itemEntity, stack, world)) {
stack = null; stack = null;
@@ -234,16 +241,14 @@ public class CommonProxy {
"random.pop", "random.pop",
0.15F, 0.15F,
((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F
+ 1.0F) + 1.0F) * 2.0F);
* 2.0F);
} }
} else { } else {
magnet.doVanillaPickup(itemEntity, player, stack, world, stack.stackSize); magnet.doVanillaPickup(itemEntity, player, stack, world, stack.stackSize);
} }
} }
} else { // blacklisting } else { // blacklisting
if (!magnet.isItemFiltered(stack, filteredList) if (!magnet.isItemFiltered(stack, filteredList) || filteredList == null
|| filteredList == null
|| filteredList.size() <= 0) { || filteredList.size() <= 0) {
if (magnet.doInject(ais, stack.stackSize, player, itemEntity, stack, world)) { if (magnet.doInject(ais, stack.stackSize, player, itemEntity, stack, world)) {
stack = null; stack = null;
@@ -261,8 +266,7 @@ public class CommonProxy {
"random.pop", "random.pop",
0.15F, 0.15F,
((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F
+ 1.0F) + 1.0F) * 2.0F);
* 2.0F);
} }
} else { } else {
magnet.doVanillaPickup(itemEntity, player, stack, world, stack.stackSize); magnet.doVanillaPickup(itemEntity, player, stack, world, stack.stackSize);
@@ -283,8 +287,7 @@ public class CommonProxy {
@SubscribeEvent @SubscribeEvent
public void onPlayerCraftingEvent(final PlayerEvent.ItemCraftedEvent event) { public void onPlayerCraftingEvent(final PlayerEvent.ItemCraftedEvent event) {
if (event.player == null if (event.player == null || event.player.isDead
|| event.player.isDead
|| event.player instanceof FakePlayer || event.player instanceof FakePlayer
|| event.crafting == null) { || event.crafting == null) {
return; return;
@@ -302,12 +305,9 @@ public class CommonProxy {
} }
/* /*
* if (event.crafting.getItem() == * if (event.crafting.getItem() == ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem()) {
* ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem()) { * AchievementHandler.triggerAch(wctAch, event.player); if (Reference.WCT_BOOSTER_ENABLED) {
* AchievementHandler.triggerAch(wctAch, event.player); if * AchievementHandler.addAchievementToPage(AchievementHandler. boosterAch, true, event.player); } }
* (Reference.WCT_BOOSTER_ENABLED) {
* AchievementHandler.addAchievementToPage(AchievementHandler.
* boosterAch, true, event.player); } }
*/ */
if (Reference.WCT_BOOSTER_ENABLED && Reference.WCT_EASYMODE_ENABLED) { if (Reference.WCT_BOOSTER_ENABLED && Reference.WCT_EASYMODE_ENABLED) {
if (event.crafting.getItem() == ItemEnum.BOOSTER_CARD.getItem()) { if (event.crafting.getItem() == ItemEnum.BOOSTER_CARD.getItem()) {
@@ -1,14 +1,14 @@
package net.p455w0rd.wirelesscraftingterminal.reference; package net.p455w0rd.wirelesscraftingterminal.reference;
public class Reference { public class Reference {
public static final String MODID = "ae2wct"; public static final String MODID = "ae2wct";
public static final String VERSION = "GRADLETOKEN_VERSION"; public static final String VERSION = "GRADLETOKEN_VERSION";
public static final String NAME = "AE2 Wireless Crafting Terminal"; public static final String NAME = "AE2 Wireless Crafting Terminal";
public static final String SERVER_PROXY_CLASS = "net.p455w0rd.wirelesscraftingterminal.proxy.CommonProxy"; public static final String SERVER_PROXY_CLASS = "net.p455w0rd.wirelesscraftingterminal.proxy.CommonProxy";
public static final String CLIENT_PROXY_CLASS = "net.p455w0rd.wirelesscraftingterminal.proxy.ClientProxy"; public static final String CLIENT_PROXY_CLASS = "net.p455w0rd.wirelesscraftingterminal.proxy.ClientProxy";
public static final String GUI_FACTORY = "net.p455w0rd.wirelesscraftingterminal.client.gui.GuiFactory"; public static final String GUI_FACTORY = "net.p455w0rd.wirelesscraftingterminal.client.gui.GuiFactory";
public static final String CREDITS_LIST = public static final String CREDITS_LIST = "brandon3055, Techjar, AlgorythmX2, thatsIch, Nividica, squeek502, M3gaFr3ak, DrummerMC, cpw, LexManos, Pahimar, diesieben07, Wuppy, Jabelar, blay09, SirSengir, mezz, jotato";
"brandon3055, Techjar, AlgorythmX2, thatsIch, Nividica, squeek502, M3gaFr3ak, DrummerMC, cpw, LexManos, Pahimar, diesieben07, Wuppy, Jabelar, blay09, SirSengir, mezz, jotato";
public static final String CONFIG_FILE = "WirelessCraftingTerminal.cfg"; public static final String CONFIG_FILE = "WirelessCraftingTerminal.cfg";
public static boolean WCT_DIDTHEDIDDLE = false; public static boolean WCT_DIDTHEDIDDLE = false;
public static int WCT_MAX_POWER = 1600000; public static int WCT_MAX_POWER = 1600000;