This commit is contained in:
basaigh 2024-06-16 22:05:28 +01:00 committed by GitHub
parent 6cda7c2202
commit 1efb633723
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 29 deletions

View file

@ -57,7 +57,7 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
return;
}
// Separate case since each RecordEventData in Java is an individual track in Bedrock
if (levelEvent == LevelEventType.RECORD) {
if (levelEvent == LevelEventType.SOUND_PLAY_JUKEBOX_SONG) {
RecordEventData recordEventData = (RecordEventData) packet.getData();
JukeboxSong jukeboxSong = session.getRegistryCache().jukeboxSongs().byId(recordEventData.getRecordId());
if (jukeboxSong == null) {
@ -126,11 +126,11 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
effectPacket.setPosition(pos);
effectPacket.setData(0);
switch (levelEvent) {
case BRUSH_BLOCK_COMPLETE -> {
case PARTICLES_AND_SOUND_BRUSH_BLOCK_COMPLETE -> {
effectPacket.setType(ParticleType.BRUSH_DUST);
session.playSoundEvent(SoundEvent.BRUSH_COMPLETED, pos); // todo 1.20.2 verify this
}
case COMPOSTER -> {
case COMPOSTER_FILL -> {
effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_CROP_GROWTH);
ComposterEventData composterEventData = (ComposterEventData) packet.getData();
@ -146,7 +146,7 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
}
case BLOCK_LAVA_EXTINGUISH -> {
case LAVA_FIZZ -> {
effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_EVAPORATE);
effectPacket.setPosition(pos.add(-0.5f, 0.7f, -0.5f));
@ -159,7 +159,7 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
}
case BLOCK_REDSTONE_TORCH_BURNOUT -> {
case REDSTONE_TORCH_BURNOUT -> {
effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_EVAPORATE);
effectPacket.setPosition(pos.add(-0.5f, 0, -0.5f));
@ -172,7 +172,7 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
}
case BLOCK_END_PORTAL_FRAME_FILL -> {
case END_PORTAL_FRAME_FILL -> {
effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_EVAPORATE);
effectPacket.setPosition(pos.add(-0.5f, 0.3125f, -0.5f));
@ -185,8 +185,8 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
}
case SMOKE, WHITE_SMOKE -> {
if (levelEvent == LevelEventType.SMOKE) {
case PARTICLES_SHOOT_SMOKE, PARTICLES_SHOOT_WHITE_SMOKE -> {
if (levelEvent == LevelEventType.PARTICLES_SHOOT_SMOKE) {
effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_SHOOT);
} else {
effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_SHOOT_WHITE_SMOKE);
@ -225,13 +225,13 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
}
//TODO: Block break particles when under fire
case BREAK_BLOCK -> {
case PARTICLES_DESTROY_BLOCK -> {
effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_DESTROY_BLOCK);
BreakBlockEventData breakBlockEventData = (BreakBlockEventData) packet.getData();
effectPacket.setData(session.getBlockMappings().getBedrockBlockId(breakBlockEventData.getBlockState()));
}
case BREAK_SPLASH_POTION, BREAK_SPLASH_POTION2 -> {
case PARTICLES_SPELL_POTION_SPLASH, PARTICLES_INSTANT_POTION_SPLASH -> {
effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_POTION_SPLASH);
effectPacket.setPosition(pos.add(0, -0.5f, 0));
@ -247,16 +247,16 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
soundEventPacket.setRelativeVolumeDisabled(false);
session.sendUpstreamPacket(soundEventPacket);
}
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(levelEvent == LevelEventType.BONEMEAL_GROW ? org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_TURTLE_EGG : org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_CROP_GROWTH);
case PARTICLES_EYE_OF_ENDER_DEATH -> effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_EYE_OF_ENDER_DEATH);
case PARTICLES_MOBBLOCK_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 PARTICLES_AND_SOUND_PLANT_GROWTH -> {
effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_CROP_GROWTH);
BonemealGrowEventData growEventData = (BonemealGrowEventData) packet.getData();
effectPacket.setData(growEventData.getParticleCount());
}
case EGG_CRACK -> effectPacket.setType(ParticleType.VILLAGER_HAPPY); // both the lil green sparkle
case ENDERDRAGON_FIREBALL_EXPLODE -> {
case PARTICLES_EGG_CRACK -> effectPacket.setType(ParticleType.VILLAGER_HAPPY); // both the lil green sparkle
case PARTICLES_DRAGON_FIREBALL_SPLASH -> {
effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_EYE_OF_ENDER_DEATH); // TODO
DragonFireballEventData fireballEventData = (DragonFireballEventData) packet.getData();
@ -271,15 +271,15 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
session.sendUpstreamPacket(soundEventPacket);
}
}
case EXPLOSION -> {
case PARTICLES_DRAGON_BLOCK_BREAK -> {
effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_GENERIC_SPAWN);
effectPacket.setData(61);
}
case EVAPORATE -> {
case PARTICLES_WATER_EVAPORATING -> {
effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_EVAPORATE_WATER);
effectPacket.setPosition(pos.add(-0.5f, 0.5f, -0.5f));
}
case END_GATEWAY_SPAWN -> {
case ANIMATION_END_GATEWAY_SPAWN -> {
effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_EXPLOSION);
LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket();
@ -292,11 +292,11 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
session.sendUpstreamPacket(soundEventPacket);
}
case DRIPSTONE_DRIP -> effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_DRIPSTONE_DRIP);
case ELECTRIC_SPARK -> effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_ELECTRIC_SPARK); // Matches with a Bedrock server but doesn't seem to match up with Java
case WAX_ON -> effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_WAX_ON);
case WAX_OFF -> effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_WAX_OFF);
case SCRAPE -> effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_SCRAPE);
case SCULK_BLOCK_CHARGE -> {
case PARTICLES_ELECTRIC_SPARK -> effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_ELECTRIC_SPARK); // Matches with a Bedrock server but doesn't seem to match up with Java
case PARTICLES_AND_SOUND_WAX_ON -> effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_WAX_ON);
case PARTICLES_WAX_OFF -> effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_WAX_OFF);
case PARTICLES_SCRAPE -> effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_SCRAPE);
case PARTICLES_SCULK_CHARGE -> {
SculkBlockChargeEventData eventData = (SculkBlockChargeEventData) packet.getData();
LevelEventGenericPacket levelEventPacket = new LevelEventGenericPacket();
// TODO add SCULK_BLOCK_CHARGE sound
@ -324,7 +324,7 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
session.sendUpstreamPacket(levelEventPacket);
return;
}
case SCULK_SHRIEKER_SHRIEK -> {
case PARTICLES_SCULK_SHRIEK -> {
LevelEventGenericPacket levelEventPacket = new LevelEventGenericPacket();
levelEventPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_SCULK_SHRIEK);
levelEventPacket.setTag(
@ -346,7 +346,7 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
session.sendUpstreamPacket(soundEventPacket);
return;
}
case STOP_RECORD -> {
case SOUND_STOP_JUKEBOX_SONG -> {
String bedrockSound = session.getWorldCache().removeActiveRecord(origin);
if (bedrockSound == null) {
// Vanilla record

@ -1 +1 @@
Subproject commit 2ac0c1415cb9063c405dbd7e14f2d426a0ba1180
Subproject commit 420cbe173ffa0667d4607715f9e3d43402e1ab77

View file

@ -13,7 +13,7 @@ websocket = "1.5.1"
protocol = "3.0.0.Beta2-20240616.144648-10"
raknet = "1.0.0.CR3-20240416.144209-1"
mcauthlib = "e5b0bcc"
mcprotocollib = "4f5f650"
mcprotocollib = "1.21-20240616.154144-5"
adventure = "4.14.0"
adventure-platform = "4.3.0"
junit = "5.9.2"
@ -107,7 +107,7 @@ guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
junit = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" }
mcauthlib = { group = "com.github.GeyserMC", name = "MCAuthLib", version.ref = "mcauthlib" }
mcprotocollib = { group = "com.github.GeyserMC", name = "mcprotocollib", version.ref = "mcprotocollib" }
mcprotocollib = { group = "org.geysermc.mcprotocollib", name = "protocol", version.ref = "mcprotocollib" }
raknet = { group = "org.cloudburstmc.netty", name = "netty-transport-raknet", version.ref = "raknet" }
terminalconsoleappender = { group = "net.minecrell", name = "terminalconsoleappender", version.ref = "terminalconsoleappender" }
velocity-api = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }