Revamp centrifuge jei support
This commit is contained in:
parent
eb220643fc
commit
2a78196939
8 changed files with 48 additions and 71 deletions
|
@ -3,11 +3,11 @@ package techreborn.client.gui;
|
|||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.gui.widget.GuiButtonPowerBar;
|
||||
|
||||
/**
|
||||
|
@ -19,9 +19,9 @@ public class GuiBase extends GuiContainer {
|
|||
public int ySize = 176;
|
||||
public TRBuilder builder = new TRBuilder();
|
||||
public TileEntity tile;
|
||||
public Container container;
|
||||
public BuiltContainer container;
|
||||
|
||||
public GuiBase(EntityPlayer player, TileEntity tile, Container container) {
|
||||
public GuiBase(EntityPlayer player, TileEntity tile, BuiltContainer container) {
|
||||
super(container);
|
||||
this.tile = tile;
|
||||
this.container = container;
|
||||
|
|
|
@ -1,23 +1,15 @@
|
|||
package techreborn.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import techreborn.tiles.TileCentrifuge;
|
||||
|
||||
public class GuiCentrifuge extends GuiBase {
|
||||
|
||||
TileCentrifuge centrifuge;
|
||||
TileCentrifuge tile;
|
||||
|
||||
public GuiCentrifuge(final EntityPlayer player, final TileCentrifuge centrifuge) {
|
||||
super(player, centrifuge, centrifuge.createContainer(player));
|
||||
this.centrifuge = centrifuge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
final int k = (this.width - this.xSize) / 2;
|
||||
final int l = (this.height - this.ySize) / 2;
|
||||
super.initGui();
|
||||
public GuiCentrifuge(final EntityPlayer player, final TileCentrifuge tile) {
|
||||
super(player, tile, tile.createContainer(player));
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -43,7 +35,7 @@ public class GuiCentrifuge extends GuiBase {
|
|||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
final Layer layer = Layer.FOREGROUND;
|
||||
|
||||
this.builder.drawProgressBar(this, this.centrifuge.getProgressScaled(100), 100, 61, 47, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
|
||||
this.builder.drawMultiEnergyBar(this, 9, 18, (int) this.centrifuge.getEnergy(), (int) this.centrifuge.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||
this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 61, 47, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
|
||||
this.builder.drawMultiEnergyBar(this, 9, 18, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import reborncore.client.guibuilder.GuiBuilder;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
@ -91,19 +92,21 @@ public class TRBuilder extends GuiBuilder {
|
|||
}
|
||||
|
||||
public void drawJEIButton(GuiBase gui, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer) {
|
||||
if (layer == GuiBase.Layer.BACKGROUND) {
|
||||
x += gui.getGuiLeft();
|
||||
y += gui.getGuiTop();
|
||||
}
|
||||
if (layer == GuiBase.Layer.FOREGROUND) {
|
||||
mouseX -= gui.getGuiLeft();
|
||||
mouseY -= gui.getGuiTop();
|
||||
}
|
||||
gui.mc.getTextureManager().bindTexture(GUI_SHEET);
|
||||
if (isInRect(x, y, 20, 12, mouseX, mouseY)) {
|
||||
gui.drawTexturedModalRect(x, y, 184, 82, 20, 12);
|
||||
} else {
|
||||
gui.drawTexturedModalRect(x, y, 184, 70, 20, 12);
|
||||
if (Loader.isModLoaded("jei")) {
|
||||
if (layer == GuiBase.Layer.BACKGROUND) {
|
||||
x += gui.getGuiLeft();
|
||||
y += gui.getGuiTop();
|
||||
}
|
||||
if (layer == GuiBase.Layer.FOREGROUND) {
|
||||
mouseX -= gui.getGuiLeft();
|
||||
mouseY -= gui.getGuiTop();
|
||||
}
|
||||
gui.mc.getTextureManager().bindTexture(GUI_SHEET);
|
||||
if (isInRect(x, y, 20, 12, mouseX, mouseY)) {
|
||||
gui.drawTexturedModalRect(x, y, 184, 82, 20, 12);
|
||||
} else {
|
||||
gui.drawTexturedModalRect(x, y, 184, 70, 20, 12);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue