Search in sources :

Example 1 with Vecs3dCube

use of reborncore.common.misc.vecmath.Vecs3dCube in project TechReborn by TechReborn.

the class MultipartFluidPipe method refreshBounding.

public void refreshBounding() {
    float centerFirst = center - offset;
    double w = (thickness / 16) - 0.5;
    boundingBoxes[6] = new Vecs3dCube(centerFirst - w, centerFirst - w, centerFirst - w, centerFirst + w, centerFirst + w, centerFirst + w);
    int i = 0;
    for (EnumFacing dir : EnumFacing.VALUES) {
        double xMin1 = (dir.getFrontOffsetX() < 0 ? 0.0 : (dir.getFrontOffsetX() == 0 ? centerFirst - w : centerFirst + w));
        double xMax1 = (dir.getFrontOffsetX() > 0 ? 1.0 : (dir.getFrontOffsetX() == 0 ? centerFirst + w : centerFirst - w));
        double yMin1 = (dir.getFrontOffsetY() < 0 ? 0.0 : (dir.getFrontOffsetY() == 0 ? centerFirst - w : centerFirst + w));
        double yMax1 = (dir.getFrontOffsetY() > 0 ? 1.0 : (dir.getFrontOffsetY() == 0 ? centerFirst + w : centerFirst - w));
        double zMin1 = (dir.getFrontOffsetZ() < 0 ? 0.0 : (dir.getFrontOffsetZ() == 0 ? centerFirst - w : centerFirst + w));
        double zMax1 = (dir.getFrontOffsetZ() > 0 ? 1.0 : (dir.getFrontOffsetZ() == 0 ? centerFirst + w : centerFirst - w));
        boundingBoxes[i] = new Vecs3dCube(xMin1, yMin1, zMin1, xMax1, yMax1, zMax1);
        i++;
    }
}
Also used : Vecs3dCube(reborncore.common.misc.vecmath.Vecs3dCube)

Example 2 with Vecs3dCube

use of reborncore.common.misc.vecmath.Vecs3dCube in project TechReborn by TechReborn.

the class CableMultipart method refreshBounding.

public void refreshBounding() {
    float centerFirst = center - offset;
    double w = (getCableType().cableThickness / 16) - 0.5;
    boundingBoxes[6] = new Vecs3dCube(centerFirst - w, centerFirst - w, centerFirst - w, centerFirst + w, centerFirst + w, centerFirst + w);
    int i = 0;
    for (EnumFacing dir : EnumFacing.VALUES) {
        double xMin1 = (dir.getFrontOffsetX() < 0 ? 0.0 : (dir.getFrontOffsetX() == 0 ? centerFirst - w : centerFirst + w));
        double xMax1 = (dir.getFrontOffsetX() > 0 ? 1.0 : (dir.getFrontOffsetX() == 0 ? centerFirst + w : centerFirst - w));
        double yMin1 = (dir.getFrontOffsetY() < 0 ? 0.0 : (dir.getFrontOffsetY() == 0 ? centerFirst - w : centerFirst + w));
        double yMax1 = (dir.getFrontOffsetY() > 0 ? 1.0 : (dir.getFrontOffsetY() == 0 ? centerFirst + w : centerFirst - w));
        double zMin1 = (dir.getFrontOffsetZ() < 0 ? 0.0 : (dir.getFrontOffsetZ() == 0 ? centerFirst - w : centerFirst + w));
        double zMax1 = (dir.getFrontOffsetZ() > 0 ? 1.0 : (dir.getFrontOffsetZ() == 0 ? centerFirst + w : centerFirst - w));
        boundingBoxes[i] = new Vecs3dCube(xMin1, yMin1, zMin1, xMax1, yMax1, zMax1);
        i++;
    }
}
Also used : Vecs3dCube(reborncore.common.misc.vecmath.Vecs3dCube)

Example 3 with Vecs3dCube

use of reborncore.common.misc.vecmath.Vecs3dCube in project TechReborn by TechReborn.

the class RenderFluidPipePart method getQuads.

@Override
public List<BakedQuad> getQuads(IBlockState blockState, EnumFacing side, long rand) {
    ArrayList<BakedQuad> list = new ArrayList<>();
    BlockFaceUV uv = new BlockFaceUV(new float[] { 0.0F, 0.0F, 16.0F, 16.0F }, 0);
    BlockPartFace face = new BlockPartFace(null, 0, "", uv);
    double thickness = MultipartFluidPipe.thickness;
    double lastThickness = 16 - thickness;
    IExtendedBlockState state = (IExtendedBlockState) blockState;
    if (side != null) {
        return Collections.emptyList();
    }
    boolean renderedConnection = false;
    if (state != null) {
        if (state.getValue(MultipartFluidPipe.UP)) {
            BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, lastThickness, thickness, lastThickness, 16.0, lastThickness), list, face, ModelRotation.X0_Y0, texture, EnumFacing.UP, faceBakery);
            renderedConnection = true;
        }
        if (state.getValue(MultipartFluidPipe.DOWN)) {
            BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, 0.0, thickness, lastThickness, thickness, lastThickness), list, face, ModelRotation.X0_Y0, texture, EnumFacing.DOWN, faceBakery);
            renderedConnection = true;
        }
        if (state.getValue(MultipartFluidPipe.NORTH)) {
            BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, thickness, 0.0, lastThickness, lastThickness, lastThickness), list, face, ModelRotation.X0_Y0, texture, EnumFacing.NORTH, faceBakery);
            renderedConnection = true;
        }
        if (state.getValue(MultipartFluidPipe.SOUTH)) {
            BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, thickness, thickness, lastThickness, lastThickness, 16.0), list, face, ModelRotation.X0_Y0, texture, EnumFacing.SOUTH, faceBakery);
            renderedConnection = false;
        }
        if (state.getValue(MultipartFluidPipe.EAST)) {
            BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, thickness, thickness, 16, lastThickness, lastThickness), list, face, ModelRotation.X0_Y0, texture, EnumFacing.EAST, faceBakery);
            renderedConnection = false;
        }
        if (state.getValue(MultipartFluidPipe.WEST)) {
            BakedModelUtils.addCubeToList(new Vecs3dCube(0.0, thickness, thickness, thickness, lastThickness, lastThickness), list, face, ModelRotation.X0_Y0, texture, EnumFacing.WEST, faceBakery);
            renderedConnection = true;
        }
        if (!renderedConnection) {
            BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, thickness, thickness, lastThickness, lastThickness, lastThickness), list, face, ModelRotation.X0_Y0, texture, null, faceBakery);
        }
    }
    return list;
}
Also used : Vecs3dCube(reborncore.common.misc.vecmath.Vecs3dCube) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) ArrayList(java.util.ArrayList)

Example 4 with Vecs3dCube

use of reborncore.common.misc.vecmath.Vecs3dCube in project TechReborn by TechReborn.

the class RenderCablePart method getQuads.

@Override
public List<BakedQuad> getQuads(IBlockState blockState, EnumFacing side, long rand) {
    type = blockState.getValue(CableMultipart.TYPE);
    texture = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(type.textureName);
    ArrayList<BakedQuad> list = new ArrayList<>();
    BlockFaceUV uv = new BlockFaceUV(new float[] { 0.0F, 0.0F, 16.0F, 16.0F }, 0);
    BlockPartFace face = new BlockPartFace(null, 0, "", uv);
    double thickness = type.cableThickness;
    double lastThickness = 16 - thickness;
    IExtendedBlockState state = (IExtendedBlockState) blockState;
    if (side != null) {
        return Collections.emptyList();
    }
    BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, thickness, thickness, lastThickness, lastThickness, lastThickness), list, face, ModelRotation.X0_Y0, texture, null, faceBakery);
    if (state != null) {
        if (state.getValue(CableMultipart.UP)) {
            BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, lastThickness, thickness, lastThickness, 16.0, lastThickness), list, face, ModelRotation.X0_Y0, texture, EnumFacing.UP, faceBakery);
        }
        if (state.getValue(CableMultipart.DOWN)) {
            BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, 0.0, thickness, lastThickness, thickness, lastThickness), list, face, ModelRotation.X0_Y0, texture, EnumFacing.DOWN, faceBakery);
        }
        if (state.getValue(CableMultipart.NORTH)) {
            BakedModelUtils.addCubeToList(new Vecs3dCube(0.0, thickness, thickness, thickness, lastThickness, lastThickness), list, face, ModelRotation.X0_Y90, texture, EnumFacing.NORTH, faceBakery);
        }
        if (state.getValue(CableMultipart.SOUTH)) {
            BakedModelUtils.addCubeToList(new Vecs3dCube(0.0, thickness, thickness, thickness, lastThickness, lastThickness), list, face, ModelRotation.X0_Y270, texture, EnumFacing.SOUTH, faceBakery);
        }
        if (state.getValue(CableMultipart.EAST)) {
            BakedModelUtils.addCubeToList(new Vecs3dCube(lastThickness, thickness, thickness, 16.0, lastThickness, lastThickness), list, face, ModelRotation.X0_Y0, texture, EnumFacing.EAST, faceBakery);
        }
        if (state.getValue(CableMultipart.WEST)) {
            BakedModelUtils.addCubeToList(new Vecs3dCube(0.0, thickness, thickness, thickness, lastThickness, lastThickness), list, face, ModelRotation.X0_Y0, texture, EnumFacing.WEST, faceBakery);
        }
    }
    return list;
}
Also used : Vecs3dCube(reborncore.common.misc.vecmath.Vecs3dCube) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) ArrayList(java.util.ArrayList)

Aggregations

Vecs3dCube (reborncore.common.misc.vecmath.Vecs3dCube)4 ArrayList (java.util.ArrayList)2 IExtendedBlockState (net.minecraftforge.common.property.IExtendedBlockState)2