mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2025-02-04 13:51:23 +01:00
Cancel block change packets for removed actions
This commit is contained in:
parent
d58959fcca
commit
9c81ba368f
@ -31,7 +31,17 @@ public class BlockRewriter {
|
||||
map(Type.UNSIGNED_BYTE); // Action id
|
||||
map(Type.UNSIGNED_BYTE); // Action param
|
||||
map(Type.VAR_INT); // Block id - /!\ NOT BLOCK STATE
|
||||
handler(wrapper -> wrapper.set(Type.VAR_INT, 0, blockRewriter.rewrite(wrapper.get(Type.VAR_INT, 0))));
|
||||
handler(wrapper -> {
|
||||
int id = wrapper.get(Type.VAR_INT, 0);
|
||||
int mappedId = blockRewriter.rewrite(id);
|
||||
if (mappedId == -1) {
|
||||
// Block (action) has been removed
|
||||
wrapper.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
wrapper.set(Type.VAR_INT, 0, mappedId);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user