diff --git a/src/main/java/com/hbm/inventory/gui/GUILaunchPadLarge.java b/src/main/java/com/hbm/inventory/gui/GUILaunchPadLarge.java index c99bd9f9b..e144595e2 100644 --- a/src/main/java/com/hbm/inventory/gui/GUILaunchPadLarge.java +++ b/src/main/java/com/hbm/inventory/gui/GUILaunchPadLarge.java @@ -33,6 +33,15 @@ public class GUILaunchPadLarge extends GuiInfoContainer { this.ySize = 236; } + @Override + public void drawScreen(int mouseX, int mouseY, float f) { + super.drawScreen(mouseX, mouseY, f); + + this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 107, guiTop + 88 - 52, 16, 52, launchpad.power, launchpad.maxPower); + launchpad.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 125, guiTop + 70 - 52, 16, 52); + launchpad.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 143, guiTop + 70 - 52, 16, 52); + } + @Override protected void drawGuiContainerForegroundLayer(int i, int j) { String name = this.launchpad.hasCustomInventoryName() ? this.launchpad.getInventoryName() : I18n.format(this.launchpad.getInventoryName()); @@ -46,6 +55,22 @@ public class GUILaunchPadLarge extends GuiInfoContainer { Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + int fuel = launchpad.getFuelState(); + int oxidizer = launchpad.getOxidizerState(); + + if(fuel == 1) drawTexturedModalRect(guiLeft + 130, guiTop + 23, 192, 0, 6, 8); + if(fuel == -1) drawTexturedModalRect(guiLeft + 130, guiTop + 23, 198, 0, 6, 8); + if(oxidizer == 1) drawTexturedModalRect(guiLeft + 148, guiTop + 23, 192, 0, 6, 8); + if(oxidizer == -1) drawTexturedModalRect(guiLeft + 148, guiTop + 23, 198, 0, 6, 8); + if(launchpad.isMissileValid()) { + drawTexturedModalRect(guiLeft + 112, guiTop + 23, launchpad.power >= 75_000 ? 192 : 198, 0, 6, 8); + } + + int power = (int) (launchpad.power * 52 / launchpad.maxPower); + drawTexturedModalRect(guiLeft + 107, guiTop + 88 - power, 176, 52 - power, 16, power); + launchpad.tanks[0].renderTank(guiLeft + 125, guiTop + 88,this.zLevel, 16, 52); + launchpad.tanks[1].renderTank(guiLeft + 143, guiTop + 88,this.zLevel, 16, 52); + if(launchpad.slots[0] != null) { Consumer renderer = ItemRenderMissileGeneric.renderers.get(new ComparableStack(launchpad.slots[0]).makeSingular()); if(renderer != null) { diff --git a/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPadBase.java b/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPadBase.java index a54b485ef..6cc7d1a4b 100644 --- a/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPadBase.java +++ b/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPadBase.java @@ -16,6 +16,7 @@ import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.gui.GUILaunchPadLarge; import com.hbm.items.ModItems; import com.hbm.items.weapon.ItemMissile; +import com.hbm.items.weapon.ItemMissile.MissileFuel; import com.hbm.lib.Library; import com.hbm.main.MainRegistry; import com.hbm.tileentity.IGUIProvider; @@ -340,6 +341,28 @@ public abstract class TileEntityLaunchPadBase extends TileEntityMachineBase impl return this.isMissileValid() && this.hasFuel() && this.isReadyForLaunch(); } + public int getFuelState() { + return getGaugeState(0); + } + + public int getOxidizerState() { + return getGaugeState(1); + } + + public int getGaugeState(int tank) { + if(slots[0] == null) return 0; + + if(slots[0].getItem() instanceof ItemMissile) { + ItemMissile missile = (ItemMissile) slots[0].getItem(); + MissileFuel fuel = missile.fuel; + + if(fuel == MissileFuel.SOLID) return 0; + return tanks[tank].getFill() >= missile.fuelCap ? 1 : -1; + } + + return 0; + } + /** Any extra conditions for launching in addition to the missile being valid and fueled */ public abstract boolean isReadyForLaunch(); } diff --git a/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPadLarge.java b/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPadLarge.java index 87ee4d71a..7b36f7791 100644 --- a/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPadLarge.java +++ b/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPadLarge.java @@ -10,9 +10,12 @@ import com.hbm.tileentity.IRadarCommandReceiver; import api.hbm.energy.IEnergyUser; import api.hbm.fluid.IFluidStandardReceiver; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase implements IEnergyUser, IFluidStandardReceiver, IGUIProvider, IRadarCommandReceiver { @@ -160,11 +163,9 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase implements } if(this.liftMoving) { - if(this.audioLift == null) { + if(this.audioLift == null || !this.audioLift.isPlaying()) { this.audioLift = MainRegistry.proxy.getLoopedSound("hbm:door.wgh_start", xCoord, yCoord, zCoord, 0.75F, 25F, 1.0F, 5); this.audioLift.startSound(); - } else if(!this.audioLift.isPlaying()) { - this.audioLift.startSound(); } this.audioLift.keepAlive(); } else { @@ -175,11 +176,9 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase implements } if(this.erectorMoving) { - if(this.audioErector == null) { + if(this.audioErector == null || !this.audioErector.isPlaying()) { this.audioErector = MainRegistry.proxy.getLoopedSound("hbm:door.garage_move", xCoord, yCoord, zCoord, 1.5F, 25F, 1.0F, 5); this.audioErector.startSound(); - } else if(!this.audioErector.isPlaying()) { - this.audioErector.startSound(); } this.audioErector.keepAlive(); } else { @@ -255,4 +254,29 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase implements return missile; } + + AxisAlignedBB bb = null; + + @Override + public AxisAlignedBB getRenderBoundingBox() { + + if(bb == null) { + bb = AxisAlignedBB.getBoundingBox( + xCoord - 10, + yCoord, + zCoord - 10, + xCoord + 11, + yCoord + 15, + zCoord + 11 + ); + } + + return bb; + } + + @Override + @SideOnly(Side.CLIENT) + public double getMaxRenderDistanceSquared() { + return 65536.0D; + } }