Compare commits

...
8 Commits
Author SHA1 Message Date
bombcar 28859a3f6e [bs] spotless apply for jenkins (#11)
* spotless apply for jenkins

* remove *
2024-01-09 15:27:38 -06:00
Raven Szewczyk 58b41c6bb5 [ci skip] upgraded build system 2024-01-08 21:25:38 +00:00
glowredman f6eb09de3a Remove hard-dependency on GregTech (#10)
* Update buildscript

* Make GregTech a soft-dependency

* Small cleanup
2023-03-25 14:45:43 +01:00
Raven Szewczyk f31f2e3adf [ci skip] upgraded build system 2023-01-31 09:52:43 +00:00
Jason Mitchell 1bf51f5a48 [ci skip] Add git-blame-ignore-revs for spotlessApply 2023-01-29 12:45:21 -08:00
Jason Mitchell f2dc81704a [ci skip] spotlessApply with the new settings 2023-01-29 12:45:21 -08:00
Jason Mitchell 0e2d9e02a4 [ci skip] Update buildscript to RetroFuturaGradle 2023-01-29 12:44:20 -08:00
miozune 1f4c5b0058 Fix inventory slots not being highlighted (#9) 2022-09-01 16:07:31 +02:00
30 changed files with 1871 additions and 771 deletions

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
# Ignore spotlessApply reformat
f2dc81704a965d1f2ada7500842bc904f0ca7ddc
+44
View File
@@ -0,0 +1,44 @@
* text eol=lf
*.[jJ][aA][rR] binary
*.[pP][nN][gG] binary
*.[jJ][pP][gG] binary
*.[jJ][pP][eE][gG] binary
*.[gG][iI][fF] binary
*.[tT][iI][fF] binary
*.[tT][iI][fF][fF] binary
*.[iI][cC][oO] binary
*.[sS][vV][gG] text
*.[eE][pP][sS] binary
*.[xX][cC][fF] binary
*.[kK][aA][rR] binary
*.[mM]4[aA] binary
*.[mM][iI][dD] binary
*.[mM][iI][dD][iI] binary
*.[mM][pP]3 binary
*.[oO][gG][gG] binary
*.[rR][aA] binary
*.7[zZ] binary
*.[gG][zZ] binary
*.[tT][aA][rR] binary
*.[tT][gG][zZ] binary
*.[zZ][iI][pP] binary
*.[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
*.[pP][aA][tT][cC][hH] -text
*.[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
+1310 -427
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -1,6 +1,6 @@
// Add your dependencies here // Add your dependencies here
dependencies { dependencies {
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.27-GTNH:dev') implementation('com.github.GTNewHorizons:NotEnoughItems:2.5.3-GTNH:dev')
compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.33:dev') compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.23:dev')
} }
+84 -9
View File
@@ -3,7 +3,7 @@ modName = FindIt
# This is a case-sensitive string to identify your mod. Convention is to use lower case. # This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = findit modId = findit
modGroup = com.gtnh modGroup = com.gtnh.findit
# WHY is there no version field? # WHY is there no version field?
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the # The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
@@ -15,22 +15,40 @@ autoUpdateBuildScript = false
minecraftVersion = 1.7.10 minecraftVersion = 1.7.10
forgeVersion = 10.13.4.1614 forgeVersion = 10.13.4.1614
# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task.
channel = stable
mappingsVersion = 12
# Define other MCP mappings for dependency deobfuscation
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you # Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
# restart Minecraft in development. Choose this dependent on your mod: # restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name # Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty # Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = Developer developmentEnvironmentUserName = Developer
# Define a source file of your project with: # Enables using modern java syntax (up to version 17) via Jabel, while still targetting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = true
# Enables injecting missing generics into the decompiled source code for a better coding experience
# Turns most publically visible List, Map, etc. into proper List<Type>, Map<K, V> types
enableGenericInjection = false
# Generate a class with String fields for the mod id, name, version and group name named with the fields below
generateGradleTokenClass = com.gtnh.findit.Tags
gradleTokenModId =
gradleTokenModName =
gradleTokenVersion = VERSION
gradleTokenGroupName =
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-seperated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION"; # public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's # The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...]) # version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements # Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = FindIt.java replaceGradleTokenInFile =
gradleTokenModId = GRADLETOKEN_MODID
gradleTokenModName = GRADLETOKEN_MODNAME
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can # In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty. # leave this property empty.
@@ -43,6 +61,8 @@ accessTransformersFile = findit_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! # Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false usesMixins = false
# Adds some debug arguments like verbose output and export
usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. # Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin = mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! # Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
@@ -55,13 +75,68 @@ coreModClass =
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false! # that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false containsMixinsAndOrCoreModOnly = false
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your # If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required. # responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies = false usesShadowedDependencies = false
# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories
includeWellKnownRepositories = true
# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token.
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish on Modrinth.
modrinthProjectId =
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;...
# Where scope can be one of [required, optional, incompatible, embedded],
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
curseForgeRelations =
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older # Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# projects. New projects should not use this parameter. # projects. New projects should not use this parameter.
#customArchiveBaseName = # customArchiveBaseName =
# Optional parameter to prevent the source code from being published # Optional parameter to prevent the source code from being published
# noPublishedSources = # noPublishedSources =
# Uncomment this to disable spotless checks
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
# disableSpotless = true
# Override the IDEA build type. Valid value is "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
# (force use delegated build).
# This is meant to be set in $HOME/.gradle/gradle.properties.
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be always native build.
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
# ideaOverrideBuildType = idea
Binary file not shown.
+3 -1
View File
@@ -1,5 +1,7 @@
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.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
Vendored
+178 -117
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,111 @@
# #
############################################################################## ##############################################################################
## #
## 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 # Resolve links: $0 may be a link
PRG="$0" app_path=$0
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do # Need this for daisy-chained symlinks.
ls=`ls -ld "$PRG"` while
link=`expr "$ls" : '.*-> \(.*\)$'` APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
if expr "$link" : '/.*' > /dev/null; then [ -h "$app_path" ]
PRG="$link" do
else ls=$( ls -ld "$app_path" )
PRG=`dirname "$PRG"`"/$link" link=${ls#*' -> '}
fi case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle" # This is normally unused
APP_BASE_NAME=`basename "$0"` # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# 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,92 +130,120 @@ 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. if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "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=SC2039,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=SC2039,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
# 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"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-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
-18
View File
@@ -1,22 +1,4 @@
// Add any additional repositories for your dependencies here // Add any additional repositories for your dependencies here
repositories { repositories {
maven {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
maven {
name = "ic2"
url = "https://maven.ic2.player.to/"
metadataSources {
mavenPom()
artifact()
}
}
maven {
url "https://cursemaven.com"
}
maven {
url = "https://jitpack.io"
}
} }
+27
View File
@@ -0,0 +1,27 @@
pluginManagement {
repositories {
maven {
// RetroFuturaGradle
name "GTNH Maven"
url "https://nexus.gtnewhorizons.com/repository/public/"
mavenContent {
includeGroupByRegex("com\\.gtnewhorizons\\..+")
}
}
gradlePluginPortal()
mavenCentral()
mavenLocal()
}
}
plugins {
id 'com.diffplug.blowdryerSetup' version '1.7.1'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' // Provides java toolchains
}
blowdryerSetup {
repoSubfolder 'gtnhShared'
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
//devLocal '.' // Use this when testing config updates locally
}
+17 -21
View File
@@ -1,14 +1,13 @@
package com.gtnh.findit; package com.gtnh.findit;
import codechicken.nei.guihook.GuiContainerManager;
import com.gtnh.findit.service.blockfinder.BlockFindService; import com.gtnh.findit.service.blockfinder.BlockFindService;
import com.gtnh.findit.service.blockfinder.ClientBlockFindService; import com.gtnh.findit.service.blockfinder.ClientBlockFindService;
import com.gtnh.findit.service.cooldown.SearchCooldownService; import com.gtnh.findit.service.cooldown.SearchCooldownService;
import com.gtnh.findit.service.itemfinder.ClientItemFindService; import com.gtnh.findit.service.itemfinder.ClientItemFindService;
import com.gtnh.findit.service.itemfinder.ItemFindService; import com.gtnh.findit.service.itemfinder.ItemFindService;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -16,20 +15,21 @@ import cpw.mods.fml.relauncher.Side;
modid = FindIt.MOD_ID, modid = FindIt.MOD_ID,
name = FindIt.MOD_NAME, name = FindIt.MOD_NAME,
version = FindIt.VERSION, version = FindIt.VERSION,
dependencies = "required-after:NotEnoughItems;required-after:gregtech", dependencies = "required-after:NotEnoughItems;after:gregtech",
acceptableRemoteVersions = "*" acceptableRemoteVersions = "*",
) acceptedMinecraftVersions = "[1.7.10]")
public class FindIt { public class FindIt {
// Mod info // Mod info
public static final String MOD_ID = "GRADLETOKEN_MODID"; public static final String MOD_ID = "findit";
public static final String MOD_NAME = "GRADLETOKEN_MODNAME"; public static final String MOD_NAME = "FindIt";
public static final String VERSION = "GRADLETOKEN_VERSION"; public static final String VERSION = Tags.VERSION;
@Mod.Instance(MOD_ID) @Mod.Instance(MOD_ID)
public static FindIt INSTANCE; public static FindIt INSTANCE;
private boolean extraUtilitiesLoaded; private boolean extraUtilitiesLoaded;
private boolean gregTechloaded;
private SearchCooldownService cooldownService; private SearchCooldownService cooldownService;
private BlockFindService blockFindService; private BlockFindService blockFindService;
@@ -37,22 +37,14 @@ public class FindIt {
@Mod.EventHandler @Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) { public void preInit(FMLPreInitializationEvent event) {
extraUtilitiesLoaded = Loader.isModLoaded("ExtraUtilities"); this.extraUtilitiesLoaded = Loader.isModLoaded("ExtraUtilities");
this.gregTechloaded = Loader.isModLoaded("gregtech");
FindItConfig.setup(event.getSuggestedConfigurationFile()); FindItConfig.setup(event.getSuggestedConfigurationFile());
boolean isClient = event.getSide() == Side.CLIENT; boolean isClient = event.getSide() == Side.CLIENT;
cooldownService = new SearchCooldownService(); this.cooldownService = new SearchCooldownService();
blockFindService = isClient ? new ClientBlockFindService() : new BlockFindService(); this.blockFindService = isClient ? new ClientBlockFindService() : new BlockFindService();
itemFindService = isClient ? new ClientItemFindService() : new ItemFindService(); this.itemFindService = isClient ? new ClientItemFindService() : new ItemFindService();
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
if (event.getSide() == Side.CLIENT && FindIt.isExtraUtilitiesLoaded()) {
GuiContainerManager.inputHandlers.removeIf((inputHandler) ->
inputHandler.getClass().getName().equals("com.rwtema.extrautils.nei.ping.NEIPing")
);
}
} }
public static SearchCooldownService getCooldownService() { public static SearchCooldownService getCooldownService() {
@@ -70,4 +62,8 @@ public class FindIt {
public static boolean isExtraUtilitiesLoaded() { public static boolean isExtraUtilitiesLoaded() {
return INSTANCE.extraUtilitiesLoaded; return INSTANCE.extraUtilitiesLoaded;
} }
public static boolean isGregTechLoaded() {
return INSTANCE.gregTechloaded;
}
} }
@@ -1,9 +1,9 @@
package com.gtnh.findit; package com.gtnh.findit;
import net.minecraftforge.common.config.Configuration;
import java.io.File; import java.io.File;
import net.minecraftforge.common.config.Configuration;
public class FindItConfig { public class FindItConfig {
public static int SEARCH_RADIUS = 16; public static int SEARCH_RADIUS = 16;
@@ -15,28 +15,18 @@ public class FindItConfig {
try { try {
config.load(); config.load();
SEARCH_RADIUS = config.get( SEARCH_RADIUS = config.get(Configuration.CATEGORY_GENERAL, "SearchRadius", "16", "Radius to search within")
Configuration.CATEGORY_GENERAL, .getInt();
"SearchRadius",
"16",
"Radius to search within"
).getInt();
SEARCH_COOLDOWN = config.get( SEARCH_COOLDOWN = config
Configuration.CATEGORY_GENERAL, .get(Configuration.CATEGORY_GENERAL, "SearchCooldown", "10", "Search cooldown in ticks").getInt();
"SearchCooldown",
"10",
"Search cooldown in ticks"
).getInt();
MAX_RESPONSE_SIZE = config.get( MAX_RESPONSE_SIZE = config.get(
Configuration.CATEGORY_GENERAL, Configuration.CATEGORY_GENERAL,
"MaxResponseSize", "MaxResponseSize",
"20", "20",
"Maximum number of positions that can be displayed by item/block search" "Maximum number of positions that can be displayed by item/block search").getInt();
).getInt(); } catch (Exception ignore) {} finally {
} catch (Exception ignore) {
} finally {
if (config.hasChanged()) config.save(); if (config.hasChanged()) config.save();
} }
} }
@@ -11,7 +11,8 @@ public class FindItNetwork {
private static int lastMessageId = -1; private static int lastMessageId = -1;
public static final SimpleNetworkWrapper CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(FindIt.MOD_ID); public static final SimpleNetworkWrapper CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(FindIt.MOD_ID);
public static <REQ extends IMessage, REPLY extends IMessage> void registerMessage(Class<? extends IMessageHandler<REQ, REPLY>> messageHandler, Class<REQ> requestMessageType, Side side) { public static <REQ extends IMessage, REPLY extends IMessage> void registerMessage(
Class<? extends IMessageHandler<REQ, REPLY>> messageHandler, Class<REQ> requestMessageType, Side side) {
CHANNEL.registerMessage(messageHandler, requestMessageType, ++lastMessageId, side); CHANNEL.registerMessage(messageHandler, requestMessageType, ++lastMessageId, side);
} }
} }
@@ -1,13 +1,14 @@
package com.gtnh.findit.fx; package com.gtnh.findit.fx;
import java.util.List;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityReddustFX; import net.minecraft.client.particle.EntityReddustFX;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.ChunkPosition; import net.minecraft.world.ChunkPosition;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import java.util.List; import org.lwjgl.opengl.GL11;
public class ParticlePosition extends EntityReddustFX { public class ParticlePosition extends EntityReddustFX {
@@ -20,8 +21,7 @@ public class ParticlePosition extends EntityReddustFX {
world, world,
pos.chunkPosX + (0.5 + (world.rand.nextDouble() - 0.5) * world.rand.nextDouble()), pos.chunkPosX + (0.5 + (world.rand.nextDouble() - 0.5) * world.rand.nextDouble()),
pos.chunkPosY + (0.5 + (world.rand.nextDouble() - 0.5) * world.rand.nextDouble()), pos.chunkPosY + (0.5 + (world.rand.nextDouble() - 0.5) * world.rand.nextDouble()),
pos.chunkPosZ + (0.5 + (world.rand.nextDouble() - 0.5) * world.rand.nextDouble()) pos.chunkPosZ + (0.5 + (world.rand.nextDouble() - 0.5) * world.rand.nextDouble()));
);
version = validVersion; version = validVersion;
} }
@@ -45,7 +45,8 @@ public class ParticlePosition extends EntityReddustFX {
} }
@Override @Override
public void renderParticle(final Tessellator tessellator, float partialTickTime, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { public void renderParticle(final Tessellator tessellator, float partialTickTime, float rotationX, float rotationZ,
float rotationYZ, float rotationXY, float rotationXZ) {
tessellator.draw(); tessellator.draw();
GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_DEPTH_TEST);
@@ -1,19 +1,23 @@
package com.gtnh.findit.fx; package com.gtnh.findit.fx;
import com.gtnh.findit.FindIt; import java.util.List;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import java.util.List; import com.gtnh.findit.FindIt;
public class SlotHighlighter { public class SlotHighlighter {
private static final ResourceLocation highlightTexture = new ResourceLocation(FindIt.MOD_ID, "textures/gui/slot_highlight.png"); private static final ResourceLocation highlightTexture = new ResourceLocation(
FindIt.MOD_ID,
"textures/gui/slot_highlight.png");
public static void highlightSlots(GuiContainer gui, List<Integer> slots, int color) { public static void highlightSlots(GuiContainer gui, List<Integer> slots, int color) {
if (slots.isEmpty()) { if (slots.isEmpty()) {
@@ -1,25 +1,28 @@
package com.gtnh.findit.service.blockfinder; package com.gtnh.findit.service.blockfinder;
import com.gtnh.findit.FindIt; import java.util.ArrayList;
import com.gtnh.findit.FindItConfig; import java.util.List;
import com.gtnh.findit.FindItNetwork;
import com.gtnh.findit.util.WorldUtils;
import cpw.mods.fml.relauncher.Side;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.ChunkPosition; import net.minecraft.world.ChunkPosition;
import java.util.ArrayList; import com.gtnh.findit.FindIt;
import java.util.List; import com.gtnh.findit.FindItConfig;
import com.gtnh.findit.FindItNetwork;
import com.gtnh.findit.util.WorldUtils;
import cpw.mods.fml.relauncher.Side;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
public class BlockFindService { public class BlockFindService {
public BlockFindService() { public BlockFindService() {
FindItNetwork.registerMessage(FindBlockRequest.Handler.class, FindBlockRequest.class, Side.SERVER); FindItNetwork.registerMessage(FindBlockRequest.Handler.class, FindBlockRequest.class, Side.SERVER);
FindItNetwork.registerMessage(BlockFoundResponse.Handler.class, BlockFoundResponse.class, Side.CLIENT); FindItNetwork.registerMessage(BlockFoundResponse.Handler.class, BlockFoundResponse.class, Side.CLIENT);
} }
public void handleRequest(EntityPlayerMP player, FindBlockRequest request) { public void handleRequest(EntityPlayerMP player, FindBlockRequest request) {
if (FindIt.getCooldownService().checkSearchCooldown(player)) { if (FindIt.getCooldownService().checkSearchCooldown(player)) {
return; return;
@@ -34,7 +37,7 @@ public class BlockFindService {
} }
int tileMeta; int tileMeta;
if (tileEntity instanceof IGregTechTileEntity) { if (FindIt.isGregTechLoaded() && tileEntity instanceof IGregTechTileEntity) {
tileMeta = ((IGregTechTileEntity) tileEntity).getMetaTileID(); tileMeta = ((IGregTechTileEntity) tileEntity).getMetaTileID();
} else { } else {
tileMeta = tileEntity.getBlockMetadata(); tileMeta = tileEntity.getBlockMetadata();
@@ -1,16 +1,18 @@
package com.gtnh.findit.service.blockfinder; package com.gtnh.findit.service.blockfinder;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.world.ChunkPosition;
import com.gtnh.findit.util.ProtoUtils; import com.gtnh.findit.util.ProtoUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.world.ChunkPosition;
import java.util.List;
public class BlockFoundResponse implements IMessage { public class BlockFoundResponse implements IMessage {
@@ -20,8 +22,7 @@ public class BlockFoundResponse implements IMessage {
this.positions = positions; this.positions = positions;
} }
public BlockFoundResponse() { public BlockFoundResponse() {}
}
public List<ChunkPosition> getPositions() { public List<ChunkPosition> getPositions() {
return positions; return positions;
@@ -1,18 +1,20 @@
package com.gtnh.findit.service.blockfinder; package com.gtnh.findit.service.blockfinder;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.api.API;
import codechicken.nei.guihook.GuiContainerManager;
import com.gtnh.findit.FindIt;
import com.gtnh.findit.FindItNetwork;
import com.gtnh.findit.fx.ParticlePosition;
import com.gtnh.findit.util.AbstractStackFinder;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import com.gtnh.findit.FindIt;
import com.gtnh.findit.FindItNetwork;
import com.gtnh.findit.fx.ParticlePosition;
import com.gtnh.findit.util.AbstractStackFinder;
import codechicken.nei.api.API;
import codechicken.nei.guihook.GuiContainerManager;
public class ClientBlockFindService extends BlockFindService { public class ClientBlockFindService extends BlockFindService {
public ClientBlockFindService() { public ClientBlockFindService() {
@@ -47,4 +49,4 @@ public class ClientBlockFindService extends BlockFindService {
public static ClientBlockFindService getInstance() { public static ClientBlockFindService getInstance() {
return (ClientBlockFindService) FindIt.getBlockFindService(); return (ClientBlockFindService) FindIt.getBlockFindService();
} }
} }
@@ -1,12 +1,14 @@
package com.gtnh.findit.service.blockfinder; package com.gtnh.findit.service.blockfinder;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import com.gtnh.findit.FindIt; import com.gtnh.findit.FindIt;
import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
public class FindBlockRequest implements IMessage { public class FindBlockRequest implements IMessage {
@@ -18,8 +20,7 @@ public class FindBlockRequest implements IMessage {
this.metaToFind = meta; this.metaToFind = meta;
} }
public FindBlockRequest() { public FindBlockRequest() {}
}
@Override @Override
public void fromBytes(ByteBuf buf) { public void fromBytes(ByteBuf buf) {
@@ -1,9 +1,10 @@
package com.gtnh.findit.service.cooldown; package com.gtnh.findit.service.cooldown;
import com.gtnh.findit.FindItConfig; import java.util.WeakHashMap;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import java.util.WeakHashMap; import com.gtnh.findit.FindItConfig;
public class SearchCooldownService { public class SearchCooldownService {
@@ -1,16 +1,8 @@
package com.gtnh.findit.service.itemfinder; package com.gtnh.findit.service.itemfinder;
import codechicken.nei.NEIClientUtils; import java.util.ArrayList;
import codechicken.nei.api.API; import java.util.List;
import codechicken.nei.guihook.GuiContainerManager;
import com.gtnh.findit.FindIt;
import com.gtnh.findit.FindItNetwork;
import com.gtnh.findit.fx.ParticlePosition;
import com.gtnh.findit.fx.SlotHighlighter;
import com.gtnh.findit.util.AbstractStackFinder;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
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.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
@@ -22,10 +14,21 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import java.util.ArrayList; import com.gtnh.findit.FindIt;
import java.util.List; import com.gtnh.findit.FindItNetwork;
import com.gtnh.findit.fx.ParticlePosition;
import com.gtnh.findit.fx.SlotHighlighter;
import com.gtnh.findit.util.AbstractStackFinder;
import codechicken.nei.api.API;
import codechicken.nei.event.NEIConfigsLoadedEvent;
import codechicken.nei.guihook.GuiContainerManager;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
public class ClientItemFindService extends ItemFindService { public class ClientItemFindService extends ItemFindService {
@@ -38,6 +41,7 @@ public class ClientItemFindService extends ItemFindService {
GuiContainerManager.addInputHandler(new ItemFindInputHandler()); GuiContainerManager.addInputHandler(new ItemFindInputHandler());
MinecraftForge.EVENT_BUS.register(new GuiListener()); MinecraftForge.EVENT_BUS.register(new GuiListener());
MinecraftForge.EVENT_BUS.register(new NEIEventListener());
FMLCommonHandler.instance().bus().register(new TickListener()); FMLCommonHandler.instance().bus().register(new TickListener());
} }
@@ -49,7 +53,10 @@ public class ClientItemFindService extends ItemFindService {
} }
public void handleSlotHighlight(HighlightSlotsPacket packet) { public void handleSlotHighlight(HighlightSlotsPacket packet) {
highlightData = new ContainerHighlightData(packet.getWindowId(), packet.getTargetStack(), packet.getTargetSlots()); highlightData = new ContainerHighlightData(
packet.getWindowId(),
packet.getTargetStack(),
packet.getTargetSlots());
} }
public class TickListener { public class TickListener {
@@ -109,6 +116,7 @@ public class ClientItemFindService extends ItemFindService {
} }
private static class ContainerHighlightData { private static class ContainerHighlightData {
private final int windowId; private final int windowId;
private final ItemStack targetStack; private final ItemStack targetStack;
private final List<Integer> targetSlots; private final List<Integer> targetSlots;
@@ -123,6 +131,7 @@ public class ClientItemFindService extends ItemFindService {
public void updateHighlightedSlots(GuiContainer gui) { public void updateHighlightedSlots(GuiContainer gui) {
highlightedSlots.clear(); highlightedSlots.clear();
@SuppressWarnings("unchecked")
List<Slot> slots = (List<Slot>) gui.inventorySlots.inventorySlots; List<Slot> slots = (List<Slot>) gui.inventorySlots.inventorySlots;
Item targetItem = targetStack.getItem(); Item targetItem = targetStack.getItem();
int targetMeta = targetStack.getItemDamage(); int targetMeta = targetStack.getItemDamage();
@@ -141,7 +150,19 @@ public class ClientItemFindService extends ItemFindService {
} }
} }
public static class NEIEventListener {
@SubscribeEvent
public void onNEIConfigsLoaded(NEIConfigsLoadedEvent event) {
if (FindIt.isExtraUtilitiesLoaded()) {
GuiContainerManager.inputHandlers.removeIf(
(inputHandler) -> inputHandler.getClass().getName()
.equals("com.rwtema.extrautils.nei.ping.NEIPing"));
}
}
}
public static ClientItemFindService getInstance() { public static ClientItemFindService getInstance() {
return (ClientItemFindService) FindIt.getItemFindService(); return (ClientItemFindService) FindIt.getItemFindService();
} }
} }
@@ -1,13 +1,15 @@
package com.gtnh.findit.service.itemfinder; package com.gtnh.findit.service.itemfinder;
import net.minecraft.item.ItemStack;
import com.gtnh.findit.FindIt; import com.gtnh.findit.FindIt;
import com.gtnh.findit.service.blockfinder.BlockFoundResponse; import com.gtnh.findit.service.blockfinder.BlockFoundResponse;
import com.gtnh.findit.util.ProtoUtils; import com.gtnh.findit.util.ProtoUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack;
public class FindItemRequest implements IMessage { public class FindItemRequest implements IMessage {
@@ -17,8 +19,7 @@ public class FindItemRequest implements IMessage {
this.stack = stack; this.stack = stack;
} }
public FindItemRequest() { public FindItemRequest() {}
}
@Override @Override
public void fromBytes(ByteBuf buf) { public void fromBytes(ByteBuf buf) {
@@ -1,15 +1,17 @@
package com.gtnh.findit.service.itemfinder; package com.gtnh.findit.service.itemfinder;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
import com.gtnh.findit.service.blockfinder.BlockFoundResponse; import com.gtnh.findit.service.blockfinder.BlockFoundResponse;
import com.gtnh.findit.util.ProtoUtils; import com.gtnh.findit.util.ProtoUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.List;
public class HighlightSlotsPacket implements IMessage { public class HighlightSlotsPacket implements IMessage {
@@ -23,8 +25,7 @@ public class HighlightSlotsPacket implements IMessage {
this.targetSlots = targetSlots; this.targetSlots = targetSlots;
} }
public HighlightSlotsPacket() { public HighlightSlotsPacket() {}
}
@Override @Override
public void fromBytes(ByteBuf buf) { public void fromBytes(ByteBuf buf) {
@@ -69,4 +70,4 @@ public class HighlightSlotsPacket implements IMessage {
return null; return null;
} }
} }
} }
@@ -1,11 +1,12 @@
package com.gtnh.findit.service.itemfinder; package com.gtnh.findit.service.itemfinder;
import com.gtnh.findit.FindIt; import java.util.ArrayList;
import com.gtnh.findit.FindItConfig; import java.util.HashMap;
import com.gtnh.findit.FindItNetwork; import java.util.HashSet;
import com.gtnh.findit.util.WorldUtils; import java.util.List;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import java.util.Map;
import cpw.mods.fml.relauncher.Side; import java.util.Set;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
@@ -19,7 +20,13 @@ import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerOpenContainerEvent; import net.minecraftforge.event.entity.player.PlayerOpenContainerEvent;
import java.util.*; import com.gtnh.findit.FindIt;
import com.gtnh.findit.FindItConfig;
import com.gtnh.findit.FindItNetwork;
import com.gtnh.findit.util.WorldUtils;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
public class ItemFindService { public class ItemFindService {
@@ -53,8 +60,7 @@ public class ItemFindService {
List<ChunkPosition> positions = new ArrayList<>(); List<ChunkPosition> positions = new ArrayList<>();
tileIter: tileIter: for (TileEntity tileEntity : WorldUtils.getTileEntitiesAround(player, FindItConfig.SEARCH_RADIUS)) {
for (TileEntity tileEntity : WorldUtils.getTileEntitiesAround(player, FindItConfig.SEARCH_RADIUS)) {
try { try {
if (!(tileEntity instanceof IInventory)) { if (!(tileEntity instanceof IInventory)) {
continue; continue;
@@ -82,9 +88,9 @@ public class ItemFindService {
if (!positions.isEmpty()) { if (!positions.isEmpty()) {
ItemFoundResult foundResult = new ItemFindService.ItemFoundResult( ItemFoundResult foundResult = new ItemFindService.ItemFoundResult(
request.getStackToFind(), positions, request.getStackToFind(),
player.getEntityWorld().getTotalWorldTime() positions,
); player.getEntityWorld().getTotalWorldTime());
lastResults.put(player, foundResult); lastResults.put(player, foundResult);
FindItNetwork.CHANNEL.sendTo(new ItemFoundResponse(request.getStackToFind(), positions), player); FindItNetwork.CHANNEL.sendTo(new ItemFoundResponse(request.getStackToFind(), positions), player);
@@ -100,6 +106,7 @@ public class ItemFindService {
return; return;
} }
@SuppressWarnings("unchecked")
List<Slot> slots = (List<Slot>) container.inventorySlots; List<Slot> slots = (List<Slot>) container.inventorySlots;
List<Integer> targetSlots = new ArrayList<>(); List<Integer> targetSlots = new ArrayList<>();
Set<ChunkPosition> tilePositions = new HashSet<>(); Set<ChunkPosition> tilePositions = new HashSet<>();
@@ -129,15 +136,15 @@ public class ItemFindService {
FindItNetwork.CHANNEL.sendTo( FindItNetwork.CHANNEL.sendTo(
new HighlightSlotsPacket(container.windowId, lastFoundResult.foundStack, targetSlots), new HighlightSlotsPacket(container.windowId, lastFoundResult.foundStack, targetSlots),
player player);
);
} }
} }
private IInventory getSlotTrueInventory(Slot slot) { private IInventory getSlotTrueInventory(Slot slot) {
if (slot.inventory instanceof InventoryLargeChest) { if (slot.inventory instanceof InventoryLargeChest) {
InventoryLargeChest largeChest = (InventoryLargeChest) slot.inventory; InventoryLargeChest largeChest = (InventoryLargeChest) slot.inventory;
return slot.slotNumber < largeChest.upperChest.getSizeInventory() ? largeChest.upperChest : largeChest.lowerChest; return slot.slotNumber < largeChest.upperChest.getSizeInventory() ? largeChest.upperChest
: largeChest.lowerChest;
} }
return slot.inventory; return slot.inventory;
} }
@@ -165,6 +172,7 @@ public class ItemFindService {
} }
public static class ItemFoundResult { public static class ItemFoundResult {
private final ItemStack foundStack; private final ItemStack foundStack;
private final Set<ChunkPosition> positions = new HashSet<>(); private final Set<ChunkPosition> positions = new HashSet<>();
private final long responseTime; private final long responseTime;
@@ -1,17 +1,19 @@
package com.gtnh.findit.service.itemfinder; package com.gtnh.findit.service.itemfinder;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.world.ChunkPosition;
import com.gtnh.findit.util.ProtoUtils; import com.gtnh.findit.util.ProtoUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.world.ChunkPosition;
import java.util.List;
public class ItemFoundResponse implements IMessage { public class ItemFoundResponse implements IMessage {
@@ -23,8 +25,7 @@ public class ItemFoundResponse implements IMessage {
this.positions = positions; this.positions = positions;
} }
public ItemFoundResponse() { public ItemFoundResponse() {}
}
@Override @Override
public void fromBytes(ByteBuf buf) { public void fromBytes(ByteBuf buf) {
@@ -1,12 +1,12 @@
package com.gtnh.findit.util; package com.gtnh.findit.util;
import appeng.client.gui.implementations.*; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import codechicken.nei.LayoutManager; import codechicken.nei.LayoutManager;
import codechicken.nei.NEIClientConfig; import codechicken.nei.NEIClientConfig;
import codechicken.nei.guihook.GuiContainerManager; import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.guihook.IContainerInputHandler; import codechicken.nei.guihook.IContainerInputHandler;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
public abstract class AbstractStackFinder implements IContainerInputHandler { public abstract class AbstractStackFinder implements IContainerInputHandler {
@@ -20,9 +20,7 @@ public abstract class AbstractStackFinder implements IContainerInputHandler {
} }
@Override @Override
public void onKeyTyped(GuiContainer guiContainer, char c, int i) { public void onKeyTyped(GuiContainer guiContainer, char c, int i) {}
}
@Override @Override
public boolean lastKeyTyped(GuiContainer guiContainer, char c, int i) { public boolean lastKeyTyped(GuiContainer guiContainer, char c, int i) {
@@ -48,14 +46,10 @@ public abstract class AbstractStackFinder implements IContainerInputHandler {
} }
@Override @Override
public void onMouseClicked(GuiContainer guiContainer, int i, int i1, int i2) { public void onMouseClicked(GuiContainer guiContainer, int i, int i1, int i2) {}
}
@Override @Override
public void onMouseUp(GuiContainer guiContainer, int i, int i1, int i2) { public void onMouseUp(GuiContainer guiContainer, int i, int i1, int i2) {}
}
@Override @Override
public boolean mouseScrolled(GuiContainer guiContainer, int i, int i1, int i2) { public boolean mouseScrolled(GuiContainer guiContainer, int i, int i1, int i2) {
@@ -63,12 +57,8 @@ public abstract class AbstractStackFinder implements IContainerInputHandler {
} }
@Override @Override
public void onMouseScrolled(GuiContainer guiContainer, int i, int i1, int i2) { public void onMouseScrolled(GuiContainer guiContainer, int i, int i1, int i2) {}
}
@Override @Override
public void onMouseDragged(GuiContainer guiContainer, int i, int i1, int i2, long l) { public void onMouseDragged(GuiContainer guiContainer, int i, int i1, int i2, long l) {}
}
} }
@@ -1,14 +1,15 @@
package com.gtnh.findit.util; package com.gtnh.findit.util;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.world.ChunkPosition;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.world.ChunkPosition;
import io.netty.buffer.ByteBuf;
public class ProtoUtils { public class ProtoUtils {
public static void writePositions(ByteBuf buf, List<ChunkPosition> positions) { public static void writePositions(ByteBuf buf, List<ChunkPosition> positions) {
@@ -1,15 +1,15 @@
package com.gtnh.findit.util; package com.gtnh.findit.util;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.ChunkPosition; import net.minecraft.world.ChunkPosition;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class WorldUtils { public class WorldUtils {
public static List<TileEntity> getTileEntitiesAround(Entity entity, int r) { public static List<TileEntity> getTileEntitiesAround(Entity entity, int r) {
@@ -23,7 +23,8 @@ public class WorldUtils {
* @param (x1,y1,z1) included * @param (x1,y1,z1) included
* @param (x2,y2,z2) excluded * @param (x2,y2,z2) excluded
*/ */
public static List<TileEntity> getTileEntitiesInRegion(World world, int x1, int y1, int z1, int x2, int y2, int z2) { public static List<TileEntity> getTileEntitiesInRegion(World world, int x1, int y1, int z1, int x2, int y2,
int z2) {
List<TileEntity> result = new ArrayList<>(); List<TileEntity> result = new ArrayList<>();
int cx1 = x2 >> 4; int cx1 = x2 >> 4;
int cz1 = z2 >> 4; int cz1 = z2 >> 4;
@@ -32,12 +33,15 @@ public class WorldUtils {
for (int cz = z1 >> 4; cz <= cz1; cz++) { for (int cz = z1 >> 4; cz <= cz1; cz++) {
Chunk chunk = world.getChunkFromChunkCoords(cx, cz); Chunk chunk = world.getChunkFromChunkCoords(cx, cz);
if (chunk != null) { if (chunk != null) {
@SuppressWarnings("unchecked")
Map<ChunkPosition, TileEntity> tiles = chunk.chunkTileEntityMap; Map<ChunkPosition, TileEntity> tiles = chunk.chunkTileEntityMap;
for (TileEntity tile : tiles.values()) { for (TileEntity tile : tiles.values()) {
if (!tile.isInvalid() if (!tile.isInvalid() && tile.xCoord >= x1
&& tile.xCoord >= x1 && tile.xCoord < x2 && tile.xCoord < x2
&& tile.yCoord >= y1 && tile.yCoord < y2 && tile.yCoord >= y1
&& tile.zCoord >= z1 && tile.zCoord < z2) { && tile.yCoord < y2
&& tile.zCoord >= z1
&& tile.zCoord < z2) {
result.add(tile); result.add(tile);
} }
} }
+21 -16
View File
@@ -1,16 +1,21 @@
[ {
{ "modListVersion": 2,
"modid": "findit", "modList": [{
"name": "${modName}", "modid": "${modId}",
"description": "Now where did I put that EV mixer...", "name": "${modName}",
"version": "${modVersion}", "description": "Now where did I put that EV mixer...",
"mcversion": "${minecraftVersion}", "version": "${modVersion}",
"url": "https://github.com/GTNewHorizons/FindIt", "mcversion": "${minecraftVersion}",
"updateUrl": "", "url": "https://github.com/GTNewHorizons/FindIt",
"authorList": ["mitchej123"], "updateUrl": "",
"credits": "Heavily inspired from Buuz135/findme", "authorList": ["mitchej123"],
"logoFile": "", "credits": "Heavily inspired from Buuz135/findme",
"screenshots": [], "logoFile": "",
"dependencies": ["NotEnoughItems"] "screenshots": [],
} "parent": "",
] "requiredMods": [],
"dependencies": ["NotEnoughItems"],
"dependants": [],
"useDependencyInformation": true
}]
}