aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Hilyard <anthony.hilyard@gmail.com>2021-08-25 14:51:42 -0700
committerAnthony Hilyard <anthony.hilyard@gmail.com>2021-08-25 14:51:42 -0700
commitfca13e61adcfbdbf38497c20a2e41ef120ef1d13 (patch)
tree2fcf430a4de62639338bf9b360853bb46c5b9d90
downloadIceberg-fca13e61adcfbdbf38497c20a2e41ef120ef1d13.tar.gz
Iceberg-fca13e61adcfbdbf38497c20a2e41ef120ef1d13.tar.bz2
Iceberg-fca13e61adcfbdbf38497c20a2e41ef120ef1d13.zip
Initial commit.
-rw-r--r--.gitattributes5
-rw-r--r--.gitignore19
-rw-r--r--LICENSE89
-rw-r--r--README.md2
-rw-r--r--assets/icon.pngbin0 -> 26618 bytes
-rw-r--r--build.gradle87
-rw-r--r--gradle.properties11
-rw-r--r--gradle/wrapper/gradle-wrapper.jarbin0 -> 54708 bytes
-rw-r--r--gradle/wrapper/gradle-wrapper.properties5
-rw-r--r--gradlew172
-rw-r--r--gradlew.bat84
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/IcebergClient.java26
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/IcebergServer.java19
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/Loader.java70
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/events/CriterionEvent.java38
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/events/EntityFluidEvent.java57
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/mixin/EntityMixin.java66
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/mixin/PlayerAdvancementsMixin.java31
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java129
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/util/Easing.java107
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/util/ItemColor.java38
-rw-r--r--src/main/resources/META-INF/mods.toml27
-rw-r--r--src/main/resources/iceberg.mixins.json15
-rw-r--r--src/main/resources/icon.pngbin0 -> 4416 bytes
-rw-r--r--src/main/resources/pack.mcmeta7
25 files changed, 1104 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..f811f6a
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,5 @@
+# Disable autocrlf on generated files, they always generate with LF
+# Add any extra files or paths here to make git stop saying they
+# are changed when only line endings change.
+src/generated/**/.cache/cache text eol=lf
+src/generated/**/*.json text eol=lf
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5272725
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,19 @@
+# vscode
+bin
+*.launch
+.settings
+.metadata
+.classpath
+.project
+.vscode
+
+# gradle
+build
+.gradle
+
+# other
+run
+logs
+
+# Files from Forge MDK
+forge*changelog.txt
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..0635035
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,89 @@
+Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License
+
+Copyright (c) 2021 AHilyard
+
+By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
+
+Section 1 – Definitions.
+
+Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
+Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
+Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
+Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
+Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
+Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
+Licensor means the individual(s) or entity(ies) granting rights under this Public License.
+NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
+Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
+Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
+You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
+Section 2 – Scope.
+
+License grant.
+Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
+reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
+produce and reproduce, but not Share, Adapted Material for NonCommercial purposes only.
+Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
+Term. The term of this Public License is specified in Section 6(a).
+Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
+Downstream recipients.
+Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
+No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
+No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
+Other rights.
+
+Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
+Patent and trademark rights are not licensed under this Public License.
+To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
+Section 3 – License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the following conditions.
+
+Attribution.
+
+If You Share the Licensed Material, You must:
+
+retain the following if it is supplied by the Licensor with the Licensed Material:
+identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
+a copyright notice;
+a notice that refers to this Public License;
+a notice that refers to the disclaimer of warranties;
+a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
+indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
+indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
+For the avoidance of doubt, You do not have permission under this Public License to Share Adapted Material.
+You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
+If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
+Section 4 – Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
+
+for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only and provided You do not Share Adapted Material;
+if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
+You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
+For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
+Section 5 – Disclaimer of Warranties and Limitation of Liability.
+
+Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
+To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
+The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
+Section 6 – Term and Termination.
+
+This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
+Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
+
+automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
+upon express reinstatement by the Licensor.
+For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
+For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
+Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
+Section 7 – Other Terms and Conditions.
+
+The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
+Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
+Section 8 – Interpretation.
+
+For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
+To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
+No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
+Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..57afaf4
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# Iceberg
+A library for Minecraft 1.16.5 to make modding easier. \ No newline at end of file
diff --git a/assets/icon.png b/assets/icon.png
new file mode 100644
index 0000000..06dfd9c
--- /dev/null
+++ b/assets/icon.png
Binary files differ
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..0d0e82f
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,87 @@
+buildscript {
+ repositories {
+ maven { url = 'https://files.minecraftforge.net/maven' }
+ maven { url = "https://repo.spongepowered.org/maven" }
+ jcenter()
+ mavenCentral()
+ }
+ dependencies {
+ classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
+ classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT'
+ }
+}
+apply plugin: 'net.minecraftforge.gradle'
+apply plugin: 'org.spongepowered.mixin'
+apply plugin: 'eclipse'
+
+archivesBaseName = name + '-' + mcVersion
+
+sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
+
+mixin {
+ add sourceSets.main, "${project.name.toLowerCase()}.refmap.json"
+}
+
+minecraft {
+ mappings channel: 'official', version: project.mcVersion
+
+ runs {
+ client = {
+ properties 'forge.logging.markers': ''
+ properties 'forge.logging.console.level': 'debug'
+ properties 'terminal.ansi': 'true'
+ workingDirectory project.file('run').canonicalPath
+ source sourceSets.main
+
+ arg "-mixin.debug=true"
+ arg "-mixin.checks.interfaces=true"
+ arg "-mixin.config=${project.name}.mixins.json".toLowerCase()
+ }
+ }
+}
+
+// Process resources on build
+processResources {
+ // This will ensure that this task is redone when the versions change.
+ inputs.property 'version', project.version
+
+ // Replace stuff in mods.toml, nothing else
+ from(sourceSets.main.resources.srcDirs) {
+ include 'META-INF/mods.toml'
+
+ // Replace version
+ expand 'version':project.version
+ }
+
+ // Copy everything else except the mods.toml
+ from(sourceSets.main.resources.srcDirs) {
+ exclude 'META-INF/mods.toml'
+ }
+}
+
+
+sourceSets {
+ main {
+ resources {
+ srcDir 'src/generated/resources'
+ }
+ }
+}
+
+dependencies {
+ minecraft 'net.minecraftforge:forge:' + project.properties.mcVersion + '-' + forgeVersion
+ annotationProcessor 'org.spongepowered:mixin:0.8:processor'
+}
+
+jar {
+ manifest {
+ attributes(["Specification-Title": project.name,
+ "Specification-Vendor": project.author,
+ "Specification-Version": "24.0",
+ "Implementation-Title": project.name,
+ "Implementation-Version": project.version,
+ "Implementation-Vendor" : project.author,
+ "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
+ "MixinConfigs": "${project.name.toLowerCase()}.mixins.json"],)
+ }
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..7f277e7
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,11 @@
+# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
+# This is required to provide enough memory for the Minecraft decompilation process.
+org.gradle.jvmargs=-Xmx3G
+org.gradle.daemon=false
+
+name=Iceberg
+group=com.anthonyhilyard.iceberg
+author=anthonyhilyard
+version=1.0.0
+mcVersion=1.16.5
+forgeVersion=36.2.2 \ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..7a3265e
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..1d5b29f
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..cccdd3d
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+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"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ 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
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "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
+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
+
+# 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"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..dee787c
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@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=
+
+@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
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@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%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="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
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega \ No newline at end of file
diff --git a/src/main/java/com/anthonyhilyard/iceberg/IcebergClient.java b/src/main/java/com/anthonyhilyard/iceberg/IcebergClient.java
new file mode 100644
index 0000000..3a860a2
--- /dev/null
+++ b/src/main/java/com/anthonyhilyard/iceberg/IcebergClient.java
@@ -0,0 +1,26 @@
+package com.anthonyhilyard.iceberg;
+
+import net.minecraftforge.api.distmarker.Dist;
+import net.minecraftforge.fml.common.Mod;
+import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
+import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
+
+@Mod.EventBusSubscriber(modid = Loader.MODID, bus = Bus.MOD, value = Dist.CLIENT)
+public class IcebergClient
+{
+ public IcebergClient()
+ {
+ }
+
+ public void onClientSetup(FMLClientSetupEvent event)
+ {
+ event.enqueueWork(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/anthonyhilyard/iceberg/IcebergServer.java b/src/main/java/com/anthonyhilyard/iceberg/IcebergServer.java
new file mode 100644
index 0000000..c5baa64
--- /dev/null
+++ b/src/main/java/com/anthonyhilyard/iceberg/IcebergServer.java
@@ -0,0 +1,19 @@
+package com.anthonyhilyard.iceberg;
+
+import net.minecraftforge.api.distmarker.Dist;
+import net.minecraftforge.fml.common.Mod;
+import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
+import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
+
+@Mod.EventBusSubscriber(modid = Loader.MODID, bus = Bus.MOD, value = Dist.DEDICATED_SERVER)
+public class IcebergServer
+{
+ public IcebergServer()
+ {
+ }
+
+ public void onServerStarting(FMLServerStartingEvent event)
+ {
+
+ }
+}
diff --git a/src/main/java/com/anthonyhilyard/iceberg/Loader.java b/src/main/java/com/anthonyhilyard/iceberg/Loader.java
new file mode 100644
index 0000000..b41595f
--- /dev/null
+++ b/src/main/java/com/anthonyhilyard/iceberg/Loader.java
@@ -0,0 +1,70 @@
+package com.anthonyhilyard.iceberg;
+
+import com.anthonyhilyard.iceberg.events.CriterionEvent;
+import com.anthonyhilyard.iceberg.events.EntityFluidEvent;
+
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import net.minecraftforge.api.distmarker.Dist;
+import net.minecraftforge.eventbus.api.SubscribeEvent;
+import net.minecraftforge.fml.ExtensionPoint;
+import net.minecraftforge.fml.ModLoadingContext;
+import net.minecraftforge.fml.common.Mod;
+import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
+import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
+import net.minecraftforge.fml.loading.FMLEnvironment;
+import net.minecraftforge.fml.network.FMLNetworkConstants;
+
+@Mod(Loader.MODID)
+public class Loader
+{
+ public static final String MODID = "iceberg";
+ public static final Logger LOGGER = LogManager.getLogger(MODID);
+
+ public Loader()
+ {
+ if (FMLEnvironment.dist == Dist.CLIENT)
+ {
+ IcebergClient mod = new IcebergClient();
+ FMLJavaModLoadingContext.get().getModEventBus().addListener(mod::onClientSetup);
+ }
+ else
+ {
+ new IcebergServer();
+ }
+ ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.DISPLAYTEST, () -> Pair.of(() -> FMLNetworkConstants.IGNORESERVERONLY, (a, b) -> true));
+ }
+
+ @SubscribeEvent
+ public void onCommonSetup(FMLCommonSetupEvent event)
+ {
+
+ }
+
+ // Event testing.
+ //
+ // @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.FORGE)
+ // public static class AdvancementEvents
+ // {
+ // @SubscribeEvent
+ // public static void onCriterion(final CriterionEvent event)
+ // {
+ // LOGGER.info("{} gained {} for {}!", event.getPlayer().getName().getString(), event.getCriterionKey(), event.getAdvancement().getId().toString());
+ // }
+
+ // @SubscribeEvent
+ // public static void onFluidEntered(final EntityFluidEvent.Entered event)
+ // {
+ // LOGGER.info("{} entered {}!", event.getEntity().getName().getString(), event.getFluid().getRegistryName().toString());
+ // }
+
+ // @SubscribeEvent
+ // public static void onFluidExited(final EntityFluidEvent.Exited event)
+ // {
+ // LOGGER.info("{} exited {}!", event.getEntity().getName().getString(), event.getFluid().getRegistryName().toString());
+ // }
+ // }
+
+} \ No newline at end of file
diff --git a/src/main/java/com/anthonyhilyard/iceberg/events/CriterionEvent.java b/src/main/java/com/anthonyhilyard/iceberg/events/CriterionEvent.java
new file mode 100644
index 0000000..8148b9b
--- /dev/null
+++ b/src/main/java/com/anthonyhilyard/iceberg/events/CriterionEvent.java
@@ -0,0 +1,38 @@
+package com.anthonyhilyard.iceberg.events;
+
+import net.minecraftforge.event.entity.player.AdvancementEvent;
+import net.minecraft.advancements.Advancement;
+import net.minecraft.entity.player.PlayerEntity;
+import net.minecraftforge.common.MinecraftForge;
+
+/**
+ * This event is fired when a player is granted an advancement criterion.
+ * <br>
+ * This event is not {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
+ * <br>
+ * This event does not have a result. {@link HasResult}<br>
+ * <br>
+ * This event is fired on the {@link MinecraftForge#EVENT_BUS}.
+ */
+public class CriterionEvent extends AdvancementEvent
+{
+ private final Advancement advancement;
+ private final String criterionKey;
+
+ public CriterionEvent(PlayerEntity player, Advancement advancement, String criterionKey)
+ {
+ super(player, advancement);
+ this.advancement = advancement;
+ this.criterionKey = criterionKey;
+ }
+
+ public Advancement getAdvancement()
+ {
+ return advancement;
+ }
+
+ public String getCriterionKey()
+ {
+ return criterionKey;
+ }
+}
diff --git a/src/main/java/com/anthonyhilyard/iceberg/events/EntityFluidEvent.java b/src/main/java/com/anthonyhilyard/iceberg/events/EntityFluidEvent.java
new file mode 100644
index 0000000..aa91fa5
--- /dev/null
+++ b/src/main/java/com/anthonyhilyard/iceberg/events/EntityFluidEvent.java
@@ -0,0 +1,57 @@
+package com.anthonyhilyard.iceberg.events;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.fluid.Fluid;
+import net.minecraftforge.event.entity.EntityEvent;
+
+public class EntityFluidEvent extends EntityEvent
+{
+ private final Fluid fluid;
+
+ private EntityFluidEvent(Entity entity, Fluid fluid)
+ {
+ super(entity);
+ this.fluid = fluid;
+ }
+
+ public Fluid getFluid()
+ {
+ return fluid;
+ }
+
+ /**
+ * This event is fired when an entity enters a fluid to at least eye-level.
+ * If this is a player, they will see the "submerged in fluid" effect at this point.
+ * <br>
+ * This event is not {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
+ * <br>
+ * This event does not have a result. {@link HasResult}<br>
+ * <br>
+ * This event is fired on the {@link MinecraftForge#EVENT_BUS}.
+ */
+ public static class Entered extends EntityFluidEvent
+ {
+ public Entered(Entity entity, Fluid fluid)
+ {
+ super(entity, fluid);
+ }
+ }
+
+ /**
+ * This event is fired when an entity was previously submerged in a fluid to at least eye-level and no longer are.
+ * If this is a player, they will no longer see the "submerged in fluid" effect at this point.
+ * <br>
+ * This event is not {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
+ * <br>
+ * This event does not have a result. {@link HasResult}<br>
+ * <br>
+ * This event is fired on the {@link MinecraftForge#EVENT_BUS}.
+ */
+ public static class Exited extends EntityFluidEvent
+ {
+ public Exited(Entity entity, Fluid fluid)
+ {
+ super(entity, fluid);
+ }
+ }
+}
diff --git a/src/main/java/com/anthonyhilyard/iceberg/mixin/EntityMixin.java b/src/main/java/com/anthonyhilyard/iceberg/mixin/EntityMixin.java
new file mode 100644
index 0000000..f4ca091
--- /dev/null
+++ b/src/main/java/com/anthonyhilyard/iceberg/mixin/EntityMixin.java
@@ -0,0 +1,66 @@
+package com.anthonyhilyard.iceberg.mixin;
+
+import java.util.Objects;
+
+import com.anthonyhilyard.iceberg.events.EntityFluidEvent;
+
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.At.Shift;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.fluid.Fluid;
+import net.minecraft.tags.ITag;
+import net.minecraftforge.common.MinecraftForge;
+
+@Mixin(Entity.class)
+public class EntityMixin extends net.minecraftforge.common.capabilities.CapabilityProvider<Entity>
+{
+ private Fluid previousFluidOnEyes = null;
+
+ @Shadow
+ protected ITag<Fluid> fluidOnEyes;
+
+ protected EntityMixin(Class<Entity> baseClass) { super(baseClass); }
+
+ @Inject(method = "updateFluidOnEyes", at = @At(value = "RETURN"))
+ public void onUpdateFluidOnEyes(CallbackInfo callbackInfo)
+ {
+ if (fluidOnEyes != null && fluidOnEyes.getValues().size() > 0)
+ {
+ previousFluidOnEyes = fluidOnEyes.getValues().get(0);
+ }
+ else if (previousFluidOnEyes != null)
+ {
+ // We were submerged in a fluid that we no longer are.
+ if (previousFluidOnEyes != null)
+ {
+ MinecraftForge.EVENT_BUS.post(new EntityFluidEvent.Exited((Entity)(Object)this, previousFluidOnEyes));
+ }
+ previousFluidOnEyes = null;
+ }
+ }
+
+ @Inject(method = "updateFluidOnEyes",
+ at = @At(value = "FIELD", target = "Lnet/minecraft/entity/Entity;fluidOnEyes:Lnet/minecraft/tags/ITag;", ordinal = 1, shift = Shift.AFTER))
+ public void onUpdateFluidOnEyeAssign(CallbackInfo callbackInfo)
+ {
+ Fluid currentFluid = null;
+ if (fluidOnEyes != null && fluidOnEyes.getValues().size() > 0)
+ {
+ currentFluid = fluidOnEyes.getValues().get(0);
+ }
+
+ if (!Objects.equals(previousFluidOnEyes, currentFluid))
+ {
+ // We are now submerged in a fluid that doesn't match the previous one.
+ if (currentFluid != null)
+ {
+ MinecraftForge.EVENT_BUS.post(new EntityFluidEvent.Entered((Entity)(Object)this, currentFluid));
+ }
+ }
+ }
+}
diff --git a/src/main/java/com/anthonyhilyard/iceberg/mixin/PlayerAdvancementsMixin.java b/src/main/java/com/anthonyhilyard/iceberg/mixin/PlayerAdvancementsMixin.java
new file mode 100644
index 0000000..b27b219
--- /dev/null
+++ b/src/main/java/com/anthonyhilyard/iceberg/mixin/PlayerAdvancementsMixin.java
@@ -0,0 +1,31 @@
+package com.anthonyhilyard.iceberg.mixin;
+
+import com.anthonyhilyard.iceberg.events.CriterionEvent;
+
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
+
+import net.minecraft.advancements.Advancement;
+import net.minecraft.advancements.PlayerAdvancements;
+import net.minecraft.entity.player.ServerPlayerEntity;
+import net.minecraftforge.common.MinecraftForge;
+
+@Mixin(PlayerAdvancements.class)
+public class PlayerAdvancementsMixin
+{
+ @Shadow
+ private ServerPlayerEntity player;
+
+ @Inject(method = "award", at = @At(value = "TAIL"), locals = LocalCapture.CAPTURE_FAILEXCEPTION)
+ public void onAward(Advancement advancement, String criterionKey, CallbackInfoReturnable<Boolean> callbackInfo, boolean success)
+ {
+ if (success)
+ {
+ MinecraftForge.EVENT_BUS.post(new CriterionEvent(player, advancement, criterionKey));
+ }
+ }
+}
diff --git a/src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java b/src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java
new file mode 100644
index 0000000..29ce7d0
--- /dev/null
+++ b/src/main/java/com/anthonyhilyard/iceberg/renderer/CustomItemRenderer.java
@@ -0,0 +1,129 @@
+package com.anthonyhilyard.iceberg.renderer;
+
+import com.mojang.blaze3d.matrix.MatrixStack;
+import com.mojang.blaze3d.platform.GlStateManager.DestFactor;
+import com.mojang.blaze3d.platform.GlStateManager.SourceFactor;
+import com.mojang.blaze3d.systems.RenderSystem;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.lwjgl.opengl.GL11;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.AbstractGui;
+import net.minecraft.client.renderer.IRenderTypeBuffer;
+import net.minecraft.client.renderer.ItemRenderer;
+import net.minecraft.client.renderer.RenderHelper;
+import net.minecraft.client.renderer.color.ItemColors;
+import net.minecraft.client.renderer.model.IBakedModel;
+import net.minecraft.client.renderer.model.ItemCameraTransforms;
+import net.minecraft.client.renderer.model.ModelManager;
+import net.minecraft.client.renderer.texture.AtlasTexture;
+import net.minecraft.client.renderer.texture.OverlayTexture;
+import net.minecraft.client.renderer.texture.TextureManager;
+import net.minecraft.client.shader.Framebuffer;
+import net.minecraft.item.ItemStack;
+
+/**
+ * An extended ItemRenderer that allows items to be rendered to framebuffer before drawing to screen.
+ * This allows alpha values to be supported properly by all item types, even semi-transparent items.
+ */
+public class CustomItemRenderer extends ItemRenderer
+{
+ @SuppressWarnings("unused")
+ private static final Logger LOGGER = LogManager.getLogger();
+
+ private static Framebuffer iconFrameBuffer = null;
+ private Minecraft mc;
+
+ public CustomItemRenderer(TextureManager textureManagerIn, ModelManager modelManagerIn, ItemColors itemColorsIn, Minecraft mcIn)
+ {
+ super(textureManagerIn, modelManagerIn, itemColorsIn);
+ mc = mcIn;
+
+ // Initialize the icon framebuffer if needed.
+ if (iconFrameBuffer == null)
+ {
+ // Use 96 x 96 pixels for the icon frame buffer so at 1.5 scale we get 4x resolution (for smooth icons on larger gui scales).
+ iconFrameBuffer = new Framebuffer(96, 96, true, Minecraft.ON_OSX);
+ iconFrameBuffer.setClearColor(0.0F, 0.0F, 0.0F, 0.0F);
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public void renderItemModelIntoGUIWithAlpha(ItemStack stack, int x, int y, float alpha)
+ {
+ IBakedModel bakedModel = mc.getItemRenderer().getModel(stack, null, null);
+ Framebuffer lastFrameBuffer = mc.getMainRenderTarget();
+
+ // Bind the icon framebuffer so we can render to texture.
+ iconFrameBuffer.clear(Minecraft.ON_OSX);
+ iconFrameBuffer.bindWrite(true);
+
+ RenderSystem.clear(GL11.GL_DEPTH_BUFFER_BIT, Minecraft.ON_OSX);
+ RenderSystem.matrixMode(GL11.GL_PROJECTION);
+ RenderSystem.pushMatrix();
+ RenderSystem.loadIdentity();
+ RenderSystem.ortho(0.0D, iconFrameBuffer.width, iconFrameBuffer.height, 0.0D, 1000.0D, 3000.0D);
+ RenderSystem.matrixMode(GL11.GL_MODELVIEW);
+ RenderSystem.pushMatrix();
+ RenderSystem.loadIdentity();
+ RenderSystem.translatef(0.0F, 0.0F, -2000.0F);
+ RenderHelper.setupFor3DItems();
+
+ mc.getTextureManager().bind(AtlasTexture.LOCATION_BLOCKS);
+ mc.getTextureManager().getTexture(AtlasTexture.LOCATION_BLOCKS).setFilter(false, false);
+ RenderSystem.enableRescaleNormal();
+ RenderSystem.enableAlphaTest();
+ RenderSystem.defaultAlphaFunc();
+ RenderSystem.enableBlend();
+ RenderSystem.blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ONE_MINUS_SRC_ALPHA);
+ RenderSystem.color4f(1.0f, 1.0f, 1.0f, 1.0f);
+ RenderSystem.translatef(48.0f, 48.0f, 150.0f + this.blitOffset);
+ RenderSystem.scalef(1.0f, -1.0f, 1.0f);
+ RenderSystem.scalef(96.0f, 96.0f, 96.0f);
+ MatrixStack matrixStack = new MatrixStack();
+ IRenderTypeBuffer.Impl renderBuffer = Minecraft.getInstance().renderBuffers().bufferSource();
+ boolean isSideLit = !bakedModel.usesBlockLight();
+ if (isSideLit)
+ {
+ RenderHelper.setupForFlatItems();
+ }
+
+ render(stack, ItemCameraTransforms.TransformType.GUI, false, matrixStack, renderBuffer, 0xF000F0, OverlayTexture.NO_OVERLAY, bakedModel);
+ renderBuffer.endBatch();
+ RenderSystem.enableDepthTest();
+ if (isSideLit)
+ {
+ RenderHelper.setupFor3DItems();
+ }
+
+ RenderSystem.disableRescaleNormal();
+ RenderSystem.popMatrix();
+ RenderSystem.matrixMode(GL11.GL_PROJECTION);
+ RenderSystem.popMatrix();
+ RenderSystem.matrixMode(GL11.GL_MODELVIEW);
+
+ // Rebind the previous framebuffer, if there was one.
+ if (lastFrameBuffer != null)
+ {
+ lastFrameBuffer.bindWrite(true);
+
+ // Blit from the texture we just rendered to, respecting the alpha value given.
+ iconFrameBuffer.bindRead();
+ RenderSystem.enableAlphaTest();
+ RenderSystem.enableBlend();
+ RenderSystem.defaultBlendFunc();
+ RenderSystem.defaultAlphaFunc();
+ RenderSystem.disableCull();
+ RenderSystem.color4f(1.0f, 1.0f, 1.0f, alpha);
+ RenderSystem.scalef(1.0f, -1.0f, 1.0f);
+
+ AbstractGui.blit(new MatrixStack(), x, y - 18, 16, 16, 0, 0, iconFrameBuffer.width, iconFrameBuffer.height, iconFrameBuffer.width, iconFrameBuffer.height);
+ }
+ else
+ {
+ iconFrameBuffer.unbindWrite();
+ }
+ }
+}
diff --git a/src/main/java/com/anthonyhilyard/iceberg/util/Easing.java b/src/main/java/com/anthonyhilyard/iceberg/util/Easing.java
new file mode 100644
index 0000000..da41927
--- /dev/null
+++ b/src/main/java/com/anthonyhilyard/iceberg/util/Easing.java
@@ -0,0 +1,107 @@
+package com.anthonyhilyard.iceberg.util;
+
+/**
+ * Helper functions for smooth easing/interpolation. If you need linear, use net.minecraft.util.math.MathHelper.lerp instead.
+ */
+public final class Easing
+{
+ public static enum EasingType
+ {
+ None, // Produces step-wise interpolation.
+ Quad,
+ Cubic
+ }
+
+ public static enum EasingDirection
+ {
+ In,
+ Out,
+ InOut
+ }
+
+ public static float Ease(float a, float b, float t)
+ {
+ return Ease(a, b, t, EasingType.Quad);
+ }
+
+ public static float Ease(float a, float b, float t, EasingType type)
+ {
+ return Ease(a, b, t, type, EasingDirection.InOut);
+ }
+
+ public static float Ease(float a, float b, float t, EasingType type, EasingDirection direction)
+ {
+ switch (type)
+ {
+ case None:
+ default:
+ return None(a, b, t);
+ case Quad:
+ return Quad(a, b, t, direction);
+ case Cubic:
+ return Cubic(a, b, t, direction);
+ }
+ }
+
+ private static float None(float a, float b, float t)
+ {
+ if (t < 0.5f)
+ {
+ return a;
+ }
+ else
+ {
+ return b;
+ }
+ }
+
+ private static float Quad(float a, float b, float t, EasingDirection direction)
+ {
+ switch (direction)
+ {
+ case In:
+ return a + (b - a) * t * t;
+ case Out:
+ return a + (b - a) * (1.0f - (1.0f - t) * (1.0f - t));
+ case InOut:
+ default:
+ {
+ t *= 2.0f;
+ if (t < 1.0f)
+ {
+ return a + (b - a) * 0.5f * t * t;
+ }
+ else
+ {
+ t -= 2.0f;
+ return a + (a - b) * 0.5f * (t * t - 2.0f);
+ }
+ }
+ }
+ }
+
+ private static float Cubic(float a, float b, float t, EasingDirection direction)
+ {
+ switch (direction)
+ {
+ case In:
+ return a + (b - a) * t * t * t;
+ case Out:
+ return a + (b - a) * (1.0f - (1.0f - t) * (1.0f - t) * (1.0f - t));
+ case InOut:
+ default:
+ {
+ t *= 2.0f;
+ if (t < 1.0f)
+ {
+ return a + (b - a) * 0.5f * t * t * t;
+ }
+ else
+ {
+ t -= 2.0f;
+ return a + (b - a) * 0.5f * (t * t * t + 2.0f);
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/com/anthonyhilyard/iceberg/util/ItemColor.java b/src/main/java/com/anthonyhilyard/iceberg/util/ItemColor.java
new file mode 100644
index 0000000..a4625aa
--- /dev/null
+++ b/src/main/java/com/anthonyhilyard/iceberg/util/ItemColor.java
@@ -0,0 +1,38 @@
+package com.anthonyhilyard.iceberg.util;
+
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.text.Color;
+
+public class ItemColor
+{
+ public static Color getColorForItem(ItemStack item, Color defaultColor)
+ {
+ Color result = null;
+
+ // Color based on rarity value.
+ result = item.getDisplayName().getStyle().getColor();
+
+ // Some mods override the getName() method of the Item class, so grab that color if it's there.
+ if (item.getItem() != null &&
+ item.getItem().getName(item) != null &&
+ item.getItem().getName(item).getStyle() != null &&
+ item.getItem().getName(item).getStyle().getColor() != null)
+ {
+ result = item.getItem().getName(item).getStyle().getColor();
+ }
+
+ // Finally, if the item has a special hover name color (Stored in NBT), use that.
+ if (!item.getHoverName().getStyle().isEmpty() && item.getHoverName().getStyle().getColor() != null)
+ {
+ result = item.getHoverName().getStyle().getColor();
+ }
+
+ // Fallback to the default color if we somehow haven't found a single valid color.
+ if (result == null)
+ {
+ result = defaultColor;
+ }
+
+ return result;
+ }
+}
diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml
new file mode 100644
index 0000000..bfb58bd
--- /dev/null
+++ b/src/main/resources/META-INF/mods.toml
@@ -0,0 +1,27 @@
+modLoader="javafml"
+loaderVersion="[36,)"
+license="All rights reserved."
+
+[[mods]]
+modId="iceberg"
+version="${version}"
+displayName="Iceberg"
+displayURL="https://anthonyhilyard.com/"
+updateJSONURL="https://mc-curse-update-checker.herokuapp.com/520110"
+logoFile="icon.png"
+authors="Grend"
+description="A library containing events, helpers, and utilities to make modding easier."
+
+[[dependencies.iceberg]]
+ modId="forge"
+ mandatory=true
+ versionRange="[36,)"
+ ordering="NONE"
+ side="BOTH"
+
+[[dependencies.iceberg]]
+ modId="minecraft"
+ mandatory=true
+ versionRange="[1.16.5]"
+ ordering="NONE"
+ side="BOTH" \ No newline at end of file
diff --git a/src/main/resources/iceberg.mixins.json b/src/main/resources/iceberg.mixins.json
new file mode 100644
index 0000000..41b5589
--- /dev/null
+++ b/src/main/resources/iceberg.mixins.json
@@ -0,0 +1,15 @@
+{
+ "required": true,
+ "package": "com.anthonyhilyard.iceberg.mixin",
+ "compatibilityLevel": "JAVA_8",
+ "refmap": "iceberg.refmap.json",
+ "mixins": [
+ "PlayerAdvancementsMixin",
+ "EntityMixin"
+ ],
+ "injectors": {
+ "defaultRequire": 1
+ },
+ "minVersion": "0.8",
+ "target": "@env(DEFAULT)"
+}
diff --git a/src/main/resources/icon.png b/src/main/resources/icon.png
new file mode 100644
index 0000000..a7ac381
--- /dev/null
+++ b/src/main/resources/icon.png
Binary files differ
diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta
new file mode 100644
index 0000000..709504e
--- /dev/null
+++ b/src/main/resources/pack.mcmeta
@@ -0,0 +1,7 @@
+{
+ "pack": {
+ "description": "iceberg resources",
+ "pack_format": 6,
+ "_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods."
+ }
+}