diff --git a/src/main/java/com/sonicether/soundphysics/Config.java b/src/main/java/com/sonicether/soundphysics/Config.java index 5a880d34..045043ae 100644 --- a/src/main/java/com/sonicether/soundphysics/Config.java +++ b/src/main/java/com/sonicether/soundphysics/Config.java @@ -113,19 +113,19 @@ private void syncConfig() { "If true, enables a simpler technique for determining when the player and a sound source share airspace. Might sometimes miss recognizing shared airspace, but it's faster to calculate."); // material properties - stoneReflectivity = this.forgeConfig.getFloat("Stone Reflectivity", categoryMaterialProperties, 1.0f, 0.0f, + stoneReflectivity = this.forgeConfig.getFloat("Stone Reflectivity", categoryMaterialProperties, 0.95f, 0.0f, 1.0f, "Sound reflectivity for stone blocks."); - woodReflectivity = this.forgeConfig.getFloat("Wood Reflectivity", categoryMaterialProperties, 0.4f, 0.0f, 1.0f, + woodReflectivity = this.forgeConfig.getFloat("Wood Reflectivity", categoryMaterialProperties, 0.7f, 0.0f, 1.0f, "Sound reflectivity for wooden blocks."); groundReflectivity = this.forgeConfig.getFloat("Ground Reflectivity", categoryMaterialProperties, 0.3f, 0.0f, 1.0f, "Sound reflectivity for ground blocks (dirt, gravel, etc)."); - plantReflectivity = this.forgeConfig.getFloat("Foliage Reflectivity", categoryMaterialProperties, 0.5f, 0.0f, + plantReflectivity = this.forgeConfig.getFloat("Foliage Reflectivity", categoryMaterialProperties, 0.2f, 0.0f, 1.0f, "Sound reflectivity for foliage blocks (leaves, grass, etc.)."); - metalReflectivity = this.forgeConfig.getFloat("Metal Reflectivity", categoryMaterialProperties, 1.0f, 0.0f, + metalReflectivity = this.forgeConfig.getFloat("Metal Reflectivity", categoryMaterialProperties, 0.97f, 0.0f, 1.0f, "Sound reflectivity for metal blocks."); glassReflectivity = this.forgeConfig.getFloat("Glass Reflectivity", categoryMaterialProperties, 0.5f, 0.0f, 1.0f, "Sound reflectivity for glass blocks."); - clothReflectivity = this.forgeConfig.getFloat("Cloth Reflectivity", categoryMaterialProperties, 0.05f, 0.0f, + clothReflectivity = this.forgeConfig.getFloat("Cloth Reflectivity", categoryMaterialProperties, 0.25f, 0.0f, 1.0f, "Sound reflectivity for cloth blocks (carpet, wool, etc)."); sandReflectivity = this.forgeConfig.getFloat("Sand Reflectivity", categoryMaterialProperties, 0.2f, 0.0f, 1.0f, "Sound reflectivity for sand blocks."); diff --git a/src/main/java/com/sonicether/soundphysics/SoundPhysics.java b/src/main/java/com/sonicether/soundphysics/SoundPhysics.java index a92deade..7b7e8c98 100644 --- a/src/main/java/com/sonicether/soundphysics/SoundPhysics.java +++ b/src/main/java/com/sonicether/soundphysics/SoundPhysics.java @@ -229,12 +229,11 @@ private static Vec3d getNormalFromFacing(final EnumFacing sideHit) { } private static Vec3d reflect(final Vec3d dir, final Vec3d normal) { - // dir - 2.0 * dot(normal, dir) * normal - final double dot = dir.dotProduct(normal); + final double dot2 = dir.dotProduct(normal) * 2; - final double x = dir.x - 2.0 * dot * normal.x; - final double y = dir.y - 2.0 * dot * normal.y; - final double z = dir.z - 2.0 * dot * normal.z; + final double x = dir.x - dot2 * normal.x; + final double y = dir.y - dot2 * normal.y; + final double z = dir.z - dot2 * normal.z; return new Vec3d(x, y, z); } @@ -254,7 +253,7 @@ private static Vec3d offsetSoundByName(final double soundX, final double soundY, offsetY = 0.1; } - if (category == SoundCategory.BLOCKS || category == SoundCategory.RECORDS || name.matches(".*block.*")) { + if (category == SoundCategory.BLOCKS || name.matches(".*block.*")) { // The ray will probably hit the block that it's emitting from // before // escaping. Offset the ray start position towards the player by the @@ -279,8 +278,9 @@ private static Vec3d offsetSoundByName(final double soundX, final double soundY, @SuppressWarnings("deprecation") private static void evaluateEnvironment(final int sourceID, final float posX, final float posY, final float posZ) { - if (mc.player == null || mc.world == null || posY <= 0) { - // Menu clicks, posY <= 0 as a condition has to be there: Ingame + if (mc.player == null | mc.world == null | posY <= 0 | lastSoundCategory == SoundCategory.RECORDS + | lastSoundCategory == SoundCategory.MUSIC) { + // posY <= 0 as a condition has to be there: Ingame // menu clicks do have a player and world present setEnvironment(sourceID, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); return;