From 60011168f27cdfb8ef407a0c528d37c46d39f65d Mon Sep 17 00:00:00 2001 From: D3v1s0m Date: Tue, 30 Apr 2024 20:30:26 +0530 Subject: [PATCH] fix dinnerbone property for 1.12 and below --- .../pyr/znpcsplus/entity/properties/DinnerboneProperty.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/entity/properties/DinnerboneProperty.java b/plugin/src/main/java/lol/pyr/znpcsplus/entity/properties/DinnerboneProperty.java index b04fc87..dab1770 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/entity/properties/DinnerboneProperty.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/entity/properties/DinnerboneProperty.java @@ -14,11 +14,13 @@ import java.util.Map; import java.util.Optional; public class DinnerboneProperty extends EntityPropertyImpl { + private final boolean optional; private final Object serialized; private final EntityDataType type; public DinnerboneProperty(boolean legacy, boolean optional) { super("dinnerbone", false, Boolean.class); + this.optional = optional; Component name = Component.text("Dinnerbone"); Object serialized = legacy ? AdventureSerializer.getLegacyGsonSerializer().serialize(name) : optional ? name : LegacyComponentSerializer.legacySection().serialize(name); @@ -28,6 +30,6 @@ public class DinnerboneProperty extends EntityPropertyImpl { @Override public void apply(Player player, PacketEntity entity, boolean isSpawned, Map properties) { - properties.put(2, new EntityData(2, type, entity.getProperty(this) ? serialized : null)); + properties.put(2, new EntityData(2, type, entity.getProperty(this) ? serialized : optional ? null : "")); } }