Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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?

  • 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.