Started work on new Digital Miner filter system
|
@ -170,6 +170,14 @@ public class GuiMItemStackFilter extends GuiMekanism
|
||||||
else {
|
else {
|
||||||
drawTexturedModalRect(guiWidth + 5, guiHeight + 5, 176, 11, 11, 11);
|
drawTexturedModalRect(guiWidth + 5, guiHeight + 5, 176, 11, 11, 11);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 148 && xAxis <= 162 && yAxis >= 45 && yAxis <= 59)
|
||||||
|
{
|
||||||
|
drawTexturedModalRect(guiWidth + 148, guiHeight + 45, 176 + 23, 0, 14, 14);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drawTexturedModalRect(guiWidth + 148, guiHeight + 45, 176 + 23, 14, 14, 14);
|
||||||
|
}
|
||||||
|
|
||||||
if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35)
|
if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35)
|
||||||
{
|
{
|
||||||
|
@ -185,6 +193,21 @@ public class GuiMItemStackFilter extends GuiMekanism
|
||||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35)
|
||||||
|
{
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
int x = guiWidth + 149;
|
||||||
|
int y = guiHeight + 19;
|
||||||
|
drawGradientRect(x, y, x + 16, y + 16, -2130706433, -2130706433);
|
||||||
|
|
||||||
|
GL11.glPopAttrib();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -170,6 +170,14 @@ public class GuiMMaterialFilter extends GuiMekanism
|
||||||
else {
|
else {
|
||||||
drawTexturedModalRect(guiWidth + 5, guiHeight + 5, 176, 11, 11, 11);
|
drawTexturedModalRect(guiWidth + 5, guiHeight + 5, 176, 11, 11, 11);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 148 && xAxis <= 162 && yAxis >= 45 && yAxis <= 59)
|
||||||
|
{
|
||||||
|
drawTexturedModalRect(guiWidth + 148, guiHeight + 45, 176 + 23, 0, 14, 14);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drawTexturedModalRect(guiWidth + 148, guiHeight + 45, 176 + 23, 14, 14, 14);
|
||||||
|
}
|
||||||
|
|
||||||
if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35)
|
if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35)
|
||||||
{
|
{
|
||||||
|
@ -185,6 +193,21 @@ public class GuiMMaterialFilter extends GuiMekanism
|
||||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35)
|
||||||
|
{
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
int x = guiWidth + 149;
|
||||||
|
int y = guiHeight + 19;
|
||||||
|
drawGradientRect(x, y, x + 16, y + 16, -2130706433, -2130706433);
|
||||||
|
|
||||||
|
GL11.glPopAttrib();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -202,6 +202,29 @@ public class GuiMModIDFilter extends GuiMekanism
|
||||||
else {
|
else {
|
||||||
drawTexturedModalRect(guiWidth + 131, guiHeight + 47, 176 + 11, 12, 12, 12);
|
drawTexturedModalRect(guiWidth + 131, guiHeight + 47, 176 + 11, 12, 12, 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 148 && xAxis <= 162 && yAxis >= 45 && yAxis <= 59)
|
||||||
|
{
|
||||||
|
drawTexturedModalRect(guiWidth + 148, guiHeight + 45, 176 + 23, 0, 14, 14);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drawTexturedModalRect(guiWidth + 148, guiHeight + 45, 176 + 23, 14, 14, 14);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35)
|
||||||
|
{
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
int x = guiWidth + 149;
|
||||||
|
int y = guiHeight + 19;
|
||||||
|
drawGradientRect(x, y, x + 16, y + 16, -2130706433, -2130706433);
|
||||||
|
|
||||||
|
GL11.glPopAttrib();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
modIDText.drawTextBox();
|
modIDText.drawTextBox();
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,6 +205,29 @@ public class GuiMOreDictFilter extends GuiMekanism
|
||||||
else {
|
else {
|
||||||
drawTexturedModalRect(guiWidth + 131, guiHeight + 47, 176 + 11, 12, 12, 12);
|
drawTexturedModalRect(guiWidth + 131, guiHeight + 47, 176 + 11, 12, 12, 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 148 && xAxis <= 162 && yAxis >= 45 && yAxis <= 59)
|
||||||
|
{
|
||||||
|
drawTexturedModalRect(guiWidth + 148, guiHeight + 45, 176 + 23, 0, 14, 14);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drawTexturedModalRect(guiWidth + 148, guiHeight + 45, 176 + 23, 14, 14, 14);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35)
|
||||||
|
{
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
int x = guiWidth + 149;
|
||||||
|
int y = guiHeight + 19;
|
||||||
|
drawGradientRect(x, y, x + 16, y + 16, -2130706433, -2130706433);
|
||||||
|
|
||||||
|
GL11.glPopAttrib();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
oreDictText.drawTextBox();
|
oreDictText.drawTextBox();
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,7 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData
|
||||||
item.ticksExisted = 0;
|
item.ticksExisted = 0;
|
||||||
|
|
||||||
spawnParticlesAt(new Pos3D(item));
|
spawnParticlesAt(new Pos3D(item));
|
||||||
worldObj.playSoundAtEntity(this, "random.fizz", 1.0F, 1.0F);
|
worldObj.playSoundAtEntity(item, "random.fizz", 1.0F, 1.0F);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,8 @@ public class MItemStackFilter extends MinerFilter
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound write(NBTTagCompound nbtTags)
|
public NBTTagCompound write(NBTTagCompound nbtTags)
|
||||||
{
|
{
|
||||||
|
super.write(nbtTags);
|
||||||
|
|
||||||
nbtTags.setInteger("type", 0);
|
nbtTags.setInteger("type", 0);
|
||||||
itemType.writeToNBT(nbtTags);
|
itemType.writeToNBT(nbtTags);
|
||||||
|
|
||||||
|
@ -56,6 +58,8 @@ public class MItemStackFilter extends MinerFilter
|
||||||
@Override
|
@Override
|
||||||
protected void read(NBTTagCompound nbtTags)
|
protected void read(NBTTagCompound nbtTags)
|
||||||
{
|
{
|
||||||
|
super.read(nbtTags);
|
||||||
|
|
||||||
itemType = ItemStack.loadItemStackFromNBT(nbtTags);
|
itemType = ItemStack.loadItemStackFromNBT(nbtTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +67,8 @@ public class MItemStackFilter extends MinerFilter
|
||||||
public void write(ArrayList data)
|
public void write(ArrayList data)
|
||||||
{
|
{
|
||||||
data.add(0);
|
data.add(0);
|
||||||
|
|
||||||
|
super.write(data);
|
||||||
|
|
||||||
data.add(MekanismUtils.getID(itemType));
|
data.add(MekanismUtils.getID(itemType));
|
||||||
data.add(itemType.stackSize);
|
data.add(itemType.stackSize);
|
||||||
|
@ -72,6 +78,8 @@ public class MItemStackFilter extends MinerFilter
|
||||||
@Override
|
@Override
|
||||||
protected void read(ByteBuf dataStream)
|
protected void read(ByteBuf dataStream)
|
||||||
{
|
{
|
||||||
|
super.read(dataStream);
|
||||||
|
|
||||||
itemType = new ItemStack(Item.getItemById(dataStream.readInt()), dataStream.readInt(), dataStream.readInt());
|
itemType = new ItemStack(Item.getItemById(dataStream.readInt()), dataStream.readInt(), dataStream.readInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +103,8 @@ public class MItemStackFilter extends MinerFilter
|
||||||
public MItemStackFilter clone()
|
public MItemStackFilter clone()
|
||||||
{
|
{
|
||||||
MItemStackFilter filter = new MItemStackFilter();
|
MItemStackFilter filter = new MItemStackFilter();
|
||||||
|
filter.replaceStack = replaceStack;
|
||||||
|
filter.requireStack = requireStack;
|
||||||
filter.itemType = itemType.copy();
|
filter.itemType = itemType.copy();
|
||||||
|
|
||||||
return filter;
|
return filter;
|
||||||
|
|
|
@ -36,6 +36,8 @@ public class MMaterialFilter extends MinerFilter
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound write(NBTTagCompound nbtTags)
|
public NBTTagCompound write(NBTTagCompound nbtTags)
|
||||||
{
|
{
|
||||||
|
super.write(nbtTags);
|
||||||
|
|
||||||
nbtTags.setInteger("type", 2);
|
nbtTags.setInteger("type", 2);
|
||||||
materialItem.writeToNBT(nbtTags);
|
materialItem.writeToNBT(nbtTags);
|
||||||
|
|
||||||
|
@ -45,6 +47,8 @@ public class MMaterialFilter extends MinerFilter
|
||||||
@Override
|
@Override
|
||||||
protected void read(NBTTagCompound nbtTags)
|
protected void read(NBTTagCompound nbtTags)
|
||||||
{
|
{
|
||||||
|
super.read(nbtTags);
|
||||||
|
|
||||||
materialItem = ItemStack.loadItemStackFromNBT(nbtTags);
|
materialItem = ItemStack.loadItemStackFromNBT(nbtTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +56,8 @@ public class MMaterialFilter extends MinerFilter
|
||||||
public void write(ArrayList data)
|
public void write(ArrayList data)
|
||||||
{
|
{
|
||||||
data.add(2);
|
data.add(2);
|
||||||
|
|
||||||
|
super.write(data);
|
||||||
|
|
||||||
data.add(MekanismUtils.getID(materialItem));
|
data.add(MekanismUtils.getID(materialItem));
|
||||||
data.add(materialItem.stackSize);
|
data.add(materialItem.stackSize);
|
||||||
|
@ -61,6 +67,8 @@ public class MMaterialFilter extends MinerFilter
|
||||||
@Override
|
@Override
|
||||||
protected void read(ByteBuf dataStream)
|
protected void read(ByteBuf dataStream)
|
||||||
{
|
{
|
||||||
|
super.read(dataStream);
|
||||||
|
|
||||||
materialItem = new ItemStack(Item.getItemById(dataStream.readInt()), dataStream.readInt(), dataStream.readInt());
|
materialItem = new ItemStack(Item.getItemById(dataStream.readInt()), dataStream.readInt(), dataStream.readInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,6 +92,8 @@ public class MMaterialFilter extends MinerFilter
|
||||||
public MMaterialFilter clone()
|
public MMaterialFilter clone()
|
||||||
{
|
{
|
||||||
MMaterialFilter filter = new MMaterialFilter();
|
MMaterialFilter filter = new MMaterialFilter();
|
||||||
|
filter.replaceStack = replaceStack;
|
||||||
|
filter.requireStack = requireStack;
|
||||||
filter.materialItem = materialItem;
|
filter.materialItem = materialItem;
|
||||||
|
|
||||||
return filter;
|
return filter;
|
||||||
|
|
|
@ -28,6 +28,8 @@ public class MModIDFilter extends MinerFilter
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound write(NBTTagCompound nbtTags)
|
public NBTTagCompound write(NBTTagCompound nbtTags)
|
||||||
{
|
{
|
||||||
|
super.write(nbtTags);
|
||||||
|
|
||||||
nbtTags.setInteger("type", 3);
|
nbtTags.setInteger("type", 3);
|
||||||
nbtTags.setString("modID", modID);
|
nbtTags.setString("modID", modID);
|
||||||
|
|
||||||
|
@ -37,6 +39,8 @@ public class MModIDFilter extends MinerFilter
|
||||||
@Override
|
@Override
|
||||||
protected void read(NBTTagCompound nbtTags)
|
protected void read(NBTTagCompound nbtTags)
|
||||||
{
|
{
|
||||||
|
super.read(nbtTags);
|
||||||
|
|
||||||
modID = nbtTags.getString("modID");
|
modID = nbtTags.getString("modID");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,12 +48,17 @@ public class MModIDFilter extends MinerFilter
|
||||||
public void write(ArrayList data)
|
public void write(ArrayList data)
|
||||||
{
|
{
|
||||||
data.add(3);
|
data.add(3);
|
||||||
|
|
||||||
|
super.write(data);
|
||||||
|
|
||||||
data.add(modID);
|
data.add(modID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void read(ByteBuf dataStream)
|
protected void read(ByteBuf dataStream)
|
||||||
{
|
{
|
||||||
|
super.read(dataStream);
|
||||||
|
|
||||||
modID = PacketHandler.readString(dataStream);
|
modID = PacketHandler.readString(dataStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +80,8 @@ public class MModIDFilter extends MinerFilter
|
||||||
public MModIDFilter clone()
|
public MModIDFilter clone()
|
||||||
{
|
{
|
||||||
MModIDFilter filter = new MModIDFilter();
|
MModIDFilter filter = new MModIDFilter();
|
||||||
|
filter.replaceStack = replaceStack;
|
||||||
|
filter.requireStack = requireStack;
|
||||||
filter.modID = modID;
|
filter.modID = modID;
|
||||||
|
|
||||||
return filter;
|
return filter;
|
||||||
|
|
|
@ -71,6 +71,8 @@ public class MOreDictFilter extends MinerFilter
|
||||||
public MOreDictFilter clone()
|
public MOreDictFilter clone()
|
||||||
{
|
{
|
||||||
MOreDictFilter filter = new MOreDictFilter();
|
MOreDictFilter filter = new MOreDictFilter();
|
||||||
|
filter.replaceStack = replaceStack;
|
||||||
|
filter.requireStack = requireStack;
|
||||||
filter.oreDictName = oreDictName;
|
filter.oreDictName = oreDictName;
|
||||||
|
|
||||||
return filter;
|
return filter;
|
||||||
|
|
|
@ -4,20 +4,64 @@ import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import mekanism.common.util.MekanismUtils;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
public abstract class MinerFilter
|
public abstract class MinerFilter
|
||||||
{
|
{
|
||||||
|
public ItemStack replaceStack;
|
||||||
|
|
||||||
|
public boolean requireStack;
|
||||||
|
|
||||||
public abstract boolean canFilter(ItemStack itemStack);
|
public abstract boolean canFilter(ItemStack itemStack);
|
||||||
|
|
||||||
public abstract NBTTagCompound write(NBTTagCompound nbtTags);
|
public NBTTagCompound write(NBTTagCompound nbtTags)
|
||||||
|
{
|
||||||
|
nbtTags.setBoolean("requireStack", requireStack);
|
||||||
|
|
||||||
protected abstract void read(NBTTagCompound nbtTags);
|
if(replaceStack != null)
|
||||||
|
{
|
||||||
|
nbtTags.setTag("replaceStack", replaceStack.writeToNBT(new NBTTagCompound()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return nbtTags;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract void write(ArrayList data);
|
protected void read(NBTTagCompound nbtTags)
|
||||||
|
{
|
||||||
|
requireStack = nbtTags.getBoolean("requireStack");
|
||||||
|
|
||||||
|
if(nbtTags.hasKey("replaceStack"))
|
||||||
|
{
|
||||||
|
replaceStack = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("replaceStack"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract void read(ByteBuf dataStream);
|
public void write(ArrayList data)
|
||||||
|
{
|
||||||
|
if(replaceStack != null)
|
||||||
|
{
|
||||||
|
data.add(true);
|
||||||
|
data.add(MekanismUtils.getID(replaceStack));
|
||||||
|
data.add(replaceStack.getItemDamage());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
data.add(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void read(ByteBuf dataStream)
|
||||||
|
{
|
||||||
|
if(dataStream.readBoolean())
|
||||||
|
{
|
||||||
|
replaceStack = new ItemStack(Block.getBlockById(dataStream.readInt()), 1, dataStream.readInt());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
replaceStack = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static MinerFilter readFromNBT(NBTTagCompound nbtTags)
|
public static MinerFilter readFromNBT(NBTTagCompound nbtTags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package mekanism.common.miner;
|
package mekanism.common.miner;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import mekanism.api.BlockInfo;
|
import mekanism.api.BlockInfo;
|
||||||
|
@ -9,7 +11,6 @@ import mekanism.api.Coord4D;
|
||||||
import mekanism.common.tile.TileEntityBoundingBlock;
|
import mekanism.common.tile.TileEntityBoundingBlock;
|
||||||
import mekanism.common.tile.TileEntityDigitalMiner;
|
import mekanism.common.tile.TileEntityDigitalMiner;
|
||||||
import mekanism.common.util.MekanismUtils;
|
import mekanism.common.util.MekanismUtils;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
@ -20,6 +21,7 @@ public class ThreadMinerSearch extends Thread
|
||||||
public State state = State.IDLE;
|
public State state = State.IDLE;
|
||||||
|
|
||||||
public BitSet oresToMine = new BitSet();
|
public BitSet oresToMine = new BitSet();
|
||||||
|
public List<Integer> replaceMap = new ArrayList<Integer>();
|
||||||
|
|
||||||
public Map<BlockInfo, Boolean> acceptedItems = new HashMap<BlockInfo, Boolean>();
|
public Map<BlockInfo, Boolean> acceptedItems = new HashMap<BlockInfo, Boolean>();
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.6 KiB |