From 3a676e6212e94156dc369d8e1cbfae2639bd98ab Mon Sep 17 00:00:00 2001 From: Aurora Dawn <131844170+StellarWitch7@users.noreply.github.com> Date: Mon, 8 Jul 2024 16:02:22 -0400 Subject: [PATCH] Conduit's Ploy: Exploitative Edition is now discontinued --- .../dev/enjarai/trickster/cca/ManaComponent.java | 15 +++++++++++---- .../dev/enjarai/trickster/entity/ModEntities.java | 10 ++++++++++ .../trickster/tags/entity_type/mana_devoid.json | 5 +++++ 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 src/main/java/dev/enjarai/trickster/entity/ModEntities.java create mode 100644 src/main/resources/data/trickster/tags/entity_type/mana_devoid.json diff --git a/src/main/java/dev/enjarai/trickster/cca/ManaComponent.java b/src/main/java/dev/enjarai/trickster/cca/ManaComponent.java index b491e11a..6fb5a1a2 100644 --- a/src/main/java/dev/enjarai/trickster/cca/ManaComponent.java +++ b/src/main/java/dev/enjarai/trickster/cca/ManaComponent.java @@ -1,10 +1,9 @@ package dev.enjarai.trickster.cca; +import dev.enjarai.trickster.entity.ModEntities; import dev.enjarai.trickster.spell.ManaPool; import dev.enjarai.trickster.spell.SimpleManaPool; import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.damage.DamageTypes; import net.minecraft.nbt.NbtCompound; import net.minecraft.network.RegistryByteBuf; import net.minecraft.registry.RegistryWrapper; @@ -14,10 +13,12 @@ public class ManaComponent extends SimpleManaPool implements AutoSyncedComponent, CommonTickingComponent { private final LivingEntity entity; + private final boolean manaDevoid; public ManaComponent(LivingEntity entity) { super(0); // Max mana gets updated later this.entity = entity; + this.manaDevoid = entity.getType().isIn(ModEntities.MANA_DEVOID); } @Override @@ -42,6 +43,9 @@ public void writeSyncPacket(RegistryByteBuf buf, ServerPlayerEntity recipient) { @Override public void tick() { + if (manaDevoid) + return; + maxMana = ManaPool.manaFromHealth(entity.getMaxHealth()); stdIncrease(); } @@ -56,12 +60,15 @@ public void increase(float amount) { */ @Override public boolean decrease(float amount) { + if (manaDevoid) + return true; + float f = mana - amount; mana = Math.max(Math.min(mana - amount, maxMana), 0); if (f < 0) { //TODO: funny death messages - entity.damage(new DamageSource(entity.getRegistryManager().get(DamageTypes.MAGIC.getRegistryRef()).entryOf(DamageTypes.MAGIC)), - ManaPool.healthFromMana(f * -1)); + if (!entity.isInCreativeMode()) + entity.setHealth(entity.getHealth() - ManaPool.healthFromMana(f * -1)); return entity.isAlive(); } diff --git a/src/main/java/dev/enjarai/trickster/entity/ModEntities.java b/src/main/java/dev/enjarai/trickster/entity/ModEntities.java new file mode 100644 index 00000000..8a5f98b8 --- /dev/null +++ b/src/main/java/dev/enjarai/trickster/entity/ModEntities.java @@ -0,0 +1,10 @@ +package dev.enjarai.trickster.entity; + +import dev.enjarai.trickster.Trickster; +import net.minecraft.entity.EntityType; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.TagKey; + +public class ModEntities { + public static final TagKey> MANA_DEVOID = TagKey.of(RegistryKeys.ENTITY_TYPE, Trickster.id("mana_devoid")); +} diff --git a/src/main/resources/data/trickster/tags/entity_type/mana_devoid.json b/src/main/resources/data/trickster/tags/entity_type/mana_devoid.json new file mode 100644 index 00000000..7b05549b --- /dev/null +++ b/src/main/resources/data/trickster/tags/entity_type/mana_devoid.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:armor_stand" + ] +} \ No newline at end of file