commit 4d85c9beac15c206c7917023e1bee1cc6c66cb6c from: hattolo date: Wed Nov 3 23:02:50 2021 UTC first commit commit - /dev/null commit + 4d85c9beac15c206c7917023e1bee1cc6c66cb6c blob - /dev/null blob + 48f6c9149e3909ce00297cfe2e072476c4d446e0 (mode 644) --- /dev/null +++ .github/workflows/build.yml @@ -0,0 +1,39 @@ +# Automatically build the project and run any configured tests for every push +# and submitted pull request. This can help catch issues that only occur on +# certain platforms or Java versions, and provides a first line of defence +# against bad commits. + +name: build +on: [pull_request, push] + +jobs: + build: + strategy: + matrix: + # Use these Java versions + java: [ + 16 # Minimum supported by Minecraft + ] + # and run on both Linux and Windows + os: [ubuntu-20.04, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: checkout repository + uses: actions/checkout@v2 + - name: validate gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - name: setup jdk ${{ matrix.java }} + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + - name: make gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + - name: build + run: ./gradlew build + - name: capture build artifacts + if: ${{ runner.os == 'Linux' && matrix.java == '16' }} # Only upload artifacts built from latest java on one OS + uses: actions/upload-artifact@v2 + with: + name: Artifacts + path: build/libs/ blob - /dev/null blob + 09cd281f99c27f22fb63b62d167b8f16c0cb7365 (mode 644) --- /dev/null +++ .gitignore @@ -0,0 +1,33 @@ +# gradle + +.gradle/ +build/ +out/ +classes/ + +# eclipse + +*.launch + +# idea + +.idea/ +*.iml +*.ipr +*.iws + +# vscode + +.settings/ +.vscode/ +bin/ +.classpath +.project + +# macos + +*.DS_Store + +# fabric + +run/ blob - /dev/null blob + 0e259d42c996742e9e3cba14c677129b2c1b6311 (mode 644) --- /dev/null +++ LICENSE @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. blob - /dev/null blob + fd96346f4041a322679e77d79cdca9218bb7d801 (mode 644) --- /dev/null +++ README.md @@ -0,0 +1,9 @@ +# Fabric Example Mod + +## Setup + +For setup instructions please see the [fabric wiki page](https://fabricmc.net/wiki/tutorial:setup) that relates to the IDE that you are using. + +## License + +This template is available under the CC0 license. Feel free to learn from it and incorporate it in your own projects. blob - /dev/null blob + 8cfee35adc43a2f1479efef59e56518cb1648c5e (mode 644) --- /dev/null +++ build.gradle @@ -0,0 +1,109 @@ +plugins { + id 'fabric-loom' version '0.8-SNAPSHOT' + id 'maven-publish' +} + +sourceCompatibility = JavaVersion.VERSION_16 +targetCompatibility = JavaVersion.VERSION_16 + +archivesBaseName = project.archives_base_name +version = project.mod_version +group = project.maven_group + +repositories { + maven { + url 'https://repo.maven.apache.org/maven2' + name 'Maven Central' + } + // For Mod Menu + maven { + url "https://maven.terraformersmc.com/releases/" + } + // For Cloth Config + maven { + url "https://maven.shedaniel.me/" + } + + // Add repositories to retrieve artifacts from in here. + // You should only use this when depending on other mods because + // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. + // See https://docs.gradle.org/current/userguide/declaring_repositories.html + // for more information about repositories. +} + +dependencies { + implementation 'log4j:log4j:1.2.17' + + // To change the versions see the gradle.properties file + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" + + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + + // Fabric API. This is technically optional, but you probably want it anyway. + modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + // Mod Menu + modImplementation "com.terraformersmc:modmenu:${project.mod_menu_version}" + // Cloth Config + modApi("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") { + exclude(group: "net.fabricmc.fabric-api") + } + + // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs. + // You may need to force-disable transitiveness on them. +} + +processResources { + inputs.property "version", project.version + + filesMatching("fabric.mod.json") { + expand "version": project.version + } +} + +tasks.withType(JavaCompile).configureEach { + // ensure that the encoding is set to UTF-8, no matter what the system default is + // this fixes some edge cases with special characters not displaying correctly + // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html + // If Javadoc is generated, this must be specified in that task too. + it.options.encoding = "UTF-8" + + // Minecraft 1.17 (21w19a) upwards uses Java 16. + it.options.release = 16 +} + +java { + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task + // if it is present. + // If you remove this line, sources will not be generated. + withSourcesJar() +} + +jar { + from("LICENSE") { + rename { "${it}_${project.archivesBaseName}"} + } +} + +// configure the maven publication +publishing { + publications { + mavenJava(MavenPublication) { + // add all the jars that should be included when publishing to maven + artifact(remapJar) { + builtBy remapJar + } + artifact(sourcesJar) { + builtBy remapSourcesJar + } + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + // Add repositories to publish to here. + // Notice: This block does NOT have the same function as the block in the top level. + // The repositories here will be used for publishing your artifact, not for + // retrieving dependencies. + } +} blob - /dev/null blob + e708b1c023ec8b20f512888fe07c5bd3ff77bb8f (mode 644) Binary files /dev/null and gradle/wrapper/gradle-wrapper.jar differ blob - /dev/null blob + 05679dc3c18669869e21a57ce911ccfe56352d0d (mode 644) --- /dev/null +++ gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists blob - /dev/null blob + abf6be1b4d35a05e76114c02da50aa5f58673601 (mode 644) --- /dev/null +++ gradle.properties @@ -0,0 +1,18 @@ +# Done to increase the memory available to gradle. +org.gradle.jvmargs=-Xmx1G + +# Fabric Properties + # check these on https://fabricmc.net/versions.html + minecraft_version=1.17.1 + yarn_mappings=1.17.1+build.14 + loader_version=0.11.6 + +# Mod Properties + mod_version = 1.0.0 + maven_group = com.hattolo + archives_base_name = console-sounds-mod + +# Dependencies + fabric_version=0.37.0+1.17 + mod_menu_version = 2.0.14 + cloth_config_version = 5.0.34 \ No newline at end of file blob - /dev/null blob + 4f906e0c811fc9e230eb44819f509cd0627f2600 (mode 644) --- /dev/null +++ gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" blob - /dev/null blob + 107acd32c4e687021ef32db511e8a206129b88ec (mode 644) --- /dev/null +++ gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega blob - /dev/null blob + f91a4fe7e1f1240c4ca98d81fd7a3d7cede3efb5 (mode 644) --- /dev/null +++ settings.gradle @@ -0,0 +1,9 @@ +pluginManagement { + repositories { + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + gradlePluginPortal() + } +} blob - /dev/null blob + d03e4d89be037314b57dc2a658e2d68aa9893019 (mode 644) --- /dev/null +++ src/main/java/com/hattolo/consolesounds/ConsoleSoundsClient.java @@ -0,0 +1,53 @@ +package com.hattolo.consolesounds; + +import me.shedaniel.autoconfig.AutoConfig; +import me.shedaniel.autoconfig.serializer.GsonConfigSerializer; +import net.fabricmc.api.ClientModInitializer; +//import net.fabricmc.fabric.api.resource.ResourceManagerHelper; +//import net.fabricmc.fabric.api.resource.ResourcePackActivationType; +//import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.sound.SoundEvent; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ConsoleSoundsClient implements ClientModInitializer { + public static final Logger log = LogManager.getLogger("Console Sounds"); + + public static final Identifier UI_SELECT_ID = new Identifier("consolemod:ui_select"); + public static SoundEvent UI_SELECT_EVENT = new SoundEvent(UI_SELECT_ID); + + public static final Identifier UI_BACK_ID = new Identifier("consolemod:ui_back"); + public static SoundEvent UI_BACK_EVENT = new SoundEvent(UI_BACK_ID); + + public static final Identifier UI_SCROLL_ID = new Identifier("consolemod:ui_scroll"); + public static SoundEvent UI_SCROLL_EVENT = new SoundEvent(UI_SCROLL_ID); + + public static final Identifier UI_FAIL_ID = new Identifier("consolemod:ui_fail"); + public static SoundEvent UI_FAIL_EVENT = new SoundEvent(UI_FAIL_ID); + + @Override + public void onInitializeClient() { + // This code runs as soon as Minecraft is in a mod-load-ready state. + // However, some things (like resources) may still be uninitialized. + // Proceed with mild caution. + + // register sounds + Registry.register(Registry.SOUND_EVENT, UI_SELECT_ID, UI_SELECT_EVENT); + Registry.register(Registry.SOUND_EVENT, UI_BACK_ID, UI_BACK_EVENT); + Registry.register(Registry.SOUND_EVENT, UI_SCROLL_ID, UI_SCROLL_EVENT); + Registry.register(Registry.SOUND_EVENT, UI_FAIL_ID, UI_FAIL_EVENT); + log.info("Registered all sounds!"); + + // register config + AutoConfig.register(ConsoleSoundsConfig.class, GsonConfigSerializer::new); + log.info("Registered config!"); + + // register and automatically load resource pack + //ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("consolemod", "console_pack"), FabricLoader.getInstance().getModContainer("consolemod").get(), ResourcePackActivationType.ALWAYS_ENABLED); + + log.info("Initialized the mod!"); + } +} blob - /dev/null blob + e7063ccc2214662b3a3f5930275616dd93d6383d (mode 644) --- /dev/null +++ src/main/java/com/hattolo/consolesounds/ConsoleSoundsConfig.java @@ -0,0 +1,27 @@ +package com.hattolo.consolesounds; + +import me.shedaniel.autoconfig.ConfigData; +import me.shedaniel.autoconfig.annotation.Config; +import me.shedaniel.autoconfig.annotation.ConfigEntry; +import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.Comment; +import net.minecraft.text.TranslatableText; + +@Config(name = "consolesounds") +public class ConsoleSoundsConfig implements ConfigData { + @Comment("Enables the sound you hear when you hover over buttons.") + public boolean enableHoverSounds = true; + @Comment("Enables the click sound you hear when you click on a slot on an in-game menu, like a crafting table or your inventory.") + public boolean enableInGameClickSounds = true; + @Comment("Enables the pop sound you hear when you craft something.") + public boolean enableCraftingSounds = true; + @Comment("Enables the sound you hear when you use a slider.") + public boolean enableSliderSounds = true; + @Comment("Plays the click sound whenever you open the pause menu. You might want to disable this if you set the game to auto pause on focus loss.") + public boolean playSoundOnPauseMenu = true; + @Comment("Plays the click sound whenever you open an in-game menu, like a crafting table or your inventory.") + public boolean playSoundOnInGameMenu = true; + @Comment("Plays the back sound whenever you close a menu, like a crafting table or your inventory.") + public boolean playSoundOnMenuExit = true; + @Comment("Plays the back sound whenever you close an in-game menu, like a crafting table or your inventory.") + public boolean playSoundOnInGameMenuExit = true; +} \ No newline at end of file blob - /dev/null blob + d0fa07674f2693b2eca446241ea59ad6c83db17e (mode 644) --- /dev/null +++ src/main/java/com/hattolo/consolesounds/ConsoleSoundsModMenu.java @@ -0,0 +1,15 @@ +package com.hattolo.consolesounds; + +import com.terraformersmc.modmenu.api.ModMenuApi; +import com.terraformersmc.modmenu.api.ConfigScreenFactory; +import me.shedaniel.autoconfig.AutoConfig; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class ConsoleSoundsModMenu implements ModMenuApi { + @Override + public ConfigScreenFactory getModConfigScreenFactory() { + return parent -> AutoConfig.getConfigScreen(ConsoleSoundsConfig.class, parent).get(); + } +} blob - /dev/null blob + 0f6f93a80023724fcddab806c9c8d68bf23d2866 (mode 644) --- /dev/null +++ src/main/java/com/hattolo/consolesounds/mixin/ClickCreativeInventoryScreenMixin.java @@ -0,0 +1,21 @@ +package com.hattolo.consolesounds.mixin; + +import com.hattolo.consolesounds.ConsoleSoundsConfig; +import me.shedaniel.autoconfig.AutoConfig; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; +import net.minecraft.client.gui.screen.ingame.HandledScreen; +import net.minecraft.client.sound.PositionedSoundInstance; +import net.minecraft.sound.SoundEvents; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(CreativeInventoryScreen.class) +public class ClickCreativeInventoryScreenMixin { + @Inject(at = @At("HEAD"), method = "onMouseClick(Lnet/minecraft/screen/slot/Slot;IILnet/minecraft/screen/slot/SlotActionType;)V") + private void onMouseClick(CallbackInfo ci) { + if (AutoConfig.getConfigHolder(ConsoleSoundsConfig.class).getConfig().enableInGameClickSounds) MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + } +} blob - /dev/null blob + c71f5cdae4d595ff1de447ea2ed026054b4cd20d (mode 644) --- /dev/null +++ src/main/java/com/hattolo/consolesounds/mixin/ClickHandledScreenMixin.java @@ -0,0 +1,20 @@ +package com.hattolo.consolesounds.mixin; + +import com.hattolo.consolesounds.ConsoleSoundsConfig; +import me.shedaniel.autoconfig.AutoConfig; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.ingame.HandledScreen; +import net.minecraft.client.sound.PositionedSoundInstance; +import net.minecraft.sound.SoundEvents; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(HandledScreen.class) +public class ClickHandledScreenMixin { + @Inject(at = @At("HEAD"), method = "onMouseClick(Lnet/minecraft/screen/slot/Slot;IILnet/minecraft/screen/slot/SlotActionType;)V") + private void onMouseClick(CallbackInfo ci) { + if (AutoConfig.getConfigHolder(ConsoleSoundsConfig.class).getConfig().enableInGameClickSounds) MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + } +} blob - /dev/null blob + 434eb40850549c39b0327d5acd11ce9d58ee03b3 (mode 644) --- /dev/null +++ src/main/java/com/hattolo/consolesounds/mixin/CloseHandledScreenMixin.java @@ -0,0 +1,20 @@ +package com.hattolo.consolesounds.mixin; + +import com.hattolo.consolesounds.ConsoleSoundsClient; +import com.hattolo.consolesounds.ConsoleSoundsConfig; +import me.shedaniel.autoconfig.AutoConfig; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.ingame.HandledScreen; +import net.minecraft.client.sound.PositionedSoundInstance; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(HandledScreen.class) +public class CloseHandledScreenMixin { + @Inject(at = @At("HEAD"), method = "onClose") + private void onClose(CallbackInfo ci) { + if (AutoConfig.getConfigHolder(ConsoleSoundsConfig.class).getConfig().playSoundOnInGameMenuExit) MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(ConsoleSoundsClient.UI_BACK_EVENT, 1.0F)); + } +} blob - /dev/null blob + 9e9b794485161b9f50efe78127fcb6aab4fc3217 (mode 644) --- /dev/null +++ src/main/java/com/hattolo/consolesounds/mixin/CloseScreenMixin.java @@ -0,0 +1,20 @@ +package com.hattolo.consolesounds.mixin; + +import com.hattolo.consolesounds.ConsoleSoundsClient; +import com.hattolo.consolesounds.ConsoleSoundsConfig; +import me.shedaniel.autoconfig.AutoConfig; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.sound.PositionedSoundInstance; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(Screen.class) +public class CloseScreenMixin { + @Inject(at = @At("HEAD"), method = "onClose") + private void onClose(CallbackInfo ci) { + if (AutoConfig.getConfigHolder(ConsoleSoundsConfig.class).getConfig().playSoundOnMenuExit) MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(ConsoleSoundsClient.UI_BACK_EVENT, 1.0F)); + } +} blob - /dev/null blob + b46225a681df3b19d1029edc091922137c4d9398 (mode 644) --- /dev/null +++ src/main/java/com/hattolo/consolesounds/mixin/CraftItemStackMixin.java @@ -0,0 +1,20 @@ +package com.hattolo.consolesounds.mixin; + +import com.hattolo.consolesounds.ConsoleSoundsConfig; +import me.shedaniel.autoconfig.AutoConfig; +import net.minecraft.client.MinecraftClient; +import net.minecraft.item.ItemStack; +import net.minecraft.client.sound.PositionedSoundInstance; +import net.minecraft.sound.SoundEvents; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ItemStack.class) +public class CraftItemStackMixin { + @Inject(at = @At("HEAD"), method = "onCraft") + private void init(CallbackInfo ci) { + if (AutoConfig.getConfigHolder(ConsoleSoundsConfig.class).getConfig().enableCraftingSounds) MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.ENTITY_ITEM_PICKUP, 1.0F)); + } +} blob - /dev/null blob + 0ec84a76c6e8ce6cc92b79b53497e72f8d191a57 (mode 644) --- /dev/null +++ src/main/java/com/hattolo/consolesounds/mixin/ExitScreenMixin.java @@ -0,0 +1,35 @@ +package com.hattolo.consolesounds.mixin; + +import com.hattolo.consolesounds.ConsoleSoundsClient; +import com.hattolo.consolesounds.ConsoleSoundsConfig; +import me.shedaniel.autoconfig.AutoConfig; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.sound.PositionedSoundInstance; +import org.lwjgl.glfw.GLFW; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(Screen.class) +public class ExitScreenMixin { + @Inject(at = @At("RETURN"), method = "keyPressed") + private void keyPressed(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable cir) { + //System.out.println("Lel"); + if (cir.getReturnValue()) { + if (keyCode == GLFW.GLFW_KEY_BACKSPACE || keyCode == GLFW.GLFW_KEY_DELETE || keyCode == GLFW.GLFW_KEY_HOME || keyCode == GLFW.GLFW_KEY_END || keyCode == GLFW.GLFW_KEY_LEFT || keyCode == GLFW.GLFW_KEY_RIGHT) return; + if (modifiers == GLFW.GLFW_MOD_CONTROL) return; + + //System.out.println("Escaped!"); + if (AutoConfig.getConfigHolder(ConsoleSoundsConfig.class).getConfig().playSoundOnMenuExit) MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(ConsoleSoundsClient.UI_BACK_EVENT, 1.0F)); + } + /* + System.out.println("Lel"); + if (keyCode == GLFW.GLFW_KEY_ESCAPE && Screen.shouldCloseOnEsc()) { + System.out.println("Escaped!"); + MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(ConsoleModClient.UI_BACK_EVENT, 1.0F)); + } + */ + } +} blob - /dev/null blob + 63ca11b7a9d2410ba25d3e75cb0f24bc71902705 (mode 644) --- /dev/null +++ src/main/java/com/hattolo/consolesounds/mixin/OpenHandledScreenMixin.java @@ -0,0 +1,20 @@ +package com.hattolo.consolesounds.mixin; + +import com.hattolo.consolesounds.ConsoleSoundsConfig; +import me.shedaniel.autoconfig.AutoConfig; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.ingame.HandledScreen; +import net.minecraft.client.sound.PositionedSoundInstance; +import net.minecraft.sound.SoundEvents; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(HandledScreen.class) +public class OpenHandledScreenMixin { + @Inject(at = @At("HEAD"), method = "init") + private void init(CallbackInfo ci) { + if (AutoConfig.getConfigHolder(ConsoleSoundsConfig.class).getConfig().playSoundOnInGameMenu) MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + } +} blob - /dev/null blob + eb60e239d16f606667c9421ba06a72e09406eb47 (mode 644) --- /dev/null +++ src/main/java/com/hattolo/consolesounds/mixin/OpenPauseMenuMixin.java @@ -0,0 +1,32 @@ +package com.hattolo.consolesounds.mixin; + +import com.hattolo.consolesounds.ConsoleSoundsConfig; +import me.shedaniel.autoconfig.AutoConfig; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.GameMenuScreen; +import net.minecraft.client.option.GameOptions; +import net.minecraft.client.sound.PositionedSoundInstance; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvents; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; +import javax.sound.sampled.Clip; +import javax.sound.sampled.FloatControl; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + + +@Mixin(MinecraftClient.class) +public class OpenPauseMenuMixin { + @Inject(at = @At("TAIL"), method = "openPauseMenu") + private void init(boolean pause, CallbackInfo ci) { + if (MinecraftClient.getInstance().currentScreen instanceof GameMenuScreen) { + if (AutoConfig.getConfigHolder(ConsoleSoundsConfig.class).getConfig().playSoundOnPauseMenu) MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + } + } +} blob - /dev/null blob + af6e2df1153c0ae6cea1867d7f52f278533b4591 (mode 644) --- /dev/null +++ src/main/java/com/hattolo/consolesounds/mixin/ScrollSliderWidgetMixin.java @@ -0,0 +1,33 @@ +package com.hattolo.consolesounds.mixin; + +import com.hattolo.consolesounds.ConsoleSoundsClient; +import com.hattolo.consolesounds.ConsoleSoundsConfig; +import me.shedaniel.autoconfig.AutoConfig; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.sound.PositionedSoundInstance; +import net.minecraft.client.gui.widget.SliderWidget; +import net.minecraft.util.math.MathHelper; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(SliderWidget.class) +public class ScrollSliderWidgetMixin { + double oldValue = -9999; + + @Inject(at = @At("HEAD"), method = "setValue") + private void init(double value, CallbackInfo ci) { + double v = MathHelper.clamp(roundDown2(value), 0.0D, 1.0D); + double ov = MathHelper.clamp(roundDown2(oldValue), 0.0D, 1.0D); + + if (v != ov && AutoConfig.getConfigHolder(ConsoleSoundsConfig.class).getConfig().enableSliderSounds) MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(ConsoleSoundsClient.UI_SCROLL_EVENT, 1.0F)); + oldValue = value; + + //System.out.println("value: " + value + " oldvalue: " + oldValue + " v: " + v + " ov: " + ov); + } + + private static double roundDown2(double d) { + return Math.floor(d * 1e2) / 1e2; + } +} blob - /dev/null blob + 17c0006724fb1ff1f3725c299ae945641a925a8d (mode 644) --- /dev/null +++ src/main/java/com/hattolo/consolesounds/mixin/SelectClickableWidgetMixin.java @@ -0,0 +1,44 @@ +package com.hattolo.consolesounds.mixin; + +import com.hattolo.consolesounds.ConsoleSoundsClient; +import com.hattolo.consolesounds.ConsoleSoundsConfig; +import me.shedaniel.autoconfig.AutoConfig; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.widget.ClickableWidget; +import net.minecraft.client.sound.PositionedSoundInstance; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.Random; + +@Mixin(ClickableWidget.class) +public class SelectClickableWidgetMixin { + private static float randFloat(float min, float max) { + Random rand = new Random(); + return rand.nextFloat() * (max - min) + min; + } + + @Inject(at = @At("RETURN"), method = "isHovered") + private void isHovered(CallbackInfoReturnable cir) { + if (cir.getReturnValue()) { + if (selected == false) { + selected = true; + if (AutoConfig.getConfigHolder(ConsoleSoundsConfig.class).getConfig().enableHoverSounds) MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(ConsoleSoundsClient.UI_SELECT_EVENT, randFloat(0.9f, 1.1f))); + } + } + else { + selected = false; + } + } + + Boolean selected = false; + /* + @Inject(at = @At("HEAD"), method = "renderTooltip") + private void renderTooltip(CallbackInfo info) { + System.out.println("This line is printed by an example mod mixin!"); + MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(ConsoleModClient.UI_SELECT_EVENT, 1.0F)); + } + */ +} blob - /dev/null blob + da69566104f134a1fbaa432ccdca2b8d34cdf812 (mode 644) --- /dev/null +++ src/main/java/com/hattolo/consolesounds/mixin/SlotClickedRecipeBookMixin.java @@ -0,0 +1,26 @@ +package com.hattolo.consolesounds.mixin; + +import com.hattolo.consolesounds.ConsoleSoundsClient; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.ingame.CraftingScreen; +import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget; +import net.minecraft.client.sound.PositionedSoundInstance; +import net.minecraft.screen.slot.Slot; +import net.minecraft.sound.SoundEvents; +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +// unused mixin + +@Mixin(RecipeBookWidget.class) +public class SlotClickedRecipeBookMixin { + @Inject(at = @At("HEAD"), method = "slotClicked") + private void init(@Nullable Slot slot, CallbackInfo ci) { + if (slot != null && slot.id < 4) { + MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(ConsoleSoundsClient.UI_FAIL_EVENT, 1.0F)); + } + } +} blob - /dev/null blob + 04af7d0be8249f25189b8698c10806be40c080b2 (mode 644) --- /dev/null +++ src/main/resources/assets/consolemod/lang/en_us.json @@ -0,0 +1,11 @@ +{ + "text.autoconfig.consolesounds.title": "Console Sounds Configuration", + "text.autoconfig.consolesounds.option.enableHoverSounds": "Enable Hover Sounds", + "text.autoconfig.consolesounds.option.enableInGameClickSounds": "Enable In-Game Menu Click Sounds", + "text.autoconfig.consolesounds.option.enableCraftingSounds": "Enable Crafting Sounds", + "text.autoconfig.consolesounds.option.enableSliderSounds": "Enable Slider Sounds", + "text.autoconfig.consolesounds.option.playSoundOnPauseMenu": "Play Sound on Pause Menu Open", + "text.autoconfig.consolesounds.option.playSoundOnInGameMenu": "Play Sound on In-Game Menu Open", + "text.autoconfig.consolesounds.option.playSoundOnMenuExit": "Play Sound on Menu Close", + "text.autoconfig.consolesounds.option.playSoundOnInGameMenuExit": "Play Sound on In-Game Menu Close" +} \ No newline at end of file blob - /dev/null blob + fe067c72ec7053ef09386b87a29abcc7d59b25d1 (mode 644) Binary files /dev/null and src/main/resources/assets/consolemod/sounds/ui_back.ogg differ blob - /dev/null blob + 8634dc600ceaa58c6dedce2898c6865c3e636aa3 (mode 644) Binary files /dev/null and src/main/resources/assets/consolemod/sounds/ui_fail.ogg differ blob - /dev/null blob + 680958b6bdccbc916a03abf16c08b92288f4e7e4 (mode 644) Binary files /dev/null and src/main/resources/assets/consolemod/sounds/ui_scroll.ogg differ blob - /dev/null blob + 261662ca293c64a5d8a98f50b1c4473ee315d0b9 (mode 644) Binary files /dev/null and src/main/resources/assets/consolemod/sounds/ui_select.ogg differ blob - /dev/null blob + c396f3f422432a134ea3dab4c0e4cec86187bf4a (mode 644) --- /dev/null +++ src/main/resources/assets/consolemod/sounds.json @@ -0,0 +1,22 @@ +{ + "ui_select": { + "sounds": [ + "consolemod:ui_select" + ] + }, + "ui_back": { + "sounds": [ + "consolemod:ui_back" + ] + }, + "ui_scroll": { + "sounds": [ + "consolemod:ui_scroll" + ] + }, + "ui_fail": { + "sounds": [ + "consolemod:ui_fail" + ] + } +} \ No newline at end of file blob - /dev/null blob + 2944f4c4c573320d41d20202e00269e3b3a85bbe (mode 644) Binary files /dev/null and src/main/resources/assets/minecraft/sounds/random/click_stereo.ogg differ blob - /dev/null blob + 48f26c7e9a4cd993bb6e12048f2c7aac18ab431f (mode 644) Binary files /dev/null and src/main/resources/click_stereo.wav differ blob - /dev/null blob + 2d477840540ec29e483157cca17a72b727c0f517 (mode 644) --- /dev/null +++ src/main/resources/consolemod.mixins.json @@ -0,0 +1,23 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "com.hattolo.consolesounds.mixin", + "compatibilityLevel": "JAVA_16", + "mixins": [ + ], + "client": [ + "SelectClickableWidgetMixin", + "ExitScreenMixin", + "CloseScreenMixin", + "CloseHandledScreenMixin", + "OpenHandledScreenMixin", + "ClickHandledScreenMixin", + "ClickCreativeInventoryScreenMixin", + "CraftItemStackMixin", + "OpenPauseMenuMixin", + "ScrollSliderWidgetMixin" + ], + "injectors": { + "defaultRequire": 1 + } +} blob - /dev/null blob + 3ec4cfec005881e024474014a2ca048de25d5978 (mode 644) --- /dev/null +++ src/main/resources/fabric.mod.json @@ -0,0 +1,40 @@ +{ + "schemaVersion": 1, + "id": "consolesounds", + "version": "${version}", + + "name": "Console Sounds Mod", + "description": "This adds new sounds from legacy console Minecraft to Java!", + "authors": [ + "hattolo (or Hattozo)" + ], + "contact": { + "homepage": "https://fabricmc.net/", + "sources": "https://github.com/FabricMC/fabric-example-mod" + }, + + "license": "MIT", + + "environment": "*", + "entrypoints": { + "client": [ + "com.hattolo.consolesounds.ConsoleSoundsClient" + ], + "modmenu": [ + "com.hattolo.consolesounds.ConsoleSoundsModMenu" + ] + }, + "mixins": [ + "consolemod.mixins.json" + ], + + "depends": { + "fabricloader": ">=0.11.3", + "fabric": "*", + "minecraft": "1.17.x", + "java": ">=16" + }, + "suggests": { + "another-mod": "*" + } +}