Mekanism-tilera-Edition/common/mekanism/client/gui/GuiElement.java

81 lines
2.2 KiB
Java
Raw Normal View History

package mekanism.client.gui;
2013-08-26 02:54:34 +02:00
import java.util.List;
2013-08-26 02:54:34 +02:00
import mekanism.common.ObfuscatedNames;
import mekanism.common.util.MekanismUtils;
2013-08-26 02:54:34 +02:00
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
2013-08-26 02:54:34 +02:00
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
2014-03-16 01:05:26 +01:00
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
2013-08-26 02:54:34 +02:00
2014-03-16 01:05:26 +01:00
@SideOnly(Side.CLIENT)
2013-08-26 02:54:34 +02:00
public abstract class GuiElement
{
protected static Minecraft mc = Minecraft.getMinecraft();
2013-08-26 02:54:34 +02:00
protected ResourceLocation RESOURCE;
2014-01-05 04:43:54 +01:00
public GuiMekanism guiObj;
2013-08-26 02:54:34 +02:00
public TileEntity tileEntity;
2013-08-26 02:54:34 +02:00
public ResourceLocation defaultLocation;
2014-01-05 04:43:54 +01:00
public GuiElement(ResourceLocation resource, GuiMekanism gui, TileEntity tile, ResourceLocation def)
2013-08-26 02:54:34 +02:00
{
RESOURCE = resource;
guiObj = gui;
2013-08-26 02:54:34 +02:00
tileEntity = tile;
defaultLocation = def;
}
2013-08-26 02:54:34 +02:00
protected void displayTooltip(String s, int xAxis, int yAxis)
{
2014-01-05 04:43:54 +01:00
guiObj.drawCreativeTabHoveringText(s, xAxis, yAxis);
2013-08-26 02:54:34 +02:00
}
protected void displayTooltips(List<String> list, int xAxis, int yAxis)
{
guiObj.func_102021_a(list, xAxis, yAxis);
}
2013-08-26 02:54:34 +02:00
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) {}
}
2013-08-26 02:54:34 +02:00
}
2013-08-26 02:54:34 +02:00
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) {}
}
2013-08-26 02:54:34 +02:00
}
2013-08-26 02:54:34 +02:00
protected FontRenderer getFontRenderer()
{
return guiObj.getFontRenderer();
2013-08-26 02:54:34 +02:00
}
2013-08-26 02:54:34 +02:00
public abstract void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight);
2013-08-26 02:54:34 +02:00
public abstract void renderForeground(int xAxis, int yAxis);
public abstract void preMouseClicked(int xAxis, int yAxis, int button);
public abstract void mouseClicked(int xAxis, int yAxis, int button);
2013-08-26 02:54:34 +02:00
}