Java Code Examples for net.minecraft.client.renderer.RenderType#State

The following examples show how to use net.minecraft.client.renderer.RenderType#State . 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: RenderCustomEndPortal.java    From EnderStorage with MIT License 6 votes vote down vote up
public void render(Matrix4 mat, IRenderTypeBuffer getter, double yToCamera) {
    Vec3d projectedView = TileEntityRendererDispatcher.instance.renderInfo.getProjectedView();
    mat = mat.copy();//Defensive copy, prevent external modifications.
    randy.setSeed(31100L);
    for (int i = 0; i < 16; i++) {
        RenderType.State state = RENDER_STATES.get(i);
        EndPortalRenderType renderType = new EndPortalRenderType(i, yToCamera, projectedView, mat, state);
        IVertexBuilder builder = getter.getBuffer(renderType);
        float r = (randy.nextFloat() * 0.5F + 0.1F) * renderType.f7;
        float g = (randy.nextFloat() * 0.5F + 0.4F) * renderType.f7;
        float b = (randy.nextFloat() * 0.5F + 0.5F) * renderType.f7;
        if (i == 0) {
            r = g = b = 1.0F * renderType.f7;
        }
        builder.pos(surfaceX1, surfaceY, surfaceZ1).color(r, g, b, 1.0F).endVertex();
        builder.pos(surfaceX1, surfaceY, surfaceZ2).color(r, g, b, 1.0F).endVertex();
        builder.pos(surfaceX2, surfaceY, surfaceZ2).color(r, g, b, 1.0F).endVertex();
        builder.pos(surfaceX2, surfaceY, surfaceZ1).color(r, g, b, 1.0F).endVertex();
    }
}
 
Example 2
Source File: RenderCustomEndPortal.java    From EnderStorage with MIT License 5 votes vote down vote up
public EndPortalRenderType(int idx, double posY, Vec3d projectedView, Matrix4 mat, RenderType.State state) {
    super("enderstorage:end_portal", DefaultVertexFormats.POSITION_COLOR, GL11.GL_QUADS, 256, false, true, null, null);
    this.idx = idx;
    this.projectedView = projectedView;
    this.mat = mat;
    this.state = state;
    f5 = idx == 0 ? 65F : 16 - idx;
    f6 = idx == 0 ? 0.125F : (idx == 1 ? 0.5F : 0.0625F);
    f7 = idx == 0 ? 0.1F : 1.0F / (16 - idx + 1.0F);
    f8 = (float) (-(posY + surfaceY));
    f9 = (float) (f8 + projectedView.y);
    f10 = (float) (f8 + f5 + projectedView.y);
    f11 = (float) (posY + surfaceY) + (f9 / f10);
}
 
Example 3
Source File: CCModelLibrary.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static RenderType.State makeIcosState(ResourceLocation texture, boolean lighting) {
    return RenderType.State.getBuilder()//
            .texture(new RenderState.TextureState(texture, false, false))//
            .texturing(new RenderState.TexturingState("icosahedron", () -> {
                if (!lighting) {
                    RenderSystem.disableLighting();
                }
            }, () -> {
            }))//
            .transparency(NO_TRANSPARENCY)//
            .diffuseLighting(DIFFUSE_LIGHTING_ENABLED)//
            .lightmap(LIGHTMAP_ENABLED)//
            .build(false);
}