xbony2 / Nuclear-Control

An updated version of nuclear control.
BSD 3-Clause "New" or "Revised" License
24 stars 36 forks source link

Bad Energy sensor card given when using the Energy Sensor Kit On MFSU or MFE #165

Closed bahakc closed 8 years ago

bahakc commented 8 years ago

With Thermal Expansion installed, using the Energy Sensor Kit on Energy devices like the MFSU or the MFE, the RF Energy Sensor Location card is given instead of the standard Energy Sensor Location card. Probably the same issue with other IC2 energy storage devices which i didn't try.

Placing the RF Energy Sensor Location card (linked to the MFSU or MFE) into an industrial information panel will lead to a "Target Not Found" message.

Versions used :

To reproduce the problem :

  1. Install IC2 Experimental, ThermalExpansion and NuclearControl mods.
  2. In creative mode, place a MFSU device.
  3. Place an Industrial Information Panel with redstone torch to power it.
  4. Use an Energy Sensor Kit on the MFSU.
  5. Place the obtained RF Energy Sensor Location card into the Industrial Information Panel.
  6. Target Not Found should be displayed.

Also note that using the Energy Sensor Kit on EnergyCounter devices crashes the game.

After my investigation, i found the following code has been reworked lately : Nuclear-Control-master\src\main\java\shedar\mods\ic2\nuclearcontrol\items\ItemKitEnergySensor.java At Line 35 : else if (Loader.isModLoaded(ModLib.TE) || storageData.type == EnergyStorageData.TARGET_TYPE_RF) { return new ItemStack(CrossTE.RFSensorCard); }

The OR logical operand seems to explain the problem. After looking at the file history, if found that in earlier builds, the EnergyStorageData type (TARGET_TYPE_RF) was checked before the presence of ThermalExpansion (Loader.isModLoaded(ModLib.TE)) which is no longer the case in v2.4.1a

So, knowing that, I made a test on my computer by replacing the OR condition by and AND : else if (Loader.isModLoaded(ModLib.TE) && storageData.type == EnergyStorageData.TARGET_TYPE_RF) { return new ItemStack(CrossTE.RFSensorCard); }

Recompile the lib, install.

Then using the EnergyKit on the MFSU gives me an Energy Sensor Location card like old time and work as expected in the Industrial Information Panel.

I dunno if that change is sufficient to fix the lib cause of Mekanism integration (which i don't have) but the minor change above solves my problem for EnergySensorKit when ThermalExpansion is installed.

I hope my investigation help you in an incoming fix.

xbony2 commented 8 years ago

It shouldn't be TE-only anyway, so I'll just knock off that part of the code.

bahakc commented 8 years ago

Excellent. Thank you for the fast response and for the nice mod work :+1:

xbony2 commented 8 years ago

I get paid big bucks for this.

(not really)