diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2cad236..2b40a6e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,13 +5,12 @@ # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle -name: Build GlowingEyes for forge/1.19.2 - +name: Build GlowingEyes for forge/1.20.1 on: push: - branches: [ "forge/1.19.2" ] + branches: [ "forge/1.20.1" ] pull_request: - branches: [ "forge/1.19.2" ] + branches: [ "forge/1.20.1" ] jobs: build: @@ -54,6 +53,8 @@ jobs: # # - name: Build with Gradle 8.5 # run: gradle build + # + # hi dependency-submission: diff --git a/.gitignore b/.gitignore index a5d88b3..3572e68 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,118 @@ -# eclipse -bin -*.launch -.settings -.metadata -.classpath -.project - -# idea -out +# User-specific stuff +.idea/ + +*.iml *.ipr *.iws -*.iml -.idea -# gradle -build +# IntelliJ +out/ +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + .gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Cache of project +.gradletasknamecache + +**/build/ -# other -eclipse -run -run_server +# Common working directory +run*/ -# Files from Forge MDK -forge*changelog.txt +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar diff --git a/LICENSE b/LICENSE index f288702..8eb8b32 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,189 @@ +Copyright (c) 2024 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +and a copy of GNU General Public License along with this program. If not, see + + + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. + GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -631,8 +813,8 @@ to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - - Copyright (C) + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -645,14 +827,14 @@ the "copyright" line and a pointer to where the full notice is found. GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - Copyright (C) + {project} Copyright (C) {year} {fullname} This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @@ -664,11 +846,12 @@ might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -. +. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. +. + diff --git a/build.gradle b/build.gradle index c9ed836..c9c15b4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,22 +1,23 @@ + plugins { id 'eclipse' id 'idea' - id 'maven-publish' id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'org.parchmentmc.librarian.forgegradle' version '1.+' } -version = mod_version + group = mod_group_id +version = mod_version base { archivesName = mod_id } -// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. -java.toolchain.languageVersion = JavaLanguageVersion.of(17) +java { + toolchain.languageVersion = JavaLanguageVersion.of(17) +} -println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { // The mappings can be changed at any time and must be in the following format. // Channel: Version: @@ -27,14 +28,13 @@ minecraft { // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md // // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge - // Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started + // Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started // // Use non-default mappings at your own risk. They may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. mappings channel: mapping_channel, version: mapping_version // When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game. - // In most cases, it is not necessary to enable. // enableEclipsePrepareRuns = true // enableIdeaPrepareRuns = true @@ -70,14 +70,12 @@ minecraft { // "REGISTRYDUMP": For getting the contents of all registries. property 'forge.logging.markers', 'REGISTRIES' + // Recommended logging level for the console // You can set various levels here. // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels property 'forge.logging.console.level', 'debug' - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - property 'forge.enabledGameTestNamespaces', mod_id - mods { "${mod_id}" { source sourceSets.main @@ -90,11 +88,6 @@ minecraft { property 'forge.enabledGameTestNamespaces', mod_id } - client2 { - parent runs.client - args '--username', "Dev2" - } - server { property 'forge.enabledGameTestNamespaces', mod_id args '--nogui' @@ -124,7 +117,8 @@ repositories { // Put repositories for dependencies here // ForgeGradle automatically adds the Forge maven and Maven Central for you - // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: + // If you have mod jar dependencies in ./libs, you can declare them as a repository like so. + // See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver // flatDir { // dir 'libs' // } @@ -138,10 +132,11 @@ dependencies { // then special handling is done to allow a setup of a vanilla dependency without the use of an external repository. minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" - // Real mod deobf dependency examples - these get remapped to your current mappings - // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency - // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency - // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency + // Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings + // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime + // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}") + // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}") + // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}") // Example mod dependency using a mod jar from ./libs with a flat dir repository // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar @@ -165,51 +160,31 @@ tasks.named('processResources', ProcessResources).configure { mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, mod_authors: mod_authors, mod_description: mod_description, ] + inputs.properties replaceProperties filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { expand replaceProperties + [project: project] - } -} + }} // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar).configure { manifest { attributes([ - 'Specification-Title' : mod_id, - 'Specification-Vendor' : mod_authors, - 'Specification-Version' : '1', // We are version 1 of ourselves - 'Implementation-Title' : project.name, - 'Implementation-Version' : project.jar.archiveVersion, - 'Implementation-Vendor' : mod_authors, - 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + "Specification-Title": mod_id, + "Specification-Vendor": mod_authors, + "Specification-Version": "1", // We are version 1 of ourselves + "Implementation-Title": project.name, + "Implementation-Version": project.jar.archiveVersion, + "Implementation-Vendor": mod_authors, + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } - archiveFileName = "GlowingEyes-${minecraft_version}-${project.version}.jar" - // This is the preferred method to reobfuscate your jar file finalizedBy 'reobfJar' } -// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing: -// tasks.named('publish').configure { -// dependsOn 'reobfJar' -// } - -publishing { - publications { - register('mavenJava', MavenPublication) { - artifact jar - } - } - repositories { - maven { - url "file://${project.projectDir}/mcmodsrepo" - } - } -} - tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation } diff --git a/gradle.properties b/gradle.properties index fa4ca2a..0aae64f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,23 +1,23 @@ # 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 +org.gradle.jvmargs=-Xmx5G +org.gradle.daemon=true ## Environment Properties # The Minecraft version must agree with the Forge version to get a valid artifact -minecraft_version=1.19.2 +minecraft_version=1.20.1 # The Minecraft version range can use any release version of Minecraft as bounds. # Snapshots, pre-releases, and release candidates are not guaranteed to sort properly # as they do not follow standard versioning conventions. -minecraft_version_range=[1.19.2,1.20) +minecraft_version_range=[1.20.1,1.21) # The Forge version must agree with the Minecraft version to get a valid artifact -forge_version=43.3.8 +forge_version=47.2.30 # The Forge version range can use any version of Forge as bounds or match the loader version range -forge_version_range=[43,) +forge_version_range=[47,) # The loader version range can only use the major version of Forge/FML as bounds -loader_version_range=[43,) +loader_version_range=[47,) # The mapping channel to use for mappings. # The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"]. # Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin. @@ -35,7 +35,7 @@ loader_version_range=[43,) mapping_channel=parchment # The mapping version to query from the mapping channel. # This must match the format required by the mapping channel. -mapping_version=2022.08.14-1.19.2 +mapping_version=2023.09.03-1.20.1 ## Mod Properties diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e583..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 fae0804..37aef8d 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-8.1.1-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index a69d9cb..aeb74cb 100644 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# 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/. @@ -80,13 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -143,12 +140,16 @@ 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 @@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/gradlew.bat b/gradlew.bat index f127cfd..93e3f59 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/settings.gradle b/settings.gradle index bb93556..213aea2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -5,10 +5,14 @@ pluginManagement { name = 'MinecraftForge' url = 'https://maven.minecraftforge.net/' } - maven { url = 'https://maven.parchmentmc.org' } + repositories { + maven { url = 'https://maven.parchmentmc.org' } // Add this line + } } } plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' } + +rootProject.name = 'glowingeyes' diff --git a/src/main/java/me/andreasmelone/glowingeyes/GlowingEyes.java b/src/main/java/me/andreasmelone/glowingeyes/GlowingEyes.java index eaba117..83e3dc4 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/GlowingEyes.java +++ b/src/main/java/me/andreasmelone/glowingeyes/GlowingEyes.java @@ -1,16 +1,13 @@ package me.andreasmelone.glowingeyes; -import me.andreasmelone.glowingeyes.common.GlowingEyesEvents; -import me.andreasmelone.glowingeyes.common.capability.data.PlayerDataCapability; -import me.andreasmelone.glowingeyes.common.capability.data.PlayerDataHandler; -import me.andreasmelone.glowingeyes.common.capability.eyes.GlowingEyesCapability; -import me.andreasmelone.glowingeyes.common.capability.eyes.GlowingEyesHandler; -import me.andreasmelone.glowingeyes.common.packets.PacketManager; -import me.andreasmelone.glowingeyes.common.scheduler.CodeScheduler; -import me.andreasmelone.glowingeyes.common.scheduler.Scheduler; +import me.andreasmelone.glowingeyes.server.GlowingEyesEvents; +import me.andreasmelone.glowingeyes.server.capability.data.PlayerDataCapability; +import me.andreasmelone.glowingeyes.server.capability.data.PlayerDataHandler; +import me.andreasmelone.glowingeyes.server.capability.eyes.GlowingEyesCapability; +import me.andreasmelone.glowingeyes.server.capability.eyes.GlowingEyesHandler; +import me.andreasmelone.glowingeyes.server.packets.PacketManager; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import com.mojang.logging.LogUtils; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; diff --git a/src/main/java/me/andreasmelone/glowingeyes/client/GlowingEyesClient.java b/src/main/java/me/andreasmelone/glowingeyes/client/GlowingEyesClient.java index 3341764..007e0b9 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/client/GlowingEyesClient.java +++ b/src/main/java/me/andreasmelone/glowingeyes/client/GlowingEyesClient.java @@ -4,8 +4,8 @@ import me.andreasmelone.glowingeyes.GlowingEyes; import me.andreasmelone.glowingeyes.client.presets.PresetManager; import me.andreasmelone.glowingeyes.client.render.RenderManager; -import me.andreasmelone.glowingeyes.common.scheduler.CodeScheduler; -import me.andreasmelone.glowingeyes.common.scheduler.Scheduler; +import me.andreasmelone.glowingeyes.server.scheduler.CodeScheduler; +import me.andreasmelone.glowingeyes.server.scheduler.Scheduler; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.RegisterKeyMappingsEvent; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/me/andreasmelone/glowingeyes/client/GlowingEyesClientEvents.java b/src/main/java/me/andreasmelone/glowingeyes/client/GlowingEyesClientEvents.java index 30f4ad7..45c0b9f 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/client/GlowingEyesClientEvents.java +++ b/src/main/java/me/andreasmelone/glowingeyes/client/GlowingEyesClientEvents.java @@ -1,7 +1,7 @@ package me.andreasmelone.glowingeyes.client; import me.andreasmelone.glowingeyes.client.gui.EyesEditorScreen; -import me.andreasmelone.glowingeyes.common.capability.eyes.GlowingEyesCapability; +import me.andreasmelone.glowingeyes.server.capability.eyes.GlowingEyesCapability; import net.minecraft.client.Minecraft; import net.minecraft.world.entity.player.Player; import net.minecraftforge.event.TickEvent; diff --git a/src/main/java/me/andreasmelone/glowingeyes/client/gui/ColorPickerScreen.java b/src/main/java/me/andreasmelone/glowingeyes/client/gui/ColorPickerScreen.java index 187bdc2..3b4b749 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/client/gui/ColorPickerScreen.java +++ b/src/main/java/me/andreasmelone/glowingeyes/client/gui/ColorPickerScreen.java @@ -6,12 +6,12 @@ import me.andreasmelone.glowingeyes.client.util.ColorUtil; import me.andreasmelone.glowingeyes.client.util.GuiUtil; import me.andreasmelone.glowingeyes.client.util.TextureLocations; -import me.andreasmelone.glowingeyes.common.util.Util; +import me.andreasmelone.glowingeyes.server.util.Util; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.EditBox; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -import org.lwjgl.glfw.GLFW; import java.awt.*; import java.util.function.Consumer; @@ -44,7 +44,7 @@ public ColorPickerScreen(Screen parent) { @Override protected void init() { super.init(); - if(parent != null) parent.init(getMinecraft(), getMinecraft().getWindow().getGuiScaledWidth(), getMinecraft().getWindow().getGuiScaledHeight()); + if(parent != null) parent.init(Minecraft.getInstance(), Minecraft.getInstance().getWindow().getGuiScaledWidth(), Minecraft.getInstance().getWindow().getGuiScaledHeight()); this.guiLeft = (this.width - this.xSize) / 2; this.guiTop = (this.height - this.ySize) / 2; @@ -59,7 +59,7 @@ protected void init() { this.font, this.guiLeft + this.xSize - 50, this.guiTop + 20, 40, 20, - Component.literal(String.valueOf(Util.round((float) ColorUtil.getRedFromRGB(GlowingEyes.DEFAULT_COLOR.getRGB()) / 255))) + Component.empty() // the label should stay uninitialized for now ) ); this.addEditBox( @@ -67,7 +67,7 @@ protected void init() { this.font, this.guiLeft + this.xSize - 50, this.guiTop + 50, 40, 20, - Component.literal(String.valueOf(Util.round((float) ColorUtil.getGreenFromRGB(GlowingEyes.DEFAULT_COLOR.getRGB()) / 255))) + Component.empty() ) ); this.addEditBox( @@ -75,7 +75,7 @@ protected void init() { this.font, this.guiLeft + this.xSize - 50, this.guiTop + 80, 40, 20, - Component.literal(String.valueOf(Util.round((float) ColorUtil.getBlueFromRGB(GlowingEyes.DEFAULT_COLOR.getRGB()) / 255))) + Component.empty() ) ); @@ -88,36 +88,34 @@ protected void init() { } @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float delta) { if(parent != null) { - parent.render(poseStack, mouseX, mouseY, delta); + parent.render(guiGraphics, mouseX, mouseY, delta); } - this.renderBackground(poseStack); - GuiUtil.drawBackground(poseStack, + this.renderBackground(guiGraphics); + GuiUtil.drawBackground(guiGraphics, TextureLocations.UI_BACKGROUND_SLIM_LONG, this.guiLeft, this.guiTop, this.xSize, this.ySize); // draw the selected color on the right bottom - fill( - poseStack, + guiGraphics.fill( this.guiLeft + this.xSize - 40, this.guiTop + this.ySize - 40, this.guiLeft + this.xSize - 15, this.guiTop + this.ySize - 15, selectedColor ); - WheelRenderer.renderColorWheel(poseStack, colorWheelX, colorWheelY); - renderCursor(poseStack); + WheelRenderer.renderColorWheel(guiGraphics, colorWheelX, colorWheelY); + renderCursor(guiGraphics); int selectedColorBrightened = ColorUtil.getRGBFromBrightness(selectedColor, 1.0f); - fillGradient( - poseStack, + guiGraphics.fillGradient( brightnessSliderX, brightnessSliderY, brightnessSliderX + 30, brightnessSliderY + 100, selectedColorBrightened, Color.BLACK.getRGB() ); - renderBrightnessCursor(poseStack); + renderBrightnessCursor(guiGraphics); - super.render(poseStack, mouseX, mouseY, delta); + super.render(guiGraphics, mouseX, mouseY, delta); } @Override @@ -145,11 +143,11 @@ public boolean isPauseScreen() { @Override public void onClose() { if(parent != null) { - getMinecraft().setScreen(parent); + Minecraft.getInstance().setScreen(parent); parent.init( - getMinecraft(), - getMinecraft().getWindow().getGuiScaledWidth(), - getMinecraft().getWindow().getGuiScaledHeight() + Minecraft.getInstance(), + Minecraft.getInstance().getWindow().getGuiScaledWidth(), + Minecraft.getInstance().getWindow().getGuiScaledHeight() ); } } @@ -226,14 +224,13 @@ else if (editBox == blue) }; } - private void renderCursor(PoseStack poseStack) { + private void renderCursor(GuiGraphics guiGraphics) { // the x and y are relative to the color wheel, we need to get the position relative to this whole screen int relativeX = (int) (selectedX / WheelRenderer.SCALE) + colorWheelX; int relativeY = (int) (selectedY / WheelRenderer.SCALE) + colorWheelY; - RenderSystem.setShaderTexture(0, TextureLocations.CURSOR); - blit( - poseStack, + guiGraphics.blit( + TextureLocations.CURSOR, relativeX - 3, relativeY - 3, 0, 0, 8, 8, @@ -241,12 +238,11 @@ private void renderCursor(PoseStack poseStack) { ); } - private void renderBrightnessCursor(PoseStack poseStack) { + private void renderBrightnessCursor(GuiGraphics guiGraphics) { int relativeY = (int) (brightnessSliderY + (1 - WheelRenderer.brightness) * 100); - RenderSystem.setShaderTexture(0, TextureLocations.BRIGHTNESS_CURSOR); - blit( - poseStack, + guiGraphics.blit( + TextureLocations.BRIGHTNESS_CURSOR, colorWheelX + 118, relativeY - 1, 34,4, 0, 0, diff --git a/src/main/java/me/andreasmelone/glowingeyes/client/gui/EyesEditorScreen.java b/src/main/java/me/andreasmelone/glowingeyes/client/gui/EyesEditorScreen.java index e489c35..fe124e5 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/client/gui/EyesEditorScreen.java +++ b/src/main/java/me/andreasmelone/glowingeyes/client/gui/EyesEditorScreen.java @@ -1,14 +1,13 @@ package me.andreasmelone.glowingeyes.client.gui; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.logging.LogUtils; import me.andreasmelone.glowingeyes.client.gui.preset.PresetsScreen; import me.andreasmelone.glowingeyes.client.util.ColorUtil; import me.andreasmelone.glowingeyes.client.util.GuiUtil; import me.andreasmelone.glowingeyes.client.util.TextureLocations; -import me.andreasmelone.glowingeyes.common.capability.eyes.GlowingEyesCapability; -import net.minecraft.client.gui.Gui; +import me.andreasmelone.glowingeyes.server.capability.eyes.GlowingEyesCapability; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.ImageButton; import net.minecraft.client.gui.screens.Screen; @@ -42,7 +41,7 @@ protected void init() { this.guiTop = (this.height - this.ySize) / 2; AtomicBoolean saved = new AtomicBoolean(false); - Player player = getMinecraft().player; + Player player = Minecraft.getInstance().player; if(player != null) { pixels = GlowingEyesCapability.getGlowingEyesMap(player); saved.set(true); @@ -58,7 +57,7 @@ protected void init() { 0, 0, 20, TextureLocations.COLOR_PICKER_BUTTON, 64, 64, - button -> getMinecraft().setScreen(new ColorPickerScreen(this)) + button -> Minecraft.getInstance().setScreen(new ColorPickerScreen(this)) )); // the preset menu button @@ -69,7 +68,7 @@ protected void init() { TextureLocations.PRESET_MENU_BUTTON, 64, 64, button -> { - getMinecraft().setScreen(new PresetsScreen(this)); + Minecraft.getInstance().setScreen(new PresetsScreen(this)); } )); @@ -122,16 +121,16 @@ protected void init() { /** * The method that renders the screen - * @param poseStack The PoseStack, a stack of transformations to apply to the rendering + * @param guiGraphics The guiGraphics object that handles rendering * @param mouseX The x position of the mouse * @param mouseY The y position of the mouse * @param deltaTime The time since the last frame */ @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float deltaTime) { - renderBackground(poseStack); + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float deltaTime) { + renderBackground(guiGraphics); - GuiUtil.drawBackground(poseStack, + GuiUtil.drawBackground(guiGraphics, TextureLocations.UI_BACKGROUND_BROAD, this.guiLeft, this.guiTop, this.xSize, this.ySize); int spaceBetweenPixels = 2; @@ -143,20 +142,17 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float deltaTime) endHeadX = headX + headSize * pixelSize + (headSize - 1) * spaceBetweenPixels; endHeadY = headY + headSize * pixelSize + (headSize - 1) * spaceBetweenPixels; - fill( - poseStack, + guiGraphics.fill( headX - spaceBetweenPixels, headY - spaceBetweenPixels, endHeadX + spaceBetweenPixels, endHeadY + spaceBetweenPixels, new Color(160, 160, 160, 255).getRGB() ); - RenderSystem.setShaderTexture(0, getMinecraft().player.getSkinTextureLocation()); - for (int y = 0; y < headSize; y++) { for (int x = 0; x < headSize; x++) { Point point = new Point(x, y); - Gui.blit( - poseStack, + guiGraphics.blit( + Minecraft.getInstance().player.getSkinTextureLocation(), headX + x * pixelSize + x * spaceBetweenPixels, headY + y * pixelSize + y * spaceBetweenPixels, pixelSize, @@ -167,8 +163,7 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float deltaTime) ); if(pixels.containsKey(point)) { - fill( - poseStack, + guiGraphics.fill( headX + x * pixelSize + x * spaceBetweenPixels, headY + y * pixelSize + y * spaceBetweenPixels, headX + x * pixelSize + x * spaceBetweenPixels + pixelSize, @@ -178,8 +173,8 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float deltaTime) } if(displaySecondLayer) { - Gui.blit( - poseStack, + guiGraphics.blit( + Minecraft.getInstance().player.getSkinTextureLocation(), headX + x * pixelSize + x * spaceBetweenPixels, headY + y * pixelSize + y * spaceBetweenPixels, pixelSize, @@ -192,7 +187,7 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float deltaTime) } } - super.render(poseStack, mouseX, mouseY, deltaTime); + super.render(guiGraphics, mouseX, mouseY, deltaTime); } @Override @@ -222,8 +217,8 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { float[] pixel = new float[4]; - double scaleX = (double) getMinecraft().getWindow().getWidth() / (double) getMinecraft().getWindow().getGuiScaledWidth(); - double scaleY = (double) getMinecraft().getWindow().getHeight() / (double) getMinecraft().getWindow().getGuiScaledHeight(); + double scaleX = (double) Minecraft.getInstance().getWindow().getWidth() / (double) Minecraft.getInstance().getWindow().getGuiScaledWidth(); + double scaleY = (double) Minecraft.getInstance().getWindow().getHeight() / (double) Minecraft.getInstance().getWindow().getGuiScaledHeight(); GL11.glReadPixels( (int)(mouseX * scaleX), (int) (mouseY * scaleY), @@ -250,7 +245,7 @@ public boolean mouseDragged(double mouseX, double mouseY, int button, double dra @Override public void onClose() { AtomicBoolean saved = new AtomicBoolean(false); - Player player = getMinecraft().player; + Player player = Minecraft.getInstance().player; if(player != null) { GlowingEyesCapability.setGlowingEyesMap(player, pixels); saved.set(true); @@ -270,9 +265,9 @@ public boolean isPauseScreen() { public void openAsParent() { this.pixels.clear(); - this.pixels.putAll(GlowingEyesCapability.getGlowingEyesMap(getMinecraft().player)); + this.pixels.putAll(GlowingEyesCapability.getGlowingEyesMap(Minecraft.getInstance().player)); - getMinecraft().setScreen(this); + Minecraft.getInstance().setScreen(this); } Mode mode = Mode.BRUSH; diff --git a/src/main/java/me/andreasmelone/glowingeyes/client/gui/WheelRenderer.java b/src/main/java/me/andreasmelone/glowingeyes/client/gui/WheelRenderer.java index 94e702b..be064ad 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/client/gui/WheelRenderer.java +++ b/src/main/java/me/andreasmelone/glowingeyes/client/gui/WheelRenderer.java @@ -5,13 +5,12 @@ import com.mojang.blaze3d.vertex.PoseStack; import me.andreasmelone.glowingeyes.GlowingEyes; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.NotNull; import java.awt.*; -import java.io.IOException; public class WheelRenderer { public static float brightness = 1.0f; @@ -19,11 +18,11 @@ public class WheelRenderer { public final static float SCALE = (WHEEL_RADIUS / 100.0f) * 2; static ResourceLocation colorWheel = null; - public static void renderColorWheel(PoseStack posestack, int colorWheelX, int colorWheelY) { - renderColorWheel(posestack, colorWheelX, colorWheelY, 100, 100); + public static void renderColorWheel(GuiGraphics guiGraphics, int colorWheelX, int colorWheelY) { + renderColorWheel(guiGraphics, colorWheelX, colorWheelY, 100, 100); } - public static void renderColorWheel(PoseStack posestack, int colorWheelX, int colorWheelY, + public static void renderColorWheel(GuiGraphics guiGraphics, int colorWheelX, int colorWheelY, int colorWheelWidth, int colorWheelHeight) { if(colorWheel == null) { NativeImage image = getNativeImage(); @@ -31,11 +30,10 @@ public static void renderColorWheel(PoseStack posestack, int colorWheelX, int co GlowingEyes.MOD_ID + ".color_wheel", new DynamicTexture(image) ); System.out.println("Registered color wheel"); - renderColorWheel(posestack, colorWheelX, colorWheelY, colorWheelWidth, colorWheelHeight); + renderColorWheel(guiGraphics, colorWheelX, colorWheelY, colorWheelWidth, colorWheelHeight); } else { - RenderSystem.setShaderTexture(0, colorWheel); - GuiComponent.blit( - posestack, + guiGraphics.blit( + colorWheel, colorWheelX, colorWheelY, 0, 0, colorWheelWidth, colorWheelHeight, diff --git a/src/main/java/me/andreasmelone/glowingeyes/client/gui/button/BigSelectableButton.java b/src/main/java/me/andreasmelone/glowingeyes/client/gui/button/BigSelectableButton.java index 5303d16..0490330 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/client/gui/button/BigSelectableButton.java +++ b/src/main/java/me/andreasmelone/glowingeyes/client/gui/button/BigSelectableButton.java @@ -4,21 +4,25 @@ import com.mojang.blaze3d.vertex.PoseStack; import me.andreasmelone.glowingeyes.client.util.TextureLocations; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.network.chat.Component; +import net.minecraft.util.FormattedCharSequence; + +import java.util.function.Supplier; public class BigSelectableButton extends Button { private boolean isSelected = false; public BigSelectableButton(int x, int y, Component buttonText, OnPress pressedAction) { - super(x, y, 128, 29, buttonText, pressedAction); + super(x, y, 128, 29, buttonText, pressedAction, Supplier::get); } @Override - public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTicks) { + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { if(this.visible) { - RenderSystem.setShaderTexture(0, TextureLocations.BIG_BUTTON); - boolean flag = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height; + boolean flag = mouseX >= this.getX() && mouseY >= this.getY() + && mouseX < this.getX() + this.width && mouseY < this.getY() + this.height; int i = 0; if(flag) { @@ -29,20 +33,20 @@ public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float part } - blit( - poseStack, - this.x, this.y, + guiGraphics.blit( + TextureLocations.BIG_BUTTON, + this.getX(), this.getY(), 0, i, 128, 29, 128, 128 ); Minecraft mc = Minecraft.getInstance(); - mc.font.draw( - poseStack, + guiGraphics.drawString( + mc.font, this.getMessage(), - this.x + (float) this.width / 2 - (float) mc.font.width(this.getMessage()) / 2, - this.y + (float) (this.height - 8) / 2, + this.getX() + this.width / 2 - mc.font.width(this.getMessage()) / 2, + this.getY() + (this.height - 8) / 2, 0xFFFFFF ); } diff --git a/src/main/java/me/andreasmelone/glowingeyes/client/gui/preset/ConfirmDeletionScreen.java b/src/main/java/me/andreasmelone/glowingeyes/client/gui/preset/ConfirmDeletionScreen.java index e0208b0..16d099c 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/client/gui/preset/ConfirmDeletionScreen.java +++ b/src/main/java/me/andreasmelone/glowingeyes/client/gui/preset/ConfirmDeletionScreen.java @@ -1,16 +1,12 @@ package me.andreasmelone.glowingeyes.client.gui.preset; -import com.mojang.blaze3d.platform.GlStateManager; -import com.mojang.blaze3d.vertex.PoseStack; import me.andreasmelone.glowingeyes.client.util.GuiUtil; import me.andreasmelone.glowingeyes.client.util.TextureLocations; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.FormattedText; -import net.minecraft.network.chat.Style; -import net.minecraft.util.FormattedCharSequence; -import org.apache.logging.log4j.core.config.builder.api.ComponentBuilder; import java.util.List; import java.util.concurrent.CompletableFuture; @@ -45,61 +41,56 @@ public void init() { labelComponent = Component.empty(); - this.addRenderableWidget(new Button( - this.guiLeft + 20, this.guiTop + 100, - 80 - 5, 20, + this.addRenderableWidget(Button.builder( Component.translatable("gui.confirm"), button -> { if(this.future != null) { this.future.complete(true); } if(this.parent != null) { - this.getMinecraft().setScreen(this.parent); + Minecraft.getInstance().setScreen(this.parent); } } - )); - this.addRenderableWidget(new Button( - this.guiLeft + 100 + (5 * 2), this.guiTop + 100, - 80 - 5, 20, + ).pos(this.guiLeft + 20, this.guiTop + 100).size(80 - 5, 20).build()); + this.addRenderableWidget(Button.builder( Component.translatable("gui.cancel"), button -> { if(this.future != null) { this.future.complete(false); } if(this.parent != null) { - this.getMinecraft().setScreen(this.parent); + Minecraft.getInstance().setScreen(this.parent); } } - )); + ).pos(this.guiLeft + 100 + (5 * 2), this.guiTop + 100).size(80 - 5, 20).build()); labelComponent = Component.translatable("gui.delete.confirm", this.deletedElement); } @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTicks) { - parent.render(poseStack, mouseX, mouseY, partialTicks); - this.renderBackground(poseStack); + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { + parent.render(guiGraphics, mouseX, mouseY, partialTicks); + this.renderBackground(guiGraphics); GuiUtil.drawBackground( - poseStack, TextureLocations.UI_BACKGROUND_SLIM, + guiGraphics, TextureLocations.UI_BACKGROUND_SLIM, this.guiLeft, this.guiTop, this.xSize, this.ySize ); - drawCenteredString( - poseStack, + guiGraphics.drawCenteredString( this.font, labelComponent, this.middleX, this.middleY - 20, 0xFFFFFF ); - super.render(poseStack, mouseX, mouseY, partialTicks); + super.render(guiGraphics, mouseX, mouseY, partialTicks); } public static CompletableFuture askToDelete(Screen parent, String element) { ConfirmDeletionScreen screen = new ConfirmDeletionScreen(parent); screen.deletedElement = element; - parent.getMinecraft().setScreen(screen); + Minecraft.getInstance().setScreen(screen); CompletableFuture future = new CompletableFuture<>(); screen.future = future; return future; diff --git a/src/main/java/me/andreasmelone/glowingeyes/client/gui/preset/CreatePresetScreen.java b/src/main/java/me/andreasmelone/glowingeyes/client/gui/preset/CreatePresetScreen.java index 6b77ca0..288ea56 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/client/gui/preset/CreatePresetScreen.java +++ b/src/main/java/me/andreasmelone/glowingeyes/client/gui/preset/CreatePresetScreen.java @@ -1,19 +1,16 @@ package me.andreasmelone.glowingeyes.client.gui.preset; -import com.mojang.blaze3d.vertex.PoseStack; -import me.andreasmelone.glowingeyes.GlowingEyes; import me.andreasmelone.glowingeyes.client.presets.PresetManager; import me.andreasmelone.glowingeyes.client.util.GuiUtil; import me.andreasmelone.glowingeyes.client.util.TextureLocations; -import me.andreasmelone.glowingeyes.common.capability.eyes.GlowingEyesCapability; +import me.andreasmelone.glowingeyes.server.capability.eyes.GlowingEyesCapability; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.EditBox; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -import java.io.IOException; - public class CreatePresetScreen extends Screen { int xSize = 200; int ySize = 143; @@ -41,44 +38,40 @@ public void init() { this.xSize - (20 * 2), 20, Component.empty() )); - nameField.setFocus(true); + nameField.setFocused(true); - this.addRenderableWidget(new Button( - this.guiLeft + 20, this.guiTop + 100, - 80 - 5, 20, + this.addRenderableWidget(Button.builder( Component.translatable("gui.create"), button -> { - PresetManager.getInstance().createPreset(nameField.getValue(), GlowingEyesCapability.getGlowingEyesMap(getMinecraft().player)); - getMinecraft().setScreen(parent); + PresetManager.getInstance().createPreset(nameField.getValue(), GlowingEyesCapability.getGlowingEyesMap(Minecraft.getInstance().player)); + Minecraft.getInstance().setScreen(parent); } - )); - this.addRenderableWidget(new Button( - this.guiLeft + 100 + (5 * 2), this.guiTop + 100, - 80 - 5, 20, + ).pos(this.guiLeft + 20, this.guiTop + 100).size(80 - 5, 20).build()); + this.addRenderableWidget(Button.builder( Component.translatable("gui.cancel"), button -> { - getMinecraft().setScreen(parent); + Minecraft.getInstance().setScreen(parent); } - )); + ).pos(this.guiLeft + 100 + (5 * 2), this.guiTop + 100).size(80 - 5, 20).build()); } @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTicks) { - parent.render(poseStack, mouseX, mouseY, partialTicks); - this.renderBackground(poseStack); + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { + parent.render(guiGraphics, mouseX, mouseY, partialTicks); + this.renderBackground(guiGraphics); GuiUtil.drawBackground( - poseStack, TextureLocations.UI_BACKGROUND_SLIM, + guiGraphics, TextureLocations.UI_BACKGROUND_SLIM, this.guiLeft, this.guiTop, this.xSize, this.ySize ); - drawCenteredString( - poseStack, this.font, + guiGraphics.drawCenteredString( + this.font, Component.translatable("gui.create.title"), this.width / 2, this.guiTop + 10, 0xFFFFFF ); - super.render(poseStack, mouseX, mouseY, partialTicks); + super.render(guiGraphics, mouseX, mouseY, partialTicks); } } \ No newline at end of file diff --git a/src/main/java/me/andreasmelone/glowingeyes/client/gui/preset/EditPresetScreen.java b/src/main/java/me/andreasmelone/glowingeyes/client/gui/preset/EditPresetScreen.java index 6acd04a..297727f 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/client/gui/preset/EditPresetScreen.java +++ b/src/main/java/me/andreasmelone/glowingeyes/client/gui/preset/EditPresetScreen.java @@ -4,6 +4,7 @@ import me.andreasmelone.glowingeyes.client.util.GuiUtil; import me.andreasmelone.glowingeyes.client.util.TextureLocations; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.EditBox; import net.minecraft.client.gui.screens.Screen; @@ -44,44 +45,40 @@ protected void init() { this.xSize - (20 * 2), 20, Component.literal(this.elementName) )); - nameField.setFocus(true); + nameField.setFocused(true); // make an "apply" and a cancel button - this.addRenderableWidget(new Button( - this.guiLeft + 20, this.guiTop + 100, - 80 - 5, 20, + this.addRenderableWidget(Button.builder( Component.translatable("gui.apply"), button -> { if(parent != null) { future.complete(nameField.getValue()); - this.getMinecraft().setScreen(parent); + Minecraft.getInstance().setScreen(parent); } } - )); - this.addRenderableWidget(new Button( - this.guiLeft + 100 + (5 * 2), this.guiTop + 100, - 80 - 5, 20, + ).pos(this.guiLeft + 20, this.guiTop + 100).size(80 - 5, 20).build()); + this.addRenderableWidget(Button.builder( Component.translatable("gui.cancel"), button -> { if(parent != null) { - this.getMinecraft().setScreen(parent); + Minecraft.getInstance().setScreen(parent); } } - )); + ).pos(this.guiLeft + 100 + (5 * 2), this.guiTop + 100).size(80 - 5, 20).build()); } @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTicks) { - parent.render(poseStack, mouseX, mouseY, partialTicks); - this.renderBackground(poseStack); + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { + parent.render(guiGraphics, mouseX, mouseY, partialTicks); + this.renderBackground(guiGraphics); GuiUtil.drawBackground( - poseStack, TextureLocations.UI_BACKGROUND_SLIM, + guiGraphics, TextureLocations.UI_BACKGROUND_SLIM, this.guiLeft, this.guiTop, this.xSize, this.ySize ); - drawCenteredString( - poseStack, this.font, + guiGraphics.drawCenteredString( + this.font, Component.translatable("gui.edit.title"), this.width / 2, this.guiTop + 10, 0xFFFFFF @@ -94,13 +91,13 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTic // 0xFFFFFF // ); - super.render(poseStack, mouseX, mouseY, partialTicks); + super.render(guiGraphics, mouseX, mouseY, partialTicks); } public static CompletableFuture askForName(Screen parent, String elementName) { EditPresetScreen screen = new EditPresetScreen(parent); screen.elementName = elementName; - parent.getMinecraft().setScreen(screen); + Minecraft.getInstance().setScreen(screen); CompletableFuture future = new CompletableFuture<>(); screen.future = future; return future; diff --git a/src/main/java/me/andreasmelone/glowingeyes/client/gui/preset/PresetsScreen.java b/src/main/java/me/andreasmelone/glowingeyes/client/gui/preset/PresetsScreen.java index 538a961..1f64a67 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/client/gui/preset/PresetsScreen.java +++ b/src/main/java/me/andreasmelone/glowingeyes/client/gui/preset/PresetsScreen.java @@ -1,15 +1,15 @@ package me.andreasmelone.glowingeyes.client.gui.preset; import com.mojang.blaze3d.platform.GlStateManager; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; import me.andreasmelone.glowingeyes.client.gui.EyesEditorScreen; import me.andreasmelone.glowingeyes.client.gui.button.PresetButton; import me.andreasmelone.glowingeyes.client.presets.Preset; import me.andreasmelone.glowingeyes.client.presets.PresetManager; import me.andreasmelone.glowingeyes.client.util.GuiUtil; import me.andreasmelone.glowingeyes.client.util.TextureLocations; -import me.andreasmelone.glowingeyes.common.capability.eyes.GlowingEyesCapability; +import me.andreasmelone.glowingeyes.server.capability.eyes.GlowingEyesCapability; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.InventoryScreen; @@ -68,29 +68,23 @@ public void init() { int leftButtonX = (int) (this.guiLeft + 128 * ((double)1 / 4)); int rightButtonX = (int) (this.guiLeft + 128 * ((double)3 / 4)); - this.addRenderableWidget(new Button( - leftButtonX, this.guiTop - 20 + ((pageSize + 1) * 30), - 20, 20, + this.addRenderableWidget(Button.builder( Component.literal("<"), button -> { switchPage(page - 1); } - )); - this.addRenderableWidget(new Button( - rightButtonX, this.guiTop - 20 + ((pageSize + 1) * 30), - 20, 20, + ).pos(leftButtonX, this.guiTop - 20 + ((pageSize + 1) * 30)).size(20, 20).build()); + this.addRenderableWidget(Button.builder( Component.literal(">"), button -> { switchPage(page + 1); } - )); - this.addRenderableWidget(new Button( - this.guiLeft + this.xSize - 90, this.guiTop + 120, - 80, 20, + ).pos(rightButtonX, this.guiTop - 20 + ((pageSize + 1) * 30)).size(20, 20).build()); + this.addRenderableWidget(Button.builder( Component.translatable("gui.done"), button -> { if(parent != null) { - GlowingEyesCapability.setToggledOn(getMinecraft().player, toggledState); + GlowingEyesCapability.setToggledOn(Minecraft.getInstance().player, toggledState); if(selectedPreset != -1) { presetManager.applyPreset(selectedPreset); } @@ -98,27 +92,23 @@ public void init() { if(parent instanceof EyesEditorScreen) ((EyesEditorScreen)parent).openAsParent(); else - getMinecraft().setScreen(parent); + Minecraft.getInstance().setScreen(parent); } } - )); - this.addRenderableWidget(new Button( - this.guiLeft + this.xSize - 90, this.guiTop + 142, - 80, 20, + ).pos(this.guiLeft + this.xSize - 90, this.guiTop + 120).size(80, 20).build()); + this.addRenderableWidget(Button.builder( Component.translatable("gui.cancel"), button -> { if(parent != null) { - GlowingEyesCapability.setGlowingEyesMap(getMinecraft().player, savedPixelMap); - GlowingEyesCapability.setToggledOn(getMinecraft().player, toggledState); + GlowingEyesCapability.setGlowingEyesMap(Minecraft.getInstance().player, savedPixelMap); + GlowingEyesCapability.setToggledOn(Minecraft.getInstance().player, toggledState); presetManager.savePresets(); - getMinecraft().setScreen(parent); + Minecraft.getInstance().setScreen(parent); } } - )); - this.addRenderableWidget(createEditButton = new Button( - this.guiLeft + 10, this.guiTop + 5 + ((pageSize + 1) * 30), - 128 / 2 - 3, 20, + ).pos(this.guiLeft + this.xSize - 90, this.guiTop + 142).size(80, 20).build()); + this.addRenderableWidget(createEditButton = Button.builder( Component.translatable("gui.presets.create"), button -> { if(editing) { @@ -133,12 +123,10 @@ public void init() { this.unselectPreset(); } }); - } else getMinecraft().setScreen(new CreatePresetScreen(this)); + } else Minecraft.getInstance().setScreen(new CreatePresetScreen(this)); } - )); - this.addRenderableWidget(new Button( - this.guiLeft + 10 + (128 / 2) + (3 * 2), this.guiTop + 5 + ((pageSize + 1) * 30), - 128 / 2 - 3, 20, + ).pos(this.guiLeft + 10, this.guiTop + 5 + ((pageSize + 1) * 30)).size(128 / 2 - 3, 20).build()); + this.addRenderableWidget(Button.builder( Component.translatable("gui.presets.delete"), button -> { if(selectedPreset != -1) { @@ -151,19 +139,17 @@ public void init() { }); } } - )); - this.addRenderableWidget(new Button( - this.guiLeft + this.xSize - 90, this.guiTop + 164, - 80, 20, + ).pos(this.guiLeft + 10 + (128 / 2) + (3 * 2), this.guiTop + 5 + ((pageSize + 1) * 30)).size(128 / 2 - 3, 20).build()); + this.addRenderableWidget(Button.builder( Component.translatable("gui.presets.lock"), button -> { isLocked = !isLocked; button.setMessage(isLocked ? Component.translatable("gui.presets.unlock") : Component.translatable("gui.presets.lock")); } - )); + ).pos(this.guiLeft + this.xSize - 90, this.guiTop + 164).size(80, 20).build()); - savedPixelMap = GlowingEyesCapability.getGlowingEyesMap(getMinecraft().player); - toggledState = GlowingEyesCapability.isToggledOn(getMinecraft().player); + savedPixelMap = GlowingEyesCapability.getGlowingEyesMap(Minecraft.getInstance().player); + toggledState = GlowingEyesCapability.isToggledOn(Minecraft.getInstance().player); List presets = new ArrayList<>(presetManager.getPresets().values()); int j; @@ -184,7 +170,7 @@ public void init() { for (PresetButton b : this.presetButtons) { b.setSelected(b.getPreset().getId() == selectedPreset); if (b.getPreset().getId() == selectedPreset) { - GlowingEyesCapability.setGlowingEyesMap(getMinecraft().player, b.getPreset().getContent()); + GlowingEyesCapability.setGlowingEyesMap(Minecraft.getInstance().player, b.getPreset().getContent()); } } } @@ -194,10 +180,10 @@ public void init() { } @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTicks) { - this.renderBackground(poseStack); + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { + this.renderBackground(guiGraphics); GuiUtil.drawBackground( - poseStack, TextureLocations.UI_BACKGROUND_BROAD, + guiGraphics, TextureLocations.UI_BACKGROUND_BROAD, this.guiLeft, this.guiTop, this.xSize, this.ySize ); @@ -209,9 +195,8 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTic final int scale = 30; - RenderSystem.setShaderTexture(0, TextureLocations.UI_PLAYERBOX); - blit( - poseStack, + guiGraphics.blit( + TextureLocations.UI_PLAYERBOX, this.guiLeft + this.xSize - 90 + (scale / 2), this.guiTop + 110 - (scale * 2), 0, 0, sourceWidth, sourceHeight, @@ -223,18 +208,19 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTic GlStateManager._enableDepthTest(); GlStateManager._depthFunc(GL11.GL_LEQUAL); - InventoryScreen.renderEntityInInventory( + InventoryScreen.renderEntityInInventoryFollowsMouse( + guiGraphics, this.guiLeft + this.xSize - 90 + 40, this.guiTop + 110, scale, (float) (isLocked ? 0 : (double) (this.guiLeft + this.xSize - 90 + 40) - mouseX), (float) (isLocked ? 0 : (double) (this.guiTop + 110 - 20) - mouseY), - getMinecraft().player + Minecraft.getInstance().player ); GlStateManager._disableDepthTest(); - super.render(poseStack, mouseX, mouseY, partialTicks); + super.render(guiGraphics, mouseX, mouseY, partialTicks); } @Override @@ -242,7 +228,7 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) { if(keyCode == GLFW.GLFW_KEY_ESCAPE) { if(parent != null) { this.onClose(); - getMinecraft().setScreen(parent); + Minecraft.getInstance().setScreen(parent); } } return super.keyPressed(keyCode, scanCode, modifiers); @@ -255,8 +241,8 @@ public boolean isPauseScreen() { @Override public void onClose() { - GlowingEyesCapability.setGlowingEyesMap(getMinecraft().player, savedPixelMap); - GlowingEyesCapability.setToggledOn(getMinecraft().player, toggledState); + GlowingEyesCapability.setGlowingEyesMap(Minecraft.getInstance().player, savedPixelMap); + GlowingEyesCapability.setToggledOn(Minecraft.getInstance().player, toggledState); presetManager.savePresets(); } diff --git a/src/main/java/me/andreasmelone/glowingeyes/client/presets/PresetManager.java b/src/main/java/me/andreasmelone/glowingeyes/client/presets/PresetManager.java index 37ba930..dabe392 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/client/presets/PresetManager.java +++ b/src/main/java/me/andreasmelone/glowingeyes/client/presets/PresetManager.java @@ -7,9 +7,8 @@ import com.mojang.logging.LogUtils; import me.andreasmelone.glowingeyes.client.presets.gson.GsonPresetsFileModel; import me.andreasmelone.glowingeyes.client.presets.gson.PointColorMapSerializer; -import me.andreasmelone.glowingeyes.common.capability.eyes.GlowingEyesCapability; +import me.andreasmelone.glowingeyes.server.capability.eyes.GlowingEyesCapability; import net.minecraft.client.Minecraft; -import net.minecraft.world.entity.player.Player; import org.slf4j.Logger; import javax.annotation.Nullable; diff --git a/src/main/java/me/andreasmelone/glowingeyes/client/render/GlowingEyesHeadLayer.java b/src/main/java/me/andreasmelone/glowingeyes/client/render/GlowingEyesHeadLayer.java index 93688b7..c4fa7e7 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/client/render/GlowingEyesHeadLayer.java +++ b/src/main/java/me/andreasmelone/glowingeyes/client/render/GlowingEyesHeadLayer.java @@ -2,9 +2,8 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; -import me.andreasmelone.glowingeyes.common.capability.eyes.GlowingEyesCapability; -import me.andreasmelone.glowingeyes.common.capability.eyes.GlowingEyesImpl; -import me.andreasmelone.glowingeyes.common.capability.eyes.IGlowingEyes; +import me.andreasmelone.glowingeyes.client.util.DynamicTextureCache; +import me.andreasmelone.glowingeyes.server.capability.eyes.GlowingEyesCapability; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.renderer.MultiBufferSource; @@ -22,16 +21,16 @@ public GlowingEyesHeadLayer(RenderLayerParent pRenderer) { @Override public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, - int i, T t, float v, float v1, float v2, + int i, T player, float v, float v1, float v2, float v3, float v4, float v5) { - if(GlowingEyesCapability.isToggledOn(t) && !t.isInvisible()) { - ResourceLocation eyeOverlayResource = GlowingEyesCapability.getGlowingEyesTexture(t); + if(GlowingEyesCapability.isToggledOn(player) && !player.isInvisible()) { + ResourceLocation eyeOverlayResource = DynamicTextureCache.getTexture(GlowingEyesCapability.getGlowingEyesMap(player)); if(eyeOverlayResource == null) return; RenderType eyeRenderType = RenderType.eyes(eyeOverlayResource); VertexConsumer vertexBuilderEye = multiBufferSource.getBuffer(eyeRenderType); - int packerOverlay = LivingEntityRenderer.getOverlayCoords(t, 0); + int packerOverlay = LivingEntityRenderer.getOverlayCoords(player, 0); ModelPart head = this.getParentModel().head; head.render(poseStack, vertexBuilderEye, i, packerOverlay); diff --git a/src/main/java/me/andreasmelone/glowingeyes/client/util/DynamicTextureCache.java b/src/main/java/me/andreasmelone/glowingeyes/client/util/DynamicTextureCache.java new file mode 100644 index 0000000..7ed9f4e --- /dev/null +++ b/src/main/java/me/andreasmelone/glowingeyes/client/util/DynamicTextureCache.java @@ -0,0 +1,67 @@ +package me.andreasmelone.glowingeyes.client.util; + +import com.mojang.blaze3d.platform.NativeImage; +import me.andreasmelone.glowingeyes.GlowingEyes; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.resources.ResourceLocation; + +import java.awt.*; +import java.awt.image.BufferedImage; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +public class DynamicTextureCache { + private DynamicTextureCache() { + } + + private static final Map, ResourceLocation> cache = new HashMap<>(); + + public static ResourceLocation getTexture(Map glowingEyesMap) { + ResourceLocation texture = cache.get(glowingEyesMap); + if (texture != null) { + return texture; + } + + texture = createTexture(glowingEyesMap); + cache.put(glowingEyesMap, texture); + return texture; + } + + public static void clear() { + for(ResourceLocation texture : cache.values()) { + Minecraft.getInstance().getTextureManager().release(texture); + } + cache.clear(); + } + + private static ResourceLocation createTexture(Map glowingEyesMap) { + BufferedImage image = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB); + for (Map.Entry entry : glowingEyesMap.entrySet()) { + Point point = entry.getKey(); + Color color = entry.getValue(); + image.setRGB(point.x + 8, point.y + 8, color.getRGB()); + } + + NativeImage nativeImage = GuiUtil.toNativeImage(image); + DynamicTexture dynamicTexture = new DynamicTexture(nativeImage); + return Minecraft.getInstance().getTextureManager().register(GlowingEyes.MOD_ID + "_" + UUID.randomUUID(), dynamicTexture); + } + + private static boolean areEqual(Map map1, Map map2) { + if (map1.size() != map2.size()) { + return false; + } + + for (Map.Entry entry : map1.entrySet()) { + K key = entry.getKey(); + V value = entry.getValue(); + if (!map2.containsKey(key) || !map2.get(key).equals(value)) { + return false; + } + } + + return true; + } +} diff --git a/src/main/java/me/andreasmelone/glowingeyes/client/util/GuiUtil.java b/src/main/java/me/andreasmelone/glowingeyes/client/util/GuiUtil.java index 83fccf7..f58d764 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/client/util/GuiUtil.java +++ b/src/main/java/me/andreasmelone/glowingeyes/client/util/GuiUtil.java @@ -1,11 +1,14 @@ package me.andreasmelone.glowingeyes.client.util; +import com.mojang.blaze3d.platform.NativeImage; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.resources.ResourceLocation; import java.awt.*; +import java.awt.image.BufferedImage; public class GuiUtil { /** @@ -15,10 +18,24 @@ public class GuiUtil { * @param width The width of the texture (usually named xSize) * @param height The height of the texture (usually named ySize) */ - public static void drawBackground(PoseStack poseStack, ResourceLocation backgroundTexture, int x, int y, int width, int height) { - // Use the Minecraft class to get the texture manager - RenderSystem.setShaderTexture(0, backgroundTexture); + public static void drawBackground(GuiGraphics guiGraphics, ResourceLocation backgroundTexture, int x, int y, int width, int height) { // Draw the background texture - Gui.blit(poseStack, x, y, 0, 0, width, height, 256, 256); + guiGraphics.blit(backgroundTexture, x, y, 0, 0, width, height, 256, 256); + } + + public static NativeImage toNativeImage(BufferedImage image) { + NativeImage nativeImage = new NativeImage(image.getWidth(), image.getHeight(), true); + for (int y = 0; y < image.getHeight(); y++) { + for (int x = 0; x < image.getWidth(); x++) { + int argb = image.getRGB(x, y); + // native textures use BGR instead of RGB so we have to convert the color + Color bgr = new Color(argb); + bgr = new Color(bgr.getBlue(), bgr.getGreen(), bgr.getRed()); + + nativeImage.setPixelRGBA(x, y, bgr.getRGB()); + } + } + + return nativeImage; } } diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/capability/eyes/GlowingEyesImpl.java b/src/main/java/me/andreasmelone/glowingeyes/common/capability/eyes/GlowingEyesImpl.java deleted file mode 100644 index 83d1a8e..0000000 --- a/src/main/java/me/andreasmelone/glowingeyes/common/capability/eyes/GlowingEyesImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -package me.andreasmelone.glowingeyes.common.capability.eyes; - -import me.andreasmelone.glowingeyes.GlowingEyes; -import me.andreasmelone.glowingeyes.common.util.Util; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.DynamicTexture; -import net.minecraft.resources.ResourceLocation; - -import javax.annotation.Nonnull; -import java.awt.*; -import java.awt.image.BufferedImage; -import java.util.HashMap; -import java.util.UUID; - -public class GlowingEyesImpl implements IGlowingEyes { - private boolean toggledOn = true; - private HashMap glowingEyesMap = new HashMap<>(); - - @Nonnull - @Override - public HashMap getGlowingEyesMap() { - return this.glowingEyesMap; - } - - @Override - public void setGlowingEyesMap(@Nonnull HashMap glowingEyesMap) { - this.glowingEyesMap = glowingEyesMap; - try { - updateTexture(); - } catch (Exception ignored) { - /* - this only happens when the game is running on the wrong thread, - which only happens when we are running on the wrong side (server instead of client) - or when the method is called from the wrong thread - since I have no idea how to check that, I'll just try catch it lol - */ - } - } - - @Override - public boolean isToggledOn() { - return toggledOn; - } - - @Override - public void setToggledOn(boolean toggledOn) { - this.toggledOn = toggledOn; - } - - ResourceLocation resourceLocation; - @Override - public ResourceLocation getGlowingEyesTexture() { - return resourceLocation; - } - - private void updateTexture() { - if (resourceLocation != null) { - Minecraft.getInstance().getTextureManager().release(resourceLocation); - } - - BufferedImage eyeOverlayTexture = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB); - for (Point point : glowingEyesMap.keySet()) { - Color color = glowingEyesMap.get(point); - eyeOverlayTexture.setRGB(point.x + 8, point.y + 8, color.getRGB()); - } - DynamicTexture dynamicTexture = new DynamicTexture(Util.toNativeImage(eyeOverlayTexture)); - Minecraft.getInstance().getTextureManager().register( - resourceLocation = new ResourceLocation(GlowingEyes.MOD_ID + ":eyes_texture" + UUID.randomUUID()), - dynamicTexture - ); - } -} diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/GlowingEyesEvents.java b/src/main/java/me/andreasmelone/glowingeyes/server/GlowingEyesEvents.java similarity index 86% rename from src/main/java/me/andreasmelone/glowingeyes/common/GlowingEyesEvents.java rename to src/main/java/me/andreasmelone/glowingeyes/server/GlowingEyesEvents.java index 357e9a0..c7c1705 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/common/GlowingEyesEvents.java +++ b/src/main/java/me/andreasmelone/glowingeyes/server/GlowingEyesEvents.java @@ -1,8 +1,8 @@ -package me.andreasmelone.glowingeyes.common; +package me.andreasmelone.glowingeyes.server; -import me.andreasmelone.glowingeyes.common.capability.data.PlayerDataCapability; -import me.andreasmelone.glowingeyes.common.capability.eyes.GlowingEyesCapability; -import me.andreasmelone.glowingeyes.common.packets.PacketManager; +import me.andreasmelone.glowingeyes.server.capability.data.PlayerDataCapability; +import me.andreasmelone.glowingeyes.server.capability.eyes.GlowingEyesCapability; +import me.andreasmelone.glowingeyes.server.packets.PacketManager; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; import net.minecraftforge.event.entity.player.PlayerEvent; diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/capability/data/IPlayerData.java b/src/main/java/me/andreasmelone/glowingeyes/server/capability/data/IPlayerData.java similarity index 76% rename from src/main/java/me/andreasmelone/glowingeyes/common/capability/data/IPlayerData.java rename to src/main/java/me/andreasmelone/glowingeyes/server/capability/data/IPlayerData.java index 685afd6..a71284c 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/common/capability/data/IPlayerData.java +++ b/src/main/java/me/andreasmelone/glowingeyes/server/capability/data/IPlayerData.java @@ -1,4 +1,4 @@ -package me.andreasmelone.glowingeyes.common.capability.data; +package me.andreasmelone.glowingeyes.server.capability.data; import java.util.Set; import java.util.UUID; diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/capability/data/PlayerDataCapability.java b/src/main/java/me/andreasmelone/glowingeyes/server/capability/data/PlayerDataCapability.java similarity index 96% rename from src/main/java/me/andreasmelone/glowingeyes/common/capability/data/PlayerDataCapability.java rename to src/main/java/me/andreasmelone/glowingeyes/server/capability/data/PlayerDataCapability.java index 387de48..2445384 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/common/capability/data/PlayerDataCapability.java +++ b/src/main/java/me/andreasmelone/glowingeyes/server/capability/data/PlayerDataCapability.java @@ -1,4 +1,4 @@ -package me.andreasmelone.glowingeyes.common.capability.data; +package me.andreasmelone.glowingeyes.server.capability.data; import net.minecraft.world.entity.player.Player; import net.minecraftforge.common.capabilities.Capability; diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/capability/data/PlayerDataHandler.java b/src/main/java/me/andreasmelone/glowingeyes/server/capability/data/PlayerDataHandler.java similarity index 95% rename from src/main/java/me/andreasmelone/glowingeyes/common/capability/data/PlayerDataHandler.java rename to src/main/java/me/andreasmelone/glowingeyes/server/capability/data/PlayerDataHandler.java index 87018bc..8e6790e 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/common/capability/data/PlayerDataHandler.java +++ b/src/main/java/me/andreasmelone/glowingeyes/server/capability/data/PlayerDataHandler.java @@ -1,4 +1,4 @@ -package me.andreasmelone.glowingeyes.common.capability.data; +package me.andreasmelone.glowingeyes.server.capability.data; import me.andreasmelone.glowingeyes.GlowingEyes; import net.minecraft.core.Direction; diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/capability/data/PlayerDataImpl.java b/src/main/java/me/andreasmelone/glowingeyes/server/capability/data/PlayerDataImpl.java similarity index 89% rename from src/main/java/me/andreasmelone/glowingeyes/common/capability/data/PlayerDataImpl.java rename to src/main/java/me/andreasmelone/glowingeyes/server/capability/data/PlayerDataImpl.java index 5544651..157b287 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/common/capability/data/PlayerDataImpl.java +++ b/src/main/java/me/andreasmelone/glowingeyes/server/capability/data/PlayerDataImpl.java @@ -1,4 +1,4 @@ -package me.andreasmelone.glowingeyes.common.capability.data; +package me.andreasmelone.glowingeyes.server.capability.data; import java.util.HashSet; import java.util.Set; diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/capability/eyes/GlowingEyesCapability.java b/src/main/java/me/andreasmelone/glowingeyes/server/capability/eyes/GlowingEyesCapability.java similarity index 89% rename from src/main/java/me/andreasmelone/glowingeyes/common/capability/eyes/GlowingEyesCapability.java rename to src/main/java/me/andreasmelone/glowingeyes/server/capability/eyes/GlowingEyesCapability.java index 80b36c6..608e5c8 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/common/capability/eyes/GlowingEyesCapability.java +++ b/src/main/java/me/andreasmelone/glowingeyes/server/capability/eyes/GlowingEyesCapability.java @@ -1,11 +1,13 @@ -package me.andreasmelone.glowingeyes.common.capability.eyes; +package me.andreasmelone.glowingeyes.server.capability.eyes; -import me.andreasmelone.glowingeyes.common.packets.CapabilityUpdatePacket; -import me.andreasmelone.glowingeyes.common.packets.PacketManager; +import me.andreasmelone.glowingeyes.server.packets.CapabilityUpdatePacket; +import me.andreasmelone.glowingeyes.server.packets.PacketManager; import net.minecraft.client.Minecraft; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.capabilities.CapabilityToken; @@ -77,15 +79,6 @@ public static void setToggledOn(Player player, boolean toggledOn) { getCapability(player).setToggledOn(toggledOn); } - /** - * Gets the texture for the glowing eyes for a player - * @param player the player to get the glowing eyes texture for - * @return the glowing eyes texture - */ - public static ResourceLocation getGlowingEyesTexture(Player player) { - return getCapability(player).getGlowingEyesTexture(); - } - /** * Server-side only method to send the updated capability to the client * @param updatedPlayer the player who has been updated (will receive the update if no second player is specified) @@ -115,6 +108,7 @@ public static void sendUpdate(ServerPlayer updatedPlayer, ServerPlayer receiving * Client-side only method to send an update to the server * Throws an exception when ran on the wrong side, so make sure to check the side before calling this method */ + @OnlyIn(Dist.CLIENT) public static void sendUpdate() { PacketManager.INSTANCE.sendToServer(new CapabilityUpdatePacket(Minecraft.getInstance().player, localCapability)); } diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/capability/eyes/GlowingEyesHandler.java b/src/main/java/me/andreasmelone/glowingeyes/server/capability/eyes/GlowingEyesHandler.java similarity index 94% rename from src/main/java/me/andreasmelone/glowingeyes/common/capability/eyes/GlowingEyesHandler.java rename to src/main/java/me/andreasmelone/glowingeyes/server/capability/eyes/GlowingEyesHandler.java index 9bc3039..2e372f8 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/common/capability/eyes/GlowingEyesHandler.java +++ b/src/main/java/me/andreasmelone/glowingeyes/server/capability/eyes/GlowingEyesHandler.java @@ -1,7 +1,7 @@ -package me.andreasmelone.glowingeyes.common.capability.eyes; +package me.andreasmelone.glowingeyes.server.capability.eyes; import me.andreasmelone.glowingeyes.GlowingEyes; -import me.andreasmelone.glowingeyes.common.util.Util; +import me.andreasmelone.glowingeyes.server.util.Util; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; diff --git a/src/main/java/me/andreasmelone/glowingeyes/server/capability/eyes/GlowingEyesImpl.java b/src/main/java/me/andreasmelone/glowingeyes/server/capability/eyes/GlowingEyesImpl.java new file mode 100644 index 0000000..78519e8 --- /dev/null +++ b/src/main/java/me/andreasmelone/glowingeyes/server/capability/eyes/GlowingEyesImpl.java @@ -0,0 +1,39 @@ +package me.andreasmelone.glowingeyes.server.capability.eyes; + +import me.andreasmelone.glowingeyes.GlowingEyes; +import me.andreasmelone.glowingeyes.server.util.Util; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.resources.ResourceLocation; + +import javax.annotation.Nonnull; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.util.HashMap; +import java.util.UUID; + +public class GlowingEyesImpl implements IGlowingEyes { + private boolean toggledOn = true; + private HashMap glowingEyesMap = new HashMap<>(); + + @Nonnull + @Override + public HashMap getGlowingEyesMap() { + return this.glowingEyesMap; + } + + @Override + public void setGlowingEyesMap(@Nonnull HashMap glowingEyesMap) { + this.glowingEyesMap = glowingEyesMap; + } + + @Override + public boolean isToggledOn() { + return toggledOn; + } + + @Override + public void setToggledOn(boolean toggledOn) { + this.toggledOn = toggledOn; + } +} diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/capability/eyes/IGlowingEyes.java b/src/main/java/me/andreasmelone/glowingeyes/server/capability/eyes/IGlowingEyes.java similarity index 72% rename from src/main/java/me/andreasmelone/glowingeyes/common/capability/eyes/IGlowingEyes.java rename to src/main/java/me/andreasmelone/glowingeyes/server/capability/eyes/IGlowingEyes.java index 6139901..1d12dd0 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/common/capability/eyes/IGlowingEyes.java +++ b/src/main/java/me/andreasmelone/glowingeyes/server/capability/eyes/IGlowingEyes.java @@ -1,6 +1,8 @@ -package me.andreasmelone.glowingeyes.common.capability.eyes; +package me.andreasmelone.glowingeyes.server.capability.eyes; import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import javax.annotation.Nonnull; import java.awt.*; @@ -13,6 +15,4 @@ public interface IGlowingEyes extends Serializable { void setGlowingEyesMap(@Nonnull HashMap glowingEyesMap); boolean isToggledOn(); void setToggledOn(boolean toggledOn); - - ResourceLocation getGlowingEyesTexture(); } diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/exceptions/ToBeImplementedException.java b/src/main/java/me/andreasmelone/glowingeyes/server/exceptions/ToBeImplementedException.java similarity index 75% rename from src/main/java/me/andreasmelone/glowingeyes/common/exceptions/ToBeImplementedException.java rename to src/main/java/me/andreasmelone/glowingeyes/server/exceptions/ToBeImplementedException.java index 447e185..7d31c35 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/common/exceptions/ToBeImplementedException.java +++ b/src/main/java/me/andreasmelone/glowingeyes/server/exceptions/ToBeImplementedException.java @@ -1,4 +1,4 @@ -package me.andreasmelone.glowingeyes.common.exceptions; +package me.andreasmelone.glowingeyes.server.exceptions; public class ToBeImplementedException extends RuntimeException { public ToBeImplementedException() { diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/packets/CapabilityUpdatePacket.java b/src/main/java/me/andreasmelone/glowingeyes/server/packets/CapabilityUpdatePacket.java similarity index 90% rename from src/main/java/me/andreasmelone/glowingeyes/common/packets/CapabilityUpdatePacket.java rename to src/main/java/me/andreasmelone/glowingeyes/server/packets/CapabilityUpdatePacket.java index be2dc30..bab799e 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/common/packets/CapabilityUpdatePacket.java +++ b/src/main/java/me/andreasmelone/glowingeyes/server/packets/CapabilityUpdatePacket.java @@ -1,15 +1,14 @@ -package me.andreasmelone.glowingeyes.common.packets; +package me.andreasmelone.glowingeyes.server.packets; -import me.andreasmelone.glowingeyes.common.capability.eyes.GlowingEyesCapability; -import me.andreasmelone.glowingeyes.common.capability.eyes.GlowingEyesImpl; -import me.andreasmelone.glowingeyes.common.capability.eyes.IGlowingEyes; -import me.andreasmelone.glowingeyes.common.util.Util; +import me.andreasmelone.glowingeyes.server.capability.eyes.GlowingEyesCapability; +import me.andreasmelone.glowingeyes.server.capability.eyes.GlowingEyesImpl; +import me.andreasmelone.glowingeyes.server.capability.eyes.IGlowingEyes; +import me.andreasmelone.glowingeyes.server.util.Util; import net.minecraft.client.Minecraft; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; -import net.minecraftforge.network.PacketDistributor; import java.util.List; import java.util.UUID; diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/packets/PacketManager.java b/src/main/java/me/andreasmelone/glowingeyes/server/packets/PacketManager.java similarity index 92% rename from src/main/java/me/andreasmelone/glowingeyes/common/packets/PacketManager.java rename to src/main/java/me/andreasmelone/glowingeyes/server/packets/PacketManager.java index 6654ada..fa71363 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/common/packets/PacketManager.java +++ b/src/main/java/me/andreasmelone/glowingeyes/server/packets/PacketManager.java @@ -1,7 +1,6 @@ -package me.andreasmelone.glowingeyes.common.packets; +package me.andreasmelone.glowingeyes.server.packets; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.ConnectionData; import net.minecraftforge.network.NetworkHooks; import me.andreasmelone.glowingeyes.GlowingEyes; @@ -41,7 +40,7 @@ public static boolean isModPresent(Connection connection) { } public static boolean isModPresent(ServerPlayer player) { - Connection connection = player.connection.getConnection(); + Connection connection = player.connection.connection; return isModPresent(connection); } diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/scheduler/CodeScheduler.java b/src/main/java/me/andreasmelone/glowingeyes/server/scheduler/CodeScheduler.java similarity index 88% rename from src/main/java/me/andreasmelone/glowingeyes/common/scheduler/CodeScheduler.java rename to src/main/java/me/andreasmelone/glowingeyes/server/scheduler/CodeScheduler.java index 1f16e48..be693d4 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/common/scheduler/CodeScheduler.java +++ b/src/main/java/me/andreasmelone/glowingeyes/server/scheduler/CodeScheduler.java @@ -1,6 +1,6 @@ -package me.andreasmelone.glowingeyes.common.scheduler; +package me.andreasmelone.glowingeyes.server.scheduler; -import me.andreasmelone.glowingeyes.common.exceptions.ToBeImplementedException; +import me.andreasmelone.glowingeyes.server.exceptions.ToBeImplementedException; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/scheduler/CodeTask.java b/src/main/java/me/andreasmelone/glowingeyes/server/scheduler/CodeTask.java similarity index 88% rename from src/main/java/me/andreasmelone/glowingeyes/common/scheduler/CodeTask.java rename to src/main/java/me/andreasmelone/glowingeyes/server/scheduler/CodeTask.java index 47ce405..d501f0a 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/common/scheduler/CodeTask.java +++ b/src/main/java/me/andreasmelone/glowingeyes/server/scheduler/CodeTask.java @@ -1,4 +1,4 @@ -package me.andreasmelone.glowingeyes.common.scheduler; +package me.andreasmelone.glowingeyes.server.scheduler; public class CodeTask implements Task { private final Runnable runnable; diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/scheduler/Scheduler.java b/src/main/java/me/andreasmelone/glowingeyes/server/scheduler/Scheduler.java similarity index 76% rename from src/main/java/me/andreasmelone/glowingeyes/common/scheduler/Scheduler.java rename to src/main/java/me/andreasmelone/glowingeyes/server/scheduler/Scheduler.java index 3384ea7..4b557b0 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/common/scheduler/Scheduler.java +++ b/src/main/java/me/andreasmelone/glowingeyes/server/scheduler/Scheduler.java @@ -1,4 +1,4 @@ -package me.andreasmelone.glowingeyes.common.scheduler; +package me.andreasmelone.glowingeyes.server.scheduler; public interface Scheduler { Task runLater(Runnable runnable, long ticks); diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/scheduler/Task.java b/src/main/java/me/andreasmelone/glowingeyes/server/scheduler/Task.java similarity index 61% rename from src/main/java/me/andreasmelone/glowingeyes/common/scheduler/Task.java rename to src/main/java/me/andreasmelone/glowingeyes/server/scheduler/Task.java index ca59c91..fb16c9b 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/common/scheduler/Task.java +++ b/src/main/java/me/andreasmelone/glowingeyes/server/scheduler/Task.java @@ -1,4 +1,4 @@ -package me.andreasmelone.glowingeyes.common.scheduler; +package me.andreasmelone.glowingeyes.server.scheduler; public interface Task { void run(); diff --git a/src/main/java/me/andreasmelone/glowingeyes/common/util/Util.java b/src/main/java/me/andreasmelone/glowingeyes/server/util/Util.java similarity index 76% rename from src/main/java/me/andreasmelone/glowingeyes/common/util/Util.java rename to src/main/java/me/andreasmelone/glowingeyes/server/util/Util.java index 4a5a2c0..e41cbc7 100644 --- a/src/main/java/me/andreasmelone/glowingeyes/common/util/Util.java +++ b/src/main/java/me/andreasmelone/glowingeyes/server/util/Util.java @@ -1,4 +1,4 @@ -package me.andreasmelone.glowingeyes.common.util; +package me.andreasmelone.glowingeyes.server.util; import com.mojang.blaze3d.platform.NativeImage; @@ -46,22 +46,6 @@ public static , K extends Serializable, V extends Serializ } } - public static NativeImage toNativeImage(BufferedImage image) { - NativeImage nativeImage = new NativeImage(image.getWidth(), image.getHeight(), true); - for (int y = 0; y < image.getHeight(); y++) { - for (int x = 0; x < image.getWidth(); x++) { - int argb = image.getRGB(x, y); - // native textures use BGR instead of RGB so we have to convert the color - Color bgr = new Color(argb); - bgr = new Color(bgr.getBlue(), bgr.getGreen(), bgr.getRed()); - - nativeImage.setPixelRGBA(x, y, bgr.getRGB()); - } - } - - return nativeImage; - } - public static float round(float value, int places) { if (places < 0) throw new IllegalArgumentException(); long factor = (long) Math.pow(10, places); diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 8cf3e73..6a5d737 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -25,9 +25,9 @@ displayName="${mod_name}" #mandatory # A URL for the "homepage" for this mod, displayed in the mod UI #displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional # A file name (in the root of the mod JAR) containing a logo for display -#logoFile="examplemod.png" #optional +#logoFile="glowingeyes.png" #optional # A text field displayed in the mod UI -#credits="" #optional +#credits="Thanks for this example mod goes to Java" #optional # A text field displayed in the mod UI authors="${mod_authors}" #optional # Display Test controls the display for your mod in the server connection screen @@ -42,23 +42,22 @@ authors="${mod_authors}" #optional description='''${mod_description}''' # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. [[dependencies.${mod_id}]] #optional -# the modid of the dependency -modId="forge" #mandatory -# Does this dependency have to exist - if not, ordering below must be specified -mandatory=true #mandatory -# The version range of the dependency -versionRange="${forge_version_range}" #mandatory -# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory -# BEFORE - This mod is loaded BEFORE the dependency -# AFTER - This mod is loaded AFTER the dependency -ordering="NONE" -# Side this dependency is applied on - BOTH, CLIENT, or SERVER -side="BOTH" -# Here's another dependency + # the modid of the dependency + modId="forge" #mandatory + # Does this dependency have to exist - if not, ordering below must be specified + mandatory=true #mandatory + # The version range of the dependency + versionRange="${forge_version_range}" #mandatory + # An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory + # BEFORE - This mod is loaded BEFORE the dependency + # AFTER - This mod is loaded AFTER the dependency + ordering="NONE" + # Side this dependency is applied on - BOTH, CLIENT, or SERVER + side="BOTH"# Here's another dependency [[dependencies.${mod_id}]] -modId="minecraft" -mandatory=true -# This version range declares a minimum of the current minecraft version up to but not including the next major version -versionRange="${minecraft_version_range}" -ordering="NONE" -side="BOTH" + modId="minecraft" + mandatory=true + # This version range declares a minimum of the current minecraft version up to but not including the next major version + versionRange="${minecraft_version_range}" + ordering="NONE" + side="BOTH" diff --git a/src/main/resources/assets/glowingeyes/logo.png b/src/main/resources/assets/glowingeyes/logo.png new file mode 100644 index 0000000..cde4b37 Binary files /dev/null and b/src/main/resources/assets/glowingeyes/logo.png differ diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 81a429d..33c10d3 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,8 +1,6 @@ { "pack": { "description": "${mod_id} resources", - "pack_format": 9, - "forge:resource_pack_format": 9, - "forge:data_pack_format": 10 + "pack_format": 9 } }