com.mojang.blaze3d.systems.RenderSystem Java Examples

The following examples show how to use com.mojang.blaze3d.systems.RenderSystem. 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: Render.java    From XRay-Mod with GNU General Public License v3.0 7 votes vote down vote up
static void renderBlocks(RenderWorldLastEvent event) {
       Vector3d view = XRay.mc.gameRenderer.getActiveRenderInfo().getProjectedView();

       MatrixStack stack = event.getMatrixStack();
       stack.translate(-view.x, -view.y, -view.z); // translate

       RenderSystem.pushMatrix();
       RenderSystem.multMatrix(stack.getLast().getMatrix());

       Tessellator tessellator = Tessellator.getInstance();
       BufferBuilder buffer = tessellator.getBuffer();
       Profile.BLOCKS.apply(); // Sets GL state for block drawing

       syncRenderList.forEach(blockProps -> {
           buffer.begin( GL_LINES, DefaultVertexFormats.POSITION_COLOR );
           renderBlockBounding(buffer, blockProps);
           tessellator.draw();
       } );

       Profile.BLOCKS.clean();
       RenderSystem.popMatrix();
}
 
Example #2
Source File: GuiAddBlock.java    From XRay-Mod with GNU General Public License v3.0 6 votes vote down vote up
static void renderPreview(int x, int y, float r, float g, float b) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder tessellate = tessellator.getBuffer();
    RenderSystem.enableBlend();
    RenderSystem.disableTexture();
    RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    RenderSystem.color4f(r/255, g/255, b/255, 1);
    tessellate.begin(7, DefaultVertexFormats.POSITION);
    tessellate.pos(x, y, 0.0D).endVertex();
    tessellate.pos(x, y + 45, 0.0D).endVertex();
    tessellate.pos(x + 202, y + 45, 0.0D).endVertex();
    tessellate.pos(x + 202, y, 0.0D).endVertex();
    tessellator.draw();
    RenderSystem.enableTexture();
    RenderSystem.disableBlend();
}
 
Example #3
Source File: SawmillScreen.java    From Survivalist with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
protected void func_230450_a_(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY)
{
    RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.field_230706_i_.getTextureManager().bindTexture(GUI_TEXTURE_LOCATION);
    int x = this.guiLeft;
    int y = this.guiTop;
    this.func_238474_b_(matrixStack, x, y, 0, 0, xSize, ySize);

    if (container.isBurning())
    {
        int k = this.getBurnLeftScaled(13);
        this.func_238474_b_(matrixStack, x + 56, y + 36 + 12 - k, 176, 12 - k, 14, k + 1);
    }

    int l = this.getCookProgressScaled(24);
    this.func_238474_b_(matrixStack, x + 79, y + 34, 176, 14, l + 1, 16);
}
 
Example #4
Source File: WTextField.java    From LibGui with MIT License 6 votes vote down vote up
@Environment(EnvType.CLIENT)
private void invertedRect(int x, int y, int width, int height) {
	Tessellator tessellator_1 = Tessellator.getInstance();
	BufferBuilder bufferBuilder_1 = tessellator_1.getBuffer();
	RenderSystem.color4f(0.0F, 0.0F, 255.0F, 255.0F);
	RenderSystem.disableTexture();
	RenderSystem.enableColorLogicOp();
	RenderSystem.logicOp(GlStateManager.LogicOp.OR_REVERSE);
	bufferBuilder_1.begin(GL11.GL_QUADS, VertexFormats.POSITION);
	bufferBuilder_1.vertex(x,       y+height, 0.0D).next();
	bufferBuilder_1.vertex(x+width, y+height, 0.0D).next();
	bufferBuilder_1.vertex(x+width, y,        0.0D).next();
	bufferBuilder_1.vertex(x,       y,        0.0D).next();
	tessellator_1.draw();
	RenderSystem.disableColorLogicOp();
	RenderSystem.enableTexture();
}
 
Example #5
Source File: ToggleButton.java    From MiningGadgets with MIT License 6 votes vote down vote up
@Override
public void renderButton(int p_renderButton_1_, int p_renderButton_2_, float p_renderButton_3_) {
    Color activeColor = this.enabled ? Color.GREEN : Color.RED;

    RenderSystem.enableBlend();
    RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.param, GlStateManager.SourceFactor.ONE.param, GlStateManager.DestFactor.ZERO.param);
    RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.param);

    RenderSystem.disableTexture();
    RenderSystem.color4f(activeColor.getRed() / 255f, activeColor.getGreen() / 255f, activeColor.getBlue() / 255f, this.enabled ? .4f : .6f);
    blit(this.x, this.y, 0, 0, this.width, this.height);
    RenderSystem.enableTexture();

    RenderSystem.color4f(1f, 1f, 1f, 1f);
    Minecraft.getInstance().getTextureManager().bindTexture(texture);
    blit(this.x +2, this.y + 5, 0, 0, 16, 16, 16, 16);
}
 
Example #6
Source File: ScreenDrawing.java    From LibGui with MIT License 6 votes vote down vote up
/**
 * Draws an untextured rectangle of the specified RGB color.
 */
public static void coloredRect(int left, int top, int width, int height, int color) {
	if (width <= 0) width = 1;
	if (height <= 0) height = 1;

	float a = (color >> 24 & 255) / 255.0F;
	float r = (color >> 16 & 255) / 255.0F;
	float g = (color >> 8 & 255) / 255.0F;
	float b = (color & 255) / 255.0F;
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder buffer = tessellator.getBuffer();
	RenderSystem.enableBlend();
	RenderSystem.disableTexture();
	RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO);
	buffer.begin(GL11.GL_QUADS, VertexFormats.POSITION_COLOR); //I thought GL_QUADS was deprecated but okay, sure.
	buffer.vertex(left,         top + height, 0.0D).color(r, g, b, a).next();
	buffer.vertex(left + width, top + height, 0.0D).color(r, g, b, a).next();
	buffer.vertex(left + width, top,          0.0D).color(r, g, b, a).next();
	buffer.vertex(left,         top,          0.0D).color(r, g, b, a).next();
	tessellator.draw();
	RenderSystem.enableTexture();
	RenderSystem.disableBlend();
}
 
Example #7
Source File: ScreenDrawing.java    From LibGui with MIT License 6 votes vote down vote up
/**
 * Draws a textured rectangle.
 *
 * @param x         the x coordinate of the box on-screen
 * @param y         the y coordinate of the box on-screen
 * @param width     the width of the box on-screen
 * @param height    the height of the box on-screen
 * @param texture   the Identifier for the texture
 * @param u1        the left edge of the texture
 * @param v1        the top edge of the texture
 * @param u2        the right edge of the texture
 * @param v2        the bottom edge of the texture
 * @param color     a color to tint the texture. This can be transparent! Use 0xFF_FFFFFF if you don't want a color tint
 * @param opacity   opacity of the drawn texture. (0f is fully opaque and 1f is fully visible)
 * @since 2.0.0
 */
public static void texturedRect(int x, int y, int width, int height, Identifier texture, float u1, float v1, float u2, float v2, int color, float opacity) {
	MinecraftClient.getInstance().getTextureManager().bindTexture(texture);

	//float scale = 0.00390625F;

	if (width <= 0) width = 1;
	if (height <= 0) height = 1;

	float r = (color >> 16 & 255) / 255.0F;
	float g = (color >> 8 & 255) / 255.0F;
	float b = (color & 255) / 255.0F;
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder buffer = tessellator.getBuffer();
	RenderSystem.enableBlend();
	//GlStateManager.disableTexture2D();
	RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO);
	buffer.begin(GL11.GL_QUADS, VertexFormats.POSITION_COLOR_TEXTURE); //I thought GL_QUADS was deprecated but okay, sure.
	buffer.vertex(x,         y + height, 0).color(r, g, b, opacity).texture(u1, v2).next();
	buffer.vertex(x + width, y + height, 0).color(r, g, b, opacity).texture(u2, v2).next();
	buffer.vertex(x + width, y,          0).color(r, g, b, opacity).texture(u2, v1).next();
	buffer.vertex(x,         y,          0).color(r, g, b, opacity).texture(u1, v1).next();
	tessellator.draw();
	//GlStateManager.enableTexture2D();
	RenderSystem.disableBlend();
}
 
Example #8
Source File: GuiSelectionScreen.java    From XRay-Mod with GNU General Public License v3.0 6 votes vote down vote up
@Override // @mcp: func_230432_a_  = render
public void func_230432_a_(MatrixStack stack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks) {
    BlockData blockData = this.block;

    FontRenderer font = Minecraft.getInstance().fontRenderer;
    // @mcp: func_238407_a_ = drawString
    font.func_238407_a_(stack, ITextProperties.func_240652_a_(blockData.getEntryName()), left + 40, top + 7, 0xFFFFFF);
    font.func_238407_a_(stack, ITextProperties.func_240652_a_(blockData.isDrawing() ? "Enabled" : "Disabled"), left + 40, top + 17, blockData.isDrawing() ? Color.GREEN.getRGB() : Color.RED.getRGB());

    RenderHelper.enableStandardItemLighting();
    Minecraft.getInstance().getItemRenderer().renderItemAndEffectIntoGUI(blockData.getItemStack(), left + 15, top + 7);
    RenderHelper.disableStandardItemLighting();
    if (mouseX > left && mouseX < (left + entryWidth) && mouseY > top && mouseY < (top + entryHeight) && mouseY < (this.parent.getTop() + this.parent.getHeight()) && mouseY > this.parent.getTop()) {
        this.parent.parent.func_238654_b_(
                stack,
                Arrays.asList(new TranslationTextComponent("xray.tooltips.edit1"), new TranslationTextComponent("xray.tooltips.edit2")),
                left + 15,
                (entryIdx == this.parent.func_231039_at__().size() - 1 ? (top - (entryHeight - 20)) : (top + (entryHeight + 15))) // @mcp: func_231039_at__ = getEntries
        );  // @mcp: func_230457_a_ = renderTooltip
    }

    RenderSystem.enableAlphaTest();
    RenderSystem.enableBlend();
    RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
    Minecraft.getInstance().getRenderManager().textureManager.bindTexture(GuiSelectionScreen.CIRCLE);
    GuiBase.drawTexturedQuadFit((left + entryWidth) - 37, top + (entryHeight / 2f) - 9, 14, 14, new int[]{255, 255, 255}, 50f);
    GuiBase.drawTexturedQuadFit((left + entryWidth) - 35, top + (entryHeight / 2f) - 7, 10, 10, blockData.getColor());
    RenderSystem.disableAlphaTest();
    RenderSystem.disableBlend();
}
 
Example #9
Source File: ListWidget.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
protected void renderHoleBackground(int top, int bottom, int topAlpha,
	int bottomAlpha)
{
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder bufferBuilder = tessellator.getBuffer();
	client.getTextureManager()
		.bindTexture(DrawableHelper.BACKGROUND_TEXTURE);
	RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
	bufferBuilder.begin(7, VertexFormats.POSITION_TEXTURE_COLOR);
	bufferBuilder.vertex(left, bottom, 0.0D).texture(0.0F, bottom / 32.0F)
		.color(64, 64, 64, bottomAlpha).next();
	bufferBuilder.vertex(left + width, bottom, 0.0D)
		.texture(width / 32.0F, bottom / 32.0F)
		.color(64, 64, 64, bottomAlpha).next();
	bufferBuilder.vertex(left + width, top, 0.0D)
		.texture(width / 32.0F, top / 32.0F).color(64, 64, 64, topAlpha)
		.next();
	bufferBuilder.vertex(left, top, 0.0D).texture(0.0F, top / 32.0F)
		.color(64, 64, 64, topAlpha).next();
	tessellator.draw();
}
 
Example #10
Source File: GuiBase.java    From XRay-Mod with GNU General Public License v3.0 6 votes vote down vote up
public static void drawTexturedQuadFit(double x, double y, double width, double height, int[] color, float alpha)
{
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder tessellate = tessellator.getBuffer();

    RenderSystem.pushMatrix();
    tessellate.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);

    if ( color != null )
        RenderSystem.color4f((float) color[0] / 255, (float) color[1] / 255, (float) color[2] / 255, alpha / 255);

    tessellate.pos(x + 0, y + height, (double) 0).tex( 0,1).endVertex();
    tessellate.pos(x + width, y + height, (double) 0).tex( 1, 1).endVertex();
    tessellate.pos(x + width, y + 0, (double) 0).tex( 1,0).endVertex();
    tessellate.pos(x + 0, y + 0, (double) 0).tex( 0, 0).endVertex();
    tessellator.draw();

    RenderSystem.popMatrix();
}
 
Example #11
Source File: HallowedLoadingScreen.java    From the-hallow with MIT License 6 votes vote down vote up
@Override
public void renderDirtBackground(int i) {
	// Copied mostly from renderDirtBackground()
	RenderSystem.disableLighting();
	RenderSystem.disableFog();
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder builder = tessellator.getBuffer();
	minecraft.getTextureManager().bindTexture(backgroundTexture);
	int brightness = 130;
	RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
	builder.begin(7, VertexFormats.POSITION_TEXTURE_COLOR);
	builder.vertex(0, height, 0).texture(0, height / 32.0F + i).color(brightness, brightness, brightness, 255).next();
	builder.vertex(width, height, 0).texture(width / 32.0F, height / 32.0F + i).color(brightness, brightness, brightness, 255).next();
	builder.vertex(width, 0, 0).texture(width / 32.0F, i).color(brightness, brightness, brightness, 255).next();
	builder.vertex(0, 0, 0).texture(0, i).color(brightness, brightness, brightness, 255).next();
	tessellator.draw();
}
 
Example #12
Source File: HallowedLoadingScreen.java    From the-hallow with MIT License 6 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float delta) {
	renderDirtBackground(0);
	this.drawCenteredString(font, I18n.translate(message), width / 2, height / 2 - 50, 0xFFFFFF);
	
	float scale = 100f;
	RenderSystem.pushMatrix();
	RenderSystem.translatef(width / 2f, height / 2f + 65 + MathHelper.sin(floatingTick / 6.5f) * 25, 500f);
	RenderSystem.scalef(scale, scale, scale);
	RenderSystem.rotatef(180, 1, 0, 0);
	RenderSystem.rotatef(rotation, 0, 1, 0);
	
	minecraft.getTextureManager().bindTexture(SpriteAtlasTexture.BLOCK_ATLAS_TEX);
	minecraft.getItemRenderer().renderGuiItem(pumpkinStack, 0, 0);
	
	RenderSystem.popMatrix();
}
 
Example #13
Source File: SpaceRaceScreen.java    From Galacticraft-Rewoven with MIT License 6 votes vote down vote up
private void renderButton(MatrixStack stack, TextRenderer textRenderer, Text text, int x, int y, int width, int height) {
    RenderSystem.disableBlend();
    stack.push();

    fillSolid(stack.peek().getModel(), x, y, x + width, y + height, 0x0);

    drawHorizontalLineSolid(stack, x, x + width, y, 0x2d2d2d);
    drawVerticalLineSolid(stack, x + width, y, y + height, 0x2d2d2d);
    drawHorizontalLineSolid(stack, x + width, x, y + height, 0x2d2d2d);
    drawVerticalLineSolid(stack, x, y, y + height, 0x2d2d2d);

    stack.pop();
    RenderSystem.enableBlend();

    textRenderer.draw(stack, text, x + (width / 2F) - (textRenderer.getWidth(text) / 2F), y + (height / 2F) - 4F, 0xffffff);
}
 
Example #14
Source File: FilterScreen.java    From MiningGadgets with MIT License 5 votes vote down vote up
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
    RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
    getMinecraft().getTextureManager().bindTexture(TEXTURE);
    int x = (this.width - this.xSize) / 2;
    int y = (this.height - this.ySize) / 2;

    // Stolen from minecraft chests :D
    this.blit(x, y, 0, 0, this.xSize, 71);
    this.blit(x, y + 71, 0, 126, this.xSize, 96);
}
 
Example #15
Source File: ModificationTableScreen.java    From MiningGadgets with MIT License 5 votes vote down vote up
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
    RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
    getMinecraft().getTextureManager().bindTexture(GUI);
    int relX = (this.width - this.xSize) / 2;
    int relY = (this.height - this.ySize) / 2;
    this.blit(relX - 23, relY, 0, 0, this.xSize + 23, this.ySize);
}
 
Example #16
Source File: SeaponyRenderer.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
public void render(GuardianEntity entity, float entityYaw, float tickDelta, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv) {
    IResizeable resize = (IResizeable)entity;
    EntityDimensions origin = resize.getCurrentSize();

    // aligns the beam to their horns
    resize.setCurrentSize(EntityDimensions.changing(origin.width, entity instanceof ElderGuardianEntity ? 6 : 3));

    super.render(entity, entityYaw, tickDelta, stack, renderContext, lightUv);

    // The beams in RenderGuardian leave lighting disabled, so we need to change it back. #MojangPls
    RenderSystem.enableLighting();
    resize.setCurrentSize(origin);
}
 
Example #17
Source File: DireButton.java    From MiningGadgets with MIT License 5 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
    if (this.visible) {
        FontRenderer fontrenderer = Minecraft.getInstance().fontRenderer;
        Minecraft.getInstance().getTextureManager().bindTexture(WIDGETS_LOCATION);
        RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.isHovered = isMouseOver(mouseX, mouseY);
        RenderSystem.enableBlend();
        RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.param, GlStateManager.SourceFactor.ONE.param, GlStateManager.DestFactor.ZERO.param);
        RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.param);
        this.blit(this.x, this.y, 0, 46, this.width / 2, this.height);
        this.blit(this.x + this.width / 2, this.y, 200 - this.width / 2, 46, this.width / 2, this.height);


        int bottomToDraw = 2;
        this.blit(this.x, this.y + this.height - bottomToDraw, 0, 66 - bottomToDraw, this.width / 2, bottomToDraw);
        this.blit(this.x + this.width / 2, this.y + this.height - bottomToDraw, 200 - this.width / 2, 66 - bottomToDraw, this.width / 2, bottomToDraw);

        int j = 14737632;

        if (this.packedFGColor != 0) {
            j = this.packedFGColor;
        } else if (!this.active) {
            j = 10526880;
        } else if (this.isHovered) {
            j = 16777120;
        }

        this.drawCenteredString(fontrenderer, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 7) / 2, j);
    }
}
 
Example #18
Source File: EquineRenderManager.java    From MineLittlePony with MIT License 5 votes vote down vote up
public static void enableModelRenderProfile(boolean skipBlend) {
    RenderSystem.enableBlend();
    if (!skipBlend) {
        RenderSystem.blendFunc(SrcFactor.SRC_ALPHA, DstFactor.ONE_MINUS_SRC_ALPHA);
    }
    RenderSystem.alphaFunc(516, 0.003921569F);
}
 
Example #19
Source File: RenderCustomEndPortal.java    From EnderStorage with MIT License 5 votes vote down vote up
@Override
@SuppressWarnings ("deprecation")
public void setupRenderState() {
    state.renderStates.forEach(RenderState::setupRenderState);
    RenderSystem.disableLighting();
    RenderSystem.pushMatrix();//Apply stack here.
    mat.glApply();
    RenderSystem.pushMatrix();
    GlStateManager.translated(projectedView.x, f11, projectedView.z);
    GlStateManager.texGenMode(GlStateManager.TexGen.S, GL11.GL_OBJECT_LINEAR);
    GlStateManager.texGenMode(GlStateManager.TexGen.T, GL11.GL_OBJECT_LINEAR);
    GlStateManager.texGenMode(GlStateManager.TexGen.R, GL11.GL_OBJECT_LINEAR);
    GlStateManager.texGenMode(GlStateManager.TexGen.Q, GL11.GL_EYE_LINEAR);
    GlStateManager.texGenParam(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, bufferTexData(1.0F, 0.0F, 0.0F, 0.0F));
    GlStateManager.texGenParam(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, bufferTexData(0.0F, 0.0F, 1.0F, 0.0F));
    GlStateManager.texGenParam(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, bufferTexData(0.0F, 0.0F, 0.0F, 1.0F));
    GlStateManager.texGenParam(GlStateManager.TexGen.Q, GL11.GL_EYE_PLANE, bufferTexData(0.0F, 1.0F, 0.0F, 0.0F));
    GlStateManager.enableTexGen(GlStateManager.TexGen.S);
    GlStateManager.enableTexGen(GlStateManager.TexGen.T);
    GlStateManager.enableTexGen(GlStateManager.TexGen.R);
    GlStateManager.enableTexGen(GlStateManager.TexGen.Q);
    RenderSystem.popMatrix();
    RenderSystem.matrixMode(GL11.GL_TEXTURE);
    RenderSystem.pushMatrix();
    RenderSystem.loadIdentity();
    RenderSystem.translatef(0.0F, System.currentTimeMillis() % 700000L / 700000F, 0.0F);
    RenderSystem.scalef(f6, f6, f6);
    RenderSystem.translatef(0.5F, 0.5F, 0.0F);
    RenderSystem.rotatef((idx * idx * 4321 + idx * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
    RenderSystem.translatef(-0.5F, -0.5F, 0.0F);
    RenderSystem.translated(-projectedView.x, -projectedView.z, -projectedView.y);
    float f92 = f8 + (float) projectedView.y;
    RenderSystem.translated((projectedView.x * f5) / f92, (projectedView.z * f5) / f92, -projectedView.y + 20);
}
 
Example #20
Source File: RenderCustomEndPortal.java    From EnderStorage with MIT License 5 votes vote down vote up
@Override
@SuppressWarnings ("deprecation")
public void clearRenderState() {
    RenderSystem.popMatrix();
    RenderSystem.matrixMode(GL11.GL_MODELVIEW);
    RenderSystem.popMatrix();//Pop stack here.
    GlStateManager.disableTexGen(GlStateManager.TexGen.S);
    GlStateManager.disableTexGen(GlStateManager.TexGen.T);
    GlStateManager.disableTexGen(GlStateManager.TexGen.R);
    GlStateManager.disableTexGen(GlStateManager.TexGen.Q);
    state.renderStates.forEach(RenderState::clearRenderState);
}
 
Example #21
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);
}
 
Example #22
Source File: RenderUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static RenderType getFluidRenderType() {
    return RenderType.makeType("ccl:fluid_render", DefaultVertexFormats.POSITION_COLOR_TEX, GL11.GL_QUADS, 256, RenderType.State.getBuilder()//
            .texture(RenderType.BLOCK_SHEET)//
            .transparency(RenderType.TRANSLUCENT_TRANSPARENCY)//
            .texturing(new RenderState.TexturingState("disable_lighting", RenderSystem::disableLighting, SneakyUtils::none))//
            .build(false)//
    );
}
 
Example #23
Source File: VBORenderType.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void setupRenderState() {
    super.setupRenderState();
    states.forEach(RenderState::setupRenderState);
    RenderSystem.pushMatrix();
    matrix.glApply();
    if (hasLightMap) {
        RenderSystem.glMultiTexCoord2f(GL13.GL_TEXTURE2, packedLight & 0xFFFF, packedLight >>> 16);
    }
}
 
Example #24
Source File: DryingRackScreen.java    From Survivalist with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void func_230450_a_(MatrixStack matrixStack, float p_230450_2_, int p_230450_3_, int p_230450_4_)
{
    RenderSystem.color4f(1.0f, 1.0f, 1.0f, 1.0f);

    int x = (field_230708_k_ - xSize) / 2;
    int y = (field_230709_l_ - ySize) / 2;

    field_230706_i_.textureManager.bindTexture(guiTextureLocation);
    this.func_238474_b_(matrixStack, x, y, 0, 0, xSize, ySize);


    for (int s = 0; s < container.dryTimeRemainingArray.size(); s++)
    {
        int mt = DryingRecipe.getDryingTime(field_230706_i_.world, container.getSlot(s).getStack());
        int ct = container.dryTimeRemainingArray.get(s);

        if (ct > 0 && mt > 0)
        {
            int sx = x + 44 + 36 * s;
            int ny = (int) Math.ceil(ct * 20.0 / mt);
            int sy = 20 - ny;

            this.func_238474_b_(matrixStack, sx, y + 32 + sy, 176, sy, 9, ny);
        }
    }
}
 
Example #25
Source File: Render.java    From XRay-Mod with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void apply()
{
    RenderSystem.disableTexture();
    RenderSystem.disableDepthTest();
    RenderSystem.depthMask( false );
    RenderSystem.polygonMode( GL_FRONT_AND_BACK, GL_LINE );
    RenderSystem.blendFunc( GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA );
    RenderSystem.enableBlend();
    RenderSystem.lineWidth( (float) Configuration.general.outlineThickness.get().doubleValue() );
}
 
Example #26
Source File: Render.java    From XRay-Mod with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void clean()
{
    RenderSystem.polygonMode( GL_FRONT_AND_BACK, GL_FILL );
    RenderSystem.disableBlend();
    RenderSystem.enableDepthTest();
    RenderSystem.depthMask( true );
    RenderSystem.enableTexture();
}
 
Example #27
Source File: GuiOverlay.java    From XRay-Mod with GNU General Public License v3.0 5 votes vote down vote up
@OnlyIn(Dist.CLIENT)
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void RenderGameOverlayEvent(RenderGameOverlayEvent event) {
    // Draw Indicator
    if(!Controller.isXRayActive() || !Configuration.general.showOverlay.get() || event.isCanceled() || event.getType() != RenderGameOverlayEvent.ElementType.TEXT )
        return;

    RenderSystem.color3f(0, 255, 0);
    XRay.mc.getTextureManager().bindTexture(circle);
    Screen.func_238463_a_(event.getMatrixStack(), 5, 5, 0f, 0f, 5, 5, 5, 5); // @mcp: func_238463_a_ = blit (7 parms) =

    // @mcp: func_238405_a_ = drawStringWithShadow
    XRay.mc.fontRenderer.func_238405_a_(event.getMatrixStack(), I18n.format("xray.overlay"), 15, 4, 0xffffffff);
}
 
Example #28
Source File: ShapesRenderer.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Override
public void renderFaces(Tessellator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick)
{
    if (shape.fa == 0.0) return;
    Vec3d vc = shape.relativiseRender(client.world, shape.center, partialTick);
    RenderSystem.lineWidth(1.0f);
    drawSphereFaces(tessellator, bufferBuilder,
            (float)(vc.x-cx), (float)(vc.y-cy), (float)(vc.z-cz),
            (float)(shape.radius+renderEpsilon), shape.subdivisions,
            shape.fr, shape.fg, shape.fb, shape.fa);
}
 
Example #29
Source File: SpaceRaceScreen.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
private void renderHoveredButton(MatrixStack stack, TextRenderer textRenderer, Text text, int x, int y, int width, int height) {
    RenderSystem.disableBlend();
    stack.push();

    fillSolid(stack.peek().getModel(), x, y, x + width, y + height, 0x1e1e1e);

    drawHorizontalLineSolid(stack, x, x + width, y, 0x3c3c3c);
    drawVerticalLineSolid(stack, x + width, y, y + height, 0x3c3c3c);
    drawHorizontalLineSolid(stack, x + width, x, y + height, 0x3c3c3c);
    drawVerticalLineSolid(stack, x, y, y + height, 0x3c3c3c);

    stack.pop();
    RenderSystem.enableBlend();

    textRenderer.draw(stack, text, x + (width / 2F) - (textRenderer.getWidth(text) / 2F), y + (height / 2F) - 4F, 0xffffff);
}
 
Example #30
Source File: Particles_1_12_2.java    From multiconnect with MIT License 5 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public void buildGeometry(VertexConsumer vc, Camera camera, float delta) {
    if (!(vc instanceof BufferBuilder)) return;

    float alpha = (ticks + delta) / maxTicks;
    alpha *= alpha;
    alpha = 2 - (alpha * 2);
    if (alpha > 1)
        alpha = 1;
    alpha *= 0.2;

    RenderSystem.disableLighting();
    final float radius = 0.125f;
    Vec3d cameraPos = camera.getPos();
    float x = (float) (this.x - cameraPos.getX());
    float y = (float) (this.y - cameraPos.getY());
    float z = (float) (this.z - cameraPos.getZ());
    float light = world.getBrightness(new BlockPos(this.x, this.y, this.z));
    textureManager.bindTexture(FOOTPRINT_TEXTURE);
    RenderSystem.enableBlend();
    RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
    ((BufferBuilder) vc).begin(GL11.GL_QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
    vc.vertex(x - radius, y, z + radius).texture(0, 1).color(light, light, light, alpha).next();
    vc.vertex(x + radius, y, z + radius).texture(1, 1).color(light, light, light, alpha).next();
    vc.vertex(x + radius, y, z - radius).texture(1, 0).color(light, light, light, alpha).next();
    vc.vertex(x - radius, y, z - radius).texture(0, 0).color(light, light, light, alpha).next();
    Tessellator.getInstance().draw();
    RenderSystem.disableBlend();
    RenderSystem.enableLighting();
}