Railcraft Reborn

Railcraft Reborn

8M Downloads

Charge Network Fails to Build Correctly (Revisited)

Ommina opened this issue · 1 comments

commented

Is there an existing issue for this?

  • I have searched the existing issues

Description of the Bug

Once upon a time, (five years ago!), I posted this issue, describing a situation where the charge network for the electric locomotive would behave erratically while the track was being placed in the world. A fix was proposed and merged, but never, to my knowledge, released publicly; the merge happened roughly two months after the final public beta.

I'm here to report an almost (but not entirely!) identical issue with the mod's current iteration. Complete with the weird title and the utter lack of reliable reproduction steps.

Much of what is described in the original issue remains true, but the numbers are different. Once the network is built, and no further nodes are added, it seems absolutely stable, and runs without issue for days at a time. However, adding nodes OR a server restart tends to break it. (Chunkloading and unloading of the associated track has no impact.)

The size of the rogue network will vary. The charge meter may not respond at all (nothing posted to chat when interacting with the track), or it may report a net with a size only a fraction of the correct size. For example, if the net size should be 2008, it may report a size of only 350.

To repair it, I've been running about trying to find a transition point between two network sizes. There I would break and replace the track, in an attempt to join the networks. Typically this works, but it takes some time, particularly if there are multiple break points, and isn't much fun.

Once repaired, it remains happy until the next building spree or server restart. (I can not say if it does, or does not, happen in a single player world. Presumably it does, but I can't promise.)

As always, thank you for your time.

Railcraft Reborn version

1.2.4

NeoForge/Forge version

21.1.64

Minecraft version

1.21.1

Minecraft server

Yes

To Reproduce

Detailed Reproduction Steps: Yeah, I wish.

Expected behavior

Unsurprisingly, I expect the charge network to behalf itself and not demand attention so much.

Logs & Environment

Nothing obvious in the logs, but I don't know if there is something for which I should be looking either.

No crash reports.

Screenshots & Video

No response

commented

+1 on this issue.

I have observed this in v1.12 (old railcraft), v1.20 (railcraft reborn - ATM 9), v1.21 (railcraft reborn ATM 10)

Server restarts definitely causing a consistent breaking of the power circuit to the track.

  1. Removing and re-adding the power source to the charge frame - no effect
  2. Picking up and re-placing electric locomotive - no effect

A friend an I have done many experiments to try resolve the issue post restart, all which result in small amounts of track that was previously unpowered near the affected piece of track to be powered, but only ~10 blocks or so worth:

  1. Removing of the rail on the charge frame and re-placing it
  2. Removing of the charge frame and re-placing it and the rail that was sitting on it
  3. Being electrocuted by a rail with charge

With our electric rail loops usually being in the 1600-2000 block round trip range, this makes the mod basically unusable based on the fact after each restart, we need to run the length of the track being electrocuted to resolve it.

Edit for additional note:

  1. On server restart, the only node of rail that is powered is the one that is on top of the frame with the charge being fed into it. Placing the electric locomotive on that block, hooking up a minecart and riding the cart seems to fix the whole loop (almost as if it's the same as us walking the whole loop to re-electify it as previously mentioned.
  2. We tried the same with an entity in the cart (chicken fat controller), didn't work.

Second Edit for more testing notesL
Stuck my head in the code around the zap mechanic, noticed that each time:

mods.railcraft.world.level.block.track.behaivor.CollisionHandler#entityInside

Is called, a

Charge.distribution.network(level).access(pos)

call is made, which appears to trigger the reconstruction of the grid, observed when getting shocked by the track.

I had a dig for anything else that might cause this type of access call, which I found the EnergyMinecart (or as it's affectionately named in game "Minecart with Energy cell"). Thus we broke the charge network again with a server restart, placed the Electric locomotive on the only piece of powered track (the track piece on top of the charge provider frame), hooked up the battery cart and sent it. This caused the entire track's grid to be re-generated as the energy cart slowly traversed the network - thus working around this bug.