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;
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.active = !this.isTrials;
}

View file

@ -96,19 +96,19 @@ public abstract class GuiBooklet extends GuiBookletBase {
if (this.hasPageLeftButton()) {
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);
}
if (this.hasPageRightButton()) {
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);
}
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");
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);
}

View file

@ -135,7 +135,7 @@ public class GuiMainPage extends GuiBooklet {
List<String> configText = new ArrayList<>();
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));
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);
List<String> achievementText = new ArrayList<>();

View file

@ -117,7 +117,7 @@ public class GuiPage extends GuiBooklet {
List<String> links = this.getWebLinks();
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);
}

View file

@ -10,20 +10,24 @@
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.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
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.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.util.ArrayList;
import java.util.List;
@OnlyIn(Dist.CLIENT)
public class EnergyDisplay extends Gui {
public class EnergyDisplay extends AbstractGui {
private CustomEnergyStorage rfReference;
private int x;
@ -47,7 +51,7 @@ public class EnergyDisplay extends Gui {
this.drawTextNextTo = drawTextNextTo;
}
public void draw() {
public void draw(MatrixStack matrices) {
Minecraft mc = Minecraft.getInstance();
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();
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);
GlStateManager.color(1F, 1F, 1F);
RenderSystem.color4f(1F, 1F, 1F);
}
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)) {
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.util.StringUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -26,7 +28,7 @@ import java.util.Collections;
import java.util.List;
@OnlyIn(Dist.CLIENT)
public class FilterSettingsGui extends Gui {
public class FilterSettingsGui extends AbstractGui {
private final FilterSettings theSettings;
@ -54,48 +56,48 @@ public class FilterSettingsGui extends Gui {
this.modButton = new SmallerButton(this.theSettings.modButtonId, x, y, "", true);
buttonList.add(this.modButton);
this.update();
this.tick();
}
public void update() {
this.whitelistButton.displayString = (this.theSettings.isWhitelist
public void tick() {
this.whitelistButton.setMessage(new StringTextComponent("WH").mergeStyle(this.theSettings.isWhitelist
? TextFormatting.DARK_GREEN
: TextFormatting.RED) + "WH";
this.metaButton.displayString = (this.theSettings.respectMeta
: TextFormatting.RED));
this.whitelistButton.setMessage(new StringTextComponent("ME").mergeStyle(this.theSettings.respectMeta
? TextFormatting.DARK_GREEN
: TextFormatting.RED) + "ME";
this.nbtButton.displayString = (this.theSettings.respectNBT
: TextFormatting.RED));
this.whitelistButton.setMessage(new StringTextComponent("NB").mergeStyle(this.theSettings.respectNBT
? TextFormatting.DARK_GREEN
: TextFormatting.RED) + "NB";
this.modButton.displayString = (this.theSettings.respectMod
: TextFormatting.RED));
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.RED) + "MO";
this.oredictButton.displayString = (this.theSettings.respectOredict == 0
? TextFormatting.RED
: this.theSettings.respectOredict == 1
? TextFormatting.GREEN
: TextFormatting.DARK_GREEN) + "OR";
: TextFormatting.DARK_GREEN));
}
public void drawHover(int mouseX, int mouseY) {
Minecraft mc = Minecraft.getInstance();
if (this.whitelistButton.isMouseOver()) {
if (this.whitelistButton.isMouseOver(mouseX, mouseY)) {
List<String> list = new ArrayList<>();
list.add(TextFormatting.BOLD + (this.theSettings.isWhitelist
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.whitelist")
: StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.blacklist")));
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);
} else if (this.metaButton.isMouseOver()) {
} else if (this.metaButton.isMouseOver(mouseX, mouseY)) {
GuiUtils.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.theSettings.respectMeta
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectMeta")
: 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
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectNBT")
: 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.add(TextFormatting.BOLD + (this.theSettings.respectMod
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectMod")

View file

@ -10,21 +10,25 @@
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.StringUtil;
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.minecraftforge.fluids.Fluid;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fml.client.config.GuiUtils;
import net.minecraftforge.fluids.capability.templates.FluidTank;
import net.minecraftforge.fml.client.gui.GuiUtils;
import java.text.NumberFormat;
import java.util.Collections;
@OnlyIn(Dist.CLIENT)
public class FluidDisplay extends Gui {
public class FluidDisplay extends AbstractGui {
private FluidTank fluidReference;
private Fluid oldFluid;
@ -53,7 +57,7 @@ public class FluidDisplay extends Gui {
this.drawTextNextTo = drawTextNextTo;
}
public void draw() {
public void draw(MatrixStack matrices) {
Minecraft mc = Minecraft.getInstance();
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
? 26
: 18) && mouseY < this.y + (this.outline

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerBag;
import de.ellpeck.actuallyadditions.mod.network.PacketClientToServer;
@ -71,7 +70,7 @@ public class GuiBag extends GuiWtfMojang<ContainerBag> {
@Override
public void updateScreen() {
super.updateScreen();
this.filter.update();
this.filter.tick();
this.buttonAutoInsert.displayString = (this.container.autoInsert
? TextFormatting.DARK_GREEN
@ -103,7 +102,7 @@ public class GuiBag extends GuiWtfMojang<ContainerBag> {
@Override
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.blit(matrixStack, this.guiLeft, this.guiTop + 90, 0, 0, 176, 86);

View file

@ -10,6 +10,7 @@
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.tile.TileEntityBioReactor;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -38,19 +39,19 @@ public class GuiBioReactor extends GuiWtfMojang<ContainerBioReactor> {
}
@Override
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
this.energy.drawOverlay(x, y);
public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
super.render(matrices, mouseX, mouseY, partialTicks);
this.energy.render(mouseX, mouseY);
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.tile);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tile);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float partialTicks, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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) {
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();

View file

@ -10,7 +10,7 @@
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.tile.TileEntityCanolaPress;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -43,21 +43,21 @@ public class GuiCanolaPress extends GuiWtfMojang<ContainerCanolaPress> {
}
@Override
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.drawOverlay(x, y);
this.fluid.drawOverlay(x, y);
this.energy.render(matrices, x, y);
this.fluid.render(matrices, x, y);
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.press);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.press);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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.energy.draw();
this.fluid.draw();
this.energy.draw(matrices);
this.fluid.draw(matrices);
}
}

View file

@ -10,6 +10,7 @@
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.tile.TileEntityCoalGenerator;
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.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class GuiCoalGenerator extends GuiWtfMojang<ContainerCoalGenerator> {
@ -40,19 +41,19 @@ public class GuiCoalGenerator extends GuiWtfMojang<ContainerCoalGenerator> {
}
@Override
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
this.energy.drawOverlay(x, y);
public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.render(matrices, x, y);
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.generator);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.generator);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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.energy.draw();
this.energy.draw(matrices);
}
}

View file

@ -10,16 +10,20 @@
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.inventory.ContainerCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.Collections;
@ -43,7 +47,7 @@ public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
public void 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.energy = new EnergyDisplay(this.guiLeft + 16, this.guiTop + 5, this.machine.storage);
@ -51,26 +55,26 @@ public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
}
@Override
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
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) {
this.drawHoveringText(Collections.singletonList(text2), x, y);
}
this.energy.drawOverlay(x, y);
this.fluid.drawOverlay(x, y);
this.energy.render(matrices, x, y);
this.fluid.render(matrices, x, y);
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.machine);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.machine);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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.energy.draw();
this.fluid.draw();
this.energy.draw(matrices);
this.fluid.draw(matrices);
}
@Override

View file

@ -10,7 +10,7 @@
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.tile.TileEntityDirectionalBreaker;
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.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class GuiDirectionalBreaker extends GuiWtfMojang<ContainerDirectionalBreaker> {
@ -42,20 +41,20 @@ public class GuiDirectionalBreaker extends GuiWtfMojang<ContainerDirectionalBrea
}
@Override
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.drawOverlay(x, y);
this.energy.render(matrices, x, y);
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.breaker);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.breaker);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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.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;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDrill;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -34,13 +34,13 @@ public class GuiDrill extends GuiWtfMojang<ContainerDrill> {
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + ".drill.name"));
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + ".drill.name"));
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerDropper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -35,13 +35,13 @@ public class GuiDropper extends GuiWtfMojang<ContainerDropper> {
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.dropper);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.dropper);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -41,19 +41,19 @@ public class GuiEnergizer extends GuiWtfMojang<ContainerEnergizer> {
}
@Override
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
this.energy.drawOverlay(x, y);
public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.render(matrices, x, y);
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.energizer);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.energizer);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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.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;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnervator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -42,19 +42,19 @@ public class GuiEnervator extends GuiWtfMojang<ContainerEnervator> {
}
@Override
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
this.energy.drawOverlay(x, y);
public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.render(matrices, x, y);
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.enervator);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.enervator);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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.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;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFarmer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -44,13 +44,13 @@ public class GuiFarmer extends GuiWtfMojang<ContainerFarmer> {
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.farmer);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.farmer);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93);
this.energy.draw();
this.energy.draw(matrices);
}
@Override
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
this.energy.drawOverlay(x, y);
public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.render(matrices, x, y);
}
}

View file

@ -10,7 +10,7 @@
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.inventory.ContainerFeeder;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
@ -38,8 +38,8 @@ public class GuiFeeder extends GuiWtfMojang<ContainerFeeder> {
}
@Override
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
public void render(MatrixStack matrices, int x, int y, float 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) {
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")
@ -51,13 +51,13 @@ public class GuiFeeder extends GuiWtfMojang<ContainerFeeder> {
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.tileFeeder);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tileFeeder);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 70, 0, 0, 176, 86);
this.getMinecraft().getTextureManager().bindTexture(RES_LOC);

View file

@ -10,7 +10,7 @@
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.tile.TileEntityFermentingBarrel;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -37,10 +37,10 @@ public class GuiFermentingBarrel extends GuiWtfMojang<ContainerFermentingBarrel>
}
@Override
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
this.input.drawOverlay(x, y);
this.output.drawOverlay(x, y);
public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.input.render(matrices, x, y);
this.output.render(matrices, x, y);
}
@Override
@ -51,13 +51,13 @@ public class GuiFermentingBarrel extends GuiWtfMojang<ContainerFermentingBarrel>
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.press);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.press);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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.input.draw();
this.output.draw();
this.input.draw(matrices);
this.output.draw(matrices);
}
}

View file

@ -10,7 +10,8 @@
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.inventory.ContainerFilter;
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.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class GuiFilter extends GuiWtfMojang<ContainerFilter> {
@ -34,13 +34,13 @@ public class GuiFilter extends GuiWtfMojang<ContainerFilter> {
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + ".filter.name"));
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + ".filter.name"));
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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.tile.TileEntityFireworkBox;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.gui.GuiPageButtonList.GuiResponder;
import net.minecraft.client.gui.GuiSlider;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class GuiFireworkBox extends GuiContainer implements GuiResponder {
public class GuiFireworkBox extends ContainerScreen<ContainerFireworkBox> implements GuiResponder {
private final TileEntityFireworkBox tile;

View file

@ -10,7 +10,8 @@
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.tile.TileEntityFluidCollector;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -36,10 +37,10 @@ public class GuiFluidCollector extends GuiWtfMojang<ContainerFluidCollector> {
}
@Override
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.fluid.drawOverlay(x, y);
this.fluid.render(matrices, x, y);
}
@Override
@ -49,13 +50,13 @@ public class GuiFluidCollector extends GuiWtfMojang<ContainerFluidCollector> {
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.collector);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.collector);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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.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;
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.inventory.ContainerFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -44,11 +47,11 @@ public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
}
@Override
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
this.energy.drawOverlay(x, y);
public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
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
? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.on")
: StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.autoSplitItems.off"))), x, y);
@ -64,13 +67,14 @@ public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
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.RED) + "S";
: TextFormatting.RED));
}
@Override
@ -81,13 +85,13 @@ public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.tileFurnace);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tileFurnace);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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.energy.draw();
this.energy.draw(matrices);
}
}

View file

@ -70,7 +70,7 @@
//
// @Override
// 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.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 242, 190);
// this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);

View file

@ -10,11 +10,11 @@
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.inventory.ContainerGrinder;
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.util.AssetUtil;
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.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -40,10 +41,6 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
private Button buttonAutoSplit;
public GuiGrinder(PlayerInventory inventoryPlayer, TileEntityBase tile) {
this(inventoryPlayer, tile, false);
}
private GuiGrinder(ContainerGrinder container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
this.tileGrinder = container.tileGrinder;
@ -73,20 +70,20 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
}
@Override
public void updateScreen() {
super.updateScreen();
public void tick() {
super.tick();
if (this.isDouble) {
this.buttonAutoSplit.displayString = (this.tileGrinder.isAutoSplit
this.buttonAutoSplit.setMessage(new StringTextComponent("S").mergeStyle(this.tileGrinder.isAutoSplit
? TextFormatting.DARK_GREEN
: TextFormatting.RED) + "S";
: TextFormatting.RED);
}
}
@Override
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
this.energy.drawOverlay(x, y);
public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.render(matrices, x, y);
if (this.isDouble && this.buttonAutoSplit.isMouseOver()) {
@ -97,13 +94,13 @@ public class GuiGrinder extends GuiWtfMojang<ContainerGrinder> {
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.tileGrinder);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tileGrinder);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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 GuiGrinderDouble(PlayerInventory inventory, TileEntityBase tile) {
super(inventory, tile, true);
public GuiGrinderDouble(ContainerGrinder containerGrinder, PlayerInventory inventory, ITextComponent tile) {
super(containerGrinder, inventory, tile);
}
}
}

View file

@ -10,14 +10,15 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerInputter;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.java.games.input.Keyboard;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.TextFieldWidget;
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.OnlyIn;
import java.io.IOException;
@OnlyIn(Dist.CLIENT)
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.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
: 0), 34, 8);
this.fieldPullStart.setMaxStringLength(5);
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
: 0), 34, 8);
this.fieldPullEnd.setMaxStringLength(5);
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
: 0), 34, 8);
this.fieldPutStart.setMaxStringLength(5);
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
: 0), 34, 8);
this.fieldPutEnd.setMaxStringLength(5);
this.fieldPutEnd.setEnableBackgroundDrawing(false);
this.children.add(this.fieldPutEnd);
SmallerButton buttonSidePutP = new SmallerButton(0, this.guiLeft + 155, this.guiTop + 43 + (this.isAdvanced
? OFFSET_ADVANCED
@ -112,8 +117,8 @@ public class GuiInputter extends GuiWtfMojang<ContainerInputter> {
}
@Override
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
int newTopOffset = this.guiTop + (this.isAdvanced
? OFFSET_ADVANCED
@ -139,13 +144,13 @@ public class GuiInputter extends GuiWtfMojang<ContainerInputter> {
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.tileInputter);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tileInputter);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.blit(matrices, this.guiLeft, this.guiTop + 97 + (this.isAdvanced
@ -159,86 +164,81 @@ public class GuiInputter extends GuiWtfMojang<ContainerInputter> {
? OFFSET_ADVANCED
: 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
: 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
: 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
: 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
: 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
: 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
: 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
: 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
: 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
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
public void updateScreen() {
super.updateScreen();
this.fieldPutStart.updateCursorCounter();
this.fieldPutEnd.updateCursorCounter();
this.fieldPullStart.updateCursorCounter();
this.fieldPullEnd.updateCursorCounter();
public void tick() {
super.tick();
//
// this.fieldPutStart.updateCursorCounter();
// this.fieldPutEnd.updateCursorCounter();
// this.fieldPullStart.updateCursorCounter();
// this.fieldPullEnd.updateCursorCounter();
if (this.isAdvanced) {
this.leftFilter.update();
this.rightFilter.update();
this.leftFilter.tick();
this.rightFilter.tick();
}
}
@ -279,23 +279,23 @@ public class GuiInputter extends GuiWtfMojang<ContainerInputter> {
public final ResourceLocation resLoc = AssetUtil.getGuiLocation("gui_inputter");
private final boolean smaller;
public SmallerButton(int id, int x, int y, String display) {
this(id, x, y, display, false);
public SmallerButton(int x, int y, ITextComponent display, IPressable pressable) {
this(x, y, display, false, pressable);
}
public SmallerButton(int id, int x, int y, String display, boolean smaller) {
super(id, x, y, 16, smaller
public SmallerButton(int x, int y, ITextComponent display, boolean smaller, IPressable pressable) {
super(x, y, 16, smaller
? 12
: 16, display);
: 16, display, pressable);
this.smaller = smaller;
}
@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) {
mc.getTextureManager().bindTexture(this.resLoc);
GlStateManager.color(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;
Minecraft.getInstance().getTextureManager().bindTexture(this.resLoc);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.isHovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height;
int k = this.getHoverState(this.hovered);
GlStateManager.enableBlend();
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) {
if (this.visible) {
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;
int k = this.getHoverState(this.hovered);
GlStateManager.enableBlend();

View file

@ -10,7 +10,8 @@
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.inventory.ContainerLaserRelayItemWhitelist;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiInputter.SmallerButton;
@ -49,11 +50,11 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelay
}
@Override
public void updateScreen() {
super.updateScreen();
public void tick() {
super.tick();
this.leftFilter.update();
this.rightFilter.update();
this.leftFilter.tick();
this.rightFilter.tick();
}
@Override
@ -75,8 +76,8 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelay
}
@Override
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
if (this.buttonSmartWhitelistLeft.isMouseOver() || this.buttonSmartWhitelistRight.isMouseOver()) {
List<String> list = new ArrayList<>();
@ -90,18 +91,18 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelay
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.tile);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tile);
String s1 = StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.inbound");
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(s2, 131 - this.font.getStringWidth(s2) / 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(matrices, s2, 131 - this.font.getStringWidth(s2) / 2, 80, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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;
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.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
@ -40,21 +42,23 @@ public class GuiMiner extends GuiWtfMojang<ContainerMiner> {
public void 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);
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);
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.miner);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.miner);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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
? "Only Mining Ores"
: "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

View file

@ -10,7 +10,8 @@
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.tile.TileEntityOilGenerator;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -47,20 +48,20 @@ public class GuiOilGenerator extends GuiWtfMojang<ContainerOilGenerator> {
}
@Override
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
this.energy.drawOverlay(x, y);
this.fluid.drawOverlay(x, y);
public void render(MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.render(matrices, x, y);
this.fluid.render(matrices, x, y);
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.font, this.xSize, -10, this.generator);
public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.generator);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
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) {
this.drawCenteredString(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);
GlStateManager.pushMatrix();
GlStateManager.scale(0.75, 0.75, 1);
drawCenteredString(matrices, this.font, this.generator.currentEnergyProduce + " " + I18n.format("actuallyadditions.cft"), this.guiLeft + 87, this.guiTop + 65, 0xFFFFFF);
drawCenteredString(matrices, this.font, "for " + this.generator.maxBurnTime + " t", this.guiLeft + 87, this.guiTop + 75, 0xFFFFFF);
matrices.push();
matrices.scale(0.75F, 0.75F, 1F);
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);
GlStateManager.popMatrix();
matrices.pop();
}
this.energy.draw();
this.fluid.draw();
this.energy.draw(matrices);
this.fluid.draw(matrices);
}
}

View file

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

View file

@ -42,8 +42,8 @@
// }
//
// @Override
// public void drawScreen(int x, int y, float f) {
// super.drawScreen(x, y, f);
// public void render(int x, int y, float f) {
// super.render(x, y, f);
// this.energy.drawOverlay(x, y);
// }
//
@ -54,7 +54,7 @@
//
// @Override
// 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.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);

View file

@ -75,7 +75,7 @@
//
// @Override
// 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.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;
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.network.PacketHandlerHelper;
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.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -43,15 +44,24 @@ public class GuiXPSolidifier extends GuiWtfMojang<ContainerXPSolidifier> {
public void init() {
super.init();
Button buttonOne = new GuiInputter.SmallerButton(0, this.guiLeft + 62, this.guiTop + 44, "1");
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 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 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 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 buttonOne = new GuiInputter.SmallerButton(this.guiLeft + 62, this.guiTop + 44, new StringTextComponent("1"), btn -> {
});
Button buttonFive = new GuiInputter.SmallerButton(this.guiLeft + 80, this.guiTop + 44, new StringTextComponent("5"), btn -> {
});
Button buttonTen = new GuiInputter.SmallerButton(this.guiLeft + 99, this.guiTop + 44, new StringTextComponent("10"), btn -> {
});
Button buttonTwenty = new GuiInputter.SmallerButton(this.guiLeft + 62, this.guiTop + 61, new StringTextComponent("20"), btn -> {
});
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(buttonFive);
@ -71,7 +81,7 @@ public class GuiXPSolidifier extends GuiWtfMojang<ContainerXPSolidifier> {
@Override
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.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);

View file

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

View file

@ -27,7 +27,7 @@ public abstract class RecipeWrapperWithButton implements IRecipeWr {
protected final TexturedButton theButton;
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();