Search in sources :

Example 6 with IBloodAltar

use of WayofTime.alchemicalWizardry.api.tile.IBloodAltar in project BloodMagic by WayofTime.

the class RitualEffectWellOfSuffering method performEffect.

@Override
public void performEffect(IMasterRitualStone ritualStone) {
    String owner = ritualStone.getOwner();
    int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
    World world = ritualStone.getWorld();
    int x = ritualStone.getXCoord();
    int y = ritualStone.getYCoord();
    int z = ritualStone.getZCoord();
    if (world.getWorldTime() % this.timeDelay != 0) {
        return;
    }
    IBloodAltar tileAltar = null;
    boolean testFlag = false;
    for (int i = -5; i <= 5; i++) {
        for (int j = -5; j <= 5; j++) {
            for (int k = -10; k <= 10; k++) {
                if (world.getTileEntity(x + i, y + k, z + j) instanceof IBloodAltar) {
                    tileAltar = (IBloodAltar) world.getTileEntity(x + i, y + k, z + j);
                    testFlag = true;
                }
            }
        }
    }
    if (!testFlag) {
        return;
    }
    boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
    int d0 = 10;
    int vertRange = hasPotentia ? 20 : 10;
    AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, vertRange, d0);
    List<EntityLivingBase> list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
    int entityCount = 0;
    boolean hasTennebrae = this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, false);
    boolean hasOffensa = this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false);
    if (currentEssence < this.getCostPerRefresh() * list.size()) {
        SoulNetworkHandler.causeNauseaToPlayer(owner);
    } else {
        for (EntityLivingBase livingEntity : list) {
            if (!livingEntity.isEntityAlive() || livingEntity instanceof EntityPlayer || AlchemicalWizardry.wellBlacklist.contains(livingEntity.getClass())) {
                continue;
            }
            hasOffensa = hasOffensa && this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, true);
            if (livingEntity.attackEntityFrom(DamageSource.outOfWorld, hasOffensa ? 2 : 1)) {
                hasTennebrae = hasTennebrae && this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, true);
                entityCount++;
                tileAltar.sacrificialDaggerCall(this.amount * (hasTennebrae ? 2 : 1) * (hasOffensa ? 2 : 1), true);
            }
        }
        SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * entityCount);
        if (hasPotentia) {
            this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true);
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) World(net.minecraft.world.World) IBloodAltar(WayofTime.alchemicalWizardry.api.tile.IBloodAltar)

Example 7 with IBloodAltar

use of WayofTime.alchemicalWizardry.api.tile.IBloodAltar in project BloodMagic by WayofTime.

the class DaggerOfSacrifice method findAndNotifyAltarOfDemon.

public boolean findAndNotifyAltarOfDemon(World world, EntityLivingBase sacrifice) {
    int posX = (int) Math.round(sacrifice.posX - 0.5f);
    int posY = (int) sacrifice.posY;
    int posZ = (int) Math.round(sacrifice.posZ - 0.5f);
    IBloodAltar altarEntity = this.getAltar(world, posX, posY, posZ);
    if (altarEntity == null) {
        return false;
    }
    altarEntity.addToDemonBloodDuration(50);
    return true;
}
Also used : IBloodAltar(WayofTime.alchemicalWizardry.api.tile.IBloodAltar)

Example 8 with IBloodAltar

use of WayofTime.alchemicalWizardry.api.tile.IBloodAltar in project BloodMagic by WayofTime.

the class DaggerOfSacrifice method findAndFillAltar.

public boolean findAndFillAltar(World world, EntityLivingBase sacrifice, int amount) {
    int posX = (int) Math.round(sacrifice.posX - 0.5f);
    int posY = (int) sacrifice.posY;
    int posZ = (int) Math.round(sacrifice.posZ - 0.5f);
    IBloodAltar altarEntity = this.getAltar(world, posX, posY, posZ);
    if (altarEntity == null) {
        return false;
    }
    altarEntity.sacrificialDaggerCall(amount, true);
    altarEntity.startCycle();
    return true;
}
Also used : IBloodAltar(WayofTime.alchemicalWizardry.api.tile.IBloodAltar)

Example 9 with IBloodAltar

use of WayofTime.alchemicalWizardry.api.tile.IBloodAltar in project BloodMagic by WayofTime.

the class SacrificialDagger method findAndFillAltar.

public void findAndFillAltar(World world, EntityPlayer player, int amount) {
    int posX = (int) Math.round(player.posX - 0.5f);
    int posY = (int) player.posY;
    int posZ = (int) Math.round(player.posZ - 0.5f);
    IBloodAltar altarEntity = getAltar(world, posX, posY, posZ);
    if (altarEntity == null) {
        return;
    }
    altarEntity.sacrificialDaggerCall(amount, false);
    altarEntity.startCycle();
}
Also used : IBloodAltar(WayofTime.alchemicalWizardry.api.tile.IBloodAltar)

Aggregations

IBloodAltar (WayofTime.alchemicalWizardry.api.tile.IBloodAltar)9 World (net.minecraft.world.World)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 TEWritingTable (WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 IInventory (net.minecraft.inventory.IInventory)1 ISidedInventory (net.minecraft.inventory.ISidedInventory)1 ItemStack (net.minecraft.item.ItemStack)1 TileEntity (net.minecraft.tileentity.TileEntity)1 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)1 FluidStack (net.minecraftforge.fluids.FluidStack)1 IFluidHandler (net.minecraftforge.fluids.IFluidHandler)1