Handle dust particle change

This commit is contained in:
KennyTV 2021-01-21 09:38:50 +01:00
parent 29ec3efa9c
commit 8a67061d32
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 11 additions and 22 deletions

View File

@ -68,18 +68,16 @@ public class BlockItemPackets1_17 extends nl.matsv.viabackwards.api.rewriters.It
map(Type.INT); // Particle count
handler(wrapper -> {
int id = wrapper.get(Type.INT, 0);
if (id == 14 || id == 15) {
wrapper.write(Type.FLOAT, wrapper.read(Type.DOUBLE).floatValue()); // R
wrapper.write(Type.FLOAT, wrapper.read(Type.DOUBLE).floatValue()); // G
wrapper.write(Type.FLOAT, wrapper.read(Type.DOUBLE).floatValue()); // B
if (id == 15) {
wrapper.passthrough(Type.FLOAT); // R
wrapper.passthrough(Type.FLOAT); // G
wrapper.passthrough(Type.FLOAT); // B
wrapper.passthrough(Type.FLOAT); // Scale
if (id == 15) {
// Dust color transition -> Dust
wrapper.read(Type.DOUBLE); // R
wrapper.read(Type.DOUBLE); // G
wrapper.read(Type.DOUBLE); // B
}
// Dust color transition -> Dust
wrapper.read(Type.FLOAT); // R
wrapper.read(Type.FLOAT); // G
wrapper.read(Type.FLOAT); // B
} else if (id == 36) {
// Vibration signal - no nice mapping possible without tracking entity positions and doing particle tasks
wrapper.cancel();

View File

@ -84,18 +84,9 @@ public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
}
} else if (type == MetaType1_14.PARTICLE) {
Particle particle = (Particle) meta.getValue();
if (particle.getId() == 14 || particle.getId() == 15) { // Dust / Dust Transition
// RGB is encoded as doubles in 1.17
for (int i = 0; i < 3; i++) {
Particle.ParticleData data = particle.getArguments().get(i);
data.setValue(((Number) data.getValue()).floatValue());
data.setType(Type.FLOAT);
}
if (particle.getId() == 15) {
// Remove transition target color values 4-6
particle.getArguments().subList(4, 7).clear();
}
if (particle.getId() == 15) { // Dust / Dust Transition
// Remove transition target color values 4-6
particle.getArguments().subList(4, 7).clear();
} else if (particle.getId() == 36) { // Vibration Signal
// No nice mapping possible without tracking entity positions and doing particle tasks
particle.setId(0);