Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-19 14:30:17 +01:00
Ursprung
f801dc05bd
Commit
f3f30625d4
@ -58,20 +58,20 @@ public class SoundEventsRegistryLoader extends EffectRegistryLoader<Map<LevelEve
|
|||||||
LevelEventTranslator transformer = null;
|
LevelEventTranslator transformer = null;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "soundLevel" -> {
|
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());
|
LevelEventType levelEventType = org.cloudburstmc.protocol.bedrock.data.LevelEvent.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 = 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());
|
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() : "";
|
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 = LevelEvent.valueOf(entry.getKey());
|
javaEffect = com.github.steveice10.mc.protocol.data.game.level.event.LevelEventType.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();
|
||||||
|
@ -53,8 +53,11 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(GeyserSession session, ClientboundLevelEventPacket packet) {
|
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
|
// 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();
|
RecordEventData recordEventData = (RecordEventData) packet.getData();
|
||||||
SoundEvent soundEvent = Registries.RECORDS.get(recordEventData.getRecordId());
|
SoundEvent soundEvent = Registries.RECORDS.get(recordEventData.getRecordId());
|
||||||
if (soundEvent == null) {
|
if (soundEvent == null) {
|
||||||
@ -99,7 +102,7 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
|||||||
LevelEventPacket effectPacket = new LevelEventPacket();
|
LevelEventPacket effectPacket = new LevelEventPacket();
|
||||||
effectPacket.setPosition(pos);
|
effectPacket.setPosition(pos);
|
||||||
effectPacket.setData(0);
|
effectPacket.setData(0);
|
||||||
switch (packet.getEvent()) {
|
switch (levelEvent) {
|
||||||
case COMPOSTER -> {
|
case COMPOSTER -> {
|
||||||
effectPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_CROP_GROWTH);
|
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 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 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 -> {
|
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();
|
BonemealGrowEventData growEventData = (BonemealGrowEventData) packet.getData();
|
||||||
effectPacket.setData(growEventData.getParticleCount());
|
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"
|
protocol-connection = "3.0.0.Beta1-20230501.101518-74"
|
||||||
raknet = "1.0.0.CR1-20230430.211932-7"
|
raknet = "1.0.0.CR1-20230430.211932-7"
|
||||||
mcauthlib = "d9d773e"
|
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 = "4.14.0-20230424.215040-7"
|
||||||
adventure-platform = "4.1.2"
|
adventure-platform = "4.1.2"
|
||||||
junit = "5.9.2"
|
junit = "5.9.2"
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren