Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-24 23:30:22 +01:00
Play sound when totem is used
Dieser Commit ist enthalten in:
Ursprung
9f77d47f14
Commit
c1e66f306c
@ -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) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren