Even more gui cleanup, remove most RenderSystem calls

This commit is contained in:
modmuss50 2023-05-13 16:50:47 +01:00 committed by modmuss
parent 5bca54128a
commit e5b5c399ef
12 changed files with 31 additions and 147 deletions

View file

@ -24,22 +24,10 @@
package reborncore.client; package reborncore.client;
import com.mojang.blaze3d.systems.RenderSystem;
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler;
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.*;
import net.minecraft.client.texture.Sprite; import net.minecraft.client.texture.Sprite;
import net.minecraft.client.texture.TextureManager;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.fluid.Fluid;
import net.minecraft.screen.PlayerScreenHandler; import net.minecraft.screen.PlayerScreenHandler;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import reborncore.common.fluid.FluidValue;
import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.util.Tank;
/** /**
* Created by Gigabit101 on 08/08/2016. * Created by Gigabit101 on 08/08/2016.
@ -48,34 +36,4 @@ public class RenderUtil {
public static Sprite getSprite(Identifier identifier) { public static Sprite getSprite(Identifier identifier) {
return MinecraftClient.getInstance().getSpriteAtlas(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE).apply(identifier); return MinecraftClient.getInstance().getSpriteAtlas(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE).apply(identifier);
} }
public static void drawGradientRect(DrawContext drawContext, int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) {
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
float f = (startColor >> 24 & 0xFF) / 255.0F;
float g = (startColor >> 16 & 0xFF) / 255.0F;
float h = (startColor >> 8 & 0xFF) / 255.0F;
float i = (startColor & 0xFF) / 255.0F;
float j = (endColor >> 24 & 0xFF) / 255.0F;
float k = (endColor >> 16 & 0xFF) / 255.0F;
float l = (endColor >> 8 & 0xFF) / 255.0F;
float m = (endColor & 0xFF) / 255.0F;
bufferBuilder.vertex(drawContext.getMatrices().peek().getPositionMatrix(), right, top, zLevel).color(g, h, i, f).next();
bufferBuilder.vertex(drawContext.getMatrices().peek().getPositionMatrix(), left, top, zLevel).color(g, h, i, f).next();
bufferBuilder.vertex(drawContext.getMatrices().peek().getPositionMatrix(), left, bottom, zLevel).color(k, l, m, j).next();
bufferBuilder.vertex(drawContext.getMatrices().peek().getPositionMatrix(), right, bottom, zLevel).color(k, l, m, j).next();
tessellator.draw();
RenderSystem.disableBlend();
}
} }

View file

@ -1,36 +0,0 @@
/*
* This file is part of RebornCore, licensed under the MIT License (MIT).
*
* Copyright (c) 2021 TeamReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package reborncore.client.gui;
import net.minecraft.client.gui.DrawContext;
import reborncore.client.RenderUtil;
public class GuiUtil {
@Deprecated(forRemoval = true) // TODO 1.20 remove me
public static void drawGradientRect(DrawContext drawContext, int x, int y, int w, int h, int colour1, int colour2) {
RenderUtil.drawGradientRect(drawContext, 0, x, y, x + w, y + h, colour1, colour2);
}
}

View file

@ -24,7 +24,6 @@
package reborncore.client.gui.builder; package reborncore.client.gui.builder;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
@ -33,7 +32,6 @@ import net.minecraft.client.gui.Selectable;
import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.resource.language.I18n; import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids; import net.minecraft.fluid.Fluids;
@ -199,7 +197,6 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
@Override @Override
protected void drawBackground(DrawContext drawContext, float lastFrameDuration, int mouseX, int mouseY) { protected void drawBackground(DrawContext drawContext, float lastFrameDuration, int mouseX, int mouseY) {
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
renderBackground(drawContext); renderBackground(drawContext);
boolean drawPlayerSlots = selectedTab == null && drawPlayerSlots(); boolean drawPlayerSlots = selectedTab == null && drawPlayerSlots();
updateSlotDraw(drawPlayerSlots); updateSlotDraw(drawPlayerSlots);
@ -248,13 +245,17 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
@Override @Override
protected void drawForeground(DrawContext drawContext, int mouseX, int mouseY) { protected void drawForeground(DrawContext drawContext, int mouseX, int mouseY) {
drawTitle(drawContext); drawTitle(drawContext);
getTab().ifPresent(guiTab -> guiTab.draw(drawContext, mouseX, mouseY));
} }
@Override @Override
public void render(DrawContext drawContext, int mouseX, int mouseY, float partialTicks) { public void render(DrawContext drawContext, int mouseX, int mouseY, float partialTicks) {
super.render(drawContext, mouseX, mouseY, partialTicks); super.render(drawContext, mouseX, mouseY, partialTicks);
this.drawMouseoverTooltip(drawContext, mouseX, mouseY); this.drawMouseoverTooltip(drawContext, mouseX, mouseY);
drawContext.getMatrices().push();
drawContext.getMatrices().translate(this.x, this.y, 900);
getTab().ifPresent(guiTab -> guiTab.draw(drawContext, mouseX, mouseY));
drawContext.getMatrices().pop();
} }
@Override @Override
@ -306,7 +307,6 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
factorY = this.y; factorY = this.y;
} }
drawContext.drawText(MinecraftClient.getInstance().textRenderer, text, x + factorX, y + factorY, colour, false); drawContext.drawText(MinecraftClient.getInstance().textRenderer, text, x + factorX, y + factorY, colour, false);
RenderSystem.setShaderColor(1F, 1F, 1F, 1F);
} }
public GuiButtonHologram addHologramButton(int x, int y, int id, Layer layer) { public GuiButtonHologram addHologramButton(int x, int y, int id, Layer layer) {

View file

@ -56,11 +56,10 @@ public class RedstoneConfigGui {
boolean hovered = withinBounds(guiBase, mouseX, mouseY, x + 92, y + (i * spread) - 2, 63, 15); boolean hovered = withinBounds(guiBase, mouseX, mouseY, x + 92, y + (i * spread) - 2, 63, 15);
int color = hovered ? 0xFF8b8b8b : 0x668b8b8b; int color = hovered ? 0xFF8b8b8b : 0x668b8b8b;
RenderUtil.drawGradientRect(drawContext, 0, x + 91, y + (i * spread) - 2, x + 93 + 65, y + (i * spread) + 10, color, color); drawContext.fill(x + 91, y + (i * spread) - 2, x + 93 + 65, y + (i * spread) + 10, color);
Text name = Text.translatable("reborncore.gui.fluidconfig." + configuration.getState(element).name().toLowerCase(Locale.ROOT)); Text name = Text.translatable("reborncore.gui.fluidconfig." + configuration.getState(element).name().toLowerCase(Locale.ROOT));
guiBase.drawCentredText(drawContext, name, y + (i * spread), -1, x + 37, GuiBase.Layer.FOREGROUND); guiBase.drawCentredText(drawContext, name, y + (i * spread), -1, x + 37, GuiBase.Layer.FOREGROUND);
//guiBase.getTextRenderer().drawWithShadow(name, x + 92, y + (i * spread), -1);
i++; i++;
} }

View file

@ -25,16 +25,13 @@
package reborncore.client.gui.builder.slot; package reborncore.client.gui.builder.slot;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.Slot;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import reborncore.client.ClientChatUtils; import reborncore.client.ClientChatUtils;
import reborncore.client.ClientNetworkManager; import reborncore.client.ClientNetworkManager;
import reborncore.client.gui.GuiUtil;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.slot.elements.ConfigSlotElement; import reborncore.client.gui.builder.slot.elements.ConfigSlotElement;
import reborncore.client.gui.builder.slot.elements.ElementBase; import reborncore.client.gui.builder.slot.elements.ElementBase;
@ -81,14 +78,12 @@ public class SlotConfigGui {
if (guiBase.be != slot.inventory) { if (guiBase.be != slot.inventory) {
continue; continue;
} }
RenderSystem.setShaderColor(1.0F, 0, 0, 1.0F);
Color color = new Color(255, 0, 0, 128); Color color = new Color(255, 0, 0, 128);
GuiUtil.drawGradientRect(drawContext, slot.x - 1, slot.y - 1, 18, 18, color.getColor(), color.getColor());
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); drawContext.fill(slot.x -1, slot.y -1, slot.x + 17, slot.y + 17, color.getColor());
} }
if (selectedSlot != -1) { if (selectedSlot != -1) {
slotElementMap.get(selectedSlot).draw(drawContext, guiBase); slotElementMap.get(selectedSlot).draw(drawContext, guiBase);
} }
} }

View file

@ -34,11 +34,8 @@ import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.BlockRenderManager; import net.minecraft.client.render.block.BlockRenderManager;
import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.screen.PlayerScreenHandler;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.RotationAxis; import net.minecraft.util.math.RotationAxis;
import net.minecraft.world.World;
import org.joml.Quaternionf; import org.joml.Quaternionf;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MachineBaseBlockEntity;
@ -56,20 +53,18 @@ public abstract class AbstractConfigPopupElement extends ElementBase {
drawDefaultBackground(drawContext, gui, adjustX(gui, getX() - 8), adjustY(gui, getY() - 7), 84, 105 + (filter ? 15 : 0)); drawDefaultBackground(drawContext, gui, adjustX(gui, getX() - 8), adjustY(gui, getY() - 7), 84, 105 + (filter ? 15 : 0));
super.draw(drawContext, gui); super.draw(drawContext, gui);
MachineBaseBlockEntity machine = ((MachineBaseBlockEntity) gui.be); final MachineBaseBlockEntity machine = ((MachineBaseBlockEntity) gui.be);
World world = machine.getWorld(); final BlockState state = machine.getCachedState();
BlockPos pos = machine.getPos(); final BlockState defaultState = state.getBlock().getDefaultState();
BlockState state = world.getBlockState(pos); final BlockRenderManager dispatcher = MinecraftClient.getInstance().getBlockRenderManager();
BlockState actualState = state.getBlock().getDefaultState(); final BakedModel model = dispatcher.getModels().getModel(defaultState);
BlockRenderManager dispatcher = MinecraftClient.getInstance().getBlockRenderManager();
BakedModel model = dispatcher.getModels().getModel(state.getBlock().getDefaultState()); drawState(drawContext, gui, model, defaultState, dispatcher, 4, 23, RotationAxis.POSITIVE_Y.rotationDegrees(90F)); //left
MinecraftClient.getInstance().getTextureManager().bindTexture(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE); drawState(drawContext, gui, model, defaultState, dispatcher, 23, 4, RotationAxis.NEGATIVE_X.rotationDegrees(90F)); //top
drawState(drawContext, gui, world, model, actualState, pos, dispatcher, 4, 23, RotationAxis.POSITIVE_Y.rotationDegrees(90F)); //left drawState(drawContext, gui, model, defaultState, dispatcher, 23, 23, null); //centre
drawState(drawContext, gui, world, model, actualState, pos, dispatcher, 23, 4, RotationAxis.NEGATIVE_X.rotationDegrees(90F)); //top drawState(drawContext, gui, model, defaultState, dispatcher, 23, 26, RotationAxis.POSITIVE_X.rotationDegrees(90F)); //bottom
drawState(drawContext, gui, world, model, actualState, pos, dispatcher, 23, 23, null); //centre drawState(drawContext, gui, model, defaultState, dispatcher, 42, 23, RotationAxis.POSITIVE_Y.rotationDegrees(90F)); //right
drawState(drawContext, gui, world, model, actualState, pos, dispatcher, 23, 26, RotationAxis.POSITIVE_X.rotationDegrees(90F)); //bottom drawState(drawContext, gui, model, defaultState, dispatcher, 26, 42, RotationAxis.POSITIVE_Y.rotationDegrees(180F)); //back
drawState(drawContext, gui, world, model, actualState, pos, dispatcher, 42, 23, RotationAxis.POSITIVE_Y.rotationDegrees(90F)); //right
drawState(drawContext, gui, world, model, actualState, pos, dispatcher, 26, 42, RotationAxis.POSITIVE_Y.rotationDegrees(180F)); //back
drawSateColor(drawContext, gui, MachineFacing.UP.getFacing(machine), 22, -1); drawSateColor(drawContext, gui, MachineFacing.UP.getFacing(machine), 22, -1);
drawSateColor(drawContext, gui, MachineFacing.FRONT.getFacing(machine), 22, 18); drawSateColor(drawContext, gui, MachineFacing.FRONT.getFacing(machine), 22, 18);
@ -112,20 +107,18 @@ public abstract class AbstractConfigPopupElement extends ElementBase {
protected void drawState(DrawContext drawContext, protected void drawState(DrawContext drawContext,
GuiBase<?> gui, GuiBase<?> gui,
World world,
BakedModel model, BakedModel model,
BlockState actualState, BlockState actualState,
BlockPos pos,
BlockRenderManager dispatcher, BlockRenderManager dispatcher,
int x, int x,
int y, int y,
Quaternionf quaternion) { Quaternionf quaternion) {
MatrixStack matrixStack = drawContext.getMatrices(); MatrixStack matrixStack = drawContext.getMatrices();
matrixStack.push(); matrixStack.push();
matrixStack.translate(8 + gui.getGuiLeft() + this.x + x, 8 + gui.getGuiTop() + this.y + y, 512); matrixStack.translate(8 + gui.getGuiLeft() + this.x + x, 8 + gui.getGuiTop() + this.y + y, 0);
matrixStack.scale(16F, 16F, 16F); matrixStack.scale(16F, 16F, 16F);
matrixStack.translate(0.5F, 0.5F, 0.5F); matrixStack.translate(0.5F, 0.5F, 0);
matrixStack.scale(-1, -1, -1); matrixStack.scale(-1, -1, 0);
if (quaternion != null) { if (quaternion != null) {
matrixStack.multiply(quaternion); matrixStack.multiply(quaternion);

View file

@ -24,12 +24,7 @@
package reborncore.client.gui.builder.slot.elements; package reborncore.client.gui.builder.slot.elements;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.text.Text; import net.minecraft.text.Text;

View file

@ -24,16 +24,10 @@
package reborncore.client.gui.builder.slot.elements; package reborncore.client.gui.builder.slot.elements;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.client.RenderUtil;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MachineBaseBlockEntity;
@ -286,7 +280,6 @@ public class ElementBase {
Sprite sprite = iSprite.getSprite(gui.getMachine()); Sprite sprite = iSprite.getSprite(gui.getMachine());
if (sprite != null) { if (sprite != null) {
if (sprite.hasTextureInfo()) { if (sprite.hasTextureInfo()) {
RenderSystem.setShaderColor(1F, 1F, 1F, 1F);
drawContext.drawTexture(sprite.textureLocation, x + gui.getGuiLeft(), y + gui.getGuiTop(), sprite.x, sprite.y, sprite.width, sprite.height); drawContext.drawTexture(sprite.textureLocation, x + gui.getGuiLeft(), y + gui.getGuiTop(), sprite.x, sprite.y, sprite.width, sprite.height);
} }
if (sprite.hasStack()) { if (sprite.hasStack()) {

View file

@ -24,12 +24,10 @@
package reborncore.client.gui.builder.slot.elements; package reborncore.client.gui.builder.slot.elements;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import reborncore.RebornCore; import reborncore.RebornCore;
import reborncore.client.ClientNetworkManager; import reborncore.client.ClientNetworkManager;
import reborncore.client.gui.GuiUtil;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.common.blockentity.FluidConfiguration; import reborncore.common.blockentity.FluidConfiguration;
import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MachineBaseBlockEntity;
@ -96,8 +94,6 @@ public class FluidConfigPopupElement extends AbstractConfigPopupElement {
case OUTPUT -> new Color(255, 69, 0, 128); case OUTPUT -> new Color(255, 69, 0, 128);
case ALL -> new Color(52, 255, 30, 128); case ALL -> new Color(52, 255, 30, 128);
}; };
RenderSystem.setShaderColor(1, 1, 1, 1); drawContext.fill(sx, sy, sx + 18, sy + 18, color.getColor());
GuiUtil.drawGradientRect(drawContext, sx, sy, 18, 18, color.getColor(), color.getColor());
RenderSystem.setShaderColor(1, 1, 1, 1);
} }
} }

View file

@ -24,12 +24,10 @@
package reborncore.client.gui.builder.slot.elements; package reborncore.client.gui.builder.slot.elements;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import reborncore.RebornCore; import reborncore.RebornCore;
import reborncore.client.ClientNetworkManager; import reborncore.client.ClientNetworkManager;
import reborncore.client.gui.GuiUtil;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.common.blockentity.SlotConfiguration; import reborncore.common.blockentity.SlotConfiguration;
import reborncore.common.network.IdentifiedPacket; import reborncore.common.network.IdentifiedPacket;
@ -99,8 +97,6 @@ public class SlotConfigPopupElement extends AbstractConfigPopupElement {
case OUTPUT -> new Color(255, 69, 0, 128); case OUTPUT -> new Color(255, 69, 0, 128);
default -> new Color(0, 0, 0, 0); default -> new Color(0, 0, 0, 0);
}; };
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); drawContext.fill(sx, sy, sx + 18, sy + 18, color.getColor());
GuiUtil.drawGradientRect(drawContext, sx, sy, 18, 18, color.getColor(), color.getColor());
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
} }
} }

View file

@ -25,7 +25,6 @@
package reborncore.client.gui.guibuilder; package reborncore.client.gui.guibuilder;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.blaze3d.systems.RenderSystem;
import net.fabricmc.fabric.api.transfer.v1.client.fluid.FluidVariantRendering; import net.fabricmc.fabric.api.transfer.v1.client.fluid.FluidVariantRendering;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
@ -40,7 +39,6 @@ import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.api.IListInfoProvider; import reborncore.api.IListInfoProvider;
import reborncore.client.RenderUtil;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.slot.GuiTab; import reborncore.client.gui.builder.slot.GuiTab;
import reborncore.common.fluid.FluidUtils; import reborncore.common.fluid.FluidUtils;
@ -328,13 +326,11 @@ public class GuiBuilder {
x += gui.getGuiLeft(); x += gui.getGuiLeft();
y += gui.getGuiTop(); y += gui.getGuiTop();
} }
RenderSystem.enableDepthTest();
RenderSystem.colorMask(true, true, true, false); drawContext.fillGradient(x, y, x + 176, y + 20, 0x000000, 0xC0000000);
RenderUtil.drawGradientRect(drawContext, 0, x, y, x + 176, y + 20, 0x000000, 0xC0000000); drawContext.fillGradient(x, y + 20, x + 176, y + 20 + 48, 0xC0000000, 0xC0000000);
RenderUtil.drawGradientRect(drawContext, 0, x, y + 20, x + 176, y + 20 + 48, 0xC0000000, 0xC0000000); drawContext.fillGradient(x, y + 68, x + 176, y + 70 + 20, 0xC0000000, 0x00000000);
RenderUtil.drawGradientRect(drawContext, 0, x, y + 68, x + 176, y + 70 + 20, 0xC0000000, 0x00000000);
RenderSystem.colorMask(true, true, true, true);
RenderSystem.disableDepthTest();
gui.drawCentredText(drawContext, Text.translatable("reborncore.gui.missingmultiblock"), 43, 0xFFFFFF, layer); gui.drawCentredText(drawContext, Text.translatable("reborncore.gui.missingmultiblock"), 43, 0xFFFFFF, layer);
} }

View file

@ -24,10 +24,9 @@
package techreborn.client.gui; package techreborn.client.gui;
import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ConfirmLinkScreen; import net.minecraft.client.gui.screen.ConfirmLinkScreen;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.Util; import net.minecraft.util.Util;