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

Hello all forge modders,

 

How would one create an efficient power network system with cables? I have had multiple thoughts, but don't know the usual/best implementation. The goal is a simple power system similar to IC2, but without different voltages and power falloff over distance. Any cables connected shares power 1:1, meaning a generator (adding power to a neighboring cable) could power an electric furnace (consuming power from neighboring cable), however many blocks away. 

 

My suggestions:

  • Cables being TileEntities distributing power to its neighbors directly. Every cable has a IEnergyStorage. Would require power splitting on multiple neighbors. This would probably be very inefficient (based on other posts in this forum).

 

  • Creating a WorldSavedData class, containing a List<List<BlockPos>> (note; this structure might be inefficient as well. Suggestions here are also welcome  ). Every time a cable block is placed, add it to the WorldSavedData. The First list represents one isolated network, the second all blocks in that network. By adding blocks to the network (and merging/splitting networks when needed), only one IEnergyStorage would be needed for one isolated network. This system would barely use tileEntities. Every cable TileEntity would have to store the corresponding network id (or a search in the List<List<BlockPos>> every time a power generator/consumer is placed). Therefore, this system may be redundant compared to next suggestion.

 

  • Similar to the last one, but instead every Cable TileEntity keeping track of its own networkId. Merging of two networks would become more complex (TileEntities would need to update their neighbors, resulting in a chain reaction). This makes saves smaller. The previous system has an advantage, I believe copying all BlockPos from one net to another is performance-cheaper than executing this chain reaction. Not tested.

 

Do you have any other suggestions? Which of the above would be best scalable for performance (and world save size, but not as big of a priority). 

 

Any help would be appreciated!

Edited by Gaffa

  • Author

The question is unrelated to version. I have no code to troubleshoot, Im only asking for the concept.

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.