Search in sources :

Example 1 with EnumDemonWillType

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

the class BlockDemonCrystal method breakBlock.

@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
    TileEntity tile = world.getTileEntity(pos);
    if (tile instanceof TileDemonCrystal) {
        EnumDemonWillType type = state.getValue(TYPE);
        int number = ((TileDemonCrystal) tile).getCrystalCount();
        spawnAsEntity(world, pos, getItemStackDropped(type, number));
        world.removeTileEntity(pos);
    }
    super.breakBlock(world, pos, state);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType) TileDemonCrystal(WayofTime.bloodmagic.tile.TileDemonCrystal)

Example 2 with EnumDemonWillType

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

the class ItemSentientArmour method onPlayerAttacked.

public void onPlayerAttacked(ItemStack stack, DamageSource source, EntityPlayer attackedPlayer) {
    if (source.getTrueSource() instanceof EntityLivingBase) {
        EntityLivingBase attacker = (EntityLivingBase) source.getTrueSource();
        EnumDemonWillType type = this.getCurrentType(stack);
        switch(type) {
            case CORROSIVE:
                if (!source.isProjectile()) {
                    // TODO: customize duration
                    attacker.addPotionEffect(new PotionEffect(MobEffects.POISON, 100));
                }
                break;
            case DEFAULT:
                break;
            case DESTRUCTIVE:
                break;
            case STEADFAST:
                break;
            case VENGEFUL:
                break;
        }
    }
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Example 3 with EnumDemonWillType

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

the class ItemSentientArmour method damageArmor.

@Override
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
    if (entity instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) entity;
        EnumDemonWillType type = getCurrentType(stack);
        double willRequired = this.getCostModifier(stack) * damage;
        double willLeft = PlayerDemonWillHandler.getTotalDemonWill(type, player);
        if (willLeft >= willRequired && canSustainArmour(type, willLeft)) {
            this.setAbilitiesOfArmour(type, willLeft - willRequired, stack);
            PlayerDemonWillHandler.consumeDemonWill(type, player, willRequired);
        } else {
            this.revertArmour(player, stack);
        }
    }
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Example 4 with EnumDemonWillType

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

the class ItemSentientArmour method gatherVariants.

@Override
public void gatherVariants(Consumer<String> variants) {
    for (EnumDemonWillType type : EnumDemonWillType.values()) {
        String additional = "_" + type.getName().toLowerCase();
        variants.accept("armour=head" + additional);
        variants.accept("armour=body" + additional);
        variants.accept("armour=leg" + additional);
        variants.accept("armour=feet" + additional);
    }
}
Also used : EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Example 5 with EnumDemonWillType

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

the class ItemSentientArmourGem method onItemRightClick.

@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
    boolean hasSentientArmour = false;
    NonNullList<ItemStack> armourInventory = player.inventory.armorInventory;
    for (ItemStack armourStack : armourInventory) {
        if (armourStack != null && armourStack.getItem() instanceof ItemSentientArmour) {
            hasSentientArmour = true;
        }
    }
    if (hasSentientArmour) {
        ItemSentientArmour.revertAllArmour(player);
    } else {
        EnumDemonWillType type = PlayerDemonWillHandler.getLargestWillType(player);
        double will = PlayerDemonWillHandler.getTotalDemonWill(type, player);
        // PlayerDemonWillHandler.consumeDemonWill(player, willBracket[bracket]);
        ItemSentientArmour.convertPlayerArmour(type, will, player);
    }
    return new ActionResult<>(EnumActionResult.PASS, player.getHeldItem(hand));
}
Also used : ActionResult(net.minecraft.util.ActionResult) EnumActionResult(net.minecraft.util.EnumActionResult) ItemStack(net.minecraft.item.ItemStack) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType) ItemSentientArmour(WayofTime.bloodmagic.item.armour.ItemSentientArmour)

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