BuildCraft|Core

BuildCraft|Core

7M Downloads

Pipes attempt to call interface methods on invalid tiles.

unpairedbracket opened this issue ยท 5 comments

commented

Because pipes only update their adjacent tile cache after updating the pipe object, removing Multipart cables from next to pipes causes a crash. I'd suggest either adding a tile valid check around https://github.com/BuildCraft/BuildCraft/blob/6.1.x/common/buildcraft/transport/PipeTransportPower.java#L195 or moving the blockNeighborChange at https://github.com/BuildCraft/BuildCraft/blob/6.1.x/common/buildcraft/transport/TileGenericPipe.java#L396 above pipe.updateEntity(). ChickenBones suggests reacting to tile updates (the comparator kind) instantly to avoid this happening: Chicken-Bones/ForgeMultipart#288

commented

Thanks @asiekierka, this (along with an additional nullcheck in PipeTransportPower's line 168) fixes the issue.

commented

The way we usually do it is that upon a tile request from the TileBuffer, the TileBuffer makes sure the tile is still valid.

However, PipeTransportPower, presumably for optimization purposes, keeps its own TileEntity cache, which is not updated that way... well, now it is.

commented

Admittedly, @Chicken-Bones 's idea is better, but reacting to tile updates immediately could break other behaviour in pipes, as well as cause additional, unnecessary lag (connection computation is not necessairly the cheapest thing). Something to look for in 7.0.

commented

i think for now the easiest way to handle multipart errors without breaking it is surrounding that part of the code with a try catch, not the best solution but it'll stop the crashes until a permanent and better way of handeling it is found

commented

@AEnterprise - I am already handling it properly, see the commit.