Added machine GUI progress bars
This commit is contained in:
parent
a23243cd02
commit
65dd53c6ec
7 changed files with 115 additions and 111 deletions
|
@ -15,23 +15,19 @@ import techreborn.tiles.TileBlastFurnace;
|
|||
|
||||
public class GuiAssemblingMachine extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(
|
||||
"techreborn", "textures/gui/assembling_machine.png");
|
||||
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/assembling_machine.png");
|
||||
|
||||
TileAssemblingMachine assemblinmachine;
|
||||
TileAssemblingMachine assemblingmachine;
|
||||
|
||||
public GuiAssemblingMachine(EntityPlayer player,
|
||||
TileAssemblingMachine tileassemblinmachine)
|
||||
{
|
||||
public GuiAssemblingMachine(EntityPlayer player, TileAssemblingMachine tileassemblinmachine) {
|
||||
super(new ContainerAssemblingMachine(tileassemblinmachine, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
assemblinmachine = tileassemblinmachine;
|
||||
assemblingmachine = tileassemblinmachine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
|
||||
this.buttonList.clear();
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
|
@ -40,22 +36,28 @@ public class GuiAssemblingMachine extends GuiContainer {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
|
||||
int p_146976_2_, int p_146976_3_)
|
||||
{
|
||||
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;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
int j = 0;
|
||||
|
||||
if(assemblingmachine.crafter.currentRecipe != null) {
|
||||
j = this.assemblingmachine.crafter.currentTickTime * 20 / this.assemblingmachine.crafter.currentRecipe.tickTime();
|
||||
}
|
||||
this.drawTexturedModalRect(k + 86, l + 34, 176, 14, j + 1, 16);
|
||||
|
||||
j = (int)this.assemblingmachine.energy.getEnergyStored() * 12 / this.assemblingmachine.energy.getCapacity();
|
||||
if(j > 0) {
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
|
||||
int p_146979_2_)
|
||||
{
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
String name = StatCollector.translateToLocal("tile.techreborn.assemblinmachine.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(
|
||||
I18n.format("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,23 +13,19 @@ import net.minecraft.util.StatCollector;
|
|||
|
||||
public class GuiImplosionCompressor extends GuiContainer{
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(
|
||||
"techreborn", "textures/gui/implosion_compressor.png");
|
||||
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/implosion_compressor.png");
|
||||
|
||||
TileImplosionCompressor compresser;
|
||||
|
||||
public GuiImplosionCompressor(EntityPlayer player, TileImplosionCompressor tilecompresser)
|
||||
{
|
||||
public GuiImplosionCompressor(EntityPlayer player, TileImplosionCompressor tilecompresser) {
|
||||
super(new ContainerImplosionCompressor(tilecompresser, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
compresser = tilecompresser;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
|
||||
this.buttonList.clear();
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
|
@ -38,23 +34,29 @@ public class GuiImplosionCompressor extends GuiContainer{
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
|
||||
int p_146976_2_, int p_146976_3_)
|
||||
{
|
||||
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;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
int j = 0;
|
||||
|
||||
if(compresser.crafter.currentRecipe != null) {
|
||||
j = this.compresser.crafter.currentTickTime * 20 / this.compresser.crafter.currentRecipe.tickTime();
|
||||
}
|
||||
this.drawTexturedModalRect(k + 60, l + 38, 176, 14, j + 1, 16);
|
||||
|
||||
j = (int)this.compresser.energy.getEnergyStored() * 12 / this.compresser.energy.getCapacity();
|
||||
if(j > 0) {
|
||||
this.drawTexturedModalRect(k + 16, l + 37 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
|
||||
int p_146979_2_)
|
||||
{
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
String name = StatCollector.translateToLocal("tile.techreborn.implosioncompressor.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(
|
||||
I18n.format("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,14 +15,11 @@ import techreborn.tiles.TileLathe;
|
|||
|
||||
public class GuiLathe extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(
|
||||
"techreborn", "textures/gui/lathe.png");
|
||||
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/lathe.png");
|
||||
|
||||
TileLathe lathe;
|
||||
|
||||
public GuiLathe(EntityPlayer player,
|
||||
TileLathe tilelathe)
|
||||
{
|
||||
public GuiLathe(EntityPlayer player, TileLathe tilelathe) {
|
||||
super(new ContainerLathe(tilelathe, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
|
@ -31,7 +28,6 @@ public class GuiLathe extends GuiContainer {
|
|||
|
||||
@Override
|
||||
public void initGui() {
|
||||
|
||||
this.buttonList.clear();
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
|
@ -40,22 +36,28 @@ public class GuiLathe extends GuiContainer {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
|
||||
int p_146976_2_, int p_146976_3_)
|
||||
{
|
||||
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;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
int j = 0;
|
||||
|
||||
if(lathe.crafter.currentRecipe != null) {
|
||||
j = this.lathe.crafter.currentTickTime * 20 / this.lathe.crafter.currentRecipe.tickTime();
|
||||
}
|
||||
this.drawTexturedModalRect(k + 80, l + 34, 176, 14, j, 16);
|
||||
|
||||
j = (int)this.lathe.energy.getEnergyStored() * 12 / this.lathe.energy.getCapacity();
|
||||
if(j > 0) {
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
|
||||
int p_146979_2_)
|
||||
{
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
String name = StatCollector.translateToLocal("tile.techreborn.lathe.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(
|
||||
I18n.format("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,14 +17,11 @@ import techreborn.tiles.TilePlateCuttingMachine;
|
|||
|
||||
public class GuiPlateCuttingMachine extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(
|
||||
"techreborn", "textures/gui/plate_cutting_machine.png");
|
||||
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/plate_cutting_machine.png");
|
||||
|
||||
TilePlateCuttingMachine platecuttingmachine;
|
||||
|
||||
public GuiPlateCuttingMachine(EntityPlayer player,
|
||||
TilePlateCuttingMachine tileplatecuttingmachine)
|
||||
{
|
||||
public GuiPlateCuttingMachine(EntityPlayer player, TilePlateCuttingMachine tileplatecuttingmachine) {
|
||||
super(new ContainerPlateCuttingMachine(tileplatecuttingmachine, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
|
@ -33,7 +30,6 @@ public class GuiPlateCuttingMachine extends GuiContainer {
|
|||
|
||||
@Override
|
||||
public void initGui() {
|
||||
|
||||
this.buttonList.clear();
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
|
@ -42,22 +38,28 @@ public class GuiPlateCuttingMachine extends GuiContainer {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
|
||||
int p_146976_2_, int p_146976_3_)
|
||||
{
|
||||
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;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
int j = 0;
|
||||
|
||||
if(platecuttingmachine.crafter.currentRecipe != null) {
|
||||
j = this.platecuttingmachine.crafter.currentTickTime * 20 / this.platecuttingmachine.crafter.currentRecipe.tickTime();
|
||||
}
|
||||
this.drawTexturedModalRect(k + 83, l + 34, 176, 14, j, 16);
|
||||
|
||||
j = (int)this.platecuttingmachine.energy.getEnergyStored() * 12 / this.platecuttingmachine.energy.getCapacity();
|
||||
if(j > 0) {
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
|
||||
int p_146979_2_)
|
||||
{
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
String name = StatCollector.translateToLocal("tile.techreborn.platecuttingmachine.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(
|
||||
I18n.format("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,48 +12,41 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileMachineBase extends TileEntity {
|
||||
private int facing;
|
||||
private int facing;
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
// TODO make this happen less
|
||||
// syncWithAll();
|
||||
}
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
// TODO make this happen less
|
||||
// syncWithAll();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addWailaInfo(List<String> info)
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addWailaInfo(List<String> info) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void syncWithAll()
|
||||
{
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
PacketHandler.sendPacketToAllPlayers(getDescriptionPacket(),
|
||||
worldObj);
|
||||
}
|
||||
}
|
||||
public void syncWithAll() {
|
||||
if (!worldObj.isRemote) {
|
||||
PacketHandler.sendPacketToAllPlayers(getDescriptionPacket(),
|
||||
worldObj);
|
||||
}
|
||||
}
|
||||
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
writeToNBT(nbtTag);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord,
|
||||
this.zCoord, 1, nbtTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net,
|
||||
S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord,
|
||||
yCoord, zCoord);
|
||||
readFromNBT(packet.func_148857_g());
|
||||
}
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
writeToNBT(nbtTag);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord,
|
||||
this.zCoord, 1, nbtTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net,
|
||||
S35PacketUpdateTileEntity packet) {
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord,
|
||||
yCoord, zCoord);
|
||||
readFromNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -81,21 +81,24 @@ public class TilePlateCuttingMachine extends TileMachineBase implements IWrencha
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
super.readFromNBT(tagCompound);
|
||||
inventory.readFromNBT(tagCompound);
|
||||
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
super.readFromNBT(tagCompound);
|
||||
inventory.readFromNBT(tagCompound);
|
||||
energy.readFromNBT(tagCompound);
|
||||
crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
super.writeToNBT(tagCompound);
|
||||
inventory.writeToNBT(tagCompound);
|
||||
|
||||
}
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
super.writeToNBT(tagCompound);
|
||||
inventory.writeToNBT(tagCompound);
|
||||
energy.writeToNBT(tagCompound);
|
||||
crafter.writeToNBT(tagCompound);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Loading…
Add table
Reference in a new issue