More work!
This commit is contained in:
parent
87f5bbcde2
commit
7a74fb86ba
10 changed files with 166 additions and 49 deletions
|
@ -10,6 +10,7 @@ import mekanism.client.gui.GuiCombiner;
|
|||
import mekanism.client.gui.GuiConfiguration;
|
||||
import mekanism.client.gui.GuiCredits;
|
||||
import mekanism.client.gui.GuiCrusher;
|
||||
import mekanism.client.gui.GuiDigitalMiner;
|
||||
import mekanism.client.gui.GuiDynamicTank;
|
||||
import mekanism.client.gui.GuiElectricChest;
|
||||
import mekanism.client.gui.GuiElectricPump;
|
||||
|
@ -300,7 +301,7 @@ public class ClientProxy extends CommonProxy
|
|||
case 1:
|
||||
return new GuiCredits();
|
||||
case 2:
|
||||
//DigitalMiner GUI TODO
|
||||
return new GuiDigitalMiner(player.inventory, (TileEntityDigitalMiner)tileEntity);
|
||||
case 3:
|
||||
return new GuiEnrichmentChamber(player.inventory, (TileEntityElectricMachine)tileEntity);
|
||||
case 4:
|
||||
|
|
|
@ -1,11 +1,21 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
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.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
|
@ -38,10 +48,29 @@ public class GuiDigitalMiner extends GuiMekanism
|
|||
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
||||
|
||||
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
||||
if(tileEntity.replaceStack != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
itemRenderer.renderItemAndEffectIntoGUI(fontRenderer, mc.getTextureManager(), tileEntity.replaceStack, 144, 27);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if(xAxis >= 164 && xAxis <= 168 && yAxis >= 25 && yAxis <= 77)
|
||||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
|
||||
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 47 && yAxis <= 61)
|
||||
{
|
||||
drawCreativeTabHoveringText("Auto-eject", xAxis, yAxis);
|
||||
}
|
||||
|
||||
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 63 && yAxis <= 77)
|
||||
{
|
||||
drawCreativeTabHoveringText("Auto-pull", xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -61,6 +90,71 @@ protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, in
|
|||
int displayInt;
|
||||
|
||||
displayInt = tileEntity.getScaledEnergyLevel(52);
|
||||
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 7 + 52 - displayInt, 4, displayInt);
|
||||
drawTexturedModalRect(guiWidth + 164, guiHeight + 25 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
|
||||
|
||||
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 47 && yAxis <= 61)
|
||||
{
|
||||
drawTexturedModalRect(guiWidth + 147, guiHeight + 47, 176 + 4, 0, 14, 14);
|
||||
}
|
||||
else {
|
||||
drawTexturedModalRect(guiWidth + 147, guiHeight + 47, 176 + 4, 14, 14, 14);
|
||||
}
|
||||
|
||||
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 63 && yAxis <= 77)
|
||||
{
|
||||
drawTexturedModalRect(guiWidth + 147, guiHeight + 63, 176 + 4 + 14, 0, 14, 14);
|
||||
}
|
||||
else {
|
||||
drawTexturedModalRect(guiWidth + 147, guiHeight + 63, 176 + 4 + 14, 14, 14, 14);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 47 && yAxis <= 61)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
|
||||
ArrayList data = new ArrayList();
|
||||
data.add(0);
|
||||
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Object3D.get(tileEntity), data));
|
||||
}
|
||||
|
||||
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 63 && yAxis <= 77)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
|
||||
ArrayList data = new ArrayList();
|
||||
data.add(1);
|
||||
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Object3D.get(tileEntity), data));
|
||||
}
|
||||
|
||||
if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35)
|
||||
{
|
||||
ItemStack stack = mc.thePlayer.inventory.getItemStack();
|
||||
|
||||
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
tileEntity.replaceStack = stack.copy();
|
||||
tileEntity.replaceStack.stackSize = 1;
|
||||
}
|
||||
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
tileEntity.replaceStack = null;
|
||||
}
|
||||
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,27 +2,23 @@ package mekanism.client.gui;
|
|||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.inventory.container.ContainerFilter;
|
||||
import mekanism.common.miner.MItemStackFilter;
|
||||
import mekanism.common.network.PacketDigitalMinerGui;
|
||||
import mekanism.common.network.PacketDigitalMinerGui.MinerGuiPacket;
|
||||
import mekanism.common.network.PacketEditFilter;
|
||||
import mekanism.common.network.PacketLogisticalSorterGui;
|
||||
import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket;
|
||||
import mekanism.common.network.PacketNewFilter;
|
||||
import mekanism.common.tileentity.TileEntityDigitalMiner;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mekanism.common.util.TransporterUtils;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
public class GuiMItemStackFilter extends GuiMekanism
|
||||
{
|
||||
|
@ -90,7 +86,7 @@ public class GuiMItemStackFilter extends GuiMekanism
|
|||
PacketHandler.sendPacket(Transmission.SERVER, new PacketEditFilter().setParams(Object3D.get(tileEntity), false, origFilter, filter));
|
||||
}
|
||||
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketLogisticalSorterGui().setParams(SorterGuiPacket.SERVER, Object3D.get(tileEntity), 0));
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketDigitalMinerGui().setParams(MinerGuiPacket.SERVER, Object3D.get(tileEntity), 0));
|
||||
}
|
||||
else if(filter.itemType == null)
|
||||
{
|
||||
|
@ -101,7 +97,7 @@ public class GuiMItemStackFilter extends GuiMekanism
|
|||
else if(guibutton.id == 1)
|
||||
{
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketEditFilter().setParams(Object3D.get(tileEntity), true, origFilter));
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketLogisticalSorterGui().setParams(SorterGuiPacket.SERVER, Object3D.get(tileEntity), 0));
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketDigitalMinerGui().setParams(MinerGuiPacket.SERVER, Object3D.get(tileEntity), 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,7 +201,7 @@ public class GuiMItemStackFilter extends GuiMekanism
|
|||
if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketLogisticalSorterGui().setParams(SorterGuiPacket.SERVER, Object3D.get(tileEntity), 0));
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketDigitalMinerGui().setParams(MinerGuiPacket.SERVER, Object3D.get(tileEntity), 0));
|
||||
}
|
||||
|
||||
if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35)
|
||||
|
|
|
@ -9,9 +9,9 @@ import mekanism.common.PacketHandler;
|
|||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.inventory.container.ContainerFilter;
|
||||
import mekanism.common.miner.MOreDictFilter;
|
||||
import mekanism.common.network.PacketDigitalMinerGui;
|
||||
import mekanism.common.network.PacketDigitalMinerGui.MinerGuiPacket;
|
||||
import mekanism.common.network.PacketEditFilter;
|
||||
import mekanism.common.network.PacketLogisticalSorterGui;
|
||||
import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket;
|
||||
import mekanism.common.network.PacketNewFilter;
|
||||
import mekanism.common.tileentity.TileEntityDigitalMiner;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
@ -132,7 +132,7 @@ public class GuiMOreDictFilter extends GuiMekanism
|
|||
PacketHandler.sendPacket(Transmission.SERVER, new PacketEditFilter().setParams(Object3D.get(tileEntity), false, origFilter, filter));
|
||||
}
|
||||
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketLogisticalSorterGui().setParams(SorterGuiPacket.SERVER, Object3D.get(tileEntity), 0));
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketDigitalMinerGui().setParams(MinerGuiPacket.SERVER, Object3D.get(tileEntity), 0));
|
||||
}
|
||||
else {
|
||||
status = EnumColor.DARK_RED + "No key";
|
||||
|
@ -142,7 +142,7 @@ public class GuiMOreDictFilter extends GuiMekanism
|
|||
else if(guibutton.id == 1)
|
||||
{
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketEditFilter().setParams(Object3D.get(tileEntity), true, origFilter));
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketLogisticalSorterGui().setParams(SorterGuiPacket.SERVER, Object3D.get(tileEntity), 0));
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketDigitalMinerGui().setParams(MinerGuiPacket.SERVER, Object3D.get(tileEntity), 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ public class GuiMOreDictFilter extends GuiMekanism
|
|||
if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketLogisticalSorterGui().setParams(SorterGuiPacket.SERVER, Object3D.get(tileEntity), 0));
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketDigitalMinerGui().setParams(MinerGuiPacket.SERVER, Object3D.get(tileEntity), 0));
|
||||
}
|
||||
|
||||
if(xAxis >= 131 && xAxis <= 143 && yAxis >= 47 && yAxis <= 59)
|
||||
|
|
|
@ -3,6 +3,7 @@ package mekanism.common;
|
|||
import java.io.File;
|
||||
|
||||
import mekanism.common.inventory.container.ContainerAdvancedElectricMachine;
|
||||
import mekanism.common.inventory.container.ContainerDigitalMiner;
|
||||
import mekanism.common.inventory.container.ContainerDynamicTank;
|
||||
import mekanism.common.inventory.container.ContainerElectricMachine;
|
||||
import mekanism.common.inventory.container.ContainerElectricPump;
|
||||
|
@ -244,7 +245,7 @@ public class CommonProxy
|
|||
switch(ID)
|
||||
{
|
||||
case 2:
|
||||
//DIGITAL MINER CONTAINER TODO
|
||||
return new ContainerDigitalMiner(player.inventory, (TileEntityDigitalMiner)tileEntity);
|
||||
case 3:
|
||||
return new ContainerElectricMachine(player.inventory, (TileEntityElectricMachine)tileEntity);
|
||||
case 4:
|
||||
|
|
|
@ -362,6 +362,10 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
|||
{
|
||||
return icons[blockID][11][0];
|
||||
}
|
||||
else if(meta == 4)
|
||||
{
|
||||
return icons[blockID][0][2]; //TODO
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -480,6 +484,10 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
|||
{
|
||||
return icons[blockID][11][0];
|
||||
}
|
||||
else if(metadata == 4)
|
||||
{
|
||||
return icons[blockID][0][2]; //TODO
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -498,7 +506,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
|||
list.add(new ItemStack(i, 1, 1));
|
||||
list.add(new ItemStack(i, 1, 2));
|
||||
list.add(new ItemStack(i, 1, 3));
|
||||
//TODO DIGITAL MINER
|
||||
list.add(new ItemStack(i, 1, 4));
|
||||
|
||||
for(RecipeType type : RecipeType.values())
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@ public class ContainerDigitalMiner extends Container
|
|||
}
|
||||
}
|
||||
|
||||
addSlotToContainer(new SlotDischarge(tentity, 27, 180, 11));
|
||||
addSlotToContainer(new SlotDischarge(tentity, 27, 152, 6));
|
||||
|
||||
int slotX;
|
||||
|
||||
|
@ -53,6 +53,7 @@ public class ContainerDigitalMiner extends Container
|
|||
{
|
||||
super.onContainerClosed(entityplayer);
|
||||
|
||||
tileEntity.closeChest();
|
||||
tileEntity.playersUsing.remove(entityplayer);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package mekanism.common.network;
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.client.gui.GuiDigitalMiner;
|
||||
|
@ -145,6 +146,16 @@ public class PacketDigitalMinerGui implements IMekanismPacket
|
|||
playerMP.openContainer = container;
|
||||
playerMP.openContainer.windowId = window;
|
||||
playerMP.openContainer.addCraftingToCrafters(playerMP);
|
||||
|
||||
if(guiType == 0)
|
||||
{
|
||||
TileEntityDigitalMiner tile = (TileEntityDigitalMiner)obj.getTileEntity(world);
|
||||
|
||||
for(EntityPlayer player : tile.playersUsing)
|
||||
{
|
||||
PacketHandler.sendPacket(Transmission.SINGLE_CLIENT, new PacketTileEntity().setParams(obj, tile.getFilterPacket(new ArrayList())), player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -183,6 +183,20 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
@Override
|
||||
public void handlePacketData(ByteArrayDataInput dataStream)
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
int type = dataStream.readInt();
|
||||
|
||||
if(type == 0)
|
||||
{
|
||||
doEject = !doEject;
|
||||
}
|
||||
else if(type == 1)
|
||||
{
|
||||
doPull = !doPull;
|
||||
}
|
||||
}
|
||||
|
||||
super.handlePacketData(dataStream);
|
||||
|
||||
int type = dataStream.readInt();
|
||||
|
@ -249,15 +263,6 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChest()
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
PacketHandler.sendPacket(Transmission.CLIENTS_RANGE, new PacketTileEntity().setParams(Object3D.get(this), getFilterPacket(new ArrayList())), Object3D.get(this), 50D);
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList getGenericPacket(ArrayList data)
|
||||
{
|
||||
super.getNetworkedData(data);
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Loading…
Reference in a new issue