Closed LemADEC closed 4 years ago
According to this: https://github.com/AlmuraDev/SGCraft/blob/master/src/mod/gcewing/sg/features/cc/CCPeripheralProvider.java#L19
The lookup returns the same TE regardless of face so I'm not sure exactly what you're saying the problem is.
According to the exact next line, a new object is created for each call. CC API doesn't expect that.
Oh, I see what you're saying..... hm.
Give this a try: http://solder.almuramc.com/downloads/SGCraft-2.0.4-beta-4.jar
Fixed.
Looking good, remember to comment the printf in https://github.com/AlmuraDev/SGCraft/blob/dea61cdc9fcf87981e3cc3df3f13c55a97b926ad/src/mod/gcewing/sg/features/cc/CCSGPeripheral.java#L143-L153
That got missed in the official 2.0.4 build, I'll go comment it out so its ready for the next.
Since at least 2.0.2, the mod reports a different object for each side of a peripheral while the CC API expects the same object returned for all faces of that object. See initial logs from #88 about this: when placing a second computer, there's extra attach & detach events popping up. Here's logs from my mod, then from that build of SGCraft:
SGCraft implementation of getPeripheral should cache previously created interfaces, or, just use the TileEntity itself as an interface or storage of the latest. For reference, getPeripheral() is called from the main thread so the World.getTileEntity() call is safe.