Cache Torus.generate result for Origin (#2845)

* Cache Torus.generate result for Origin

Fusion Coils are laggy, not by ticking block entities, just purely by torus.generate(BlockPos.origin, size)

* Assign TorusListCache

* use cached result
This commit is contained in:
AngelBottomless 2022-03-05 23:17:16 +09:00 committed by GitHub
parent 40f4785816
commit 7f415d3ec9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View file

@ -391,7 +391,7 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity
@Override
public void writeMultiblock(MultiblockWriter writer) {
BlockState coil = TRContent.Machine.FUSION_COIL.block.getDefaultState();
Torus.generate(BlockPos.ORIGIN, size).forEach(pos -> writer.add(pos.getX(), pos.getY(), pos.getZ(), coil));
Torus.getOriginPositions(size).forEach(pos -> writer.add(pos.getX(), pos.getY(), pos.getZ(), coil));
}
@Override