Fix #605 grid lock in 1.12 and 1.13

This commit is contained in:
libraryaddict 2021-07-30 04:25:27 +12:00
parent 41187cd35d
commit 99227518ac

View File

@ -54,13 +54,23 @@ public class FallingBlockWatcher extends FlagWatcher {
if (getDisguise().isDisguiseInUse() && getDisguise().getEntity() != null) { if (getDisguise().isDisguiseInUse() && getDisguise().getEntity() != null) {
PacketContainer relMove = new PacketContainer(PacketType.Play.Server.REL_ENTITY_MOVE); PacketContainer relMove = new PacketContainer(PacketType.Play.Server.REL_ENTITY_MOVE);
StructureModifier<Short> shorts = relMove.getShorts(); relMove.getModifier().write(0, getDisguise().getEntity().getEntityId());
Location loc = getDisguise().getEntity().getLocation(); Location loc = getDisguise().getEntity().getLocation();
relMove.getModifier().write(0, getDisguise().getEntity().getEntityId()); if (NmsVersion.v1_14.isSupported()) {
StructureModifier<Short> shorts = relMove.getShorts();
shorts.write(0, conRel(loc.getX(), loc.getBlockX() + 0.5)); shorts.write(0, conRel(loc.getX(), loc.getBlockX() + 0.5));
shorts.write(1, conRel(loc.getY(), loc.getBlockY() + (loc.getY() % 1 >= 0.85 ? 1 : loc.getY() % 1 >= 0.35 ? .5 : 0))); shorts.write(1, conRel(loc.getY(), loc.getBlockY() + (loc.getY() % 1 >= 0.85 ? 1 : loc.getY() % 1 >= 0.35 ? .5 : 0)));
shorts.write(2, conRel(loc.getZ(), loc.getBlockZ() + 0.5)); shorts.write(2, conRel(loc.getZ(), loc.getBlockZ() + 0.5));
} else {
StructureModifier<Integer> ints = relMove.getIntegers();
ints.write(0, (int) conRel(loc.getX(), loc.getBlockX() + 0.5));
ints.write(1, (int) conRel(loc.getY(), loc.getBlockY() + (loc.getY() % 1 >= 0.85 ? 1 : loc.getY() % 1 >= 0.35 ? .5 : 0)));
ints.write(2, (int) conRel(loc.getZ(), loc.getBlockZ() + 0.5));
}
try { try {
for (Player player : DisguiseUtilities.getPerverts(getDisguise())) { for (Player player : DisguiseUtilities.getPerverts(getDisguise())) {