aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md7
-rw-r--r--build.gradle2
-rw-r--r--src/main/java/me/Danker/DankersSkyblockMod.java2
-rw-r--r--src/main/java/me/Danker/commands/CustomMusicCommand.java18
-rw-r--r--src/main/java/me/Danker/features/CustomMusic.java36
-rw-r--r--src/main/java/me/Danker/handlers/ConfigHandler.java6
6 files changed, 37 insertions, 34 deletions
diff --git a/README.md b/README.md
index 0bd7c27..f42b153 100644
--- a/README.md
+++ b/README.md
@@ -85,7 +85,7 @@ Discord Server: https://discord.gg/QsEkNQS
- /reparty - Disbands and reparties all members in the party
- /fairysouls - Check the fairysouls of a player
- /lobbybank - Uses API to find the average bank total of the lobby, as well the three players with the highest total money in the bank (and purse).
-- /dsmmusic <stop/reload/volume> [dungeonboss/bloodroom/dungeon] [#] - Stops, reloads or changes the volume of custom music.
+- /dsmmusic <stop/reload/volume> [dungeonboss/bloodroom/dungeon] [1-100] - Stops, reloads or changes the volume of custom music.
## Keybinds
- Open Maddox menu - M by default.
@@ -93,10 +93,13 @@ Discord Server: https://discord.gg/QsEkNQS
- Start/Stop Skill Tracker - Numpad 5 by default.
## Custom Music
-- To use custom music, place a music file with the given name in the `.minecraft/config/dsmmusic` folder, either run `/dsmmusic reload` or restart your game, and enable the custom song in `/dsm`.
+1. Place a music file with the given name in the `.mincraft/config/dsmmusic` folder:
- Dungeon music: `dungeon.wav`
- Blood room music: `bloodroom.wav`
- Dungeon boss music: `dungeonboss.wav`
+2. Either run `/dsmmusic reload` or restart your game.
+3. Enable the custom music in `/dsm`.
+4. (Optional) Change the volume of the music with `/dsmmusic volume`.
### Notes
- Slayer tracker for token drops and 20% chance drops uses a 12x12x12 bounding box centered on the player to detect the drops. If you are out of the range of the item drop, it will not count on the tracker.
diff --git a/build.gradle b/build.gradle
index db9242c..bbbfa06 100644
--- a/build.gradle
+++ b/build.gradle
@@ -20,7 +20,7 @@ plugins {
id "net.minecraftforge.gradle.forge" version "2.0.2"
}
*/
-version = "1.8.6-beta5"
+version = "1.8.6-beta6"
group= "me.Danker.DankersSkyblockMod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "Danker's Skyblock Mod"
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java
index 17def9a..0d6dbac 100644
--- a/src/main/java/me/Danker/DankersSkyblockMod.java
+++ b/src/main/java/me/Danker/DankersSkyblockMod.java
@@ -62,7 +62,7 @@ import java.util.Map;
@Mod(modid = DankersSkyblockMod.MODID, version = DankersSkyblockMod.VERSION, clientSideOnly = true)
public class DankersSkyblockMod {
public static final String MODID = "Danker's Skyblock Mod";
- public static final String VERSION = "1.8.6-beta5";
+ public static final String VERSION = "1.8.6-beta6";
public static int titleTimer = -1;
public static boolean showTitle = false;
public static String titleText = "";
diff --git a/src/main/java/me/Danker/commands/CustomMusicCommand.java b/src/main/java/me/Danker/commands/CustomMusicCommand.java
index 6412474..0e80dd3 100644
--- a/src/main/java/me/Danker/commands/CustomMusicCommand.java
+++ b/src/main/java/me/Danker/commands/CustomMusicCommand.java
@@ -24,7 +24,7 @@ public class CustomMusicCommand extends CommandBase {
@Override
public String getCommandUsage(ICommandSender arg0) {
- return "/" + getCommandName() + " <stop/reload/volume> [dungeonboss/bloodroom/dungeon] [#]";
+ return "/" + getCommandName() + " <stop/reload/volume> [dungeonboss/bloodroom/dungeon] [1-100]";
}
public static String usage(ICommandSender arg0) {
@@ -75,7 +75,7 @@ public class CustomMusicCommand extends CommandBase {
return;
}
- float volume = Float.parseFloat(arg1[2]);
+ int volume = Integer.parseInt(arg1[2]);
boolean success;
switch (arg1[1].toLowerCase()) {
@@ -85,8 +85,8 @@ public class CustomMusicCommand extends CommandBase {
return;
}
- CustomMusic.dungeonbossDecibels = volume;
- ConfigHandler.writeIntConfig("music", "DungeonBossDecibels", (int) volume);
+ CustomMusic.dungeonbossVolume = volume;
+ ConfigHandler.writeIntConfig("music", "DungeonBossVolume", volume);
break;
case "bloodroom":
success = CustomMusic.bloodroom.setVolume(volume);
@@ -94,8 +94,8 @@ public class CustomMusicCommand extends CommandBase {
return;
}
- CustomMusic.bloodroomDecibels = volume;
- ConfigHandler.writeIntConfig("music", "BloodRoomDecibels", (int) volume);
+ CustomMusic.bloodroomVolume = volume;
+ ConfigHandler.writeIntConfig("music", "BloodRoomVolume", volume);
break;
case "dungeon":
success = CustomMusic.dungeon.setVolume(volume);
@@ -103,15 +103,15 @@ public class CustomMusicCommand extends CommandBase {
return;
}
- CustomMusic.dungeonDecibels = volume;
- ConfigHandler.writeIntConfig("music", "DungeonDecibels", (int) volume);
+ CustomMusic.dungeonVolume = volume;
+ ConfigHandler.writeIntConfig("music", "DungeonVolume", volume);
break;
default:
player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0)));
return;
}
- player.addChatMessage(new ChatComponentText(DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + DankersSkyblockMod.MAIN_COLOUR + " was set to " + DankersSkyblockMod.SECONDARY_COLOUR + volume + "db"));
+ player.addChatMessage(new ChatComponentText(DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + DankersSkyblockMod.MAIN_COLOUR + " was set to " + DankersSkyblockMod.SECONDARY_COLOUR + volume + "%"));
break;
default:
player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0)));
diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java
index 342913f..4b1f6bb 100644
--- a/src/main/java/me/Danker/features/CustomMusic.java
+++ b/src/main/java/me/Danker/features/CustomMusic.java
@@ -28,11 +28,11 @@ public class CustomMusic {
static boolean prevInDungeonBossRoom = false;
public static boolean inDungeonBossRoom = false;
public static Song dungeonboss;
- public static float dungeonbossDecibels;
+ public static int dungeonbossVolume;
public static Song bloodroom;
- public static float bloodroomDecibels;
+ public static int bloodroomVolume;
public static Song dungeon;
- public static float dungeonDecibels;
+ public static int dungeonVolume;
@SubscribeEvent
public void onWorldChange(WorldEvent.Load event) {
@@ -66,9 +66,6 @@ public class CustomMusic {
if (!prevInDungeonBossRoom) {
dungeonboss.start();
}
- } else {
- inDungeonBossRoom = false;
- dungeonboss.stop();
}
}
}
@@ -100,8 +97,8 @@ public class CustomMusic {
@SubscribeEvent
public void onSound(PlaySoundEvent event) {
- if (cancelNotes) {
- if (event.isCancelable() && event.name.startsWith("note.")) event.setCanceled(true);
+ if (cancelNotes && event.name.startsWith("note.")) {
+ event.result = null;
}
}
@@ -114,19 +111,18 @@ public class CustomMusic {
File dungeonBossFile = new File(directory + "/dungeonboss.wav");
System.out.println("dungeonboss.wav exists?: " + dungeonBossFile.exists());
- dungeonboss = new Song(dungeonBossFile, dungeonbossDecibels);
+ dungeonboss = new Song(dungeonBossFile, dungeonbossVolume);
File bloodRoomFile = new File(directory + "/bloodroom.wav");
System.out.println("bloodroom.wav exists?: " + bloodRoomFile.exists());
- bloodroom = new Song(bloodRoomFile, bloodroomDecibels);
+ bloodroom = new Song(bloodRoomFile, bloodroomVolume);
File dungeonFile = new File(directory + "/dungeon.wav");
System.out.println("dungeon.wav exists?: " + dungeonFile.exists());
- dungeon = new Song(dungeonFile, dungeonDecibels);
+ dungeon = new Song(dungeonFile, dungeonVolume);
}
public static void reset() {
- cancelNotes = false;
if (dungeonboss != null) dungeonboss.stop();
if (bloodroom != null) bloodroom.stop();
if (dungeon != null) dungeon.stop();
@@ -136,20 +132,20 @@ public class CustomMusic {
public Clip music;
- public Song(File file, float decibels) throws IOException, UnsupportedAudioFileException, LineUnavailableException {
+ public Song(File file, int volume) throws IOException, UnsupportedAudioFileException, LineUnavailableException {
if (file.exists()) {
music = AudioSystem.getClip();
AudioInputStream ais = AudioSystem.getAudioInputStream(file);
music.open(ais);
- setVolume(decibels);
+ setVolume(volume);
}
}
public void start() {
reset();
- cancelNotes = true;
if (music != null) {
+ cancelNotes = true;
music.setMicrosecondPosition(0);
music.start();
music.loop(Clip.LOOP_CONTINUOUSLY);
@@ -161,13 +157,17 @@ public class CustomMusic {
if (music != null) music.stop();
}
- public boolean setVolume(float decibels) {
+ public boolean setVolume(int volume) {
+ EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (music == null) return false;
+ if (volume <= 0 || volume > 100) {
+ if (player != null) player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Volume can only be set between 0% and 100%."));
+ return false;
+ }
+ float decibels = (float) (20 * Math.log(volume / 100.0));
FloatControl control = (FloatControl) music.getControl(FloatControl.Type.MASTER_GAIN);
if (decibels <= control.getMinimum() || decibels >= control.getMaximum()) {
- EntityPlayer player = Minecraft.getMinecraft().thePlayer;
- if (player != null) player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Volume can only be set between " + control.getMinimum() + " and " + control.getMaximum() + "."));
return false;
}
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java
index 6d474d4..1551a3e 100644
--- a/src/main/java/me/Danker/handlers/ConfigHandler.java
+++ b/src/main/java/me/Danker/handlers/ConfigHandler.java
@@ -277,9 +277,9 @@ public class ConfigHandler {
ToggleCommand.bloodRoomMusic = initBoolean("toggles", "BloodRoomMusic", false);
ToggleCommand.dungeonMusic = initBoolean("toggles", "DungeonMusic", false);
// Music Volume
- CustomMusic.dungeonbossDecibels = (float) initInt("music", "DungeonBossDecibels", -20);
- CustomMusic.bloodroomDecibels = (float) initInt("music", "BloodRoomDecibels", -20);
- CustomMusic.dungeonDecibels = (float) initInt("music", "DungeonDecibels", -20);
+ CustomMusic.dungeonbossVolume = initInt("music", "DungeonBossVolume", 50);
+ CustomMusic.bloodroomVolume = initInt("music", "BloodRoomVolume", 50);
+ CustomMusic.dungeonVolume = initInt("music", "DungeonVolume", 50);
// API
if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", "");