diff --git a/src/main/java/xyz/nifeather/morph/backends/server/renderer/network/datawatcher/watchers/types/CreeperWatcher.java b/src/main/java/xyz/nifeather/morph/backends/server/renderer/network/datawatcher/watchers/types/CreeperWatcher.java index 1684f46a..9a8e445c 100644 --- a/src/main/java/xyz/nifeather/morph/backends/server/renderer/network/datawatcher/watchers/types/CreeperWatcher.java +++ b/src/main/java/xyz/nifeather/morph/backends/server/renderer/network/datawatcher/watchers/types/CreeperWatcher.java @@ -4,6 +4,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import xyz.nifeather.morph.backends.server.renderer.network.registries.ValueIndex; +import xyz.nifeather.morph.misc.disguiseProperty.DisguiseProperties; +import xyz.nifeather.morph.misc.disguiseProperty.SingleProperty; +import xyz.nifeather.morph.misc.disguiseProperty.values.CreeperProperties; public class CreeperWatcher extends LivingEntityWatcher { @@ -20,6 +23,20 @@ protected void initRegistry() register(ValueIndex.CREEPER); } + @Override + protected void onPropertyWrite(SingleProperty property, X value) + { + var properties = DisguiseProperties.INSTANCE.getOrThrow(CreeperProperties.class); + + if (property.equals(properties.CHARGED)) + { + var isCharged = Boolean.TRUE.equals(value); + this.writePersistent(ValueIndex.CREEPER.IS_CHARGED_CREEPER, isCharged); + } + + super.onPropertyWrite(property, value); + } + @Override public void mergeFromCompound(CompoundTag nbt) { diff --git a/src/main/java/xyz/nifeather/morph/misc/disguiseProperty/DisguiseProperties.java b/src/main/java/xyz/nifeather/morph/misc/disguiseProperty/DisguiseProperties.java index 6aaf728e..555280fe 100644 --- a/src/main/java/xyz/nifeather/morph/misc/disguiseProperty/DisguiseProperties.java +++ b/src/main/java/xyz/nifeather/morph/misc/disguiseProperty/DisguiseProperties.java @@ -34,6 +34,7 @@ public DisguiseProperties() register(EntityType.VILLAGER, new VillagerProperties()); register(EntityType.ZOMBIE_VILLAGER, new VillagerProperties()); register(EntityType.ARMOR_STAND, new ArmorStandProperties()); + register(EntityType.CREEPER, new CreeperProperties()); } public void register(EntityType type, AbstractProperties properties) diff --git a/src/main/java/xyz/nifeather/morph/misc/disguiseProperty/values/CreeperProperties.java b/src/main/java/xyz/nifeather/morph/misc/disguiseProperty/values/CreeperProperties.java new file mode 100644 index 00000000..f8a9bc8e --- /dev/null +++ b/src/main/java/xyz/nifeather/morph/misc/disguiseProperty/values/CreeperProperties.java @@ -0,0 +1,13 @@ +package xyz.nifeather.morph.misc.disguiseProperty.values; + +import xyz.nifeather.morph.misc.disguiseProperty.SingleProperty; + +public class CreeperProperties extends AbstractProperties +{ + public final SingleProperty CHARGED = getSingle("charged", false).withRandom(false, false, false, true); + + public CreeperProperties() + { + registerSingle(CHARGED); + } +}