From e09f33c61482532c4503b136c0821f084aa0f0ae Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 27 Feb 2021 12:19:30 -0500 Subject: [PATCH 1/2] Clean up and fix more armor stand inconsistencies (#1988) --- .../entity/living/ArmorStandEntity.java | 49 ++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java index 5543c3d5d..3d1005510 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java @@ -123,43 +123,38 @@ public class ArmorStandEntity extends LivingEntity { isInvisible = (xd & 0x20) == 0x20; updateSecondEntityStatus(false); } - } else if (entityMetadata.getId() == 2 || entityMetadata.getId() == 3) { + } else if (entityMetadata.getId() == 2) { updateSecondEntityStatus(false); } else if (entityMetadata.getId() == 14 && entityMetadata.getType() == MetadataType.BYTE) { byte xd = (byte) entityMetadata.getValue(); // isSmall boolean newIsSmall = (xd & 0x01) == 0x01; - if ((newIsSmall != isSmall) && positionRequiresOffset) { - // Fix new inconsistency with offset - this.position = fixOffsetForSize(position, newIsSmall); - positionUpdateRequired = true; - } - isSmall = newIsSmall; - if (isSmall) { - - float scale = metadata.getFloat(EntityData.SCALE); - if (scale != 0.55f && scale != 0.0f) { - metadata.put(EntityData.SCALE, 0.55f); + if (newIsSmall != isSmall) { + if (positionRequiresOffset) { + // Fix new inconsistency with offset + this.position = fixOffsetForSize(position, newIsSmall); + positionUpdateRequired = true; } - if (metadata.getFloat(EntityData.BOUNDING_BOX_WIDTH) == 0.5f) { - metadata.put(EntityData.BOUNDING_BOX_WIDTH, 0.25f); - metadata.put(EntityData.BOUNDING_BOX_HEIGHT, 0.9875f); + isSmall = newIsSmall; + if (!isMarker) { + toggleSmallStatus(); } - } else if (metadata.getFloat(EntityData.BOUNDING_BOX_WIDTH) == 0.25f) { - metadata.put(EntityData.BOUNDING_BOX_WIDTH, entityType.getWidth()); - metadata.put(EntityData.BOUNDING_BOX_HEIGHT, entityType.getHeight()); } // setMarker boolean oldIsMarker = isMarker; isMarker = (xd & 0x10) == 0x10; - if (isMarker) { - metadata.put(EntityData.BOUNDING_BOX_WIDTH, 0.0f); - metadata.put(EntityData.BOUNDING_BOX_HEIGHT, 0.0f); - } if (oldIsMarker != isMarker) { + if (isMarker) { + metadata.put(EntityData.BOUNDING_BOX_WIDTH, 0.0f); + metadata.put(EntityData.BOUNDING_BOX_HEIGHT, 0.0f); + metadata.put(EntityData.SCALE, 0f); + } else { + toggleSmallStatus(); + } + updateSecondEntityStatus(false); } } @@ -226,6 +221,7 @@ public class ArmorStandEntity extends LivingEntity { if (!primaryEntity) return; if (!isInvisible || isMarker) { // It is either impossible to show armor, or the armor stand isn't invisible. We good. + metadata.getFlags().setFlag(EntityFlag.INVISIBLE, false); updateOffsetRequirement(false); if (positionUpdateRequired) { positionUpdateRequired = false; @@ -306,6 +302,15 @@ public class ArmorStandEntity extends LivingEntity { } } + /** + * If this armor stand is not a marker, set its bounding box size and scale. + */ + private void toggleSmallStatus() { + metadata.put(EntityData.BOUNDING_BOX_WIDTH, isSmall ? 0.25f : entityType.getWidth()); + metadata.put(EntityData.BOUNDING_BOX_HEIGHT, isSmall ? 0.9875f : entityType.getHeight()); + metadata.put(EntityData.SCALE, isSmall ? 0.55f : 1f); + } + /** * @return the selected position with the position offset applied. */ From 88d4903fc6a62ed2cd5cc4ea014742fb97b9b2a9 Mon Sep 17 00:00:00 2001 From: SupremeMortal <6178101+SupremeMortal@users.noreply.github.com> Date: Sun, 28 Feb 2021 16:07:26 +0000 Subject: [PATCH 2/2] Update Protocol lib and fastutil (#1990) * Update protocol lib and fastutil Move away from jitpack since we store each unique snapshot build in the opencollab repo. Also, trove hasn't existed in the network repo for quite some time so the exclusion isn't needed anymore. * Store fastutil version in a property * Store adventure version in a property --- connector/pom.xml | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/connector/pom.xml b/connector/pom.xml index 8b1bfe510..33ad39db3 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -12,6 +12,8 @@ 4.1.59.Final + 8.5.2 + 4.5.0 @@ -28,15 +30,11 @@ compile - com.github.CloudburstMC.Protocol + com.nukkitx.protocol bedrock-v422 - 294e7e5 + 2.6.2-20210228.150048-4 compile - - net.sf.trove4j - trove - com.nukkitx.network raknet @@ -44,9 +42,9 @@ - com.github.CloudburstMC.Network + com.nukkitx.network raknet - a94d2dd + 1.6.26-20210217.205834-2 compile @@ -58,61 +56,61 @@ com.nukkitx.fastutil fastutil-int-int-maps - 8.3.1 + ${fastutil.version} compile com.nukkitx.fastutil fastutil-int-float-maps - 8.3.1 + ${fastutil.version} compile com.nukkitx.fastutil fastutil-long-long-maps - 8.3.1 + ${fastutil.version} compile com.nukkitx.fastutil fastutil-object-long-maps - 8.3.1 + ${fastutil.version} compile com.nukkitx.fastutil fastutil-int-byte-maps - 8.3.1 + ${fastutil.version} compile com.nukkitx.fastutil fastutil-int-double-maps - 8.3.1 + ${fastutil.version} compile com.nukkitx.fastutil fastutil-int-boolean-maps - 8.3.1 + ${fastutil.version} compile com.nukkitx.fastutil fastutil-object-int-maps - 8.3.1 + ${fastutil.version} compile com.nukkitx.fastutil fastutil-object-byte-maps - 8.3.1 + ${fastutil.version} compile com.nukkitx.fastutil fastutil-object-object-maps - 8.3.1 + ${fastutil.version} compile @@ -214,25 +212,25 @@ net.kyori adventure-api - 4.5.0 + ${adventure.version} compile net.kyori adventure-text-serializer-gson - 4.5.0 + ${adventure.version} compile net.kyori adventure-text-serializer-legacy - 4.5.0 + ${adventure.version} compile net.kyori adventure-text-serializer-gson-legacy-impl - 4.5.0 + ${adventure.version} compile