Search in sources :

Example 46 with Tessellator

use of net.minecraft.client.render.Tessellator in project BleachHack by BleachDrinker420.

the class Window method horizontalGradient.

public static void horizontalGradient(MatrixStack matrices, int x1, int y1, int x2, int y2, int color1, int color2) {
    float alpha1 = (color1 >> 24 & 255) / 255.0F;
    float red1 = (color1 >> 16 & 255) / 255.0F;
    float green1 = (color1 >> 8 & 255) / 255.0F;
    float blue1 = (color1 & 255) / 255.0F;
    float alpha2 = (color2 >> 24 & 255) / 255.0F;
    float red2 = (color2 >> 16 & 255) / 255.0F;
    float green2 = (color2 >> 8 & 255) / 255.0F;
    float blue2 = (color2 & 255) / 255.0F;
    RenderSystem.disableTexture();
    RenderSystem.enableBlend();
    RenderSystem.defaultBlendFunc();
    RenderSystem.setShader(GameRenderer::getPositionColorShader);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferBuilder = tessellator.getBuffer();
    bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
    bufferBuilder.vertex(x1, y1, 0).color(red1, green1, blue1, alpha1).next();
    bufferBuilder.vertex(x1, y2, 0).color(red1, green1, blue1, alpha1).next();
    bufferBuilder.vertex(x2, y2, 0).color(red2, green2, blue2, alpha2).next();
    bufferBuilder.vertex(x2, y1, 0).color(red2, green2, blue2, alpha2).next();
    tessellator.draw();
    RenderSystem.disableBlend();
    RenderSystem.enableTexture();
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Example 47 with Tessellator

use of net.minecraft.client.render.Tessellator in project BleachHack by BleachDrinker420.

the class Window method verticalGradient.

public static void verticalGradient(MatrixStack matrices, int x1, int y1, int x2, int y2, int color1, int color2) {
    float alpha1 = (color1 >> 24 & 255) / 255.0F;
    float red1 = (color1 >> 16 & 255) / 255.0F;
    float green1 = (color1 >> 8 & 255) / 255.0F;
    float blue1 = (color1 & 255) / 255.0F;
    float alpha2 = (color2 >> 24 & 255) / 255.0F;
    float red2 = (color2 >> 16 & 255) / 255.0F;
    float green2 = (color2 >> 8 & 255) / 255.0F;
    float blue2 = (color2 & 255) / 255.0F;
    RenderSystem.disableTexture();
    RenderSystem.enableBlend();
    RenderSystem.defaultBlendFunc();
    RenderSystem.setShader(GameRenderer::getPositionColorShader);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferBuilder = tessellator.getBuffer();
    bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
    bufferBuilder.vertex(x2, y1, 0).color(red1, green1, blue1, alpha1).next();
    bufferBuilder.vertex(x1, y1, 0).color(red1, green1, blue1, alpha1).next();
    bufferBuilder.vertex(x1, y2, 0).color(red2, green2, blue2, alpha2).next();
    bufferBuilder.vertex(x2, y2, 0).color(red2, green2, blue2, alpha2).next();
    tessellator.draw();
    RenderSystem.disableBlend();
    RenderSystem.enableTexture();
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Aggregations

Tessellator (net.minecraft.client.render.Tessellator)47 BufferBuilder (net.minecraft.client.render.BufferBuilder)43 GameRenderer (net.minecraft.client.render.GameRenderer)31 MatrixStack (net.minecraft.client.util.math.MatrixStack)12 Color (java.awt.Color)4 Inject (org.spongepowered.asm.mixin.injection.Inject)4 Matrix4f (net.minecraft.util.math.Matrix4f)3 Framebuffer (net.minecraft.client.gl.Framebuffer)2 Shader (net.minecraft.client.render.Shader)2 Box (net.minecraft.util.math.Box)2 Vec3d (net.minecraft.util.math.Vec3d)2 Mirror (com.qouteall.immersive_portals.portal.Mirror)1 Random (java.util.Random)1 BlockBase (net.minecraft.block.BlockBase)1 TextRenderer (net.minecraft.client.font.TextRenderer)1 VertexBuffer (net.minecraft.client.gl.VertexBuffer)1 ClientPlayerEntity (net.minecraft.client.network.ClientPlayerEntity)1 VertexConsumerProvider (net.minecraft.client.render.VertexConsumerProvider)1 NbtCompound (net.minecraft.nbt.NbtCompound)1 StationTessellator (net.modificationstation.stationapi.api.client.render.StationTessellator)1