Immersive Engineering

Immersive Engineering

134M Downloads

Crash with Galacticraft energy module upon inserting flux

libertylocked opened this issue ยท 2 comments

commented

Description of the issue:

Game crashes upon inserting RF into the output face of a Galacticraft energy module. I think it's a GC bug, but I don't think IE should crash. (I've done some investigations, see below.)

To reproduce:

  • Place a galacticraft energy module
  • Place a Kinetic Dynamo and Windmill
  • Connect the Kinetic Dynamo to the output (red) face of the GC energy module
  • Game crashe, null pointer exception.

Crashlog:

I have the crash report attached.
crash-2019-11-14_23.56.34-server.txt

Versions & Modlist

  • Minecraft 1.12.2
  • Forge 1.12.2-14.23.5.2838

I believe the modlist is included in the crash log, but here they are

  • ImmersiveEngineering-0.12-92 (I'm building this from master, but I can confirm the same crash is also reproducible with the release build)
  • MicdoodleCore-1.12.2-4.0.2.238
  • GalacticraftCore-1.12.2-4.0.2.238
  • Galacticraft-Planets-1.12.2-4.0.2.238

Additional findings

For some strange reason the GC tile returns true in hasCapability but null in getCapability. It certainly feels more like a GC bug than an IE bug.

I was able to fix this by adding a null check in EnergyHelper.isFluxReceiver and EnergyHelper.insertFlux

public static boolean isFluxReceiver(TileEntity tile, EnumFacing facing)
{
	if(tile==null)
		return false;
	if(tile instanceof IFluxReceiver&&((IFluxReceiver)tile).canConnectEnergy(facing))
		return true;
	if(tile.hasCapability(CapabilityEnergy.ENERGY, facing)) {
		if (tile.getCapability(CapabilityEnergy.ENERGY, facing) == null)
		{
			return false;
		}
		return tile.getCapability(CapabilityEnergy.ENERGY, facing).canReceive();
	}
	return false;
}

and same thing for insertFlux.

I'm happy to fix this in IE so it doesn't crash on NullPointerException. Meanwhile I'm also looking at GC and see if I can fix the crash from there. Let me know how you wish to get this resolved. Thanks!

commented

If the GC tile is returning true in hasCapability and null in getCapability, then it's a bug on their side (see documentation on ICapabilityProvider). It's not our job to hide bugs in other mods.

commented

Makes sense. Thank you