From fc4baf800cb5526350a98eadda0ce70e93f24bc6 Mon Sep 17 00:00:00 2001 From: Florian Rinke Date: Mon, 11 Oct 2021 20:55:06 +0200 Subject: update PlaySound --- src/main/java/de/torui/coflsky/WSCommandHandler.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/main/java/de/torui/coflsky/WSCommandHandler.java') 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); } -- cgit