Java Code Examples for codechicken.lib.vec.Matrix4#rotate()

The following examples show how to use codechicken.lib.vec.Matrix4#rotate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetaTileEntityQuantumTank.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {
    Textures.VOLTAGE_CASINGS[tier].render(renderState, translation, ArrayUtils.add(pipeline,
        new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))));
    translation.translate(0.5, 0.001, 0.5);
    translation.rotate(Math.toRadians(rotations[getFrontFacing().getIndex() - 2]), new Vector3(0.0, 1.0, 0.0));
    translation.translate(-0.5, 0.0, -0.5);
    Textures.SCREEN.renderSided(EnumFacing.UP, renderState, translation, pipeline);
}
 
Example 2
Source File: MetaTileEntityQuantumChest.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {
    Textures.VOLTAGE_CASINGS[tier].render(renderState, translation, ArrayUtils.add(pipeline,
        new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))));
    translation.translate(0.5, 0.001, 0.5);
    translation.rotate(Math.toRadians(rotations[getFrontFacing().getIndex() - 2]), new Vector3(0.0, 1.0, 0.0));
    translation.translate(-0.5, 0.0, -0.5);
    Textures.SCREEN.renderSided(EnumFacing.UP, renderState, translation, pipeline);
}
 
Example 3
Source File: TileEntityCrusherBladeRenderer.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void draw(TileEntityCrusherBlade tileEntity, CCRenderState renderState, Matrix4 translation, float partialTicks) {
    translation.translate(0.5, 0.5, 0.5);

    IBlockState blockState = tileEntity.getBlockState();
    switch (blockState.getValue(BlockCrusherBlade.AXIS)) {
        case Y:
            break;
        case X:
            translation.rotate(Math.toRadians(90.0), Rotation.axes[3]);
            break;
        case Z:
            translation.rotate(Math.toRadians(90.0), Rotation.axes[5]);
            break;
    }

    if (blockState.getValue(BlockCrusherBlade.ACTIVE)) {
        long currentWorldTime = tileEntity.hasWorld() ? tileEntity.getWorld().getTotalWorldTime() : 0;
        translation.rotate(Math.toRadians(currentWorldTime * 12.0 % 180), Rotation.axes[1]);
    }

    translation.translate(-0.5, -0.5, -0.5);

    TextureAtlasSprite ironBlockTexture = TextureUtils.getBlockTexture("iron_block");
    IVertexOperation[] operations = {};

    for (Cuboid6 cuboid6 : BlockCrusherBlade.basicModel) {
        for (EnumFacing renderSide : EnumFacing.VALUES) {
            Textures.renderFace(renderState, translation, operations, renderSide, cuboid6, ironBlockTexture);
        }
    }
}
 
Example 4
Source File: TankLayerRenderer.java    From EnderStorage with MIT License 5 votes vote down vote up
@Override
public void render(MatrixStack mStack, IRenderTypeBuffer getter, int packedLight, AbstractClientPlayerEntity entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
    if (UUIDS.contains(entity.getUniqueID())) {
        CCRenderState ccrs = CCRenderState.instance();
        ccrs.brightness = packedLight;
        ccrs.overlay = OverlayTexture.NO_OVERLAY;
        Matrix4 mat = new Matrix4(mStack);
        mat.rotate(MathHelper.torad * 180, Vector3.X_POS);
        mat.scale(0.5);
        if (entity.isShiftKeyDown()) {
            mat.translate(0, -0.5, 0);
        }
        if (entity.isElytraFlying()) {
            headPitch = -45;
        }
        mat.rotate(netHeadYaw * MathHelper.torad, Vector3.Y_NEG);
        mat.rotate(headPitch * MathHelper.torad, Vector3.X_POS);
        mat.translate(-0.5, 1, -0.5);
        RenderTileEnderTank.renderTank(ccrs, mat, getter, 0, (float) (MathHelper.torad * 90F), 0, BLANK, 0);

        FluidStack stack = FluidUtils.water.copy();
        float bob = 0.45F + RenderUtils.getPearlBob(ClientUtils.getRenderTime()) * 2;
        stack.setAmount((int) MathHelper.map(bob, 0.2, 0.6, 1000, 14000));
        mat.translate(-0.5, 0, -0.5);
        RenderTileEnderTank.renderFluid(ccrs, mat, getter, stack);

    }
}