Cancel 1.14 bell block action

Fixes #209
This commit is contained in:
KennyTV 2020-06-08 18:01:40 +02:00
parent 3bda6dd503
commit 71d5aab1b0
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 9 additions and 5 deletions

View File

@ -211,10 +211,12 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
public static int getNewBlockId(int id) {
if (id == 669) return -1; // Bell
int newId = BackwardsMappings.blockMappings.getNewId(id);
if (newId == -1) {
ViaBackwards.getPlatform().getLogger().warning("Missing 1.13.2 block id for 1.14 block " + id);
return id;
return -1;
}
return newId;
}

View File

@ -354,11 +354,13 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
map(Type.UNSIGNED_BYTE); // Action id
map(Type.UNSIGNED_BYTE); // Action param
map(Type.VAR_INT); // Block id - /!\ NOT BLOCK STATE
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
wrapper.set(Type.VAR_INT, 0, Protocol1_13_2To1_14.getNewBlockId(wrapper.get(Type.VAR_INT, 0)));
handler(wrapper -> {
int mappedId = Protocol1_13_2To1_14.getNewBlockId(wrapper.get(Type.VAR_INT, 0));
if (mappedId == -1) {
wrapper.cancel();
return;
}
wrapper.set(Type.VAR_INT, 0, mappedId);
});
}
});