Energy Cable

Started by Aizark on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Energy Cable

Tell me, how should I implement an energy cable for a mod with appliances and electricity?

I'm not talking about a 3D model or mapping, I'm talking about the logic of receiving and transmitting energy to mechanisms located far away using wires


The only way that I see is to create a block that can store as much energy as it transmits. But it seems that if the player uses such wires, then the server will have to do a lot of work to calculate each wire. it also looks more like an accamulator, not a wire.

Are there any other methods of creating a block of wires that would not cause a huge load? perhaps it is necessary to somehow store the information of all mechanisms and generators or storages?

I ask for help. perhaps there is already a built-in solution in the creator?

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
with coding? It'd probably…
Tue, 11/26/2024 - 14:32

with coding? It'd probably be easiest to store an array list reference in each block, and when two 'systems' touch (when a block with one list is placed next to another with another list), combine the two systems lists. This way, you could simply look for a random block in the list that provides energy and pull directly from it.
On the other hand, you could do a sort of linked list, where each block has an array list of the connecting blocks which you'd traverse to find a source and the path to it if you wanted to have to send the energy through the wires.

without coding? Best I could come up with is to maybe do a 'request' procedure which checks the adjacent blocks for available energy, if it finds it, just transfer the energy, otherwise, call the 'request' procedure on adjacent blocks that can hold energy while passing the original block along. (Similar to the linked list idea, except the list isn't being stored)
It was after writing the without coding part when I realized you'd still need to pass a list of all the visited blocks so the procedure didn't endlessly re-traverse a block.

Other than that, how'd you make the wire visually? I've been wanting to make wires and pipes, but I don't know how to do anything for the visuals except make a sprite.