diff --git a/src/main/java/mekanism/client/gui/GuiDigitalMiner.java b/src/main/java/mekanism/client/gui/GuiDigitalMiner.java index f1a5f6eb9..c50441a80 100644 --- a/src/main/java/mekanism/client/gui/GuiDigitalMiner.java +++ b/src/main/java/mekanism/client/gui/GuiDigitalMiner.java @@ -265,21 +265,6 @@ public class GuiDigitalMiner extends GuiMekanism } super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); - - if(xAxis >= 144 && xAxis <= 160 && yAxis >= 27 && yAxis <= 43) - { - GL11.glPushMatrix(); - GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_DEPTH_TEST); - - int x = guiWidth + 144; - int y = guiHeight + 27; - drawGradientRect(x, y, x + 16, y + 16, -2130706433, -2130706433); - - GL11.glPopAttrib(); - GL11.glPopMatrix(); - } } @Override @@ -331,49 +316,6 @@ public class GuiDigitalMiner extends GuiMekanism Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data)); } - - if(xAxis >= 144 && xAxis <= 160 && yAxis >= 27 && yAxis <= 43) - { - boolean doNull = false; - ItemStack stack = mc.thePlayer.inventory.getItemStack(); - ItemStack toUse = null; - - if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) - { - if(stack.getItem() instanceof ItemBlock) - { - if(Block.getBlockFromItem(stack.getItem()) != Blocks.bedrock) - { - toUse = stack.copy(); - toUse.stackSize = 1; - } - } - } - else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) - { - doNull = true; - } - - if(toUse != null || doNull) - { - ArrayList data = new ArrayList(); - data.add(2); - - if(stack != null) - { - data.add(false); - data.add(MekanismUtils.getID(toUse)); - data.add(toUse.getItemDamage()); - } - else { - data.add(true); - } - - Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data)); - } - - SoundHandler.playSound("gui.button.press"); - } } } } diff --git a/src/main/java/mekanism/client/gui/GuiMItemStackFilter.java b/src/main/java/mekanism/client/gui/GuiMItemStackFilter.java index 4fd443744..8fc9b078e 100644 --- a/src/main/java/mekanism/client/gui/GuiMItemStackFilter.java +++ b/src/main/java/mekanism/client/gui/GuiMItemStackFilter.java @@ -1,5 +1,7 @@ package mekanism.client.gui; +import java.util.ArrayList; + import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.client.sound.SoundHandler; @@ -10,6 +12,7 @@ import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage; import mekanism.common.network.PacketDigitalMinerGui.MinerGuiPacket; import mekanism.common.network.PacketEditFilter.EditFilterMessage; import mekanism.common.network.PacketNewFilter.NewFilterMessage; +import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.tile.TileEntityDigitalMiner; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; @@ -133,6 +136,15 @@ public class GuiMItemStackFilter extends GuiMekanism GL11.glPopMatrix(); } + if(filter.replaceStack != null) + { + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_LIGHTING); + itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), filter.replaceStack, 149, 19); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } + if(xAxis >= 148 && xAxis <= 162 && yAxis >= 45 && yAxis <= 59) { drawCreativeTabHoveringText(MekanismUtils.localize("gui.digitalMiner.requireReplace") + ": " + LangUtils.transYesNo(filter.requireStack), xAxis, yAxis); @@ -258,6 +270,36 @@ public class GuiMItemStackFilter extends GuiMekanism filter.itemType = null; } + SoundHandler.playSound("gui.button.press"); + } + + if(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35) + { + boolean doNull = false; + ItemStack stack = mc.thePlayer.inventory.getItemStack(); + ItemStack toUse = null; + + if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + { + if(stack.getItem() instanceof ItemBlock) + { + if(Block.getBlockFromItem(stack.getItem()) != Blocks.bedrock) + { + toUse = stack.copy(); + toUse.stackSize = 1; + } + } + } + else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + { + doNull = true; + } + + if(toUse != null || doNull) + { + filter.replaceStack = toUse; + } + SoundHandler.playSound("gui.button.press"); } } diff --git a/src/main/java/mekanism/client/gui/GuiMMaterialFilter.java b/src/main/java/mekanism/client/gui/GuiMMaterialFilter.java index c566601a1..5a5e41c0a 100644 --- a/src/main/java/mekanism/client/gui/GuiMMaterialFilter.java +++ b/src/main/java/mekanism/client/gui/GuiMMaterialFilter.java @@ -133,6 +133,15 @@ public class GuiMMaterialFilter extends GuiMekanism GL11.glPopMatrix(); } + if(filter.replaceStack != null) + { + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_LIGHTING); + itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), filter.replaceStack, 149, 19); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } + if(xAxis >= 148 && xAxis <= 162 && yAxis >= 45 && yAxis <= 59) { drawCreativeTabHoveringText(MekanismUtils.localize("gui.digitalMiner.requireReplace") + ": " + LangUtils.transYesNo(filter.requireStack), xAxis, yAxis); @@ -258,6 +267,36 @@ public class GuiMMaterialFilter extends GuiMekanism filter.materialItem = null; } + SoundHandler.playSound("gui.button.press"); + } + + if(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35) + { + boolean doNull = false; + ItemStack stack = mc.thePlayer.inventory.getItemStack(); + ItemStack toUse = null; + + if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + { + if(stack.getItem() instanceof ItemBlock) + { + if(Block.getBlockFromItem(stack.getItem()) != Blocks.bedrock) + { + toUse = stack.copy(); + toUse.stackSize = 1; + } + } + } + else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + { + doNull = true; + } + + if(toUse != null || doNull) + { + filter.replaceStack = toUse; + } + SoundHandler.playSound("gui.button.press"); } } diff --git a/src/main/java/mekanism/client/gui/GuiMModIDFilter.java b/src/main/java/mekanism/client/gui/GuiMModIDFilter.java index bcaeace64..b2d72c559 100644 --- a/src/main/java/mekanism/client/gui/GuiMModIDFilter.java +++ b/src/main/java/mekanism/client/gui/GuiMModIDFilter.java @@ -17,9 +17,12 @@ import mekanism.common.tile.TileEntityDigitalMiner; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; +import net.minecraft.block.Block; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiTextField; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import org.lwjgl.input.Keyboard; @@ -171,6 +174,15 @@ public class GuiMModIDFilter extends GuiMekanism } catch(Exception e) {} } + if(filter.replaceStack != null) + { + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_LIGHTING); + itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), filter.replaceStack, 149, 19); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } + if(xAxis >= 148 && xAxis <= 162 && yAxis >= 45 && yAxis <= 59) { drawCreativeTabHoveringText(MekanismUtils.localize("gui.digitalMiner.requireReplace") + ": " + LangUtils.transYesNo(filter.requireStack), xAxis, yAxis); @@ -305,6 +317,36 @@ public class GuiMModIDFilter extends GuiMekanism SoundHandler.playSound("gui.button.press"); filter.requireStack = !filter.requireStack; } + + if(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35) + { + boolean doNull = false; + ItemStack stack = mc.thePlayer.inventory.getItemStack(); + ItemStack toUse = null; + + if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + { + if(stack.getItem() instanceof ItemBlock) + { + if(Block.getBlockFromItem(stack.getItem()) != Blocks.bedrock) + { + toUse = stack.copy(); + toUse.stackSize = 1; + } + } + } + else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + { + doNull = true; + } + + if(toUse != null || doNull) + { + filter.replaceStack = toUse; + } + + SoundHandler.playSound("gui.button.press"); + } } } diff --git a/src/main/java/mekanism/client/gui/GuiMOreDictFilter.java b/src/main/java/mekanism/client/gui/GuiMOreDictFilter.java index 326b58d2e..1b295d0bf 100644 --- a/src/main/java/mekanism/client/gui/GuiMOreDictFilter.java +++ b/src/main/java/mekanism/client/gui/GuiMOreDictFilter.java @@ -18,9 +18,11 @@ import mekanism.common.tile.TileEntityDigitalMiner; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; +import net.minecraft.block.Block; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiTextField; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; @@ -174,6 +176,15 @@ public class GuiMOreDictFilter extends GuiMekanism } catch(Exception e) {} } + if(filter.replaceStack != null) + { + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_LIGHTING); + itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), filter.replaceStack, 149, 19); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } + if(xAxis >= 148 && xAxis <= 162 && yAxis >= 45 && yAxis <= 59) { drawCreativeTabHoveringText(MekanismUtils.localize("gui.digitalMiner.requireReplace") + ": " + LangUtils.transYesNo(filter.requireStack), xAxis, yAxis); @@ -308,6 +319,36 @@ public class GuiMOreDictFilter extends GuiMekanism SoundHandler.playSound("gui.button.press"); filter.requireStack = !filter.requireStack; } + + if(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35) + { + boolean doNull = false; + ItemStack stack = mc.thePlayer.inventory.getItemStack(); + ItemStack toUse = null; + + if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + { + if(stack.getItem() instanceof ItemBlock) + { + if(Block.getBlockFromItem(stack.getItem()) != Blocks.bedrock) + { + toUse = stack.copy(); + toUse.stackSize = 1; + } + } + } + else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + { + doNull = true; + } + + if(toUse != null || doNull) + { + filter.replaceStack = toUse; + } + + SoundHandler.playSound("gui.button.press"); + } } } diff --git a/src/main/java/mekanism/common/miner/MinerFilter.java b/src/main/java/mekanism/common/miner/MinerFilter.java index 92b20665a..6a52bd7b1 100644 --- a/src/main/java/mekanism/common/miner/MinerFilter.java +++ b/src/main/java/mekanism/common/miner/MinerFilter.java @@ -41,6 +41,8 @@ public abstract class MinerFilter public void write(ArrayList data) { + data.add(requireStack); + if(replaceStack != null) { data.add(true); @@ -54,6 +56,8 @@ public abstract class MinerFilter protected void read(ByteBuf dataStream) { + requireStack = dataStream.readBoolean(); + if(dataStream.readBoolean()) { replaceStack = new ItemStack(Block.getBlockById(dataStream.readInt()), 1, dataStream.readInt());