From 85febebd09d0fa417c69d51b01c19a20cd0e55ef Mon Sep 17 00:00:00 2001 From: Zak Shearman Date: Mon, 1 May 2023 14:06:48 +0100 Subject: [PATCH] Fix nullability for Player shoulder entity data (#1834) --- .../net/minestom/server/entity/metadata/PlayerMeta.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/net/minestom/server/entity/metadata/PlayerMeta.java b/src/main/java/net/minestom/server/entity/metadata/PlayerMeta.java index af5c7b21a..a0f7342bd 100644 --- a/src/main/java/net/minestom/server/entity/metadata/PlayerMeta.java +++ b/src/main/java/net/minestom/server/entity/metadata/PlayerMeta.java @@ -6,6 +6,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jglrxavpok.hephaistos.nbt.NBT; +import java.util.Map; + public class PlayerMeta extends LivingEntityMeta { public static final byte OFFSET = LivingEntityMeta.MAX_OFFSET; public static final byte MAX_OFFSET = OFFSET + 1; @@ -108,6 +110,8 @@ public class PlayerMeta extends LivingEntityMeta { } public void setLeftShoulderEntityData(@Nullable NBT value) { + if (value == null) value = NBT.Compound(Map.of()); + super.metadata.setIndex(OFFSET + 4, Metadata.NBT(value)); } @@ -117,6 +121,8 @@ public class PlayerMeta extends LivingEntityMeta { } public void setRightShoulderEntityData(@Nullable NBT value) { + if (value == null) value = NBT.Compound(Map.of()); + super.metadata.setIndex(OFFSET + 5, Metadata.NBT(value)); }