use of forestry.core.vect.MutableVect in project ForestryMC by ForestryMC.
the class FarmTarget method setExtentAndYOffset.
public void setExtentAndYOffset(World world, Vect platformPosition) {
if (platformPosition == null) {
extent = 0;
return;
}
MutableVect position = new MutableVect(platformPosition);
for (extent = 0; extent < limit; extent++) {
Block platform = VectUtil.getBlock(world, position);
Vect soilPosition = new Vect(position.x, position.y + 1, position.z);
if (!StructureLogicFarm.bricks.contains(platform) || !FarmLogic.canBreakSoil(world, soilPosition)) {
break;
}
position.add(getDirection());
}
yOffset = platformPosition.getY() + 1 - getStart().getY();
}
use of forestry.core.vect.MutableVect in project ForestryMC by ForestryMC.
the class FarmHelper method getFarmMultiblockEdge.
private static Vect getFarmMultiblockEdge(World world, Vect start, ForgeDirection direction) {
MutableVect edge = new MutableVect(start);
while (VectUtil.getTile(world, edge) instanceof IFarmComponent) {
edge.add(direction);
}
edge.add(direction.getOpposite());
return new Vect(edge);
}
use of forestry.core.vect.MutableVect in project ForestryMC by ForestryMC.
the class FarmLogicCocoa method tryPlantingCocoa.
private boolean tryPlantingCocoa(Vect position) {
World world = getWorld();
MutableVect current = new MutableVect(position);
while (VectUtil.isWoodBlock(world, current) && BlockLog.func_150165_c(VectUtil.getBlockMeta(world, current)) == 3) {
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
if (direction == ForgeDirection.UP || direction == ForgeDirection.DOWN) {
continue;
}
Vect candidate = new Vect(current.x + direction.offsetX, current.y, current.z + direction.offsetZ);
if (VectUtil.isAirBlock(world, candidate)) {
return housing.plantGermling(cocoa, world, candidate.x, candidate.y, candidate.z);
}
}
current.y++;
if (current.y - position.y > 1) {
break;
}
}
return false;
}
use of forestry.core.vect.MutableVect in project ForestryMC by ForestryMC.
the class Bee method hasFlower.
@Override
public boolean hasFlower(IBeeHousing housing) {
IFlowerProvider provider = genome.getFlowerProvider();
Vect housingPos = new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord());
Vect area = getArea(genome, housing);
Vect offset = new Vect(-area.x / 2, -area.y / 2, -area.z / 2);
boolean hasFlower = false;
MutableVect posCurrent = new MutableVect(0, 0, 0);
while (posCurrent.advancePositionInArea(area)) {
Vect posBlock = Vect.add(housingPos, posCurrent, offset);
if (provider.isAcceptedFlower(housing.getWorld(), this, posBlock.x, posBlock.y, posBlock.z)) {
hasFlower = true;
break;
}
}
return hasFlower;
}
Aggregations