Applied Energistics 2

Applied Energistics 2

137M Downloads

Attempting to place a grid connected part on dense cable results in NullPointerException

ruifung opened this issue ยท 2 comments

commented

Game crashes with NullPointerException when grid connected part has canBePlacedOn(BusSupport.DENSE_CABLE) = true

Describe the bug
Because the CableBusContainer uses the INTERNAL position for part connections, at
PartDenseCable.java:79, PartDenseCable.java:134, a NullPointerException will be caused when it attempts to call isDense() due to attempting to do a BlockPos.offset(null) due to the fact that AEPartLocation.INTERNAL returns a null EnumFacing.

The documentation (javadoc) on IPart.canBePlacedOn does not state that BusSupport.DENSE_CABLE can not be used with grid connected parts. So I assumed that it would work.
To Reproduce
Grid connected part that is set up to be plaecable on dense cables.

Expected behavior
Sort of expected it to just work so I could implement a part that can forward a full 32 channels.

Additional context
Yeah, no crash log on this one. Had to step through with breakpoints in a debugger for this.

Environment
Forge dev environment, run from gradle.

  • Minecraft Version: 1.12.2
  • AE2 Version: rv6-6
  • Forge Version: 14.23.5.2768
commented

Dense cables are not designed for functional parts, only to transfer channels.
Imo better crash early to indicate something is wrong indev, than simply supressing it and have no feedback about a non working part.

I'll probably extend the javadocs for it at one point. In case I do not forget it again.

commented

I do agree about the crash early part, but this is more of a documentation issue I think.