use of buildcraft.lib.misc.data.Box in project BuildCraft by BuildCraft.
the class TileQuarry method createUtilsIfNeeded.
public void createUtilsIfNeeded() {
if (!worldObj.isRemote) {
if (builder == null) {
if (!box.isInitialized()) {
setBoundaries(loadDefaultBoundaries);
}
initializeBlueprintBuilder();
}
}
if (getStage() != Stage.BUILDING) {
box.isVisible = false;
if (arm == null) {
createArm();
}
if (miningBox == null || !miningBox.isInitialized()) {
miningBox = new Box(box.min(), box.max());
miningBox.contract(1);
miningBox.setMin(VecUtil.replaceValue(miningBox.min(), Axis.Y, 0));
miningBox.setMax(miningBox.max().add(0, 1, 0));
}
if (findTarget(false)) {
AxisAlignedBB union = miningBox.getBoundingBox().union(box.getBoundingBox());
if (!union.isVecInside(headPos)) {
headPos = VecUtil.replaceValue(headPos, Axis.Y, (double) (miningBox.max().getY() - 2));
BlockPos nearestPos = miningBox.closestInsideTo(Utils.convertFloor(headPos));
headPos = Utils.convert(nearestPos);
}
}
} else {
box.isVisible = true;
}
}
use of buildcraft.lib.misc.data.Box in project BuildCraft by BuildCraft.
the class BoxTester method testMax.
@Test
public void testMax() {
Box box = new Box(MIN, MAX);
Assert.assertEquals(MAX, box.max());
}
use of buildcraft.lib.misc.data.Box in project BuildCraft by BuildCraft.
the class BoxTester method testIntersection1.
@Test
public void testIntersection1() {
Box box1 = new Box(new BlockPos(0, 0, 0), new BlockPos(2, 2, 2));
Box box2 = new Box(new BlockPos(1, 1, 1), new BlockPos(3, 3, 3));
Box inter = new Box(new BlockPos(1, 1, 1), new BlockPos(2, 2, 2));
Assert.assertEquals(inter, box1.getIntersect(box2));
Assert.assertEquals(inter, box2.getIntersect(box1));
}
use of buildcraft.lib.misc.data.Box in project BuildCraft by BuildCraft.
the class BoxTester method testContainsVec3d.
@Test
@Theory
public void testContainsVec3d(@FromDataPoints("testContainsVec3d") Entry<Vec3d, Boolean> entry) {
Box box = new Box(MIN, MAX);
Vec3d in = entry.getKey();
boolean expected = entry.getValue();
Assert.assertEquals(expected, box.contains(in));
}
use of buildcraft.lib.misc.data.Box in project BuildCraft by BuildCraft.
the class RenderBoxProvider method renderTileEntityAt.
@Override
public void renderTileEntityAt(T tileentity, double x, double y, double z, float f, int anArgument) {
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GlStateManager.enableCull();
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glPushMatrix();
GL11.glTranslated(-tileentity.getPos().getX(), -tileentity.getPos().getY(), -tileentity.getPos().getZ());
GL11.glTranslated(x, y, z);
if (tileentity instanceof IBoxesProvider) {
for (Box b : ((IBoxesProvider) tileentity).getBoxes()) {
if (b.isVisible) {
RenderBox.doRender(TileEntityRendererDispatcher.instance.worldObj, Minecraft.getMinecraft().renderEngine, getTexture(b.kind), b);
}
}
} else if (tileentity instanceof IBoxProvider) {
Box b = ((IBoxProvider) tileentity).getBox();
if (b.isVisible && b.isInitialized()) {
RenderBox.doRender(TileEntityRendererDispatcher.instance.worldObj, Minecraft.getMinecraft().renderEngine, getTexture(b.kind), b);
}
}
GL11.glPopMatrix();
GL11.glPopAttrib();
GL11.glPopMatrix();
}
Aggregations