Search in sources :

Example 6 with EntitySentientSpecter

use of WayofTime.bloodmagic.entity.mob.EntitySentientSpecter in project BloodMagic by WayofTime.

the class ItemSentientShovel method spawnSentientEntityOnDrop.

@Override
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player) {
    World world = player.getEntityWorld();
    if (!world.isRemote) {
        this.recalculatePowers(droppedStack, world, player);
        EnumDemonWillType type = this.getCurrentType(droppedStack);
        double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
        if (soulsRemaining < 1024) {
            return false;
        }
        PlayerDemonWillHandler.consumeDemonWill(type, player, 100);
        EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
        specterEntity.setPosition(player.posX, player.posY, player.posZ);
        world.spawnEntity(specterEntity);
        specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, droppedStack.copy());
        specterEntity.setType(this.getCurrentType(droppedStack));
        specterEntity.setOwner(player);
        specterEntity.setTamed(true);
        return true;
    }
    return false;
}
Also used : EntitySentientSpecter(WayofTime.bloodmagic.entity.mob.EntitySentientSpecter) World(net.minecraft.world.World) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Aggregations

EntitySentientSpecter (WayofTime.bloodmagic.entity.mob.EntitySentientSpecter)6 World (net.minecraft.world.World)6 EnumDemonWillType (WayofTime.bloodmagic.soul.EnumDemonWillType)5 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 Vec3d (net.minecraft.util.math.Vec3d)1 Explosion (net.minecraft.world.Explosion)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1