Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for fabric and newer versions #32

Open
wants to merge 89 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
9f174c8
Added all the modifications
djpadbit Sep 26, 2018
f7b9a8f
Updated README
djpadbit Sep 26, 2018
506e16a
Removed ISound thing because it's useless
djpadbit Sep 26, 2018
6698a71
NOT WORKING RIGHT NOW. Commit auto stereo to mono sound conversion, i…
djpadbit Sep 27, 2018
fd5601a
Auto stero downmix to mono
djpadbit Sep 28, 2018
e7550b9
Updated README
djpadbit Sep 28, 2018
4ec26f8
Fixed menu & ui sounds being converted to mono
djpadbit Sep 28, 2018
836328f
Disabled dynamic env by default
djpadbit Sep 28, 2018
437b36d
Updated README
djpadbit Sep 29, 2018
af813ac
Update README.md
Sep 30, 2018
d873c7e
update build.gradle
Sep 30, 2018
08eba91
fix getPath() error
Sep 30, 2018
2e7d7ab
align with upstream readme.md
Oct 1, 2018
ebf4c33
Added speed of sound delay testing (commented)
djpadbit Oct 1, 2018
53fbbad
Merge pull request #1 from Eddi2015/master
djpadbit Oct 2, 2018
b10ee2d
Updated build.gradle
djpadbit Oct 2, 2018
7417af9
Fixed computronics sound fuckery
djpadbit Oct 2, 2018
cc91e41
1.0.5 Release
djpadbit Oct 4, 2018
e96b000
Fixed bug that caused sounds with "ui" to not get converted such as t…
djpadbit Dec 31, 2018
ceacd15
1.0.5 Patch 1
djpadbit Dec 31, 2018
98664d5
Quick hack to fix the new dynamic surrounding's footsteps sounds
djpadbit Jan 3, 2019
b2d3119
Just a tid bit cleaner but still a dirt hack
djpadbit Jan 3, 2019
577cf40
1.0.5 Patch 2
djpadbit Jan 3, 2019
5161cd2
Fixed Dynmaic Env. thing
djpadbit Jan 27, 2019
12a2266
Modifed logging and options
djpadbit Jan 27, 2019
9329968
Added snow air absorption. Now sounds get muffled when it's snowing
djpadbit Jan 30, 2019
b54eaff
Bit of spaces
djpadbit Jan 30, 2019
b75414c
More logging in injector
djpadbit Jan 31, 2019
1bd9112
Now works on note blocks (configurable)
djpadbit Jan 31, 2019
f6b30dc
Don't try to restart the thread as it is useless and causes problems …
djpadbit Feb 3, 2019
3f20d9b
Fixed computronics play sound distance
djpadbit Feb 3, 2019
aea1b4e
1.0.6 Release
djpadbit Feb 13, 2019
89c7f87
Fixed only harp note blocks sound would get processed
djpadbit Mar 4, 2019
282c15c
Computronics fix source position for tape drive, speaker and speech box
djpadbit Apr 13, 2019
e511571
Added server support (seems to work for now)
djpadbit Apr 13, 2019
0d0ccf3
Another bugfix for the dynamic thing
djpadbit Apr 14, 2019
d2b5fcd
Bugfixes
djpadbit Apr 18, 2019
8bc501c
Fix sound position moving for computronics
djpadbit Apr 22, 2019
bbe011d
Added config for ray max distance
djpadbit May 15, 2019
7d71747
1.0.7 Release
djpadbit Jun 20, 2019
58e36ad
Fix computronics sounds being muffled on server without sound physics
djpadbit Jun 27, 2019
47e6e57
Fix footsteps on soulsand being muffled
djpadbit Jul 8, 2019
86522e0
Catch exceptions in environment evaluation.
djpadbit Jul 12, 2019
2087d31
WIP Immersive Railroading compatibility
djpadbit Jul 12, 2019
aa93987
Use the logger instead of stdout
djpadbit Jul 12, 2019
6922bc8
Added but commented out position shift for IR compat
djpadbit Jul 12, 2019
4ac40a7
Removed debugging
djpadbit Jul 12, 2019
afaf3b5
Updated README
djpadbit Jul 12, 2019
9eeae29
Remove ray bounce config as it is useless
djpadbit Jul 20, 2019
b15efd5
Updated gradle and added access transformer
djpadbit Jul 25, 2019
1a16895
Fix client mod rejection
djpadbit Jul 25, 2019
8d403fb
Updated README
djpadbit Jul 25, 2019
4808bd2
Made it a bit clearer
djpadbit Jul 25, 2019
a7b3725
Added doppler effect
djpadbit Jul 27, 2019
ce62c61
Commented out doppler effect because it sounds weird.
djpadbit Jul 28, 2019
82031bf
Check if sound is null before trying to get the name
djpadbit Jul 30, 2019
7e61fa9
Use || instead of |
djpadbit Aug 12, 2019
7a61e30
Release 1.0.8
djpadbit Aug 12, 2019
fca2c27
Updated gradle again, added DS patch, fixed config loading
djpadbit Sep 1, 2019
3c21e91
Updated Forge to latest recommended
djpadbit Sep 11, 2019
aa4b5e5
Only patch DS if version is 3.5.x.x
djpadbit Oct 13, 2019
7c1b392
Simplify a bit the snow air absorption
djpadbit Oct 23, 2019
56a53db
Fix muffled snow footstep sounds
djpadbit Oct 25, 2019
3354549
Fixed IR compatiblity for IR 1.7.0+
djpadbit Nov 11, 2019
ce1f3e2
1.0.8-1 Release
djpadbit Nov 24, 2019
8ba9172
Fix rift sounds in The Betweenlands being converted to mono.
djpadbit Mar 6, 2020
beaed46
Added The Midnight patch to fix https://github.com/djpadbit/Sound-Phy…
djpadbit Apr 27, 2020
d0c5f50
Comments
djpadbit Apr 27, 2020
574d8f9
Removed dynamic env. evalutaion + Cleaned up dead code
djpadbit May 1, 2020
ed7d90e
Questionable code formatting
djpadbit May 1, 2020
0a5879c
Better build versioning
djpadbit May 11, 2020
88092a3
build.gradle converted to unix line ending
djpadbit May 11, 2020
22f424c
Added Global Volume Multiplier config option
djpadbit May 13, 2020
a6ce81d
Fix bug with DS and globalVolumeMultiplier
djpadbit May 13, 2020
0bfcf46
Don't offset block sounds if player is inside, fixes #30
djpadbit May 30, 2020
d57704f
1.0.9 Release
djpadbit May 31, 2020
91b1911
Added echo, may need to tweak the values though.
djpadbit Jun 24, 2020
96453ba
Don't use Y coords as check if ingame, fixes #31
djpadbit Jun 27, 2020
e7ae852
Updated forge
djpadbit Jun 27, 2020
e3e745a
Readd reverb to The Midnight, fixes #36
djpadbit Jul 15, 2020
87ced9e
Added IC2 Compatbility
djpadbit Jul 26, 2020
d0bb85f
Null check mc in onLoadSound
djpadbit Sep 4, 2020
9e81d40
1.0.10 Release
djpadbit Sep 7, 2020
94a2e11
Fix #44 by throwing an IllegalStateException when a deadlock would ha…
djpadbit Oct 4, 2020
5ffb68b
1.0.10-1 Release
djpadbit Oct 4, 2020
df7c7ab
Added Gibly's VC patching
djpadbit Nov 8, 2020
f1648ae
Added Patching for Gliby's VC Sources
djpadbit Nov 9, 2020
2da4ae9
Added IC2 Classic compatibility
djpadbit Nov 21, 2020
4641cd1
Fix hacky fix to fix #52
djpadbit Dec 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions BUILD.bat

This file was deleted.

13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# Sound-Physics
A Minecraft mod that provides realistic sound attenuation, reverberation, and absorption through blocks.

This is a fork! TODO: There is still some cleanup left! Sonic Ether's original source code was very messy!
Downloads are in the [releases tab](https://github.com/djpadbit/Sound-Physics/releases)

This is a fork of a fork! I forked it from daipenger who forked it from sonicether, daipenger ported it to 1.12.2 and cleaned up the codebase, i just added some stuff.

The stuff added in this fork:
* Automatic stero to mono downmixing of sounds (So the original resourcepack is not needed anymore)
* More compatibility with mods (Computronics & Immersive Railroading)
* Server-side support (right position for entity and computronics sounds and higher distance before sound cutoff)

Todo:
* Rewrite Dynamic environement evaluation (feature removed for now)
* More mod compatibility ? I'm open to suggestions
68 changes: 37 additions & 31 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,54 +1,60 @@
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.

version = "1.12.2"
version = "${mc_version}-${mod_version}"
group = "com.sonicether.soundphysics"
archivesBaseName = "Sound-Physics"

jar {
manifest {
attributes 'FMLCorePlugin': 'com.sonicether.soundphysics.CoreModLoader'
attributes 'FMLCorePluginContainsFMLMod': 'true'
}
attributes 'FMLCorePlugin': 'com.sonicether.soundphysics.CoreModLoader'
attributes 'FMLCorePluginContainsFMLMod': 'true'
attributes 'FMLAT': 'soundphysics_at.cfg'
}
}

sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
sourceCompatibility = targetCompatibility = '1.8'
}

minecraft {
version = "1.12.2-14.23.0.2542"
runDir = "run"
mappings = "snapshot_20171003"
version = "${mc_version}-${forge_version}"
runDir = "run"
mappings = mcp_mappings

replace '${version}', mod_version
replace '${mc_version}', mc_version
replaceIn "SoundPhysics.java"
}

dependencies {
}

processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
// this will ensure that this task is redone when the versions change.
inputs.property "version", mod_version
inputs.property "mc_version", mc_version

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

// replace version and mcversion
expand 'version':mod_version, 'mc_version':mc_version
}

// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 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

forge_version=14.23.5.2847
mcp_mappings=snapshot_20180814

mc_version=1.12.2
mod_version=1.0.10-1
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
Empty file modified gradlew
100644 → 100755
Empty file.
71 changes: 69 additions & 2 deletions src/main/java/com/sonicether/soundphysics/Config.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.sonicether.soundphysics;

import java.io.File;

import java.util.ArrayList;
import java.util.List;

Expand All @@ -20,12 +22,18 @@ public class Config {
// general
public static float rolloffFactor;
public static float globalReverbGain;
public static float globalVolumeMultiplier;
public static float globalReverbBrightness;
public static float soundDistanceAllowance;
public static float globalBlockAbsorption;
public static float globalBlockReflectance;
public static float airAbsorption;
public static float snowAirAbsorptionFactor;
public static float underwaterFilter;
public static boolean noteBlockEnable;
public static float maxDistance;
public static boolean volumeMulOnlyAffected;
public static float globalEchoMultiplier;

// performance
public static boolean skipRainOcclusionTracing;
Expand All @@ -43,19 +51,38 @@ public class Config {
public static float sandReflectivity;
public static float snowReflectivity;

// compatibility
public static boolean computronicsPatching;
public static boolean irPatching;
public static boolean dsPatching;
public static boolean midnightPatching;
public static boolean midnightPatchingFix;
public static boolean ic2Patching;
public static boolean glibyVCPatching;
public static boolean glibyVCSrcPatching;
public static boolean autoSteroDownmix;

// misc
public static boolean autoSteroDownmixLogging;
public static boolean injectorLogging;

private static final String categoryGeneral = "General";
private static final String categoryPerformance = "Performance";
private static final String categoryMaterialProperties = "Material properties";
private static final String categoryCompatibility = "Compatibility";
private static final String categoryMisc = "Misc";

static {
instance = new Config();
}

private Config() {
this.forgeConfig = new Configuration(new File(new File(CoreModLoader.mcDir, "config"), SoundPhysics.modid+".cfg"));
syncConfig();
}

public void preInit(final FMLPreInitializationEvent event) {
this.forgeConfig = new Configuration(event.getSuggestedConfigurationFile());
//this.forgeConfig = new Configuration(event.getSuggestedConfigurationFile());
syncConfig();
}

Expand All @@ -76,6 +103,8 @@ public List<IConfigElement> getConfigElements() {
list.add(new ConfigElement(this.forgeConfig.getCategory(Config.categoryGeneral)));
list.add(new ConfigElement(this.forgeConfig.getCategory(Config.categoryPerformance)));
list.add(new ConfigElement(this.forgeConfig.getCategory(Config.categoryMaterialProperties)));
list.add(new ConfigElement(this.forgeConfig.getCategory(Config.categoryCompatibility)));
list.add(new ConfigElement(this.forgeConfig.getCategory(Config.categoryMisc)));

return list;
}
Expand All @@ -84,6 +113,8 @@ private void syncConfig() {
// General
rolloffFactor = this.forgeConfig.getFloat("Attenuation Factor", categoryGeneral, 1.0f, 0.2f, 1.0f,
"Affects how quiet a sound gets based on distance. Lower values mean distant sounds are louder. 1.0 is the physically correct value.");
globalVolumeMultiplier = this.forgeConfig.getFloat("Global Volume Multiplier", categoryGeneral, 4.0f, 0.1f, 8.0f,
"The global volume multiplier of all sounds.");
globalReverbGain = this.forgeConfig.getFloat("Global Reverb Gain", categoryGeneral, 1.0f, 0.1f, 2.0f,
"The global volume of simulated reverberations.");
globalReverbBrightness = this.forgeConfig.getFloat("Global Reverb Brightness", categoryGeneral, 1.0f, 0.1f,
Expand All @@ -99,8 +130,18 @@ private void syncConfig() {
"Minecraft won't allow sounds to play past a certain distance. This parameter is a multiplier for how far away a sound source is allowed to be in order for it to actually play. Values too high can cause polyphony issues.");
airAbsorption = this.forgeConfig.getFloat("Air Absorption", categoryGeneral, 1.0f, 0.0f, 5.0f,
"A value controlling the amount that air absorbs high frequencies with distance. A value of 1.0 is physically correct for air with normal humidity and temperature. Higher values mean air will absorb more high frequencies with distance. 0 disables this effect.");
snowAirAbsorptionFactor = this.forgeConfig.getFloat("Max Snow Air Absorption Factor", categoryGeneral, 5.0f, 0.0f, 10.0f,
"The maximum air absorption factor when it's snowing. The real absorption factor will depend on the snow's intensity. Set to 1 or lower to disable");
underwaterFilter = this.forgeConfig.getFloat("Underwater Filter", categoryGeneral, 0.8f, 0.0f, 1.0f,
"How much sound is filtered when the player is underwater. 0.0 means no filter. 1.0 means fully filtered.");
noteBlockEnable = this.forgeConfig.getBoolean("Affect Note Blocks", categoryGeneral, true,
"If true, note blocks will be processed.");
maxDistance = this.forgeConfig.getFloat("Max ray distance", categoryGeneral, 256.0f, 1.0f, 8192.0f,
"How far the rays should be traced.");
volumeMulOnlyAffected = this.forgeConfig.getBoolean("Volume Multiplier Only On Affected", categoryGeneral, true,
"If true, the global volume multiplier will only be applied to affected sounds (so not to the ui sounds for example).");
globalEchoMultiplier = this.forgeConfig.getFloat("Global Echo Multiplier", categoryGeneral, 1.0f, 0.0f, 2.0f,
"The global volume multiplier of the echos, put to 0 to disable echos all together");

// performance
skipRainOcclusionTracing = this.forgeConfig.getBoolean("Skip Rain Occlusion Tracing", categoryPerformance, true,
Expand Down Expand Up @@ -132,9 +173,35 @@ private void syncConfig() {
snowReflectivity = this.forgeConfig.getFloat("Snow Reflectivity", categoryMaterialProperties, 0.2f, 0.0f, 1.0f,
"Sound reflectivity for snow blocks.");

// compatibility
computronicsPatching = this.forgeConfig.getBoolean("Patch Computronics", categoryCompatibility, true,
"REQUIRES RESTART. If true, patches the Computronics sound sources so it works with Sound Physics.");
irPatching = this.forgeConfig.getBoolean("Patch Immersive Railroading", categoryCompatibility, true,
"REQUIRES RESTART. If true, patches the Immersive Railroading sound sources so it works with Sound Physics.");
dsPatching = this.forgeConfig.getBoolean("Patch Dynamic Surroundings", categoryCompatibility, true,
"REQUIRES RESTART. If true, patches Dynamic Surroundings to fix some bugs with Sound Physics.");
midnightPatching = this.forgeConfig.getBoolean("Patch The Midnight", categoryCompatibility, true,
"REQUIRES RESTART. If true, patches The Midnight to disable redundant functionality that causes some problems.");
midnightPatchingFix = this.forgeConfig.getBoolean("Readd The Midnight Reverb", categoryCompatibility, true,
"If true, readds The Midnight reverb that is removed with the patch.");
ic2Patching = this.forgeConfig.getBoolean("Patch IC2", categoryCompatibility, true,
"REQUIRES RESTART. If true, patches IC2 audio to better work with Sound Physics.");
glibyVCPatching = this.forgeConfig.getBoolean("Patch Gliby's Voice Chat", categoryCompatibility, true,
"REQUIRES RESTART. If true, patches Gliby's VC's copied soundsystem classes to restore Sound Physics.");
glibyVCSrcPatching = this.forgeConfig.getBoolean("Patch Gliby's VC sources", categoryCompatibility, true,
"REQUIRES RESTART. If true, patches Gliby's VC sources to work with Sound Physics.");
autoSteroDownmix = this.forgeConfig.getBoolean("Auto Stereo Downmix", categoryCompatibility, true,
"REQUIRES RESTART. If true, Automatically downmix stereo sounds that are loaded to mono");

// misc
autoSteroDownmixLogging = this.forgeConfig.getBoolean("Stereo downmix Logging", categoryMisc, false,
"If true, Prints sound name and format of the sounds that get converted");
injectorLogging = this.forgeConfig.getBoolean("Injector Logging", categoryMisc, false,
"If true, Logs debug info about the injector");

SoundPhysics.applyConfigChanges();
if (this.forgeConfig.hasChanged()) {
this.forgeConfig.save();
SoundPhysics.applyConfigChanges();
}
}

Expand Down
Loading