From 5cb4c6e24033cf337812390d99a6817d24d21eab Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Sun, 12 Feb 2017 20:43:03 +0300 Subject: Removed explosion radius limitations. Explosion calculation optimized (reduced memory usage). One more detonator and explosive pack recipe. GT6 recipes for both chemical reactors and cryogenic distiller. Max stack size of muffle furnace is limited to 32. A lot of old features are removed. --- ihl/datanet/Contact.java | 254 ----------- ihl/datanet/DataCableItem.java | 177 ------- ihl/datanet/DataGrid.java | 60 --- ihl/datanet/DataNet.java | 127 ------ ihl/datanet/GuiInvisibleButton.java | 22 - ihl/datanet/RedstoneSignalConverterContainer.java | 100 ---- ihl/datanet/RedstoneSignalConverterGui.java | 139 ------ ihl/datanet/RedstoneSignalConverterTileEntity.java | 508 --------------------- 8 files changed, 1387 deletions(-) delete mode 100644 ihl/datanet/Contact.java delete mode 100644 ihl/datanet/DataCableItem.java delete mode 100644 ihl/datanet/DataGrid.java delete mode 100644 ihl/datanet/DataNet.java delete mode 100644 ihl/datanet/GuiInvisibleButton.java delete mode 100644 ihl/datanet/RedstoneSignalConverterContainer.java delete mode 100644 ihl/datanet/RedstoneSignalConverterGui.java delete mode 100644 ihl/datanet/RedstoneSignalConverterTileEntity.java (limited to 'ihl/datanet') diff --git a/ihl/datanet/Contact.java b/ihl/datanet/Contact.java deleted file mode 100644 index 5dce365..0000000 --- a/ihl/datanet/Contact.java +++ /dev/null @@ -1,254 +0,0 @@ -package ihl.datanet; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import ic2.core.Ic2Items; -import ihl.IHLMod; -import ihl.interfaces.IDataCableHolder; -import ihl.interfaces.IDataNode; -import ihl.processing.invslots.InvSlotSignalProcessor; -import ihl.utils.IHLUtils; - -public class Contact implements IDataNode -{ - public final int innerId; - private int dataGridID=-1; - private Set connectedContacts = new HashSet(8); - public final InvSlotSignalProcessor attachedSlot; - public final int attachedSlotNumber; - public final int type; //Free:-1; A1:0; A2:1; C:2; NO:3; NC:4; - private final TileEntity base; - - public Contact(TileEntity base1, int innerId1,InvSlotSignalProcessor attachedSlot1,int attachedSlotNumber1, int type1) - { - type=type1; - base=base1; - innerId=innerId1; - attachedSlot=attachedSlot1; - attachedSlotNumber=attachedSlotNumber1; - } - - public void onLoad() - { - if(dataGridID!=-1) - { - DataGrid grid = IHLMod.datanet.getGrid(dataGridID); - grid.telist.add(this); - } - } - - @Override - public int getDataGridID() { - return dataGridID; - } - - @Override - public void setDataGrid(int newGridID) - { - dataGridID=newGridID; - onLoad(); - } - - @Override - public Set getConnectedDataNodes() { - return this.connectedContacts; - } - - public void removeLinkTo(Contact contact2) - { - this.connectedContacts.remove(contact2); - contact2.getConnectedDataNodes().remove(this); - if(dataGridID!=-1) - { - IHLMod.datanet.splitGrids(dataGridID); - } - if(dataGridID!=-1) - { - for(IDataNode contact3:IHLMod.datanet.getGrid(dataGridID).telist) - { - contact3.checkAttachedSlots(); - } - } - else - { - this.checkAttachedSlots(); - } - if(contact2.getDataGridID()!=-1) - { - for(IDataNode contact3:IHLMod.datanet.getGrid(contact2.getDataGridID()).telist) - { - contact3.checkAttachedSlots(); - } - } - else - { - contact2.checkAttachedSlots(); - } - - } - - public void removeConnections(Contact[] contacts) - { - if(this.dataGridID!=-1) - { - this.connectedContacts.removeAll(Arrays.asList(contacts)); - IHLMod.datanet.splitGrids(dataGridID); - } - } - - public void establishLink(Contact contact) - { - this.connectedContacts.add(contact); - contact.getConnectedDataNodes().add(this); - if(dataGridID!=contact.getDataGridID() || dataGridID==-1 || contact.getDataGridID()==-1) - { - int newDataGridID = IHLMod.datanet.mergeGrids(dataGridID,contact.getDataGridID()); - if(this.dataGridID==-1) - { - this.setDataGrid(newDataGridID); - } - if(contact.getDataGridID()==-1) - { - contact.setDataGrid(newDataGridID); - } - for(IDataNode contact2:IHLMod.datanet.getGrid(newDataGridID).telist) - { - contact2.checkAttachedSlots(); - } - } - } - - public void writeToNBT(NBTTagCompound nbt) - { - nbt.setInteger("dataGridID", dataGridID); - NBTTagList connections = new NBTTagList(); - for(IDataNode contact1:this.connectedContacts) - { - NBTTagCompound contactNBT = new NBTTagCompound(); - contactNBT.setInteger("x", contact1.getXPos()); - contactNBT.setInteger("y", contact1.getYPos()); - contactNBT.setInteger("z", contact1.getZPos()); - contactNBT.setInteger("innerId", contact1.getInnerId()); - connections.appendTag(contactNBT); - } - nbt.setTag("connections"+innerId, connections); - } - - public void readFromNBT(NBTTagCompound nbt) - { - this.setDataGrid(nbt.getInteger("dataGridID")); - NBTTagList connections = nbt.getTagList("connections"+innerId, 10); - for(int i=0;i iconMap = new HashMap(); - private static Map nameMap = new HashMap(); - private static Map descriptionMap = new HashMap(); - public static DataCableItem dataCableInstance; - - public DataCableItem() - { - super(); - this.isDataCable=true; - this.setUnlocalizedName("dataCable"); - dataCableInstance=this; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tabs, List itemList) - { - Type[] var1 = Type.values(); - for(int i=0;i telist = new HashSet(); - public double energy=0D; - public boolean isGridValid=true; - - public Set getListOfExcludedNodes() - { - Set excludedNodes = new HashSet(); - if(this.telist.isEmpty()) - { - return excludedNodes; - } - excludedNodes.addAll(this.telist); - IDataNode startNode = this.telist.iterator().next(); - this.recursiveGridNodesSearch(excludedNodes, startNode); - this.telist.removeAll(excludedNodes); - return excludedNodes; - } - - public void recursiveGridNodesSearch(Set excludedNodes, IDataNode startNode) - { - Iterator nodei = startNode.getConnectedDataNodes().iterator(); - excludedNodes.remove(startNode); - while(nodei.hasNext()) - { - IDataNode node = nodei.next(); - if(excludedNodes.contains(node)) - { - recursiveGridNodesSearch(excludedNodes, node); - } - } - } - - public boolean isConnectedToContact(Contact emitter, int id) - { - Iterator it1 = this.telist.iterator(); - while(it1.hasNext()) - { - IDataNode ate1 = it1.next(); - if(ate1.getInnerId()==id) - { - return true; - } - else if(emitter!=ate1 && ate1.isIndirectlyConnectedWithContact(id)) - { - return true; - } - } - return false; - } -} diff --git a/ihl/datanet/DataNet.java b/ihl/datanet/DataNet.java deleted file mode 100644 index a241517..0000000 --- a/ihl/datanet/DataNet.java +++ /dev/null @@ -1,127 +0,0 @@ -package ihl.datanet; - -import ihl.IHLMod; -import ihl.flexible_cable.NodeEntity; -import ihl.interfaces.IDataNode; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -import net.minecraft.nbt.NBTTagCompound; - -public class DataNet { - - public Map grids = new HashMap(); - private int griduid=0; - - public DataNet() - { - } - - public int getNewUniqueGridID() - { - for(int i=0;i tei = grids.get(gridID2).telist.iterator(); - while(tei.hasNext()) - { - IDataNode te = tei.next(); - te.setDataGrid(gridID); - } - grids.remove(gridID2); - return gridID; - } - return gridID2; - } - - - public DataGrid getGrid(int gridID) - { - if(this.grids.get(gridID)==null) - { - DataGrid cgrid; - cgrid=new DataGrid(); - grids.put(gridID, cgrid); - return cgrid; - } - else - { - return this.grids.get(gridID); - } - } - - public void splitGrids(int gridID) - { - DataGrid grid1 = this.grids.get(gridID); - Set excludedNodes = grid1.getListOfExcludedNodes(); - if(!excludedNodes.isEmpty()) - { - if(grid1.telist.size()==1) - { - IDataNode singleNode = grid1.telist.iterator().next(); - singleNode.setDataGrid(-1); - grid1.telist.remove(singleNode); - } - if(excludedNodes.size()==1) - { - IDataNode singleNode = excludedNodes.iterator().next(); - singleNode.setDataGrid(-1); - } - else //Form a new grid - { - int newGridId = this.getNewUniqueGridID(); - Iterator excludedNodesI = excludedNodes.iterator(); - while(excludedNodesI.hasNext()) - { - excludedNodesI.next().setDataGrid(newGridId); - } - } - } - } - - public void removeCableEntities(NBTTagCompound cable) - { - int uid = cable.getInteger("chainUID"); - Set cs = IHLMod.proxy.nodeEntityRegistry.get(uid); - if(cs!=null) - { - for(NodeEntity ne:cs) - { - if(ne!=null) - { - ne.setDead(); - } - } - } - } -} diff --git a/ihl/datanet/GuiInvisibleButton.java b/ihl/datanet/GuiInvisibleButton.java deleted file mode 100644 index 31e8b3f..0000000 --- a/ihl/datanet/GuiInvisibleButton.java +++ /dev/null @@ -1,22 +0,0 @@ -package ihl.datanet; - -import java.util.List; -import java.util.Map; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; - -public class GuiInvisibleButton extends GuiButton { - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public GuiInvisibleButton(int id1, int x, int y, int w, int h, Map linksCoordinatesMap, List buttonList) - { - super(id1, x, y, w, h, ""); - linksCoordinatesMap.put(id1, new Integer[] {x+w/2,y+h/2}); - buttonList.add(this); - } - - @Override - public void drawButton(Minecraft minecraft, int i, int j){} - -} diff --git a/ihl/datanet/RedstoneSignalConverterContainer.java b/ihl/datanet/RedstoneSignalConverterContainer.java deleted file mode 100644 index 261c9d5..0000000 --- a/ihl/datanet/RedstoneSignalConverterContainer.java +++ /dev/null @@ -1,100 +0,0 @@ -package ihl.datanet; - -import java.util.List; - -import ic2.core.ContainerBase; -import ic2.core.IC2; -import ic2.core.slot.SlotInvSlot; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; - -public class RedstoneSignalConverterContainer extends ContainerBase { - - protected RedstoneSignalConverterTileEntity tileEntity; - private int lastLinksAmount = -1; - private int lastCablesAmount = -1; - private short lastEnergy = -1; - private int prevButtonPressed1 = -1; - public final static int height=224; - public final static int width=198; - public List links; - - public RedstoneSignalConverterContainer(EntityPlayer entityPlayer, RedstoneSignalConverterTileEntity tileEntity1){ - super(tileEntity1); - this.tileEntity = tileEntity1; - links=this.tileEntity.links; - int col; - for (col = 0; col < 3; ++col) - { - for (int col1 = 0; col1 < 9; ++col1) - { - this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18)); - } - } - for (col = 0; col < 9; ++col) - { - this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24)); - } - for (col = 0; col < tileEntity1.sensorEmitterSlots.size(); ++col) - { - this.addSlotToContainer(new SlotInvSlot(tileEntity1.sensorEmitterSlots, col, 8, 8+col*18)); - } - this.addSlotToContainer(new SlotInvSlot(tileEntity1.dischargeSlot, 0, 8, 116)); - } - - @Override - public boolean canInteractWith(EntityPlayer var1) { - return tileEntity.isUseableByPlayer(var1); - } - - - @Override - public void detectAndSendChanges() - { - super.detectAndSendChanges(); - for (int i = 0; i < this.crafters.size(); ++i) - { - ICrafting icrafting = (ICrafting)this.crafters.get(i); - if (this.tileEntity.links.size() != this.lastLinksAmount) - { - IC2.network.get().sendContainerField(this, "links"); - } - if (this.tileEntity.energy != this.lastEnergy) - { - icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.energy); - } - if (this.tileEntity.cableList.size() != this.lastCablesAmount) - { - icrafting.sendProgressBarUpdate(this, 2, this.tileEntity.cableList.size()); - } - if (this.tileEntity.prevButtonPressed != this.prevButtonPressed1) - { - icrafting.sendProgressBarUpdate(this, 3, this.tileEntity.prevButtonPressed); - } - } - this.lastCablesAmount=this.tileEntity.cableList.size(); - this.lastLinksAmount=this.tileEntity.links.size(); - this.lastEnergy=this.tileEntity.energy; - this.prevButtonPressed1 = this.tileEntity.prevButtonPressed; - - } - - @Override - public void updateProgressBar(int index, int value) - { - super.updateProgressBar(index, value); - switch (index) - { - case 1: - this.tileEntity.energy=(short) value; - break; - case 2: - this.tileEntity.cablesAmount=(short) value; - break; - case 3: - this.tileEntity.prevButtonPressed=(short) value; - break; - } - } -} diff --git a/ihl/datanet/RedstoneSignalConverterGui.java b/ihl/datanet/RedstoneSignalConverterGui.java deleted file mode 100644 index ce7e2d4..0000000 --- a/ihl/datanet/RedstoneSignalConverterGui.java +++ /dev/null @@ -1,139 +0,0 @@ -package ihl.datanet; - -import java.util.HashMap; -import java.util.Map; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import ic2.core.IC2; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.util.ResourceLocation; - -import org.lwjgl.opengl.GL11; - -import ihl.collector.GuiMultiTextureButton; - -@SideOnly(Side.CLIENT) -public class RedstoneSignalConverterGui extends GuiContainer { - private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUIRedstoneSignalConverter.png"); - private RedstoneSignalConverterContainer container; - private GuiInvisibleButton[] sensorsEmittersPlus = new GuiInvisibleButton[6]; - private GuiInvisibleButton[] sensorsEmittersMinus = new GuiInvisibleButton[6]; - private GuiInvisibleButton[][] cableContacts = new GuiInvisibleButton[4][8]; - public Map linksCoordinatesMap = new HashMap(); - private GuiMultiTextureButton removeLast; - private GuiMultiTextureButton removeAll; - private int timer=10; - - public RedstoneSignalConverterGui (RedstoneSignalConverterContainer container1) - { - super(container1); - this.container=container1; - this.ySize=RedstoneSignalConverterContainer.height; - this.xSize=RedstoneSignalConverterContainer.width; - } - - @SuppressWarnings("unchecked") - @Override - public void initGui() - { - super.initGui(); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - int i,i1; - new GuiInvisibleButton(0, x+24, y+121, 3, 3, linksCoordinatesMap, buttonList); //battery plus - new GuiInvisibleButton(1, x+24, y+124, 3, 3, linksCoordinatesMap, buttonList); //battery minus - for(i=0;i>8) & 255); - Integer[] to = this.linksCoordinatesMap.get(integer & 255); - this.drawLink(from[0], from[1], to[0], to[1], index); - } - - @Override - public void actionPerformed(GuiButton button) - { - super.actionPerformed(button); - IC2.network.get().initiateClientTileEntityEvent(this.container.tileEntity, button.id); - if (button.id == removeLast.id) - { - //removeLast.isActive=true; - timer=10; - } - if (button.id == removeAll.id) - { - removeAll.isActive=true; - timer=10; - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, - int par3) { - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); this.mc.renderEngine.bindTexture(background); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - for(int i = 0;i 0) - { - int i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12); - this.drawTexturedModalRect(x+184, y+119 + 12 - i1, 202, 12 - i1, 14, i1 + 2); - } - for(int i=0;i0) - { - timer--; - } - if(timer==1) - { - //removeLast.isActive=false; - removeAll.isActive=false; - } - } - - private void drawLink(int fromX, int fromY, int toX, int toY, int index) - { - int verticalLineOffset = 3*index+3; - this.drawTexturedModalRect(Math.min(fromX+verticalLineOffset,toX), toY-1, 0, 253, Math.abs(fromX+verticalLineOffset-toX)+(toX<=fromX+verticalLineOffset?1:0), 3); - this.drawTexturedModalRect(fromX+verticalLineOffset-1, Math.min(fromY, toY), 253, 0, 3, Math.abs(fromY-toY)+(toY cableList; - public final IHLInvSlotDischarge dischargeSlot; - public final List links = new ArrayList();//Short has 16 bits - public int prevButtonPressed=-1; - public short energy=0; - public final static short maxEnergy=Short.MAX_VALUE; - private int tick=0; - public boolean linksOrInventoryChanged=false; - private int inventoryCheckSum=0; - public final Contact[] contacts = new Contact[68]; - private NBTTagCompound nbtread; - public boolean checkcableList=true; - public short cablesAmount=0; - - /*Contacts is: - * 0 - battery slot plus - * 1 - battery slot minus - * 2-7 sensors/emitters plus - * 8-13 sensors/emitters minus - * 14-49 cableList - */ - - public RedstoneSignalConverterTileEntity() - { - sensorEmitterSlots = new InvSlotSignalProcessor(this, "sensorEmitterSlots", 0, Access.IO, 6, 2); - cableList = new ArrayList(); - dischargeSlot = new IHLInvSlotDischarge(this, 2, Access.IO, 4); - contacts[0]=new Contact(this,0,null,-1,0); - contacts[1]=new Contact(this,1,null,-1,1); - for(int i1=2;i1<8;i1++) - { - contacts[i1]=new Contact(this,i1, sensorEmitterSlots,i1-2,0); - } - for(int i1=8;i1<14;i1++) - { - sensorEmitterSlots.setStackSizeLimit(1); - contacts[i1]=new Contact(this,i1, sensorEmitterSlots,i1-8,1); - } - for(int i1=14;i1<50;i1++) - { - contacts[i1]=new Contact(this,i1,null, -1, -1); - } - for(int i1=50;i1<56;i1++) - { - contacts[i1]=new Contact(this,i1, sensorEmitterSlots,i1-50,2); - } - for(int i1=56;i1<62;i1++) - { - contacts[i1]=new Contact(this,i1, sensorEmitterSlots,i1-56,3); - } - for(int i1=62;i1<68;i1++) - { - contacts[i1]=new Contact(this,i1, sensorEmitterSlots,i1-02,4); - } - } - - @Override - public boolean wrenchCanRemove(EntityPlayer var1) - { - return this.cableList.isEmpty(); - } - - @Override - public void setFacing(short facing) - { - this.removeAttachedChains(); - } - - @Override - public void onLoaded() - { - super.onLoaded(); - if (IC2.platform.isSimulating()) - { - IC2.network.get().updateTileEntityField(this, "sensorEmitterSlots"); - if(nbtread!=null) - { - for(Contact contact1:contacts) - { - contact1.readFromNBT(nbtread); - } - } - nbtread=null; - } - } - - @Override - public List getNetworkedFields() - { - List fields = super.getNetworkedFields(); - fields.add("sensorEmitterSlots"); - return fields; - } - - @Override - public void updateEntityClient() - { - int checkSum=0; - for(int i=0;i0) - { - Set checkedGrids = new HashSet(); - Set unCheckedGrids = new HashSet(); - InvSlotSignalProcessor slots = this.sensorEmitterSlots; - for(int i=0;i ugi = unCheckedGrids.iterator(); - while(!unCheckedGrids.isEmpty()) - { - Integer dgid2 = ugi.next(); - ugi.remove(); - { - for(IDataNode contact3:IHLMod.datanet.getGrid(dgid2).telist) - { - contact3.checkAttachedSlots(); - if(contact3.getAttachedSlot()!=null) - { - Contact c4 = contact3.getAttachedSlot().getOppositeContact(contact3); - if(!checkedGrids.contains(c4.getDataGridID())) - { - unCheckedGrids.add(c4.getDataGridID()); - } - } - } - checkedGrids.add(dgid2); - } - } - this.linksOrInventoryChanged=false; - } - if(this.energy < 1) - { - this.energy += (short)(this.dischargeSlot.discharge(getDemandedEnergy(), false)*256D); - } - if(tick++ % 256==0) - { - this.energy--; - } - } - - @Override - public String getInventoryName() - { - return "redstoneSignalConverter"; - } - @Override - public boolean addDataCable(NBTTagCompound cable) - { - if(this.cableList.size()<4) - { - this.cableList.add(cable); - return true; - } - return false; - } - - - @Override - public double[] getPortPos(EntityLivingBase player) - { - ForgeDirection direction = ForgeDirection.getOrientation(IHLUtils.getFacingFromPlayerView(player, true)).getOpposite(); - return new double[] {this.xCoord+0.5d+0.5d*direction.offsetX,this.yCoord+direction.offsetY*1.0d,this.zCoord+0.5d+0.5d*direction.offsetZ}; - } - - @Override - public void onNetworkEvent(EntityPlayer player, int event) - { - if(prevButtonPressed==-1 && event < 255) - { - prevButtonPressed = event; - } - else if(prevButtonPressed!=event && event < 255) - { - int minor = Math.min(prevButtonPressed,event); - int major = Math.max(prevButtonPressed,event); - int link = ((minor<<8) | major); - this.links.add(link); - contacts[prevButtonPressed].establishLink(contacts[event]); - prevButtonPressed=-1; - } - else if(event==256 && !this.links.isEmpty()) - { - int link = this.links.remove(this.links.size()-1); - Contact contact1 = this.contacts[link >> 8]; - Contact contact2 = this.contacts[link & 255]; - contact1.removeLinkTo(contact2); - } - else if(event==257 && !this.links.isEmpty()) - { - this.links.clear(); - for(Contact contact1:contacts) - { - contact1.removeConnections(contacts); - } - } - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - for(Contact contact1:contacts) - { - contact1.writeToNBT(nbt); - } - if (!links.isEmpty()) - { - NBTTagList linkList1 = new NBTTagList(); - Iterator fli = links.iterator(); - while(fli.hasNext()) - { - Integer link = fli.next(); - if(link!=null) - { - NBTTagCompound linkNBT1 = new NBTTagCompound(); - linkNBT1.setInteger("link", link); - linkList1.appendTag(linkNBT1); - } - } - nbt.setTag("links", linkList1); - } - else - { - nbt.setString("Empty", ""); - } - NBTTagList cableNBTList = new NBTTagList(); - for(NBTTagCompound cable:this.cableList) - { - cableNBTList.appendTag(cable); - } - nbt.setTag("cableList", cableNBTList); - nbt.setBoolean("checkcableList", this.checkcableList); - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - NBTTagList cableNBTList=nbt.getTagList("cableList", 10); - for(int i=0;i getGuiContainer(EntityPlayer player) - { - return new RedstoneSignalConverterContainer(player, this); - } - - public int getGUIEnergy(int i) - { - if(this.energy cli = cableList.iterator(); - while(cli.hasNext()) - { - NBTTagCompound cl=cli.next(); - IHLMod.datanet.removeCableEntities(cl); - ItemStack is = IHLUtils.getThisModItemStack("dataCable"); - is.stackTagCompound=cl; - double[] pps = this.getPortPos(null); - EntityItem eitem = new EntityItem(worldObj, pps[0], pps[1], pps[2], is); - worldObj.spawnEntityInWorld(eitem); - { - int chainUID = cl.getInteger("chainUID"); - int x1 = cl.getInteger("connectorX1"); - int y1 = cl.getInteger("connectorY1"); - int z1 = cl.getInteger("connectorZ1"); - int connectorDimensionId1 = cl.getInteger("connectorDimensionId1"); - int x = cl.getInteger("connectorX"); - int y = cl.getInteger("connectorY"); - int z = cl.getInteger("connectorZ"); - int connectorDimensionId = cl.getInteger("connectorDimensionId"); - if(x1!=xCoord || y1!=yCoord || z1!=zCoord) - { - x=x1; - y=y1; - z=z1; - connectorDimensionId=connectorDimensionId1; - } - TileEntity te = MinecraftServer.getServer().worldServerForDimension(connectorDimensionId).getTileEntity(x, y, z); - if(te instanceof IDataCableHolder) - { - IDataCableHolder dch = ((IDataCableHolder)te); - Contact[] c = this.getContacts(chainUID); - Contact[] c1 = dch.getContacts(chainUID); - for(int i2=0;i2 cli = cableList.iterator(); - while(cli.hasNext()) - { - NBTTagCompound cl=cli.next(); - int chainUID1 = cl.getInteger("chainUID"); - if(chainUID1==chainUID) - { - cli.remove(); - return; - } - } - } - - @Override - public Contact getContact(int innerId1) - { - return this.contacts[innerId1]; - } - - - @Override - public boolean isCableRemoved(int chainUniqueID) { - if(!checkcableList) - { - return false; - } - for(NBTTagCompound cl:cableList) - { - if(cl.getInteger("chainUID")==chainUniqueID) - { - return false; - } - } - return true; - } - - @Override - public void setCableCheck(boolean b) - { - this.checkcableList=b; - } -} -- cgit v1.2.3