diff --git a/src/main/java/net/pedroricardo/subtitles/mixin/RenderSubtitleMixin.java b/src/main/java/net/pedroricardo/subtitles/mixin/RenderSubtitleMixin.java index a98a54b..b9444ce 100644 --- a/src/main/java/net/pedroricardo/subtitles/mixin/RenderSubtitleMixin.java +++ b/src/main/java/net/pedroricardo/subtitles/mixin/RenderSubtitleMixin.java @@ -74,7 +74,7 @@ public void renderGameOverlay(float partialTicks, boolean flag, int mouseX, int width - (longestStringWidth / 2) - (fontrenderer.getStringWidth(stringToDraw) / 2) - sp - arrowWidth / 2, height - 34 - (subtitleLines * lineHeight) - sp, Color.intToIntARGB( - (int) (Math.min(60.0f, Subtitles.soundsPlaying.get(string)) * 255.0f / 60f), 255, + (int) (Math.min(60.0f, 20.0f + Subtitles.soundsPlaying.get(string)) * 255.0f / 70.0f), 255, 255, 255)); if (angleDegrees <= 325 && 215 <= angleDegrees) { @@ -82,14 +82,14 @@ public void renderGameOverlay(float partialTicks, boolean flag, int mouseX, int width - 6 - sp, height - 34 - (subtitleLines * lineHeight) - sp, Color.intToIntARGB( - (int) (Math.min(60.0f, Subtitles.soundsPlaying.get(string)) * 255.0f / 60f), 255, + (int) (Math.min(60.0f, 10.0f + Subtitles.soundsPlaying.get(string)) * 255.0f / 70.0f), 255, 255, 255)); } else if (angleDegrees >= 35 && 145 >= angleDegrees) { fontrenderer.drawString("<", width - longestStringWidth - sp - arrowWidth, height - 34 - (subtitleLines * lineHeight) - sp, Color.intToIntARGB( - (int) (Math.min(60.0f, Subtitles.soundsPlaying.get(string)) * 255.0f / 60f), 255, + (int) (Math.min(60.0f, 20.0f + Subtitles.soundsPlaying.get(string)) * 255.0f / 70.0f), 255, 255, 255)); } } else { diff --git a/src/main/java/net/pedroricardo/subtitles/mixin/SoundPoolMixin.java b/src/main/java/net/pedroricardo/subtitles/mixin/SoundPoolMixin.java index e769896..098072e 100644 --- a/src/main/java/net/pedroricardo/subtitles/mixin/SoundPoolMixin.java +++ b/src/main/java/net/pedroricardo/subtitles/mixin/SoundPoolMixin.java @@ -1,5 +1,6 @@ package net.pedroricardo.subtitles.mixin; +import net.minecraft.client.Minecraft; import net.minecraft.src.SoundManager; import net.minecraft.src.SoundPoolEntry; import net.pedroricardo.subtitles.Subtitles; @@ -23,13 +24,11 @@ public class SoundPoolMixin { @Inject(method = "playSound", at = @At(value = "INVOKE", target = "Lpaulscode/sound/SoundSystem;newSource(ZLjava/lang/String;Ljava/net/URL;Ljava/lang/String;ZFFFIF)V"), locals = LocalCapture.CAPTURE_FAILHARD) public void playSound(String s, float x, float y, float z, float f3, float f4, CallbackInfo ci, - SoundPoolEntry soundpoolentry, String s1, float f5) throws IOException, - UnsupportedAudioFileException { + SoundPoolEntry soundpoolentry, String s1, float f5) throws IOException { File file = new File(soundpoolentry.soundUrl.getPath()); - double soundDuration = 0.0f; if (file.getName().endsWith(".ogg")) { - soundDuration = calculateDuration(file); - Subtitles.soundsPlaying.put(s, 60.0f + (float)soundDuration / 15.0f); + double soundDuration = calculateDuration(file); + Subtitles.soundsPlaying.put(s, 60.0f + (float)soundDuration / 50.0f); } else { Subtitles.soundsPlaying.put(s, 150.0f); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 4fd8aa6..590cc20 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -4,7 +4,7 @@ "version": "${version}", "name": "Subtitles", - "description": "This mod", + "description": "This mod adds modern subtitles to the game.", "authors": [ "Pedro Ricardo" ], diff --git a/src/main/resources/lang/subtitles/en_US.lang b/src/main/resources/lang/subtitles/en_US.lang index e929ad6..2329cc3 100644 --- a/src/main/resources/lang/subtitles/en_US.lang +++ b/src/main/resources/lang/subtitles/en_US.lang @@ -50,4 +50,17 @@ subtitles.mob.creeper=Creeper hurts subtitles.null=Something subtitles.random.glass=Glass shatters subtitles.liquid.splash=Splashing -subtitles.liquid.water=Water flows \ No newline at end of file +subtitles.liquid.water=Water flows +subtitles.tile.piston.out=Piston extends +subtitles.tile.piston.in=Piston retracts +subtitles.ambient.weather.rain=Rain falls +subtitles.ambient.weather.thunder=Thunder roars +subtitles.ambient.cave.cave=Eerie noise +subtitles.note.bass=Note Block plays +subtitles.note.bassattack=Note Block plays +subtitles.note.bd=Note Block plays +subtitles.note.harp=Note Block plays +subtitles.note.hat=Note Block plays +subtitles.note.pling=Note Block plays +subtitles.note.snare=Note Block plays +subtitles.portal.trigger=Portal noise intensifies