What I actually want is spawn some item one second after entity death but I don't know how. Here is my code:
package net.some_more_boss.handler;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.client.Minecraft;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraft.item.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.some_more_boss.TestBoss;
import net.some_more_boss.TestBoss.EntityCustom;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
public class bossEvent {
@SubscribeEvent
public void bossDeath(LivingDeathEvent event){
if (!(event.getEntityLiving() instanceof TestBoss.EntityCustom))
return;
if (event.getEntityLiving() instanceof TestBoss.EntityCustom){
EntityCustom boss = (EntityCustom)event.getEntityLiving();
EntityPlayer player = Minecraft.getMinecraft().player;
int X = Minecraft.getMinecraft().player.getPosition().getX();
int Y = Minecraft.getMinecraft().player.getPosition().getY();
int Z = Minecraft.getMinecraft().player.getPosition().getZ();
World world = (World)boss.getEntityWorld();
if (event.getSource().getTrueSource() instanceof EntityPlayer){
//wait some tick here
world.spawnEntity(new EntityItem(world, X, Y, Z, new ItemStack(Items.DIAMOND_SWORD, 1)));
world.spawnEntity(new EntityItem(world, X, Y, Z, new ItemStack(Items.DIAMOND_HELMET, 1)));
world.spawnEntity(new EntityItem(world, X, Y, Z, new ItemStack(Items.WOODEN_AXE, 1)));
}
}
}
}