Skip to content

Commit 35efacd

Browse files
authored
Make custom quest sounds decent volume (#162)
1 parent 7434970 commit 35efacd

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/main/java/betterquesting/client/QuestNotification.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import java.util.List;
66

77
import net.minecraft.client.Minecraft;
8-
import net.minecraft.client.audio.PositionedSoundRecord;
8+
import net.minecraft.client.audio.PositionedSound;
99
import net.minecraft.item.ItemStack;
1010
import net.minecraft.util.EnumChatFormatting;
1111
import net.minecraft.util.MathHelper;
@@ -14,6 +14,7 @@
1414

1515
import org.lwjgl.opengl.GL11;
1616

17+
import betterquesting.api.properties.NativeProps;
1718
import betterquesting.api.storage.BQ_Settings;
1819
import betterquesting.api.utils.RenderUtils;
1920
import betterquesting.api2.utils.QuestTranslation;
@@ -58,8 +59,10 @@ public void onDrawScreen(RenderGameOverlayEvent.Post event) {
5859
}
5960
notice.init = true;
6061
notice.startTime = Minecraft.getSystemTime();
62+
// lower volume for default xp jingle, standard volume for custom sounds
63+
float volume = notice.sound.equals(NativeProps.SOUND_COMPLETE.getDefault()) ? 0.25f : 1f;
6164
mc.getSoundHandler()
62-
.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation(notice.sound), 1.0F));
65+
.playSound(new QuestCompleteSound(new ResourceLocation(notice.sound), volume));
6366
}
6467

6568
if (notice.getTime() >= 6F) {
@@ -123,4 +126,18 @@ public float getTime() {
123126
}
124127
}
125128

129+
public static class QuestCompleteSound extends PositionedSound {
130+
131+
public QuestCompleteSound(ResourceLocation resource, float volume) {
132+
super(resource);
133+
this.volume = volume;
134+
this.field_147663_c = 1; // Pitch
135+
this.xPosF = 0;
136+
this.yPosF = 0;
137+
this.zPosF = 0;
138+
this.repeat = false;
139+
this.field_147665_h = 0; // Repeat time
140+
this.field_147666_i = AttenuationType.NONE;
141+
}
142+
}
126143
}

0 commit comments

Comments
 (0)