3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-24 15:20:25 +01:00

Play sound when totem is used

Dieser Commit ist enthalten in:
Redned 2021-09-04 13:52:02 -05:00 committet von RednedEpic
Ursprung 9f77d47f14
Commit c1e66f306c

Datei anzeigen

@ -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) {