Skip to content

Commit

Permalink
tested, fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad2305m committed Dec 4, 2021
1 parent 18ae85b commit 05f5437
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/main/java/com/sonicether/soundphysics/SoundPhysics.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class SoundPhysics

private static final Pattern rainPattern = Pattern.compile(".*rain.*");
private static final Pattern blockPattern = Pattern.compile(".*block..*");
private static final Pattern uiPattern = Pattern.compile("ui..*");
//Private fields
private static final String logPrefix = "[SOUND PHYSICS]";
private static int auxFXSlot0;
Expand Down Expand Up @@ -220,7 +221,7 @@ private static Vec3d reflect(Vec3d dir, Vec3d normal)
private static void evaluateEnvironment(final int sourceID, final double posX, final double posY, final double posZ)
{
if (!ConfigManager.getConfig().enabled) return;
if (mc.player == null || mc.world == null || posY <= mc.world.getBottomY() || lastSoundCategory == SoundCategory.RECORDS)
if (mc.player == null || mc.world == null || posY <= mc.world.getBottomY() || lastSoundCategory == SoundCategory.RECORDS || uiPattern.matcher(lastSoundName).matches() || (posX == 0.0 && posY == 0.0 && posZ == 0.0))
{
//logDetailed("Menu sound!");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public enum ConfigPresets {
entry("field_28697", 0.1), entry("field_22153", 0.6), entry("field_27201", 0.3),
entry("field_27200", 0.3), entry("field_22154", 0.4), entry("field_28696", 0.1),
entry("field_27204", 2.3), entry("field_17734", 0.2), entry("field_17579", 0.3),
entry("field_28060", 1.8), entry("DEFAULT", 0.6)),
entry("field_28060", 1.8), entry(".DEFAULT", 0.6)),

0.3, 10.0, true, true, 1.0, false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ public static class Material_Properties {
Map<String, Pair<Double, String>> map =
SoundPhysicsMod.blockSoundGroups.entrySet().stream()
.collect(Collectors.toMap((e)-> e.getValue().getLeft(), (e) -> new Pair<>(0.5, e.getValue().getRight())));
map.getOrDefault("STONE", new Pair<>(1.0, ""));
map.getOrDefault("WOOD", new Pair<>(0.4, ""));
map.getOrDefault("GRAVEL", new Pair<>(0.3, ""));
map.getOrDefault("GRASS", new Pair<>(0.5, ""));
map.getOrDefault("METAL", new Pair<>(1.0, ""));
map.getOrDefault("GLASS", new Pair<>(0.5, ""));
map.getOrDefault("WOOL", new Pair<>(0.05, ""));
map.getOrDefault("SAND", new Pair<>(0.2, ""));
map.getOrDefault("SNOW", new Pair<>(0.2, ""));
map.getOrDefault("LADDER", new Pair<>(0.4, ""));
map.getOrDefault("ANVIL", new Pair<>(1.0, ""));
map.getOrDefault(".DEFAULT", new Pair<>(0.5, "")); // TODO more
map.putIfAbsent("STONE", new Pair<>(1.0, ""));
map.putIfAbsent("WOOD", new Pair<>(0.4, ""));
map.putIfAbsent("GRAVEL", new Pair<>(0.3, ""));
map.putIfAbsent("GRASS", new Pair<>(0.5, ""));
map.putIfAbsent("METAL", new Pair<>(1.0, ""));
map.putIfAbsent("GLASS", new Pair<>(0.5, ""));
map.putIfAbsent("WOOL", new Pair<>(0.05, ""));
map.putIfAbsent("SAND", new Pair<>(0.2, ""));
map.putIfAbsent("SNOW", new Pair<>(0.2, ""));
map.putIfAbsent("LADDER", new Pair<>(0.4, ""));
map.putIfAbsent("ANVIL", new Pair<>(1.0, ""));
map.putIfAbsent(".DEFAULT", new Pair<>(0.5, "")); // TODO more
reflectivityMap = map;
}
}
Expand Down

0 comments on commit 05f5437

Please sign in to comment.