Search in sources :

Example 1 with BlockPosition

use of powercrystals.core.position.BlockPosition in project MineFactoryReloaded by powercrystals.

the class HarvestAreaManager method getNextBlock.

public BlockPosition getNextBlock() {
    checkRecalculate();
    BlockPosition next = _harvestedBlocks.get(_currentBlock);
    _currentBlock++;
    if (_currentBlock >= _harvestedBlocks.size()) {
        _currentBlock = 0;
    }
    return next;
}
Also used : BlockPosition(powercrystals.core.position.BlockPosition)

Example 2 with BlockPosition

use of powercrystals.core.position.BlockPosition in project MineFactoryReloaded by powercrystals.

the class MFRUtil method directionsWithoutConveyors.

public static ForgeDirection[] directionsWithoutConveyors(World world, int x, int y, int z) {
    ArrayList<ForgeDirection> nonConveyors = new ArrayList<ForgeDirection>();
    for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
        BlockPosition bp = new BlockPosition(x, y, z);
        bp.orientation = direction;
        bp.moveForwards(1);
        TileEntity te = world.getBlockTileEntity(bp.x, bp.y, bp.z);
        if (te == null || !(te instanceof TileEntityConveyor)) {
            nonConveyors.add(direction);
        }
    }
    return nonConveyors.toArray(new ForgeDirection[nonConveyors.size()]);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityConveyor(powercrystals.minefactoryreloaded.tile.conveyor.TileEntityConveyor) BlockPosition(powercrystals.core.position.BlockPosition) ArrayList(java.util.ArrayList) ForgeDirection(net.minecraftforge.common.ForgeDirection)

Example 3 with BlockPosition

use of powercrystals.core.position.BlockPosition in project MineFactoryReloaded by powercrystals.

the class ItemNeedlegunAmmoBlock method onHitBlock.

@Override
public void onHitBlock(EntityPlayer owner, World world, int x, int y, int z, int side, double distance) {
    BlockPosition bp = new BlockPosition(x, y, z, ForgeDirection.getOrientation(side));
    bp.moveForwards(1);
    placeBlockAt(world, bp.x, bp.y, bp.z);
}
Also used : BlockPosition(powercrystals.core.position.BlockPosition)

Example 4 with BlockPosition

use of powercrystals.core.position.BlockPosition in project MineFactoryReloaded by powercrystals.

the class TileEntitySludgeBoiler method activateMachine.

@Override
protected boolean activateMachine() {
    if (_tank.getLiquid() != null && _tank.getLiquid().amount > 10) {
        _tank.drain(10, true);
        setWorkDone(getWorkDone() + 1);
        _tick++;
        if (getWorkDone() >= getWorkMax()) {
            ItemStack s = ((WeightedRandomItemStack) WeightedRandom.getRandomItem(_rand, MFRRegistry.getSludgeDrops())).getStack();
            doDrop(s);
            setWorkDone(0);
        }
        if (_tick >= 23) {
            Area a = new Area(new BlockPosition(this), 3, 3, 3);
            List<?> entities = worldObj.getEntitiesWithinAABB(EntityLiving.class, a.toAxisAlignedBB());
            for (Object o : entities) {
                if (o instanceof EntityPlayer) {
                    ((EntityPlayer) o).addPotionEffect(new PotionEffect(Potion.hunger.id, 20 * 20, 0));
                }
                if (o instanceof EntityPlayer) {
                    ((EntityPlayer) o).addPotionEffect(new PotionEffect(Potion.poison.id, 6 * 20, 0));
                }
            }
            _tick = 0;
        }
        return true;
    }
    return false;
}
Also used : Area(powercrystals.core.position.Area) PotionEffect(net.minecraft.potion.PotionEffect) BlockPosition(powercrystals.core.position.BlockPosition) WeightedRandomItemStack(powercrystals.core.random.WeightedRandomItemStack) EntityPlayer(net.minecraft.entity.player.EntityPlayer) WeightedRandomItemStack(powercrystals.core.random.WeightedRandomItemStack) ItemStack(net.minecraft.item.ItemStack)

Example 5 with BlockPosition

use of powercrystals.core.position.BlockPosition in project MineFactoryReloaded by powercrystals.

the class RedstoneNetwork method notifyNodes.

private void notifyNodes(int subnet) {
    if (_ignoreUpdates) {
        RedstoneNetwork.log("Network asked to notify nodes while ignoring updates (API misuse?)!");
        _mustUpdate = true;
        return;
    }
    _ignoreUpdates = true;
    RedstoneNetwork.log("Network with ID %d:%d notifying %d single nodes and %d omni nodes", _id, subnet, _singleNodes.get(subnet).size(), _omniNodes.size());
    for (int i = 0; i < _singleNodes.get(subnet).size(); i++) {
        BlockPosition bp = _singleNodes.get(subnet).get(i);
        RedstoneNetwork.log("Network with ID %d:%d notifying node %s of power state change to %d", _id, subnet, bp.toString(), _powerLevelOutput[subnet]);
        notifySingleNode(bp, subnet);
    }
    for (int i = 0; i < _omniNodes.size(); i++) {
        BlockPosition bp = _omniNodes.get(i);
        RedstoneNetwork.log("Network with ID %d:%d notifying omni node %s of power state change to %d", _id, subnet, bp.toString(), _powerLevelOutput[subnet]);
        notifyOmniNode(bp);
    }
    _ignoreUpdates = false;
}
Also used : BlockPosition(powercrystals.core.position.BlockPosition)

Aggregations

BlockPosition (powercrystals.core.position.BlockPosition)37 ItemStack (net.minecraft.item.ItemStack)8 TileEntity (net.minecraft.tileentity.TileEntity)8 Area (powercrystals.core.position.Area)6 Block (net.minecraft.block.Block)4 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 ForgeDirection (net.minecraftforge.common.ForgeDirection)2 IFactoryHarvestable (powercrystals.minefactoryreloaded.api.IFactoryHarvestable)2 IConnectableRedNet (powercrystals.minefactoryreloaded.api.rednet.IConnectableRedNet)2 TreeHarvestManager (powercrystals.minefactoryreloaded.core.TreeHarvestManager)2 IconOverlay (powercrystals.minefactoryreloaded.render.IconOverlay)2 TileEntityRedNetCable (powercrystals.minefactoryreloaded.tile.rednet.TileEntityRedNetCable)2 IPowerProvider (buildcraft.api.power.IPowerProvider)1 IPowerReceptor (buildcraft.api.power.IPowerReceptor)1 ArrayList (java.util.ArrayList)1 Entity (net.minecraft.entity.Entity)1 EntityAgeable (net.minecraft.entity.EntityAgeable)1 EntityLiving (net.minecraft.entity.EntityLiving)1 EntityMinecartContainer (net.minecraft.entity.item.EntityMinecartContainer)1