From 99227518acc1e09dc03e813188de03a8a6f63992 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 30 Jul 2021 04:25:27 +1200 Subject: [PATCH] Fix #605 grid lock in 1.12 and 1.13 --- .../watchers/FallingBlockWatcher.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.java index c0f70a88..021cd7fe 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/FallingBlockWatcher.java @@ -54,13 +54,23 @@ public class FallingBlockWatcher extends FlagWatcher { if (getDisguise().isDisguiseInUse() && getDisguise().getEntity() != null) { PacketContainer relMove = new PacketContainer(PacketType.Play.Server.REL_ENTITY_MOVE); - StructureModifier shorts = relMove.getShorts(); + relMove.getModifier().write(0, getDisguise().getEntity().getEntityId()); + Location loc = getDisguise().getEntity().getLocation(); - relMove.getModifier().write(0, getDisguise().getEntity().getEntityId()); - 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(2, conRel(loc.getZ(), loc.getBlockZ() + 0.5)); + if (NmsVersion.v1_14.isSupported()) { + StructureModifier shorts = relMove.getShorts(); + + 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(2, conRel(loc.getZ(), loc.getBlockZ() + 0.5)); + } else { + StructureModifier 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 { for (Player player : DisguiseUtilities.getPerverts(getDisguise())) {