diff --git a/assets/hbm/textures/gui/gui_ams_base.png b/assets/hbm/textures/gui/gui_ams_base.png index 760dfbec4..2c1039e14 100644 Binary files a/assets/hbm/textures/gui/gui_ams_base.png and b/assets/hbm/textures/gui/gui_ams_base.png differ diff --git a/assets/hbm/textures/gui/gui_ams_limiter.png b/assets/hbm/textures/gui/gui_ams_limiter.png index 316d938f8..6cb4472ce 100644 Binary files a/assets/hbm/textures/gui/gui_ams_limiter.png and b/assets/hbm/textures/gui/gui_ams_limiter.png differ diff --git a/assets/hbm/textures/items/ams_focus_blank.png b/assets/hbm/textures/items/ams_focus_blank.png new file mode 100644 index 000000000..6a5ca07bc Binary files /dev/null and b/assets/hbm/textures/items/ams_focus_blank.png differ diff --git a/assets/hbm/textures/items/ams_focus_booster.png b/assets/hbm/textures/items/ams_focus_booster.png new file mode 100644 index 000000000..7a58f7efb Binary files /dev/null and b/assets/hbm/textures/items/ams_focus_booster.png differ diff --git a/assets/hbm/textures/items/ams_focus_limiter.png b/assets/hbm/textures/items/ams_focus_limiter.png new file mode 100644 index 000000000..1659c3ba1 Binary files /dev/null and b/assets/hbm/textures/items/ams_focus_limiter.png differ diff --git a/com/hbm/inventory/gui/GUIAMSLimiter.java b/com/hbm/inventory/gui/GUIAMSLimiter.java index dbab5a181..924c82bde 100644 --- a/com/hbm/inventory/gui/GUIAMSLimiter.java +++ b/com/hbm/inventory/gui/GUIAMSLimiter.java @@ -34,6 +34,8 @@ public class GUIAMSLimiter extends GuiInfoContainer { limiter.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 69 - 52, 16, 52); this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 69 - 52, 16, 52, limiter.power, limiter.maxPower); + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 69 - 52, 16, 52, new String[] { "Efficiency:", limiter.efficiency + "%" }); + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 69 - 52, 16, 52, new String[] { "Heat:", limiter.heat + "/" + limiter.maxHeat }); } @Override @@ -53,6 +55,12 @@ public class GUIAMSLimiter extends GuiInfoContainer { int i = (int) limiter.getPowerScaled(52); drawTexturedModalRect(guiLeft + 134, guiTop + 69 - i, 192, 52 - i, 16, i); + int j = limiter.getEfficiencyScaled(52); + drawTexturedModalRect(guiLeft + 152, guiTop + 69 - j, 208, 52 - j, 16, j); + + int k = limiter.getHeatScaled(52); + drawTexturedModalRect(guiLeft + 8, guiTop + 69 - k, 176, 52 - k, 16, k); + Minecraft.getMinecraft().getTextureManager().bindTexture(limiter.tank.getSheet()); limiter.tank.renderTank(this, guiLeft + 26, guiTop + 69, limiter.tank.getTankType().textureX() * FluidTank.x, limiter.tank.getTankType().textureY() * FluidTank.y, 16, 52); diff --git a/com/hbm/inventory/gui/GuiInfoContainer.java b/com/hbm/inventory/gui/GuiInfoContainer.java index fe784566c..7dded0616 100644 --- a/com/hbm/inventory/gui/GuiInfoContainer.java +++ b/com/hbm/inventory/gui/GuiInfoContainer.java @@ -20,5 +20,10 @@ public abstract class GuiInfoContainer extends GuiContainer { if(x <= mouseX && x + width > mouseX && y < mouseY && y + height >= mouseY) gui.drawFluidInfo(new String[] { power + "/" + maxPower + "HE" }, mouseX, mouseY); } + + public void drawCustomInfo(GuiInfoContainer gui, int mouseX, int mouseY, int x, int y, int width, int height, String[] text) { + if(x <= mouseX && x + width > mouseX && y < mouseY && y + height >= mouseY) + this.func_146283_a(Arrays.asList(text), mouseX, mouseY); + } } diff --git a/com/hbm/packet/AuxGaugePacket.java b/com/hbm/packet/AuxGaugePacket.java new file mode 100644 index 000000000..55ddc2922 --- /dev/null +++ b/com/hbm/packet/AuxGaugePacket.java @@ -0,0 +1,71 @@ +package com.hbm.packet; + +import com.hbm.interfaces.IConsumer; +import com.hbm.interfaces.ISource; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; +import net.minecraft.client.Minecraft; +import net.minecraft.tileentity.TileEntity; + +public class AuxGaugePacket implements IMessage { + + int x; + int y; + int z; + int value; + int id; + + public AuxGaugePacket() + { + + } + + public AuxGaugePacket(int x, int y, int z, int value, int id) + { + this.x = x; + this.y = y; + this.z = z; + this.value = value; + this.id = id; + } + + @Override + public void fromBytes(ByteBuf buf) { + x = buf.readInt(); + y = buf.readInt(); + z = buf.readInt(); + value = buf.readInt(); + id = buf.readInt(); + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeInt(x); + buf.writeInt(y); + buf.writeInt(z); + buf.writeInt(value); + buf.writeInt(id); + } + + public static class Handler implements IMessageHandler { + + @Override + @SideOnly(Side.CLIENT) + public IMessage onMessage(AuxGaugePacket m, MessageContext ctx) { + try { + TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z); + + if (true) { + + } + + } catch (Exception x) { } + return null; + } + } +} diff --git a/com/hbm/packet/PacketDispatcher.java b/com/hbm/packet/PacketDispatcher.java index b09c050e3..f89cf6b54 100644 --- a/com/hbm/packet/PacketDispatcher.java +++ b/com/hbm/packet/PacketDispatcher.java @@ -51,6 +51,8 @@ public class PacketDispatcher { wrapper.registerMessage(TEPressPacket.Handler.class, TEPressPacket.class, i++, Side.CLIENT); //Electricity gauge for GUI rendering wrapper.registerMessage(AuxElectricityPacket.Handler.class, AuxElectricityPacket.class, i++, Side.CLIENT); + //Electricity gauge for GUI rendering + wrapper.registerMessage(AuxGaugePacket.Handler.class, AuxGaugePacket.class, i++, Side.CLIENT); } } diff --git a/com/hbm/tileentity/machine/TileEntityAMSLimiter.java b/com/hbm/tileentity/machine/TileEntityAMSLimiter.java index d51fbdc88..2ad585038 100644 --- a/com/hbm/tileentity/machine/TileEntityAMSLimiter.java +++ b/com/hbm/tileentity/machine/TileEntityAMSLimiter.java @@ -32,9 +32,9 @@ public class TileEntityAMSLimiter extends TileEntity implements ISidedInventory, public long power = 0; public static final long maxPower = 1000000; public int efficiency = 0; - public static final long maxEfficiency = 100; + public static final int maxEfficiency = 100; public int heat = 0; - public static final long maxHeat = 2500; + public static final int maxHeat = 2500; public int age = 0; public int warning = 0; public int mode = 0; @@ -211,6 +211,32 @@ public class TileEntityAMSLimiter extends TileEntity implements ISidedInventory, tank.setType(0, 1, slots); tank.updateTank(xCoord, yCoord, zCoord); + + heat = 0; + + if(slots[0] != null) + heat += maxHeat/2; + if(slots[1] != null) + heat += maxHeat/2; + + if(power > 0) { + //" - (maxHeat / 2)" offsets center to 50% instead of 0% + efficiency = Math.round(calcEffect(power, heat - (maxHeat / 2)) * 100); + power -= Math.ceil(power * 0.025); + heat += efficiency; + } else { + efficiency = 0; + } + + //TODO + /*if(tank.getTankType().name().equals(FluidType.CRYOGEL.name())) { + + int i = (int) (1/Math.sqrt(heat + 1)); + + if() { + + } + }*/ power = Library.chargeTEFromItems(slots, 3, power, maxPower); @@ -218,9 +244,29 @@ public class TileEntityAMSLimiter extends TileEntity implements ISidedInventory, } } + private float gauss(float a, float x) { + + //Greater values -> less difference of temperate impact + double amplifier = 0.10; + + return (float) ( (1/Math.sqrt(a * Math.PI)) * Math.pow(Math.E, -1 * Math.pow(x, 2)/amplifier) ); + } + + private float calcEffect(float a, float x) { + return (float) (gauss( 1 / a, x / maxHeat) * Math.sqrt(Math.PI * 2) / (Math.sqrt(2) * Math.sqrt(maxPower))); + } + public long getPowerScaled(long i) { return (power * i) / maxPower; } + + public int getEfficiencyScaled(int i) { + return (efficiency * i) / maxEfficiency; + } + + public int getHeatScaled(int i) { + return (heat * i) / maxHeat; + } @Override public void setPower(long i) {