use of com.enderio.core.client.render.BoundingBox in project EnderIO by SleepyTrousers.
the class TileDialingDevice method getBounds.
@Override
@Nonnull
public BoundingBox getBounds() {
EnumFacing forward = getDialerFacing().getInputSide();
EnumFacing up;
EnumFacing side;
if (forward.getFrontOffsetY() == 0) {
up = EnumFacing.UP;
side = forward.rotateY();
} else {
// look along y
up = EnumFacing.NORTH;
side = EnumFacing.EAST;
}
int range = 4;
BlockPos checkMin = pos.offset(forward, 0 + 1).offset(side, 0 - range).offset(up, 0 - range);
BlockPos checkMax = pos.offset(forward, (range * 2 - 1) + 1).offset(side, (range * 2 - 1) - range).offset(up, (range * 2 - 1) - range);
return new BoundingBox(checkMin, checkMax);
}
use of com.enderio.core.client.render.BoundingBox in project EnderIO by SleepyTrousers.
the class ConduitGeometryUtil method preInit.
@SubscribeEvent
public static void preInit(EnderIOLifecycleEvent.Config.Post event) {
float size = (float) (0.075f + (0.175f * Config.conduitScale));
WIDTH = size;
HEIGHT = size;
HWIDTH = WIDTH / 2;
HHEIGHT = HEIGHT / 2;
final Vector3d core_min = new Vector3d(0.5f - HWIDTH, 0.5 - HHEIGHT, 0.5 - HWIDTH);
CORE_MIN = core_min;
final Vector3d core_max = new Vector3d(CORE_MIN.x + WIDTH, CORE_MIN.y + HEIGHT, CORE_MIN.z + WIDTH);
CORE_MAX = core_max;
CORE_BOUNDS = new BoundingBox(core_min, core_max);
float connectorWidth = (float) (0.25f + (Config.conduitScale * 0.5f));
for (EnumFacing dir : EnumFacing.VALUES) {
EXTERNAL_CONNECTOR_BOUNDS.put(dir, createExternalConnector(dir, CONNECTOR_DEPTH, connectorWidth));
}
}
use of com.enderio.core.client.render.BoundingBox in project EnderIO by SleepyTrousers.
the class ConduitGeometryUtil method createConnectorComponent.
@Nonnull
private static BoundingBox createConnectorComponent(@Nonnull EnumFacing dir, float cornerMin, float cornerMax, float depthMin, float depthMax) {
float minX = (1 - Math.abs(dir.getFrontOffsetX())) * cornerMin + dir.getFrontOffsetX() * depthMin;
float minY = (1 - Math.abs(dir.getFrontOffsetY())) * cornerMin + dir.getFrontOffsetY() * depthMin;
float minZ = (1 - Math.abs(dir.getFrontOffsetZ())) * cornerMin + dir.getFrontOffsetZ() * depthMin;
float maxX = (1 - Math.abs(dir.getFrontOffsetX())) * cornerMax + (dir.getFrontOffsetX() * depthMax);
float maxY = (1 - Math.abs(dir.getFrontOffsetY())) * cornerMax + (dir.getFrontOffsetY() * depthMax);
float maxZ = (1 - Math.abs(dir.getFrontOffsetZ())) * cornerMax + (dir.getFrontOffsetZ() * depthMax);
minX = fix(minX);
minY = fix(minY);
minZ = fix(minZ);
maxX = fix(maxX);
maxY = fix(maxY);
maxZ = fix(maxZ);
BoundingBox bb = new BoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
bb = bb.fixMinMax();
return bb;
}
use of com.enderio.core.client.render.BoundingBox in project EnderIO by SleepyTrousers.
the class ConduitGeometryUtil method createBoundsForConnectionController.
@Nonnull
public BoundingBox createBoundsForConnectionController(@Nonnull EnumFacing dir, @Nonnull Offset offset) {
Vector3d nonUniformScale = ForgeDirectionOffsets.forDirCopy(dir);
nonUniformScale.scale(0.5);
nonUniformScale.x = 0.8 * (1 - Math.abs(nonUniformScale.x));
nonUniformScale.y = 0.8 * (1 - Math.abs(nonUniformScale.y));
nonUniformScale.z = 0.8 * (1 - Math.abs(nonUniformScale.z));
BoundingBox bb = CORE_BOUNDS;
bb = bb.scale(nonUniformScale.x, nonUniformScale.y, nonUniformScale.z);
double offsetFromEnd = Math.min(bb.sizeX(), bb.sizeY());
offsetFromEnd = Math.min(offsetFromEnd, bb.sizeZ());
offsetFromEnd = Math.max(offsetFromEnd, 0.075);
double transMag = 0.5 - (offsetFromEnd * 1.2);
Vector3d trans = ForgeDirectionOffsets.forDirCopy(dir);
trans.scale(transMag);
bb = bb.translate(trans);
bb = bb.translate(getTranslation(dir, offset));
return bb;
}
use of com.enderio.core.client.render.BoundingBox in project EnderIO by SleepyTrousers.
the class ReservoirRenderer method renderTankFluid.
private void renderTankFluid(SmartTank tank, Set<EnumFacing> mergers, World world, BlockPos pos) {
final FluidStack fluid = tank.getFluid();
if (fluid != null) {
TextureAtlasSprite icon = RenderUtil.getStillTexture(fluid);
int color = fluid.getFluid().getColor(fluid);
float fullness = tank.getFilledRatio();
boolean[][][] merge = getMergers9(world, pos);
BufferBuilder tes = Tessellator.getInstance().getBuffer();
float minU = icon.getMinU(), maxU = icon.getMaxU(), minV = icon.getMinV(), maxV = icon.getMaxV();
for (int i = 0; i <= 1; i++) {
if (i == 0) {
GlStateManager.cullFace(CullFace.FRONT);
} else {
GlStateManager.cullFace(CullFace.BACK);
}
for (NNIterator<EnumFacing> facings = NNList.FACING.fastIterator(); facings.hasNext(); ) {
EnumFacing dir = facings.next();
float fullness2 = 0;
if (mergers.contains(dir)) {
BlockPos pos2 = pos.offset(dir);
TileEntity tileEntity = world.getTileEntity(pos2);
if (tileEntity instanceof TileReservoir) {
TileReservoir res2 = (TileReservoir) tileEntity;
fullness2 = res2.tank.getFilledRatio();
}
}
BoundingBox bb = mkFace(merge, dir, fullness, fullness2);
if (bb != null) {
float minVx = minV, maxVx = maxV;
if (dir.getAxis() != EnumFacing.Axis.Y) {
minVx = icon.getInterpolatedV((1 - fullness) * 16);
maxVx = icon.getInterpolatedV((1 - fullness2) * 16);
}
renderFace(tes, bb, dir, minU, maxU, minVx, maxVx, color);
}
}
}
}
}
Aggregations