Search in sources :

Example 11 with BlockPosition

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

the class BlockFactoryGlass method getBlockOverlayTexture.

public Icon getBlockOverlayTexture(IBlockAccess world, int x, int y, int z, int side) {
    BlockPosition bp;
    boolean[] sides = new boolean[8];
    if (side <= 1) {
        bp = new BlockPosition(x, y, z, ForgeDirection.NORTH);
        bp.moveRight(1);
        sides[0] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
        bp.moveBackwards(1);
        sides[4] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
        bp.moveLeft(1);
        sides[1] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
        bp.moveLeft(1);
        sides[5] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
        bp.moveForwards(1);
        sides[3] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
        bp.moveForwards(1);
        sides[6] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
        bp.moveRight(1);
        sides[2] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
        bp.moveRight(1);
        sides[7] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
    } else {
        bp = new BlockPosition(x, y, z, ForgeDirection.VALID_DIRECTIONS[side]);
        bp.moveRight(1);
        sides[0] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
        bp.moveDown(1);
        sides[4] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
        bp.moveLeft(1);
        sides[1] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
        bp.moveLeft(1);
        sides[5] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
        bp.moveUp(1);
        sides[3] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
        bp.moveUp(1);
        sides[6] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
        bp.moveRight(1);
        sides[2] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
        bp.moveRight(1);
        sides[7] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
    }
    return new IconOverlay(_texture, 8, 8, sides);
}
Also used : IconOverlay(powercrystals.minefactoryreloaded.render.IconOverlay) BlockPosition(powercrystals.core.position.BlockPosition)

Example 12 with BlockPosition

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

the class BlockFactoryGlassPane method getBlockOverlayTexture.

public Icon getBlockOverlayTexture(IBlockAccess world, int x, int y, int z, int side) {
    BlockPosition bp = new BlockPosition(x, y, z, ForgeDirection.VALID_DIRECTIONS[side]);
    boolean[] sides = new boolean[8];
    bp.moveRight(1);
    sides[0] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
    bp.moveDown(1);
    sides[4] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
    bp.moveLeft(1);
    sides[1] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
    bp.moveLeft(1);
    sides[5] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
    bp.moveUp(1);
    sides[3] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
    bp.moveUp(1);
    sides[6] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
    bp.moveRight(1);
    sides[2] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
    bp.moveRight(1);
    sides[7] = world.getBlockId(bp.x, bp.y, bp.z) == blockID;
    return new IconOverlay(BlockFactoryGlass._texture, 8, 8, sides);
}
Also used : IconOverlay(powercrystals.minefactoryreloaded.render.IconOverlay) BlockPosition(powercrystals.core.position.BlockPosition)

Example 13 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 14 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 15 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)

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