mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-11-02 09:09:55 +01:00
parent
00172ee675
commit
650f89e1ce
@ -39,9 +39,13 @@ public class ParticleMapping {
|
|||||||
|
|
||||||
int type = blockType >> 4;
|
int type = blockType >> 4;
|
||||||
int meta = blockType & 15;
|
int meta = blockType & 15;
|
||||||
|
|
||||||
return new int[]{type + (meta << 12)};
|
return new int[]{type + (meta << 12)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockHandler() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
particles = new ParticleData[]{
|
particles = new ParticleData[]{
|
||||||
@ -148,11 +152,15 @@ public class ParticleMapping {
|
|||||||
return new ParticleData(replacementId, handler);
|
return new ParticleData(replacementId, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ParticleHandler {
|
public interface ParticleHandler {
|
||||||
|
|
||||||
int[] rewrite(Protocol1_12_2To1_13 protocol, PacketWrapper wrapper) throws Exception;
|
int[] rewrite(Protocol1_12_2To1_13 protocol, PacketWrapper wrapper) throws Exception;
|
||||||
|
|
||||||
int[] rewrite(Protocol1_12_2To1_13 protocol, List<Particle.ParticleData> data);
|
int[] rewrite(Protocol1_12_2To1_13 protocol, List<Particle.ParticleData> data);
|
||||||
|
|
||||||
|
default boolean isBlockHandler() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class ParticleData {
|
public static final class ParticleData {
|
||||||
|
@ -382,6 +382,11 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13
|
|||||||
int secondArg = 0;
|
int secondArg = 0;
|
||||||
int[] particleArgs = data.rewriteMeta(protocol, particle.getArguments());
|
int[] particleArgs = data.rewriteMeta(protocol, particle.getArguments());
|
||||||
if (particleArgs != null && particleArgs.length != 0) {
|
if (particleArgs != null && particleArgs.length != 0) {
|
||||||
|
if (data.getHandler().isBlockHandler() && particleArgs[0] == 0) {
|
||||||
|
// Air doesn't have a break particle for sub 1.13 clients -> glass pane
|
||||||
|
particleArgs[0] = 102;
|
||||||
|
}
|
||||||
|
|
||||||
firstArg = particleArgs[0];
|
firstArg = particleArgs[0];
|
||||||
secondArg = particleArgs.length == 2 ? particleArgs[1] : 0;
|
secondArg = particleArgs.length == 2 ? particleArgs[1] : 0;
|
||||||
}
|
}
|
||||||
|
@ -139,8 +139,15 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
|
|
||||||
int[] data = old.rewriteData(protocol, wrapper);
|
int[] data = old.rewriteData(protocol, wrapper);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
for (int i : data)
|
if (old.getHandler().isBlockHandler() && data[0] == 0) {
|
||||||
|
// Cancel air block particles
|
||||||
|
wrapper.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i : data) {
|
||||||
wrapper.write(Type.VAR_INT, i);
|
wrapper.write(Type.VAR_INT, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user