mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
Added the visuals tab. Easier than I thought!
This commit is contained in:
1 parent
f6a34f59bb
commit
6889bba52d
7 files changed
+82
-46
No files matched your search
@@ -0,0 +1,74 @@
|
||||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.tile.TileEntityDigitalMiner;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
|
||||
public class GuiVisualsTab extends GuiElement
|
||||
{
|
||||
private TileEntityDigitalMiner tileEntity;
|
||||
|
||||
public GuiVisualsTab(IGuiWrapper gui, TileEntityDigitalMiner tile, ResourceLocation def)
|
||||
{
|
||||
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiVisualsTab.png"), gui, def);
|
||||
|
||||
tileEntity = tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle4i getBounds(int guiWidth, int guiHeight)
|
||||
{
|
||||
return new Rectangle4i(guiWidth - 26, guiHeight + 6, 26, 26);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
|
||||
{
|
||||
mc.renderEngine.bindTexture(RESOURCE);
|
||||
|
||||
guiObj.drawTexturedRect(guiWidth - 26, guiHeight + 6, 0, 0, 26, 26);
|
||||
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 10 && yAxis <= 28)
|
||||
{
|
||||
guiObj.drawTexturedRect(guiWidth - 21, guiHeight + 10, 26, 0, 18, 18);
|
||||
}
|
||||
else {
|
||||
guiObj.drawTexturedRect(guiWidth - 21, guiHeight + 10, 26, 18, 18, 18);
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(defaultLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int xAxis, int yAxis)
|
||||
{
|
||||
mc.renderEngine.bindTexture(RESOURCE);
|
||||
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 10 && yAxis <= 28)
|
||||
{
|
||||
displayTooltip(MekanismUtils.localize("gui.visuals") + ": " + LangUtils.transOnOff(tileEntity.clientRendering), 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)
|
||||
{
|
||||
if(button == 0)
|
||||
{
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 10 && yAxis <= 28)
|
||||
{
|
||||
tileEntity.clientRendering = !tileEntity.clientRendering;
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user