Merge branches 'development' and 'development' of https://github.com/aidancbrady/Mekanism into development

This commit is contained in:
Aidan C. Brady 2014-01-10 23:17:31 -05:00
commit dc69809d15
14 changed files with 88 additions and 75 deletions

View file

@ -27,6 +27,7 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiUpgradeManagement(this, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiConfigurationTab(this, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiPowerBar(this, tileEntity, tileEntity.guiLocation, 164, 15));
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
@ -45,11 +46,6 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
fontRenderer.drawString(tileEntity.getInvName(), (xSize/2)-(fontRenderer.getStringWidth(tileEntity.getInvName())/2), 6, 0x404040);
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
{
drawCreativeTabHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis);
}
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
}
@ -57,8 +53,6 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
@Override
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
{
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
mc.renderEngine.bindTexture(tileEntity.guiLocation);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int guiWidth = (width - xSize) / 2;
@ -69,14 +63,13 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
int yAxis = mouseY - guiHeight;
int displayInt;
displayInt = tileEntity.getScaledEnergyLevel(52);
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 19 + 52 - displayInt, 4, displayInt);
displayInt = tileEntity.getScaledSecondaryEnergyLevel(12);
drawTexturedModalRect(guiWidth + 61, guiHeight + 37 + 12 - displayInt, 176, 7 + 12 - displayInt, 5, displayInt);
displayInt = tileEntity.getScaledProgress(24);
drawTexturedModalRect(guiWidth + 79, guiHeight + 39, 176, 0, displayInt + 1, 7);
}
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
}
}

View file

@ -27,6 +27,7 @@ public class GuiElectricMachine extends GuiMekanism
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiUpgradeManagement(this, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiConfigurationTab(this, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiPowerBar(this, tileEntity, tileEntity.guiLocation, 164, 15));
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
@ -45,11 +46,6 @@ public class GuiElectricMachine extends GuiMekanism
fontRenderer.drawString(tileEntity.getInvName(), 45, 6, 0x404040);
fontRenderer.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
{
drawCreativeTabHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis);
}
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
}
@ -57,8 +53,6 @@ public class GuiElectricMachine extends GuiMekanism
@Override
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
{
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
mc.renderEngine.bindTexture(tileEntity.guiLocation);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int guiWidth = (width - xSize) / 2;
@ -70,10 +64,9 @@ public class GuiElectricMachine extends GuiMekanism
int displayInt;
displayInt = tileEntity.getScaledEnergyLevel(52);
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 7 + 52 - displayInt, 4, displayInt);
displayInt = tileEntity.getScaledProgress(24);
drawTexturedModalRect(guiWidth + 79, guiHeight + 39, 176, 0, displayInt + 1, 7);
}
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
}
}

View file

@ -6,6 +6,7 @@ import mekanism.common.tile.TileEntityElectricPump;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
@ -17,11 +18,15 @@ import cpw.mods.fml.relauncher.SideOnly;
public class GuiElectricPump extends GuiMekanism
{
public TileEntityElectricPump tileEntity;
public ResourceLocation guiLocation = MekanismUtils.getResource(ResourceType.GUI, "GuiElectricPump.png");
public GuiElectricPump(InventoryPlayer inventory, TileEntityElectricPump tentity)
{
super(new ContainerElectricPump(inventory, tentity));
tileEntity = tentity;
guiElements.add(new GuiPowerBar(this, tileEntity, guiLocation, 164, 15));
}
@Override
@ -40,33 +45,24 @@ public class GuiElectricPump extends GuiMekanism
drawCreativeTabHoveringText(tileEntity.fluidTank.getFluid() != null ? tileEntity.fluidTank.getFluid().getFluid().getLocalizedName() + ": " + tileEntity.fluidTank.getFluid().amount + "mB" : MekanismUtils.localize("gui.empty"), xAxis, yAxis);
}
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
{
drawCreativeTabHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis);
}
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
{
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiElectricPump.png"));
mc.renderEngine.bindTexture(guiLocation);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
int displayInt;
displayInt = tileEntity.getScaledEnergyLevel(52);
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
if(tileEntity.getScaledFluidLevel(58) > 0)
{
displayGauge(7, 14, tileEntity.getScaledFluidLevel(58), tileEntity.fluidTank.getFluid());
}
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
}
public void displayGauge(int xPos, int yPos, int scale, FluidStack fluid)
@ -105,7 +101,7 @@ public class GuiElectricPump extends GuiMekanism
}
}
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiElectricPump.png"));
mc.renderEngine.bindTexture(guiLocation);
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos, 176, 52, 16, 60);
}
}

View file

@ -2,12 +2,8 @@ package mekanism.client.gui;
import java.util.List;
import mekanism.common.ObfuscatedNames;
import mekanism.common.util.MekanismUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
@ -43,33 +39,17 @@ public abstract class GuiElement
protected void offsetX(int xSize)
{
if(guiObj instanceof GuiContainer)
{
try {
int size = (Integer)MekanismUtils.getPrivateValue(guiObj, GuiContainer.class, ObfuscatedNames.GuiContainer_xSize);
MekanismUtils.setPrivateValue(guiObj, size+xSize, GuiContainer.class, ObfuscatedNames.GuiContainer_xSize);
} catch(Exception e) {}
}
guiObj.xSize += xSize;
}
protected void offsetY(int ySize)
{
if(guiObj instanceof GuiContainer)
{
try {
int size = (Integer)MekanismUtils.getPrivateValue(guiObj, GuiContainer.class, ObfuscatedNames.GuiContainer_ySize);
MekanismUtils.setPrivateValue(guiObj, size+ySize, GuiContainer.class, ObfuscatedNames.GuiContainer_ySize);
} catch(Exception e) {}
}
guiObj.ySize += ySize;
}
protected FontRenderer getFontRenderer()
{
try {
return (FontRenderer)MekanismUtils.getPrivateValue(guiObj, GuiScreen.class, ObfuscatedNames.GuiScreen_fontRenderer);
} catch(Exception e) {}
return null;
return guiObj.getFontRenderer();
}
public abstract void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight);

View file

@ -9,6 +9,8 @@ import mekanism.common.IInvConfiguration;
import mekanism.common.SideData;
import mekanism.common.item.ItemConfigurator;
import mekanism.common.tile.TileEntityContainerBlock;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
@ -148,4 +150,9 @@ public abstract class GuiMekanism extends GuiContainer
super.func_102021_a(list, x, y);
GL11.glPopAttrib();
}
protected FontRenderer getFontRenderer()
{
return fontRenderer;
}
}

View file

@ -0,0 +1,59 @@
package mekanism.client.gui;
import mekanism.common.tile.TileEntityElectricBlock;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
public class GuiPowerBar extends GuiElement
{
private int xLocation;
private int yLocation;
private int width = 6;
private int height = 56;
private int innerOffsetY = 2;
private TileEntityElectricBlock tileEntityElectric;
public GuiPowerBar(GuiMekanism gui, TileEntityElectricBlock tile, ResourceLocation def, int x, int y)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiPowerBar.png"), gui, tile, def);
tileEntityElectric = tile;
xLocation = x;
yLocation = y;
}
@Override
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
{
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedModalRect(guiWidth + xLocation, guiHeight + yLocation, 0, 0, width, height);
int displayInt = tileEntityElectric.getScaledEnergyLevel(52) + innerOffsetY;
guiObj.drawTexturedModalRect(guiWidth + xLocation, guiHeight + yLocation + height - displayInt, 6, height - displayInt, width, displayInt);
mc.renderEngine.bindTexture(defaultLocation);
}
@Override
public void renderForeground(int xAxis, int yAxis)
{
mc.renderEngine.bindTexture(RESOURCE);
if(xAxis >= xLocation && xAxis <= xLocation + width && yAxis >= yLocation && yAxis <= yLocation + height)
{
displayTooltip(MekanismUtils.getEnergyDisplay(tileEntityElectric.getEnergy()), xAxis, yAxis);
}
mc.renderEngine.bindTexture(defaultLocation);
}
@Override
public void preMouseClicked(int xAxis, int yAxis, int button) {}
@Override
public void mouseClicked(int xAxis, int yAxis, int button) {}
}

View file

@ -75,22 +75,7 @@ public class TileEntitySolarGenerator extends TileEntityGenerator
else {
seesSun = false;
}
for(int y = yCoord+1; y < 256; y++)
{
Coord4D obj = new Coord4D(xCoord, y, zCoord, worldObj.provider.dimensionId);
Block block = Block.blocksList[obj.getBlockId(worldObj)];
if(block != null)
{
if(block.isOpaqueCube() || block.blockID == MekanismGenerators.generatorID && obj.getMetadata(worldObj) == GeneratorType.SOLAR_GENERATOR.meta)
{
seesSun = false;
break;
}
}
}
if(canOperate())
{
setActive(true);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B