Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-09-16 17:31:21 +02:00
Handle dust particle rgb type change
Dieser Commit ist enthalten in:
Ursprung
9e4718abc3
Commit
54dcb32232
@ -56,7 +56,7 @@ public class BlockItemPackets1_17 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
protocol.registerOutgoing(ClientboundPackets1_17.SPAWN_PARTICLE, new PacketRemapper() {
|
protocol.registerOutgoing(ClientboundPackets1_17.SPAWN_PARTICLE, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // Particle Id
|
map(Type.INT); // Particle id
|
||||||
map(Type.BOOLEAN); // Long distance
|
map(Type.BOOLEAN); // Long distance
|
||||||
map(Type.DOUBLE); // X
|
map(Type.DOUBLE); // X
|
||||||
map(Type.DOUBLE); // Y
|
map(Type.DOUBLE); // Y
|
||||||
@ -68,16 +68,18 @@ public class BlockItemPackets1_17 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
map(Type.INT); // Particle count
|
map(Type.INT); // Particle count
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
int id = wrapper.get(Type.INT, 0);
|
int id = wrapper.get(Type.INT, 0);
|
||||||
if (id == 15) {
|
if (id == 14 || id == 15) {
|
||||||
// Dust color transition -> Dust
|
wrapper.write(Type.FLOAT, wrapper.read(Type.DOUBLE).floatValue()); // R
|
||||||
wrapper.passthrough(Type.DOUBLE); // R
|
wrapper.write(Type.FLOAT, wrapper.read(Type.DOUBLE).floatValue()); // G
|
||||||
wrapper.passthrough(Type.DOUBLE); // G
|
wrapper.write(Type.FLOAT, wrapper.read(Type.DOUBLE).floatValue()); // B
|
||||||
wrapper.passthrough(Type.DOUBLE); // B
|
|
||||||
wrapper.passthrough(Type.FLOAT); // Scale
|
wrapper.passthrough(Type.FLOAT); // Scale
|
||||||
|
|
||||||
|
if (id == 15) {
|
||||||
|
// Dust color transition -> Dust
|
||||||
wrapper.read(Type.DOUBLE); // R
|
wrapper.read(Type.DOUBLE); // R
|
||||||
wrapper.read(Type.DOUBLE); // G
|
wrapper.read(Type.DOUBLE); // G
|
||||||
wrapper.read(Type.DOUBLE); // B
|
wrapper.read(Type.DOUBLE); // B
|
||||||
|
}
|
||||||
} else if (id == 36) {
|
} else if (id == 36) {
|
||||||
// Vibration signal - no nice mapping possible without tracking entity positions and doing particle tasks
|
// Vibration signal - no nice mapping possible without tracking entity positions and doing particle tasks
|
||||||
wrapper.cancel();
|
wrapper.cancel();
|
||||||
|
@ -82,13 +82,23 @@ public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
|
|||||||
}
|
}
|
||||||
} else if (type == MetaType1_14.PARTICLE) {
|
} else if (type == MetaType1_14.PARTICLE) {
|
||||||
Particle particle = (Particle) meta.getValue();
|
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) {
|
if (particle.getId() == 15) {
|
||||||
// Remove target color values 4-6
|
// Remove transition target color values 4-6
|
||||||
particle.getArguments().subList(4, 7).clear();
|
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
|
} else if (particle.getId() == 36) { // Vibration Signal
|
||||||
|
// No nice mapping possible without tracking entity positions and doing particle tasks
|
||||||
particle.setId(0);
|
particle.setId(0);
|
||||||
particle.getArguments().clear();
|
particle.getArguments().clear();
|
||||||
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
rewriteParticle(particle);
|
rewriteParticle(particle);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren