Remove a lot of dead code + misc cleanup
This commit is contained in:
parent
90bcfe2fb9
commit
5bca54128a
8 changed files with 20 additions and 198 deletions
|
@ -28,6 +28,7 @@ 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.FluidRenderHandler;
|
||||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
|
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.render.*;
|
||||||
import net.minecraft.client.texture.Sprite;
|
import net.minecraft.client.texture.Sprite;
|
||||||
import net.minecraft.client.texture.TextureManager;
|
import net.minecraft.client.texture.TextureManager;
|
||||||
|
@ -44,108 +45,11 @@ import reborncore.common.util.Tank;
|
||||||
* Created by Gigabit101 on 08/08/2016.
|
* Created by Gigabit101 on 08/08/2016.
|
||||||
*/
|
*/
|
||||||
public class RenderUtil {
|
public class RenderUtil {
|
||||||
public static TextureManager engine() {
|
|
||||||
return MinecraftClient.getInstance().getTextureManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void bindBlockTexture() {
|
|
||||||
RenderSystem.setShaderTexture(0, PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Sprite getStillTexture(FluidInstance fluid) {
|
|
||||||
if (fluid == null || fluid.getFluid() == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return getStillTexture(fluid.getFluid());
|
|
||||||
}
|
|
||||||
|
|
||||||
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 Sprite getStillTexture(Fluid fluid) {
|
public static void drawGradientRect(DrawContext drawContext, int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) {
|
||||||
FluidRenderHandler fluidRenderHandler = FluidRenderHandlerRegistry.INSTANCE.get(fluid);
|
|
||||||
if (fluidRenderHandler != null) {
|
|
||||||
return fluidRenderHandler.getFluidSprites(MinecraftClient.getInstance().world, BlockPos.ORIGIN, fluid.getDefaultState())[0];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void renderGuiTank(Tank tank, double x, double y, double zLevel, double width, double height) {
|
|
||||||
renderGuiTank(tank.getFluidInstance(), tank.getFluidValueCapacity(), tank.getFluidAmount(), x, y, zLevel, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void renderGuiTank(FluidInstance fluid, FluidValue capacity, FluidValue amount, double x, double y, double zLevel,
|
|
||||||
double width, double height) {
|
|
||||||
if (fluid == null || fluid.getFluid() == null || fluid.getAmount().lessThanOrEqual(FluidValue.EMPTY)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Sprite icon = getStillTexture(fluid);
|
|
||||||
if (icon == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int renderAmount = (int) Math.max(Math.min(height, amount.getRawValue() * height / capacity.getRawValue()), 1);
|
|
||||||
int posY = (int) (y + height - renderAmount);
|
|
||||||
|
|
||||||
bindBlockTexture();
|
|
||||||
int color = FluidRenderHandlerRegistry.INSTANCE.get(fluid.getFluid()).getFluidColor(null, null, fluid.getFluid().getDefaultState());
|
|
||||||
float r = (float) (color >> 16 & 0xFF) / 255.0F;
|
|
||||||
float g = (float) (color >> 8 & 0xFF) / 255.0F;
|
|
||||||
float b = (float) (color & 0xFF) / 255.0F;
|
|
||||||
RenderSystem.setShaderColor(r, g, b, 1.0F);
|
|
||||||
|
|
||||||
RenderSystem.enableBlend();
|
|
||||||
RenderLayer.getTranslucent().startDrawing();
|
|
||||||
for (int i = 0; i < width; i += 16) {
|
|
||||||
for (int j = 0; j < renderAmount; j += 16) {
|
|
||||||
int drawWidth = (int) Math.min(width - i, 16);
|
|
||||||
int drawHeight = Math.min(renderAmount - j, 16);
|
|
||||||
|
|
||||||
int drawX = (int) (x + i);
|
|
||||||
int drawY = posY + j;
|
|
||||||
|
|
||||||
float minU = icon.getMinU();
|
|
||||||
float maxU = icon.getMaxU();
|
|
||||||
float minV = icon.getMinV();
|
|
||||||
float maxV = icon.getMaxV();
|
|
||||||
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
|
||||||
BufferBuilder tes = tessellator.getBuffer();
|
|
||||||
tes.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL);
|
|
||||||
tes.vertex(drawX, drawY + drawHeight, 0)
|
|
||||||
.color(r, g, b, 1.0F)
|
|
||||||
.texture(minU, minV + (maxV - minV) * drawHeight / 16F)
|
|
||||||
.light(LightmapTextureManager.MAX_LIGHT_COORDINATE)
|
|
||||||
.normal(0, 1, 0)
|
|
||||||
.next();
|
|
||||||
tes.vertex(drawX + drawWidth, drawY + drawHeight, 0)
|
|
||||||
.color(r, g, b, 1.0F)
|
|
||||||
.texture(minU + (maxU - minU) * drawWidth / 16F, minV + (maxV - minV) * drawHeight / 16F)
|
|
||||||
.light(LightmapTextureManager.MAX_LIGHT_COORDINATE)
|
|
||||||
.normal(0, 1, 0)
|
|
||||||
.next();
|
|
||||||
tes.vertex(drawX + drawWidth, drawY, 0)
|
|
||||||
.color(r, g, b, 1.0F)
|
|
||||||
.texture(minU + (maxU - minU) * drawWidth / 16F, minV)
|
|
||||||
.light(LightmapTextureManager.MAX_LIGHT_COORDINATE)
|
|
||||||
.normal(0, 1, 0)
|
|
||||||
.next();
|
|
||||||
tes.vertex(drawX, drawY, 0)
|
|
||||||
.color(r, g, b, 1.0F)
|
|
||||||
.texture(minU, minV)
|
|
||||||
.light(LightmapTextureManager.MAX_LIGHT_COORDINATE)
|
|
||||||
.normal(0, 1, 0)
|
|
||||||
.next();
|
|
||||||
tessellator.draw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
RenderLayer.getTranslucent().endDrawing();
|
|
||||||
RenderSystem.disableBlend();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void drawGradientRect(MatrixStack matrices, int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) {
|
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc();
|
||||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||||
|
@ -164,13 +68,14 @@ public class RenderUtil {
|
||||||
float l = (endColor >> 8 & 0xFF) / 255.0F;
|
float l = (endColor >> 8 & 0xFF) / 255.0F;
|
||||||
float m = (endColor & 0xFF) / 255.0F;
|
float m = (endColor & 0xFF) / 255.0F;
|
||||||
|
|
||||||
bufferBuilder.vertex(matrices.peek().getPositionMatrix(), right, top, zLevel).color(g, h, i, f).next();
|
bufferBuilder.vertex(drawContext.getMatrices().peek().getPositionMatrix(), right, top, zLevel).color(g, h, i, f).next();
|
||||||
bufferBuilder.vertex(matrices.peek().getPositionMatrix(), left, 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(matrices.peek().getPositionMatrix(), left, bottom, zLevel).color(k, l, m, j).next();
|
bufferBuilder.vertex(drawContext.getMatrices().peek().getPositionMatrix(), left, bottom, zLevel).color(k, l, m, j).next();
|
||||||
bufferBuilder.vertex(matrices.peek().getPositionMatrix(), right, 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();
|
tessellator.draw();
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,28 +24,13 @@
|
||||||
|
|
||||||
package reborncore.client.gui;
|
package reborncore.client.gui;
|
||||||
|
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import reborncore.client.RenderUtil;
|
import reborncore.client.RenderUtil;
|
||||||
|
|
||||||
public class GuiUtil {
|
public class GuiUtil {
|
||||||
public static void drawTooltipBox(MatrixStack matrices, int x, int y, int w, int h) {
|
@Deprecated(forRemoval = true) // TODO 1.20 remove me
|
||||||
int bg = 0xf0100010;
|
public static void drawGradientRect(DrawContext drawContext, int x, int y, int w, int h, int colour1, int colour2) {
|
||||||
drawGradientRect(matrices, x + 1, y, w - 1, 1, bg, bg);
|
RenderUtil.drawGradientRect(drawContext, 0, x, y, x + w, y + h, colour1, colour2);
|
||||||
drawGradientRect(matrices, x + 1, y + h, w - 1, 1, bg, bg);
|
|
||||||
drawGradientRect(matrices, x + 1, y + 1, w - 1, h - 1, bg, bg);// center
|
|
||||||
drawGradientRect(matrices, x, y + 1, 1, h - 1, bg, bg);
|
|
||||||
drawGradientRect(matrices, x + w, y + 1, 1, h - 1, bg, bg);
|
|
||||||
int grad1 = 0x505000ff;
|
|
||||||
int grad2 = 0x5028007F;
|
|
||||||
drawGradientRect(matrices, x + 1, y + 2, 1, h - 3, grad1, grad2);
|
|
||||||
drawGradientRect(matrices, x + w - 1, y + 2, 1, h - 3, grad1, grad2);
|
|
||||||
|
|
||||||
drawGradientRect(matrices, x + 1, y + 1, w - 1, 1, grad1, grad1);
|
|
||||||
drawGradientRect(matrices, x + 1, y + h - 1, w - 1, 1, grad2, grad2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void drawGradientRect(MatrixStack matrices, int x, int y, int w, int h, int colour1, int colour2) {
|
|
||||||
RenderUtil.drawGradientRect(matrices, 0, x, y, x + w, y + h, colour1, colour2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ 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.getMatrices(), 0, x + 91, y + (i * spread) - 2, x + 93 + 65, y + (i * spread) + 10, color, color);
|
RenderUtil.drawGradientRect(drawContext, 0, x + 91, y + (i * spread) - 2, x + 93 + 65, y + (i * spread) + 10, color, 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);
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class SlotConfigGui {
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderColor(1.0F, 0, 0, 1.0F);
|
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.getMatrices(), slot.x - 1, slot.y - 1, 18, 18, color.getColor(), color.getColor());
|
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);
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -264,25 +264,6 @@ public class ElementBase {
|
||||||
void update(GuiBase<?> gui, ElementBase element);
|
void update(GuiBase<?> gui, ElementBase element);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawRect(MatrixStack matrices, GuiBase<?> gui, int x, int y, int width, int height, int colour) {
|
|
||||||
drawGradientRect(matrices, gui, x, y, width, height, colour, colour);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Taken from Gui
|
|
||||||
*/
|
|
||||||
public void drawGradientRect(MatrixStack matrices, GuiBase<?> gui, int x, int y, int width, int height, int startColor, int endColor) {
|
|
||||||
x = adjustX(gui, x);
|
|
||||||
y = adjustY(gui, y);
|
|
||||||
|
|
||||||
int left = x;
|
|
||||||
int top = y;
|
|
||||||
int right = x + width;
|
|
||||||
int bottom = y + height;
|
|
||||||
|
|
||||||
RenderUtil.drawGradientRect(matrices, 0, left, top, right, bottom, startColor, endColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int adjustX(GuiBase<?> gui, int x) {
|
public int adjustX(GuiBase<?> gui, int x) {
|
||||||
return gui.getGuiLeft() + x;
|
return gui.getGuiLeft() + x;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class FluidConfigPopupElement extends AbstractConfigPopupElement {
|
||||||
case ALL -> new Color(52, 255, 30, 128);
|
case ALL -> new Color(52, 255, 30, 128);
|
||||||
};
|
};
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
GuiUtil.drawGradientRect(drawContext.getMatrices(), sx, sy, 18, 18, color.getColor(), color.getColor());
|
GuiUtil.drawGradientRect(drawContext, sx, sy, 18, 18, color.getColor(), color.getColor());
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class SlotConfigPopupElement extends AbstractConfigPopupElement {
|
||||||
default -> new Color(0, 0, 0, 0);
|
default -> new Color(0, 0, 0, 0);
|
||||||
};
|
};
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
GuiUtil.drawGradientRect(drawContext.getMatrices(), sx, sy, 18, 18, color.getColor(), color.getColor());
|
GuiUtil.drawGradientRect(drawContext, sx, sy, 18, 18, color.getColor(), color.getColor());
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,14 +33,9 @@ import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
|
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
|
||||||
import net.minecraft.client.gui.widget.EntryListWidget;
|
import net.minecraft.client.gui.widget.EntryListWidget;
|
||||||
import net.minecraft.client.render.BufferBuilder;
|
|
||||||
import net.minecraft.client.render.Tessellator;
|
|
||||||
import net.minecraft.client.render.VertexFormat;
|
|
||||||
import net.minecraft.client.render.VertexFormats;
|
|
||||||
import net.minecraft.client.texture.Sprite;
|
import net.minecraft.client.texture.Sprite;
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.screen.PlayerScreenHandler;
|
|
||||||
import net.minecraft.text.Text;
|
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;
|
||||||
|
@ -88,8 +83,6 @@ public class GuiBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawPlayerSlots(DrawContext drawContext, Screen gui, int posX, int posY, boolean center) {
|
public void drawPlayerSlots(DrawContext drawContext, Screen gui, int posX, int posY, boolean center) {
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
|
|
||||||
if (center) {
|
if (center) {
|
||||||
posX -= 81;
|
posX -= 81;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +99,6 @@ public class GuiBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawSlot(DrawContext drawContext, Screen gui, int posX, int posY) {
|
public void drawSlot(DrawContext drawContext, Screen gui, int posX, int posY) {
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
drawContext.drawTexture(resourceLocation, posX, posY, 150, 0, 18, 18);
|
drawContext.drawTexture(resourceLocation, posX, posY, 150, 0, 18, 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +107,6 @@ public class GuiBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawProgressBar(DrawContext drawContext, GuiBase<?> gui, double progress, int x, int y) {
|
public void drawProgressBar(DrawContext drawContext, GuiBase<?> gui, double progress, int x, int y) {
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
drawContext.drawTexture(resourceLocation, x, y, 150, 18, 22, 15);
|
drawContext.drawTexture(resourceLocation, x, y, 150, 18, 22, 15);
|
||||||
int j = (int) (progress);
|
int j = (int) (progress);
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
|
@ -124,7 +115,6 @@ public class GuiBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawOutputSlot(DrawContext drawContext, GuiBase<?> gui, int x, int y) {
|
public void drawOutputSlot(DrawContext drawContext, GuiBase<?> gui, int x, int y) {
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
drawContext.drawTexture(resourceLocation, x, y, 174, 0, 26, 26);
|
drawContext.drawTexture(resourceLocation, x, y, 174, 0, 26, 26);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +133,6 @@ public class GuiBuilder {
|
||||||
x += gui.getGuiLeft();
|
x += gui.getGuiLeft();
|
||||||
y += gui.getGuiTop();
|
y += gui.getGuiTop();
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
drawContext.drawTexture(resourceLocation, x, y, 202, 0, 12, 12);
|
drawContext.drawTexture(resourceLocation, x, y, 202, 0, 12, 12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +154,6 @@ public class GuiBuilder {
|
||||||
x += gui.getGuiLeft();
|
x += gui.getGuiLeft();
|
||||||
y += gui.getGuiTop();
|
y += gui.getGuiTop();
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
drawContext.drawTexture(resourceLocation, x, y, 174, 26 + (locked ? 12 : 0), 20, 12);
|
drawContext.drawTexture(resourceLocation, x, y, 174, 26 + (locked ? 12 : 0), 20, 12);
|
||||||
if (gui.isPointInRect(x, y, 20, 12, mouseX, mouseY)) {
|
if (gui.isPointInRect(x, y, 20, 12, mouseX, mouseY)) {
|
||||||
List<Text> list = new ArrayList<>();
|
List<Text> list = new ArrayList<>();
|
||||||
|
@ -194,7 +182,6 @@ public class GuiBuilder {
|
||||||
x += gui.getGuiLeft();
|
x += gui.getGuiLeft();
|
||||||
y += gui.getGuiTop();
|
y += gui.getGuiTop();
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
if (gui.getMachine().renderMultiblock) {
|
if (gui.getMachine().renderMultiblock) {
|
||||||
drawContext.drawTexture(resourceLocation, x, y, 174, 62, 20, 12);
|
drawContext.drawTexture(resourceLocation, x, y, 174, 62, 20, 12);
|
||||||
} else {
|
} else {
|
||||||
|
@ -227,7 +214,6 @@ public class GuiBuilder {
|
||||||
x += gui.getGuiLeft();
|
x += gui.getGuiLeft();
|
||||||
y += gui.getGuiTop();
|
y += gui.getGuiTop();
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
drawContext.drawTexture(resourceLocation, x, y, 26, 218, 114, 18);
|
drawContext.drawTexture(resourceLocation, x, y, 26, 218, 114, 18);
|
||||||
if (value != 0) {
|
if (value != 0) {
|
||||||
int j = (int) ((double) value / (double) max * 106);
|
int j = (int) ((double) value / (double) max * 106);
|
||||||
|
@ -264,7 +250,6 @@ public class GuiBuilder {
|
||||||
x += gui.getGuiLeft();
|
x += gui.getGuiLeft();
|
||||||
y += gui.getGuiTop();
|
y += gui.getGuiTop();
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
int j = (int) ((double) value / (double) max * 106);
|
int j = (int) ((double) value / (double) max * 106);
|
||||||
if (j < 0) {
|
if (j < 0) {
|
||||||
j = 0;
|
j = 0;
|
||||||
|
@ -317,8 +302,6 @@ public class GuiBuilder {
|
||||||
mouseY -= gui.getGuiTop();
|
mouseY -= gui.getGuiTop();
|
||||||
}
|
}
|
||||||
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
||||||
//RenderSystem.disableLighting();
|
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,12 +328,11 @@ public class GuiBuilder {
|
||||||
x += gui.getGuiLeft();
|
x += gui.getGuiLeft();
|
||||||
y += gui.getGuiTop();
|
y += gui.getGuiTop();
|
||||||
}
|
}
|
||||||
//RenderSystem.disableLighting();
|
|
||||||
RenderSystem.enableDepthTest();
|
RenderSystem.enableDepthTest();
|
||||||
RenderSystem.colorMask(true, true, true, false);
|
RenderSystem.colorMask(true, true, true, false);
|
||||||
RenderUtil.drawGradientRect(drawContext.getMatrices(), 0, x, y, x + 176, y + 20, 0x000000, 0xC0000000);
|
RenderUtil.drawGradientRect(drawContext, 0, x, y, x + 176, y + 20, 0x000000, 0xC0000000);
|
||||||
RenderUtil.drawGradientRect(drawContext.getMatrices(), 0, x, y + 20, x + 176, y + 20 + 48, 0xC0000000, 0xC0000000);
|
RenderUtil.drawGradientRect(drawContext, 0, x, y + 20, x + 176, y + 20 + 48, 0xC0000000, 0xC0000000);
|
||||||
RenderUtil.drawGradientRect(drawContext.getMatrices(), 0, 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.colorMask(true, true, true, true);
|
||||||
RenderSystem.disableDepthTest();
|
RenderSystem.disableDepthTest();
|
||||||
gui.drawCentredText(drawContext, Text.translatable("reborncore.gui.missingmultiblock"), 43, 0xFFFFFF, layer);
|
gui.drawCentredText(drawContext, Text.translatable("reborncore.gui.missingmultiblock"), 43, 0xFFFFFF, layer);
|
||||||
|
@ -365,7 +347,6 @@ public class GuiBuilder {
|
||||||
* @param y {@code int} Top left corner where to place slots
|
* @param y {@code int} Top left corner where to place slots
|
||||||
*/
|
*/
|
||||||
public void drawUpgrades(DrawContext drawContext, GuiBase<?> gui, int x, int y) {
|
public void drawUpgrades(DrawContext drawContext, GuiBase<?> gui, int x, int y) {
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
drawContext.drawTexture(resourceLocation, x, y, 217, 0, 24, 81);
|
drawContext.drawTexture(resourceLocation, x, y, 217, 0, 24, 81);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,7 +381,6 @@ public class GuiBuilder {
|
||||||
TipsListWidget explanation = new TipsListWidget(gui, gui.getScreenWidth() - 14, 54, y, y + 76, 9 + 2, tips);
|
TipsListWidget explanation = new TipsListWidget(gui, gui.getScreenWidth() - 14, 54, y, y + 76, 9 + 2, tips);
|
||||||
explanation.setLeftPos(x - 81);
|
explanation.setLeftPos(x - 81);
|
||||||
explanation.render(drawContext, mouseX, mouseY, 1.0f);
|
explanation.render(drawContext, mouseX, mouseY, 1.0f);
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -420,22 +400,11 @@ public class GuiBuilder {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderBackground(DrawContext drawContext) {
|
protected void renderBackground(DrawContext drawContext) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) {
|
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) {
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
drawContext.fill(this.left, this.top, this.right, this.bottom, 0xff202020); //
|
||||||
BufferBuilder bufferBuilder = tessellator.getBuffer();
|
|
||||||
RenderSystem.setShaderTexture(0, Screen.OPTIONS_BACKGROUND_TEXTURE);
|
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
|
|
||||||
bufferBuilder.vertex(this.left, this.bottom, 0.0D).texture((float) this.left / 32.0F, (float) (this.bottom + (int) this.getScrollAmount()) / 32.0F).color(32, 32, 32, 255).next();
|
|
||||||
bufferBuilder.vertex(this.right, this.bottom, 0.0D).texture((float) this.right / 32.0F, (float) (this.bottom + (int) this.getScrollAmount()) / 32.0F).color(32, 32, 32, 255).next();
|
|
||||||
bufferBuilder.vertex(this.right, this.top, 0.0D).texture((float) this.right / 32.0F, (float) (this.top + (int) this.getScrollAmount()) / 32.0F).color(32, 32, 32, 255).next();
|
|
||||||
bufferBuilder.vertex(this.left, this.top, 0.0D).texture((float) this.left / 32.0F, (float) (this.top + (int) this.getScrollAmount()) / 32.0F).color(32, 32, 32, 255).next();
|
|
||||||
tessellator.draw();
|
|
||||||
|
|
||||||
super.renderList(drawContext, mouseX, mouseY, delta);
|
super.renderList(drawContext, mouseX, mouseY, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,7 +451,6 @@ public class GuiBuilder {
|
||||||
x += gui.getGuiLeft();
|
x += gui.getGuiLeft();
|
||||||
y += gui.getGuiTop();
|
y += gui.getGuiTop();
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
drawContext.drawTexture(resourceLocation, x, y, 150, 91, 16, 16);
|
drawContext.drawTexture(resourceLocation, x, y, 150, 91, 16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,7 +474,6 @@ public class GuiBuilder {
|
||||||
y += gui.getGuiTop();
|
y += gui.getGuiTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
drawContext.drawTexture(resourceLocation, x, y, direction.x, direction.y, direction.width, direction.height);
|
drawContext.drawTexture(resourceLocation, x, y, direction.x, direction.y, direction.width, direction.height);
|
||||||
int j = (int) ((double) progress / (double) maxProgress * 16);
|
int j = (int) ((double) progress / (double) maxProgress * 16);
|
||||||
if (j < 0) {
|
if (j < 0) {
|
||||||
|
@ -543,8 +510,6 @@ public class GuiBuilder {
|
||||||
mouseY -= gui.getGuiTop();
|
mouseY -= gui.getGuiTop();
|
||||||
}
|
}
|
||||||
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
||||||
//RenderSystem.disableLighting();
|
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,7 +535,6 @@ public class GuiBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
EnergySystem displayPower = PowerSystem.getDisplayPower();
|
EnergySystem displayPower = PowerSystem.getDisplayPower();
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
drawContext.drawTexture(resourceLocation, x, y, displayPower.xBar - 15, displayPower.yBar - 1, 14, 50);
|
drawContext.drawTexture(resourceLocation, x, y, displayPower.xBar - 15, displayPower.yBar - 1, 14, 50);
|
||||||
int draw = (int) ((double) energyStored / (double) maxEnergyStored * (48));
|
int draw = (int) ((double) energyStored / (double) maxEnergyStored * (48));
|
||||||
if (energyStored > maxEnergyStored) {
|
if (energyStored > maxEnergyStored) {
|
||||||
|
@ -624,8 +588,6 @@ public class GuiBuilder {
|
||||||
mouseY -= gui.getGuiTop();
|
mouseY -= gui.getGuiTop();
|
||||||
}
|
}
|
||||||
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
||||||
//RenderSystem.disableLighting();
|
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,7 +617,6 @@ public class GuiBuilder {
|
||||||
amount = fluid.getAmount();
|
amount = fluid.getAmount();
|
||||||
percentage = percentage(maxCapacity.getRawValue(), amount.getRawValue());
|
percentage = percentage(maxCapacity.getRawValue(), amount.getRawValue());
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
drawContext.drawTexture(resourceLocation, x, y, 194, 26, 22, 56);
|
drawContext.drawTexture(resourceLocation, x, y, 194, 26, 22, 56);
|
||||||
if (!isTankEmpty) {
|
if (!isTankEmpty) {
|
||||||
drawFluid(drawContext, gui, fluid, x + 4, y + 4, 14, 48, maxCapacity.getRawValue());
|
drawFluid(drawContext, gui, fluid, x + 4, y + 4, 14, 48, maxCapacity.getRawValue());
|
||||||
|
@ -687,8 +648,6 @@ public class GuiBuilder {
|
||||||
mouseY -= gui.getGuiTop();
|
mouseY -= gui.getGuiTop();
|
||||||
}
|
}
|
||||||
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
||||||
//RenderSystem.disableLighting();
|
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -707,7 +666,6 @@ public class GuiBuilder {
|
||||||
if (fluid.getFluid() == Fluids.EMPTY) {
|
if (fluid.getFluid() == Fluids.EMPTY) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
|
||||||
y += height;
|
y += height;
|
||||||
final Sprite sprite = FluidVariantRendering.getSprite(fluid.getVariant());
|
final Sprite sprite = FluidVariantRendering.getSprite(fluid.getVariant());
|
||||||
int color = FluidVariantRendering.getColor(fluid.getVariant());
|
int color = FluidVariantRendering.getColor(fluid.getVariant());
|
||||||
|
@ -716,7 +674,7 @@ public class GuiBuilder {
|
||||||
final int iconHeight = sprite.getContents().getHeight();
|
final int iconHeight = sprite.getContents().getHeight();
|
||||||
int offsetHeight = drawHeight;
|
int offsetHeight = drawHeight;
|
||||||
|
|
||||||
RenderSystem.setShaderColor((color >> 16 & 255) / 255.0F, (float) (color >> 8 & 255) / 255.0F, (float) (color & 255) / 255.0F, 1F);
|
drawContext.setShaderColor((color >> 16 & 255) / 255.0F, (float) (color >> 8 & 255) / 255.0F, (float) (color & 255) / 255.0F, 1F);
|
||||||
|
|
||||||
int iteration = 0;
|
int iteration = 0;
|
||||||
while (offsetHeight != 0) {
|
while (offsetHeight != 0) {
|
||||||
|
@ -729,9 +687,6 @@ public class GuiBuilder {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderColor(1F, 1F, 1F, 1F);
|
|
||||||
|
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -752,7 +707,6 @@ public class GuiBuilder {
|
||||||
x += gui.getGuiLeft();
|
x += gui.getGuiLeft();
|
||||||
y += gui.getGuiTop();
|
y += gui.getGuiTop();
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
drawContext.drawTexture(resourceLocation, x, y, 150, 64, 13, 13);
|
drawContext.drawTexture(resourceLocation, x, y, 150, 64, 13, 13);
|
||||||
int j = 13 - (int) ((double) progress / (double) maxProgress * 13);
|
int j = 13 - (int) ((double) progress / (double) maxProgress * 13);
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
|
@ -768,8 +722,6 @@ public class GuiBuilder {
|
||||||
mouseY -= gui.getGuiTop();
|
mouseY -= gui.getGuiTop();
|
||||||
}
|
}
|
||||||
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
||||||
//RenderSystem.disableLighting();
|
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -782,7 +734,6 @@ public class GuiBuilder {
|
||||||
* @param count {@code int} Number of output slots
|
* @param count {@code int} Number of output slots
|
||||||
*/
|
*/
|
||||||
public void drawOutputSlotBar(DrawContext drawContext, GuiBase<?> gui, int x, int y, int count) {
|
public void drawOutputSlotBar(DrawContext drawContext, GuiBase<?> gui, int x, int y, int count) {
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
|
||||||
drawContext.drawTexture(resourceLocation, x, y, 150, 122, 3, 26);
|
drawContext.drawTexture(resourceLocation, x, y, 150, 122, 3, 26);
|
||||||
x += 3;
|
x += 3;
|
||||||
for (int i = 1; i <= count; i++) {
|
for (int i = 1; i <= count; i++) {
|
||||||
|
|
Loading…
Reference in a new issue