aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/torui/coflsky/WSCommandHandler.java
diff options
context:
space:
mode:
authorFlorian Rinke <develop@torui.de>2021-10-11 20:55:06 +0200
committerFlorian Rinke <develop@torui.de>2021-10-11 20:55:06 +0200
commitfc4baf800cb5526350a98eadda0ce70e93f24bc6 (patch)
treec8d73235c971a342cb4c5a1d4b3182a073180ecd /src/main/java/de/torui/coflsky/WSCommandHandler.java
parent3e28db2478b08d54cdf63ddec86b4446e41ff6b2 (diff)
downloadCOFL-fc4baf800cb5526350a98eadda0ce70e93f24bc6.tar.gz
COFL-fc4baf800cb5526350a98eadda0ce70e93f24bc6.tar.bz2
COFL-fc4baf800cb5526350a98eadda0ce70e93f24bc6.zip
update PlaySound
Diffstat (limited to 'src/main/java/de/torui/coflsky/WSCommandHandler.java')
-rw-r--r--src/main/java/de/torui/coflsky/WSCommandHandler.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/de/torui/coflsky/WSCommandHandler.java b/src/main/java/de/torui/coflsky/WSCommandHandler.java
index dd74d87..4dbb500 100644
--- a/src/main/java/de/torui/coflsky/WSCommandHandler.java
+++ b/src/main/java/de/torui/coflsky/WSCommandHandler.java
@@ -1,6 +1,7 @@
package de.torui.coflsky;
import de.torui.coflsky.core.Command;
+import de.torui.coflsky.core.SoundCommand;
import de.torui.coflsky.core.WriteToChatCommand;
import de.torui.coflsky.websocket.WSClient;
import net.minecraft.client.Minecraft;
@@ -37,8 +38,10 @@ public class WSCommandHandler {
break;
case PlaySound:
PlaySound(cmd, sender);
+ break;
case ChatMessage:
ChatMessage(cmd);
+ break;
default:
break;
}
@@ -48,14 +51,14 @@ public class WSCommandHandler {
private static void PlaySound(Command cmd, Entity sender) {
- // Minecraft.getMinecraft().theWorld.playSoundAtEntity(sender,
- // "random.explode",1f, 1f);
-
+ SoundCommand sc = WSClient.gson.fromJson(cmd.getData(), SoundCommand.class);
+
SoundHandler handler = Minecraft.getMinecraft().getSoundHandler();
// random.explode
PositionedSoundRecord psr = PositionedSoundRecord
- .create(new ResourceLocation(WSClient.gson.fromJson(cmd.getData(), String.class)));
+ .create(new ResourceLocation(sc.Name), sc.Pitch);
+
handler.playSound(psr);
}