From 7b36e13d1836a820a37d7751751cc675f6d80bee Mon Sep 17 00:00:00 2001 From: ACGaming <4818419+ACGaming@users.noreply.github.com> Date: Sun, 23 Jun 2024 21:09:17 +0200 Subject: [PATCH] Use tags for most spectral logic Doesn't sync properly to client side, needs to get looked into for rendering purposes --- .../mod/emt/harkenscythe/entities/HSEntityHarbinger.java | 2 +- .../mod/emt/harkenscythe/events/HSLivingDeathEvent.java | 7 +++---- .../mod/emt/harkenscythe/events/HSLivingDropsEvent.java | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/mod/emt/harkenscythe/entities/HSEntityHarbinger.java b/src/main/java/mod/emt/harkenscythe/entities/HSEntityHarbinger.java index 25acc86..2ab78f2 100644 --- a/src/main/java/mod/emt/harkenscythe/entities/HSEntityHarbinger.java +++ b/src/main/java/mod/emt/harkenscythe/entities/HSEntityHarbinger.java @@ -65,7 +65,7 @@ else if (this.getHealth() > this.getMaxHealth() * 0.25) { onSneakPhase(); } - if (this.getAttackTarget() != null && this.getAttackTarget().getCustomNameTag().contains("Spectral")) + if (this.getAttackTarget() != null && this.getAttackTarget().getEntityData().getBoolean("IsSpectral")) { this.setAttackTarget(null); } diff --git a/src/main/java/mod/emt/harkenscythe/events/HSLivingDeathEvent.java b/src/main/java/mod/emt/harkenscythe/events/HSLivingDeathEvent.java index 22c8b90..c57f845 100644 --- a/src/main/java/mod/emt/harkenscythe/events/HSLivingDeathEvent.java +++ b/src/main/java/mod/emt/harkenscythe/events/HSLivingDeathEvent.java @@ -34,7 +34,7 @@ public static void onScytheReap(LivingDeathEvent event) World world = entity.getEntityWorld(); DamageSource damageSource = event.getSource(); Entity trueSource = damageSource.getTrueSource(); - if (trueSource instanceof EntityPlayer && isPlayerReap((EntityPlayer) trueSource, damageSource) && !entity.getCustomNameTag().contains("Spectral")) + if (trueSource instanceof EntityPlayer && isPlayerReap((EntityPlayer) trueSource, damageSource) && !entity.getEntityData().getBoolean("IsSpectral")) { spawnSoul(world, entity); } @@ -42,8 +42,7 @@ else if (trueSource instanceof HSEntityHarbinger) { spawnSpectralEntity(world, entity, entity.getPosition()); } - // TODO: Set entity data to determine spectral variant - else if (!world.isRemote && entity.getCustomNameTag().contains("Spectral")) + else if (!world.isRemote && entity.getEntityData().getBoolean("IsSpectral")) { entity.dropItem(HSItems.soul_essence, 1); } @@ -64,7 +63,7 @@ public static void spawnSpectralEntity(World world, EntityLivingBase entity, Blo // Reanimate original entity if (isWhitelistedMob(entity)) { - // TODO: Set entity data to determine spectral variant + entity.getEntityData().setBoolean("IsSpectral", true); entity.setCustomNameTag("Spectral " + entity.getName()); entity.setHealth(entity.getMaxHealth()); entity.deathTime = 0; diff --git a/src/main/java/mod/emt/harkenscythe/events/HSLivingDropsEvent.java b/src/main/java/mod/emt/harkenscythe/events/HSLivingDropsEvent.java index 6ec2e11..fb98c9b 100644 --- a/src/main/java/mod/emt/harkenscythe/events/HSLivingDropsEvent.java +++ b/src/main/java/mod/emt/harkenscythe/events/HSLivingDropsEvent.java @@ -14,8 +14,7 @@ public class HSLivingDropsEvent public static void onLivingDrops(LivingDropsEvent event) { EntityLivingBase entity = event.getEntityLiving(); - // TODO: Set entity data to determine spectral variant - if (entity.getCustomNameTag().contains("Spectral")) + if (entity.getEntityData().getBoolean("IsSpectral")) { event.getDrops().clear(); }