mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Play sound when totem is used
This commit is contained in:
parent
9f77d47f14
commit
c1e66f306c
1 changed files with 9 additions and 0 deletions
|
@ -39,6 +39,8 @@ import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||||
import org.geysermc.connector.network.translators.Translator;
|
import org.geysermc.connector.network.translators.Translator;
|
||||||
|
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
@Translator(packet = ServerEntityStatusPacket.class)
|
@Translator(packet = ServerEntityStatusPacket.class)
|
||||||
public class JavaEntityStatusTranslator extends PacketTranslator<ServerEntityStatusPacket> {
|
public class JavaEntityStatusTranslator extends PacketTranslator<ServerEntityStatusPacket> {
|
||||||
|
|
||||||
|
@ -158,6 +160,13 @@ public class JavaEntityStatusTranslator extends PacketTranslator<ServerEntitySta
|
||||||
break;
|
break;
|
||||||
case TOTEM_OF_UNDYING_MAKE_SOUND:
|
case TOTEM_OF_UNDYING_MAKE_SOUND:
|
||||||
entityEventPacket.setType(EntityEventType.CONSUME_TOTEM);
|
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;
|
break;
|
||||||
case SHEEP_GRAZE_OR_TNT_CART_EXPLODE:
|
case SHEEP_GRAZE_OR_TNT_CART_EXPLODE:
|
||||||
if (entity.getEntityType() == EntityType.SHEEP) {
|
if (entity.getEntityType() == EntityType.SHEEP) {
|
||||||
|
|
Loading…
Reference in a new issue