diff --git a/.gitignore b/.gitignore index 087aab6..82e482e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,17 @@ #Exclude all the things! /* - -#Add back the things that matter. # Gradle stuff !gradle/ !gradlew !gradlew.bat !build.gradle -!build.properties !settings.gradle +!gradle.properties # Other Files. !LICENSE.txt !README.md -!name_textures.py # Include git important files !.gitmodules @@ -23,4 +20,3 @@ # Include Important Folders !src/ -!libs/ diff --git a/build.gradle b/build.gradle index ccbc4ed..d182ba6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,62 +1,32 @@ -buildscript { - repositories { - mavenLocal() - jcenter() - mavenCentral() - maven { url "https://maven.minecraftforge.net/" } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:4.1.+' - } -} +import groovy.json.JsonOutput plugins { id 'java' id 'maven-publish' - id "net.covers1624.signing" version '1.1.4' + id 'signing' + id 'net.neoforged.gradle' version '[6.0.18,6.2)' } -apply plugin: 'net.minecraftforge.gradle' - -group = "codechicken" +group = "io.codechicken" archivesBaseName = "Translocators" -java.toolchain.languageVersion = JavaLanguageVersion.of(8) - -sourceSets.main.resources.srcDirs += "src/main/generated" - -file('build.properties').withReader { - def prop = new Properties() - prop.load(it) - project.ext.config = new ConfigSlurper().parse prop -} - -def signProps = [:] -if (System.getenv("KEY_STORE")) { - println "Using Env variables for jar signing." - signProps['keyStore'] = System.getenv("KEY_STORE") - file(System.getenv("KEY_STORE_PROPS")).withReader { - def props = new Properties() - props.load(it) - signProps.putAll(props) +java { + toolchain { + languageVersion = JavaLanguageVersion.of(17) } -} else if (project.hasProperty('keyStore')) { - println "Using Project properties for jar signing." - signProps['keyStore'] = project.getProperty('keyStore') - signProps['storePass'] = project.getProperty('keyStorePass') - signProps['alias'] = project.getProperty('keyStoreAlias') - signProps['keyPass'] = project.getProperty('keyStoreKeyPass') -} else { - println 'No signing secrets found, build will not be signed.' + withSourcesJar() + withJavadocJar() } -config.mod_version = "${config.mod_version}." + (System.getenv("BUILD_NUMBER") ?: "1") -version = "${config.mc_version}-${config.mod_version}" -println "Starting build of ${archivesBaseName}, Version: ${config.mod_version}" -println "Using Forge: ${config.forge_version}, for Minecraft: ${config.mc_version}" +sourceSets.main.resources.srcDirs += "src/main/generated" + +mod_version = "${mod_version}." + (System.getenv("BUILD_NUMBER") ?: "1") +version = "${mc_version}-${mod_version}" +println "Starting build of ${archivesBaseName}, Version: ${mod_version}" +println "Using Forge: ${forge_version}, for Minecraft: ${mc_version}" minecraft { - mappings channel: 'official', version: config.mc_version + mappings channel: 'official', version: mc_version accessTransformer = file("src/main/resources/META-INF/accesstransformer.cfg") runs { client { @@ -79,52 +49,67 @@ minecraft { repositories { mavenLocal() maven { url = "https://chickenbones.net/maven" } - maven { url = "https://dvs1.progwml6.com/files/maven" } } dependencies { - minecraft "net.minecraftforge:forge:${config.mc_version}-${config.forge_version}" - compile "codechicken:CodeChickenLib:${config.mc_version}-${config.ccl_version}:deobf" - compile "codechicken:CBMultipart:${config.mc_version}-${config.cbmp_version}:deobf" + minecraft "net.neoforged:forge:${mc_version}-${forge_version}" + implementation fg.deobf("io.codechicken:CodeChickenLib:${mc_version}-${ccl_version}:universal") + implementation fg.deobf("io.codechicken:CBMultipart:${mc_version}-${cbmp_version}:universal") } -signing { - if (!signProps.isEmpty()) { - jars { - sign jar - after 'reobfJar' - - keyStore = signProps.keyStore - alias = signProps.alias - storePass = signProps.storePass - keyPass = signProps.keyPass - } +def publishingMetadata = project.layout.buildDirectory.file("libs/$archivesBaseName-$version-publishing.json") +def publishingMetadataTask = tasks.register("publishingMetadata") { + outputs.file(publishingMetadata) + doFirst { + publishingMetadata.get().asFile.text = JsonOutput.prettyPrint(JsonOutput.toJson([ + [ + 'displayName' : "Translocators ${version}", + 'mcVersion' : "${mc_version}", + 'version' : "${mod_version}", + 'classifier' : 'universal', + 'modLoader' : 'neoforge', + 'curseforgeId': '247695', + 'modrinthId' : 'WIxTuRkQ', + 'dependencies': [ + [ + 'modId' : 'codechickenlib', + 'type' : 'required', + 'modrinthId' : '242818', + 'curseforgeId': '2gq0ALnz' + ], + [ + 'modId' : 'cbmultipart', + 'type' : 'required', + 'modrinthId' : '258426', + 'curseforgeId': 'LmvnWWSV' + ] + ] + ] + ])) } } processResources { task -> - inputs.property 'mod_version', config.mod_version - inputs.property 'mc_version', config.mc_version - inputs.property 'ccl_version', config.ccl_version - inputs.property 'ccl_version_max', config.ccl_version_max - inputs.property 'cbmp_version', config.cbmp_version - inputs.property 'cbmp_version_max', config.cbmp_version_max - - from(sourceSets.main.resources.srcDirs) { spec -> - spec.include 'META-INF/mods.toml' - task.doFirst { - spec.expand 'version': config.mod_version, - 'mc_version': config.mc_version, - 'forge_version': config.forge_version, - 'ccl_version_range': "[${resolve("CodeChickenLib")},${config.ccl_version_max})", - 'cbmp_version_range': "[${resolve("CBMultipart")},${config.cbmp_version_max})" - } + inputs.property 'mod_version', mod_version + inputs.property 'mc_version', mc_version + inputs.property 'ccl_version', ccl_version + inputs.property 'ccl_version_max', ccl_version_max + inputs.property 'cbmp_version', cbmp_version + inputs.property 'cbmp_version_max', cbmp_version_max + + filesMatching('META-INF/mods.toml') { + expand 'file': ['jarVersion': mod_version], + 'mc_version': mc_version, + 'forge_version': forge_version, + 'lang_version': forge_version.split('\\.')[0], + 'ccl_version_range': "[${ccl_version.replace(".+", "")},${ccl_version_max})", + 'cbmp_version_range': "[${cbmp_version.replace(".+", "")},${cbmp_version_max})" } } jar { finalizedBy 'reobfJar' - classifier = 'universal' + archiveClassifier = 'universal' manifest { attributes 'Specification-Title': archivesBaseName attributes 'Specification-Vendor': 'covers1624' @@ -137,11 +122,37 @@ jar { from file("LICENSE.txt") } -task srcJar(type: Jar) { - build.dependsOn it - from sourceSets.main.allSource - classifier = 'sources' - from file("LICENSE.txt") +tasks.register("signJar") { + dependsOn("jar") + dependsOn("reobfJar") + + doFirst { + def args = [:] + args['jar'] = jar.archiveFile.get().asFile + if (System.getenv("KEY_STORE")) { + args['keyStore'] = System.getenv("KEY_STORE") + file(System.getenv("KEY_STORE_PROPS")).withReader { + def props = new Properties() + props.load(it) + args.putAll(props) + } + } else if (project.hasProperty('keyStore')) { + args['keyStore'] = project.getProperty('keyStore') + args['alias'] = project.getProperty('keyStoreAlias') + args['storePass'] = project.getProperty('keyStorePass') + args['keyPass'] = project.getProperty('keyStoreKeyPass') + } else { + println "No signing properties." + state.setOutcome(org.gradle.api.internal.tasks.TaskExecutionOutcome.UP_TO_DATE) + didWork = false + return + } + project.ant.invokeMethod('signjar', args) + } +} + +javadoc { + options.addBooleanOption("Xdoclint:none", true) } publishing { @@ -162,27 +173,31 @@ publishing { artifactId project.archivesBaseName version project.version artifact jar - artifact srcJar + artifact sourcesJar + artifact javadocJar + artifact(publishingMetadata) { + builtBy publishingMetadataTask + classifier 'publishing' + } pom { name = archivesBaseName description = archivesBaseName - //The publish plugin doesnt like GString's here apparently.. - url = "https://github.com/TheCBProject/${archivesBaseName}".toString() + url = "https://github.com/TheCBProject/${archivesBaseName}" scm { - url = "https://github.com/TheCBProject/${archivesBaseName}".toString() - connection = "scm:git:git://github.com/TheCBProject/${archivesBaseName}.git".toString() - connection = "scm:git:git@github.com:TheCBProject/${archivesBaseName}.git".toString() + url = "https://github.com/TheCBProject/${archivesBaseName}" + connection = "scm:git:git://github.com/TheCBProject/${archivesBaseName}.git" + connection = "scm:git:git@github.com:TheCBProject/${archivesBaseName}.git" } issueManagement { system = 'github' - url = "https://github.com/TheCBProject/${archivesBaseName}/issues".toString() + url = "https://github.com/TheCBProject/${archivesBaseName}/issues" } licenses { license { name = "MIT" - url = "https://raw.githubusercontent.com/TheCBProject/${archivesBaseName}/master/LICENSE.txt".toString() + url = "https://raw.githubusercontent.com/TheCBProject/${archivesBaseName}/master/LICENSE.txt" distribution = 'repo' } } @@ -203,32 +218,19 @@ publishing { } } -/** - * Polls the 'compile' configuration for a dependency with the given module name - * and resolves, and returns its version. E.g: '1.2.+' will resolve to '1.2.3.4' - * - * @param module The module to search for. - * @param chop If the string should be chopped on the last '-' in its string. - * @param configuration The name of the configuration to search. - * @param errorMissing If an error should be thrown if it can't be found. - * @return The version string, '0' if 'errorMissing' is false and nothing was found. - */ -def resolve(module, chop = true, configuration = 'compile', errorMissing = true) { - //Copy and lenient resolve the configuration, Forge cant be resolved at this time so lenient is required. - def filtered = configurations.getByName(configuration).copy().incoming.artifactView({ it.lenient = true }).artifacts - .findAll { it.id.componentIdentifier.module == module } - .collect { it.id.componentIdentifier.version } - if (filtered.size() > 1) { - println "WARNING: Found ${filtered.size()} Dependencies with ModuleName '${module}' in configuration '${configuration.name}'" - } - if (errorMissing && filtered.isEmpty()) { - throw new RuntimeException("Failed resolve dependency version for '${module}'") - } - if (filtered.isEmpty()) return "0" - def version = filtered.first() as String - if (chop) { - def idx = version.lastIndexOf('-') - return version.substring(idx + 1) +signing { + if (System.getenv('GPG_PRIVATE_KEY')) { + useInMemoryPgpKeys( + new File(System.getenv('GPG_PRIVATE_KEY')).text, + System.getenv('GPG_PRIVATE_KEY_PASS') + ) + } else if (project.hasProperty('gpgPrivateKey')) { + useInMemoryPgpKeys( + new File(project.getProperty('gpgPrivateKey')).text, + project.getProperty('gpgPrivateKeyPass') + ) + } else { + return } - return version + sign publishing.publications.Translocators } diff --git a/build.properties b/build.properties deleted file mode 100644 index 2353b6d..0000000 --- a/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -mc_version=1.16.5 -forge_version=36.1.0 -ccl_version=4.0.0.+ -ccl_version_max=5.0.0 -mod_version=2.6.0 -cbmp_version=3.0.2.+ -cbmp_version_max=4.0.0 diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..b794073 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,7 @@ +mc_version=1.20.1 +forge_version=47.1.65 +ccl_version=4.4.0.+ +ccl_version_max=5.0.0 +mod_version=2.6.0 +cbmp_version=3.3.0.+ +cbmp_version_max=4.0.0 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c..c1962a7 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 442d913..0c85a1f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 91a7e26..aeb74cb 100755 --- a/gradlew +++ b/gradlew @@ -1,79 +1,126 @@ -#!/usr/bin/env bash +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## -## -## 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/. +# ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +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 -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum -warn ( ) { +warn () { echo "$*" -} +} >&2 -die ( ) { +die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# 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\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -82,7 +129,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi 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. Please set the JAVA_HOME variable in your environment to match the @@ -90,75 +137,109 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# 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 +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # 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\"" + 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 - i=$((i+1)) + # 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 - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# 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, 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" "$@" diff --git a/gradlew.bat b/gradlew.bat index 8a0b282..93e3f59 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,4 +1,20 @@ -@if "%DEBUG%" == "" @echo off +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -8,20 +24,24 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@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= - set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 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. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +55,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,44 +65,26 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @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 @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..a26ba08 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,11 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven { + name = 'NeoForged' + url = 'https://maven.neoforged.net/releases' + } + } +} + +rootProject.name = 'Translocators' diff --git a/src/main/java/codechicken/translocators/block/BlockCraftingGrid.java b/src/main/java/codechicken/translocators/block/BlockCraftingGrid.java index 8b78ce2..a04bbcf 100644 --- a/src/main/java/codechicken/translocators/block/BlockCraftingGrid.java +++ b/src/main/java/codechicken/translocators/block/BlockCraftingGrid.java @@ -32,8 +32,9 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; @@ -66,7 +67,7 @@ public class BlockCraftingGrid extends Block implements EntityBlock { } public BlockCraftingGrid() { - super(Block.Properties.of(Material.WOOD).noOcclusion()); + super(Block.Properties.of().mapColor(MapColor.WOOD).noOcclusion()); } @Override @@ -117,7 +118,7 @@ public void playerDestroy(Level worldIn, Player player, BlockPos pos, BlockState } @Override - public List getDrops(BlockState state, LootContext.Builder builder) { + public List getDrops(BlockState state, LootParams.Builder builder) { List stacks = new ArrayList<>(); TileCraftingGrid tcraft = (TileCraftingGrid) builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); if (tcraft != null) { @@ -134,7 +135,7 @@ public List getDrops(BlockState state, LootContext.Builder builder) { @Override public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult blockHit) { if (world.isClientSide()) { - return InteractionResult.PASS; + return InteractionResult.SUCCESS; } TileCraftingGrid tcraft = (TileCraftingGrid) world.getBlockEntity(pos); diff --git a/src/main/java/codechicken/translocators/client/gui/GuiTranslocator.java b/src/main/java/codechicken/translocators/client/gui/GuiTranslocator.java index 7d2ef66..da325af 100644 --- a/src/main/java/codechicken/translocators/client/gui/GuiTranslocator.java +++ b/src/main/java/codechicken/translocators/client/gui/GuiTranslocator.java @@ -1,12 +1,9 @@ package codechicken.translocators.client.gui; import codechicken.translocators.container.ContainerItemTranslocator; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; -import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; @@ -23,17 +20,14 @@ public GuiTranslocator(ContainerItemTranslocator container, Inventory playerInve } @Override - public void render(PoseStack mStack, int mouseX, int mouseY, float partialTicks) { - renderBackground(mStack); - super.render(mStack, mouseX, mouseY, partialTicks); - renderTooltip(mStack, mouseX, mouseY); + public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) { + renderBackground(graphics); + super.render(graphics, mouseX, mouseY, partialTicks); + renderTooltip(graphics, mouseX, mouseY); } @Override - protected void renderBg(PoseStack mStack, float f, int i, int j) { - RenderSystem.setShader(GameRenderer::getPositionTexShader); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.setShaderTexture(0, BACKGROUND_TEXTURE); - blit(mStack, leftPos, topPos, 0, 0, imageWidth, imageHeight); + protected void renderBg(GuiGraphics graphics, float f, int i, int j) { + graphics.blit(BACKGROUND_TEXTURE, leftPos, topPos, 0, 0, imageWidth, imageHeight); } } diff --git a/src/main/java/codechicken/translocators/client/render/FluidTranslocatorPartRenderer.java b/src/main/java/codechicken/translocators/client/render/FluidTranslocatorPartRenderer.java index 71c7aba..d2781b1 100644 --- a/src/main/java/codechicken/translocators/client/render/FluidTranslocatorPartRenderer.java +++ b/src/main/java/codechicken/translocators/client/render/FluidTranslocatorPartRenderer.java @@ -12,7 +12,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.model.Material; import net.minecraftforge.client.ForgeHooksClient; -import net.minecraftforge.fluids.FluidAttributes; +import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; import net.minecraftforge.fluids.FluidStack; /** @@ -44,10 +44,10 @@ private static void drawLiquidSpiral(CCRenderState ccrs, Matrix4 mat, int src, i return; } - FluidAttributes attribs = stack.getFluid().getAttributes(); - Material material = ForgeHooksClient.getBlockMaterial(attribs.getStillTexture(stack)); + IClientFluidTypeExtensions props = IClientFluidTypeExtensions.of(stack.getFluid()); + Material material = ForgeHooksClient.getBlockMaterial(props.getStillTexture(stack)); TextureAtlasSprite tex = material.sprite(); - ccrs.colour = attribs.getColor(stack) << 8 | 255;//Set ccrs.colour opposed to baseColour as we call writeVert manually bellow. + ccrs.colour = props.getTintColor(stack) << 8 | 255;//Set ccrs.colour opposed to baseColour as we call writeVert manually bellow. Vector3[] last = new Vector3[] { new Vector3(), new Vector3(), new Vector3(), new Vector3() }; Vector3[] next = new Vector3[] { new Vector3(), new Vector3(), new Vector3(), new Vector3() }; diff --git a/src/main/java/codechicken/translocators/client/render/ItemTranslocatorPartRenderer.java b/src/main/java/codechicken/translocators/client/render/ItemTranslocatorPartRenderer.java index 4a450da..ca11a80 100644 --- a/src/main/java/codechicken/translocators/client/render/ItemTranslocatorPartRenderer.java +++ b/src/main/java/codechicken/translocators/client/render/ItemTranslocatorPartRenderer.java @@ -8,6 +8,7 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.world.item.ItemDisplayContext; /** * Created by covers1624 on 4/5/23. @@ -25,7 +26,7 @@ public void renderDynamic(ItemTranslocatorPart part, PoseStack pStack, MultiBuff pStack.translate(path.x, path.y, path.z); pStack.scale(0.5f, 0.5f, 0.5f); pStack.scale(0.35f, 0.35f, 0.35f); - itemRenderer.renderStatic(m.stack, ItemTransforms.TransformType.FIXED, packedLight, packedOverlay, pStack, buffers, (int) part.pos().asLong()); + itemRenderer.renderStatic(m.stack, ItemDisplayContext.FIXED, packedLight, packedOverlay, pStack, buffers, part.level(), (int) part.pos().asLong()); pStack.popPose(); } } diff --git a/src/main/java/codechicken/translocators/client/render/RenderTranslocatorItem.java b/src/main/java/codechicken/translocators/client/render/RenderTranslocatorItem.java index a0d97d6..25f428b 100644 --- a/src/main/java/codechicken/translocators/client/render/RenderTranslocatorItem.java +++ b/src/main/java/codechicken/translocators/client/render/RenderTranslocatorItem.java @@ -1,11 +1,13 @@ package codechicken.translocators.client.render; +import codechicken.lib.model.PerspectiveModelState; import codechicken.lib.render.item.IItemRenderer; import codechicken.lib.util.TransformUtils; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.resources.model.ModelState; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; /** @@ -20,12 +22,12 @@ public RenderTranslocatorItem(int type) { } @Override - public void renderItem(ItemStack stack, ItemTransforms.TransformType transformType, PoseStack pStack, MultiBufferSource buffers, int packedLight, int packedOverlay) { - TranslocatorPartRenderer.renderItem(type, pStack, transformType, buffers, packedLight, packedOverlay); + public void renderItem(ItemStack stack, ItemDisplayContext ctx, PoseStack pStack, MultiBufferSource buffers, int packedLight, int packedOverlay) { + TranslocatorPartRenderer.renderItem(type, pStack, ctx, buffers, packedLight, packedOverlay); } @Override - public ModelState getModelTransform() { + public PerspectiveModelState getModelState() { return TransformUtils.DEFAULT_BLOCK; } diff --git a/src/main/java/codechicken/translocators/client/render/TileCraftingGridRenderer.java b/src/main/java/codechicken/translocators/client/render/TileCraftingGridRenderer.java index 6d7f107..088b11a 100644 --- a/src/main/java/codechicken/translocators/client/render/TileCraftingGridRenderer.java +++ b/src/main/java/codechicken/translocators/client/render/TileCraftingGridRenderer.java @@ -10,7 +10,7 @@ import codechicken.translocators.init.TranslocatorTextures; import codechicken.translocators.tile.TileCraftingGrid; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Vector3f; +import com.mojang.math.Axis; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; @@ -19,7 +19,9 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; +import org.joml.Vector3f; public class TileCraftingGridRenderer implements BlockEntityRenderer { @@ -66,7 +68,7 @@ public void render(TileCraftingGrid tile, float partialTicks, PoseStack mStack, mStack.pushPose(); mStack.translate(pos.x, pos.y, pos.z); mStack.scale(0.35f, 0.35f, 0.35f); - itemRenderer.renderStatic(stack, ItemTransforms.TransformType.FIXED, packedLight, packedOverlay, mStack, buffers, (int) tile.getBlockPos().asLong()); + itemRenderer.renderStatic(stack, ItemDisplayContext.FIXED, packedLight, packedOverlay, mStack, buffers, tile.getLevel(), (int) tile.getBlockPos().asLong()); mStack.popPose(); } @@ -77,8 +79,8 @@ public void render(TileCraftingGrid tile, float partialTicks, PoseStack mStack, float spin = (float) (ClientUtils.getRenderTime() * 9 / Math.PI); float bob = (float) (Math.sin(((float) CCRenderEventHandler.renderTime + spin) / 20.0F) * 0.1F + 0.1F); mStack.translate(0, bob + 0.25, 0); - mStack.mulPose(Vector3f.YP.rotation(((float) CCRenderEventHandler.renderTime + spin) / 30.0F)); - itemRenderer.renderStatic(tile.result, ItemTransforms.TransformType.FIXED, packedLight, packedOverlay, mStack, buffers, (int) tile.getBlockPos().asLong()); + mStack.mulPose(Axis.YP.rotation(((float) CCRenderEventHandler.renderTime + spin) / 30.0F)); + itemRenderer.renderStatic(tile.result, ItemDisplayContext.FIXED, packedLight, packedOverlay, mStack, buffers, tile.getLevel(), (int) tile.getBlockPos().asLong()); mStack.popPose(); } diff --git a/src/main/java/codechicken/translocators/client/render/TranslocatorPartRenderer.java b/src/main/java/codechicken/translocators/client/render/TranslocatorPartRenderer.java index eed8c04..970c853 100644 --- a/src/main/java/codechicken/translocators/client/render/TranslocatorPartRenderer.java +++ b/src/main/java/codechicken/translocators/client/render/TranslocatorPartRenderer.java @@ -7,6 +7,7 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.RenderUtils; import codechicken.lib.render.model.OBJParser; +import codechicken.lib.render.pipeline.attribute.LightCoordAttribute; import codechicken.lib.util.ClientUtils; import codechicken.lib.vec.Matrix4; import codechicken.lib.vec.Vector3; @@ -23,9 +24,10 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderStateShard; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemDisplayContext; import org.jetbrains.annotations.Nullable; import java.util.Map; @@ -78,39 +80,36 @@ public class TranslocatorPartRenderer implements Par .parse(); plates[0] = models.get("Plate"); insert = models.get("Insert"); - insert.computeLightCoords(); CCModel.generateSidedModels(plates, 0, new Vector3()); - for (int i = 0; i < 6; i++) { - plates[i].computeLightCoords(); - } } @Override - public boolean renderStatic(T part, @Nullable RenderType layer, CCRenderState ccrs) { + public void renderStatic(T part, @Nullable RenderType layer, CCRenderState ccrs) { Vector3 trans = Vector3.CENTER; IconTransformation i_trans = new IconTransformation(TEXTURES[part.getTType()][part.getIconIndex()]); ccrs.reset(); ccrs.setBrightness(part.level(), part.pos()); plates[part.side].render(ccrs, trans.translation(), i_trans, ccrs.lightMatrix); - return true; } @Override public void renderDynamic(T part, PoseStack pStack, MultiBufferSource buffers, int packedLight, int packedOverlay, float partialTicks) { + BlockPos pos = part.pos(); CCRenderState ccrs = CCRenderState.instance(); ccrs.reset(); - Matrix4 mat = new Matrix4(pStack); double insertpos = MathHelper.interpolate(part.b_insertpos, part.a_insertpos, partialTicks); IconTransformation i_trans = new IconTransformation(TEXTURES[part.getTType()][part.getIconIndex()]); - mat.translate(Vector3.CENTER); - mat.apply(sideRotations[part.side]); - mat.translate(new Vector3(0, -0.5, 0)); - mat.scale(1, insertpos * 2 / 3 + 1 / 3D, 1); + ccrs.reset(); - ccrs.bind(RenderType.solid(), buffers); - ccrs.lightMatrix.locate(part.level(), part.pos()); + ccrs.bind(RenderType.solid(), buffers, pStack); + ccrs.lightMatrix.locate(part.level(), pos); ccrs.brightness = packedLight; ccrs.overlay = packedOverlay; + Matrix4 mat = new Matrix4() + .translate(Vector3.CENTER) + .apply(sideRotations[part.side]) + .translate(new Vector3(0, -0.5, 0)) + .scale(1, insertpos * 2 / 3 + 1 / 3D, 1); insert.render(ccrs, mat, i_trans, ccrs.lightMatrix); ccrs.reset(); @@ -125,7 +124,7 @@ public boolean drawHighlight(T part, PartRayTraceResult hit, Camera camera, Pose return true; } - public static void renderItem(int type, PoseStack pStack, ItemTransforms.TransformType transformType, MultiBufferSource buffers, int packedLight, int packedOverlay) { + public static void renderItem(int type, PoseStack pStack, ItemDisplayContext ctx, MultiBufferSource buffers, int packedLight, int packedOverlay) { CCRenderState ccrs = CCRenderState.instance(); ccrs.reset(); ccrs.bind(ITEM_RENDER_TYPE, buffers); @@ -133,7 +132,7 @@ public static void renderItem(int type, PoseStack pStack, ItemTransforms.Transfo ccrs.overlay = packedOverlay; IconTransformation i_trans = new IconTransformation(TEXTURES[type][0]); Vector3 v_trans = Vector3.CENTER.copy().add(0, 0, 0.5); - if (transformType == ItemTransforms.TransformType.GROUND) { + if (ctx == ItemDisplayContext.GROUND) { v_trans.subtract(0, 0.5, 0); } Matrix4 mat = new Matrix4(pStack); diff --git a/src/main/java/codechicken/translocators/handler/CraftingGridKeyHandler.java b/src/main/java/codechicken/translocators/handler/CraftingGridKeyHandler.java index 998caa3..a6f6f20 100644 --- a/src/main/java/codechicken/translocators/handler/CraftingGridKeyHandler.java +++ b/src/main/java/codechicken/translocators/handler/CraftingGridKeyHandler.java @@ -10,29 +10,32 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.event.RegisterKeyMappingsEvent; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.TickEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.eventbus.api.IEventBus; import org.lwjgl.glfw.GLFW; -public class CraftingGridKeyHandler extends KeyMapping { +public class CraftingGridKeyHandler { - public static final CraftingGridKeyHandler instance = new CraftingGridKeyHandler(); - private boolean wasPressed = false; + public static final KeyMapping CRAFTING_KEY = new KeyMapping("key.craftingGrid", GLFW.GLFW_KEY_C, "key.categories.gameplay"); + private static boolean wasPressed = false; - private CraftingGridKeyHandler() { - super("key.craftingGrid", GLFW.GLFW_KEY_C, "key.categories.gameplay"); + public static void init(IEventBus modBus) { + modBus.addListener(CraftingGridKeyHandler::registerKeyBinding); + MinecraftForge.EVENT_BUS.addListener(CraftingGridKeyHandler::onClientTick); } - @SubscribeEvent - @OnlyIn (Dist.CLIENT) - public void tick(TickEvent.ClientTickEvent event) { + private static void registerKeyBinding(RegisterKeyMappingsEvent event) { + event.register(CRAFTING_KEY); + } + + private static void onClientTick(TickEvent.ClientTickEvent event) { if (event.phase != TickEvent.Phase.END) { return; } - boolean pressed = isDown(); + boolean pressed = CRAFTING_KEY.isDown(); if (pressed != wasPressed) { wasPressed = pressed; if (pressed) { @@ -41,7 +44,7 @@ public void tick(TickEvent.ClientTickEvent event) { } } - private void onKeyPressed() { + private static void onKeyPressed() { Minecraft mc = Minecraft.getInstance(); if (mc.screen != null) { return; diff --git a/src/main/java/codechicken/translocators/init/ClientInit.java b/src/main/java/codechicken/translocators/init/ClientInit.java index 0f4c99c..5eb39aa 100644 --- a/src/main/java/codechicken/translocators/init/ClientInit.java +++ b/src/main/java/codechicken/translocators/init/ClientInit.java @@ -1,7 +1,6 @@ package codechicken.translocators.init; import codechicken.lib.model.ModelRegistryHelper; -import codechicken.lib.texture.SpriteRegistryHelper; import codechicken.multipart.api.MultipartClientRegistry; import codechicken.translocators.client.gui.GuiTranslocator; import codechicken.translocators.client.render.FluidTranslocatorPartRenderer; @@ -12,9 +11,8 @@ import net.covers1624.quack.util.CrashLock; import net.minecraft.client.gui.screens.MenuScreens; import net.minecraft.client.resources.model.ModelResourceLocation; -import net.minecraftforge.client.ClientRegistry; import net.minecraftforge.client.event.EntityRenderersEvent; -import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.client.event.RegisterKeyMappingsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -25,24 +23,21 @@ public class ClientInit { private static final CrashLock LOCK = new CrashLock("Already Initialized."); - public static final SpriteRegistryHelper spriteHelper = new SpriteRegistryHelper(); public static final ModelRegistryHelper modelHelper = new ModelRegistryHelper(); public static void init() { - spriteHelper.addIIconRegister(new TranslocatorTextures()); IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); bus.addListener(ClientInit::clientSetup); bus.addListener(ClientInit::registerRenderers); + CraftingGridKeyHandler.init(bus); + TranslocatorTextures.init(bus); } private static void clientSetup(FMLClientSetupEvent event) { - MinecraftForge.EVENT_BUS.register(CraftingGridKeyHandler.instance); - ClientRegistry.registerKeyBinding(CraftingGridKeyHandler.instance); - MenuScreens.register(TranslocatorsModContent.containerItemTranslocator.get(), GuiTranslocator::new); - ModelResourceLocation itemTranslocatorInv = new ModelResourceLocation(itemTranslocatorItem.get().getRegistryName(), "inventory"); - ModelResourceLocation fluidTranslocatorInv = new ModelResourceLocation(fluidTranslocatorItem.get().getRegistryName(), "inventory"); + ModelResourceLocation itemTranslocatorInv = new ModelResourceLocation(itemTranslocatorItem.getId(), "inventory"); + ModelResourceLocation fluidTranslocatorInv = new ModelResourceLocation(fluidTranslocatorItem.getId(), "inventory"); modelHelper.register(itemTranslocatorInv, new RenderTranslocatorItem(0)); modelHelper.register(fluidTranslocatorInv, new RenderTranslocatorItem(1)); @@ -51,6 +46,7 @@ private static void clientSetup(FMLClientSetupEvent event) { MultipartClientRegistry.register(TranslocatorsModContent.fluidTranslocatorPartType.get(), new FluidTranslocatorPartRenderer()); } + private static void registerRenderers(EntityRenderersEvent.RegisterRenderers event) { event.registerBlockEntityRenderer(TranslocatorsModContent.tileCraftingGridType.get(), TileCraftingGridRenderer::new); } diff --git a/src/main/java/codechicken/translocators/init/DataGenerators.java b/src/main/java/codechicken/translocators/init/DataGenerators.java index f067ba7..8b8ea13 100644 --- a/src/main/java/codechicken/translocators/init/DataGenerators.java +++ b/src/main/java/codechicken/translocators/init/DataGenerators.java @@ -2,17 +2,22 @@ import codechicken.lib.datagen.ItemModelProvider; import codechicken.lib.datagen.recipe.RecipeProvider; +import net.minecraft.core.HolderLookup; import net.minecraft.data.DataGenerator; -import net.minecraft.data.tags.BlockTagsProvider; +import net.minecraft.data.PackOutput; import net.minecraft.data.tags.ItemTagsProvider; import net.minecraft.world.item.Items; +import net.minecraft.world.level.block.Block; import net.minecraftforge.client.model.generators.BlockStateProvider; import net.minecraftforge.client.model.generators.ModelFile; import net.minecraftforge.common.Tags; +import net.minecraftforge.common.data.BlockTagsProvider; import net.minecraftforge.common.data.ExistingFileHelper; +import net.minecraftforge.data.event.GatherDataEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.forge.event.lifecycle.GatherDataEvent; + +import java.util.concurrent.CompletableFuture; import static codechicken.translocators.Translocators.MOD_ID; @@ -22,19 +27,21 @@ public class DataGenerators { @SubscribeEvent public static void gatherDataGenerators(GatherDataEvent event) { DataGenerator gen = event.getGenerator(); + PackOutput output = gen.getPackOutput(); + CompletableFuture lookupProvider = event.getLookupProvider(); ExistingFileHelper files = event.getExistingFileHelper(); - if (event.includeClient()) { - gen.addProvider(new ItemModels(gen, files)); - gen.addProvider(new BlockStates(gen, files)); - } - gen.addProvider(new ItemTags(gen, new BlockTagsProvider(gen, MOD_ID, files), files)); - gen.addProvider(new Recipes(gen)); + + gen.addProvider(event.includeClient(), new ItemModels(output, files)); + gen.addProvider(event.includeClient(), new BlockStates(output, files)); + BlockTags blockTags = new BlockTags(output, lookupProvider, files); + gen.addProvider(event.includeServer(), new ItemTags(output, lookupProvider, blockTags.contentsGetter(), files)); + gen.addProvider(event.includeServer(), new Recipes(output)); } private static class ItemModels extends ItemModelProvider { - public ItemModels(DataGenerator generator, ExistingFileHelper existingFileHelper) { - super(generator, MOD_ID, existingFileHelper); + public ItemModels(PackOutput output, ExistingFileHelper existingFileHelper) { + super(output, MOD_ID, existingFileHelper); } @Override @@ -52,8 +59,8 @@ public String getName() { private static class BlockStates extends BlockStateProvider { - public BlockStates(DataGenerator gen, ExistingFileHelper exFileHelper) { - super(gen, MOD_ID, exFileHelper); + public BlockStates(PackOutput output, ExistingFileHelper exFileHelper) { + super(output, MOD_ID, exFileHelper); } @Override @@ -65,14 +72,25 @@ protected void registerStatesAndModels() { } } + private static class BlockTags extends BlockTagsProvider { + + public BlockTags(PackOutput output, CompletableFuture lookupProvider, ExistingFileHelper files) { + super(output, lookupProvider, MOD_ID, files); + } + + @Override + protected void addTags(HolderLookup.Provider pProvider) { + } + } + private static class ItemTags extends ItemTagsProvider { - public ItemTags(DataGenerator gen, BlockTagsProvider blockTagProvider, ExistingFileHelper files) { - super(gen, blockTagProvider, MOD_ID, files); + public ItemTags(PackOutput output, CompletableFuture lookupProvider, CompletableFuture> blockTagProvider, ExistingFileHelper files) { + super(output, lookupProvider, blockTagProvider, MOD_ID, files); } @Override - protected void addTags() { + protected void addTags(HolderLookup.Provider provider) { tag(TranslocatorsModContent.diamondNuggetTag).add(TranslocatorsModContent.diamondNuggetItem.get()); tag(Tags.Items.NUGGETS).add(TranslocatorsModContent.diamondNuggetItem.get()); tag(TranslocatorsModContent.regulateItemsTag).addTags(TranslocatorsModContent.diamondNuggetTag); @@ -86,7 +104,7 @@ public String getName() { private static class Recipes extends RecipeProvider { - public Recipes(DataGenerator gen) { super(gen); } + public Recipes(PackOutput output) { super(output); } @Override protected void registerRecipes() { diff --git a/src/main/java/codechicken/translocators/init/TranslocatorTextures.java b/src/main/java/codechicken/translocators/init/TranslocatorTextures.java index 0b196f4..0b570a8 100644 --- a/src/main/java/codechicken/translocators/init/TranslocatorTextures.java +++ b/src/main/java/codechicken/translocators/init/TranslocatorTextures.java @@ -1,114 +1,111 @@ package codechicken.translocators.init; -import codechicken.lib.texture.AtlasRegistrar; -import codechicken.lib.texture.IIconRegister; +import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; - -import java.util.function.Consumer; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.client.event.TextureStitchEvent; +import net.minecraftforge.eventbus.api.IEventBus; /** * Created by covers1624 on 14/11/2017. */ -public class TranslocatorTextures implements IIconRegister { +public class TranslocatorTextures { public static TextureAtlasSprite[] ITEM_ICONS = new TextureAtlasSprite[64]; public static TextureAtlasSprite[] FLUID_ICONS = new TextureAtlasSprite[64]; - public static TextureAtlasSprite[][] TEXTURES; + public static TextureAtlasSprite[][] TEXTURES = new TextureAtlasSprite[][] { ITEM_ICONS, FLUID_ICONS }; public static TextureAtlasSprite CRAFTING_GRID; - private static final String BLOCKS_ = "translocators:blocks/"; + private static final String BLOCKS_ = "translocators:block/"; private static final String TRANSLOCATOR_ = BLOCKS_ + "translocator/"; private static final String ITEM_ = TRANSLOCATOR_ + "item/"; private static final String FLUID_ = TRANSLOCATOR_ + "fluid/"; - private static AtlasRegistrar registrar; + public static void init(IEventBus bus) { + bus.addListener(TranslocatorTextures::textureStitchPost); + } + + private static void textureStitchPost(TextureStitchEvent.Post event) { + TextureAtlas atlas = event.getAtlas(); + if (!atlas.location().equals(TextureAtlas.LOCATION_BLOCKS)) return; - @Override - public void registerIcons(AtlasRegistrar registrar) { - TranslocatorTextures.registrar = registrar; - register(BLOCKS_ + "crafting_grid", e -> CRAFTING_GRID = e); + CRAFTING_GRID = atlas.getSprite(new ResourceLocation(BLOCKS_ + "crafting_grid")); //See https://github.com/covers1624/TextureSheetExporter/wiki //@formatter:off - register(ITEM_ + "item_00_0_0_00", e -> ITEM_ICONS [0x00] = e); - register(ITEM_ + "item_10_0_0_00", e -> ITEM_ICONS [0x01] = e); - register(ITEM_ + "item_11_0_1_00", e -> ITEM_ICONS [0x02 | 0x08] = e); - register(ITEM_ + "item_00_1_1_00", e -> ITEM_ICONS [0x04 | 0x08] = e); - register(ITEM_ + "item_10_1_1_00", e -> ITEM_ICONS [0x01 | 0x04 | 0x08] = e); - register(ITEM_ + "item_11_1_1_00", e -> ITEM_ICONS [0x02 | 0x04 | 0x08] = e); - register(ITEM_ + "item_00_0_0_10", e -> ITEM_ICONS [0x10] = e); - register(ITEM_ + "item_10_0_0_10", e -> ITEM_ICONS [0x01 | 0x10] = e); - register(ITEM_ + "item_11_0_0_10", e -> ITEM_ICONS [0x02 | 0x10] = e); - register(ITEM_ + "item_11_0_0_00", e -> ITEM_ICONS [0x02] = e); - register(ITEM_ + "item_00_1_0_10", e -> ITEM_ICONS [0x04 | 0x10] = e); - register(ITEM_ + "item_10_1_0_10", e -> ITEM_ICONS [0x01 | 0x04 | 0x10] = e); - register(ITEM_ + "item_11_1_0_10", e -> ITEM_ICONS [0x02 | 0x04 | 0x10] = e); - register(ITEM_ + "item_00_0_1_10", e -> ITEM_ICONS [0x08 | 0x10] = e); - register(ITEM_ + "item_10_0_1_10", e -> ITEM_ICONS [0x01 | 0x08 | 0x10] = e); - register(ITEM_ + "item_11_0_1_10", e -> ITEM_ICONS [0x02 | 0x08 | 0x10] = e); - register(ITEM_ + "item_00_1_1_10", e -> ITEM_ICONS [0x04 | 0x08 | 0x10] = e); - register(ITEM_ + "item_10_1_1_10", e -> ITEM_ICONS [0x01 | 0x04 | 0x08 | 0x10] = e); - register(ITEM_ + "item_11_1_1_10", e -> ITEM_ICONS [0x02 | 0x04 | 0x08 | 0x10] = e); - register(ITEM_ + "item_00_0_0_11", e -> ITEM_ICONS [0x20] = e); - register(ITEM_ + "item_10_0_0_11", e -> ITEM_ICONS [0x01 | 0x20] = e); - register(ITEM_ + "item_11_0_0_11", e -> ITEM_ICONS [0x02 | 0x20] = e); - register(ITEM_ + "item_00_1_0_11", e -> ITEM_ICONS [0x04 | 0x20] = e); - register(ITEM_ + "item_10_1_0_11", e -> ITEM_ICONS [0x01 | 0x04 | 0x20] = e); - register(ITEM_ + "item_11_1_0_11", e -> ITEM_ICONS [0x02 | 0x04 | 0x20] = e); - register(ITEM_ + "item_00_1_0_00", e -> ITEM_ICONS [0x04] = e); - register(ITEM_ + "item_00_0_1_11", e -> ITEM_ICONS [0x08 | 0x20] = e); - register(ITEM_ + "item_10_0_1_11", e -> ITEM_ICONS [0x01 | 0x08 | 0x20] = e); - register(ITEM_ + "item_11_0_1_11", e -> ITEM_ICONS [0x02 | 0x08 | 0x20] = e); - register(ITEM_ + "item_00_1_1_11", e -> ITEM_ICONS [0x04 | 0x08 | 0x20] = e); - register(ITEM_ + "item_10_1_1_11", e -> ITEM_ICONS [0x01 | 0x04 | 0x08 | 0x20] = e); - register(ITEM_ + "item_11_1_1_11", e -> ITEM_ICONS [0x02 | 0x04 | 0x08 | 0x20] = e); - register(ITEM_ + "item_10_1_0_00", e -> ITEM_ICONS [0x01 | 0x04] = e); - register(ITEM_ + "item_11_1_0_00", e -> ITEM_ICONS [0x02 | 0x04] = e); - register(ITEM_ + "item_00_0_1_00", e -> ITEM_ICONS [0x08] = e); - register(ITEM_ + "item_10_0_1_00", e -> ITEM_ICONS [0x01 | 0x08] = e); - register(FLUID_ + "fluid_00_0_0_00", e -> FLUID_ICONS[0x00] = e); - register(FLUID_ + "fluid_10_0_0_00", e -> FLUID_ICONS[0x01] = e); - register(FLUID_ + "fluid_11_0_1_00", e -> FLUID_ICONS[0x02 | 0x08] = e); - register(FLUID_ + "fluid_00_1_1_00", e -> FLUID_ICONS[0x04 | 0x08] = e); - register(FLUID_ + "fluid_10_1_1_00", e -> FLUID_ICONS[0x01 | 0x04 | 0x08] = e); - register(FLUID_ + "fluid_11_1_1_00", e -> FLUID_ICONS[0x02 | 0x04 | 0x08] = e); - register(FLUID_ + "fluid_00_0_0_10", e -> FLUID_ICONS[0x10] = e); - register(FLUID_ + "fluid_10_0_0_10", e -> FLUID_ICONS[0x01 | 0x10] = e); - register(FLUID_ + "fluid_11_0_0_10", e -> FLUID_ICONS[0x02 | 0x10] = e); - register(FLUID_ + "fluid_11_0_0_00", e -> FLUID_ICONS[0x02] = e); - register(FLUID_ + "fluid_00_1_0_10", e -> FLUID_ICONS[0x04 | 0x10] = e); - register(FLUID_ + "fluid_10_1_0_10", e -> FLUID_ICONS[0x01 | 0x04 | 0x10] = e); - register(FLUID_ + "fluid_11_1_0_10", e -> FLUID_ICONS[0x02 | 0x04 | 0x10] = e); - register(FLUID_ + "fluid_00_0_1_10", e -> FLUID_ICONS[0x08 | 0x10] = e); - register(FLUID_ + "fluid_10_0_1_10", e -> FLUID_ICONS[0x01 | 0x08 | 0x10] = e); - register(FLUID_ + "fluid_11_0_1_10", e -> FLUID_ICONS[0x02 | 0x08 | 0x10] = e); - register(FLUID_ + "fluid_00_1_1_10", e -> FLUID_ICONS[0x04 | 0x08 | 0x10] = e); - register(FLUID_ + "fluid_10_1_1_10", e -> FLUID_ICONS[0x01 | 0x04 | 0x08 | 0x10] = e); - register(FLUID_ + "fluid_11_1_1_10", e -> FLUID_ICONS[0x02 | 0x04 | 0x08 | 0x10] = e); - register(FLUID_ + "fluid_00_0_0_11", e -> FLUID_ICONS[0x20] = e); - register(FLUID_ + "fluid_10_0_0_11", e -> FLUID_ICONS[0x01 | 0x20] = e); - register(FLUID_ + "fluid_11_0_0_11", e -> FLUID_ICONS[0x02 | 0x20] = e); - register(FLUID_ + "fluid_00_1_0_11", e -> FLUID_ICONS[0x04 | 0x20] = e); - register(FLUID_ + "fluid_10_1_0_11", e -> FLUID_ICONS[0x01 | 0x04 | 0x20] = e); - register(FLUID_ + "fluid_11_1_0_11", e -> FLUID_ICONS[0x02 | 0x04 | 0x20] = e); - register(FLUID_ + "fluid_00_1_0_00", e -> FLUID_ICONS[0x04] = e); - register(FLUID_ + "fluid_00_0_1_11", e -> FLUID_ICONS[0x08 | 0x20] = e); - register(FLUID_ + "fluid_10_0_1_11", e -> FLUID_ICONS[0x01 | 0x08 | 0x20] = e); - register(FLUID_ + "fluid_11_0_1_11", e -> FLUID_ICONS[0x02 | 0x08 | 0x20] = e); - register(FLUID_ + "fluid_00_1_1_11", e -> FLUID_ICONS[0x04 | 0x08 | 0x20] = e); - register(FLUID_ + "fluid_10_1_1_11", e -> FLUID_ICONS[0x01 | 0x04 | 0x08 | 0x20] = e); - register(FLUID_ + "fluid_11_1_1_11", e -> FLUID_ICONS[0x02 | 0x04 | 0x08 | 0x20] = e); - register(FLUID_ + "fluid_10_1_0_00", e -> FLUID_ICONS[0x01 | 0x04] = e); - register(FLUID_ + "fluid_11_1_0_00", e -> FLUID_ICONS[0x02 | 0x04] = e); - register(FLUID_ + "fluid_00_0_1_00", e -> FLUID_ICONS[0x08] = e); - register(FLUID_ + "fluid_10_0_1_00", e -> FLUID_ICONS[0x01 | 0x08] = e); + ITEM_ICONS [0x00] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_00_0_0_00")); + ITEM_ICONS [0x01] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_10_0_0_00")); + ITEM_ICONS [0x02 | 0x08] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_11_0_1_00")); + ITEM_ICONS [0x04 | 0x08] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_00_1_1_00")); + ITEM_ICONS [0x01 | 0x04 | 0x08] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_10_1_1_00")); + ITEM_ICONS [0x02 | 0x04 | 0x08] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_11_1_1_00")); + ITEM_ICONS [0x10] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_00_0_0_10")); + ITEM_ICONS [0x01 | 0x10] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_10_0_0_10")); + ITEM_ICONS [0x02 | 0x10] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_11_0_0_10")); + ITEM_ICONS [0x02] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_11_0_0_00")); + ITEM_ICONS [0x04 | 0x10] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_00_1_0_10")); + ITEM_ICONS [0x01 | 0x04 | 0x10] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_10_1_0_10")); + ITEM_ICONS [0x02 | 0x04 | 0x10] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_11_1_0_10")); + ITEM_ICONS [0x08 | 0x10] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_00_0_1_10")); + ITEM_ICONS [0x01 | 0x08 | 0x10] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_10_0_1_10")); + ITEM_ICONS [0x02 | 0x08 | 0x10] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_11_0_1_10")); + ITEM_ICONS [0x04 | 0x08 | 0x10] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_00_1_1_10")); + ITEM_ICONS [0x01 | 0x04 | 0x08 | 0x10] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_10_1_1_10")); + ITEM_ICONS [0x02 | 0x04 | 0x08 | 0x10] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_11_1_1_10")); + ITEM_ICONS [0x20] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_00_0_0_11")); + ITEM_ICONS [0x01 | 0x20] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_10_0_0_11")); + ITEM_ICONS [0x02 | 0x20] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_11_0_0_11")); + ITEM_ICONS [0x04 | 0x20] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_00_1_0_11")); + ITEM_ICONS [0x01 | 0x04 | 0x20] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_10_1_0_11")); + ITEM_ICONS [0x02 | 0x04 | 0x20] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_11_1_0_11")); + ITEM_ICONS [0x04] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_00_1_0_00")); + ITEM_ICONS [0x08 | 0x20] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_00_0_1_11")); + ITEM_ICONS [0x01 | 0x08 | 0x20] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_10_0_1_11")); + ITEM_ICONS [0x02 | 0x08 | 0x20] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_11_0_1_11")); + ITEM_ICONS [0x04 | 0x08 | 0x20] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_00_1_1_11")); + ITEM_ICONS [0x01 | 0x04 | 0x08 | 0x20] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_10_1_1_11")); + ITEM_ICONS [0x02 | 0x04 | 0x08 | 0x20] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_11_1_1_11")); + ITEM_ICONS [0x01 | 0x04] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_10_1_0_00")); + ITEM_ICONS [0x02 | 0x04] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_11_1_0_00")); + ITEM_ICONS [0x08] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_00_0_1_00")); + ITEM_ICONS [0x01 | 0x08] = atlas.getSprite(new ResourceLocation(ITEM_ + "item_10_0_1_00")); + FLUID_ICONS[0x00] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_00_0_0_00")); + FLUID_ICONS[0x01] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_10_0_0_00")); + FLUID_ICONS[0x02 | 0x08] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_11_0_1_00")); + FLUID_ICONS[0x04 | 0x08] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_00_1_1_00")); + FLUID_ICONS[0x01 | 0x04 | 0x08] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_10_1_1_00")); + FLUID_ICONS[0x02 | 0x04 | 0x08] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_11_1_1_00")); + FLUID_ICONS[0x10] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_00_0_0_10")); + FLUID_ICONS[0x01 | 0x10] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_10_0_0_10")); + FLUID_ICONS[0x02 | 0x10] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_11_0_0_10")); + FLUID_ICONS[0x02] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_11_0_0_00")); + FLUID_ICONS[0x04 | 0x10] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_00_1_0_10")); + FLUID_ICONS[0x01 | 0x04 | 0x10] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_10_1_0_10")); + FLUID_ICONS[0x02 | 0x04 | 0x10] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_11_1_0_10")); + FLUID_ICONS[0x08 | 0x10] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_00_0_1_10")); + FLUID_ICONS[0x01 | 0x08 | 0x10] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_10_0_1_10")); + FLUID_ICONS[0x02 | 0x08 | 0x10] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_11_0_1_10")); + FLUID_ICONS[0x04 | 0x08 | 0x10] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_00_1_1_10")); + FLUID_ICONS[0x01 | 0x04 | 0x08 | 0x10] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_10_1_1_10")); + FLUID_ICONS[0x02 | 0x04 | 0x08 | 0x10] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_11_1_1_10")); + FLUID_ICONS[0x20] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_00_0_0_11")); + FLUID_ICONS[0x01 | 0x20] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_10_0_0_11")); + FLUID_ICONS[0x02 | 0x20] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_11_0_0_11")); + FLUID_ICONS[0x04 | 0x20] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_00_1_0_11")); + FLUID_ICONS[0x01 | 0x04 | 0x20] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_10_1_0_11")); + FLUID_ICONS[0x02 | 0x04 | 0x20] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_11_1_0_11")); + FLUID_ICONS[0x04] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_00_1_0_00")); + FLUID_ICONS[0x08 | 0x20] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_00_0_1_11")); + FLUID_ICONS[0x01 | 0x08 | 0x20] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_10_0_1_11")); + FLUID_ICONS[0x02 | 0x08 | 0x20] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_11_0_1_11")); + FLUID_ICONS[0x04 | 0x08 | 0x20] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_00_1_1_11")); + FLUID_ICONS[0x01 | 0x04 | 0x08 | 0x20] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_10_1_1_11")); + FLUID_ICONS[0x02 | 0x04 | 0x08 | 0x20] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_11_1_1_11")); + FLUID_ICONS[0x01 | 0x04] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_10_1_0_00")); + FLUID_ICONS[0x02 | 0x04] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_11_1_0_00")); + FLUID_ICONS[0x08] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_00_0_1_00")); + FLUID_ICONS[0x01 | 0x08] = atlas.getSprite(new ResourceLocation(FLUID_ + "fluid_10_0_1_00")); //@formatter:on - TEXTURES = new TextureAtlasSprite[][] { ITEM_ICONS, FLUID_ICONS }; } - - private static void register(String sprite, Consumer onReady) { - registrar.registerSprite(sprite, onReady); - } - } diff --git a/src/main/java/codechicken/translocators/init/TranslocatorsModContent.java b/src/main/java/codechicken/translocators/init/TranslocatorsModContent.java index ab3554d..0d3b011 100644 --- a/src/main/java/codechicken/translocators/init/TranslocatorsModContent.java +++ b/src/main/java/codechicken/translocators/init/TranslocatorsModContent.java @@ -15,10 +15,11 @@ import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.inventory.MenuType; -import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; @@ -34,24 +35,24 @@ public class TranslocatorsModContent { private static final CrashLock LOCK = new CrashLock("Already Initialized."); - private static final DeferredRegister ITEMS = DeferredRegister.create(Item.class, MOD_ID); - private static final DeferredRegister BLOCKS = DeferredRegister.create(Block.class, MOD_ID); - private static final DeferredRegister> TILES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITIES, MOD_ID); + private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MOD_ID); + private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MOD_ID); + private static final DeferredRegister> TILES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, MOD_ID); private static final DeferredRegister> PARTS = DeferredRegister.create(MultipartType.MULTIPART_TYPES, MOD_ID); - private static final DeferredRegister> CONTAINER_TYPES = DeferredRegister.create(ForgeRegistries.CONTAINERS, MOD_ID); + private static final DeferredRegister> MENU_TYPES = DeferredRegister.create(ForgeRegistries.MENU_TYPES, MOD_ID); public static TagKey diamondNuggetTag = ItemTags.create(new ResourceLocation("forge:nuggets/diamond")); public static TagKey regulateItemsTag = ItemTags.create(new ResourceLocation("translocators:regulate")); //region Items. public static RegistryObject itemTranslocatorItem = ITEMS.register("item_translocator", () -> - new ItemTranslocatorItem(new Item.Properties().tab(CreativeModeTab.TAB_REDSTONE))); + new ItemTranslocatorItem(new Item.Properties())); public static RegistryObject fluidTranslocatorItem = ITEMS.register("fluid_translocator", () -> - new FluidTranslocatorItem(new Item.Properties().tab(CreativeModeTab.TAB_REDSTONE))); + new FluidTranslocatorItem(new Item.Properties())); public static RegistryObject diamondNuggetItem = ITEMS.register("diamond_nugget", () -> - new Item(new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS))); + new Item(new Item.Properties())); //endregion //region Blocks. @@ -72,7 +73,7 @@ public class TranslocatorsModContent { //endregion //region ContainerTypes. - public static RegistryObject> containerItemTranslocator = CONTAINER_TYPES.register("item_translocator", () -> + public static RegistryObject> containerItemTranslocator = MENU_TYPES.register("item_translocator", () -> ICCLContainerType.create(ContainerItemTranslocator::new)); //endregion. @@ -83,6 +84,17 @@ public static void init() { BLOCKS.register(bus); TILES.register(bus); PARTS.register(bus); - CONTAINER_TYPES.register(bus); + MENU_TYPES.register(bus); + bus.addListener(TranslocatorsModContent::onCreativeTabBuild); + } + + private static void onCreativeTabBuild(BuildCreativeModeTabContentsEvent event) { + if (event.getTabKey() == CreativeModeTabs.REDSTONE_BLOCKS) { + event.accept(itemTranslocatorItem); + event.accept(fluidTranslocatorItem); + } + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) { + event.accept(diamondNuggetItem); + } } } diff --git a/src/main/java/codechicken/translocators/item/FluidTranslocatorItem.java b/src/main/java/codechicken/translocators/item/FluidTranslocatorItem.java index 003867c..4964ea0 100644 --- a/src/main/java/codechicken/translocators/item/FluidTranslocatorItem.java +++ b/src/main/java/codechicken/translocators/item/FluidTranslocatorItem.java @@ -4,7 +4,7 @@ import codechicken.translocators.init.TranslocatorsModContent; import codechicken.translocators.part.FluidTranslocatorPart; import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; +import net.minecraftforge.common.capabilities.ForgeCapabilities; /** * Created by covers1624 on 4/20/20. @@ -22,6 +22,6 @@ public MultipartType getType() { @Override public Capability getTargetCapability() { - return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY; + return ForgeCapabilities.FLUID_HANDLER; } } diff --git a/src/main/java/codechicken/translocators/item/ItemTranslocatorItem.java b/src/main/java/codechicken/translocators/item/ItemTranslocatorItem.java index 206f9c5..5415d1d 100644 --- a/src/main/java/codechicken/translocators/item/ItemTranslocatorItem.java +++ b/src/main/java/codechicken/translocators/item/ItemTranslocatorItem.java @@ -4,7 +4,7 @@ import codechicken.translocators.init.TranslocatorsModContent; import codechicken.translocators.part.ItemTranslocatorPart; import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.common.capabilities.ForgeCapabilities; /** * Created by covers1624 on 4/20/20. @@ -22,6 +22,6 @@ public MultipartType getType() { @Override public Capability getTargetCapability() { - return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY; + return ForgeCapabilities.ITEM_HANDLER; } } diff --git a/src/main/java/codechicken/translocators/item/TranslocatorItem.java b/src/main/java/codechicken/translocators/item/TranslocatorItem.java index 3f7a022..c56ec80 100644 --- a/src/main/java/codechicken/translocators/item/TranslocatorItem.java +++ b/src/main/java/codechicken/translocators/item/TranslocatorItem.java @@ -3,6 +3,7 @@ import codechicken.multipart.api.ItemMultipart; import codechicken.multipart.api.MultipartType; import codechicken.multipart.api.part.MultiPart; +import codechicken.multipart.util.MultipartPlaceContext; import codechicken.translocators.part.TranslocatorPart; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -16,7 +17,6 @@ import net.minecraftforge.common.capabilities.Capability; /** - * //TODO, This name is cancer. Also the IIR name. * Created by covers1624 on 10/11/2017. */ public abstract class TranslocatorItem extends ItemMultipart { @@ -30,7 +30,7 @@ public TranslocatorItem(Item.Properties props) { public abstract Capability getTargetCapability(); @Override - public MultiPart newPart(UseOnContext context) { + public MultiPart newPart(MultipartPlaceContext context) { Level world = context.getLevel(); Direction side = context.getClickedFace(); BlockPos onPos = context.getClickedPos().relative(side.getOpposite()); @@ -42,10 +42,10 @@ public MultiPart newPart(UseOnContext context) { return null; } - @Override - public void fillItemCategory(CreativeModeTab group, NonNullList items) { - if (allowdedIn(group)) { - items.add(new ItemStack(this, 1)); - } - } +// @Override +// public void fillItemCategory(CreativeModeTab group, NonNullList items) { +// if (allowdedIn(group)) { +// items.add(new ItemStack(this, 1)); +// } +// } } diff --git a/src/main/java/codechicken/translocators/network/TranslocatorSPH.java b/src/main/java/codechicken/translocators/network/TranslocatorSPH.java index 25d03dd..6e170ec 100644 --- a/src/main/java/codechicken/translocators/network/TranslocatorSPH.java +++ b/src/main/java/codechicken/translocators/network/TranslocatorSPH.java @@ -15,9 +15,9 @@ public class TranslocatorSPH implements IServerPacketHandler { @Override public void handlePacket(PacketCustom packet, ServerPlayer sender, ServerGamePacketListenerImpl handler) { switch (packet.getType()) { - case S_CRAFTING_GRID_PLACE -> TranslocatorsModContent.blockCraftingGrid.get().placeBlock(sender.level, sender, packet.readPos(), packet.readDirection()); + case S_CRAFTING_GRID_PLACE -> TranslocatorsModContent.blockCraftingGrid.get().placeBlock(sender.level(), sender, packet.readPos(), packet.readDirection()); case S_CRAFTING_GRID_EXECUTE -> { - if (sender.level.getBlockEntity(packet.readPos()) instanceof TileCraftingGrid tile) { + if (sender.level().getBlockEntity(packet.readPos()) instanceof TileCraftingGrid tile) { tile.craft(sender); } } diff --git a/src/main/java/codechicken/translocators/part/FluidTranslocatorPart.java b/src/main/java/codechicken/translocators/part/FluidTranslocatorPart.java index 087c53b..0ea0c2c 100644 --- a/src/main/java/codechicken/translocators/part/FluidTranslocatorPart.java +++ b/src/main/java/codechicken/translocators/part/FluidTranslocatorPart.java @@ -7,8 +7,8 @@ import codechicken.translocators.init.TranslocatorsModContent; import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; import net.minecraftforge.fluids.capability.templates.EmptyFluidHandler; @@ -40,7 +40,7 @@ public MultipartType getType() { @Override public boolean canStay() { - return capCache().getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, Direction.BY_3D_DATA[side]).isPresent(); + return capCache().getCapability(ForgeCapabilities.FLUID_HANDLER, Direction.BY_3D_DATA[side]).isPresent(); } @Override @@ -64,7 +64,7 @@ public void tick() { for (int i = 0; i < 6; i++) { //Fill with empty if the translocator doesnt exist or is the incorrect type. if (canInsert(i) || i == side) { - attached[i] = capCache().getCapabilityOr(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, Direction.BY_3D_DATA[i], EmptyFluidHandler.INSTANCE); + attached[i] = capCache().getCapabilityOr(ForgeCapabilities.FLUID_HANDLER, Direction.BY_3D_DATA[i], EmptyFluidHandler.INSTANCE); } else { attached[i] = EmptyFluidHandler.INSTANCE; } diff --git a/src/main/java/codechicken/translocators/part/ItemTranslocatorPart.java b/src/main/java/codechicken/translocators/part/ItemTranslocatorPart.java index 1114666..4d032f1 100644 --- a/src/main/java/codechicken/translocators/part/ItemTranslocatorPart.java +++ b/src/main/java/codechicken/translocators/part/ItemTranslocatorPart.java @@ -16,7 +16,7 @@ import codechicken.translocators.init.TranslocatorsModContent; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -26,7 +26,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Blocks; -import net.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.wrapper.EmptyHandler; @@ -76,7 +76,7 @@ public int getIconIndex() { @Override public boolean canStay() { - return capCache().getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.BY_3D_DATA[side]).isPresent(); + return capCache().getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.BY_3D_DATA[side]).isPresent(); } @Override @@ -90,7 +90,7 @@ public void tick() { for (int i = 0; i < 6; i++) { //Fill with empty if the translocator doesnt exist or is the incorrect type. if (canInsert(i) || i == side) { - handlers[i] = capCache().getCapabilityOr(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.BY_3D_DATA[i], EmptyHandler.INSTANCE); + handlers[i] = capCache().getCapabilityOr(ForgeCapabilities.ITEM_HANDLER, Direction.BY_3D_DATA[i], EmptyHandler.INSTANCE); } else { handlers[i] = EmptyHandler.INSTANCE; } @@ -136,7 +136,7 @@ public void tick() { if (signal) { IItemHandler[] handlers = new IItemHandler[6]; for (int i = 0; i < 6; i++) { - handlers[i] = capCache().getCapabilityOr(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.BY_3D_DATA[side], EmptyHandler.INSTANCE); + handlers[i] = capCache().getCapabilityOr(ForgeCapabilities.ITEM_HANDLER, Direction.BY_3D_DATA[side], EmptyHandler.INSTANCE); } if (a_eject) { boolean allSatisfied = true; @@ -348,14 +348,14 @@ public InteractionResult activate(Player player, PartRayTraceResult hit, ItemSta if (stack.is(ConfigHandler.regulateTag) && !regulate) { regulateStack = ItemUtils.copyStack(stack, 1); regulate = true; - if (!player.abilities.instabuild) { + if (!player.getAbilities().instabuild) { stack.shrink(1); } markUpdate(); return InteractionResult.SUCCESS; } else if (stack.getItem() == Items.IRON_INGOT && !signal) { signal = true; - if (!player.abilities.instabuild) { + if (!player.getAbilities().instabuild) { stack.shrink(1); } markUpdate(); @@ -398,7 +398,7 @@ public void setChanged() { } MenuProvider provider = new SimpleMenuProvider( (id, inv, p) -> new ContainerItemTranslocator(id, inv, new Inv(filters, filterStackLimit())), - new TranslatableComponent(name) + Component.translatable(name) ); ServerUtils.openContainer((ServerPlayer) player, provider, p -> { p.writeShort(filterStackLimit()); diff --git a/src/main/java/codechicken/translocators/part/TranslocatorPart.java b/src/main/java/codechicken/translocators/part/TranslocatorPart.java index e8bfc10..3c6cb68 100644 --- a/src/main/java/codechicken/translocators/part/TranslocatorPart.java +++ b/src/main/java/codechicken/translocators/part/TranslocatorPart.java @@ -282,7 +282,7 @@ public InteractionResult activate(Player player, PartRayTraceResult hit, ItemSta } } else if (held.getItem() == Items.REDSTONE && !redstone) { redstone = true; - if (!player.abilities.instabuild) { + if (!player.getAbilities().instabuild) { held.shrink(1); } if (level().hasNeighborSignal(pos()) == invert_redstone == a_eject) { @@ -291,7 +291,7 @@ public InteractionResult activate(Player player, PartRayTraceResult hit, ItemSta markUpdate(); } else if (held.getItem() == Items.GLOWSTONE_DUST && !fast) { fast = true; - if (!player.abilities.instabuild) { + if (!player.getAbilities().instabuild) { held.shrink(1); } markUpdate(); diff --git a/src/main/java/codechicken/translocators/tile/TileCraftingGrid.java b/src/main/java/codechicken/translocators/tile/TileCraftingGrid.java index 7c34361..4bc38fd 100644 --- a/src/main/java/codechicken/translocators/tile/TileCraftingGrid.java +++ b/src/main/java/codechicken/translocators/tile/TileCraftingGrid.java @@ -3,6 +3,7 @@ import codechicken.lib.data.MCDataByteBuf; import codechicken.lib.data.MCDataInput; import codechicken.lib.data.MCDataOutput; +import codechicken.lib.inventory.InventorySimple; import codechicken.lib.inventory.InventoryUtils; import codechicken.lib.util.ArrayUtils; import codechicken.lib.util.ItemUtils; @@ -19,8 +20,10 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.StackedContents; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.CraftingContainer; +import net.minecraft.world.inventory.TransientCraftingContainer; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingRecipe; import net.minecraft.world.item.crafting.RecipeType; @@ -30,7 +33,9 @@ import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.event.ForgeEventFactory; +import java.util.Arrays; import java.util.Collections; +import java.util.List; import java.util.Optional; public class TileCraftingGrid extends BlockEntity { @@ -132,7 +137,7 @@ public void activate(int subHit, Player player) { if (!InventoryUtils.areStacksIdentical(held, items[subHit])) { ItemStack old = items[subHit]; items[subHit] = ItemUtils.copyStack(held, 1); - player.inventory.removeItem(player.inventory.selected, 1); + player.getInventory().removeItem(player.getInventory().selected, 1); if (!old.isEmpty()) { giveOrDropItem(old, player); @@ -152,7 +157,7 @@ private void updateResult() { for (int i = 0; i < 4; i++) { Optional mresult = level.getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftMatrix, level); if (mresult.isPresent()) { - result = mresult.get().assemble(craftMatrix); + result = mresult.get().assemble(craftMatrix, level.registryAccess()); return; } @@ -178,7 +183,7 @@ public void craft(ServerPlayer player) { if (mresult.isPresent()) { CraftingRecipe recipe = mresult.get(); if (recipe.isSpecial() || !level.getGameRules().getBoolean(GameRules.RULE_LIMITED_CRAFTING) || player.getRecipeBook().contains(recipe)) { - doCraft(recipe, recipe.assemble(craftMatrix), craftMatrix, player); + doCraft(recipe, recipe.assemble(craftMatrix, level.registryAccess()), craftMatrix, player); break; } } @@ -191,12 +196,7 @@ public void craft(ServerPlayer player) { } private CraftingContainer getCraftMatrix() { - CraftingContainer craftMatrix = new CraftingContainer(new AbstractContainerMenu(null, 0) { - @Override - public boolean stillValid(Player player) { - return true; - } - }, 3, 3); + GridCraftingInventory craftMatrix = new GridCraftingInventory(); for (int i = 0; i < 9; i++) { craftMatrix.setItem(i, items[i]); @@ -229,7 +229,7 @@ private void doCraft(CraftingRecipe recipe, ItemStack mresult, CraftingContainer if (!remStack.isEmpty()) { if (invStack.isEmpty()) { craftMatrix.setItem(i, remStack); - } else if (ItemStack.isSame(invStack, remStack) && ItemStack.tagMatches(invStack, remStack)) { + } else if (ItemStack.isSameItemSameTags(invStack, remStack)) { remStack.grow(invStack.getCount()); craftMatrix.setItem(i, remStack); } else { @@ -258,6 +258,35 @@ private void rotateItems(CraftingContainer inv) { } public void onPlaced(LivingEntity entity) { - rotation = (int) (entity.yRot * 4 / 360 + 0.5D) & 3; + rotation = (int) (entity.getYRot() * 4 / 360 + 0.5D) & 3; + } + + private static class GridCraftingInventory extends InventorySimple implements CraftingContainer { + + public GridCraftingInventory() { + super(3 * 3); + } + + @Override + public int getWidth() { + return 3; + } + + @Override + public int getHeight() { + return 3; + } + + @Override + public List getItems() { + return Arrays.asList(items); + } + + @Override + public void fillStackedContents(StackedContents pContents) { + for (ItemStack item : items) { + pContents.accountSimpleStack(item); + } + } } } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index f5bb97c..4aff306 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -1,29 +1,6 @@ -# CodeChickenLib Access Transformer -public net.minecraft.util.Direction field_82609_l # BY_INDEX -public net.minecraft.util.Direction field_176754_o # BY_HORIZONTAL_INDEX -public net.minecraft.util.math.BlockRayTraceResult (ZLnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/Direction;Lnet/minecraft/util/math/BlockPos;Z)V #Constructor -public-f net.minecraft.util.math.RayTraceResult field_72307_f # hitResult +# Translocators Access Transformer +public net.minecraft.core.Direction f_122348_ # BY_3D_DATA -public net.minecraft.client.renderer.Matrix3f * # All fields. -public net.minecraft.client.renderer.Matrix4f * # All fields. -public com.mojang.blaze3d.vertex.DefaultColorVertexBuilder field_227854_a_ # defaultColor -public net.minecraft.util.math.shapes.VoxelShape field_197768_g # part -public net.minecraft.util.math.shapes.VoxelShape (Lnet/minecraft/util/math/shapes/VoxelShapePart;)V -public net.minecraft.util.math.shapes.VoxelShape func_197757_a(Lnet/minecraft/util/Direction$Axis;)Lit/unimi/dsi/fastutil/doubles/DoubleList; # getValues -public net.minecraft.util.math.shapes.SplitVoxelShape func_197757_a(Lnet/minecraft/util/Direction$Axis;)Lit/unimi/dsi/fastutil/doubles/DoubleList; # getValues -public net.minecraft.util.math.shapes.VoxelShapeArray func_197757_a(Lnet/minecraft/util/Direction$Axis;)Lit/unimi/dsi/fastutil/doubles/DoubleList; # getValues -public net.minecraft.util.math.shapes.VoxelShapeCube func_197757_a(Lnet/minecraft/util/Direction$Axis;)Lit/unimi/dsi/fastutil/doubles/DoubleList; # getValues -public net.minecraft.inventory.container.ContainerType field_221530_x # factory -public net.minecraft.inventory.container.Container field_75149_d # listeners -public net.minecraft.server.management.UserList func_152692_d(Ljava/lang/Object;)Z # hasEntry -public net.minecraft.server.management.PlayerProfileCache -public net.minecraft.server.management.PlayerProfileCache$ProfileEntry -public net.minecraft.server.management.PlayerProfileCache field_152661_c # usernameToProfileEntryMap -public-f net.minecraft.entity.item.ItemEntity field_70290_d # hoverStart -public net.minecraft.client.renderer.RenderState * # Everything. -public net.minecraft.client.renderer.RenderType field_228629_af_ # needsSorting -public-f net.minecraft.client.renderer.BlockRendererDispatcher field_175027_c # blockModelRenderer -public-f net.minecraft.client.renderer.BlockRendererDispatcher field_175025_e # fluidRenderer -public-f net.minecraft.client.renderer.BlockRendererDispatcher field_175028_a # blockModelShapes -public-f net.minecraft.client.Minecraft field_175618_aM # blockRenderDispatcher -public net.minecraft.client.renderer.ItemRenderer func_229114_a_(Lnet/minecraft/client/renderer/model/IBakedModel;Lnet/minecraft/item/ItemStack;IILcom/mojang/blaze3d/matrix/MatrixStack;Lcom/mojang/blaze3d/vertex/IVertexBuilder;)V # renderModel +public net.minecraft.client.renderer.RenderStateShard * # Everything. +public net.minecraft.client.renderer.RenderType *() # All Methods +public net.minecraft.client.renderer.RenderType * # All Fields. diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 5e4ae47..fdf4740 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -24,7 +24,7 @@ Translocates stuff! [[dependencies.translocators]] modId="minecraft" mandatory=true - versionRange="[1.18.2]" + versionRange="[1.20.1]" ordering="NONE" side="BOTH" [[dependencies.translocators]] diff --git a/src/main/resources/assets/translocators/textures/blocks/crafting_grid.png b/src/main/resources/assets/translocators/textures/block/crafting_grid.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/crafting_grid.png rename to src/main/resources/assets/translocators/textures/block/crafting_grid.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/debug.png b/src/main/resources/assets/translocators/textures/block/translocator/debug.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/debug.png rename to src/main/resources/assets/translocators/textures/block/translocator/debug.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_0_0_00.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_0_0_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_0_0_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_0_0_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_0_0_10.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_0_0_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_0_0_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_0_0_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_0_0_11.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_0_0_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_0_0_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_0_0_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_0_1_00.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_0_1_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_0_1_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_0_1_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_0_1_10.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_0_1_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_0_1_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_0_1_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_0_1_11.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_0_1_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_0_1_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_0_1_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_1_0_00.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_1_0_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_1_0_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_1_0_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_1_0_10.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_1_0_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_1_0_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_1_0_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_1_0_11.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_1_0_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_1_0_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_1_0_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_1_1_00.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_1_1_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_1_1_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_1_1_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_1_1_10.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_1_1_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_1_1_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_1_1_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_1_1_11.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_1_1_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_00_1_1_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_00_1_1_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_0_0_00.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_0_0_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_0_0_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_0_0_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_0_0_10.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_0_0_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_0_0_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_0_0_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_0_0_11.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_0_0_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_0_0_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_0_0_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_0_1_00.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_0_1_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_0_1_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_0_1_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_0_1_10.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_0_1_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_0_1_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_0_1_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_0_1_11.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_0_1_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_0_1_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_0_1_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_1_0_00.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_1_0_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_1_0_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_1_0_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_1_0_10.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_1_0_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_1_0_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_1_0_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_1_0_11.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_1_0_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_1_0_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_1_0_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_1_1_00.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_1_1_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_1_1_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_1_1_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_1_1_10.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_1_1_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_1_1_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_1_1_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_1_1_11.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_1_1_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_10_1_1_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_10_1_1_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_0_0_00.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_0_0_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_0_0_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_0_0_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_0_0_10.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_0_0_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_0_0_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_0_0_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_0_0_11.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_0_0_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_0_0_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_0_0_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_0_1_00.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_0_1_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_0_1_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_0_1_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_0_1_10.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_0_1_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_0_1_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_0_1_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_0_1_11.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_0_1_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_0_1_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_0_1_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_1_0_00.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_1_0_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_1_0_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_1_0_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_1_0_10.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_1_0_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_1_0_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_1_0_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_1_0_11.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_1_0_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_1_0_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_1_0_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_1_1_00.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_1_1_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_1_1_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_1_1_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_1_1_10.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_1_1_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_1_1_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_1_1_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_1_1_11.png b/src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_1_1_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/fluid/fluid_11_1_1_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/fluid/fluid_11_1_1_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_0_0_00.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_00_0_0_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_0_0_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_00_0_0_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_0_0_10.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_00_0_0_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_0_0_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_00_0_0_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_0_0_11.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_00_0_0_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_0_0_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_00_0_0_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_0_1_00.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_00_0_1_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_0_1_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_00_0_1_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_0_1_10.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_00_0_1_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_0_1_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_00_0_1_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_0_1_11.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_00_0_1_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_0_1_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_00_0_1_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_1_0_00.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_00_1_0_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_1_0_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_00_1_0_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_1_0_10.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_00_1_0_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_1_0_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_00_1_0_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_1_0_11.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_00_1_0_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_1_0_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_00_1_0_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_1_1_00.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_00_1_1_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_1_1_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_00_1_1_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_1_1_10.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_00_1_1_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_1_1_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_00_1_1_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_1_1_11.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_00_1_1_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_00_1_1_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_00_1_1_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_0_0_00.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_10_0_0_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_0_0_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_10_0_0_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_0_0_10.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_10_0_0_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_0_0_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_10_0_0_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_0_0_11.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_10_0_0_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_0_0_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_10_0_0_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_0_1_00.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_10_0_1_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_0_1_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_10_0_1_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_0_1_10.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_10_0_1_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_0_1_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_10_0_1_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_0_1_11.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_10_0_1_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_0_1_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_10_0_1_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_1_0_00.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_10_1_0_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_1_0_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_10_1_0_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_1_0_10.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_10_1_0_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_1_0_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_10_1_0_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_1_0_11.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_10_1_0_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_1_0_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_10_1_0_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_1_1_00.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_10_1_1_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_1_1_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_10_1_1_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_1_1_10.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_10_1_1_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_1_1_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_10_1_1_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_1_1_11.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_10_1_1_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_10_1_1_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_10_1_1_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_0_0_00.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_11_0_0_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_0_0_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_11_0_0_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_0_0_10.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_11_0_0_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_0_0_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_11_0_0_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_0_0_11.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_11_0_0_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_0_0_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_11_0_0_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_0_1_00.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_11_0_1_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_0_1_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_11_0_1_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_0_1_10.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_11_0_1_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_0_1_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_11_0_1_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_0_1_11.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_11_0_1_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_0_1_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_11_0_1_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_1_0_00.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_11_1_0_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_1_0_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_11_1_0_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_1_0_10.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_11_1_0_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_1_0_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_11_1_0_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_1_0_11.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_11_1_0_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_1_0_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_11_1_0_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_1_1_00.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_11_1_1_00.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_1_1_00.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_11_1_1_00.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_1_1_10.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_11_1_1_10.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_1_1_10.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_11_1_1_10.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_1_1_11.png b/src/main/resources/assets/translocators/textures/block/translocator/item/item_11_1_1_11.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/item/item_11_1_1_11.png rename to src/main/resources/assets/translocators/textures/block/translocator/item/item_11_1_1_11.png diff --git a/src/main/resources/assets/translocators/textures/blocks/translocator/missing.png b/src/main/resources/assets/translocators/textures/block/translocator/missing.png similarity index 100% rename from src/main/resources/assets/translocators/textures/blocks/translocator/missing.png rename to src/main/resources/assets/translocators/textures/block/translocator/missing.png diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info deleted file mode 100644 index 0bb518a..0000000 --- a/src/main/resources/mcmod.info +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "modid": "translocators", - "name": "Translocators", - "description": "Translocates stuff!", - "version": "${version}", - "mcversion": "${mc_version}", - "url": "http://www.minecraftforum.net/topic/909223", - "authorList": [ - "ChickenBones" - ], - "dependencies": [ - "codechickenlib", - "forgemultipartcbe" - ] - } -]