Tinkers Construct

Tinkers Construct

160M Downloads

Infinite neighbour update loop

DBotThePony opened this issue ยท 3 comments

commented

Issue description:
TiC 3.0.2 crash the server when connecting Mekanism transfer pipes to smeltery

Crash report:
https://gist.github.com/DBotThePony/d5fd1e1012db4118367364302aa5ac5c

It appears that

protected void setMaster(@Nullable BlockPos master, @Nullable Block block) {
assert world != null;
// invalidate handlers if the master changed
if (!Objects.equals(getMasterPos(), master)) {
clearHandler();
world.notifyNeighborsOfStateChange(pos, getBlockState().getBlock());
}
// update the master
boolean hadMaster = getMasterPos() != null;
super.setMaster(master, block);
// update the active state
boolean hasMaster = getMasterPos() != null;
if (hadMaster != hasMaster) {
world.setBlockState(pos, getBlockState().with(SmelteryIOBlock.ACTIVE, hasMaster));
}
}

is the cause. Notably, setMaster calls for neighbour update before setting new master, which cause pipe to check for capability, which come down to
private LazyOptional<T> getCachedCapability() {
if (capabilityHolder == null) {
if (validateMaster()) {
BlockPos master = getMasterPos();
if (master != null && this.world != null) {
TileEntity te = world.getTileEntity(master);
if (te != null) {
capabilityHolder = getCapability(te);
return capabilityHolder;
}
}
}
capabilityHolder = LazyOptional.empty();
}
return capabilityHolder;
}

which check for master validity again, which calls to setMaster and it go into infinite recursion. This can happen if pipe is both next to smeltery component and smeltery controller

Versions:

  • Minecraft: 1.16.5
  • Forge: 36.1.3
  • Mantle: 1.6.79
  • Tinkers Construct: 3.0.2.73
commented

Try this again in 3.0.2.76. It should be fixed, but not certain.

commented

I believe it is indeed fixed, just wasn't been able to 100% confirm it, but i am 90% certain it is.

commented

Closing this as fixed since there was no response. Feel free to reopen if this was not fixed