Search in sources :

Example 41 with EnumDemonWillType

use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.

the class ItemSentientBow method recalculatePowers.

public void recalculatePowers(ItemStack stack, World world, EntityPlayer player) {
    EnumDemonWillType type = PlayerDemonWillHandler.getLargestWillType(player);
    double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
    recalculatePowers(stack, type, soulsRemaining);
}
Also used : EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Example 42 with EnumDemonWillType

use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.

the class ItemSentientBow 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)

Example 43 with EnumDemonWillType

use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.

the class ItemSentientAxe 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)

Example 44 with EnumDemonWillType

use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.

the class ItemSentientShovel method hitEntity.

@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
    if (super.hitEntity(stack, target, attacker)) {
        if (attacker instanceof EntityPlayer) {
            EntityPlayer attackerPlayer = (EntityPlayer) attacker;
            this.recalculatePowers(stack, attackerPlayer.getEntityWorld(), attackerPlayer);
            EnumDemonWillType type = this.getCurrentType(stack);
            double will = PlayerDemonWillHandler.getTotalDemonWill(type, attackerPlayer);
            int willBracket = this.getLevel(stack, will);
            applyEffectToEntity(type, willBracket, target, attackerPlayer);
            ItemStack offStack = attackerPlayer.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
            if (offStack.getItem() instanceof ISentientSwordEffectProvider) {
                ISentientSwordEffectProvider provider = (ISentientSwordEffectProvider) offStack.getItem();
                if (provider.providesEffectForWill(type)) {
                    provider.applyOnHitEffect(type, stack, offStack, attacker, target);
                }
            }
        }
        return true;
    }
    return false;
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) ISentientSwordEffectProvider(WayofTime.bloodmagic.iface.ISentientSwordEffectProvider) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType) ItemStack(net.minecraft.item.ItemStack)

Example 45 with EnumDemonWillType

use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.

the class ItemSentientSword method getRandomDemonWillDrop.

@Override
public List<ItemStack> getRandomDemonWillDrop(EntityLivingBase killedEntity, EntityLivingBase attackingEntity, ItemStack stack, int looting) {
    List<ItemStack> soulList = new ArrayList<>();
    if (killedEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob)) {
        return soulList;
    }
    double willModifier = killedEntity instanceof EntitySlime ? 0.67 : 1;
    IDemonWill soul = ((IDemonWill) RegistrarBloodMagicItems.MONSTER_SOUL);
    EnumDemonWillType type = this.getCurrentType(stack);
    for (int i = 0; i <= looting; i++) {
        if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4) {
            ItemStack soulStack = soul.createWill(type.ordinal(), willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
            soulList.add(soulStack);
        }
    }
    return soulList;
}
Also used : IMob(net.minecraft.entity.monster.IMob) EntitySlime(net.minecraft.entity.monster.EntitySlime) IDemonWill(WayofTime.bloodmagic.soul.IDemonWill) ItemStack(net.minecraft.item.ItemStack) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Aggregations

EnumDemonWillType (WayofTime.bloodmagic.soul.EnumDemonWillType)65 ItemStack (net.minecraft.item.ItemStack)21 BlockPos (net.minecraft.util.math.BlockPos)14 EntityPlayer (net.minecraft.entity.player.EntityPlayer)13 World (net.minecraft.world.World)13 PotionEffect (net.minecraft.potion.PotionEffect)6 TileEntity (net.minecraft.tileentity.TileEntity)6 EntitySentientSpecter (WayofTime.bloodmagic.entity.mob.EntitySentientSpecter)5 IDemonWill (WayofTime.bloodmagic.soul.IDemonWill)5 IBlockState (net.minecraft.block.state.IBlockState)5 EntityLivingBase (net.minecraft.entity.EntityLivingBase)5 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)5 ISentientSwordEffectProvider (WayofTime.bloodmagic.iface.ISentientSwordEffectProvider)4 DemonWillHolder (WayofTime.bloodmagic.soul.DemonWillHolder)4 EntitySlime (net.minecraft.entity.monster.EntitySlime)4 IMob (net.minecraft.entity.monster.IMob)4 ArrayList (java.util.ArrayList)3 EntitySentientArrow (WayofTime.bloodmagic.entity.projectile.EntitySentientArrow)2 IDiscreteDemonWill (WayofTime.bloodmagic.soul.IDiscreteDemonWill)2 List (java.util.List)2