├── .gitattributes
├── .github
└── workflows
│ └── gradle.yml
├── .gitignore
├── LICENSE
├── README.md
├── build.gradle.kts
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── root.gradle.kts
├── settings.gradle.kts
├── src
└── main
│ ├── java
│ └── org
│ │ └── polyfrost
│ │ └── damagetint
│ │ ├── DamageTint.java
│ │ ├── command
│ │ └── DamageTintCommand.java
│ │ ├── config
│ │ └── DamageTintConfig.java
│ │ └── mixin
│ │ └── RendererLivingEntityMixin.java
│ └── resources
│ ├── damagetint_dark.svg
│ ├── mcmod.info
│ └── mixins.damagetint.json
└── versions
└── mainProject
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.github/workflows/gradle.yml:
--------------------------------------------------------------------------------
1 | # Build Workflow
2 |
3 | name: Build
4 |
5 | on:
6 | pull_request:
7 | workflow_dispatch:
8 | push:
9 |
10 | concurrency:
11 | group: ${{ github.head_ref || format('{0}-{1}', github.ref, github.run_number) }}
12 | cancel-in-progress: true
13 |
14 | jobs:
15 | build:
16 | name: Build
17 |
18 | runs-on: ubuntu-latest
19 |
20 | steps:
21 | - name: Checkout
22 | uses: actions/checkout@v2
23 | with:
24 | fetch-depth: 0
25 |
26 | - name: Set up JDK 17
27 | uses: actions/setup-java@v2
28 | with:
29 | java-version: 17
30 | distribution: temurin
31 | cache: 'gradle'
32 |
33 | - uses: actions/cache@v2
34 | with:
35 | path: |
36 | ~/.gradle/caches
37 | ~/.gradle/wrapper
38 | **/loom-cache
39 | **/prebundled-jars
40 | key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
41 | restore-keys: |
42 | ${{ runner.os }}-gradle-
43 | - name: Chmod Gradle
44 | run: chmod +x ./gradlew
45 |
46 | - name: Build
47 | run: ./gradlew build --no-daemon
48 |
49 | - name: Upload Build Artifacts
50 | uses: actions/upload-artifact@v2
51 | with:
52 | name: artifacts
53 | path: versions/**/build/libs/
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # vscode
2 | .vscode/
3 |
4 | # fleet
5 | .fleet/
6 |
7 | # Gradle
8 | .gradle
9 | **/build/
10 | gradle-app.setting
11 | !gradle-wrapper.jar
12 | .gradletasknamecache
13 |
14 |
15 | # IntelliJ
16 | /.idea/
17 | /output/
18 | *.iml
19 | *.ipr
20 | *.iws
21 |
22 | # Minecraft
23 | **/run/
24 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 |
9 | This version of the GNU Lesser General Public License incorporates
10 | the terms and conditions of version 3 of the GNU General Public
11 | License, supplemented by the additional permissions listed below.
12 |
13 | 0. Additional Definitions.
14 |
15 | As used herein, "this License" refers to version 3 of the GNU Lesser
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
17 | General Public License.
18 |
19 | "The Library" refers to a covered work governed by this License,
20 | other than an Application or a Combined Work as defined below.
21 |
22 | An "Application" is any work that makes use of an interface provided
23 | by the Library, but which is not otherwise based on the Library.
24 | Defining a subclass of a class defined by the Library is deemed a mode
25 | of using an interface provided by the Library.
26 |
27 | A "Combined Work" is a work produced by combining or linking an
28 | Application with the Library. The particular version of the Library
29 | with which the Combined Work was made is also called the "Linked
30 | Version".
31 |
32 | The "Minimal Corresponding Source" for a Combined Work means the
33 | Corresponding Source for the Combined Work, excluding any source code
34 | for portions of the Combined Work that, considered in isolation, are
35 | based on the Application, and not on the Linked Version.
36 |
37 | The "Corresponding Application Code" for a Combined Work means the
38 | object code and/or source code for the Application, including any data
39 | and utility programs needed for reproducing the Combined Work from the
40 | Application, but excluding the System Libraries of the Combined Work.
41 |
42 | 1. Exception to Section 3 of the GNU GPL.
43 |
44 | You may convey a covered work under sections 3 and 4 of this License
45 | without being bound by section 3 of the GNU GPL.
46 |
47 | 2. Conveying Modified Versions.
48 |
49 | If you modify a copy of the Library, and, in your modifications, a
50 | facility refers to a function or data to be supplied by an Application
51 | that uses the facility (other than as an argument passed when the
52 | facility is invoked), then you may convey a copy of the modified
53 | version:
54 |
55 | a) under this License, provided that you make a good faith effort to
56 | ensure that, in the event an Application does not supply the
57 | function or data, the facility still operates, and performs
58 | whatever part of its purpose remains meaningful, or
59 |
60 | b) under the GNU GPL, with none of the additional permissions of
61 | this License applicable to that copy.
62 |
63 | 3. Object Code Incorporating Material from Library Header Files.
64 |
65 | The object code form of an Application may incorporate material from
66 | a header file that is part of the Library. You may convey such object
67 | code under terms of your choice, provided that, if the incorporated
68 | material is not limited to numerical parameters, data structure
69 | layouts and accessors, or small macros, inline functions and templates
70 | (ten or fewer lines in length), you do both of the following:
71 |
72 | a) Give prominent notice with each copy of the object code that the
73 | Library is used in it and that the Library and its use are
74 | covered by this License.
75 |
76 | b) Accompany the object code with a copy of the GNU GPL and this license
77 | document.
78 |
79 | 4. Combined Works.
80 |
81 | You may convey a Combined Work under terms of your choice that,
82 | taken together, effectively do not restrict modification of the
83 | portions of the Library contained in the Combined Work and reverse
84 | engineering for debugging such modifications, if you also do each of
85 | the following:
86 |
87 | a) Give prominent notice with each copy of the Combined Work that
88 | the Library is used in it and that the Library and its use are
89 | covered by this License.
90 |
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 | document.
93 |
94 | c) For a Combined Work that displays copyright notices during
95 | execution, include the copyright notice for the Library among
96 | these notices, as well as a reference directing the user to the
97 | copies of the GNU GPL and this license document.
98 |
99 | d) Do one of the following:
100 |
101 | 0) Convey the Minimal Corresponding Source under the terms of this
102 | License, and the Corresponding Application Code in a form
103 | suitable for, and under terms that permit, the user to
104 | recombine or relink the Application with a modified version of
105 | the Linked Version to produce a modified Combined Work, in the
106 | manner specified by section 6 of the GNU GPL for conveying
107 | Corresponding Source.
108 |
109 | 1) Use a suitable shared library mechanism for linking with the
110 | Library. A suitable mechanism is one that (a) uses at run time
111 | a copy of the Library already present on the user's computer
112 | system, and (b) will operate properly with a modified version
113 | of the Library that is interface-compatible with the Linked
114 | Version.
115 |
116 | e) Provide Installation Information, but only if you would otherwise
117 | be required to provide such information under section 6 of the
118 | GNU GPL, and only to the extent that such information is
119 | necessary to install and execute a modified version of the
120 | Combined Work produced by recombining or relinking the
121 | Application with a modified version of the Linked Version. (If
122 | you use option 4d0, the Installation Information must accompany
123 | the Minimal Corresponding Source and Corresponding Application
124 | Code. If you use option 4d1, you must provide the Installation
125 | Information in the manner specified by section 6 of the GNU GPL
126 | for conveying Corresponding Source.)
127 |
128 | 5. Combined Libraries.
129 |
130 | You may place library facilities that are a work based on the
131 | Library side by side in a single library together with other library
132 | facilities that are not Applications and are not covered by this
133 | License, and convey such a combined library under terms of your
134 | choice, if you do both of the following:
135 |
136 | a) Accompany the combined library with a copy of the same work based
137 | on the Library, uncombined with any other library facilities,
138 | conveyed under the terms of this License.
139 |
140 | b) Give prominent notice with the combined library that part of it
141 | is a work based on the Library, and explaining where to find the
142 | accompanying uncombined form of the same work.
143 |
144 | 6. Revised Versions of the GNU Lesser General Public License.
145 |
146 | The Free Software Foundation may publish revised and/or new versions
147 | of the GNU Lesser General Public License from time to time. Such new
148 | versions will be similar in spirit to the present version, but may
149 | differ in detail to address new problems or concerns.
150 |
151 | Each version is given a distinguishing version number. If the
152 | Library as you received it specifies that a certain numbered version
153 | of the GNU Lesser General Public License "or any later version"
154 | applies to it, you have the option of following the terms and
155 | conditions either of that published version or of any later version
156 | published by the Free Software Foundation. If the Library as you
157 | received it does not specify a version number of the GNU Lesser
158 | General Public License, you may choose any version of the GNU Lesser
159 | General Public License ever published by the Free Software Foundation.
160 |
161 | If the Library as you received it specifies that a proxy can decide
162 | whether future versions of the GNU Lesser General Public License shall
163 | apply, that proxy's public statement of acceptance of any version is
164 | permanent authorization for you to choose that version for the
165 | Library.
166 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Damage Tint
2 |
3 | 
4 | 
5 |
6 | ## About
7 | A mod which changes the color of entities that are hurt.
8 |
--------------------------------------------------------------------------------
/build.gradle.kts:
--------------------------------------------------------------------------------
1 | @file:Suppress("UnstableApiUsage", "PropertyName")
2 |
3 | import org.polyfrost.gradle.util.noServerRunConfigs
4 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
5 |
6 | // Adds support for kotlin, and adds the Polyfrost Gradle Toolkit
7 | // which we use to prepare the environment.
8 | plugins {
9 | kotlin("jvm")
10 | id("org.polyfrost.multi-version")
11 | id("org.polyfrost.defaults.repo")
12 | id("org.polyfrost.defaults.java")
13 | id("org.polyfrost.defaults.loom")
14 | id("com.github.johnrengelman.shadow")
15 | id("net.kyori.blossom") version "1.3.1"
16 | id("signing")
17 | java
18 | }
19 |
20 | // Gets the mod name, version and id from the `gradle.properties` file.
21 | val mod_name: String by project
22 | val mod_version: String by project
23 | val mod_id: String by project
24 | val mod_archives_name: String by project
25 |
26 | // Sets up the variables for when we preprocess to other Minecraft versions.
27 | preprocess {
28 | vars.put("MODERN", if (project.platform.mcMinor >= 16) 1 else 0)
29 | }
30 |
31 | // Replaces the variables in `ExampleMod.java` to the ones specified in `gradle.properties`.
32 | blossom {
33 | replaceToken("@VER@", mod_version)
34 | replaceToken("@NAME@", mod_name)
35 | replaceToken("@ID@", mod_id)
36 | }
37 |
38 | // Sets the mod version to the one specified in `gradle.properties`. Make sure to change this following semver!
39 | version = mod_version
40 | // Sets the group, make sure to change this to your own. It can be a website you own backwards or your GitHub username.
41 | // e.g. com.github. or com.
42 | group = "org.polyfrost"
43 |
44 | // Sets the name of the output jar (the one you put in your mods folder and send to other people)
45 | // It outputs all versions of the mod into the `build` directory.
46 | base {
47 | archivesName.set("$mod_archives_name-$platform")
48 | }
49 |
50 | // Configures the Polyfrost Loom, our plugin fork to easily set up the programming environment.
51 | loom {
52 | // Removes the server configs from IntelliJ IDEA, leaving only client runs.
53 | // If you're developing a server-side mod, you can remove this line.
54 | noServerRunConfigs()
55 |
56 | // Adds the tweak class if we are building legacy version of forge as per the documentation (https://docs.polyfrost.org)
57 | if (project.platform.isLegacyForge) {
58 | runConfigs {
59 | "client" {
60 | programArgs("--tweakClass", "cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker")
61 | property("mixin.debug.export", "true")
62 | }
63 | }
64 | }
65 | // Configures the mixins if we are building for forge, useful for when we are dealing with cross-platform projects.
66 | if (project.platform.isForge) {
67 | forge {
68 | mixinConfig("mixins.${mod_id}.json")
69 | }
70 | }
71 | // Configures the name of the mixin "refmap" using an experimental loom api.
72 | mixin.defaultRefmapName.set("mixins.${mod_id}.refmap.json")
73 | }
74 |
75 | // Creates the shade/shadow configuration, so we can include libraries inside our mod, rather than having to add them separately.
76 | val shade: Configuration by configurations.creating {
77 | configurations.implementation.get().extendsFrom(this)
78 | }
79 |
80 | // Configures the output directory for when building from the `src/resources` directory.
81 | sourceSets {
82 | main {
83 | output.setResourcesDir(java.classesDirectory)
84 | }
85 | }
86 |
87 | // Adds the Polyfrost maven repository so that we can get the libraries necessary to develop the mod.
88 | repositories {
89 | maven("https://repo.polyfrost.org/releases")
90 | }
91 |
92 | // Configures the libraries/dependencies for your mod.
93 | dependencies {
94 | // Adds the OneConfig library, so we can develop with it.
95 | modCompileOnly("cc.polyfrost:oneconfig-$platform:0.2.1-alpha+")
96 |
97 | modRuntimeOnly("me.djtheredstoner:DevAuth-${if (platform.isFabric) "fabric" else if (platform.isLegacyForge) "forge-legacy" else "forge-latest"}:1.1.2")
98 |
99 | // If we are building for legacy forge, includes the launch wrapper with `shade` as we configured earlier.
100 | if (platform.isLegacyForge) {
101 | compileOnly("org.spongepowered:mixin:0.7.11-SNAPSHOT")
102 | shade("cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-beta+")
103 | }
104 | }
105 |
106 | tasks {
107 | // Processes the `src/resources/mcmod.info or fabric.mod.json` and replaces
108 | // the mod id, name and version with the ones in `gradle.properties`
109 | processResources {
110 | inputs.property("id", mod_id)
111 | inputs.property("name", mod_name)
112 | val java = if (project.platform.mcMinor >= 18) {
113 | 17 // If we are playing on version 1.18, set the java version to 17
114 | } else {
115 | // Else if we are playing on version 1.17, use java 16.
116 | if (project.platform.mcMinor == 17)
117 | 16
118 | else
119 | 8 // For all previous versions, we **need** java 8 (for Forge support).
120 | }
121 | val compatLevel = "JAVA_${java}"
122 | inputs.property("java", java)
123 | inputs.property("java_level", compatLevel)
124 | inputs.property("version", mod_version)
125 | inputs.property("mcVersionStr", project.platform.mcVersionStr)
126 | filesMatching(listOf("mcmod.info", "mixins.${mod_id}.json", "mods.toml")) {
127 | expand(
128 | mapOf(
129 | "id" to mod_id,
130 | "name" to mod_name,
131 | "java" to java,
132 | "java_level" to compatLevel,
133 | "version" to mod_version,
134 | "mcVersionStr" to project.platform.mcVersionStr
135 | )
136 | )
137 | }
138 | filesMatching("fabric.mod.json") {
139 | expand(
140 | mapOf(
141 | "id" to mod_id,
142 | "name" to mod_name,
143 | "java" to java,
144 | "java_level" to compatLevel,
145 | "version" to mod_version,
146 | "mcVersionStr" to project.platform.mcVersionStr.substringBeforeLast(".") + ".x"
147 | )
148 | )
149 | }
150 | }
151 |
152 | // Configures the resources to include if we are building for forge or fabric.
153 | withType(Jar::class.java) {
154 | if (project.platform.isFabric) {
155 | exclude("mcmod.info", "mods.toml")
156 | } else {
157 | exclude("fabric.mod.json")
158 | if (project.platform.isLegacyForge) {
159 | exclude("mods.toml")
160 | } else {
161 | exclude("mcmod.info")
162 | }
163 | }
164 | }
165 |
166 | // Configures our shadow/shade configuration, so we can
167 | // include some dependencies within our mod jar file.
168 | named("shadowJar") {
169 | archiveClassifier.set("dev") // TODO: machete gets confused by the `dev` prefix.
170 | configurations = listOf(shade)
171 | duplicatesStrategy = DuplicatesStrategy.EXCLUDE
172 | }
173 |
174 | remapJar {
175 | inputFile.set(shadowJar.get().archiveFile)
176 | archiveClassifier.set("")
177 | }
178 |
179 | jar {
180 | // Sets the jar manifest attributes.
181 | if (platform.isLegacyForge) {
182 | manifest.attributes += mapOf(
183 | "ModSide" to "CLIENT", // We aren't developing a server-side mod, so this is fine.
184 | "ForceLoadAsMod" to true, // We want to load this jar as a mod, so we force Forge to do so.
185 | "TweakOrder" to "0", // Makes sure that the OneConfig launch wrapper is loaded as soon as possible.
186 | "MixinConfigs" to "mixins.${mod_id}.json", // We want to use our mixin configuration, so we specify it here.
187 | "TweakClass" to "cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker" // Loads the OneConfig launch wrapper.
188 | )
189 | }
190 | dependsOn(shadowJar)
191 | archiveClassifier.set("")
192 | enabled = false
193 | }
194 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | mod_name=DamageTint
2 | mod_archives_name=DamageTint
3 | mod_id=damagetint
4 | mod_version=3.3.0
5 |
6 | # Gradle Configuration -- DO NOT TOUCH THESE VALUES.
7 | polyfrost.defaults.loom=1
8 | org.gradle.daemon=true
9 | org.gradle.parallel=true
10 | org.gradle.configureoncommand=true
11 | org.gradle.parallel.threads=4
12 | org.gradle.jvmargs=-Xmx2G
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Polyfrost/DamageTint/775a775f4c852ae92c2774330b6e06896fa271c6/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/root.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | kotlin("jvm") version "1.8.22" apply false
3 | id("org.polyfrost.multi-version.root")
4 | id("com.github.johnrengelman.shadow") version "7.1.2" apply false
5 | }
6 |
7 | preprocess {
8 | "1.8.9-forge"(10809, "srg") {}
9 | }
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | @file:Suppress("PropertyName")
2 |
3 | pluginManagement {
4 | repositories {
5 | gradlePluginPortal()
6 | mavenCentral()
7 | maven("https://repo.polyfrost.org/releases") // Adds the Polyfrost maven repository to get Polyfrost Gradle Toolkit
8 | }
9 | plugins {
10 | val pgtVersion = "0.2.9" // Sets the default versions for Polyfrost Gradle Toolkit
11 | id("org.polyfrost.multi-version.root") version pgtVersion
12 | }
13 | }
14 |
15 | val mod_name: String by settings
16 |
17 | // Configures the root project Gradle name based on the value in `gradle.properties`
18 | rootProject.name = mod_name
19 | rootProject.buildFileName = "root.gradle.kts"
20 |
21 | // Adds all of our build target versions to the classpath if we need to add version-specific code.
22 | listOf(
23 | "1.8.9-forge" // Update this if you want to remove/add a version, along with `build.gradle.kts` and `root.gradle.kts`.
24 | ).forEach { version ->
25 | include(":$version")
26 | project(":$version").apply {
27 | projectDir = file("versions/$version")
28 | buildFileName = "../../build.gradle.kts"
29 | }
30 | }
--------------------------------------------------------------------------------
/src/main/java/org/polyfrost/damagetint/DamageTint.java:
--------------------------------------------------------------------------------
1 | package org.polyfrost.damagetint;
2 |
3 | import cc.polyfrost.oneconfig.utils.commands.CommandManager;
4 | import net.minecraftforge.fml.common.Mod;
5 | import net.minecraftforge.fml.common.event.FMLInitializationEvent;
6 | import org.polyfrost.damagetint.command.DamageTintCommand;
7 | import org.polyfrost.damagetint.config.DamageTintConfig;
8 |
9 | @Mod(name = DamageTint.NAME, version = DamageTint.VER, modid = DamageTint.ID)
10 | public class DamageTint {
11 | public static final String NAME = "@NAME@", VER = "@VER@", ID = "@ID@";
12 | public static DamageTintConfig config;
13 |
14 | @Mod.EventHandler
15 | protected void onInitialization(FMLInitializationEvent event) {
16 | config = new DamageTintConfig();
17 | CommandManager.INSTANCE.registerCommand(new DamageTintCommand());
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/org/polyfrost/damagetint/command/DamageTintCommand.java:
--------------------------------------------------------------------------------
1 | package org.polyfrost.damagetint.command;
2 |
3 | import cc.polyfrost.oneconfig.utils.commands.annotations.Command;
4 | import cc.polyfrost.oneconfig.utils.commands.annotations.Main;
5 | import org.polyfrost.damagetint.DamageTint;
6 |
7 | @Command("damagetint")
8 | public class DamageTintCommand {
9 | @Main
10 | public void handle() {
11 | DamageTint.config.openGui();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/org/polyfrost/damagetint/config/DamageTintConfig.java:
--------------------------------------------------------------------------------
1 | package org.polyfrost.damagetint.config;
2 |
3 | import cc.polyfrost.oneconfig.config.Config;
4 | import cc.polyfrost.oneconfig.config.annotations.Button;
5 | import cc.polyfrost.oneconfig.config.annotations.Color;
6 | import cc.polyfrost.oneconfig.config.annotations.Exclude;
7 | import cc.polyfrost.oneconfig.config.annotations.Switch;
8 | import cc.polyfrost.oneconfig.config.core.OneColor;
9 | import cc.polyfrost.oneconfig.config.data.Mod;
10 | import cc.polyfrost.oneconfig.config.data.ModType;
11 | import cc.polyfrost.oneconfig.config.migration.VigilanceMigrator;
12 | import net.minecraft.client.Minecraft;
13 | import org.polyfrost.damagetint.DamageTint;
14 |
15 | import java.io.File;
16 |
17 | public class DamageTintConfig extends Config {
18 |
19 | @Exclude private static final int defaultColor = 1291780096;
20 |
21 | @Color(
22 | name = "Damage Tint Colour"
23 | )
24 | public static OneColor color = new OneColor(defaultColor);
25 |
26 | @Button(
27 | name = "Reset Damage Tint",
28 | text = "Reset Color"
29 | )
30 | Runnable resetColor = (() -> {
31 | color = new OneColor(defaultColor);
32 | save();
33 | openGui();
34 | });
35 |
36 | @Switch(
37 | name = "Fade Out Damage Tint"
38 | )
39 | public static boolean fade = false;
40 |
41 | @Exclude private static final File oldModDir = new File(new File(Minecraft.getMinecraft().mcDataDir, "W-OVERFLOW"), "DamageTint");
42 |
43 | public DamageTintConfig() {
44 | super(new Mod(DamageTint.NAME, ModType.UTIL_QOL, "/damagetint_dark.svg", new VigilanceMigrator(new File(oldModDir, "damagetint.toml").getPath())), "damagetint.json");
45 | initialize();
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/org/polyfrost/damagetint/mixin/RendererLivingEntityMixin.java:
--------------------------------------------------------------------------------
1 | package org.polyfrost.damagetint.mixin;
2 |
3 | import cc.polyfrost.oneconfig.utils.color.ColorUtils;
4 | import net.minecraft.client.renderer.entity.RendererLivingEntity;
5 | import net.minecraft.entity.EntityLivingBase;
6 | import org.polyfrost.damagetint.DamageTint;
7 | import org.polyfrost.damagetint.config.DamageTintConfig;
8 | import org.spongepowered.asm.mixin.Mixin;
9 | import org.spongepowered.asm.mixin.Unique;
10 | import org.spongepowered.asm.mixin.injection.At;
11 | import org.spongepowered.asm.mixin.injection.Inject;
12 | import org.spongepowered.asm.mixin.injection.ModifyArg;
13 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
14 |
15 | @Mixin(RendererLivingEntity.class)
16 | public class RendererLivingEntityMixin {
17 | @Unique
18 | private EntityLivingBase damageTint$entitylivingbaseIn;
19 |
20 | @Inject(method = "setBrightness", at = @At("HEAD"))
21 | private void set(EntityLivingBase entitylivingbaseIn, float partialTicks, boolean combineTextures, CallbackInfoReturnable cir) {
22 | damageTint$entitylivingbaseIn = entitylivingbaseIn;
23 | }
24 |
25 | @ModifyArg(method = "setBrightness", at = @At(value = "INVOKE", target = "Ljava/nio/FloatBuffer;put(F)Ljava/nio/FloatBuffer;", ordinal = 0))
26 | private float getRedTint(float f) {
27 | if (DamageTint.config.enabled) {
28 | return ((float) ColorUtils.getRed(DamageTintConfig.color.getRGB())) / 255f;
29 | }
30 | return f;
31 | }
32 |
33 | @ModifyArg(method = "setBrightness", at = @At(value = "INVOKE", target = "Ljava/nio/FloatBuffer;put(F)Ljava/nio/FloatBuffer;", ordinal = 1))
34 | private float getGreenTint(float f) {
35 | if (DamageTint.config.enabled) {
36 | return ((float) ColorUtils.getGreen(DamageTintConfig.color.getRGB())) / 255f;
37 | }
38 | return f;
39 | }
40 |
41 | @ModifyArg(method = "setBrightness", at = @At(value = "INVOKE", target = "Ljava/nio/FloatBuffer;put(F)Ljava/nio/FloatBuffer;", ordinal = 2))
42 | private float getBlueTint(float f) {
43 | if (DamageTint.config.enabled) {
44 | return ((float) ColorUtils.getBlue(DamageTintConfig.color.getRGB())) / 255f;
45 | }
46 | return f;
47 | }
48 |
49 | @ModifyArg(method = "setBrightness", at = @At(value = "INVOKE", target = "Ljava/nio/FloatBuffer;put(F)Ljava/nio/FloatBuffer;", ordinal = 3))
50 | private float getAlphaTint(float f) {
51 | if (DamageTint.config.enabled) {
52 | if (DamageTintConfig.fade) {
53 | float percent = 1.0F - (float) damageTint$entitylivingbaseIn.hurtTime / (float) damageTint$entitylivingbaseIn.maxHurtTime;
54 | percent = percent < 0.5F ? percent / 0.5F : (1.0F - percent) / 0.5F;
55 | return (float) ColorUtils.getAlpha(DamageTintConfig.color.getRGB()) * percent / 255.0F;
56 | } else {
57 | return (float) ColorUtils.getAlpha(DamageTintConfig.color.getRGB()) / 255.0F;
58 | }
59 | }
60 | return f;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/resources/damagetint_dark.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/main/resources/mcmod.info:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modid": "${id}",
4 | "name": "${name}",
5 | "description": "A mod which changes the color of entities that are hurt.",
6 | "version": "${version}",
7 | "mcversion": "1.8.9",
8 | "url": "",
9 | "updateUrl": "",
10 | "authorList": [
11 | "Polyfrost"
12 | ],
13 | "credits": "",
14 | "logoFile": "",
15 | "screenshots": [],
16 | "dependencies": []
17 | }
18 | ]
--------------------------------------------------------------------------------
/src/main/resources/mixins.damagetint.json:
--------------------------------------------------------------------------------
1 | {
2 | "compatibilityLevel": "JAVA_8",
3 | "minVersion": "0.7",
4 | "package": "org.polyfrost.damagetint.mixin",
5 | "refmap": "mixins.damagetint.refmap.json",
6 | "mixins": [
7 | "RendererLivingEntityMixin"
8 | ]
9 | }
--------------------------------------------------------------------------------
/versions/mainProject:
--------------------------------------------------------------------------------
1 | 1.8.9-forge
--------------------------------------------------------------------------------