Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack;
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.BlockParticleData;
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.ColorParticleData;
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.DustParticleData;
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.ItemParticleData;
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.Particle;
Expand Down Expand Up @@ -174,6 +175,33 @@ public void translate(GeyserSession session, ClientboundLevelParticlesPacket pac
return packet;
};
}
case FIREWORK -> {
int dimensionId = DimensionUtils.javaToBedrock(session);
return (position) -> {
SpawnParticleEffectPacket particlePacket = new SpawnParticleEffectPacket();
particlePacket.setIdentifier("minecraft:sparkler_emitter");
particlePacket.setDimensionId(dimensionId);
particlePacket.setPosition(position);
particlePacket.setMolangVariablesJson(Optional.of("[{ \"name\": \"variable.color\", \"value\": { \"type\": \"member_array\", \"value\": [{\"name\": \".r\", \"value\": { \"type\": \"float\", \"value\": 1.0}},{\"name\": \".g\", \"value\": {\"type\": \"float\", \"value\": 1.0}},{\"name\": \".b\", \"value\": {\"type\": \"float\", \"value\": 1.0}},{\"name\": \".a\", \"value\": {\"type\": \"float\", \"value\": 1.0}}]}}]"));
return particlePacket;
};
}
case TINTED_LEAVES -> {
int dimensionId = DimensionUtils.javaToBedrock(session);
ColorParticleData data = (ColorParticleData) particle.getData();
int rgbData = data.getColor();
float red = ((rgbData >> 16) & 0xFF) / 255f;
float green = ((rgbData >> 8) & 0xFF) / 255f;
float blue = (rgbData & 0xFF) / 255f;
return (position) -> {
SpawnParticleEffectPacket particlePacket = new SpawnParticleEffectPacket();
particlePacket.setIdentifier("minecraft:biome_tinted_leaves_particle");
particlePacket.setDimensionId(dimensionId);
particlePacket.setPosition(position);
particlePacket.setMolangVariablesJson(Optional.of("[{ \"name\": \"variable.color\", \"value\": { \"type\": \"member_array\", \"value\": [{\"name\": \".r\", \"value\": { \"type\": \"float\", \"value\": " + red + "}},{\"name\": \".g\", \"value\": {\"type\": \"float\", \"value\": " + green + "}},{\"name\": \".b\", \"value\": {\"type\": \"float\", \"value\": " + blue + "}}]}}]"));
return particlePacket;
};
}
default -> {
ParticleMapping particleMapping = Registries.PARTICLES.get(particle.getType());
if (particleMapping == null) { //TODO ensure no particle can be null
Expand Down