This commit is contained in:
Aidan Brady 2013-11-19 22:13:35 -05:00
parent fc1cb7926c
commit 515cbf38c8
9 changed files with 66 additions and 71 deletions

View file

@ -181,6 +181,11 @@ public class GuiDigitalMiner extends GuiMekanism
{ {
drawCreativeTabHoveringText("Replace block", xAxis, yAxis); drawCreativeTabHoveringText("Replace block", xAxis, yAxis);
} }
if(xAxis >= 131 && xAxis <= 145 && yAxis >= 47 && yAxis <= 61)
{
drawCreativeTabHoveringText("Reset", xAxis, yAxis);
}
} }
@Override @Override
@ -218,6 +223,14 @@ public class GuiDigitalMiner extends GuiMekanism
drawTexturedModalRect(guiWidth + 147, guiHeight + 63, 176 + 4 + 14, 14, 14, 14); drawTexturedModalRect(guiWidth + 147, guiHeight + 63, 176 + 4 + 14, 14, 14, 14);
} }
if(xAxis >= 131 && xAxis <= 145 && yAxis >= 47 && yAxis <= 61)
{
drawTexturedModalRect(guiWidth + 131, guiHeight + 47, 176 + 4 + 28, 0, 14, 14);
}
else {
drawTexturedModalRect(guiWidth + 131, guiHeight + 47, 176 + 4 + 28, 14, 14, 14);
}
if(xAxis >= 144 && xAxis <= 160 && yAxis >= 27 && yAxis <= 43) if(xAxis >= 144 && xAxis <= 160 && yAxis >= 27 && yAxis <= 43)
{ {
GL11.glPushMatrix(); GL11.glPushMatrix();
@ -264,6 +277,16 @@ public class GuiDigitalMiner extends GuiMekanism
PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Object3D.get(tileEntity), data)); PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Object3D.get(tileEntity), data));
} }
if(xAxis >= 131 && xAxis <= 145 && yAxis >= 47 && yAxis <= 61)
{
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
ArrayList data = new ArrayList();
data.add(5);
PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Object3D.get(tileEntity), data));
}
if(xAxis >= 144 && xAxis <= 160 && yAxis >= 27 && yAxis <= 43) if(xAxis >= 144 && xAxis <= 160 && yAxis >= 27 && yAxis <= 43)
{ {
boolean doNull = false; boolean doNull = false;

View file

@ -14,17 +14,18 @@ import mekanism.common.inventory.container.ContainerNull;
import mekanism.common.miner.MItemStackFilter; import mekanism.common.miner.MItemStackFilter;
import mekanism.common.miner.MOreDictFilter; import mekanism.common.miner.MOreDictFilter;
import mekanism.common.miner.MinerFilter; import mekanism.common.miner.MinerFilter;
import mekanism.common.network.PacketDigitalMinerGui;
import mekanism.common.network.PacketDigitalMinerGui.MinerGuiPacket; import mekanism.common.network.PacketDigitalMinerGui.MinerGuiPacket;
import mekanism.common.network.PacketLogisticalSorterGui; import mekanism.common.network.PacketLogisticalSorterGui;
import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket; import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket;
import mekanism.common.network.PacketSimpleGui; import mekanism.common.network.PacketSimpleGui;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.tileentity.TileEntityDigitalMiner; import mekanism.common.tileentity.TileEntityDigitalMiner;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
@ -142,6 +143,10 @@ public class GuiDigitalMinerConfig extends GuiMekanism
{ {
super.mouseClicked(mouseX, mouseY, button); super.mouseClicked(mouseX, mouseY, button);
radiusField.mouseClicked(mouseX, mouseY, button);
minField.mouseClicked(mouseX, mouseY, button);
maxField.mouseClicked(mouseX, mouseY, button);
if(button == 0) if(button == 0)
{ {
int xAxis = (mouseX - (width - xSize) / 2); int xAxis = (mouseX - (width - xSize) / 2);
@ -166,44 +171,17 @@ public class GuiDigitalMinerConfig extends GuiMekanism
if(filter instanceof MItemStackFilter) if(filter instanceof MItemStackFilter)
{ {
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F); mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
PacketHandler.sendPacket(Transmission.SERVER, new PacketLogisticalSorterGui().setParams(SorterGuiPacket.SERVER_INDEX, Object3D.get(tileEntity), 1, getFilterIndex()+i)); PacketHandler.sendPacket(Transmission.SERVER, new PacketDigitalMinerGui().setParams(MinerGuiPacket.SERVER_INDEX, Object3D.get(tileEntity), 1, getFilterIndex()+i));
} }
else if(filter instanceof MOreDictFilter) else if(filter instanceof MOreDictFilter)
{ {
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F); mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
PacketHandler.sendPacket(Transmission.SERVER, new PacketLogisticalSorterGui().setParams(SorterGuiPacket.SERVER_INDEX, Object3D.get(tileEntity), 2, getFilterIndex()+i)); PacketHandler.sendPacket(Transmission.SERVER, new PacketDigitalMinerGui().setParams(MinerGuiPacket.SERVER_INDEX, Object3D.get(tileEntity), 2, getFilterIndex()+i));
} }
} }
} }
} }
if(xAxis >= 13 && xAxis <= 29 && yAxis >= 137 && yAxis <= 153)
{
ArrayList data = new ArrayList();
data.add(0);
PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Object3D.get(tileEntity), data));
mc.sndManager.playSoundFX("mekanism:etc.Ding", 1.0F, 1.0F);
}
if(xAxis >= 12 && xAxis <= 26 && yAxis >= 110 && yAxis <= 124)
{
ArrayList data = new ArrayList();
data.add(1);
PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Object3D.get(tileEntity), data));
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
}
if(xAxis >= 12 && xAxis <= 26 && yAxis >= 84 && yAxis <= 98)
{
ArrayList data = new ArrayList();
data.add(2);
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) if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16)
{ {
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F); mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
@ -250,19 +228,19 @@ public class GuiDigitalMinerConfig extends GuiMekanism
buttonList.add(new GuiButton(0, guiWidth + 56, guiHeight + 136, 54, 20, "ItemStack")); buttonList.add(new GuiButton(0, guiWidth + 56, guiHeight + 136, 54, 20, "ItemStack"));
buttonList.add(new GuiButton(1, guiWidth + 110, guiHeight + 136, 43, 20, "OreDict")); buttonList.add(new GuiButton(1, guiWidth + 110, guiHeight + 136, 43, 20, "OreDict"));
String prevRad = !radiusField.getText().equals("") ? radiusField.getText() : "" + tileEntity.radius; String prevRad = radiusField != null ? radiusField.getText() : "" + tileEntity.radius;
String prevMin = !minField.getText().equals("") ? minField.getText() : "" + tileEntity.minY; String prevMin = minField != null ? minField.getText() : "" + tileEntity.minY;
String prevMax = !maxField.getText().equals("") ? maxField.getText() : "" + tileEntity.maxY; String prevMax = maxField != null ? maxField.getText() : "" + tileEntity.maxY;
radiusField = new GuiTextField(fontRenderer, guiWidth + 11, guiHeight + 67, 20, 11); radiusField = new GuiTextField(fontRenderer, guiWidth + 12, guiHeight + 67, 24, 11);
radiusField.setMaxStringLength(3); radiusField.setMaxStringLength(3);
radiusField.setText(prevRad); radiusField.setText(prevRad);
minField = new GuiTextField(fontRenderer, guiWidth + 11, guiHeight + 79, 20, 11); minField = new GuiTextField(fontRenderer, guiWidth + 12, guiHeight + 92, 20, 11);
minField.setMaxStringLength(3); minField.setMaxStringLength(3);
minField.setText(prevMin); minField.setText(prevMin);
maxField = new GuiTextField(fontRenderer, guiWidth + 11, guiHeight + 91, 20, 11); maxField = new GuiTextField(fontRenderer, guiWidth + 12, guiHeight + 117, 20, 11);
maxField.setMaxStringLength(3); maxField.setMaxStringLength(3);
maxField.setText(prevMax); maxField.setText(prevMax);
} }
@ -295,13 +273,11 @@ public class GuiDigitalMinerConfig extends GuiMekanism
fontRenderer.drawString("IS: " + getItemStackFilters().size(), 11, 37, 0x00CD00); fontRenderer.drawString("IS: " + getItemStackFilters().size(), 11, 37, 0x00CD00);
fontRenderer.drawString("OD: " + getOreDictFilters().size(), 11, 46, 0x00CD00); fontRenderer.drawString("OD: " + getOreDictFilters().size(), 11, 46, 0x00CD00);
fontRenderer.drawString("Radius: " + tileEntity.radius, 11, 58, 0x00CD00); fontRenderer.drawString("Radi: " + tileEntity.radius, 11, 58, 0x00CD00);
fontRenderer.drawString("Min Y: " + tileEntity.minY, 11, 70, 0x00CD00); fontRenderer.drawString("MinY: " + tileEntity.minY, 11, 83, 0x00CD00);
fontRenderer.drawString("Max Y: " + tileEntity.maxY, 11, 82, 0x00CD00); fontRenderer.drawString("MaxY: " + tileEntity.maxY, 11, 108, 0x00CD00);
fontRenderer.drawString("Default:", 12, 126, 0x00CD00);
for(int i = 0; i < 4; i++) for(int i = 0; i < 4; i++)
{ {
@ -348,16 +324,6 @@ public class GuiDigitalMinerConfig extends GuiMekanism
} }
} }
if(xAxis >= 12 && xAxis <= 26 && yAxis >= 110 && yAxis <= 124)
{
drawCreativeTabHoveringText("Auto-eject", xAxis, yAxis);
}
if(xAxis >= 12 && xAxis <= 26 && yAxis >= 84 && yAxis <= 98)
{
drawCreativeTabHoveringText("Round robin", xAxis, yAxis);
}
super.drawGuiContainerForegroundLayer(mouseX, mouseY); super.drawGuiContainerForegroundLayer(mouseX, mouseY);
} }
@ -366,7 +332,7 @@ public class GuiDigitalMinerConfig extends GuiMekanism
{ {
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiLogisticalSorter.png")); mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMinerConfig.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int guiWidth = (width - xSize) / 2; int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2; int guiHeight = (height - ySize) / 2;
@ -397,14 +363,6 @@ public class GuiDigitalMinerConfig extends GuiMekanism
} }
} }
if(xAxis >= 12 && xAxis <= 26 && yAxis >= 110 && yAxis <= 124)
{
drawTexturedModalRect(guiWidth + 12, guiHeight + 110, 176, 0, 14, 14);
}
else {
drawTexturedModalRect(guiWidth + 12, guiHeight + 110, 176, 14, 14, 14);
}
if(xAxis >= 12 && xAxis <= 26 && yAxis >= 84 && yAxis <= 98) if(xAxis >= 12 && xAxis <= 26 && yAxis >= 84 && yAxis <= 98)
{ {
drawTexturedModalRect(guiWidth + 12, guiHeight + 84, 176 + 14, 0, 14, 14); drawTexturedModalRect(guiWidth + 12, guiHeight + 84, 176 + 14, 0, 14, 14);
@ -524,7 +482,7 @@ public class GuiDigitalMinerConfig extends GuiMekanism
{ {
ItemStack toAdd = stack.copy(); ItemStack toAdd = stack.copy();
if(!oreDictStacks.get(filter).iterStacks.contains(stack)) if(!oreDictStacks.get(filter).iterStacks.contains(stack) && toAdd.getItem() instanceof ItemBlock)
{ {
oreDictStacks.get(filter).iterStacks.add(stack.copy()); oreDictStacks.get(filter).iterStacks.add(stack.copy());
} }

View file

@ -15,6 +15,7 @@ import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
@ -209,10 +210,13 @@ public class GuiMItemStackFilter extends GuiMekanism
ItemStack stack = mc.thePlayer.inventory.getItemStack(); ItemStack stack = mc.thePlayer.inventory.getItemStack();
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
if(stack.getItem() instanceof ItemBlock)
{ {
filter.itemType = stack.copy(); filter.itemType = stack.copy();
filter.itemType.stackSize = 1; filter.itemType.stackSize = 1;
} }
}
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{ {
filter.itemType = null; filter.itemType = null;

View file

@ -19,6 +19,7 @@ import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
@ -315,7 +316,7 @@ public class GuiMOreDictFilter extends GuiMekanism
{ {
ItemStack toAdd = stack.copy(); ItemStack toAdd = stack.copy();
if(!iterStacks.contains(stack)) if(!iterStacks.contains(stack) && toAdd.getItem() instanceof ItemBlock)
{ {
iterStacks.add(stack.copy()); iterStacks.add(stack.copy());
} }

View file

@ -1,8 +1,5 @@
package mekanism.common.inventory.container; package mekanism.common.inventory.container;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.tileentity.TileEntityTeleporter;
import mekanism.common.util.ChargeUtils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;

View file

@ -3,6 +3,7 @@ package mekanism.common.miner;
import java.util.ArrayList; import java.util.ArrayList;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -15,6 +16,11 @@ public class MOreDictFilter extends MinerFilter
@Override @Override
public boolean canFilter(ItemStack itemStack) public boolean canFilter(ItemStack itemStack)
{ {
if(itemStack == null || !(itemStack.getItem() instanceof ItemBlock))
{
return false;
}
String oreKey = MekanismUtils.getOreDictName(itemStack); String oreKey = MekanismUtils.getOreDictName(itemStack);
if(oreKey == null) if(oreKey == null)

View file

@ -4,7 +4,7 @@ import java.io.DataOutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import mekanism.api.Object3D; import mekanism.api.Object3D;
import mekanism.client.gui.GuiDigitalMiner; import mekanism.client.gui.GuiDigitalMinerConfig;
import mekanism.client.gui.GuiMItemStackFilter; import mekanism.client.gui.GuiMItemStackFilter;
import mekanism.client.gui.GuiMOreDictFilter; import mekanism.client.gui.GuiMOreDictFilter;
import mekanism.common.PacketHandler; import mekanism.common.PacketHandler;
@ -163,13 +163,14 @@ public class PacketDigitalMinerGui implements IMekanismPacket
{ {
if(type == 0) if(type == 0)
{ {
return new GuiDigitalMiner(player.inventory, (TileEntityDigitalMiner)world.getBlockTileEntity(x, y, z)); return new GuiDigitalMinerConfig(player, (TileEntityDigitalMiner)world.getBlockTileEntity(x, y, z));
} }
else { else {
if(packetType == MinerGuiPacket.CLIENT) if(packetType == MinerGuiPacket.CLIENT)
{ {
if(type == 1) if(type == 1)
{ {
System.out.println("hi");
return new GuiMItemStackFilter(player, (TileEntityDigitalMiner)world.getBlockTileEntity(x, y, z)); return new GuiMItemStackFilter(player, (TileEntityDigitalMiner)world.getBlockTileEntity(x, y, z));
} }
else if(type == 2) else if(type == 2)

View file

@ -121,8 +121,9 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
public void reset() public void reset()
{ {
searcher.reset(); searcher = new ThreadMinerSearch(this);
running = false; running = false;
oresToMine.clear();
} }
@Override @Override
@ -244,6 +245,10 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
{ {
stop(); stop();
} }
else if(type == 5)
{
reset();
}
return; return;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB