Burned cables are not properly removed from the energy net
coderbot16 opened this issue ยท 11 comments
When testing the mod in creative mode with nonsensical combinations of machines, I stumbled upon a bug that appears to be related to burning cables.
Steps to reproduce:
- Place a MFSU and a HV solar panel, with a one block space in between, so that they are not touching.
- Place a cable that cannot carry HV current (such as copper) between the machines.
The following can be observed:
- The cable burns away, yet EU still flows into the MFSU at the full rate of 512EU/t.
- Any block you place into the space of the cable gets reset to air.
a. Note that this is not a client side issue. If you place a lava block, it will try to flow into the space, yet the liquid itself will be deleted whenever this happens, indicating something serverside.
b. Note that you can use this to delete the heads of pistons, and cause other chaos. - Cables placed adjacent to the empty space will attempt to connect to the phantom cable.
- Closing and re-opening the world fixes the issue.
Investigation into the jar file with jd-gui seems to suggest that the error lies in TileEntityCable::removeConductor, which appears to set a block to air every time it is called by EnergyNetLocal::emitEnergyFrom. This function does not unregister the cable from the ENet, but instead only sets the block to air. This explains all of the symptoms, as the ENet is simply out of sync with the actual state of the world.
To clarify: I encountered this issue on the 1.12 version of the mod, but it could exist on the 1.10 version as well, which I have not investigated.
First of all thanks, second this can be only a server side issue because the enet only exists on the server not on the client.
Last no its not the conductor. Its something completly different and its only possible if you place the cable last in this scenario and only if you have 1 conductor, and it will only happen because the conductor is added/removed on the same frame. The enet cant handle that fast a single calculation.
Also when a block is destroyed (setBlockcall) the TileEntity gets invalidated and automatically calls the Enet to be removing/invalidating the instance.
I am looking into that in around 20-30 minutes because i am cooking right now.
Oh yeah and @coderbot16 ping.
Ok, thanks for the quick response! I only tested to see if it was client/server because it seemed like another one of those bugs, but once I investigated further it made a lot more sense. I wasn't sure how the internals of the e-net is designed, so I just guessed.
In any case, it's good that you're aware of the issue, but it's probably pretty minor since placing the wrong cables is usually an accident.
On another note, thanks for updating this mod to 1.12. I never liked IC2 experimental and this mod feels like the true continuation of IndustrialCraft. I'm currently using it to attempt to make a custom modpack that aims to recreate Mindcrack 1.4.7, my most favorite modpack. On that note, I originally found the bug when testing a small little piece of code that allows techreborn and stevescarts reborn to be compatible with your mod.
Ahhh ok. Steves carts should be compatible with their next patch. Techreborn will most likely never be. And i honestly don't care since from what i saw from them isnt really good.
ok @coderbot16 fixed. You were in some degree right, your solution worked instantly and from what i tested its also save. Patch comes out tomorrow because today another project has priority.
That's great, thanks for fixing the issue! Glad to know that I helped at least in some fashion, and didn't just waste your time.
As for your previous comment, the only reason I'm using techreborn is because it's the only mod for 1.12 that is like GregTech 1.4.7. My main gripes with it was the use of RF as the main energy system (kinda kills the whole feel), and general bare-bones nature that omitted some of the best IC2 things, but your mod fixes these issues.