chore: ported most parts of the Gui's

This commit is contained in:
Michael Hillcox 2021-03-01 19:55:50 +00:00
parent 4dfe0e04bb
commit dcdac11e2b
37 changed files with 391 additions and 356 deletions

View file

@ -21,7 +21,7 @@ public class TrialsButton extends TexturedButton {
private final boolean isTrials; private final boolean isTrials;
public TrialsButton(GuiBooklet gui) { public TrialsButton(GuiBooklet gui) {
super(GuiBooklet.RES_LOC_GADGETS, -152000, gui.getGuiLeft() + gui.getSizeX(), gui.getGuiTop() + 10, 0, 204, 52, 16); super(GuiBooklet.RES_LOC_GADGETS, gui.getGuiLeft() + gui.getSizeX(), gui.getGuiTop() + 10, 0, 204, 52, 16, );
this.isTrials = gui.areTrialsOpened(); this.isTrials = gui.areTrialsOpened();
this.active = !this.isTrials; this.active = !this.isTrials;
} }

View file

@ -96,19 +96,19 @@ public abstract class GuiBooklet extends GuiBookletBase {
if (this.hasPageLeftButton()) { if (this.hasPageLeftButton()) {
List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Previous Page", TextFormatting.ITALIC + "Or scroll up"); List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Previous Page", TextFormatting.ITALIC + "Or scroll up");
this.buttonLeft = new TexturedButton(RES_LOC_GADGETS, -2000, this.guiLeft - 12, this.guiTop + this.ySize - 8, 18, 54, 18, 10, hoverText); this.buttonLeft = new TexturedButton(RES_LOC_GADGETS, this.guiLeft - 12, this.guiTop + this.ySize - 8, 18, 54, 18, 10, hoverText, );
this.addButton(this.buttonLeft); this.addButton(this.buttonLeft);
} }
if (this.hasPageRightButton()) { if (this.hasPageRightButton()) {
List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Next Page", TextFormatting.ITALIC + "Or scroll down"); List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Next Page", TextFormatting.ITALIC + "Or scroll down");
this.buttonRight = new TexturedButton(RES_LOC_GADGETS, -2001, this.guiLeft + this.xSize - 6, this.guiTop + this.ySize - 8, 0, 54, 18, 10, hoverText); this.buttonRight = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + this.xSize - 6, this.guiTop + this.ySize - 8, 0, 54, 18, 10, hoverText, );
this.addButton(this.buttonRight); this.addButton(this.buttonRight);
} }
if (this.hasBackButton()) { if (this.hasBackButton()) {
List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Go Back", TextFormatting.ITALIC + "Or right-click", TextFormatting.ITALIC.toString() + TextFormatting.GRAY + "Hold Shift for Main Page"); List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Go Back", TextFormatting.ITALIC + "Or right-click", TextFormatting.ITALIC.toString() + TextFormatting.GRAY + "Hold Shift for Main Page");
this.buttonBack = new TexturedButton(RES_LOC_GADGETS, -2002, this.guiLeft - 15, this.guiTop - 3, 36, 54, 18, 10, hoverText); this.buttonBack = new TexturedButton(RES_LOC_GADGETS, this.guiLeft - 15, this.guiTop - 3, 36, 54, 18, 10, hoverText, );
this.addButton(this.buttonBack); this.addButton(this.buttonBack);
} }

View file

@ -135,7 +135,7 @@ public class GuiMainPage extends GuiBooklet {
List<String> configText = new ArrayList<>(); List<String> configText = new ArrayList<>();
configText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".configButton.name")); configText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".configButton.name"));
configText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".configButton.desc", ActuallyAdditions.NAME).replaceAll("\\\\n", "\n"), 200)); configText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".configButton.desc", ActuallyAdditions.NAME).replaceAll("\\\\n", "\n"), 200));
this.configButton = new TexturedButton(RES_LOC_GADGETS, -388, this.guiLeft + 16, this.guiTop + this.ySize - 30, 188, 14, 16, 16, configText); this.configButton = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + 16, this.guiTop + this.ySize - 30, 188, 14, 16, 16, configText, );
this.addButton(this.configButton); this.addButton(this.configButton);
List<String> achievementText = new ArrayList<>(); List<String> achievementText = new ArrayList<>();

View file

@ -117,7 +117,7 @@ public class GuiPage extends GuiBooklet {
List<String> links = this.getWebLinks(); List<String> links = this.getWebLinks();
if (links != null && !links.isEmpty()) { if (links != null && !links.isEmpty()) {
this.buttonViewOnline = new TexturedButton(RES_LOC_GADGETS, -782822, this.guiLeft + this.xSize - 24, this.guiTop + this.ySize - 25, 0, 172, 16, 16, Collections.singletonList(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".onlineButton.name"))); this.buttonViewOnline = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + this.xSize - 24, this.guiTop + this.ySize - 25, 0, 172, 16, 16, Collections.singletonList(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".onlineButton.name")), );
this.addButton(this.buttonViewOnline); this.addButton(this.buttonViewOnline);
} }

View file

@ -10,20 +10,24 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage; import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class EnergyDisplay extends Gui { public class EnergyDisplay extends AbstractGui {
private CustomEnergyStorage rfReference; private CustomEnergyStorage rfReference;
private int x; private int x;
@ -47,7 +51,7 @@ public class EnergyDisplay extends Gui {
this.drawTextNextTo = drawTextNextTo; this.drawTextNextTo = drawTextNextTo;
} }
public void draw() { public void draw(MatrixStack matrices) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
@ -66,9 +70,9 @@ public class EnergyDisplay extends Gui {
int i = this.rfReference.getEnergyStored() * 83 / this.rfReference.getMaxEnergyStored(); int i = this.rfReference.getEnergyStored() * 83 / this.rfReference.getMaxEnergyStored();
float[] color = AssetUtil.getWheelColor(mc.world.getTotalWorldTime() % 256); float[] color = AssetUtil.getWheelColor(mc.world.getTotalWorldTime() % 256);
GlStateManager.color(color[0] / 255F, color[1] / 255F, color[2] / 255F); RenderSystem.color4f(color[0] / 255F, color[1] / 255F, color[2] / 255F);
this.blit(matrices, barX + 1, barY + 84 - i, 36, 172, 16, i); this.blit(matrices, barX + 1, barY + 84 - i, 36, 172, 16, i);
GlStateManager.color(1F, 1F, 1F); RenderSystem.color4f(1F, 1F, 1F);
} }
if (this.drawTextNextTo) { if (this.drawTextNextTo) {
@ -76,7 +80,7 @@ public class EnergyDisplay extends Gui {
} }
} }
public void drawOverlay(int mouseX, int mouseY) { public void render(MatrixStack matrices, int mouseX, int mouseY) {
if (this.isMouseOver(mouseX, mouseY)) { if (this.isMouseOver(mouseX, mouseY)) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();

View file

@ -15,7 +15,9 @@ import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiInputter.SmallerButton;
import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; import de.ellpeck.actuallyadditions.mod.tile.FilterSettings;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -26,7 +28,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class FilterSettingsGui extends Gui { public class FilterSettingsGui extends AbstractGui {
private final FilterSettings theSettings; private final FilterSettings theSettings;
@ -54,48 +56,48 @@ public class FilterSettingsGui extends Gui {
this.modButton = new SmallerButton(this.theSettings.modButtonId, x, y, "", true); this.modButton = new SmallerButton(this.theSettings.modButtonId, x, y, "", true);
buttonList.add(this.modButton); buttonList.add(this.modButton);
this.update(); this.tick();
} }
public void update() { public void tick() {
this.whitelistButton.displayString = (this.theSettings.isWhitelist this.whitelistButton.setMessage(new StringTextComponent("WH").mergeStyle(this.theSettings.isWhitelist
? TextFormatting.DARK_GREEN ? TextFormatting.DARK_GREEN
: TextFormatting.RED) + "WH"; : TextFormatting.RED));
this.metaButton.displayString = (this.theSettings.respectMeta this.whitelistButton.setMessage(new StringTextComponent("ME").mergeStyle(this.theSettings.respectMeta
? TextFormatting.DARK_GREEN ? TextFormatting.DARK_GREEN
: TextFormatting.RED) + "ME"; : TextFormatting.RED));
this.nbtButton.displayString = (this.theSettings.respectNBT this.whitelistButton.setMessage(new StringTextComponent("NB").mergeStyle(this.theSettings.respectNBT
? TextFormatting.DARK_GREEN ? TextFormatting.DARK_GREEN
: TextFormatting.RED) + "NB"; : TextFormatting.RED));
this.modButton.displayString = (this.theSettings.respectMod this.whitelistButton.setMessage(new StringTextComponent("MO").mergeStyle(this.theSettings.respectMod
? TextFormatting.DARK_GREEN
: TextFormatting.RED));
this.whitelistButton.setMessage(new StringTextComponent("OR").mergeStyle(this.theSettings.respectOredict == 0
? TextFormatting.DARK_GREEN ? TextFormatting.DARK_GREEN
: TextFormatting.RED) + "MO";
this.oredictButton.displayString = (this.theSettings.respectOredict == 0
? TextFormatting.RED
: this.theSettings.respectOredict == 1 : this.theSettings.respectOredict == 1
? TextFormatting.GREEN ? TextFormatting.GREEN
: TextFormatting.DARK_GREEN) + "OR"; : TextFormatting.DARK_GREEN));
} }
public void drawHover(int mouseX, int mouseY) { public void drawHover(int mouseX, int mouseY) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
if (this.whitelistButton.isMouseOver()) { if (this.whitelistButton.isMouseOver(mouseX, mouseY)) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
list.add(TextFormatting.BOLD + (this.theSettings.isWhitelist list.add(TextFormatting.BOLD + (this.theSettings.isWhitelist
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.whitelist") ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.whitelist")
: StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.blacklist"))); : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.blacklist")));
list.addAll(mc.fontRenderer.listFormattedStringToWidth(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".gui.whitelistInfo"), 200)); list.addAll(mc.fontRenderer.listFormattedStringToWidth(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".gui.whitelistInfo"), 200));
GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer);
} else if (this.metaButton.isMouseOver()) { } else if (this.metaButton.isMouseOver(mouseX, mouseY)) {
GuiUtils.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.theSettings.respectMeta GuiUtils.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.theSettings.respectMeta
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectMeta") ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectMeta")
: StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreMeta"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreMeta"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer);
} else if (this.nbtButton.isMouseOver()) { } else if (this.nbtButton.isMouseOver(mouseX, mouseY)) {
GuiUtils.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.theSettings.respectNBT GuiUtils.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.theSettings.respectNBT
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectNBT") ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectNBT")
: StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreNBT"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreNBT"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer);
} else if (this.modButton.isMouseOver()) { } else if (this.modButton.isMouseOver(mouseX, mouseY)) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
list.add(TextFormatting.BOLD + (this.theSettings.respectMod list.add(TextFormatting.BOLD + (this.theSettings.respectMod
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectMod") ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectMod")

View file

@ -10,21 +10,25 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.AbstractGui;
import net.minecraft.fluid.Fluid;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.capability.templates.FluidTank;
import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.client.gui.GuiUtils;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.Collections; import java.util.Collections;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class FluidDisplay extends Gui { public class FluidDisplay extends AbstractGui {
private FluidTank fluidReference; private FluidTank fluidReference;
private Fluid oldFluid; private Fluid oldFluid;
@ -53,7 +57,7 @@ public class FluidDisplay extends Gui {
this.drawTextNextTo = drawTextNextTo; this.drawTextNextTo = drawTextNextTo;
} }
public void draw() { public void draw(MatrixStack matrices) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
@ -100,7 +104,7 @@ public class FluidDisplay extends Gui {
} }
} }
public void drawOverlay(int mouseX, int mouseY) { public void render(MatrixStack matrices, int mouseX, int mouseY) {
if (mouseX >= this.x && mouseY >= this.y && mouseX < this.x + (this.outline if (mouseX >= this.x && mouseY >= this.y && mouseX < this.x + (this.outline
? 26 ? 26
: 18) && mouseY < this.y + (this.outline : 18) && mouseY < this.y + (this.outline

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerBag; import de.ellpeck.actuallyadditions.mod.inventory.ContainerBag;
import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer; import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer;
@ -71,7 +70,7 @@ public class GuiBag extends GuiWtfMojang<ContainerBag> {
@Override @Override
public void updateScreen() { public void updateScreen() {
super.updateScreen(); super.updateScreen();
this.filter.update(); this.filter.tick();
this.buttonAutoInsert.displayString = (this.container.autoInsert this.buttonAutoInsert.displayString = (this.container.autoInsert
? TextFormatting.DARK_GREEN ? TextFormatting.DARK_GREEN
@ -103,7 +102,7 @@ public class GuiBag extends GuiWtfMojang<ContainerBag> {
@Override @Override
protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) { protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) {
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrixStack, this.guiLeft, this.guiTop + 90, 0, 0, 176, 86); this.blit(matrixStack, this.guiLeft, this.guiTop + 90, 0, 0, 176, 86);

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerBioReactor; import de.ellpeck.actuallyadditions.mod.inventory.ContainerBioReactor;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -38,19 +39,19 @@ public class GuiBioReactor extends GuiWtfMojang<ContainerBioReactor> {
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
super.drawScreen(x, y, f); super.render(matrices, mouseX, mouseY, partialTicks);
this.energy.drawOverlay(x, y); this.energy.render(mouseX, mouseY);
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.tile); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tile);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float partialTicks, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
@ -64,7 +65,7 @@ public class GuiBioReactor extends GuiWtfMojang<ContainerBioReactor> {
} }
if (this.tile.producePerTick > 0) { if (this.tile.producePerTick > 0) {
this.drawCenteredString(this.font, this.tile.producePerTick + " " + I18n.format("actuallyadditions.cft"), this.guiLeft + 87, this.guiTop + 86, 0xFFFFFF); drawCenteredString(matrices, this.font, this.tile.producePerTick + " " + I18n.format("actuallyadditions.cft"), this.guiLeft + 87, this.guiTop + 86, 0xFFFFFF);
} }
this.energy.draw(); this.energy.draw();

View file

@ -10,7 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCanolaPress; import de.ellpeck.actuallyadditions.mod.inventory.ContainerCanolaPress;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -43,21 +43,21 @@ public class GuiCanolaPress extends GuiWtfMojang<ContainerCanolaPress> {
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.drawScreen(x, y, f); super.render(matrices, x, y, f);
this.energy.drawOverlay(x, y); this.energy.render(matrices, x, y);
this.fluid.drawOverlay(x, y); this.fluid.render(matrices, x, y);
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.press); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.press);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
@ -70,7 +70,7 @@ public class GuiCanolaPress extends GuiWtfMojang<ContainerCanolaPress> {
this.blit(matrices, this.guiLeft + 83, this.guiTop + 32, 176, 0, 12, i); this.blit(matrices, this.guiLeft + 83, this.guiTop + 32, 176, 0, 12, i);
} }
this.energy.draw(); this.energy.draw(matrices);
this.fluid.draw(); this.fluid.draw(matrices);
} }
} }

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoalGenerator; import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoalGenerator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -17,7 +18,7 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiCoalGenerator extends GuiWtfMojang<ContainerCoalGenerator> { public class GuiCoalGenerator extends GuiWtfMojang<ContainerCoalGenerator> {
@ -40,19 +41,19 @@ public class GuiCoalGenerator extends GuiWtfMojang<ContainerCoalGenerator> {
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.drawScreen(x, y, f); super.render(matrices, x, y, f);
this.energy.drawOverlay(x, y); this.energy.render(matrices, x, y);
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.generator); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.generator);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
@ -65,6 +66,6 @@ public class GuiCoalGenerator extends GuiWtfMojang<ContainerCoalGenerator> {
this.blit(matrices, this.guiLeft + 87, this.guiTop + 27 + 12 - i, 176, 96 - i, 14, i); this.blit(matrices, this.guiLeft + 87, this.guiTop + 27 + 12 - i, 176, 96 - i, 14, i);
} }
this.energy.draw(); this.energy.draw(matrices);
} }
} }

View file

@ -10,16 +10,20 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoffeeMachine; import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.Collections; import java.util.Collections;
@ -43,7 +47,7 @@ public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
public void init() { public void init() {
super.init(); super.init();
Button buttonOkay = new Button(0, this.guiLeft + 60, this.guiTop + 11, 58, 20, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ok")); Button buttonOkay = new Button(this.guiLeft + 60, this.guiTop + 11, 58, 20, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ok"));
this.addButton(buttonOkay); this.addButton(buttonOkay);
this.energy = new EnergyDisplay(this.guiLeft + 16, this.guiTop + 5, this.machine.storage); this.energy = new EnergyDisplay(this.guiLeft + 16, this.guiTop + 5, this.machine.storage);
@ -51,26 +55,26 @@ public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.drawScreen(x, y, f); super.render(matrices, x, y, f);
String text2 = this.machine.coffeeCacheAmount + "/" + TileEntityCoffeeMachine.COFFEE_CACHE_MAX_AMOUNT + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.coffee"); String text2 = this.machine.coffeeCacheAmount + "/" + TileEntityCoffeeMachine.COFFEE_CACHE_MAX_AMOUNT + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.coffee");
if (x >= this.guiLeft + 40 && y >= this.guiTop + 25 && x <= this.guiLeft + 49 && y <= this.guiTop + 56) { if (x >= this.guiLeft + 40 && y >= this.guiTop + 25 && x <= this.guiLeft + 49 && y <= this.guiTop + 56) {
this.drawHoveringText(Collections.singletonList(text2), x, y); this.drawHoveringText(Collections.singletonList(text2), x, y);
} }
this.energy.drawOverlay(x, y); this.energy.render(matrices, x, y);
this.fluid.drawOverlay(x, y); this.fluid.render(matrices, x, y);
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.machine); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.machine);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
@ -91,8 +95,8 @@ public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
this.blit(matrices, this.guiLeft + 99 + 25 - j, this.guiTop + 44, 192 + 25 - j, 46, j, 12); this.blit(matrices, this.guiLeft + 99 + 25 - j, this.guiTop + 44, 192 + 25 - j, 46, j, 12);
} }
this.energy.draw(); this.energy.draw(matrices);
this.fluid.draw(); this.fluid.draw(matrices);
} }
@Override @Override

View file

@ -10,7 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDirectionalBreaker; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDirectionalBreaker;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker; import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -20,7 +20,6 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiDirectionalBreaker extends GuiWtfMojang<ContainerDirectionalBreaker> { public class GuiDirectionalBreaker extends GuiWtfMojang<ContainerDirectionalBreaker> {
@ -42,20 +41,20 @@ public class GuiDirectionalBreaker extends GuiWtfMojang<ContainerDirectionalBrea
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.drawScreen(x, y, f); super.render(matrices, x, y, f);
this.energy.drawOverlay(x, y); this.energy.render(matrices, x, y);
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.breaker); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.breaker);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
@ -63,6 +62,6 @@ public class GuiDirectionalBreaker extends GuiWtfMojang<ContainerDirectionalBrea
this.getMinecraft().getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
this.energy.draw(); this.energy.draw(matrices);
} }
} }

View file

@ -10,7 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -34,13 +34,13 @@ public class GuiDrill extends GuiWtfMojang<ContainerDrill> {
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + ".drill.name")); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + ".drill.name"));
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 54, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 54, 0, 0, 176, 86);

View file

@ -10,7 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDropper; import de.ellpeck.actuallyadditions.mod.inventory.ContainerDropper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper; import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -35,13 +35,13 @@ public class GuiDropper extends GuiWtfMojang<ContainerDropper> {
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.dropper); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.dropper);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);

View file

@ -10,7 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer; import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -41,19 +41,19 @@ public class GuiEnergizer extends GuiWtfMojang<ContainerEnergizer> {
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.drawScreen(x, y, f); super.render(matrices, x, y, f);
this.energy.drawOverlay(x, y); this.energy.render(matrices, x, y);
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.energizer); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.energizer);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
@ -61,6 +61,6 @@ public class GuiEnergizer extends GuiWtfMojang<ContainerEnergizer> {
this.getMinecraft().getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
this.energy.draw(); this.energy.draw(matrices);
} }
} }

View file

@ -10,7 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnervator; import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnervator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -42,19 +42,19 @@ public class GuiEnervator extends GuiWtfMojang<ContainerEnervator> {
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.drawScreen(x, y, f); super.render(matrices, x, y, f);
this.energy.drawOverlay(x, y); this.energy.render(matrices, x, y);
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.enervator); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.enervator);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
@ -62,6 +62,6 @@ public class GuiEnervator extends GuiWtfMojang<ContainerEnervator> {
this.getMinecraft().getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
this.energy.draw(); this.energy.draw(matrices);
} }
} }

View file

@ -10,7 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFarmer; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFarmer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -44,13 +44,13 @@ public class GuiFarmer extends GuiWtfMojang<ContainerFarmer> {
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.farmer); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.farmer);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
@ -58,12 +58,12 @@ public class GuiFarmer extends GuiWtfMojang<ContainerFarmer> {
this.getMinecraft().getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
this.energy.draw(); this.energy.draw(matrices);
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.drawScreen(x, y, f); super.render(matrices, x, y, f);
this.energy.drawOverlay(x, y); this.energy.render(matrices, x, y);
} }
} }

View file

@ -10,7 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFeeder; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFeeder;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
@ -38,8 +38,8 @@ public class GuiFeeder extends GuiWtfMojang<ContainerFeeder> {
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.drawScreen(x, y, f); super.render(matrices, x, y, f);
if (x >= this.guiLeft + 69 && y >= this.guiTop + 30 && x <= this.guiLeft + 69 + 10 && y <= this.guiTop + 30 + 10) { if (x >= this.guiLeft + 69 && y >= this.guiTop + 30 && x <= this.guiLeft + 69 + 10 && y <= this.guiTop + 30 + 10) {
String[] array = new String[]{this.tileFeeder.currentAnimalAmount + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.animals"), this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < TileEntityFeeder.THRESHOLD String[] array = new String[]{this.tileFeeder.currentAnimalAmount + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.animals"), this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < TileEntityFeeder.THRESHOLD
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.enoughToBreed") ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.enoughToBreed")
@ -51,13 +51,13 @@ public class GuiFeeder extends GuiWtfMojang<ContainerFeeder> {
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.tileFeeder); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tileFeeder);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 70, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 70, 0, 0, 176, 86);
this.getMinecraft().getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);

View file

@ -10,7 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFermentingBarrel; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFermentingBarrel;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -37,10 +37,10 @@ public class GuiFermentingBarrel extends GuiWtfMojang<ContainerFermentingBarrel>
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.drawScreen(x, y, f); super.render(matrices, x, y, f);
this.input.drawOverlay(x, y); this.input.render(matrices, x, y);
this.output.drawOverlay(x, y); this.output.render(matrices, x, y);
} }
@Override @Override
@ -51,13 +51,13 @@ public class GuiFermentingBarrel extends GuiWtfMojang<ContainerFermentingBarrel>
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.press); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.press);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
@ -70,7 +70,7 @@ public class GuiFermentingBarrel extends GuiWtfMojang<ContainerFermentingBarrel>
this.blit(matrices, this.guiLeft + 82, this.guiTop + 34, 176, 0, 12, i); this.blit(matrices, this.guiLeft + 82, this.guiTop + 34, 176, 0, 12, i);
} }
this.input.draw(); this.input.draw(matrices);
this.output.draw(); this.output.draw(matrices);
} }
} }

View file

@ -10,7 +10,8 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -21,7 +22,6 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiFilter extends GuiWtfMojang<ContainerFilter> { public class GuiFilter extends GuiWtfMojang<ContainerFilter> {
@ -34,13 +34,13 @@ public class GuiFilter extends GuiWtfMojang<ContainerFilter> {
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + ".filter.name")); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + ".filter.name"));
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 90, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 90, 0, 0, 176, 86);

View file

@ -14,16 +14,14 @@ import de.ellpeck.actuallyadditions.mod.inventory.ContainerFireworkBox;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.gui.GuiPageButtonList.GuiResponder; import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.client.gui.GuiSlider;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiFireworkBox extends GuiContainer implements GuiResponder { public class GuiFireworkBox extends ContainerScreen<ContainerFireworkBox> implements GuiResponder {
private final TileEntityFireworkBox tile; private final TileEntityFireworkBox tile;

View file

@ -10,7 +10,8 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFluidCollector; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFluidCollector;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -36,10 +37,10 @@ public class GuiFluidCollector extends GuiWtfMojang<ContainerFluidCollector> {
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.drawScreen(x, y, f); super.render(matrices, x, y, f);
this.fluid.drawOverlay(x, y); this.fluid.render(matrices, x, y);
} }
@Override @Override
@ -49,13 +50,13 @@ public class GuiFluidCollector extends GuiWtfMojang<ContainerFluidCollector> {
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.collector); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.collector);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
@ -63,6 +64,6 @@ public class GuiFluidCollector extends GuiWtfMojang<ContainerFluidCollector> {
this.getMinecraft().getTextureManager().bindTexture(RES_LOC); this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
this.fluid.draw(); this.fluid.draw(matrices);
} }
} }

View file

@ -10,16 +10,19 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -44,11 +47,11 @@ public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.drawScreen(x, y, f); super.render(matrices, x, y, f);
this.energy.drawOverlay(x, y); this.energy.render(matrices, x, y);
if (this.buttonAutoSplit.isMouseOver()) { if (this.buttonAutoSplit.isMouseOver(x, y)) {
this.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.tileFurnace.isAutoSplit this.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.tileFurnace.isAutoSplit
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.on") ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.on")
: StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.off"))), x, y); : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.off"))), x, y);
@ -64,13 +67,14 @@ public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
this.addButton(this.buttonAutoSplit); this.addButton(this.buttonAutoSplit);
} }
@Override
public void updateScreen() {
super.updateScreen();
this.buttonAutoSplit.displayString = (this.tileFurnace.isAutoSplit @Override
public void tick() {
super.tick();
this.buttonAutoSplit.setMessage(new StringTextComponent("S").mergeStyle(this.tileFurnace.isAutoSplit
? TextFormatting.DARK_GREEN ? TextFormatting.DARK_GREEN
: TextFormatting.RED) + "S"; : TextFormatting.RED));
} }
@Override @Override
@ -81,13 +85,13 @@ public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.tileFurnace); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tileFurnace);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
@ -104,6 +108,6 @@ public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
this.blit(matrices, this.guiLeft + 101, this.guiTop + 40, 176, 22, 24, i); this.blit(matrices, this.guiLeft + 101, this.guiTop + 40, 176, 22, 24, i);
} }
this.energy.draw(); this.energy.draw(matrices);
} }
} }

View file

@ -70,7 +70,7 @@
// //
// @Override // @Override
// public void drawGuiContainerBackgroundLayer(float f, int x, int y) { // public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); // RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
// this.getMinecraft().getTextureManager().bindTexture(RES_LOC); // this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
// this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 242, 190); // this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 242, 190);
// this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); // this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);

View file

@ -10,11 +10,11 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerGrinder; import de.ellpeck.actuallyadditions.mod.inventory.ContainerGrinder;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
@ -22,6 +22,7 @@ import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -40,10 +41,6 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
private Button buttonAutoSplit; private Button buttonAutoSplit;
public GuiGrinder(PlayerInventory inventoryPlayer, TileEntityBase tile) {
this(inventoryPlayer, tile, false);
}
private GuiGrinder(ContainerGrinder container, PlayerInventory inventory, ITextComponent title) { private GuiGrinder(ContainerGrinder container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory); super(container, inventory);
this.tileGrinder = container.tileGrinder; this.tileGrinder = container.tileGrinder;
@ -73,20 +70,20 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
} }
@Override @Override
public void updateScreen() { public void tick() {
super.updateScreen(); super.tick();
if (this.isDouble) { if (this.isDouble) {
this.buttonAutoSplit.displayString = (this.tileGrinder.isAutoSplit this.buttonAutoSplit.setMessage(new StringTextComponent("S").mergeStyle(this.tileGrinder.isAutoSplit
? TextFormatting.DARK_GREEN ? TextFormatting.DARK_GREEN
: TextFormatting.RED) + "S"; : TextFormatting.RED);
} }
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.drawScreen(x, y, f); super.render(matrices, x, y, f);
this.energy.drawOverlay(x, y); this.energy.render(matrices, x, y);
if (this.isDouble && this.buttonAutoSplit.isMouseOver()) { if (this.isDouble && this.buttonAutoSplit.isMouseOver()) {
@ -97,13 +94,13 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.tileGrinder); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tileGrinder);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
@ -126,13 +123,13 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
} }
} }
this.energy.draw(); this.energy.draw(matrices);
} }
public static class GuiGrinderDouble extends GuiGrinder { public static class GuiGrinderDouble extends GuiGrinder {
public GuiGrinderDouble(PlayerInventory inventory, TileEntityBase tile) { public GuiGrinderDouble(ContainerGrinder containerGrinder, PlayerInventory inventory, ITextComponent tile) {
super(inventory, tile, true); super(containerGrinder, inventory, tile);
} }
} }
} }

View file

@ -10,14 +10,15 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerInputter; import de.ellpeck.actuallyadditions.mod.inventory.ContainerInputter;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter; import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.java.games.input.Keyboard;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
@ -27,8 +28,6 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import java.io.IOException;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class GuiInputter extends GuiWtfMojang<ContainerInputter> { public class GuiInputter extends GuiWtfMojang<ContainerInputter> {
@ -65,27 +64,33 @@ public class GuiInputter extends GuiWtfMojang<ContainerInputter> {
this.rightFilter = new FilterSettingsGui(this.tileInputter.rightFilter, this.guiLeft + 157, this.guiTop + 6, this.buttonList); this.rightFilter = new FilterSettingsGui(this.tileInputter.rightFilter, this.guiLeft + 157, this.guiTop + 6, this.buttonList);
} }
this.fieldPullStart = new TextFieldWidget(3000, this.font, this.guiLeft + 6, this.guiTop + 80 + (this.isAdvanced this.fieldPullStart = new TextFieldWidget(this.font, this.guiLeft + 6, this.guiTop + 80 + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0), 34, 8); : 0), 34, 8);
this.fieldPullStart.setMaxStringLength(5); this.fieldPullStart.setMaxStringLength(5);
this.fieldPullStart.setEnableBackgroundDrawing(false); this.fieldPullStart.setEnableBackgroundDrawing(false);
this.fieldPullEnd = new TextFieldWidget(3001, this.font, this.guiLeft + 50, this.guiTop + 80 + (this.isAdvanced this.children.add(this.fieldPullStart);
this.fieldPullEnd = new TextFieldWidget(this.font, this.guiLeft + 50, this.guiTop + 80 + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0), 34, 8); : 0), 34, 8);
this.fieldPullEnd.setMaxStringLength(5); this.fieldPullEnd.setMaxStringLength(5);
this.fieldPullEnd.setEnableBackgroundDrawing(false); this.fieldPullEnd.setEnableBackgroundDrawing(false);
this.children.add(this.fieldPullEnd);
this.fieldPutStart = new TextFieldWidget(3002, this.font, this.guiLeft + 91, this.guiTop + 80 + (this.isAdvanced this.fieldPutStart = new TextFieldWidget(this.font, this.guiLeft + 91, this.guiTop + 80 + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0), 34, 8); : 0), 34, 8);
this.fieldPutStart.setMaxStringLength(5); this.fieldPutStart.setMaxStringLength(5);
this.fieldPutStart.setEnableBackgroundDrawing(false); this.fieldPutStart.setEnableBackgroundDrawing(false);
this.fieldPutEnd = new TextFieldWidget(3004, this.font, this.guiLeft + 135, this.guiTop + 80 + (this.isAdvanced this.children.add(this.fieldPutStart);
this.fieldPutEnd = new TextFieldWidget(this.font, this.guiLeft + 135, this.guiTop + 80 + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0), 34, 8); : 0), 34, 8);
this.fieldPutEnd.setMaxStringLength(5); this.fieldPutEnd.setMaxStringLength(5);
this.fieldPutEnd.setEnableBackgroundDrawing(false); this.fieldPutEnd.setEnableBackgroundDrawing(false);
this.children.add(this.fieldPutEnd);
SmallerButton buttonSidePutP = new SmallerButton(0, this.guiLeft + 155, this.guiTop + 43 + (this.isAdvanced SmallerButton buttonSidePutP = new SmallerButton(0, this.guiLeft + 155, this.guiTop + 43 + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
@ -112,8 +117,8 @@ public class GuiInputter extends GuiWtfMojang<ContainerInputter> {
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.drawScreen(x, y, f); super.render(matrices, x, y, f);
int newTopOffset = this.guiTop + (this.isAdvanced int newTopOffset = this.guiTop + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
@ -139,13 +144,13 @@ public class GuiInputter extends GuiWtfMojang<ContainerInputter> {
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.tileInputter); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tileInputter);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 97 + (this.isAdvanced this.blit(matrices, this.guiLeft, this.guiTop + 97 + (this.isAdvanced
@ -159,86 +164,81 @@ public class GuiInputter extends GuiWtfMojang<ContainerInputter> {
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0)); : 0));
this.font.drawString(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.inbound"), this.guiLeft + 23 + 3, this.guiTop + 32 + (this.isAdvanced this.font.drawString(matrices, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.inbound"), this.guiLeft + 23 + 3, this.guiTop + 32 + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
this.font.drawString(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.outbound"), this.guiLeft + 104 + 3, this.guiTop + 32 + (this.isAdvanced this.font.drawString(matrices, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.outbound"), this.guiLeft + 104 + 3, this.guiTop + 32 + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
this.font.drawString(SIDES[this.tileInputter.sideToPull + 1], this.guiLeft + 24 + 1, this.guiTop + 45 + 3 + (this.isAdvanced this.font.drawString(matrices, SIDES[this.tileInputter.sideToPull + 1], this.guiLeft + 24 + 1, this.guiTop + 45 + 3 + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
this.font.drawString(SIDES[this.tileInputter.sideToPut + 1], this.guiLeft + 109 + 1, this.guiTop + 45 + 3 + (this.isAdvanced this.font.drawString(matrices, SIDES[this.tileInputter.sideToPut + 1], this.guiLeft + 109 + 1, this.guiTop + 45 + 3 + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
this.font.drawString(Integer.toString(this.tileInputter.slotToPutStart), this.guiLeft + 92, this.guiTop + 67 + (this.isAdvanced this.font.drawString(matrices, Integer.toString(this.tileInputter.slotToPutStart), this.guiLeft + 92, this.guiTop + 67 + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0), StringUtil.DECIMAL_COLOR_WHITE); : 0), StringUtil.DECIMAL_COLOR_WHITE);
this.font.drawString(Integer.toString(this.tileInputter.slotToPutEnd), this.guiLeft + 136, this.guiTop + 67 + (this.isAdvanced this.font.drawString(matrices, Integer.toString(this.tileInputter.slotToPutEnd), this.guiLeft + 136, this.guiTop + 67 + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0), StringUtil.DECIMAL_COLOR_WHITE); : 0), StringUtil.DECIMAL_COLOR_WHITE);
this.font.drawString(Integer.toString(this.tileInputter.slotToPullStart), this.guiLeft + 7, this.guiTop + 67 + (this.isAdvanced this.font.drawString(matrices, Integer.toString(this.tileInputter.slotToPullStart), this.guiLeft + 7, this.guiTop + 67 + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0), StringUtil.DECIMAL_COLOR_WHITE); : 0), StringUtil.DECIMAL_COLOR_WHITE);
this.font.drawString(Integer.toString(this.tileInputter.slotToPullEnd), this.guiLeft + 51, this.guiTop + 67 + (this.isAdvanced this.font.drawString(matrices, Integer.toString(this.tileInputter.slotToPullEnd), this.guiLeft + 51, this.guiTop + 67 + (this.isAdvanced
? OFFSET_ADVANCED ? OFFSET_ADVANCED
: 0), StringUtil.DECIMAL_COLOR_WHITE); : 0), StringUtil.DECIMAL_COLOR_WHITE);
this.fieldPutStart.drawTextBox();
this.fieldPutEnd.drawTextBox();
this.fieldPullStart.drawTextBox();
this.fieldPullEnd.drawTextBox();
} }
// @Override
// protected void mouseClicked(int par1, int par2, int par3) throws IOException {
// this.fieldPutStart.mouseClicked(par1, par2, par3);
// this.fieldPutEnd.mouseClicked(par1, par2, par3);
// this.fieldPullStart.mouseClicked(par1, par2, par3);
// this.fieldPullEnd.mouseClicked(par1, par2, par3);
//
// super.mouseClicked(par1, par2, par3);
// }
// @Override
// public void keyTyped(char theChar, int key) throws IOException {
// if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
// if (this.fieldPutStart.isFocused()) {
// this.setVariable(this.fieldPutStart, 0);
// }
// if (this.fieldPutEnd.isFocused()) {
// this.setVariable(this.fieldPutEnd, 1);
// }
// if (this.fieldPullStart.isFocused()) {
// this.setVariable(this.fieldPullStart, 2);
// }
// if (this.fieldPullEnd.isFocused()) {
// this.setVariable(this.fieldPullEnd, 3);
// }
// } else if (Character.isDigit(theChar) || key == Keyboard.KEY_BACK || key == Keyboard.KEY_DELETE || key == Keyboard.KEY_LEFT || key == Keyboard.KEY_RIGHT) {
// this.fieldPutStart.textboxKeyTyped(theChar, key);
// this.fieldPutEnd.textboxKeyTyped(theChar, key);
// this.fieldPullStart.textboxKeyTyped(theChar, key);
// this.fieldPullEnd.textboxKeyTyped(theChar, key);
// } else {
// super.keyTyped(theChar, key);
// }
// }
@Override @Override
protected void mouseClicked(int par1, int par2, int par3) throws IOException { public void tick() {
this.fieldPutStart.mouseClicked(par1, par2, par3); super.tick();
this.fieldPutEnd.mouseClicked(par1, par2, par3); //
this.fieldPullStart.mouseClicked(par1, par2, par3); // this.fieldPutStart.updateCursorCounter();
this.fieldPullEnd.mouseClicked(par1, par2, par3); // this.fieldPutEnd.updateCursorCounter();
// this.fieldPullStart.updateCursorCounter();
super.mouseClicked(par1, par2, par3); // this.fieldPullEnd.updateCursorCounter();
}
@Override
public void keyTyped(char theChar, int key) throws IOException {
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
if (this.fieldPutStart.isFocused()) {
this.setVariable(this.fieldPutStart, 0);
}
if (this.fieldPutEnd.isFocused()) {
this.setVariable(this.fieldPutEnd, 1);
}
if (this.fieldPullStart.isFocused()) {
this.setVariable(this.fieldPullStart, 2);
}
if (this.fieldPullEnd.isFocused()) {
this.setVariable(this.fieldPullEnd, 3);
}
} else if (Character.isDigit(theChar) || key == Keyboard.KEY_BACK || key == Keyboard.KEY_DELETE || key == Keyboard.KEY_LEFT || key == Keyboard.KEY_RIGHT) {
this.fieldPutStart.textboxKeyTyped(theChar, key);
this.fieldPutEnd.textboxKeyTyped(theChar, key);
this.fieldPullStart.textboxKeyTyped(theChar, key);
this.fieldPullEnd.textboxKeyTyped(theChar, key);
} else {
super.keyTyped(theChar, key);
}
}
@Override
public void updateScreen() {
super.updateScreen();
this.fieldPutStart.updateCursorCounter();
this.fieldPutEnd.updateCursorCounter();
this.fieldPullStart.updateCursorCounter();
this.fieldPullEnd.updateCursorCounter();
if (this.isAdvanced) { if (this.isAdvanced) {
this.leftFilter.update(); this.leftFilter.tick();
this.rightFilter.update(); this.rightFilter.tick();
} }
} }
@ -279,23 +279,23 @@ public class GuiInputter extends GuiWtfMojang<ContainerInputter> {
public final ResourceLocation resLoc = AssetUtil.getGuiLocation("gui_inputter"); public final ResourceLocation resLoc = AssetUtil.getGuiLocation("gui_inputter");
private final boolean smaller; private final boolean smaller;
public SmallerButton(int id, int x, int y, String display) { public SmallerButton(int x, int y, ITextComponent display, IPressable pressable) {
this(id, x, y, display, false); this(x, y, display, false, pressable);
} }
public SmallerButton(int id, int x, int y, String display, boolean smaller) { public SmallerButton(int x, int y, ITextComponent display, boolean smaller, IPressable pressable) {
super(id, x, y, 16, smaller super(x, y, 16, smaller
? 12 ? 12
: 16, display); : 16, display, pressable);
this.smaller = smaller; this.smaller = smaller;
} }
@Override @Override
public void drawButton(Minecraft mc, int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
if (this.visible) { if (this.visible) {
mc.getTextureManager().bindTexture(this.resLoc); Minecraft.getInstance().getTextureManager().bindTexture(this.resLoc);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height; this.isHovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
int k = this.getHoverState(this.hovered); int k = this.getHoverState(this.hovered);
GlStateManager.enableBlend(); GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
@ -332,7 +332,7 @@ public class GuiInputter extends GuiWtfMojang<ContainerInputter> {
public void drawButton(Minecraft mc, int x, int y, float f) { public void drawButton(Minecraft mc, int x, int y, float f) {
if (this.visible) { if (this.visible) {
mc.getTextureManager().bindTexture(this.resLoc); mc.getTextureManager().bindTexture(this.resLoc);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height; this.hovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
int k = this.getHoverState(this.hovered); int k = this.getHoverState(this.hovered);
GlStateManager.enableBlend(); GlStateManager.enableBlend();

View file

@ -10,7 +10,8 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist; import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiInputter.SmallerButton; import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiInputter.SmallerButton;
@ -49,11 +50,11 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelay
} }
@Override @Override
public void updateScreen() { public void tick() {
super.updateScreen(); super.tick();
this.leftFilter.update(); this.leftFilter.tick();
this.rightFilter.update(); this.rightFilter.tick();
} }
@Override @Override
@ -75,8 +76,8 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelay
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.drawScreen(x, y, f); super.render(matrices, x, y, f);
if (this.buttonSmartWhitelistLeft.isMouseOver() || this.buttonSmartWhitelistRight.isMouseOver()) { if (this.buttonSmartWhitelistLeft.isMouseOver() || this.buttonSmartWhitelistRight.isMouseOver()) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
@ -90,18 +91,18 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelay
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.tile); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tile);
String s1 = StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.inbound"); String s1 = StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.inbound");
String s2 = StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.outbound"); String s2 = StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.outbound");
this.font.drawString(s1, 46 - this.font.getStringWidth(s1) / 2, 80, StringUtil.DECIMAL_COLOR_GRAY_TEXT); this.font.drawString(matrices, s1, 46 - this.font.getStringWidth(s1) / 2, 80, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
this.font.drawString(s2, 131 - this.font.getStringWidth(s2) / 2, 80, StringUtil.DECIMAL_COLOR_GRAY_TEXT); this.font.drawString(matrices, s2, 131 - this.font.getStringWidth(s2) / 2, 80, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);

View file

@ -10,12 +10,14 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerMiner; import de.ellpeck.actuallyadditions.mod.inventory.ContainerMiner;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner; import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
@ -40,21 +42,23 @@ public class GuiMiner extends GuiWtfMojang<ContainerMiner> {
public void init() { public void init() {
super.init(); super.init();
Button buttonMode = new Button(0, this.guiLeft + this.xSize / 2 - 51, this.guiTop + 75, 50, 20, "Mode"); Button buttonMode = new Button(this.guiLeft + this.xSize / 2 - 51, this.guiTop + 75, 50, 20, "Mode", button -> {
});
this.addButton(buttonMode); this.addButton(buttonMode);
Button buttonReset = new Button(1, this.guiLeft + this.xSize / 2 + 1, this.guiTop + 75, 50, 20, "Reset"); Button buttonReset = new Button(this.guiLeft + this.xSize / 2 + 1, this.guiTop + 75, 50, 20, "Reset", button -> {
});
this.addButton(buttonReset); this.addButton(buttonReset);
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.miner); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.miner);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
@ -65,7 +69,7 @@ public class GuiMiner extends GuiWtfMojang<ContainerMiner> {
String mining = this.miner.onlyMineOres String mining = this.miner.onlyMineOres
? "Only Mining Ores" ? "Only Mining Ores"
: "Mining Everything"; : "Mining Everything";
this.font.drawString(mining, this.guiLeft + this.xSize / 2 - this.font.getStringWidth(mining) / 2, this.guiTop + 8, StringUtil.DECIMAL_COLOR_GRAY_TEXT); this.font.drawString(matrices, mining, this.guiLeft + this.xSize / 2 - this.font.getStringWidth(mining) / 2, this.guiTop + 8, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
} }
@Override @Override

View file

@ -10,7 +10,8 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerOilGenerator; import de.ellpeck.actuallyadditions.mod.inventory.ContainerOilGenerator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -47,20 +48,20 @@ public class GuiOilGenerator extends GuiWtfMojang<ContainerOilGenerator> {
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.drawScreen(x, y, f); super.render(matrices, x, y, f);
this.energy.drawOverlay(x, y); this.energy.render(matrices, x, y);
this.fluid.drawOverlay(x, y); this.fluid.render(matrices, x, y);
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.generator); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.generator);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
@ -74,16 +75,16 @@ public class GuiOilGenerator extends GuiWtfMojang<ContainerOilGenerator> {
} }
if (this.generator.maxBurnTime > 0 && this.generator.currentEnergyProduce > 0) { if (this.generator.maxBurnTime > 0 && this.generator.currentEnergyProduce > 0) {
this.drawCenteredString(this.font, this.generator.currentEnergyProduce + " " + I18n.format("actuallyadditions.cft"), this.guiLeft + 87, this.guiTop + 65, 0xFFFFFF); drawCenteredString(matrices, this.font, this.generator.currentEnergyProduce + " " + I18n.format("actuallyadditions.cft"), this.guiLeft + 87, this.guiTop + 65, 0xFFFFFF);
this.drawCenteredString(this.font, "for " + this.generator.maxBurnTime + " t", this.guiLeft + 87, this.guiTop + 75, 0xFFFFFF); drawCenteredString(matrices, this.font, "for " + this.generator.maxBurnTime + " t", this.guiLeft + 87, this.guiTop + 75, 0xFFFFFF);
GlStateManager.pushMatrix(); matrices.push();
GlStateManager.scale(0.75, 0.75, 1); matrices.scale(0.75F, 0.75F, 1F);
float xS = (this.guiLeft + 87) * 1.365F - this.font.getStringWidth("(per 50 mB)") / 2F; float xS = (this.guiLeft + 87) * 1.365F - this.font.getStringWidth("(per 50 mB)") / 2F;
StringUtil.renderScaledAsciiString(this.font, "(per 50 mB)", xS, (this.guiTop + 85) * 1.345F, 0xFFFFFF, true, 0.75F); StringUtil.renderScaledAsciiString(this.font, "(per 50 mB)", xS, (this.guiTop + 85) * 1.345F, 0xFFFFFF, true, 0.75F);
GlStateManager.popMatrix(); matrices.pop();
} }
this.energy.draw(); this.energy.draw(matrices);
this.fluid.draw(); this.fluid.draw(matrices);
} }
} }

View file

@ -10,13 +10,15 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerPhantomPlacer; import de.ellpeck.actuallyadditions.mod.inventory.ContainerPhantomPlacer;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
@ -51,8 +53,8 @@ public class GuiPhantomPlacer extends GuiWtfMojang<ContainerPhantomPlacer> {
} }
@Override @Override
public void updateScreen() { public void tick() {
super.updateScreen(); super.tick();
if (!this.placer.isBreaker) { if (!this.placer.isBreaker) {
this.buttonList.get(0).displayString = this.getSide(); this.buttonList.get(0).displayString = this.getSide();
@ -60,8 +62,8 @@ public class GuiPhantomPlacer extends GuiWtfMojang<ContainerPhantomPlacer> {
} }
@Override @Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) { public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
super.drawScreen(mouseX, mouseY, partialTicks); super.render(matrices, mouseX, mouseY, partialTicks);
if (!this.placer.isBreaker && this.buttonList.get(0).isMouseOver()) { if (!this.placer.isBreaker && this.buttonList.get(0).isMouseOver()) {
String loc = "info." + ActuallyAdditions.MODID + ".placer.sides"; String loc = "info." + ActuallyAdditions.MODID + ".placer.sides";
@ -85,13 +87,13 @@ public class GuiPhantomPlacer extends GuiWtfMojang<ContainerPhantomPlacer> {
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.placer); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.placer);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);

View file

@ -10,7 +10,8 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector; import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector; import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
@ -45,27 +46,27 @@ public class GuiRangedCollector extends GuiWtfMojang<ContainerRangedCollector> {
} }
@Override @Override
public void drawScreen(int x, int y, float f) { public void render(MatrixStack matrices, int x, int y, float f) {
super.drawScreen(x, y, f); super.render(matrices, x, y, f);
this.filter.drawHover(x, y); this.filter.drawHover(matrices, x, y);
} }
@Override @Override
public void updateScreen() { public void tick() {
super.updateScreen(); super.tick();
this.filter.update(); this.filter.tick();
} }
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y) { public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.collector); AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.collector);
} }
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 86, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 86, 0, 0, 176, 86);

View file

@ -42,8 +42,8 @@
// } // }
// //
// @Override // @Override
// public void drawScreen(int x, int y, float f) { // public void render(int x, int y, float f) {
// super.drawScreen(x, y, f); // super.render(x, y, f);
// this.energy.drawOverlay(x, y); // this.energy.drawOverlay(x, y);
// } // }
// //
@ -54,7 +54,7 @@
// //
// @Override // @Override
// public void drawGuiContainerBackgroundLayer(float f, int x, int y) { // public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); // RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
// //
// this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); // this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
// this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); // this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);

View file

@ -75,7 +75,7 @@
// //
// @Override // @Override
// public void drawGuiContainerBackgroundLayer(float f, int x, int y) { // public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); // RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
// //
// this.getMinecraft().getTextureManager().bindTexture(RES_LOC); // this.getMinecraft().getTextureManager().bindTexture(RES_LOC);
// this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); // this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);

View file

@ -11,7 +11,7 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerXPSolidifier; import de.ellpeck.actuallyadditions.mod.inventory.ContainerXPSolidifier;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier; import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
@ -22,6 +22,7 @@ import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -43,15 +44,24 @@ public class GuiXPSolidifier extends GuiWtfMojang<ContainerXPSolidifier> {
public void init() { public void init() {
super.init(); super.init();
Button buttonOne = new GuiInputter.SmallerButton(0, this.guiLeft + 62, this.guiTop + 44, "1"); Button buttonOne = new GuiInputter.SmallerButton(this.guiLeft + 62, this.guiTop + 44, new StringTextComponent("1"), btn -> {
Button buttonFive = new GuiInputter.SmallerButton(1, this.guiLeft + 80, this.guiTop + 44, "5"); });
Button buttonTen = new GuiInputter.SmallerButton(2, this.guiLeft + 99, this.guiTop + 44, "10"); Button buttonFive = new GuiInputter.SmallerButton(this.guiLeft + 80, this.guiTop + 44, new StringTextComponent("5"), btn -> {
Button buttonTwenty = new GuiInputter.SmallerButton(3, this.guiLeft + 62, this.guiTop + 61, "20"); });
Button buttonThirty = new GuiInputter.SmallerButton(4, this.guiLeft + 80, this.guiTop + 61, "30"); Button buttonTen = new GuiInputter.SmallerButton(this.guiLeft + 99, this.guiTop + 44, new StringTextComponent("10"), btn -> {
Button buttonForty = new GuiInputter.SmallerButton(5, this.guiLeft + 99, this.guiTop + 61, "40"); });
Button buttonFifty = new GuiInputter.SmallerButton(6, this.guiLeft + 62, this.guiTop + 78, "50"); Button buttonTwenty = new GuiInputter.SmallerButton(this.guiLeft + 62, this.guiTop + 61, new StringTextComponent("20"), btn -> {
Button buttonSixtyFour = new GuiInputter.SmallerButton(7, this.guiLeft + 80, this.guiTop + 78, "64"); });
Button buttonAll = new GuiInputter.SmallerButton(8, this.guiLeft + 99, this.guiTop + 78, "All"); Button buttonThirty = new GuiInputter.SmallerButton(this.guiLeft + 80, this.guiTop + 61, new StringTextComponent("30"), btn -> {
});
Button buttonForty = new GuiInputter.SmallerButton(this.guiLeft + 99, this.guiTop + 61, new StringTextComponent("40"), btn -> {
});
Button buttonFifty = new GuiInputter.SmallerButton(this.guiLeft + 62, this.guiTop + 78, new StringTextComponent("50"), btn -> {
});
Button buttonSixtyFour = new GuiInputter.SmallerButton(this.guiLeft + 80, this.guiTop + 78, new StringTextComponent("64"), btn -> {
});
Button buttonAll = new GuiInputter.SmallerButton(this.guiLeft + 99, this.guiTop + 78, new StringTextComponent("All"), btn -> {
});
this.addButton(buttonOne); this.addButton(buttonOne);
this.addButton(buttonFive); this.addButton(buttonFive);
@ -71,7 +81,7 @@ public class GuiXPSolidifier extends GuiWtfMojang<ContainerXPSolidifier> {
@Override @Override
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);

View file

@ -11,9 +11,11 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui; package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils; import net.minecraftforge.fml.client.gui.GuiUtils;
@ -29,12 +31,12 @@ public class TexturedButton extends Button {
public int texturePosX; public int texturePosX;
public int texturePosY; public int texturePosY;
public TexturedButton(ResourceLocation resLoc, int id, int x, int y, int texturePosX, int texturePosY, int width, int height) { public TexturedButton(ResourceLocation resLoc, int x, int y, int texturePosX, int texturePosY, int width, int height, IPressable pressable) {
this(resLoc, id, x, y, texturePosX, texturePosY, width, height, new ArrayList<String>()); this(resLoc, x, y, texturePosX, texturePosY, width, height, new ArrayList<>());
} }
public TexturedButton(ResourceLocation resLoc, int id, int x, int y, int texturePosX, int texturePosY, int width, int height, List<String> hoverTextList) { public TexturedButton(ResourceLocation resLoc, int x, int y, int texturePosX, int texturePosY, int width, int height, List<String> hoverTextList, IPressable pressable) {
super(id, x, y, width, height, ""); super(x, y, width, height, StringTextComponent.EMPTY, pressable);
this.texturePosX = texturePosX; this.texturePosX = texturePosX;
this.texturePosY = texturePosY; this.texturePosY = texturePosY;
this.resLoc = resLoc; this.resLoc = resLoc;
@ -45,7 +47,7 @@ public class TexturedButton extends Button {
public void drawButton(Minecraft minecraft, int x, int y, float f) { public void drawButton(Minecraft minecraft, int x, int y, float f) {
if (this.visible) { if (this.visible) {
minecraft.getTextureManager().bindTexture(this.resLoc); minecraft.getTextureManager().bindTexture(this.resLoc);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height; this.hovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
int k = this.getHoverState(this.hovered); int k = this.getHoverState(this.hovered);
if (k == 0) { if (k == 0) {

View file

@ -27,7 +27,7 @@ public abstract class RecipeWrapperWithButton implements IRecipeWr {
protected final TexturedButton theButton; protected final TexturedButton theButton;
public RecipeWrapperWithButton() { public RecipeWrapperWithButton() {
this.theButton = new TexturedButton(GuiBooklet.RES_LOC_GADGETS, 23782, this.getButtonX(), this.getButtonY(), 0, 0, 20, 20); this.theButton = new TexturedButton(GuiBooklet.RES_LOC_GADGETS, this.getButtonX(), this.getButtonY(), 0, 0, 20, 20, );
} }
public abstract int getButtonX(); public abstract int getButtonX();