Search in sources :

Example 11 with EnumDemonWillType

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

the class ItemSentientSword 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 12 with EnumDemonWillType

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

the class ModCorruptionBlocks method init.

public static void init() {
    for (EnumDemonWillType type : EnumDemonWillType.values()) {
        CorruptionHandler.registerBlockCorruption(type, Blocks.STONE, 0, RegistrarBloodMagicBlocks.DEMON_EXTRAS.getStateFromMeta(type.ordinal()));
        CorruptionHandler.registerBlockCorruption(type, Blocks.GRASS, 0, RegistrarBloodMagicBlocks.DEMON_EXTRAS.getStateFromMeta(type.ordinal()));
        CorruptionHandler.registerBlockCorruption(type, Blocks.DIRT, 0, RegistrarBloodMagicBlocks.DEMON_EXTRAS.getStateFromMeta(type.ordinal()));
    }
}
Also used : EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Example 13 with EnumDemonWillType

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

the class Ritual method getErrorForBlockRangeOnFail.

public ITextComponent getErrorForBlockRangeOnFail(EntityPlayer player, String range, IMasterRitualStone master, BlockPos offset1, BlockPos offset2) {
    AreaDescriptor descriptor = this.getBlockRange(range);
    if (descriptor == null) {
        return new TextComponentTranslation("ritual.bloodmagic.blockRange.tooBig", "?");
    }
    List<EnumDemonWillType> willConfig = master.getActiveWillConfig();
    DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(master.getWorldObj(), master.getBlockPos());
    int maxVolume = this.getMaxVolumeForRange(range, willConfig, holder);
    int maxVertical = this.getMaxVerticalRadiusForRange(range, willConfig, holder);
    int maxHorizontal = this.getMaxHorizontalRadiusForRange(range, willConfig, holder);
    if (maxVolume > 0 && descriptor.getVolumeForOffsets(offset1, offset2) > maxVolume) {
        return new TextComponentTranslation("ritual.bloodmagic.blockRange.tooBig", maxVolume);
    } else {
        return new TextComponentTranslation("ritual.bloodmagic.blockRange.tooFar", maxVertical, maxHorizontal);
    }
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) DemonWillHolder(WayofTime.bloodmagic.soul.DemonWillHolder) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Example 14 with EnumDemonWillType

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

the class TileDemonCrucible method deserialize.

@Override
public void deserialize(NBTTagCompound tag) {
    super.deserialize(tag);
    willMap.clear();
    for (EnumDemonWillType type : EnumDemonWillType.values()) {
        double amount = tag.getDouble("EnumWill" + type.getName());
        if (amount > 0) {
            willMap.put(type, amount);
        }
    }
}
Also used : EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Example 15 with EnumDemonWillType

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

the class TileDemonCrucible method update.

@Override
public void update() {
    if (getWorld().isRemote) {
        return;
    }
    internalCounter++;
    if (getWorld().isBlockPowered(getPos())) {
        // TODO: Fill the contained gem if it is there.
        ItemStack stack = this.getStackInSlot(0);
        if (stack.getItem() instanceof IDemonWillGem) {
            IDemonWillGem gemItem = (IDemonWillGem) stack.getItem();
            for (EnumDemonWillType type : EnumDemonWillType.values()) {
                if (willMap.containsKey(type)) {
                    double current = willMap.get(type);
                    double fillAmount = Math.min(gemDrainRate, current);
                    if (fillAmount > 0) {
                        fillAmount = gemItem.fillWill(type, stack, fillAmount, true);
                        if (willMap.get(type) - fillAmount <= 0) {
                            willMap.remove(type);
                        } else {
                            willMap.put(type, willMap.get(type) - fillAmount);
                        }
                    }
                }
            }
        }
    } else {
        ItemStack stack = this.getStackInSlot(0);
        if (!stack.isEmpty()) {
            if (stack.getItem() instanceof IDemonWillGem) {
                IDemonWillGem gemItem = (IDemonWillGem) stack.getItem();
                for (EnumDemonWillType type : EnumDemonWillType.values()) {
                    double currentAmount = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
                    double drainAmount = Math.min(maxWill - currentAmount, gemDrainRate);
                    double filled = WorldDemonWillHandler.fillWillToMaximum(getWorld(), pos, type, drainAmount, maxWill, false);
                    filled = gemItem.drainWill(type, stack, filled, false);
                    if (filled > 0) {
                        filled = gemItem.drainWill(type, stack, filled, true);
                        WorldDemonWillHandler.fillWillToMaximum(getWorld(), pos, type, filled, maxWill, true);
                    }
                }
            } else if (// TODO: Limit the speed of this process
            stack.getItem() instanceof IDiscreteDemonWill) {
                IDiscreteDemonWill willItem = (IDiscreteDemonWill) stack.getItem();
                EnumDemonWillType type = willItem.getType(stack);
                double currentAmount = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
                double needed = maxWill - currentAmount;
                double discreteAmount = willItem.getDiscretization(stack);
                if (needed >= discreteAmount) {
                    double filled = willItem.drainWill(stack, discreteAmount);
                    if (filled > 0) {
                        WorldDemonWillHandler.fillWillToMaximum(getWorld(), pos, type, filled, maxWill, true);
                        if (stack.getCount() <= 0) {
                            this.setInventorySlotContents(0, ItemStack.EMPTY);
                        }
                    }
                }
            }
        }
    }
}
Also used : IDemonWillGem(WayofTime.bloodmagic.soul.IDemonWillGem) IDiscreteDemonWill(WayofTime.bloodmagic.soul.IDiscreteDemonWill) 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