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;
}
Aggregations