Posted March 30, 20169 yr Hey guys, I created a network with cables and one cable controller (similiar to AE). The list of blockPos of the cables is a field in the cable controller. Every time a cable is placed or removed I need to refresh the entire list (recursive). Problem: If the network has many cables (>500), a refresh decreases the fps. How can I prevent this? AE doesn't have this problem. Can I increases the fps by refreshing the list in another thread?
March 30, 20169 yr AE is open source, have you tried looking at how it manages its networks? Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
March 30, 20169 yr Author @Choonster I did, but I don't get it. The AE code is pretty complicated. @7 Thanks for your hints. A cable should not have a network by itself. A controller is necessary. And of course there's only one controller per network. If I connect 2 networks, one of the controllers drops. current method to fill the list private void addCables(final BlockPos pos) { for (BlockPos bl : getNeighbors(pos)) { if (worldObj.getTileEntity(bl) instanceof TileMaster && !bl.equals(this.pos) && worldObj.getChunkFromBlockCoords(bl) != null && worldObj.getChunkFromBlockCoords(bl).isLoaded()) { worldObj.getBlockState(bl).getBlock().dropBlockAsItem(worldObj, bl, worldObj.getBlockState(bl), 0); worldObj.setBlockToAir(bl); worldObj.removeTileEntity(bl); continue; } if (worldObj.getTileEntity(bl) instanceof IConnectable && !connectables.contains(bl) && worldObj.getChunkFromBlockCoords(bl).isLoaded()) { connectables.add(bl); ((IConnectable) worldObj.getTileEntity(bl)).setMaster(this.pos); addCables(bl); } } }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.