Merge pull request #2052 from UnicraftNetwork/IOB-1.13-at-recipe-request-fix

Fix IOB in 1.13 recipe request
This commit is contained in:
Nassim 2020-09-02 10:13:06 +02:00 committed by GitHub
commit b6358cf83c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -826,7 +826,17 @@ public class Protocol1_13To1_12_2 extends Protocol<ClientboundPackets1_12_1, Cli
@Override
public void registerMap() {
map(Type.BYTE); // Window id
handler(wrapper -> wrapper.write(Type.VAR_INT, Integer.parseInt(wrapper.read(Type.STRING).substring(18))));
handler(wrapper -> {
String s = wrapper.read(Type.STRING);
Integer id;
if (s.length() < 19 || (id = Ints.tryParse(s.substring(18))) == null) {
wrapper.cancel();
return;
}
wrapper.write(Type.VAR_INT, id);
});
}
});