GUI is coming together! Still need to add reset button and map button actions, but layout is there.
This commit is contained in:
parent
d02d0ceadf
commit
73bf81ceaa
6 changed files with 143 additions and 7 deletions
|
@ -6,13 +6,13 @@ import mekanism.api.Object3D;
|
|||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.inventory.container.ContainerDigitalMiner;
|
||||
import mekanism.common.network.PacketDigitalMinerGui;
|
||||
import mekanism.common.network.PacketDigitalMinerGui.MinerGuiPacket;
|
||||
import mekanism.common.network.PacketTileEntity;
|
||||
import mekanism.common.tileentity.TileEntityDigitalMiner;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
@ -27,6 +27,10 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
public class GuiDigitalMiner extends GuiMekanism
|
||||
{
|
||||
public TileEntityDigitalMiner tileEntity;
|
||||
|
||||
public GuiButton startButton;
|
||||
public GuiButton stopButton;
|
||||
public GuiButton configButton;
|
||||
|
||||
public GuiDigitalMiner(InventoryPlayer inventory, TileEntityDigitalMiner tentity)
|
||||
{
|
||||
|
@ -38,6 +42,62 @@ public class GuiDigitalMiner extends GuiMekanism
|
|||
|
||||
ySize+=64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
buttonList.clear();
|
||||
startButton = new GuiButton(0, guiWidth + 69, guiHeight + 17, 60, 20, "Start");
|
||||
|
||||
if(tileEntity.searcher.finished == true && tileEntity.running)
|
||||
{
|
||||
startButton.enabled = false;
|
||||
}
|
||||
|
||||
stopButton = new GuiButton(1, guiWidth + 69, guiHeight + 37, 60, 20, "Stop");
|
||||
|
||||
if(tileEntity.searcher.finished == false || !tileEntity.running)
|
||||
{
|
||||
stopButton.enabled = false;
|
||||
}
|
||||
|
||||
configButton = new GuiButton(2, guiWidth + 69, guiHeight + 57, 60, 20, "Config");
|
||||
|
||||
if(tileEntity.searcher.finished == true)
|
||||
{
|
||||
configButton.enabled = false;
|
||||
}
|
||||
|
||||
buttonList.add(startButton);
|
||||
buttonList.add(stopButton);
|
||||
buttonList.add(configButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen()
|
||||
{
|
||||
super.updateScreen();
|
||||
|
||||
if(tileEntity.searcher.finished == true && tileEntity.running)
|
||||
{
|
||||
startButton.enabled = false;
|
||||
}
|
||||
|
||||
if(tileEntity.searcher.finished == false || !tileEntity.running)
|
||||
{
|
||||
stopButton.enabled = false;
|
||||
}
|
||||
|
||||
if(tileEntity.searcher.finished == true)
|
||||
{
|
||||
configButton.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
|
@ -73,6 +133,11 @@ public class GuiDigitalMiner extends GuiMekanism
|
|||
{
|
||||
drawCreativeTabHoveringText("Auto-pull", xAxis, yAxis);
|
||||
}
|
||||
|
||||
if(xAxis >= 144 && xAxis <= 160 && yAxis >= 27 && yAxis <= 43)
|
||||
{
|
||||
drawCreativeTabHoveringText("Replace block", xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -164,7 +229,10 @@ public class GuiDigitalMiner extends GuiMekanism
|
|||
|
||||
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
toUse = stack.copy();
|
||||
if(stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
toUse = stack.copy();
|
||||
}
|
||||
}
|
||||
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
|
@ -178,12 +246,12 @@ public class GuiDigitalMiner extends GuiMekanism
|
|||
|
||||
if(stack != null)
|
||||
{
|
||||
data.add(true);
|
||||
data.add(false);
|
||||
data.add(stack.itemID);
|
||||
data.add(stack.getItemDamage());
|
||||
}
|
||||
else {
|
||||
data.add(false);
|
||||
data.add(true);
|
||||
}
|
||||
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Object3D.get(tileEntity), data));
|
||||
|
|
|
@ -14,8 +14,10 @@ import mekanism.common.inventory.container.ContainerNull;
|
|||
import mekanism.common.miner.MItemStackFilter;
|
||||
import mekanism.common.miner.MOreDictFilter;
|
||||
import mekanism.common.miner.MinerFilter;
|
||||
import mekanism.common.network.PacketDigitalMinerGui.MinerGuiPacket;
|
||||
import mekanism.common.network.PacketLogisticalSorterGui;
|
||||
import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket;
|
||||
import mekanism.common.network.PacketSimpleGui;
|
||||
import mekanism.common.network.PacketTileEntity;
|
||||
import mekanism.common.tileentity.TileEntityDigitalMiner;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
@ -201,6 +203,12 @@ public class GuiDigitalMinerConfig extends GuiMekanism
|
|||
PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Object3D.get(tileEntity), data));
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketSimpleGui().setParams(Object3D.get(tileEntity), 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,6 +413,14 @@ public class GuiDigitalMinerConfig extends GuiMekanism
|
|||
drawTexturedModalRect(guiWidth + 12, guiHeight + 84, 176 + 14, 14, 14, 14);
|
||||
}
|
||||
|
||||
if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16)
|
||||
{
|
||||
drawTexturedModalRect(guiWidth + 5, guiHeight + 5, 176, 0, 11, 11);
|
||||
}
|
||||
else {
|
||||
drawTexturedModalRect(guiWidth + 5, guiHeight + 5, 176, 11, 11, 11);
|
||||
}
|
||||
|
||||
radiusField.drawTextBox();
|
||||
minField.drawTextBox();
|
||||
maxField.drawTextBox();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package mekanism.common.inventory.container;
|
||||
|
||||
import mekanism.common.inventory.slot.SlotElectricChest;
|
||||
import mekanism.common.inventory.slot.SlotMachineUpgrade;
|
||||
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
|
||||
import mekanism.common.item.ItemMachineUpgrade;
|
||||
import mekanism.common.tileentity.TileEntityDigitalMiner;
|
||||
|
@ -29,6 +30,7 @@ public class ContainerDigitalMiner extends Container
|
|||
}
|
||||
|
||||
addSlotToContainer(new SlotDischarge(tentity, 27, 152, 6));
|
||||
addSlotToContainer(new SlotMachineUpgrade(tentity, 28, 180, 11));
|
||||
|
||||
int slotX;
|
||||
|
||||
|
|
|
@ -56,6 +56,8 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
public boolean isActive;
|
||||
public boolean clientActive;
|
||||
|
||||
public boolean running;
|
||||
|
||||
/** This machine's current RedstoneControl type. */
|
||||
public RedstoneControl controlType = RedstoneControl.DISABLED;
|
||||
|
||||
|
@ -109,6 +111,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
doEject = nbtTags.getBoolean("doEject");
|
||||
doPull = nbtTags.getBoolean("doPull");
|
||||
isActive = nbtTags.getBoolean("isActive");
|
||||
running = nbtTags.getBoolean("running");
|
||||
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
|
||||
|
||||
if(nbtTags.hasKey("replaceStack"))
|
||||
|
@ -148,6 +151,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
nbtTags.setBoolean("doEject", doEject);
|
||||
nbtTags.setBoolean("doPull", doPull);
|
||||
nbtTags.setBoolean("isActive", isActive);
|
||||
nbtTags.setBoolean("running", running);
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
|
||||
if(replaceStack != null)
|
||||
|
@ -207,6 +211,8 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
replaceStack = null;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
super.handlePacketData(dataStream);
|
||||
|
@ -220,8 +226,18 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
maxY = dataStream.readInt();
|
||||
doEject = dataStream.readBoolean();
|
||||
doPull = dataStream.readBoolean();
|
||||
clientToMine = dataStream.readInt();
|
||||
isActive = dataStream.readBoolean();
|
||||
running = dataStream.readBoolean();
|
||||
|
||||
if(dataStream.readBoolean())
|
||||
{
|
||||
replaceStack = new ItemStack(dataStream.readInt(), 1, dataStream.readInt());
|
||||
}
|
||||
else {
|
||||
replaceStack = null;
|
||||
}
|
||||
|
||||
clientToMine = dataStream.readInt();
|
||||
controlType = RedstoneControl.values()[dataStream.readInt()];
|
||||
|
||||
filters.clear();
|
||||
|
@ -240,8 +256,18 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
maxY = dataStream.readInt();
|
||||
doEject = dataStream.readBoolean();
|
||||
doPull = dataStream.readBoolean();
|
||||
clientToMine = dataStream.readInt();
|
||||
isActive = dataStream.readBoolean();
|
||||
running = dataStream.readBoolean();
|
||||
|
||||
if(dataStream.readBoolean())
|
||||
{
|
||||
replaceStack = new ItemStack(dataStream.readInt(), 1, dataStream.readInt());
|
||||
}
|
||||
else {
|
||||
replaceStack = null;
|
||||
}
|
||||
|
||||
clientToMine = dataStream.readInt();
|
||||
controlType = RedstoneControl.values()[dataStream.readInt()];
|
||||
}
|
||||
else if(type == 2)
|
||||
|
@ -270,6 +296,18 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
data.add(doEject);
|
||||
data.add(doPull);
|
||||
data.add(isActive);
|
||||
data.add(running);
|
||||
|
||||
if(replaceStack != null)
|
||||
{
|
||||
data.add(true);
|
||||
data.add(replaceStack.itemID);
|
||||
data.add(replaceStack.getItemDamage());
|
||||
}
|
||||
else {
|
||||
data.add(false);
|
||||
}
|
||||
|
||||
data.add(oresToMine.size());
|
||||
data.add(controlType.ordinal());
|
||||
|
||||
|
@ -295,6 +333,18 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
data.add(doEject);
|
||||
data.add(doPull);
|
||||
data.add(isActive);
|
||||
data.add(running);
|
||||
|
||||
if(replaceStack != null)
|
||||
{
|
||||
data.add(true);
|
||||
data.add(replaceStack.itemID);
|
||||
data.add(replaceStack.getItemDamage());
|
||||
}
|
||||
else {
|
||||
data.add(false);
|
||||
}
|
||||
|
||||
data.add(oresToMine.size());
|
||||
data.add(controlType.ordinal());
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 4.2 KiB |
Loading…
Reference in a new issue