IC2 Classic

IC2 Classic

2M Downloads

Burned cables are not properly removed from the energy net

coderbot16 opened this issue ยท 11 comments

commented

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:

  1. Place a MFSU and a HV solar panel, with a one block space in between, so that they are not touching.
  2. Place a cable that cannot carry HV current (such as copper) between the machines.

The following can be observed:

  1. The cable burns away, yet EU still flows into the MFSU at the full rate of 512EU/t.
  2. 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.
  3. Cables placed adjacent to the empty space will attempt to connect to the phantom cable.
  4. 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.

Before reloading world:
2018-09-01_10 51 49

After reloading world:
2018-09-01_10 55 17

commented

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.

commented

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.

commented

Oh yeah and @coderbot16 ping.

commented

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.

commented

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.

commented

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.

commented

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.

commented

I'm not sure if I should make another thread for this, but while messing around I found that the nuke's flash effect applies to other entities non-deterministically, which while amusing is probably not intended :P

2018-09-01_12 00 40

commented

yeah thanks. should be fixed next patch.

commented

alright, sounds good. you're welcome!

commented

patched.