Search in sources :

Example 1 with WitherSkeletonEntity

use of net.minecraft.entity.monster.WitherSkeletonEntity in project WarDance by Jackiecrazy.

the class GeneralUtils method dropSkull.

/**
 * drops a skull of the given type. For players it will retrieve their skin
 */
public static ItemStack dropSkull(LivingEntity elb) {
    ItemStack ret = null;
    if (elb instanceof AbstractSkeletonEntity) {
        if (elb instanceof WitherSkeletonEntity)
            ret = new ItemStack(Items.WITHER_SKELETON_SKULL);
        else
            ret = new ItemStack(Items.SKELETON_SKULL);
    } else if (elb instanceof ZombieEntity)
        ret = new ItemStack(Items.ZOMBIE_HEAD);
    else if (elb instanceof CreeperEntity)
        ret = new ItemStack(Items.CREEPER_HEAD);
    else if (elb instanceof EnderDragonEntity)
        ret = new ItemStack(Items.DRAGON_HEAD);
    else if (elb instanceof PlayerEntity) {
        PlayerEntity p = (PlayerEntity) elb;
        ret = new ItemStack(Items.PLAYER_HEAD);
        ret.setTag(new CompoundNBT());
        ret.getTag().putString("SkullOwner", p.getName().getString());
    }
    return ret;
}
Also used : ZombieEntity(net.minecraft.entity.monster.ZombieEntity) CompoundNBT(net.minecraft.nbt.CompoundNBT) EnderDragonEntity(net.minecraft.entity.boss.dragon.EnderDragonEntity) CreeperEntity(net.minecraft.entity.monster.CreeperEntity) ItemStack(net.minecraft.item.ItemStack) AbstractSkeletonEntity(net.minecraft.entity.monster.AbstractSkeletonEntity) WitherSkeletonEntity(net.minecraft.entity.monster.WitherSkeletonEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Aggregations

EnderDragonEntity (net.minecraft.entity.boss.dragon.EnderDragonEntity)1 AbstractSkeletonEntity (net.minecraft.entity.monster.AbstractSkeletonEntity)1 CreeperEntity (net.minecraft.entity.monster.CreeperEntity)1 WitherSkeletonEntity (net.minecraft.entity.monster.WitherSkeletonEntity)1 ZombieEntity (net.minecraft.entity.monster.ZombieEntity)1 PlayerEntity (net.minecraft.entity.player.PlayerEntity)1 ItemStack (net.minecraft.item.ItemStack)1 CompoundNBT (net.minecraft.nbt.CompoundNBT)1