diff --git a/src/main/java/mekanism/client/gui/GuiMItemStackFilter.java b/src/main/java/mekanism/client/gui/GuiMItemStackFilter.java index 8fc9b078e..57a591522 100644 --- a/src/main/java/mekanism/client/gui/GuiMItemStackFilter.java +++ b/src/main/java/mekanism/client/gui/GuiMItemStackFilter.java @@ -149,6 +149,11 @@ public class GuiMItemStackFilter extends GuiMekanism { drawCreativeTabHoveringText(MekanismUtils.localize("gui.digitalMiner.requireReplace") + ": " + LangUtils.transYesNo(filter.requireStack), xAxis, yAxis); } + + if(xAxis >= 15 && xAxis <= 29 && yAxis >= 45 && yAxis <= 59) + { + drawCreativeTabHoveringText(MekanismUtils.localize("gui.digitalMiner.fuzzyMode") + ": " + LangUtils.transYesNo(filter.fuzzy), xAxis, yAxis); + } super.drawGuiContainerForegroundLayer(mouseX, mouseY); } @@ -196,6 +201,14 @@ public class GuiMItemStackFilter extends GuiMekanism else { drawTexturedModalRect(guiWidth + 148, guiHeight + 45, 176 + 23, 14, 14, 14); } + + if(xAxis >= 15 && xAxis <= 29 && yAxis >= 45 && yAxis <= 59) + { + drawTexturedModalRect(guiWidth + 14, guiHeight + 45, 176 + 37, 0, 14, 14); + } + else { + drawTexturedModalRect(guiWidth + 14, guiHeight + 45, 176 + 37, 14, 14, 14); + } if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35) { @@ -249,6 +262,12 @@ public class GuiMItemStackFilter extends GuiMekanism SoundHandler.playSound("gui.button.press"); filter.requireStack = !filter.requireStack; } + + if(xAxis >= 15 && xAxis <= 29 && yAxis >= 45 && yAxis <= 59) + { + SoundHandler.playSound("gui.button.press"); + filter.fuzzy = !filter.fuzzy; + } if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35) { diff --git a/src/main/java/mekanism/client/gui/GuiSlot.java b/src/main/java/mekanism/client/gui/GuiSlot.java index 2e22eadbe..c17a4f5a6 100644 --- a/src/main/java/mekanism/client/gui/GuiSlot.java +++ b/src/main/java/mekanism/client/gui/GuiSlot.java @@ -105,7 +105,8 @@ public class GuiSlot extends GuiElement PLUS(18, 18, 18, 18), POWER(18, 18, 36, 18), INPUT(18, 18, 54, 18), - OUTPUT(18, 18, 72, 18); + OUTPUT(18, 18, 72, 18), + CHECK(18, 18, 0, 36); public int width; public int height; diff --git a/src/main/java/mekanism/common/miner/MItemStackFilter.java b/src/main/java/mekanism/common/miner/MItemStackFilter.java index 39552089c..1bc560607 100644 --- a/src/main/java/mekanism/common/miner/MItemStackFilter.java +++ b/src/main/java/mekanism/common/miner/MItemStackFilter.java @@ -3,23 +3,16 @@ package mekanism.common.miner; import io.netty.buffer.ByteBuf; import java.util.ArrayList; -import java.util.List; -import mekanism.api.ListUtils; import mekanism.common.util.MekanismUtils; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; public class MItemStackFilter extends MinerFilter { - private static List metaIgnoreArray = ListUtils.asList(Blocks.planks, Blocks.ladder, Blocks.torch, - Blocks.furnace, Blocks.dispenser, Blocks.piston, - Blocks.piston_extension, Blocks.piston_head); - public ItemStack itemType; + public boolean fuzzy; public MItemStackFilter(ItemStack item) { @@ -36,7 +29,7 @@ public class MItemStackFilter extends MinerFilter return false; } - if(itemStack.getItem() == itemType.getItem() && metaIgnoreArray.contains(Block.getBlockFromItem(itemType.getItem()))) + if(itemStack.getItem() == itemType.getItem() && fuzzy) { return true; } @@ -50,6 +43,8 @@ public class MItemStackFilter extends MinerFilter super.write(nbtTags); nbtTags.setInteger("type", 0); + + nbtTags.setBoolean("fuzzy", fuzzy); itemType.writeToNBT(nbtTags); return nbtTags; @@ -60,6 +55,7 @@ public class MItemStackFilter extends MinerFilter { super.read(nbtTags); + fuzzy = nbtTags.getBoolean("fuzzy"); itemType = ItemStack.loadItemStackFromNBT(nbtTags); } @@ -70,6 +66,8 @@ public class MItemStackFilter extends MinerFilter super.write(data); + data.add(fuzzy); + data.add(MekanismUtils.getID(itemType)); data.add(itemType.stackSize); data.add(itemType.getItemDamage()); @@ -80,6 +78,8 @@ public class MItemStackFilter extends MinerFilter { super.read(dataStream); + fuzzy = dataStream.readBoolean(); + itemType = new ItemStack(Item.getItemById(dataStream.readInt()), dataStream.readInt(), dataStream.readInt()); } @@ -105,6 +105,7 @@ public class MItemStackFilter extends MinerFilter MItemStackFilter filter = new MItemStackFilter(); filter.replaceStack = replaceStack; filter.requireStack = requireStack; + filter.fuzzy = fuzzy; filter.itemType = itemType.copy(); return filter; diff --git a/src/main/java/mekanism/common/tile/TileEntityDigitalMiner.java b/src/main/java/mekanism/common/tile/TileEntityDigitalMiner.java index 640e33e8b..b8ac8b017 100644 --- a/src/main/java/mekanism/common/tile/TileEntityDigitalMiner.java +++ b/src/main/java/mekanism/common/tile/TileEntityDigitalMiner.java @@ -206,11 +206,9 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I List drops = MinerUtils.getDrops(worldObj, coord, silkTouch); - if(canInsert(drops)) + if(canInsert(drops) && setReplace(coord, index)) { add(drops); - - setReplace(coord, index); toRemove.add(index); worldObj.playAuxSFXAtEntity(null, 2001, coord.xCoord, coord.yCoord, coord.zCoord, Block.getIdFromBlock(block) + (meta << 12)); @@ -294,10 +292,13 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I return MekanismUtils.getTicks(this, 80); } - public void setReplace(Coord4D obj, int index) + /* + * returns false if unsuccessful + */ + public boolean setReplace(Coord4D obj, int index) { ItemStack stack = getReplace(index); - + if(stack != null) { worldObj.setBlock(obj.xCoord, obj.yCoord, obj.zCoord, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 3); @@ -307,9 +308,18 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I obj.getBlock(worldObj).dropBlockAsItem(worldObj, obj.xCoord, obj.yCoord, obj.zCoord, obj.getMetadata(worldObj), 1); worldObj.setBlockToAir(obj.xCoord, obj.yCoord, obj.zCoord); } + + return true; } else { - worldObj.setBlockToAir(obj.xCoord, obj.yCoord, obj.zCoord); + if(!replaceMap.get(index).requireStack) + { + worldObj.setBlockToAir(obj.xCoord, obj.yCoord, obj.zCoord); + + return true; + } + + return false; } } diff --git a/src/main/resources/assets/mekanism/gui/GuiMItemStackFilter.png b/src/main/resources/assets/mekanism/gui/GuiMItemStackFilter.png index 4da67ab33..f848a31e6 100644 Binary files a/src/main/resources/assets/mekanism/gui/GuiMItemStackFilter.png and b/src/main/resources/assets/mekanism/gui/GuiMItemStackFilter.png differ diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiSlot.png b/src/main/resources/assets/mekanism/gui/elements/GuiSlot.png index dc64827db..bea9f695f 100644 Binary files a/src/main/resources/assets/mekanism/gui/elements/GuiSlot.png and b/src/main/resources/assets/mekanism/gui/elements/GuiSlot.png differ diff --git a/src/main/resources/assets/mekanism/lang/en_US.lang b/src/main/resources/assets/mekanism/lang/en_US.lang index 9c2564c03..0f9169393 100644 --- a/src/main/resources/assets/mekanism/lang/en_US.lang +++ b/src/main/resources/assets/mekanism/lang/en_US.lang @@ -440,6 +440,7 @@ gui.digitalMiner.toMine=To mine gui.digitalMiner.running=Running gui.digitalMiner.inverse=Inverse mode gui.digitalMiner.requireReplace=Require replace +gui.digitalMiner.fuzzyMode=Fuzzy mode //Recipe names recipe.mekanismShaped=Shaped