Convert MFSU and BatBox
This commit is contained in:
parent
e7eaa40bde
commit
53a3869092
5 changed files with 49 additions and 220 deletions
|
@ -4,8 +4,10 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import techreborn.client.container.ContainerBatbox;
|
||||
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.tiles.storage.TileBatBox;
|
||||
|
||||
public class GuiBatbox extends GuiContainer {
|
||||
|
@ -14,33 +16,31 @@ public class GuiBatbox extends GuiContainer {
|
|||
|
||||
TileBatBox generator;
|
||||
|
||||
ContainerBatbox containerGenerator;
|
||||
|
||||
public GuiBatbox(EntityPlayer player, TileBatBox generator) {
|
||||
super(new ContainerBatbox(generator, player));
|
||||
public GuiBatbox(final EntityPlayer player, final TileBatBox generator) {
|
||||
super(new ContainerBuilder().player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
|
||||
.tile(generator).energySlot(0, 80, 17).energySlot(1, 80, 53).syncEnergyValue().addInventory().create());
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
this.generator = generator;
|
||||
this.containerGenerator = (ContainerBatbox) this.inventorySlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
final int k = (this.width - this.xSize) / 2;
|
||||
final int l = (this.height - this.ySize) / 2;
|
||||
super.initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
|
||||
this.mc.getTextureManager().bindTexture(GuiBatbox.texture);
|
||||
final int k = (this.width - this.xSize) / 2;
|
||||
final int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
int j = 0;
|
||||
|
||||
j = generator.getEnergyScaled(24);
|
||||
j = this.generator.getEnergyScaled(24);
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
|
||||
}
|
||||
|
@ -53,16 +53,17 @@ public class GuiBatbox extends GuiContainer {
|
|||
// }
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
String name = I18n.translateToLocal("tile.techreborn.batbox.name");
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
|
||||
final String name = I18n.translateToLocal("tile.techreborn.batbox.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
|
||||
4210752);
|
||||
4210752);
|
||||
|
||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(generator.getMaxPower()), 25, this.ySize - 140,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerGenerator.energy), 25, this.ySize - 150,
|
||||
4210752);
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(this.generator.getMaxPower()), 25, this.ySize - 140,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(this.generator.getEnergy()), 25,
|
||||
this.ySize - 150, 4210752);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,10 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import techreborn.client.container.ContainerMFSU;
|
||||
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.tiles.storage.TileMFSU;
|
||||
|
||||
/**
|
||||
|
@ -17,33 +19,32 @@ public class GuiMFSU extends GuiContainer {
|
|||
|
||||
TileMFSU generator;
|
||||
|
||||
ContainerMFSU containerGenerator;
|
||||
|
||||
public GuiMFSU(EntityPlayer player, TileMFSU generator) {
|
||||
super(new ContainerMFSU(generator, player));
|
||||
public GuiMFSU(final EntityPlayer player, final TileMFSU generator) {
|
||||
super(new ContainerBuilder().player(player.inventory).inventory(8, 84).hotbar(8, 142).armor().complete(44, 6)
|
||||
.addArmor().addInventory().tile(generator).energySlot(0, 80, 17).energySlot(1, 80, 53).syncEnergyValue()
|
||||
.addInventory().create());
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
this.generator = generator;
|
||||
this.containerGenerator = (ContainerMFSU) this.inventorySlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
final int k = (this.width - this.xSize) / 2;
|
||||
final int l = (this.height - this.ySize) / 2;
|
||||
super.initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
|
||||
this.mc.getTextureManager().bindTexture(GuiMFSU.texture);
|
||||
final int k = (this.width - this.xSize) / 2;
|
||||
final int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
int j = 0;
|
||||
|
||||
j = generator.getEnergyScaled(24);
|
||||
j = this.generator.getEnergyScaled(24);
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
|
||||
}
|
||||
|
@ -56,16 +57,17 @@ public class GuiMFSU extends GuiContainer {
|
|||
// }
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
String name = I18n.translateToLocal("tile.techreborn.mfsu.name");
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
|
||||
final String name = I18n.translateToLocal("tile.techreborn.mfsu.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
|
||||
4210752);
|
||||
4210752);
|
||||
|
||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), this.xSize - 60,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(generator.getMaxPower()), 110, this.ySize - 150,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerGenerator.energy), 110, this.ySize - 160,
|
||||
4210752);
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(this.generator.getMaxPower()), 110, this.ySize - 150,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(this.generator.getEnergy()), 110,
|
||||
this.ySize - 160, 4210752);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue