Play sound when totem is used
@@ -39,6 +39,8 @@ import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.network.translators.Translator;
+import java.util.concurrent.ThreadLocalRandom;
+
@Translator(packet = ServerEntityStatusPacket.class)
public class JavaEntityStatusTranslator extends PacketTranslator<ServerEntityStatusPacket> {
@@ -158,6 +160,13 @@ public class JavaEntityStatusTranslator extends PacketTranslator<ServerEntitySta
break;
case TOTEM_OF_UNDYING_MAKE_SOUND:
entityEventPacket.setType(EntityEventType.CONSUME_TOTEM);
+
+ PlaySoundPacket playSoundPacket = new PlaySoundPacket();
+ playSoundPacket.setSound("random.totem");
+ playSoundPacket.setPosition(entity.getPosition());
+ playSoundPacket.setVolume(1.0F);
+ playSoundPacket.setPitch(1.0F + (ThreadLocalRandom.current().nextFloat() * 0.1F) - 0.05F);
+ session.sendUpstreamPacket(playSoundPacket);
break;
case SHEEP_GRAZE_OR_TNT_CART_EXPLODE:
if (entity.getEntityType() == EntityType.SHEEP) {
