3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-09-08 20:43:04 +02:00

SoundEvent and ParticleEvent are now combined

Dieser Commit ist enthalten in:
davchoo 2022-05-26 19:57:45 -04:00
Ursprung 4a9eec4c54
Commit 41cd7f4574
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: A0168C8E45799B7D
3 geänderte Dateien mit 175 neuen und 177 gelöschten Zeilen

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.geyser.registry;
import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType;
import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
import com.github.steveice10.mc.protocol.data.game.level.event.SoundEvent; import com.github.steveice10.mc.protocol.data.game.level.event.LevelEvent;
import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType; import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType;
import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType; import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType;
import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.packet.Packet;
@ -155,9 +155,9 @@ public final class Registries {
public static final SimpleMappedRegistry<String, SoundMapping> SOUNDS = SimpleMappedRegistry.create("mappings/sounds.json", SoundRegistryLoader::new); public static final SimpleMappedRegistry<String, SoundMapping> SOUNDS = SimpleMappedRegistry.create("mappings/sounds.json", SoundRegistryLoader::new);
/** /**
* A mapped registry holding {@link SoundEvent}s to their corresponding {@link LevelEventTranslator}. * A mapped registry holding {@link LevelEvent}s to their corresponding {@link LevelEventTranslator}.
*/ */
public static final SimpleMappedRegistry<SoundEvent, LevelEventTranslator> SOUND_EVENTS = SimpleMappedRegistry.create("mappings/effects.json", SoundEventsRegistryLoader::new); public static final SimpleMappedRegistry<LevelEvent, LevelEventTranslator> SOUND_LEVEL_EVENTS = SimpleMappedRegistry.create("mappings/effects.json", SoundEventsRegistryLoader::new);
/** /**
* A mapped registry holding {@link SoundTranslator}s to their corresponding {@link SoundInteractionTranslator}. * A mapped registry holding {@link SoundTranslator}s to their corresponding {@link SoundInteractionTranslator}.

Datei anzeigen

@ -26,7 +26,7 @@
package org.geysermc.geyser.registry.loader; package org.geysermc.geyser.registry.loader;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.github.steveice10.mc.protocol.data.game.level.event.SoundEvent; import com.github.steveice10.mc.protocol.data.game.level.event.LevelEvent;
import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.LevelEventType;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserImpl;
@ -41,37 +41,37 @@ import java.util.Map;
/** /**
* Loads sound effects from the given resource path. * Loads sound effects from the given resource path.
*/ */
public class SoundEventsRegistryLoader extends EffectRegistryLoader<Map<SoundEvent, LevelEventTranslator>> { public class SoundEventsRegistryLoader extends EffectRegistryLoader<Map<LevelEvent, LevelEventTranslator>> {
@Override @Override
public Map<SoundEvent, LevelEventTranslator> load(String input) { public Map<LevelEvent, LevelEventTranslator> load(String input) {
this.loadFile(input); this.loadFile(input);
Iterator<Map.Entry<String, JsonNode>> effectsIterator = this.get(input).fields(); Iterator<Map.Entry<String, JsonNode>> effectsIterator = this.get(input).fields();
Map<SoundEvent, LevelEventTranslator> soundEffects = new Object2ObjectOpenHashMap<>(); Map<LevelEvent, LevelEventTranslator> soundEffects = new Object2ObjectOpenHashMap<>();
while (effectsIterator.hasNext()) { while (effectsIterator.hasNext()) {
Map.Entry<String, JsonNode> entry = effectsIterator.next(); Map.Entry<String, JsonNode> entry = effectsIterator.next();
JsonNode node = entry.getValue(); JsonNode node = entry.getValue();
try { try {
String type = node.get("type").asText(); String type = node.get("type").asText();
SoundEvent javaEffect = null; LevelEvent javaEffect = null;
LevelEventTranslator transformer = null; LevelEventTranslator transformer = null;
switch (type) { switch (type) {
case "soundLevel" -> { case "soundLevel" -> {
javaEffect = SoundEvent.valueOf(entry.getKey()); javaEffect = LevelEvent.valueOf(entry.getKey());
LevelEventType levelEventType = LevelEventType.valueOf(node.get("name").asText()); LevelEventType levelEventType = LevelEventType.valueOf(node.get("name").asText());
int data = node.has("data") ? node.get("data").intValue() : 0; int data = node.has("data") ? node.get("data").intValue() : 0;
transformer = new SoundLevelEventTranslator(levelEventType, data); transformer = new SoundLevelEventTranslator(levelEventType, data);
} }
case "soundEvent" -> { case "soundEvent" -> {
javaEffect = SoundEvent.valueOf(entry.getKey()); javaEffect = LevelEvent.valueOf(entry.getKey());
com.nukkitx.protocol.bedrock.data.SoundEvent soundEvent = com.nukkitx.protocol.bedrock.data.SoundEvent.valueOf(node.get("name").asText()); com.nukkitx.protocol.bedrock.data.SoundEvent soundEvent = com.nukkitx.protocol.bedrock.data.SoundEvent.valueOf(node.get("name").asText());
String identifier = node.has("identifier") ? node.get("identifier").asText() : ""; String identifier = node.has("identifier") ? node.get("identifier").asText() : "";
int extraData = node.has("extraData") ? node.get("extraData").intValue() : -1; int extraData = node.has("extraData") ? node.get("extraData").intValue() : -1;
transformer = new SoundEventEventTranslator(soundEvent, identifier, extraData); transformer = new SoundEventEventTranslator(soundEvent, identifier, extraData);
} }
case "playSound" -> { case "playSound" -> {
javaEffect = SoundEvent.valueOf(entry.getKey()); javaEffect = LevelEvent.valueOf(entry.getKey());
String name = node.get("name").asText(); String name = node.get("name").asText();
float volume = node.has("volume") ? node.get("volume").floatValue() : 1.0f; float volume = node.has("volume") ? node.get("volume").floatValue() : 1.0f;
boolean pitchSub = node.has("pitch_sub") && node.get("pitch_sub").booleanValue(); boolean pitchSub = node.has("pitch_sub") && node.get("pitch_sub").booleanValue();
@ -85,7 +85,7 @@ public class SoundEventsRegistryLoader extends EffectRegistryLoader<Map<SoundEve
soundEffects.put(javaEffect, transformer); soundEffects.put(javaEffect, transformer);
} }
} catch (Exception e) { } catch (Exception e) {
GeyserImpl.getInstance().getLogger().warning("Failed to map sound effect " + entry.getKey() + " : " + e.toString()); GeyserImpl.getInstance().getLogger().warning("Failed to map sound effect " + entry.getKey() + " : " + e);
} }
} }
return soundEffects; return soundEffects;

Datei anzeigen

@ -51,7 +51,7 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
@Override @Override
public void translate(GeyserSession session, ClientboundLevelEventPacket packet) { public void translate(GeyserSession session, ClientboundLevelEventPacket packet) {
// Separate case since each RecordEventData in Java is an individual track in Bedrock // Separate case since each RecordEventData in Java is an individual track in Bedrock
if (packet.getEvent() == com.github.steveice10.mc.protocol.data.game.level.event.SoundEvent.RECORD) { if (packet.getEvent() == LevelEvent.RECORD) {
RecordEventData recordEventData = (RecordEventData) packet.getData(); RecordEventData recordEventData = (RecordEventData) packet.getData();
SoundEvent soundEvent = Registries.RECORDS.getOrDefault(recordEventData.getRecordId(), SoundEvent.STOP_RECORD); SoundEvent soundEvent = Registries.RECORDS.getOrDefault(recordEventData.getRecordId(), SoundEvent.STOP_RECORD);
Vector3i origin = packet.getPosition(); Vector3i origin = packet.getPosition();
@ -82,168 +82,146 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
return; return;
} }
if (packet.getEvent() instanceof com.github.steveice10.mc.protocol.data.game.level.event.SoundEvent soundEvent) { // Check for a sound event translator
LevelEventTranslator transformer = Registries.SOUND_EVENTS.get(soundEvent); LevelEventTranslator transformer = Registries.SOUND_LEVEL_EVENTS.get(packet.getEvent());
if (transformer != null) { if (transformer != null) {
transformer.translate(session, packet); transformer.translate(session, packet);
return; return;
}
Vector3i origin = packet.getPosition();
Vector3f pos = Vector3f.from(origin.getX() + 0.5f, origin.getY() + 0.5f, origin.getZ() + 0.5f);
LevelEventPacket effectPacket = new LevelEventPacket();
effectPacket.setPosition(pos);
effectPacket.setData(0);
switch (packet.getEvent()) {
case COMPOSTER -> {
effectPacket.setType(LevelEventType.PARTICLE_CROP_GROWTH);
ComposterEventData composterEventData = (ComposterEventData) packet.getData();
LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket();
switch (composterEventData) {
case FILL -> soundEventPacket.setSound(SoundEvent.COMPOSTER_FILL);
case FILL_SUCCESS -> soundEventPacket.setSound(SoundEvent.COMPOSTER_FILL_LAYER);
}
soundEventPacket.setPosition(pos);
soundEventPacket.setIdentifier("");
soundEventPacket.setExtraData(-1);
soundEventPacket.setBabySound(false);
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
} }
GeyserImpl.getInstance().getLogger().debug("Unhandled sound event: " + soundEvent.name()); case BLOCK_LAVA_EXTINGUISH -> {
} else if (packet.getEvent() instanceof ParticleEvent particleEvent) { effectPacket.setType(LevelEventType.PARTICLE_EVAPORATE);
Vector3i origin = packet.getPosition(); effectPacket.setPosition(pos.add(-0.5f, 0.7f, -0.5f));
Vector3f pos = Vector3f.from(origin.getX() + 0.5f, origin.getY() + 0.5f, origin.getZ() + 0.5f);
LevelEventPacket effectPacket = new LevelEventPacket(); LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket();
effectPacket.setPosition(pos); soundEventPacket.setSound(SoundEvent.EXTINGUISH_FIRE);
effectPacket.setData(0); soundEventPacket.setPosition(pos);
switch (particleEvent) { soundEventPacket.setIdentifier("");
case COMPOSTER -> { soundEventPacket.setExtraData(-1);
effectPacket.setType(LevelEventType.PARTICLE_CROP_GROWTH); soundEventPacket.setBabySound(false);
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
}
case BLOCK_REDSTONE_TORCH_BURNOUT -> {
effectPacket.setType(LevelEventType.PARTICLE_EVAPORATE);
effectPacket.setPosition(pos.add(-0.5f, 0, -0.5f));
ComposterEventData composterEventData = (ComposterEventData) packet.getData(); LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket();
LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket(); soundEventPacket.setSound(SoundEvent.EXTINGUISH_FIRE);
switch (composterEventData) { soundEventPacket.setPosition(pos);
case FILL -> soundEventPacket.setSound(SoundEvent.COMPOSTER_FILL); soundEventPacket.setIdentifier("");
case FILL_SUCCESS -> soundEventPacket.setSound(SoundEvent.COMPOSTER_FILL_LAYER); soundEventPacket.setExtraData(-1);
soundEventPacket.setBabySound(false);
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
}
case BLOCK_END_PORTAL_FRAME_FILL -> {
effectPacket.setType(LevelEventType.PARTICLE_EVAPORATE);
effectPacket.setPosition(pos.add(-0.5f, 0.3125f, -0.5f));
LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket();
soundEventPacket.setSound(SoundEvent.BLOCK_END_PORTAL_FRAME_FILL);
soundEventPacket.setPosition(pos);
soundEventPacket.setIdentifier("");
soundEventPacket.setExtraData(-1);
soundEventPacket.setBabySound(false);
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
}
case SMOKE -> {
effectPacket.setType(LevelEventType.PARTICLE_SHOOT);
SmokeEventData smokeEventData = (SmokeEventData) packet.getData();
int data = 0;
switch (smokeEventData) {
case DOWN -> {
data = 4;
pos = pos.add(0, -0.9f, 0);
} }
soundEventPacket.setPosition(pos); case UP -> {
soundEventPacket.setIdentifier(""); data = 4;
soundEventPacket.setExtraData(-1); pos = pos.add(0, 0.5f, 0);
soundEventPacket.setBabySound(false);
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
}
case BLOCK_LAVA_EXTINGUISH -> {
effectPacket.setType(LevelEventType.PARTICLE_EVAPORATE);
effectPacket.setPosition(pos.add(-0.5f, 0.7f, -0.5f));
LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket();
soundEventPacket.setSound(SoundEvent.EXTINGUISH_FIRE);
soundEventPacket.setPosition(pos);
soundEventPacket.setIdentifier("");
soundEventPacket.setExtraData(-1);
soundEventPacket.setBabySound(false);
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
}
case BLOCK_REDSTONE_TORCH_BURNOUT -> {
effectPacket.setType(LevelEventType.PARTICLE_EVAPORATE);
effectPacket.setPosition(pos.add(-0.5f, 0, -0.5f));
LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket();
soundEventPacket.setSound(SoundEvent.EXTINGUISH_FIRE);
soundEventPacket.setPosition(pos);
soundEventPacket.setIdentifier("");
soundEventPacket.setExtraData(-1);
soundEventPacket.setBabySound(false);
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
}
case BLOCK_END_PORTAL_FRAME_FILL -> {
effectPacket.setType(LevelEventType.PARTICLE_EVAPORATE);
effectPacket.setPosition(pos.add(-0.5f, 0.3125f, -0.5f));
LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket();
soundEventPacket.setSound(SoundEvent.BLOCK_END_PORTAL_FRAME_FILL);
soundEventPacket.setPosition(pos);
soundEventPacket.setIdentifier("");
soundEventPacket.setExtraData(-1);
soundEventPacket.setBabySound(false);
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
}
case SMOKE -> {
effectPacket.setType(LevelEventType.PARTICLE_SHOOT);
SmokeEventData smokeEventData = (SmokeEventData) packet.getData();
int data = 0;
switch (smokeEventData) {
case DOWN -> {
data = 4;
pos = pos.add(0, -0.9f, 0);
}
case UP -> {
data = 4;
pos = pos.add(0, 0.5f, 0);
}
case NORTH -> {
data = 1;
pos = pos.add(0, -0.2f, -0.7f);
}
case SOUTH -> {
data = 7;
pos = pos.add(0, -0.2f, 0.7f);
}
case WEST -> {
data = 3;
pos = pos.add(-0.7f, -0.2f, 0);
}
case EAST -> {
data = 5;
pos = pos.add(0.7f, -0.2f, 0);
}
} }
effectPacket.setPosition(pos); case NORTH -> {
effectPacket.setData(data); data = 1;
} pos = pos.add(0, -0.2f, -0.7f);
}
//TODO: Block break particles when under fire case SOUTH -> {
case BREAK_BLOCK -> { data = 7;
effectPacket.setType(LevelEventType.PARTICLE_DESTROY_BLOCK); pos = pos.add(0, -0.2f, 0.7f);
}
BreakBlockEventData breakBlockEventData = (BreakBlockEventData) packet.getData(); case WEST -> {
effectPacket.setData(session.getBlockMappings().getBedrockBlockId(breakBlockEventData.getBlockState())); data = 3;
} pos = pos.add(-0.7f, -0.2f, 0);
case BREAK_SPLASH_POTION -> { }
effectPacket.setType(LevelEventType.PARTICLE_POTION_SPLASH); case EAST -> {
effectPacket.setPosition(pos.add(0, -0.5f, 0)); data = 5;
pos = pos.add(0.7f, -0.2f, 0);
BreakPotionEventData splashPotionData = (BreakPotionEventData) packet.getData();
effectPacket.setData(splashPotionData.getPotionId());
LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket();
soundEventPacket.setSound(SoundEvent.GLASS);
soundEventPacket.setPosition(pos);
soundEventPacket.setIdentifier("");
soundEventPacket.setExtraData(-1);
soundEventPacket.setBabySound(false);
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
}
case BREAK_EYE_OF_ENDER -> effectPacket.setType(LevelEventType.PARTICLE_EYE_OF_ENDER_DEATH);
case MOB_SPAWN -> effectPacket.setType(LevelEventType.PARTICLE_MOB_BLOCK_SPAWN); // TODO: Check, but I don't think I really verified this ever went into effect on Java
case BONEMEAL_GROW_WITH_SOUND, BONEMEAL_GROW -> {
effectPacket.setType(particleEvent == ParticleEvent.BONEMEAL_GROW ? LevelEventType.PARTICLE_TURTLE_EGG : LevelEventType.PARTICLE_CROP_GROWTH);
BonemealGrowEventData growEventData = (BonemealGrowEventData) packet.getData();
effectPacket.setData(growEventData.getParticleCount());
}
case ENDERDRAGON_FIREBALL_EXPLODE -> {
effectPacket.setType(LevelEventType.PARTICLE_EYE_OF_ENDER_DEATH); // TODO
DragonFireballEventData fireballEventData = (DragonFireballEventData) packet.getData();
if (fireballEventData == DragonFireballEventData.HAS_SOUND) {
LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket();
soundEventPacket.setSound(SoundEvent.EXPLODE);
soundEventPacket.setPosition(pos);
soundEventPacket.setIdentifier("");
soundEventPacket.setExtraData(-1);
soundEventPacket.setBabySound(false);
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
} }
} }
case EXPLOSION -> { effectPacket.setPosition(pos);
effectPacket.setType(LevelEventType.PARTICLE_GENERIC_SPAWN); effectPacket.setData(data);
effectPacket.setData(61); }
}
case EVAPORATE -> {
effectPacket.setType(LevelEventType.PARTICLE_EVAPORATE_WATER);
effectPacket.setPosition(pos.add(-0.5f, 0.5f, -0.5f));
}
case END_GATEWAY_SPAWN -> {
effectPacket.setType(LevelEventType.PARTICLE_EXPLOSION);
//TODO: Block break particles when under fire
case BREAK_BLOCK -> {
effectPacket.setType(LevelEventType.PARTICLE_DESTROY_BLOCK);
BreakBlockEventData breakBlockEventData = (BreakBlockEventData) packet.getData();
effectPacket.setData(session.getBlockMappings().getBedrockBlockId(breakBlockEventData.getBlockState()));
}
case BREAK_SPLASH_POTION, BREAK_SPLASH_POTION2 -> {
effectPacket.setType(LevelEventType.PARTICLE_POTION_SPLASH);
effectPacket.setPosition(pos.add(0, -0.5f, 0));
BreakPotionEventData splashPotionData = (BreakPotionEventData) packet.getData();
effectPacket.setData(splashPotionData.getPotionId());
LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket();
soundEventPacket.setSound(SoundEvent.GLASS);
soundEventPacket.setPosition(pos);
soundEventPacket.setIdentifier("");
soundEventPacket.setExtraData(-1);
soundEventPacket.setBabySound(false);
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
}
case BREAK_EYE_OF_ENDER -> effectPacket.setType(LevelEventType.PARTICLE_EYE_OF_ENDER_DEATH);
case MOB_SPAWN -> effectPacket.setType(LevelEventType.PARTICLE_MOB_BLOCK_SPAWN); // TODO: Check, but I don't think I really verified this ever went into effect on Java
case BONEMEAL_GROW_WITH_SOUND, BONEMEAL_GROW -> {
effectPacket.setType(packet.getEvent() == LevelEvent.BONEMEAL_GROW ? LevelEventType.PARTICLE_TURTLE_EGG : LevelEventType.PARTICLE_CROP_GROWTH);
BonemealGrowEventData growEventData = (BonemealGrowEventData) packet.getData();
effectPacket.setData(growEventData.getParticleCount());
}
case ENDERDRAGON_FIREBALL_EXPLODE -> {
effectPacket.setType(LevelEventType.PARTICLE_EYE_OF_ENDER_DEATH); // TODO
DragonFireballEventData fireballEventData = (DragonFireballEventData) packet.getData();
if (fireballEventData == DragonFireballEventData.HAS_SOUND) {
LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket(); LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket();
soundEventPacket.setSound(SoundEvent.EXPLODE); soundEventPacket.setSound(SoundEvent.EXPLODE);
soundEventPacket.setPosition(pos); soundEventPacket.setPosition(pos);
@ -253,17 +231,37 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
soundEventPacket.setRelativeVolumeDisabled(false); soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket); session.sendUpstreamPacket(soundEventPacket);
} }
case DRIPSTONE_DRIP -> effectPacket.setType(LevelEventType.PARTICLE_DRIPSTONE_DRIP);
case ELECTRIC_SPARK -> effectPacket.setType(LevelEventType.PARTICLE_ELECTRIC_SPARK); // Matches with a Bedrock server but doesn't seem to match up with Java
case WAX_ON -> effectPacket.setType(LevelEventType.PARTICLE_WAX_ON);
case WAX_OFF -> effectPacket.setType(LevelEventType.PARTICLE_WAX_OFF);
case SCRAPE -> effectPacket.setType(LevelEventType.PARTICLE_SCRAPE);
default -> {
GeyserImpl.getInstance().getLogger().debug("Unhandled particle event: " + particleEvent.name());
return;
}
} }
session.sendUpstreamPacket(effectPacket); case EXPLOSION -> {
effectPacket.setType(LevelEventType.PARTICLE_GENERIC_SPAWN);
effectPacket.setData(61);
}
case EVAPORATE -> {
effectPacket.setType(LevelEventType.PARTICLE_EVAPORATE_WATER);
effectPacket.setPosition(pos.add(-0.5f, 0.5f, -0.5f));
}
case END_GATEWAY_SPAWN -> {
effectPacket.setType(LevelEventType.PARTICLE_EXPLOSION);
LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket();
soundEventPacket.setSound(SoundEvent.EXPLODE);
soundEventPacket.setPosition(pos);
soundEventPacket.setIdentifier("");
soundEventPacket.setExtraData(-1);
soundEventPacket.setBabySound(false);
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
}
case DRIPSTONE_DRIP -> effectPacket.setType(LevelEventType.PARTICLE_DRIPSTONE_DRIP);
case ELECTRIC_SPARK -> effectPacket.setType(LevelEventType.PARTICLE_ELECTRIC_SPARK); // Matches with a Bedrock server but doesn't seem to match up with Java
case WAX_ON -> effectPacket.setType(LevelEventType.PARTICLE_WAX_ON);
case WAX_OFF -> effectPacket.setType(LevelEventType.PARTICLE_WAX_OFF);
case SCRAPE -> effectPacket.setType(LevelEventType.PARTICLE_SCRAPE);
default -> {
GeyserImpl.getInstance().getLogger().debug("Unhandled level event: " + packet.getEvent());
return;
}
} }
session.sendUpstreamPacket(effectPacket);
} }
} }