mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-12-22 22:45:04 +01:00
parent
f801dc05bd
commit
f3f30625d4
3 changed files with 10 additions and 7 deletions
|
@ -58,20 +58,20 @@ public class SoundEventsRegistryLoader extends EffectRegistryLoader<Map<LevelEve
|
|||
LevelEventTranslator transformer = null;
|
||||
switch (type) {
|
||||
case "soundLevel" -> {
|
||||
javaEffect = LevelEvent.valueOf(entry.getKey());
|
||||
javaEffect = com.github.steveice10.mc.protocol.data.game.level.event.LevelEventType.valueOf(entry.getKey());
|
||||
LevelEventType levelEventType = org.cloudburstmc.protocol.bedrock.data.LevelEvent.valueOf(node.get("name").asText());
|
||||
int data = node.has("data") ? node.get("data").intValue() : 0;
|
||||
transformer = new SoundLevelEventTranslator(levelEventType, data);
|
||||
}
|
||||
case "soundEvent" -> {
|
||||
javaEffect = LevelEvent.valueOf(entry.getKey());
|
||||
javaEffect = com.github.steveice10.mc.protocol.data.game.level.event.LevelEventType.valueOf(entry.getKey());
|
||||
org.cloudburstmc.protocol.bedrock.data.SoundEvent soundEvent = org.cloudburstmc.protocol.bedrock.data.SoundEvent.valueOf(node.get("name").asText());
|
||||
String identifier = node.has("identifier") ? node.get("identifier").asText() : "";
|
||||
int extraData = node.has("extraData") ? node.get("extraData").intValue() : -1;
|
||||
transformer = new SoundEventEventTranslator(soundEvent, identifier, extraData);
|
||||
}
|
||||
case "playSound" -> {
|
||||
javaEffect = LevelEvent.valueOf(entry.getKey());
|
||||
javaEffect = com.github.steveice10.mc.protocol.data.game.level.event.LevelEventType.valueOf(entry.getKey());
|
||||
String name = node.get("name").asText();
|
||||
float volume = node.has("volume") ? node.get("volume").floatValue() : 1.0f;
|
||||
boolean pitchSub = node.has("pitch_sub") && node.get("pitch_sub").booleanValue();
|
||||
|
|
|
@ -53,8 +53,11 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
|||
|
||||
@Override
|
||||
public void translate(GeyserSession session, ClientboundLevelEventPacket packet) {
|
||||
if (!(packet.getEvent() instanceof LevelEventType levelEvent)) {
|
||||
return;
|
||||
}
|
||||
// Separate case since each RecordEventData in Java is an individual track in Bedrock
|
||||
if (packet.getEvent() == LevelEvent.RECORD) {
|
||||
if (levelEvent == LevelEventType.RECORD) {
|
||||
RecordEventData recordEventData = (RecordEventData) packet.getData();
|
||||
SoundEvent soundEvent = Registries.RECORDS.get(recordEventData.getRecordId());
|
||||
if (soundEvent == null) {
|
||||
|
@ -99,7 +102,7 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
|||
LevelEventPacket effectPacket = new LevelEventPacket();
|
||||
effectPacket.setPosition(pos);
|
||||
effectPacket.setData(0);
|
||||
switch (packet.getEvent()) {
|
||||
switch (levelEvent) {
|
||||
case COMPOSTER -> {
|
||||
effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_CROP_GROWTH);
|
||||
|
||||
|
@ -216,7 +219,7 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
|||
case BREAK_EYE_OF_ENDER -> effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_EYE_OF_ENDER_DEATH);
|
||||
case MOB_SPAWN -> effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.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 ? org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_TURTLE_EGG : org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_CROP_GROWTH);
|
||||
effectPacket.setType(levelEvent == LevelEventType.BONEMEAL_GROW ? org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_TURTLE_EGG : org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_CROP_GROWTH);
|
||||
|
||||
BonemealGrowEventData growEventData = (BonemealGrowEventData) packet.getData();
|
||||
effectPacket.setData(growEventData.getParticleCount());
|
||||
|
|
|
@ -13,7 +13,7 @@ protocol = "3.0.0.Beta1-20230501.101518-75"
|
|||
protocol-connection = "3.0.0.Beta1-20230501.101518-74"
|
||||
raknet = "1.0.0.CR1-20230430.211932-7"
|
||||
mcauthlib = "d9d773e"
|
||||
mcprotocollib = "1.19.4-2-20230427.170624-2"
|
||||
mcprotocollib = "1.19.4-2-20230503.145414-3"
|
||||
adventure = "4.14.0-20230424.215040-7"
|
||||
adventure-platform = "4.1.2"
|
||||
junit = "5.9.2"
|
||||
|
|
Loading…
Reference in a new issue