Search in sources :

Example 11 with Matrix4

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

the class ConveyorVertical method modifyQuads.

@Override
@SideOnly(Side.CLIENT)
public List<BakedQuad> modifyQuads(List<BakedQuad> baseModel, @Nullable TileEntity tile, EnumFacing facing) {
    if (tile != null && this.renderBottomBelt(tile, facing)) {
        TextureAtlasSprite sprite = ClientUtils.getSprite(isActive(tile) ? ConveyorBasic.texture_on : ConveyorBasic.texture_off);
        TextureAtlasSprite spriteColour = ClientUtils.getSprite(getColouredStripesTexture());
        boolean[] walls = { super.renderWall(tile, facing, 0), super.renderWall(tile, facing, 1) };
        baseModel.addAll(ModelConveyor.getBaseConveyor(facing, .875f, new Matrix4(facing), ConveyorDirection.HORIZONTAL, sprite, walls, new boolean[] { true, false }, spriteColour, getDyeColour()));
    }
    return baseModel;
}
Also used : TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) Matrix4(blusunrize.immersiveengineering.common.util.chickenbones.Matrix4) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 12 with Matrix4

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

the class ConveyorSplit method modifyQuads.

@Override
@SideOnly(Side.CLIENT)
public List<BakedQuad> modifyQuads(List<BakedQuad> baseModel, @Nullable TileEntity tile, EnumFacing facing) {
    TextureAtlasSprite tex_casing0 = ClientUtils.getSprite(texture_casing);
    Matrix4 matrix = new Matrix4(facing);
    float[] colour = { 1, 1, 1, 1 };
    Vector3f[] vertices = { new Vector3f(.0625f, .1875f, 0), new Vector3f(.0625f, .1875f, 1), new Vector3f(.9375f, .1875f, 1), new Vector3f(.9375f, .1875f, 0) };
    baseModel.add(ClientUtils.createBakedQuad(DefaultVertexFormats.ITEM, ClientUtils.applyMatrixToVertices(matrix, vertices), EnumFacing.UP, tex_casing0, new double[] { 1, 16, 15, 0 }, colour, false));
    vertices = new Vector3f[] { new Vector3f(.0625f, 0, 0), new Vector3f(.0625f, .1875f, 0), new Vector3f(.9375f, .1875f, 0), new Vector3f(.9375f, 0, 0) };
    baseModel.set(15, ClientUtils.createBakedQuad(DefaultVertexFormats.ITEM, ClientUtils.applyMatrixToVertices(matrix, vertices), facing, ClientUtils.getSprite(ModelConveyor.rl_casing[1]), new double[] { 1, 16, 15, 13 }, colour, false));
    vertices = new Vector3f[] { new Vector3f(.0625f, .125f, 0), new Vector3f(.0625f, .1875f, 0), new Vector3f(.9375f, .1875f, 0), new Vector3f(.9375f, .125f, 0) };
    Vector3f[] vertices2 = new Vector3f[] { new Vector3f(.5f, .125f, 0), new Vector3f(.5f, .125f, .5f), new Vector3f(.5f, .1875f, .5f), new Vector3f(.5f, .1875f, 0) };
    Vector3f[] vertices3 = new Vector3f[] { new Vector3f(.5f, .125f, 0), new Vector3f(.5f, .125f, .5f), new Vector3f(.5f, .1875f, .5f), new Vector3f(.5f, .1875f, 0) };
    for (int i = 0; i < 8; i++) {
        for (int iv = 0; iv < vertices.length; iv++) {
            vertices[iv].setZ((i + 1) * .0625f);
            vertices2[iv].setX(vertices2[iv].getX() + .0625f);
            vertices3[iv].setX(vertices3[iv].getX() - .0625f);
        }
        double v = 16 - i;
        baseModel.add(ClientUtils.createBakedQuad(DefaultVertexFormats.ITEM, ClientUtils.applyMatrixToVertices(matrix, vertices), facing, tex_casing0, new double[] { 1, v - 1, 15, v }, colour, true));
        if (i < 7) {
            double u = 8 - i;
            baseModel.add(ClientUtils.createBakedQuad(DefaultVertexFormats.ITEM, ClientUtils.applyMatrixToVertices(matrix, vertices2), facing, tex_casing0, new double[] { u - 1, 16, u, 8 }, colour, true));
            baseModel.add(ClientUtils.createBakedQuad(DefaultVertexFormats.ITEM, ClientUtils.applyMatrixToVertices(matrix, vertices3), facing, tex_casing0, new double[] { u - 1, 16, u, 8 }, colour, false));
        }
    }
    return baseModel;
}
Also used : TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) Vector3f(org.lwjgl.util.vector.Vector3f) Matrix4(blusunrize.immersiveengineering.common.util.chickenbones.Matrix4) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 13 with Matrix4

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

the class TileEntityRedstoneBreaker method getRaytraceOffset.

@Override
public Vec3d getRaytraceOffset(IImmersiveConnectable link) {
    Matrix4 mat = new Matrix4(facing);
    mat.translate(.5, .5, 0).rotate(Math.PI / 2 * rotation, 0, 0, 1).translate(-.5, -.5, 0);
    Vec3d ret = mat.apply(new Vec3d(.5, .5, .99));
    return ret;
}
Also used : Matrix4(blusunrize.immersiveengineering.common.util.chickenbones.Matrix4) Vec3d(net.minecraft.util.math.Vec3d)

Example 14 with Matrix4

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

the class TileEntityRedstoneBreaker method getConnectionOffset.

@Override
public Vec3d getConnectionOffset(Connection con) {
    Matrix4 mat = new Matrix4(facing);
    mat.translate(.5, .5, 0).rotate(Math.PI / 2 * rotation, 0, 0, 1).translate(-.5, -.5, 0);
    if (endOfLeftConnection == null)
        calculateLeftConn(mat);
    boolean isLeft = con.end.equals(endOfLeftConnection) || con.start.equals(endOfLeftConnection);
    Vec3d ret = mat.apply(isLeft ? new Vec3d(.125, .5, 1.03125) : new Vec3d(.875, .5, 1.03125));
    return ret;
}
Also used : Matrix4(blusunrize.immersiveengineering.common.util.chickenbones.Matrix4) Vec3d(net.minecraft.util.math.Vec3d)

Example 15 with Matrix4

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

the class TileEntityRedstoneBreaker method getBlockBounds.

@Override
public float[] getBlockBounds() {
    Vec3d start = new Vec3d(0, .125f, 0);
    Vec3d end = new Vec3d(1, .875f, 1);
    Matrix4 mat = new Matrix4(facing);
    mat.translate(.5, .5, 0).rotate(Math.PI / 2 * rotation, 0, 0, 1).translate(-.5, -.5, 0);
    start = mat.apply(start);
    end = mat.apply(end);
    return new float[] { (float) start.xCoord, (float) start.yCoord, (float) start.zCoord, (float) end.xCoord, (float) end.yCoord, (float) end.zCoord };
}
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