Search in sources :

Example 31 with BlockPosition

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

the class BlockNBTManager method setForBlock.

public static void setForBlock(TileEntity te) {
    if (te == null) {
        return;
    }
    NBTTagCompound tag = new NBTTagCompound();
    te.writeToNBT(tag);
    setForBlock(new BlockPosition(te), tag);
}
Also used : BlockPosition(powercrystals.core.position.BlockPosition) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 32 with BlockPosition

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

the class BlockNBTManager method getForBlock.

public static NBTTagCompound getForBlock(int x, int y, int z) {
    BlockPosition bp = new BlockPosition(x, y, z, ForgeDirection.UNKNOWN);
    NBTTagCompound tag = _blockNbtData.get(bp);
    _blockNbtData.remove(bp);
    return tag;
}
Also used : BlockPosition(powercrystals.core.position.BlockPosition) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 33 with BlockPosition

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

the class BlockNBTManager method setForBlock.

public static void setForBlock(BlockPosition bp, NBTTagCompound tag) {
    BlockPosition newbp = bp.copy();
    newbp.orientation = ForgeDirection.UNKNOWN;
    _blockNbtData.put(bp, tag);
}
Also used : BlockPosition(powercrystals.core.position.BlockPosition)

Example 34 with BlockPosition

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

the class HarvestAreaManager method recalculateArea.

private void recalculateArea() {
    BlockPosition ourpos = BlockPosition.fromFactoryTile(_owner);
    if (_overrideDirection != ForgeDirection.UNKNOWN) {
        ourpos.orientation = _overrideDirection;
    }
    _originX = ourpos.x + _originOffsetX;
    _originY = ourpos.y + _originOffsetY;
    _originZ = ourpos.z + _originOffsetZ;
    _originOrientation = ourpos.orientation;
    int radius = _radius + _upgradeLevel;
    if (ourpos.orientation == ForgeDirection.UP || ourpos.orientation == ForgeDirection.DOWN) {
        ourpos.moveForwards(1);
    } else {
        ourpos.moveForwards(radius + 1);
    }
    ourpos.x += _originOffsetX;
    ourpos.y += _originOffsetY;
    ourpos.z += _originOffsetZ;
    _harvestArea = new Area(ourpos, radius, _areaDown, _areaUp);
    _harvestedBlocks = _harvestArea.getPositionsBottomFirst();
    _currentBlock = 0;
}
Also used : Area(powercrystals.core.position.Area) BlockPosition(powercrystals.core.position.BlockPosition)

Example 35 with BlockPosition

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

the class MFRLiquidMover method pumpLiquid.

public static void pumpLiquid(ILiquidTank tank, TileEntityFactory from) {
    if (tank != null && tank.getLiquid() != null && tank.getLiquid().amount > 0) {
        LiquidStack l = tank.getLiquid().copy();
        l.amount = Math.min(l.amount, LiquidContainerRegistry.BUCKET_VOLUME);
        for (BlockPosition adj : new BlockPosition(from).getAdjacent(true)) {
            TileEntity tile = from.worldObj.getBlockTileEntity(adj.x, adj.y, adj.z);
            if (tile instanceof ITankContainer) {
                int filled = ((ITankContainer) tile).fill(adj.orientation.getOpposite(), l, true);
                tank.drain(filled, true);
                l.amount -= filled;
                if (l.amount <= 0) {
                    break;
                }
            }
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) LiquidStack(net.minecraftforge.liquids.LiquidStack) BlockPosition(powercrystals.core.position.BlockPosition) ITankContainer(net.minecraftforge.liquids.ITankContainer)

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