feat(mod): Stage 3 (continued 3) — ParticleMixin + BlockEntityRenderStateMixin + ChestRendererMixin
Some checks failed
CI / backend (cargo test + clippy) (push) Successful in 3m5s
CI / frontend (lint + test + build) (push) Failing after 27s
CI / mod (gradle test + checkFolderLimit) (push) Successful in 2m36s

Per mod/docs/optimize-layer-design.md Stage 3 (continued). Three more mixin'ов
that consume the Stage 3-continued-2 contract mixins (CachedLight, TickCached)
on actual renderers, plus the ParticleMixin that adds its own per-particle
light cache + far-particle physics skip.

mixins/optimize/particle/ParticleMixin.java:
- @Inject HEAD/RETURN on Particle.getLightCoords — caches the per-particle
  light lookup by game tick (light only changes on tick boundaries). Gated
  on the Stage 1 'particleLight' toggle.
- @Inject HEAD/RETURN on Particle.move — temporarily sets hasPhysics=false
  for far particles (>16 blocks from camera) and three always-skip
  subclasses (BaseAshSmokeParticle, CampfireSmokeParticle,
  BubbleColumnUpParticle). Gated on the 'particlePhysics' toggle.
- Ported from zako.opt.mixin.particle.ParticleMixin.

features/.../optimize/particle/camera/CameraPosition.java (new helper):
- Single point where the camera position is sampled. ParticleMixin reads it
  instead of re-walking Minecraft.getInstance().gameRenderer.mainCamera()
  per particle per tick. Ported from zako.opt.particle.CameraPosition.
- Moved into particle/camera/ subfolder so optimize/particle/ stays under
  the ≤4 .java-per-folder limit after adding ParticleMixin.

mixins/optimize/block/BlockEntityRenderStateMixin.java:
- WrapOperation on BlockEntityRenderState.extractBase's
  LightCoordsUtil.getLightCoords — consults the per-tick light cache slot
  on the BlockEntity (via the CachedLight mixin from Stage 3-continued-2)
  before falling through to the original. Gated on 'blockEntityCache'.
- Ported from zako.opt.mixin.block.BlockEntityRenderStateMixin.

mixins/optimize/block/ChestRendererMixin.java:
- Two WrapOperations on ChestRenderer.extractRenderState:
  * ChestBlock.combine — caches the double-chest neighbor-lookup result by
    game tick (via the TickCached mixin). Gated on 'blockEntityCache'.
  * Int2IntFunction.applyAsInt — caches the second (pair) light lookup
    done for double chests (via the CachedLight.lovisual$pairLight slot).
    Gated on 'microOpts'.
- Ported from zako.opt.mixin.block.ChestRendererMixin.

lovisual.mixins.json: three new entries in the 'client' array:
  optimize.block.BlockEntityRenderStateMixin
  optimize.block.ChestRendererMixin
  optimize.particle.ParticleMixin

Tests: no new tests in this batch (mixins are pure side-effect field-bags /
WrapOperation wrappers without unit-testable logic). Existing suite still green.
Total: 866 tests, 0 failures. checkFolderLimit: OK (0 папок >4).
This commit is contained in:
LoVisual AI 2026-10-10 16:51:40 +00:00 • committed by loki5512344
parent 135628c2f1
commit 8ef46e4560
Signed by: boba
GPG key ID: 253067914055423B
5 changed files with 295 additions and 0 deletions

View file

@ -35,6 +35,8 @@
"client": [
"optimize.block.BaseSpawnerMixin",
"optimize.block.BlockEntityMixin",
"optimize.block.BlockEntityRenderStateMixin",
"optimize.block.ChestRendererMixin",
"optimize.entity.EntityNameMixin",
"optimize.entity.EntityRenderStateEntityMixin",
"optimize.entity.LivingEntityLodMixin",
@ -46,6 +48,7 @@
"optimize.gl.RenderTypesMixin",
"optimize.hud.OptimizeDebugHudMixin",
"optimize.particle.BubbleColumnUpParticleMixin",
"optimize.particle.ParticleMixin",
"optimize.world.LevelRendererOutlineMixin",
"accessors.blaze3d.GlTextureInvoker",
"accessors.blaze3d.GpuDeviceAccessor",