Some simple fixes

This commit is contained in:
modmuss50 2023-05-13 13:46:48 +01:00 committed by modmuss
parent 08f75889ec
commit 2f07306d90
6 changed files with 13 additions and 5 deletions

View file

@ -58,7 +58,7 @@ public class ItemStackRenderer implements HudRenderCallback {
if (!ItemStackRenderManager.RENDER_QUEUE.isEmpty()) { if (!ItemStackRenderManager.RENDER_QUEUE.isEmpty()) {
ItemStack itemStack = ItemStackRenderManager.RENDER_QUEUE.remove(); ItemStack itemStack = ItemStackRenderManager.RENDER_QUEUE.remove();
Identifier id = Registries.ITEM.getId(itemStack.getItem()); Identifier id = Registries.ITEM.getId(itemStack.getItem());
drawContext.drawText(MinecraftClient.getInstance().textRenderer, "Rendering " + id + ", " + ItemStackRenderManager.RENDER_QUEUE.size() + " items left", 5, 5, -1, true); drawContext.drawText(MinecraftClient.getInstance().textRenderer, "Rendering " + id + ", " + ItemStackRenderManager.RENDER_QUEUE.size() + " items left", 5, 5, -1, false);
export(id, itemStack); export(id, itemStack);
} }
} }

View file

@ -305,7 +305,7 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
factorX = this.x; factorX = this.x;
factorY = this.y; factorY = this.y;
} }
drawContext.drawText(MinecraftClient.getInstance().textRenderer, text, x + factorX, y + factorY, colour, true); drawContext.drawText(MinecraftClient.getInstance().textRenderer, text, x + factorX, y + factorY, colour, false);
RenderSystem.setShaderColor(1F, 1F, 1F, 1F); RenderSystem.setShaderColor(1F, 1F, 1F, 1F);
} }

View file

@ -52,7 +52,7 @@ public class RedstoneConfigGui {
int spread = configuration.getElements().size() == 3 ? 27 : 18; int spread = configuration.getElements().size() == 3 ? 27 : 18;
for (RedstoneConfiguration.Element element : configuration.getElements()) { for (RedstoneConfiguration.Element element : configuration.getElements()) {
drawContext.drawItem(element.getIcon(), x - 3, y + (i * spread) - 5); drawContext.drawItem(element.getIcon(), x - 3, y + (i * spread) - 5);
drawContext.drawText(guiBase.getTextRenderer(), Text.translatable("reborncore.gui.fluidconfig." + element.getName()), x + 15, y + (i * spread), -1, true); drawContext.drawText(guiBase.getTextRenderer(), Text.translatable("reborncore.gui.fluidconfig." + element.getName()), x + 15, y + (i * spread), -1, false);
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;

View file

@ -298,7 +298,7 @@ public class ElementBase {
public void drawText(DrawContext drawContext, GuiBase<?> gui, Text text, int x, int y, int color) { public void drawText(DrawContext drawContext, GuiBase<?> gui, Text text, int x, int y, int color) {
x = adjustX(gui, x); x = adjustX(gui, x);
y = adjustY(gui, y); y = adjustY(gui, y);
drawContext.drawText(gui.getTextRenderer(), text, x, y, color, true); drawContext.drawText(gui.getTextRenderer(), text, x, y, color, false);
} }
public void drawSprite(DrawContext drawContext, GuiBase<?> gui, ISprite iSprite, int x, int y) { public void drawSprite(DrawContext drawContext, GuiBase<?> gui, ISprite iSprite, int x, int y) {

View file

@ -111,7 +111,7 @@ public class GuiBuilder {
} }
public void drawText(DrawContext drawContext, GuiBase<?> gui, Text text, int x, int y, int color) { public void drawText(DrawContext drawContext, GuiBase<?> gui, Text text, int x, int y, int color) {
drawContext.drawText(gui.getTextRenderer(), text, x, y, color, true); drawContext.drawText(gui.getTextRenderer(), text, x, y, color, false);
} }
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) {

View file

@ -25,6 +25,7 @@
package techreborn.client.gui; package techreborn.client.gui;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
@ -56,6 +57,11 @@ public class GuiIDSU extends GuiBase<BuiltScreenHandler> {
super.drawForeground(drawContext, mouseX, mouseY); super.drawForeground(drawContext, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND; final Layer layer = Layer.FOREGROUND;
MatrixStack matrices = drawContext.getMatrices();
matrices.push();
matrices.scale(0.6f, 0.6f, 1.0f);
Text text = Text.literal(PowerSystem.getLocalizedPowerNoSuffix(idsu.getEnergy())) Text text = Text.literal(PowerSystem.getLocalizedPowerNoSuffix(idsu.getEnergy()))
.append("/") .append("/")
.append(PowerSystem.getLocalizedPowerNoSuffix(idsu.getMaxStoredPower())) .append(PowerSystem.getLocalizedPowerNoSuffix(idsu.getMaxStoredPower()))
@ -64,6 +70,8 @@ public class GuiIDSU extends GuiBase<BuiltScreenHandler> {
drawCentredText(drawContext, text, 35, 0, 58, layer); drawCentredText(drawContext, text, 35, 0, 58, layer);
matrices.pop();
builder.drawMultiEnergyBar(drawContext, this, 81, 28, (int) idsu.getEnergy(), (int) idsu.getMaxStoredPower(), mouseX, mouseY, 0, layer); builder.drawMultiEnergyBar(drawContext, this, 81, 28, (int) idsu.getEnergy(), (int) idsu.getMaxStoredPower(), mouseX, mouseY, 0, layer);
} }