Skip to content

Commit 2168145

Browse files
author
Matsv
committed
Prevent crash for now
1 parent ebb1323 commit 2168145

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12to1_12_1/Protocol1_12To1_12_1.java

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,26 @@
1111
package nl.matsv.viabackwards.protocol.protocol1_12to1_12_1;
1212

1313
import nl.matsv.viabackwards.api.BackwardsProtocol;
14+
import us.myles.ViaVersion.api.PacketWrapper;
1415
import us.myles.ViaVersion.api.data.UserConnection;
16+
import us.myles.ViaVersion.api.remapper.PacketHandler;
17+
import us.myles.ViaVersion.api.remapper.PacketRemapper;
1518
import us.myles.ViaVersion.packets.State;
1619

1720
public class Protocol1_12To1_12_1 extends BackwardsProtocol {
1821
@Override
1922
protected void registerPackets() {
20-
registerOutgoing(State.PLAY, 0x2b, -1); // TODO
23+
registerOutgoing(State.PLAY, 0x2b, -1, new PacketRemapper() {
24+
@Override
25+
public void registerMap() {
26+
handler(new PacketHandler() {
27+
@Override
28+
public void handle(PacketWrapper wrapper) throws Exception {
29+
wrapper.cancel();
30+
}
31+
});
32+
}
33+
}); // TODO
2134
registerOutgoing(State.PLAY, 0x2c, 0x2b);
2235
registerOutgoing(State.PLAY, 0x2d, 0x2c);
2336
registerOutgoing(State.PLAY, 0x2e, 0x2d);
@@ -55,7 +68,17 @@ protected void registerPackets() {
5568
registerOutgoing(State.PLAY, 0x4e, 0x4d);
5669
registerOutgoing(State.PLAY, 0x4f, 0x4e);
5770

58-
registerIncoming(State.PLAY, -1, 0x1); // TODO
71+
registerIncoming(State.PLAY, -1, 0x1, new PacketRemapper() {
72+
@Override
73+
public void registerMap() {
74+
handler(new PacketHandler() {
75+
@Override
76+
public void handle(PacketWrapper wrapper) throws Exception {
77+
wrapper.cancel();
78+
}
79+
});
80+
}
81+
}); // TODO
5982
registerIncoming(State.PLAY, 0x1, 0x2);
6083
registerIncoming(State.PLAY, 0x2, 0x3);
6184
registerIncoming(State.PLAY, 0x3, 0x4);
@@ -73,7 +96,7 @@ protected void registerPackets() {
7396
registerIncoming(State.PLAY, 0xf, 0x10);
7497
registerIncoming(State.PLAY, 0x10, 0x11);
7598
registerIncoming(State.PLAY, 0x11, 0x12);
76-
registerIncoming(State.PLAY, 0x12, -1); // TODO
99+
registerIncoming(State.PLAY, 0x12, -1); // No sent by client, sad :(
77100
}
78101

79102
@Override

0 commit comments

Comments
 (0)