Fix encoding SpawnParticleEffectPacket for 1.18.30+

This commit is contained in:
Camotoy 2022-05-26 18:04:58 -04:00
parent 38625312a1
commit d74b0e236d
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
3 changed files with 7 additions and 0 deletions

View file

@ -39,6 +39,7 @@ import org.geysermc.geyser.entity.type.living.MobEntity;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.util.DimensionUtils;
import java.util.Optional;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
@ -262,6 +263,7 @@ public class EnderDragonEntity extends MobEntity implements Tickable {
spawnParticleEffectPacket.setDimensionId(DimensionUtils.javaToBedrock(session.getDimension()));
spawnParticleEffectPacket.setPosition(head.getPosition().add(random.nextGaussian() / 2f, random.nextGaussian() / 2f, random.nextGaussian() / 2f));
spawnParticleEffectPacket.setIdentifier("minecraft:dragon_breath_fire");
spawnParticleEffectPacket.setMolangVariablesJson(Optional.empty());
session.sendUpstreamPacket(spawnParticleEffectPacket);
}
}

View file

@ -36,6 +36,8 @@ import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
import org.geysermc.geyser.util.DimensionUtils;
import java.util.Optional;
@Translator(packet = ClientboundAnimatePacket.class)
public class JavaAnimateTranslator extends PacketTranslator<ClientboundAnimatePacket> {
@ -77,6 +79,7 @@ public class JavaAnimateTranslator extends PacketTranslator<ClientboundAnimatePa
stringPacket.setDimensionId(DimensionUtils.javaToBedrock(session.getDimension()));
stringPacket.setPosition(Vector3f.ZERO);
stringPacket.setUniqueEntityId(entity.getGeyserId());
stringPacket.setMolangVariablesJson(Optional.empty());
session.sendUpstreamPacket(stringPacket);
break;
case LEAVE_BED:

View file

@ -42,6 +42,7 @@ import org.geysermc.geyser.registry.Registries;
import org.geysermc.geyser.registry.type.ParticleMapping;
import org.geysermc.geyser.util.DimensionUtils;
import java.util.Optional;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import java.util.function.Function;
@ -150,6 +151,7 @@ public class JavaLevelParticlesTranslator extends PacketTranslator<ClientboundLe
stringPacket.setIdentifier(particleMapping.identifier());
stringPacket.setDimensionId(dimensionId);
stringPacket.setPosition(position);
stringPacket.setMolangVariablesJson(Optional.empty());
return stringPacket;
};
} else {