GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — renamed things · Intiiii/OneConfigExampleMod@5d4ab75

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • gradle/gradle-8.8
    • LICENSE
    • NOTICE
    • README
    • init.d
      • readme.txt
  • src/main
    • java/org
      • inti/ares
        • AresMod.java
        • config
          • TestConfig.java
        • mixin
          • SoundMixin.java
      • polyfrost/ares
        • AresMod.java
        • mixin
          • SoundMixin.java
    • resources
      • mixins.ares.json
  • update-to-301a6ca.md
  • update-to-fd8e095.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎gradle/gradle-8.8/LICENSE‎

Copy file name to clipboardExpand all lines: gradle/gradle-8.8/LICENSE
+421Lines changed: 421 additions & 0 deletions
Large diffs are not rendered by default.
Collapse file

‎gradle/gradle-8.8/NOTICE‎

Copy file name to clipboard
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
=========================================================================
2+
== NOTICE file corresponding to the section 4 d of ==
3+
== the Apache License, Version 2.0, ==
4+
== in this case for the Gradle distribution. ==
5+
=========================================================================
6+
7+
This product includes software developed by
8+
The Apache Software Foundation (http://www.apache.org/).
9+
10+
It includes the following other software:
11+
12+
Groovy (http://groovy-lang.org)
13+
SLF4J (http://www.slf4j.org)
14+
JUnit (http://www.junit.org)
15+
JCIFS (http://jcifs.samba.org)
16+
HttpClient (https://hc.apache.org/httpcomponents-client-4.5.x/)
17+
18+
For licenses, see the LICENSE file.
19+
20+
If any software distributed with Gradle does not have an Apache 2 License, its license is explicitly listed in the
21+
LICENSE file.
Collapse file

‎gradle/gradle-8.8/README‎

Copy file name to clipboard
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Gradle is a build tool with a focus on build automation and support for multi-language development. If you are building, testing, publishing, and deploying software on any platform, Gradle offers a flexible model that can support the entire development lifecycle from compiling and packaging code to publishing web sites. Gradle has been designed to support build automation across multiple languages and platforms including Java, Scala, Android, C/C++, and Groovy, and is closely integrated with development tools and continuous integration servers including Eclipse, IntelliJ, and Jenkins.
2+
3+
For more information about Gradle, please visit: https://gradle.org
4+
5+
If you are using the "all" distribution, the User Manual is included in your distribution.
6+
7+
If you are using the "bin" distribution, a copy of the User Manual is available on https://docs.gradle.org.
8+
9+
Typing `gradle help` prints the command line help.
10+
11+
Typing `gradle tasks` shows all the tasks of a Gradle build.
Collapse file

‎gradle/gradle-8.8/init.d/readme.txt‎

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
You can add .gradle (e.g. test.gradle) init scripts to this directory. Each one is executed at the start of the build.
Collapse file

‎src/main/java/org/inti/ares/AresMod.java‎

Copy file name to clipboard
+39Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package org.inti.ares;
2+
3+
import org.apache.logging.log4j.LogManager;
4+
import org.apache.logging.log4j.Logger;
5+
import org.inti.ares.config.TestConfig;
6+
import cc.polyfrost.oneconfig.events.event.InitializationEvent;
7+
import net.minecraftforge.fml.common.Mod;
8+
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
9+
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
10+
11+
/**
12+
* The Ares Mod - Footstep Volume Control
13+
*/
14+
@Mod(
15+
modid = AresMod.MOD_ID,
16+
name = "Ares",
17+
version = "1.0.0",
18+
clientSideOnly = true
19+
)
20+
public class AresMod {
21+
public static final String MOD_ID = "ares";
22+
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
23+
public static TestConfig config;
24+
25+
@Mod.Instance(MOD_ID)
26+
public static AresMod INSTANCE;
27+
28+
@Mod.EventHandler
29+
public void onPreInit(FMLPreInitializationEvent event) {
30+
LOGGER.info("Ares Mod Pre-Initialization");
31+
}
32+
33+
@Mod.EventHandler
34+
public void onInit(FMLInitializationEvent event) {
35+
LOGGER.info("Ares Mod Initialization");
36+
config = new TestConfig();
37+
LOGGER.info("Configuration loaded successfully");
38+
}
39+
}
Collapse file

‎…rg/polyfrost/ares/config/TestConfig.java‎ ‎…ava/org/inti/ares/config/TestConfig.java‎src/main/java/org/polyfrost/ares/config/TestConfig.java renamed to src/main/java/org/inti/ares/config/TestConfig.java src/main/java/org/polyfrost/ares/config/TestConfig.java renamed to src/main/java/org/inti/ares/config/TestConfig.java

Copy file name to clipboardExpand all lines: src/main/java/org/inti/ares/config/TestConfig.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package org.polyfrost.ares.config;
1+
package org.inti.ares.config;
22

3-
import org.polyfrost.ares.AresMod;
3+
import org.inti.ares.AresMod;
44
import cc.polyfrost.oneconfig.config.Config;
55
import cc.polyfrost.oneconfig.config.annotations.Slider;
66
import cc.polyfrost.oneconfig.config.data.Mod;
@@ -27,7 +27,7 @@ public class TestConfig extends Config {
2727
public static float otherFootstepsVolume = 100f;
2828

2929
public TestConfig() {
30-
super(new Mod(AresMod.NAME, ModType.UTIL_QOL), AresMod.MODID + ".json");
30+
super(new Mod(AresMod.MOD_ID, ModType.UTIL_QOL), AresMod.MOD_ID + ".json");
3131
initialize();
3232
}
3333
}
Collapse file

‎src/main/java/org/inti/ares/mixin/SoundMixin.java‎

Copy file name to clipboard
+112Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
package org.inti.ares.mixin;
2+
3+
import net.minecraft.client.audio.ISound;
4+
import net.minecraft.client.audio.SoundManager;
5+
import net.minecraft.client.Minecraft;
6+
import net.minecraft.entity.Entity;
7+
import org.apache.logging.log4j.LogManager;
8+
import org.apache.logging.log4j.Logger;
9+
import org.inti.ares.AresMod;
10+
import org.spongepowered.asm.mixin.Mixin;
11+
import org.spongepowered.asm.mixin.injection.At;
12+
import org.spongepowered.asm.mixin.injection.ModifyVariable;
13+
14+
@Mixin(SoundManager.class)
15+
public class SoundMixin {
16+
private static final Logger LOGGER = LogManager.getLogger(AresMod.MOD_ID);
17+
18+
/**
19+
* Modifies sound volume for footstep and digging sounds.
20+
*
21+
* @param sound Original sound to be played
22+
* @return Modified sound with adjusted volume
23+
*/
24+
@ModifyVariable(
25+
method = "playSound",
26+
at = @At("HEAD"),
27+
ordinal = 0
28+
)
29+
private ISound modifySound(ISound sound) {
30+
try {
31+
if (sound == null) return sound;
32+
33+
String soundName = sound.getSoundLocation().getResourcePath().toLowerCase();
34+
35+
// Check if it's a footstep or digging sound
36+
if (soundName.contains("step") || soundName.contains("dig")) {
37+
float x = sound.getXPosF();
38+
float y = sound.getYPosF();
39+
float z = sound.getZPosF();
40+
41+
Entity closestEntity = findClosestEntity(x, y, z);
42+
43+
if (closestEntity != null) {
44+
if (closestEntity == Minecraft.getMinecraft().thePlayer) {
45+
LOGGER.debug("Modifying own footstep sound volume to: {}", AresMod.config.ownFootstepsVolume);
46+
return new ModifiedSound(sound, AresMod.config.ownFootstepsVolume / 100f);
47+
} else {
48+
LOGGER.debug("Modifying other player's footstep sound volume to: {}", AresMod.config.otherFootstepsVolume);
49+
return new ModifiedSound(sound, AresMod.config.otherFootstepsVolume / 100f);
50+
}
51+
}
52+
}
53+
54+
return sound;
55+
} catch (Exception e) {
56+
LOGGER.error("Error modifying sound volume", e);
57+
return sound;
58+
}
59+
}
60+
61+
/**
62+
* Find the closest entity to the sound's location.
63+
*
64+
* @param x X coordinate of the sound
65+
* @param y Y coordinate of the sound
66+
* @param z Z coordinate of the sound
67+
* @return Closest entity or null
68+
*/
69+
private Entity findClosestEntity(float x, float y, float z) {
70+
Entity closestEntity = null;
71+
double closestDistance = 1.0; // Maximum distance to find an entity
72+
73+
for (Entity entity : Minecraft.getMinecraft().theWorld.loadedEntityList) {
74+
double distance = entity.getDistanceSq(x, y, z);
75+
if (distance < closestDistance) {
76+
closestDistance = distance;
77+
closestEntity = entity;
78+
}
79+
}
80+
81+
return closestEntity;
82+
}
83+
84+
/**
85+
* Custom sound implementation that wraps the original sound
86+
* and allows volume modification.
87+
*/
88+
private static class ModifiedSound implements ISound {
89+
private final ISound original;
90+
private final float volumeMultiplier;
91+
92+
public ModifiedSound(ISound original, float volumeMultiplier) {
93+
this.original = original;
94+
this.volumeMultiplier = volumeMultiplier;
95+
}
96+
97+
@Override
98+
public float getVolume() {
99+
return Math.max(0.0001f, original.getVolume() * volumeMultiplier);
100+
}
101+
102+
// Delegate all other methods to the original sound
103+
@Override public float getPitch() { return original.getPitch(); }
104+
@Override public float getXPosF() { return original.getXPosF(); }
105+
@Override public float getYPosF() { return original.getYPosF(); }
106+
@Override public float getZPosF() { return original.getZPosF(); }
107+
@Override public net.minecraft.util.ResourceLocation getSoundLocation() { return original.getSoundLocation(); }
108+
@Override public net.minecraft.client.audio.ISound.AttenuationType getAttenuationType() { return original.getAttenuationType(); }
109+
@Override public boolean canRepeat() { return original.canRepeat(); }
110+
@Override public int getRepeatDelay() { return original.getRepeatDelay(); }
111+
}
112+
}
Collapse file

‎src/main/java/org/polyfrost/ares/AresMod.java‎

Copy file name to clipboardExpand all lines: src/main/java/org/polyfrost/ares/AresMod.java
-25Lines changed: 0 additions & 25 deletions
This file was deleted.
Collapse file

‎src/main/java/org/polyfrost/ares/mixin/SoundMixin.java‎

Copy file name to clipboardExpand all lines: src/main/java/org/polyfrost/ares/mixin/SoundMixin.java
-112Lines changed: 0 additions & 112 deletions
This file was deleted.
Collapse file

‎src/main/resources/mixins.ares.json‎

Copy file name to clipboardExpand all lines: src/main/resources/mixins.ares.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compatibilityLevel": "JAVA_8",
33
"minVersion": "0.7",
4-
"package": "org.polyfrost.ares.mixin",
4+
"package": "org.inti.ares.mixin",
55
"refmap": "mixins.ares.refmap.json",
66
"injectors": {
77
"maxShiftBy": 5

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.