Logistics Pipes

Logistics Pipes

13M Downloads

NPE in CoreRoutedPipe.writeToNBT

Lunatrius opened this issue ยท 4 comments

commented

On the client side in CoreRoutedPipe.writeToNBT will throw an NPE, because .getId() seems to return null on the client no matter what. The method usually isn't called on the client side, but I do rely on it for Schematica (there is no other (easy/semi-easy) way to support all mods without doing this).

Location in the code: https://github.com/RS485/LogisticsPipes-Dev/blob/Dev/common/logisticspipes/pipes/basic/CoreRoutedPipe.java#L551
The report I got: http://www.minecraftforum.net/topic/1468779-152-schematica/page__st__560#entry22943086 (he's using LogisticsPipes-MC1.5.2-0.7.3.dev.497, the code is the same in writeToNBT, it's just offset by a few lines due to changes to some surrounding code)

commented

the issue is logistics pipes don't fully exist client side at any stage - modules and other settings are never on the client side; the only time the client cares about the info is to populate a GUI, and that's when the info is sent.

Further down in that function RouterID is 0, getLogisticsModule() will return null (so no modules will be saved), upgradeManager is probably null, and wouldn't hold any useful info, and the send-queue doesn't exist (but that last wouldn't matter for a schematic).

Furthermore, I hope that no pipes are being creating client side, even temporarily, as that might have "interesting" consequences if a) it is at the location of an existing pipe, b) isn't disposed of fully.

I've made a commit which should resolve the crash, but i don't think pipes copied this way will have modules or upgrades in them.

commented

I see. Schematics mostly don't really need a lot of information included because they're only used to display a hologram of a build.

Schematica does create a copy of the blocks/tile entities, but those are in a separate world (SchematicWorld to be exact), so they don't influence any world blocks or tile entities.

commented

either way i fixed that specific NPE in the latest dev build; could you try again?

commented

Looks like it works for him, will see if I can test it myself as well.