cc-tweaked / CC-Tweaked

Just another ComputerCraft fork
https://tweaked.cc
882 stars 206 forks source link

Inventory peripherals invalidate all the time #1817

Open SquidDev opened 1 month ago

SquidDev commented 1 month ago

Minecraft Version

1.20.6

Version

1.110.3

Details

When a block or block entity changes in the world, CC refetches the peripheral from the adjacent block. If the peripheral has changed, CC detaches the current peripheral, and attaches the new one.

On NeoForge for Minecraft 1.20.4 or later, a new inventory object is returned every time we query the item storage capability. This means the new generic peripheral is not considered equal to the previous one, and so the peripheral is reattached.

This problem is made worse by 04900dc82f143e6342b7196a0126a939ead09609, as now peripheral methods will frequently return nil due to the peripheral frequently attaching and reattaching.

I can think of a couple of options here, but none of them feel especially good: