[11.2] [API] Energy Net having issues after connected to custom EnergySource/Sink

  • In the process in trying to add IC2 energy compatibility to my mod, I ran across an error being thrown from the Energy Net. After my connector block is connected to a net, then afterwards when all players have left the server (meaning it never happens in single player, yay for making debugging easier) , it seems that after an error is thrown for every entity in the affected net about conflicting registrations every few seconds:

    Code
    1. [ic2-poolthread-1/WARN] [ic2.EnergyNet]: Tile ic2.core.block.wiring.TileEntityCable@71d9339a (dim 0: -102/89/9), sub tile -102/89/9 (ic2.core.block.wiring.TileEntityCable@71d9339a) addition is conflicting with a previous registration at the same location (ic2.core.block.wiring.TileEntityCable@1689b1cb).

    etc.

    which is followed up by an equal amount complaining about bad removals when a player rejoins again:

    Code
    1. [ic2-poolthread-4/WARN] [ic2.EnergyNet]: Tile ic2.core.block.wiring.TileEntityCable@7c04131a (dim 0: -103/89/8) removal without registration

    So anyone have any ideas what crazy thing I did in my TileEntity to displease the Energy Net so much? The source for the IC2 connecting entity can be found here here.

  • Apparently I'm not allowed to edit my post? Is that tied to post count on here or something? But I just wanted to add that I forgot to mention, after the player joins again, all the connected blocks stop functioning until replaced into the network.

  • In Minecraft, it can sometimes happen, that a Chunk a TE is in gets loaded/unloaded multiple times within a tick.

    I'm not 100% sure about the following, but I think that's what I remember from a discussion we had a while ago in the IC2 team.

    When the above thing is happening, the chunk gets loaded immediately, but the unloading can get delayed by a few ticks for performance reasons thus having multiple tileentities at the same position at the same time. We did some trickery to avoid said thing. I'm not sure if the changes made it to the 1.11 branch though.


    As I said, I'm not 100% sure, but you can try adding debug logging whenever a tile gets loaded and unloaded and check if there are multiple tiles there within the same tick to check the theory.