Added the visuals tab. Easier than I thought!
This commit is contained in:
parent
f6a34f59bb
commit
6889bba52d
7 changed files with 82 additions and 46 deletions
|
@ -46,6 +46,7 @@ public class GuiDigitalMiner extends GuiMekanism
|
|||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png")));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png")));
|
||||
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png"), 163, 23));
|
||||
guiElements.add(new GuiVisualsTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png")));
|
||||
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
|
||||
@Override
|
||||
public List<String> getInfo()
|
||||
|
|
74
src/main/java/mekanism/client/gui/GuiVisualsTab.java
Normal file
74
src/main/java/mekanism/client/gui/GuiVisualsTab.java
Normal file
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,26 +1,23 @@
|
|||
package mekanism.common.base;
|
||||
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.IConfigurable;
|
||||
import mekanism.api.IFilterAccess;
|
||||
import mekanism.api.energy.IStrictEnergyAcceptor;
|
||||
import mekanism.api.energy.IStrictEnergyStorage;
|
||||
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.Optional.InterfaceList;
|
||||
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
|
||||
@InterfaceList({
|
||||
@Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2"),
|
||||
@Interface(iface = "cofh.api.energy.IEnergyHandler", modid = "CoFHAPI|energy"),
|
||||
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
})
|
||||
public interface IAdvancedBoundingBlock extends IBoundingBlock, ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IStrictEnergyStorage, IEnergyHandler, IPeripheral, IFilterAccess, IConfigurable
|
||||
public interface IAdvancedBoundingBlock extends IBoundingBlock, ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IStrictEnergyStorage, IEnergyHandler, IPeripheral, IFilterAccess
|
||||
{
|
||||
public int[] getBoundSlots(Coord4D location, int side);
|
||||
|
||||
|
|
|
@ -1,35 +1,32 @@
|
|||
package mekanism.common.tile;
|
||||
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.IConfigurable;
|
||||
import mekanism.api.IFilterAccess;
|
||||
import mekanism.api.energy.IStrictEnergyAcceptor;
|
||||
import mekanism.common.base.IAdvancedBoundingBlock;
|
||||
import mekanism.common.util.InventoryUtils;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.Optional.InterfaceList;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.lua.LuaException;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
|
||||
@InterfaceList({
|
||||
@Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2"),
|
||||
@Interface(iface = "cofh.api.energy.IEnergyHandler", modid = "CoFHAPI|energy"),
|
||||
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
})
|
||||
public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock implements ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IEnergyHandler, IPeripheral, IFilterAccess, IConfigurable
|
||||
public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock implements ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IEnergyHandler, IPeripheral, IFilterAccess
|
||||
{
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
|
@ -493,26 +490,4 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
|
|||
|
||||
return getInv().getDataType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSneakRightClick(EntityPlayer player, int side)
|
||||
{
|
||||
if(getInv() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return getInv().onSneakRightClick(player, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onRightClick(EntityPlayer player, int side)
|
||||
{
|
||||
if(getInv() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return getInv().onRightClick(player, side);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1409,18 +1409,6 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
{
|
||||
return "tooltip.filterCard.digitalMiner";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSneakRightClick(EntityPlayer player, int side)
|
||||
{
|
||||
return clientRendering = !clientRendering;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onRightClick(EntityPlayer player, int side)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void writeSustainedData(ItemStack itemStack)
|
||||
{
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
|
@ -413,6 +413,7 @@ gui.cells=cells
|
|||
gui.providers=providers
|
||||
gui.structure=Structure
|
||||
gui.dynamicTank=Dynamic Tank
|
||||
gui.visuals=Visuals
|
||||
|
||||
gui.reactor.injectionRate=Injection Rate
|
||||
|
||||
|
|
Loading…
Reference in a new issue