Search in sources :

Example 6 with Matrix4

use of blusunrize.immersiveengineering.common.util.chickenbones.Matrix4 in project ImmersiveEngineering by BluSunrize.

the class TileEntityFluidPipe method getOBJState.

@Override
public OBJState getOBJState() {
    byte connections = getConnectionByte();
    String key = getRenderCacheKey();
    if (!cachedOBJStates.containsKey(key)) {
        ArrayList<String> parts = new ArrayList();
        //new Matrix4();
        Matrix4 rotationMatrix = new Matrix4(TRSRTransformation.identity().getMatrix());
        //			if(pipeCover!=null)
        //				parts.add("cover");
        int totalConnections = Integer.bitCount(connections);
        boolean straightY = (connections & 3) == 3;
        boolean straightZ = (connections & 12) == 12;
        boolean straightX = (connections & 48) == 48;
        switch(totalConnections) {
            case //stub
            0:
                parts.add("center");
                break;
            case //stopper
            1:
                parts.add("stopper");
                //default: y-
                if (//y+
                (connections & 2) != 0)
                    rotationMatrix.rotate(Math.PI, 0, 0, 1);
                else if (//z-
                (connections & 4) != 0)
                    rotationMatrix.rotate(Math.PI / 2, 1, 0, 0);
                else if (//z+
                (connections & 8) != 0)
                    rotationMatrix.rotate(-Math.PI / 2, 1, 0, 0);
                else if (//x-
                (connections & 16) != 0)
                    rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                else if (//x+
                (connections & 32) != 0)
                    rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                parts.add("con_yMin");
                break;
            case //straight or curve
            2:
                if (straightY) {
                    parts.add("pipe_y");
                    if (getConnectionStyle(0) == 1)
                        parts.add("con_yMin");
                    if (getConnectionStyle(1) == 1)
                        parts.add("con_yMax");
                } else if (straightZ) {
                    parts.add("pipe_z");
                    if (getConnectionStyle(2) == 1)
                        parts.add("con_zMin");
                    if (getConnectionStyle(3) == 1)
                        parts.add("con_zMax");
                } else if (straightX) {
                    parts.add("pipe_x");
                    if (getConnectionStyle(4) == 1)
                        parts.add("con_xMin");
                    if (getConnectionStyle(5) == 1)
                        parts.add("con_xMax");
                } else {
                    parts.add("curve");
                    parts.add("con_yMin");
                    parts.add("con_zMin");
                    byte connectTo = (byte) (connections & 60);
                    if (//curve to top or bottom
                    (connections & 3) != 0) {
                        if (//x-
                        connectTo == 16)
                            rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                        else if (//x+
                        connectTo == 32)
                            rotationMatrix.rotate(-Math.PI / 2, 0, 1, 0);
                        else if (//z+
                        connectTo == 8)
                            rotationMatrix.rotate(Math.PI, 0, 1, 0);
                        if (//flip to top
                        (connections & 2) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 0, 1);
                    //default: Curve to z-
                    } else //curve to horizontal
                    {
                        rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                        if (//z+ to x+
                        connectTo == 40)
                            rotationMatrix.rotate(Math.PI, 1, 0, 0);
                        else if (//z+ to x-
                        connectTo == 24)
                            rotationMatrix.rotate(-Math.PI / 2, 1, 0, 0);
                        else if (//z- to x+
                        connectTo == 36)
                            rotationMatrix.rotate(Math.PI / 2, 1, 0, 0);
                    //default: z- to x-
                    }
                }
                break;
            case //tcross or tcurve
            3:
                if (//has straight connect
                straightX || straightZ || straightY) {
                    parts.add("tcross");
                    parts.add("con_yMin");
                    parts.add("con_zMin");
                    parts.add("con_zMax");
                    if (straightX) {
                        rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                        if (//z-
                        (connections & 4) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                        else if (//z+
                        (connections & 8) != 0)
                            rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                        else if (//y+
                        (connections & 2) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 0, 1);
                    //default: Curve to y-
                    } else if (straightY) {
                        rotationMatrix.rotate(Math.PI / 2, 1, 0, 0);
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                        else if (//x+
                        (connections & 32) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                        else if (//z+
                        (connections & 8) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 0, 1);
                    //default: Curve to z-
                    } else //default:z straight
                    {
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                        else if (//x+
                        (connections & 32) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                        else if (//y+
                        (connections & 2) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 0, 1);
                    //default: Curve to y-
                    }
                } else //tcurve
                {
                    parts.add("tcurve");
                    parts.add("con_yMin");
                    parts.add("con_zMin");
                    parts.add("con_xMax");
                    //default y-, z-, x+
                    if (//z+
                    (connections & 8) != 0) {
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 1, 0);
                        else
                            rotationMatrix.rotate(-Math.PI / 2, 0, 1, 0);
                    } else //z-
                    {
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                    }
                    if (//y+
                    (connections & 2) != 0)
                        rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                }
                break;
            case //cross or complex tcross
            4:
                boolean cross = (straightX && straightZ) || (straightX && straightY) || (straightZ && straightY);
                if (cross) {
                    parts.add("cross");
                    parts.add("con_yMin");
                    parts.add("con_yMax");
                    parts.add("con_zMin");
                    parts.add("con_zMax");
                    if (//x and z
                    !straightY)
                        rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                    else if (//x and y
                    straightX)
                        rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                } else {
                    parts.add("tcross2");
                    parts.add("con_yMin");
                    parts.add("con_zMin");
                    parts.add("con_zMax");
                    parts.add("con_xMax");
                    if (straightZ) {
                        //default y- z+- x+
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 1, 0);
                        if (//y+
                        (connections & 2) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                    } else if (straightY) {
                        rotationMatrix.rotate(Math.PI / 2, 1, 0, 0);
                        //default y+- z- x+
                        if (//z+
                        (connections & 8) != 0) {
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                            if (//x-
                            (connections & 16) != 0)
                                rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                        } else if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                    } else {
                        rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                        //default y- z- x+-
                        if (//z+
                        (connections & 8) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 1, 0);
                        if (//y+
                        (connections & 2) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                    }
                }
                break;
            case //complete tcross
            5:
                parts.add("tcross3");
                parts.add("con_yMin");
                parts.add("con_yMax");
                parts.add("con_zMin");
                parts.add("con_zMax");
                parts.add("con_xMax");
                //default y+- z+- x+
                if (straightZ) {
                    if (straightY) {
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 1, 0);
                    } else if (straightX)
                        rotationMatrix.rotate(((connections & 2) != 0) ? (Math.PI / 2) : (-Math.PI / 2), 0, 0, 1);
                } else if (straightX) {
                    rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                    if (//z+
                    (connections & 8) != 0)
                        rotationMatrix.rotate(Math.PI, 0, 1, 0);
                }
                break;
            case //Full Crossing
            6:
                parts.add("con_yMin");
                parts.add("con_yMax");
                parts.add("con_zMin");
                parts.add("con_zMax");
                parts.add("con_xMin");
                parts.add("con_xMax");
                break;
        }
        //			connetionParts
        //			for(int i=0; i<6; i++)
        //				if(((TileEntityFluidPipe)tile).getConnectionStyle(i)==1)
        //					connectionCaps.add(CONNECTIONS[i]);
        Matrix4 tempMatr = new Matrix4();
        tempMatr.m03 = tempMatr.m13 = tempMatr.m23 = .5f;
        rotationMatrix.leftMultiply(tempMatr);
        tempMatr.invert();
        rotationMatrix = rotationMatrix.multiply(tempMatr);
        cachedOBJStates.put(key, new OBJState(parts, true, new TRSRTransformation(rotationMatrix.toMatrix4f())));
    }
    return cachedOBJStates.get(key);
}
Also used : TRSRTransformation(net.minecraftforge.common.model.TRSRTransformation) OBJState(net.minecraftforge.client.model.obj.OBJModel.OBJState) Matrix4(blusunrize.immersiveengineering.common.util.chickenbones.Matrix4)

Example 7 with Matrix4

use of blusunrize.immersiveengineering.common.util.chickenbones.Matrix4 in project ImmersiveEngineering by BluSunrize.

the class ItemDrill method applyTransformations.

@SideOnly(Side.CLIENT)
@Override
public Optional<TRSRTransformation> applyTransformations(ItemStack stack, String group, Optional<TRSRTransformation> transform) {
    if (transform.isPresent()) {
        NBTTagCompound upgrades = this.getUpgrades(stack);
        if (group.equals("drill_head") && upgrades.getInteger("damage") <= 0) {
            Matrix4 mat = new Matrix4(transform.get().getMatrix());
            mat.translate(-.25f, 0, 0);
            return Optional.of(new TRSRTransformation(mat.toMatrix4f()));
        }
        if (group.equals("upgrade_damage1") || group.equals("upgrade_damage2") || group.equals("upgrade_damage3") || group.equals("upgrade_damage4")) {
            Matrix4 mat = new Matrix4(transform.get().getMatrix());
            mat.translate(.441f, 0, 0);
            return Optional.of(new TRSRTransformation(mat.toMatrix4f()));
        }
    }
    return transform;
}
Also used : TRSRTransformation(net.minecraftforge.common.model.TRSRTransformation) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Matrix4(blusunrize.immersiveengineering.common.util.chickenbones.Matrix4) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 8 with Matrix4

use of blusunrize.immersiveengineering.common.util.chickenbones.Matrix4 in project ImmersiveEngineering by BluSunrize.

the class ModelConveyor method getQuads.

@Override
public List<BakedQuad> getQuads(@Nullable IBlockState blockState, @Nullable EnumFacing side, long rand) {
    TileEntity tile = null;
    String key = "default";
    EnumFacing facing = EnumFacing.NORTH;
    if (blockState == null)
        key = conveyor != null ? ConveyorHandler.reverseClassRegistry.get(conveyor.getClass()).toString() : "immersiveengineering:conveyor";
    else {
        facing = blockState.getValue(IEProperties.FACING_ALL);
        if (blockState instanceof IExtendedBlockState) {
            IExtendedBlockState exState = (IExtendedBlockState) blockState;
            if (exState.getUnlistedNames().contains(BlockConveyor.ICONEYOR_PASSTHROUGH))
                conveyor = ((IExtendedBlockState) blockState).getValue(BlockConveyor.ICONEYOR_PASSTHROUGH);
            if (exState.getUnlistedNames().contains(IEProperties.TILEENTITY_PASSTHROUGH))
                tile = ((IExtendedBlockState) blockState).getValue(IEProperties.TILEENTITY_PASSTHROUGH);
            if (conveyor != null && tile != null)
                key = conveyor.getModelCacheKey(tile, facing);
        }
    }
    List<BakedQuad> cachedQuads = modelCache.get(key);
    if (cachedQuads != null)
        return Collections.synchronizedList(Lists.newArrayList(cachedQuads));
    else {
        cachedQuads = Collections.synchronizedList(Lists.newArrayList());
        Matrix4f facingMatrix = TRSRTransformation.getMatrix(facing);
        if (conveyor != null)
            facingMatrix = conveyor.modifyBaseRotationMatrix(facingMatrix, tile, facing);
        Matrix4 matrix = new Matrix4(facingMatrix);
        ConveyorDirection conDir = conveyor != null ? conveyor.getConveyorDirection() : ConveyorDirection.HORIZONTAL;
        boolean[] walls = conveyor != null && tile != null ? new boolean[] { conveyor.renderWall(tile, facing, 0), conveyor.renderWall(tile, facing, 1) } : new boolean[] { true, true };
        TextureAtlasSprite tex_conveyor = ClientUtils.mc().getTextureMapBlocks().getMissingSprite();
        TextureAtlasSprite tex_conveyor_colour = null;
        int colourStripes = -1;
        if (conveyor != null) {
            tex_conveyor = ClientUtils.getSprite(tile != null ? (conveyor.isActive(tile) ? conveyor.getActiveTexture() : conveyor.getInactiveTexture()) : conveyor.getActiveTexture());
            if ((colourStripes = conveyor.getDyeColour()) >= 0)
                tex_conveyor_colour = ClientUtils.getSprite(conveyor.getColouredStripesTexture());
        }
        cachedQuads.addAll(getBaseConveyor(facing, 1, matrix, conDir, tex_conveyor, walls, new boolean[] { true, true }, tex_conveyor_colour, colourStripes));
        if (conveyor != null)
            cachedQuads = conveyor.modifyQuads(cachedQuads, tile, facing);
        modelCache.put(key, cachedQuads);
        return Collections.synchronizedList(Lists.newArrayList(cachedQuads));
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) BakedQuad(net.minecraft.client.renderer.block.model.BakedQuad) Matrix4f(javax.vecmath.Matrix4f) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) EnumFacing(net.minecraft.util.EnumFacing) ConveyorDirection(blusunrize.immersiveengineering.api.tool.ConveyorHandler.ConveyorDirection) Matrix4(blusunrize.immersiveengineering.common.util.chickenbones.Matrix4)

Example 9 with Matrix4

use of blusunrize.immersiveengineering.common.util.chickenbones.Matrix4 in project ImmersiveEngineering by BluSunrize.

the class ClientUtils method createBakedBox.

public static Set<BakedQuad> createBakedBox(Vector3f from, Vector3f to, Matrix4 matrix, EnumFacing facing, Function<Vector3f[], Vector3f[]> vertexTransformer, Function<EnumFacing, TextureAtlasSprite> textureGetter, float[] colour) {
    HashSet quads = new HashSet();
    if (vertexTransformer == null)
        vertexTransformer = v -> v;
    Vector3f[] vertices = { new Vector3f(from.x, from.y, from.z), new Vector3f(from.x, from.y, to.z), new Vector3f(to.x, from.y, to.z), new Vector3f(to.x, from.y, from.z) };
    TextureAtlasSprite sprite = textureGetter.apply(EnumFacing.DOWN);
    if (sprite != null)
        quads.add(ClientUtils.createBakedQuad(DefaultVertexFormats.ITEM, ClientUtils.applyMatrixToVertices(matrix, vertexTransformer.apply(vertices)), Utils.rotateFacingTowardsDir(EnumFacing.DOWN, facing), sprite, new double[] { from.x * 16, 16 - from.z * 16, to.x * 16, 16 - to.z * 16 }, colour, true));
    for (Vector3f v : vertices) v.setY(to.y);
    sprite = textureGetter.apply(EnumFacing.UP);
    if (sprite != null)
        quads.add(ClientUtils.createBakedQuad(DefaultVertexFormats.ITEM, ClientUtils.applyMatrixToVertices(matrix, vertexTransformer.apply(vertices)), Utils.rotateFacingTowardsDir(EnumFacing.UP, facing), sprite, new double[] { from.x * 16, from.z * 16, to.x * 16, to.z * 16 }, colour, false));
    vertices = new Vector3f[] { new Vector3f(to.x, to.y, from.z), new Vector3f(to.x, from.y, from.z), new Vector3f(from.x, from.y, from.z), new Vector3f(from.x, to.y, from.z) };
    sprite = textureGetter.apply(EnumFacing.NORTH);
    if (sprite != null)
        quads.add(ClientUtils.createBakedQuad(DefaultVertexFormats.ITEM, ClientUtils.applyMatrixToVertices(matrix, vertexTransformer.apply(vertices)), Utils.rotateFacingTowardsDir(EnumFacing.NORTH, facing), sprite, new double[] { from.x * 16, 16 - to.y * 16, to.x * 16, 16 - from.y * 16 }, colour, false));
    for (Vector3f v : vertices) v.setZ(to.z);
    sprite = textureGetter.apply(EnumFacing.SOUTH);
    if (sprite != null)
        quads.add(ClientUtils.createBakedQuad(DefaultVertexFormats.ITEM, ClientUtils.applyMatrixToVertices(matrix, vertexTransformer.apply(vertices)), Utils.rotateFacingTowardsDir(EnumFacing.SOUTH, facing), sprite, new double[] { to.x * 16, 16 - to.y * 16, from.x * 16, 16 - from.y * 16 }, colour, true));
    vertices = new Vector3f[] { new Vector3f(from.x, to.y, to.z), new Vector3f(from.x, from.y, to.z), new Vector3f(from.x, from.y, from.z), new Vector3f(from.x, to.y, from.z) };
    sprite = textureGetter.apply(EnumFacing.WEST);
    if (sprite != null)
        quads.add(ClientUtils.createBakedQuad(DefaultVertexFormats.ITEM, ClientUtils.applyMatrixToVertices(matrix, vertexTransformer.apply(vertices)), Utils.rotateFacingTowardsDir(EnumFacing.WEST, facing), sprite, new double[] { to.z * 16, 16 - to.y * 16, from.z * 16, 16 - from.y * 16 }, colour, true));
    for (Vector3f v : vertices) v.setX(to.x);
    sprite = textureGetter.apply(EnumFacing.EAST);
    if (sprite != null)
        quads.add(ClientUtils.createBakedQuad(DefaultVertexFormats.ITEM, ClientUtils.applyMatrixToVertices(matrix, vertexTransformer.apply(vertices)), Utils.rotateFacingTowardsDir(EnumFacing.EAST, facing), sprite, new double[] { from.z * 16, 16 - to.y * 16, to.z * 16, 16 - from.y * 16 }, colour, false));
    return quads;
}
Also used : net.minecraft.util(net.minecraft.util) Normal(net.minecraftforge.client.model.obj.OBJModel.Normal) ModelBox(net.minecraft.client.model.ModelBox) AttenuationType(net.minecraft.client.audio.ISound.AttenuationType) FluidRegistry(net.minecraftforge.fluids.FluidRegistry) ModelRenderer(net.minecraft.client.model.ModelRenderer) I18n(net.minecraft.client.resources.I18n) Vec3i(net.minecraft.util.math.Vec3i) Vec3d(net.minecraft.util.math.Vec3d) Lib(blusunrize.immersiveengineering.api.Lib) GL11(org.lwjgl.opengl.GL11) IEProperties(blusunrize.immersiveengineering.api.IEProperties) VertexFormat(net.minecraft.client.renderer.vertex.VertexFormat) BakedQuad(net.minecraft.client.renderer.block.model.BakedQuad) Quat4d(javax.vecmath.Quat4d) Vector3f(org.lwjgl.util.vector.Vector3f) FluidStack(net.minecraftforge.fluids.FluidStack) IFluidTank(net.minecraftforge.fluids.IFluidTank) net.minecraft.client.renderer(net.minecraft.client.renderer) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) java.util(java.util) Connection(blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.Connection) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) SmartLightingQuad(blusunrize.immersiveengineering.client.models.SmartLightingQuad) Function(java.util.function.Function) DefaultVertexFormats(net.minecraft.client.renderer.vertex.DefaultVertexFormats) ItemStack(net.minecraft.item.ItemStack) IEFluid(blusunrize.immersiveengineering.common.util.IEFluid) net.minecraft.block(net.minecraft.block) Minecraft(net.minecraft.client.Minecraft) Nonnull(javax.annotation.Nonnull) IImmersiveConnectable(blusunrize.immersiveengineering.api.energy.wires.IImmersiveConnectable) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) Entity(net.minecraft.entity.Entity) Utils(blusunrize.immersiveengineering.common.util.Utils) World(net.minecraft.world.World) TextFormatting(net.minecraft.util.text.TextFormatting) TextureMap(net.minecraft.client.renderer.texture.TextureMap) Timer(net.minecraft.util.Timer) BlockPos(net.minecraft.util.math.BlockPos) TextureManager(net.minecraft.client.renderer.texture.TextureManager) ModelBase(net.minecraft.client.model.ModelBase) IETileSound(blusunrize.immersiveengineering.common.util.sound.IETileSound) IBlockState(net.minecraft.block.state.IBlockState) GuiScreen(net.minecraft.client.gui.GuiScreen) FontRenderer(net.minecraft.client.gui.FontRenderer) UnpackedBakedQuad(net.minecraftforge.client.model.pipeline.UnpackedBakedQuad) Matrix4(blusunrize.immersiveengineering.common.util.chickenbones.Matrix4) Material(net.minecraft.block.material.Material) TileEntity(net.minecraft.tileentity.TileEntity) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) Vector3f(org.lwjgl.util.vector.Vector3f)

Example 10 with Matrix4

use of blusunrize.immersiveengineering.common.util.chickenbones.Matrix4 in project ImmersiveEngineering by BluSunrize.

the class ClientEventHandler method drawBlockOverlayArrow.

public static void drawBlockOverlayArrow(Tessellator tessellator, VertexBuffer vertexbuffer, Vec3d directionVec, EnumFacing side, AxisAlignedBB targetedBB) {
    Vec3d[] translatedPositions = new Vec3d[arrowCoords.length];
    Matrix4 mat = new Matrix4();
    Vec3d defaultDir = side.getAxis() == Axis.Y ? new Vec3d(0, 0, 1) : new Vec3d(0, 1, 0);
    directionVec = directionVec.normalize();
    double angle = Math.acos(defaultDir.dotProduct(directionVec));
    Vec3d axis = defaultDir.crossProduct(directionVec);
    mat.rotate(angle, axis.xCoord, axis.yCoord, axis.zCoord);
    if (side != null) {
        if (side.getAxis() == Axis.Z)
            mat.rotate(Math.PI / 2, 1, 0, 0).rotate(Math.PI, 0, 1, 0);
        else if (side.getAxis() == Axis.X)
            mat.rotate(Math.PI / 2, 0, 0, 1).rotate(Math.PI / 2, 0, 1, 0);
    }
    for (int i = 0; i < translatedPositions.length; i++) {
        Vec3d vec = mat.apply(new Vec3d(arrowCoords[i][0], 0, arrowCoords[i][1])).addVector(.5, .5, .5);
        if (side != null && targetedBB != null)
            vec = new Vec3d(side == EnumFacing.WEST ? targetedBB.minX - .002 : side == EnumFacing.EAST ? targetedBB.maxX + .002 : vec.xCoord, side == EnumFacing.DOWN ? targetedBB.minY - .002 : side == EnumFacing.UP ? targetedBB.maxY + .002 : vec.yCoord, side == EnumFacing.NORTH ? targetedBB.minZ - .002 : side == EnumFacing.SOUTH ? targetedBB.maxZ + .002 : vec.zCoord);
        translatedPositions[i] = vec;
    }
    vertexbuffer.begin(6, DefaultVertexFormats.POSITION_COLOR);
    for (Vec3d point : translatedPositions) vertexbuffer.pos(point.xCoord, point.yCoord, point.zCoord).color(Lib.COLOUR_F_ImmersiveOrange[0], Lib.COLOUR_F_ImmersiveOrange[1], Lib.COLOUR_F_ImmersiveOrange[2], 0.4F).endVertex();
    tessellator.draw();
    vertexbuffer.begin(2, DefaultVertexFormats.POSITION_COLOR);
    for (Vec3d point : translatedPositions) vertexbuffer.pos(point.xCoord, point.yCoord, point.zCoord).color(0, 0, 0, 0.4F).endVertex();
    tessellator.draw();
}
Also used : Vec3d(net.minecraft.util.math.Vec3d) Matrix4(blusunrize.immersiveengineering.common.util.chickenbones.Matrix4)

Aggregations

Matrix4 (blusunrize.immersiveengineering.common.util.chickenbones.Matrix4)19 Vec3d (net.minecraft.util.math.Vec3d)8 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)5 TRSRTransformation (net.minecraftforge.common.model.TRSRTransformation)5 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)4 TileEntity (net.minecraft.tileentity.TileEntity)4 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)4 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)3 Vector3f (org.lwjgl.util.vector.Vector3f)3 ConveyorDirection (blusunrize.immersiveengineering.api.tool.ConveyorHandler.ConveyorDirection)2 Utils (blusunrize.immersiveengineering.common.util.Utils)2 ArrayList (java.util.ArrayList)2 Function (java.util.function.Function)2 IBlockState (net.minecraft.block.state.IBlockState)2 Minecraft (net.minecraft.client.Minecraft)2 ItemStack (net.minecraft.item.ItemStack)2 BlockPos (net.minecraft.util.math.BlockPos)2 OBJState (net.minecraftforge.client.model.obj.OBJModel.OBJState)2 IExtendedBlockState (net.minecraftforge.common.property.IExtendedBlockState)2 IEProperties (blusunrize.immersiveengineering.api.IEProperties)1