mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-19 00:25:39 +01:00
Fix block connections causing issues with TNT
This commit is contained in:
parent
d5ff2b5b63
commit
222c03aa67
@ -395,7 +395,7 @@ public class Protocol1_13To1_12_2 extends Protocol {
|
|||||||
});
|
});
|
||||||
registerOutgoing(State.PLAY, 0x1B, 0x1C);
|
registerOutgoing(State.PLAY, 0x1B, 0x1C);
|
||||||
// New packet 0x1D - NBT Query
|
// New packet 0x1D - NBT Query
|
||||||
registerOutgoing(State.PLAY, 0x1C, 0x1E);
|
// WorldPackets 0x1C -> 0x1E
|
||||||
registerOutgoing(State.PLAY, 0x1E, 0x20);
|
registerOutgoing(State.PLAY, 0x1E, 0x20);
|
||||||
registerOutgoing(State.PLAY, 0x1F, 0x21);
|
registerOutgoing(State.PLAY, 0x1F, 0x21);
|
||||||
// WorldPackets 0x20 -> 0x22
|
// WorldPackets 0x20 -> 0x22
|
||||||
|
@ -254,6 +254,52 @@ public class WorldPackets {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Explosion
|
||||||
|
protocol.registerOutgoing(State.PLAY, 0x1C, 0x1E, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
if (!Via.getConfig().isServersideBlockConnections())
|
||||||
|
return;
|
||||||
|
|
||||||
|
map(Type.FLOAT); // X
|
||||||
|
map(Type.FLOAT); // Y
|
||||||
|
map(Type.FLOAT); // Z
|
||||||
|
map(Type.FLOAT); // Radius
|
||||||
|
map(Type.INT); // Record Count
|
||||||
|
|
||||||
|
handler(new PacketHandler() {
|
||||||
|
@Override
|
||||||
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
|
UserConnection userConnection = wrapper.user();
|
||||||
|
int x = (int) Math.floor(wrapper.get(Type.FLOAT, 0));
|
||||||
|
int y = (int) Math.floor(wrapper.get(Type.FLOAT, 1));
|
||||||
|
int z = (int) Math.floor(wrapper.get(Type.FLOAT, 2));
|
||||||
|
int recordCount = wrapper.get(Type.INT, 0);
|
||||||
|
Position[] records = new Position[recordCount];
|
||||||
|
|
||||||
|
for (int i = 0; i < recordCount; i++) {
|
||||||
|
Position position = new Position(
|
||||||
|
x + wrapper.passthrough(Type.BYTE),
|
||||||
|
(short) (y + wrapper.passthrough(Type.BYTE)),
|
||||||
|
z + wrapper.passthrough(Type.BYTE));
|
||||||
|
records[i] = position;
|
||||||
|
|
||||||
|
// Set to air
|
||||||
|
ConnectionData.updateBlockStorage(userConnection, position.getX(), position.getY(), position.getZ(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Workaround for packet order issue
|
||||||
|
wrapper.send(Protocol1_13To1_12_2.class, true, true);
|
||||||
|
wrapper.cancel();
|
||||||
|
|
||||||
|
for (int i = 0; i < recordCount; i++) {
|
||||||
|
ConnectionData.update(userConnection, records[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Unload Chunk
|
// Unload Chunk
|
||||||
protocol.registerOutgoing(State.PLAY, 0x1D, 0x1F, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x1D, 0x1F, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user