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);
}
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;
}
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);
}
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;
}
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;
}
}
}
}
}
Aggregations