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

It's me again.

I'm currently studying Dijkstra Algorithm and BFS (Graph theory) to make this thing work.

And I've looked up a few codes like

https://github.com/refinedmods/refinedpipes/tree/develop/src/main/java/com/refinedmods/refinedpipes

this.

Q.

If I use BFS to measure the distance to find the shortest, is there any different thing with using Dijkstra or not?

I'm more used to C rather than Java, so I coded a few BFS(Also DFS) problems with C.

Let's say that I could make cable networks into a certain graph, then the edges of the graph will have no weight, which means that I can use BFS, isn't it?

Sorry that I have poor knowledge about theory yet because I'm a student.

Edited by 1HA

  • Author
On 3/2/2022 at 9:44 AM, MFMods said:

yes, you can use bfs.

what are you trying to do?

Glad to hear that I can use BFS.

I need some cable to connect the power.

ย 

I used a 3d array in the C test code to get the "map". And it worked pretty well.

However, in minecraft, the server can't receive the cable network data with a 3d array cause it's inefficient.

Therefore somehow, as others did, the server has to receive the data with a linked list? maybe? And I have no idea what to do.

ย 

ย 

thx for replying

i think this "server receiving things" is confusing you. server knows the stuff you see in the world - blocks, sheep, zombies. the only time you send information to server is when you receive a mod-specific keypress or you open a gui window and interpret clicks into something the server would know about. even things like immersive engineering cables - player sets two endpoints, client will have to draw a "cable" all the time, but server should know about endpoints of each cable all the time - no need to send anything manually.

ย 

and before you tackle this, look into more dynamic algorithms. do not calculate unchanged distances multiple times - store them somehow, and when another cable piece is added (i assume you are using blocky cables), see if any of the distances might be improved thanks to the new block; and if i destroy a block, recheck distances. do not do any non-trivial calculations when worlds "tick" and when block entities "tick".

  • Author

Thx

I'd like to ask you one more thing. The current of the cable might constantly change(caused by generators and machines). In this case, the server has to fix the change every tick, right?๐Ÿค”

And I used neighborChanged() to check distancesย 

Edited by 1HA

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.