Oredictionificator work
This commit is contained in:
parent
8a88df5f1c
commit
6870b211c5
9 changed files with 507 additions and 10 deletions
|
@ -3,10 +3,13 @@ package mekanism.client.gui;
|
|||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
import mekanism.common.inventory.container.ContainerOredictionificator;
|
||||
import mekanism.common.tile.TileEntityOredictionificator;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -19,6 +22,12 @@ public class GuiOredictionificator extends GuiMekanism
|
|||
{
|
||||
public TileEntityOredictionificator tileEntity;
|
||||
|
||||
public boolean isDragging = false;
|
||||
|
||||
public int dragOffset = 0;
|
||||
|
||||
public float scroll;
|
||||
|
||||
public GuiOredictionificator(InventoryPlayer inventory, TileEntityOredictionificator tentity)
|
||||
{
|
||||
super(tentity, new ContainerOredictionificator(inventory, tentity));
|
||||
|
@ -32,6 +41,38 @@ public class GuiOredictionificator extends GuiMekanism
|
|||
return 1;//tileEntity.isActive ? 1 : 0;
|
||||
}
|
||||
}, ProgressBar.LARGE_RIGHT, this, MekanismUtils.getResource(ResourceType.GUI, "GuiOredictionificator.png"), 62, 118));
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiOredictionificator.png"), 25, 114));
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiOredictionificator.png"), 133, 114));
|
||||
|
||||
ySize+=64;
|
||||
}
|
||||
|
||||
public int getScroll()
|
||||
{
|
||||
return Math.max(Math.min((int)(scroll*88), 88), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
buttonList.clear();
|
||||
buttonList.add(new GuiButton(0, guiWidth + 10, guiHeight + 86, 142, 20, MekanismUtils.localize("gui.newFilter")));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
super.actionPerformed(guibutton);
|
||||
|
||||
if(guibutton.id == 0)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,6 +98,8 @@ public class GuiOredictionificator extends GuiMekanism
|
|||
|
||||
int xAxis = mouseX - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
|
||||
drawTexturedModalRect(guiWidth + 154, guiHeight + 18 + getScroll(), 232, 0, 12, 15);
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
}
|
||||
|
|
|
@ -1,14 +1,53 @@
|
|||
package mekanism.common.inventory.container;
|
||||
|
||||
import mekanism.common.inventory.slot.SlotOutput;
|
||||
import mekanism.common.tile.TileEntityOredictionificator;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class ContainerOredictionificator extends ContainerNull//TODO
|
||||
public class ContainerOredictionificator extends Container
|
||||
{
|
||||
private TileEntityOredictionificator tileEntity;
|
||||
|
||||
public ContainerOredictionificator(InventoryPlayer inventory, TileEntityOredictionificator tentity)
|
||||
{
|
||||
tileEntity = tentity;
|
||||
addSlotToContainer(new Slot(tentity, 0, 26, 115));
|
||||
addSlotToContainer(new SlotOutput(tentity, 1, 134, 115));
|
||||
|
||||
int slotX;
|
||||
|
||||
for(slotX = 0; slotX < 3; slotX++)
|
||||
{
|
||||
for(int slotY = 0; slotY < 9; slotY++)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 148 + slotX * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(slotX = 0; slotX < 9; slotX++)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 206));
|
||||
}
|
||||
|
||||
tileEntity.open(inventory.player);
|
||||
tileEntity.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer entityplayer)
|
||||
{
|
||||
super.onContainerClosed(entityplayer);
|
||||
|
||||
tileEntity.close(entityplayer);
|
||||
tileEntity.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||
{
|
||||
return tileEntity.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package mekanism.common.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
|
@ -11,7 +13,8 @@ import mekanism.common.network.PacketEditFilter.EditFilterMessage;
|
|||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tile.TileEntityDigitalMiner;
|
||||
import mekanism.common.tile.TileEntityLogisticalSorter;
|
||||
|
||||
import mekanism.common.tile.TileEntityOredictionificator;
|
||||
import mekanism.common.tile.TileEntityOredictionificator.OredictionificatorFilter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -20,8 +23,6 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
|||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketEditFilter implements IMessageHandler<EditFilterMessage, IMessage>
|
||||
{
|
||||
@Override
|
||||
|
@ -77,6 +78,29 @@ public class PacketEditFilter implements IMessageHandler<EditFilterMessage, IMes
|
|||
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(miner), miner.getFilterPacket(new ArrayList())), (EntityPlayerMP)iterPlayer);
|
||||
}
|
||||
}
|
||||
else if(message.type == 2 && message.coord4D.getTileEntity(worldServer) instanceof TileEntityOredictionificator)
|
||||
{
|
||||
TileEntityOredictionificator oredictionificator = (TileEntityOredictionificator)message.coord4D.getTileEntity(worldServer);
|
||||
|
||||
if(!oredictionificator.filters.contains(message.oFilter))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int index = oredictionificator.filters.indexOf(message.oFilter);
|
||||
|
||||
oredictionificator.filters.remove(index);
|
||||
|
||||
if(!message.delete)
|
||||
{
|
||||
oredictionificator.filters.add(index, message.oEdited);
|
||||
}
|
||||
|
||||
for(EntityPlayer iterPlayer : oredictionificator.playersUsing)
|
||||
{
|
||||
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(oredictionificator), oredictionificator.getFilterPacket(new ArrayList())), (EntityPlayerMP)iterPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -91,6 +115,9 @@ public class PacketEditFilter implements IMessageHandler<EditFilterMessage, IMes
|
|||
|
||||
public MinerFilter mFilter;
|
||||
public MinerFilter mEdited;
|
||||
|
||||
public OredictionificatorFilter oFilter;
|
||||
public OredictionificatorFilter oEdited;
|
||||
|
||||
public byte type = -1;
|
||||
|
||||
|
@ -125,6 +152,17 @@ public class PacketEditFilter implements IMessageHandler<EditFilterMessage, IMes
|
|||
|
||||
type = 1;
|
||||
}
|
||||
else if(filter instanceof OredictionificatorFilter)
|
||||
{
|
||||
oFilter = (OredictionificatorFilter)filter;
|
||||
|
||||
if(!delete)
|
||||
{
|
||||
oEdited = (OredictionificatorFilter)edited;
|
||||
}
|
||||
|
||||
type = 2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,6 +198,15 @@ public class PacketEditFilter implements IMessageHandler<EditFilterMessage, IMes
|
|||
mEdited.write(data);
|
||||
}
|
||||
}
|
||||
else if(type == 2)
|
||||
{
|
||||
oFilter.write(data);
|
||||
|
||||
if(!delete)
|
||||
{
|
||||
oEdited.write(data);
|
||||
}
|
||||
}
|
||||
|
||||
PacketHandler.encode(data.toArray(), dataStream);
|
||||
}
|
||||
|
@ -190,6 +237,15 @@ public class PacketEditFilter implements IMessageHandler<EditFilterMessage, IMes
|
|||
mEdited = MinerFilter.readFromPacket(dataStream);
|
||||
}
|
||||
}
|
||||
else if(type == 2)
|
||||
{
|
||||
oFilter = OredictionificatorFilter.readFromPacket(dataStream);
|
||||
|
||||
if(!delete)
|
||||
{
|
||||
oEdited = OredictionificatorFilter.readFromPacket(dataStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package mekanism.common.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
|
@ -11,7 +13,8 @@ import mekanism.common.network.PacketNewFilter.NewFilterMessage;
|
|||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tile.TileEntityDigitalMiner;
|
||||
import mekanism.common.tile.TileEntityLogisticalSorter;
|
||||
|
||||
import mekanism.common.tile.TileEntityOredictionificator;
|
||||
import mekanism.common.tile.TileEntityOredictionificator.OredictionificatorFilter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -20,8 +23,6 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
|||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketNewFilter implements IMessageHandler<NewFilterMessage, IMessage>
|
||||
{
|
||||
@Override
|
||||
|
@ -53,6 +54,17 @@ public class PacketNewFilter implements IMessageHandler<NewFilterMessage, IMessa
|
|||
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(miner), miner.getFilterPacket(new ArrayList())), (EntityPlayerMP)iterPlayer);
|
||||
}
|
||||
}
|
||||
else if(message.type == 2 && message.coord4D.getTileEntity(worldServer) instanceof TileEntityOredictionificator)
|
||||
{
|
||||
TileEntityOredictionificator oredictionificator = (TileEntityOredictionificator)message.coord4D.getTileEntity(worldServer);
|
||||
|
||||
oredictionificator.filters.add(message.oFilter);
|
||||
|
||||
for(EntityPlayer iterPlayer : oredictionificator.playersUsing)
|
||||
{
|
||||
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(oredictionificator), oredictionificator.getFilterPacket(new ArrayList())), (EntityPlayerMP)iterPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -65,6 +77,8 @@ public class PacketNewFilter implements IMessageHandler<NewFilterMessage, IMessa
|
|||
public TransporterFilter tFilter;
|
||||
|
||||
public MinerFilter mFilter;
|
||||
|
||||
public OredictionificatorFilter oFilter;
|
||||
|
||||
public byte type = -1;
|
||||
|
||||
|
@ -84,6 +98,11 @@ public class PacketNewFilter implements IMessageHandler<NewFilterMessage, IMessa
|
|||
mFilter = (MinerFilter)filter;
|
||||
type = 1;
|
||||
}
|
||||
else if(filter instanceof OredictionificatorFilter)
|
||||
{
|
||||
oFilter = (OredictionificatorFilter)filter;
|
||||
type = 2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -107,6 +126,10 @@ public class PacketNewFilter implements IMessageHandler<NewFilterMessage, IMessa
|
|||
{
|
||||
mFilter.write(data);
|
||||
}
|
||||
else if(type == 3)
|
||||
{
|
||||
oFilter.write(data);
|
||||
}
|
||||
|
||||
PacketHandler.encode(data.toArray(), dataStream);
|
||||
}
|
||||
|
@ -125,6 +148,10 @@ public class PacketNewFilter implements IMessageHandler<NewFilterMessage, IMessa
|
|||
{
|
||||
mFilter = MinerFilter.readFromPacket(dataStream);
|
||||
}
|
||||
else if(type == 2)
|
||||
{
|
||||
oFilter = OredictionificatorFilter.readFromPacket(dataStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -359,7 +359,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i
|
|||
|
||||
data.add(isActive);
|
||||
data.add(operatingTicks);
|
||||
data.add(infuseStored);
|
||||
data.add(infuseStored.amount);
|
||||
data.add(controlType.ordinal());
|
||||
|
||||
if(infuseStored.type != null)
|
||||
|
|
|
@ -1,17 +1,348 @@
|
|||
package mekanism.common.tile;
|
||||
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class TileEntityOredictionificator extends TileEntityContainerBlock
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.IFilterAccess;
|
||||
import mekanism.api.Range4D;
|
||||
import mekanism.common.HashList;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISustainedData;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
|
||||
public class TileEntityOredictionificator extends TileEntityContainerBlock implements IRedstoneControl, IFilterAccess, ISustainedData
|
||||
{
|
||||
public static final int MAX_LENGTH = 24;
|
||||
|
||||
public HashList<OredictionificatorFilter> filters = new HashList<OredictionificatorFilter>();
|
||||
|
||||
public RedstoneControl controlType = RedstoneControl.DISABLED;
|
||||
|
||||
public TileEntityOredictionificator()
|
||||
{
|
||||
super(MachineType.OREDICTIONIFICATOR.name);
|
||||
|
||||
inventory = new ItemStack[2];
|
||||
doAutoSync = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(playersUsing.size() > 0)
|
||||
{
|
||||
for(EntityPlayer player : playersUsing)
|
||||
{
|
||||
Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(this), getGenericPacket(new ArrayList())), (EntityPlayerMP)player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.writeToNBT(nbtTags);
|
||||
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
|
||||
NBTTagList filterTags = new NBTTagList();
|
||||
|
||||
for(OredictionificatorFilter filter : filters)
|
||||
{
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
filter.write(tagCompound);
|
||||
filterTags.appendTag(tagCompound);
|
||||
}
|
||||
|
||||
if(filterTags.tagCount() != 0)
|
||||
{
|
||||
nbtTags.setTag("filters", filterTags);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.readFromNBT(nbtTags);
|
||||
|
||||
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
|
||||
|
||||
if(nbtTags.hasKey("filters"))
|
||||
{
|
||||
NBTTagList tagList = nbtTags.getTagList("filters", NBT.TAG_COMPOUND);
|
||||
|
||||
for(int i = 0; i < tagList.tagCount(); i++)
|
||||
{
|
||||
filters.add(OredictionificatorFilter.readFromNBT((NBTTagCompound)tagList.getCompoundTagAt(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(ByteBuf dataStream)
|
||||
{
|
||||
super.handlePacketData(dataStream);
|
||||
|
||||
int type = dataStream.readInt();
|
||||
|
||||
if(type == 0)
|
||||
{
|
||||
controlType = RedstoneControl.values()[dataStream.readInt()];
|
||||
|
||||
filters.clear();
|
||||
|
||||
int amount = dataStream.readInt();
|
||||
|
||||
for(int i = 0; i < amount; i++)
|
||||
{
|
||||
filters.add(OredictionificatorFilter.readFromPacket(dataStream));
|
||||
}
|
||||
}
|
||||
else if(type == 1)
|
||||
{
|
||||
controlType = RedstoneControl.values()[dataStream.readInt()];
|
||||
}
|
||||
else if(type == 2)
|
||||
{
|
||||
filters.clear();
|
||||
|
||||
int amount = dataStream.readInt();
|
||||
|
||||
for(int i = 0; i < amount; i++)
|
||||
{
|
||||
filters.add(OredictionificatorFilter.readFromPacket(dataStream));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList getNetworkedData(ArrayList data)
|
||||
{
|
||||
super.getNetworkedData(data);
|
||||
|
||||
data.add(0);
|
||||
|
||||
data.add(controlType.ordinal());
|
||||
|
||||
data.add(filters.size());
|
||||
|
||||
for(OredictionificatorFilter filter : filters)
|
||||
{
|
||||
filter.write(data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public ArrayList getGenericPacket(ArrayList data)
|
||||
{
|
||||
super.getNetworkedData(data);
|
||||
|
||||
data.add(1);
|
||||
|
||||
data.add(controlType.ordinal());
|
||||
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
public ArrayList getFilterPacket(ArrayList data)
|
||||
{
|
||||
super.getNetworkedData(data);
|
||||
|
||||
data.add(2);
|
||||
|
||||
data.add(filters.size());
|
||||
|
||||
for(OredictionificatorFilter filter : filters)
|
||||
{
|
||||
filter.write(data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory()
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getFilterPacket(new ArrayList())), new Range4D(Coord4D.get(this)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getFilterData(NBTTagCompound nbtTags)
|
||||
{
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
|
||||
NBTTagList filterTags = new NBTTagList();
|
||||
|
||||
for(OredictionificatorFilter filter : filters)
|
||||
{
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
filter.write(tagCompound);
|
||||
filterTags.appendTag(tagCompound);
|
||||
}
|
||||
|
||||
if(filterTags.tagCount() != 0)
|
||||
{
|
||||
nbtTags.setTag("filters", filterTags);
|
||||
}
|
||||
|
||||
return nbtTags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilterData(NBTTagCompound nbtTags)
|
||||
{
|
||||
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
|
||||
|
||||
if(nbtTags.hasKey("filters"))
|
||||
{
|
||||
NBTTagList tagList = nbtTags.getTagList("filters", NBT.TAG_COMPOUND);
|
||||
|
||||
for(int i = 0; i < tagList.tagCount(); i++)
|
||||
{
|
||||
filters.add(OredictionificatorFilter.readFromNBT((NBTTagCompound)tagList.getCompoundTagAt(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataType()
|
||||
{
|
||||
return "tooltip.filterCard.oredictionificator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSustainedData(ItemStack itemStack)
|
||||
{
|
||||
itemStack.stackTagCompound.setBoolean("hasOredictionificatorConfig", true);
|
||||
|
||||
NBTTagList filterTags = new NBTTagList();
|
||||
|
||||
for(OredictionificatorFilter filter : filters)
|
||||
{
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
filter.write(tagCompound);
|
||||
filterTags.appendTag(tagCompound);
|
||||
}
|
||||
|
||||
if(filterTags.tagCount() != 0)
|
||||
{
|
||||
itemStack.stackTagCompound.setTag("filters", filterTags);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSustainedData(ItemStack itemStack)
|
||||
{
|
||||
if(itemStack.stackTagCompound.hasKey("hasOredictionificatorConfig"))
|
||||
{
|
||||
if(itemStack.stackTagCompound.hasKey("filters"))
|
||||
{
|
||||
NBTTagList tagList = itemStack.stackTagCompound.getTagList("filters", NBT.TAG_COMPOUND);
|
||||
|
||||
for(int i = 0; i < tagList.tagCount(); i++)
|
||||
{
|
||||
filters.add(OredictionificatorFilter.readFromNBT((NBTTagCompound)tagList.getCompoundTagAt(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedstoneControl getControlType()
|
||||
{
|
||||
return controlType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setControlType(RedstoneControl type)
|
||||
{
|
||||
controlType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPulse()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class OredictionificatorFilter
|
||||
{
|
||||
public String filter;
|
||||
public int index;
|
||||
|
||||
public void write(NBTTagCompound nbtTags)
|
||||
{
|
||||
nbtTags.setString("filter", filter);
|
||||
nbtTags.setInteger("index", index);
|
||||
}
|
||||
|
||||
protected void read(NBTTagCompound nbtTags)
|
||||
{
|
||||
filter = nbtTags.getString("filter");
|
||||
index = nbtTags.getInteger("index");
|
||||
}
|
||||
|
||||
public void write(ArrayList data)
|
||||
{
|
||||
data.add(filter);
|
||||
data.add(index);
|
||||
}
|
||||
|
||||
protected void read(ByteBuf dataStream)
|
||||
{
|
||||
filter = PacketHandler.readString(dataStream);
|
||||
index = dataStream.readInt();
|
||||
}
|
||||
|
||||
public static OredictionificatorFilter readFromNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
OredictionificatorFilter filter = new OredictionificatorFilter();
|
||||
|
||||
filter.read(nbtTags);
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
public static OredictionificatorFilter readFromPacket(ByteBuf dataStream)
|
||||
{
|
||||
OredictionificatorFilter filter = new OredictionificatorFilter();
|
||||
|
||||
filter.read(dataStream);
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int code = 1;
|
||||
code = 31 * code + filter.hashCode();
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object filter)
|
||||
{
|
||||
return filter instanceof OredictionificatorFilter && ((OredictionificatorFilter)filter).filter.equals(filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 3.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
|
@ -629,6 +629,7 @@ tooltip.filterCard.set=Injected filter data of type %s
|
|||
tooltip.filterCard.unequal=Unequal filter data formats
|
||||
tooltip.filterCard.logisticalSorter=Logistical Sorter
|
||||
tooltip.filterCard.digitalMiner=Digital Miner
|
||||
tooltip.filterCard.oredictionificator=Oredictionificator
|
||||
|
||||
tooltip.balloon=Balloon
|
||||
|
||||
|
|
Loading…
Reference in a new issue