Skip to content

Commit

Permalink
Add ghostly essence drops for spectral entities
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Jun 23, 2024
1 parent ae39788 commit bce0005
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import mod.emt.harkenscythe.entities.HSEntityHarbinger;
import mod.emt.harkenscythe.entities.HSEntitySoul;
import mod.emt.harkenscythe.init.HSEnchantments;
import mod.emt.harkenscythe.init.HSItems;
import mod.emt.harkenscythe.init.HSSoundEvents;
import mod.emt.harkenscythe.items.tools.HSScythe;
import net.minecraft.enchantment.Enchantment;
Expand Down Expand Up @@ -41,6 +42,11 @@ 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"))
{
entity.dropItem(HSItems.soul_essence, 1);
}
}

public static void spawnSoul(World world, EntityLivingBase entity)
Expand All @@ -61,8 +67,8 @@ public static void spawnSpectralEntity(World world, EntityLivingBase entity, Blo
// TODO: Set entity data to determine spectral variant
entity.setCustomNameTag("Spectral " + entity.getName());
entity.setHealth(entity.getMaxHealth());
entity.deathTime = 0;
entity.isDead = false;

}
// Spawn ectoglobin
else
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/mod/emt/harkenscythe/events/HSLivingDropsEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package mod.emt.harkenscythe.events;

import mod.emt.harkenscythe.HarkenScythe;
import net.minecraft.entity.EntityLivingBase;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@Mod.EventBusSubscriber(modid = HarkenScythe.MOD_ID)
public class HSLivingDropsEvent
{
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void onLivingDrops(LivingDropsEvent event)
{
EntityLivingBase entity = event.getEntityLiving();
// TODO: Set entity data to determine spectral variant
if (entity.getCustomNameTag().contains("Spectral"))
{
event.getDrops().clear();
}
}
}

0 comments on commit bce0005

Please sign in to comment.