Repository navigation
Add shared machine upgrades and working-area displays - #112
Conversation
dshadowwolf
left a comment
There was a problem hiding this comment.
Review findings (read from the diff only; I did not run tests or the game).
| int remainder = total % 8; | ||
| if (remainder != previous) { | ||
| fractions.put(processor.key(), remainder); | ||
| host.markChanged(); |
There was a problem hiding this comment.
steps() runs every tick for every processor, including idle ones. For most gearbox counts the fraction changes on every call: 4 gearboxes alternate 0/4, and 3 gearboxes cycle through all eight values. So host.markChanged() and the entity's setChanged() fire on every tick for each idle machine with a gearbox installed. setChanged also triggers a comparator neighbour update. Only 0 and 8 gearboxes stay quiet.
Suggest advancing the fraction only while the processor is actually running. Another option is to return the steps and let the processor bank the fraction after it does work.
There was a problem hiding this comment.
Fixed in 52ac85f. ProcessorClock now schedules the processor batch first and commits the fractional remainder only if the processor reports actual activity afterward. Idle, stalled, blocked, held, and paused batches leave the saved fraction unchanged and do not call markChanged for the clock. Focused tests cover all gearbox counts, saved fractions, inactive-to-running transitions, scaling, and energy gating.
|
|
||
| public int getMaxStackSize() { | ||
| return upgrade ? 1 : super.getMaxStackSize(); | ||
| return upgrade |
There was a problem hiding this comment.
This raises the GUI cap for every SlotKind.UPGRADE slot from 1 to min(8, limit), not just the gearbox socket. UpgradeSlotElement and AutomationSlotElement both use this kind. An existing kind="upgrade" slot on storage with the default 64 limit now takes stacks of 8 from the GUI. Any consumer that treats an upgrade slot as one item per socket would then count the effect up to 8 times.
The gearbox socket already sets socket.limit(8, …) on the storage, and range slots use limit(1). Keeping 1 here and letting the gearbox slot's storage limit decide (or adding a per-slot cap) would avoid changing existing upgrade slots.
There was a problem hiding this comment.
Fixed in a0d8f7c. Ordinary kind="upgrade", automation slots, and upgrade-slot elements again default to one item. upgrade-slot now has an explicit max-stack-size (also available through its Java constructor), bounded by the storage and item limits. Generated gearbox/capacitor sockets opt into eight; range sockets remain one. Added XML/generation tests and runtime checks for all three default slot types and explicit larger caps.
| tag.putBoolean("available", area != null); | ||
| if (area != null) { | ||
| var state = entity.getBlockState(); | ||
| var facing = state |
There was a problem hiding this comment.
Nit: the processors resolve facing through BaseMachine.facing() → RelativeFace.facing(state), which checks FACING before HORIZONTAL_FACING. Here only HORIZONTAL_FACING is read, with a NORTH fallback. That's identical for the built-in machine blocks, but a downstream block with a 6-way FACING would get an outline that doesn't match the area being worked. Using RelativeFace.facing(state) keeps the two in sync.
There was a problem hiding this comment.
Fixed in fee8ec7. WorkingAreaButtonElement now reads facing through RelativeFace.facing(state), matching the processors. I also moved the shared vertical WorkingArea geometry and its regression tests up from #113, so UP/DOWN consumer blocks are supported here instead of throwing when their bounds are sampled. Focused geometry tests passed.
Adds shared gearbox, capacitor and range upgrades to XML machines, with capability-derived component sockets, an upgrades drawer, processor work scheduling, working-area outlines and tracking-client work particles. Also adds processor cycle buttons, inventory selection highlighting, shared drawer placement and an explicit migration for the earlier development upgrade inventory.
Stacked on #111: merge that PR first, then retarget this PR to
master-2.0-1.21.1-neo. The current base keeps the creative-tab changes out of this diff.Upgrade layouts expand into ordinary boxes and inventories. Generation checks the composed screen to avoid placing drawer slots twice while preserving unrelated manual slots. Working-area snapshots retain machine and processor identity when unavailable, clearing only the affected outline and keeping multiple processor toggles independent. Published constructor signatures remain supported; intermediate unpublished overloads were removed.
Validation: 13 targeted unit tests passed across
UpgradeScreenGenerationTest,XmlProcessorTestandMachineUpgradesTest.runCompanionClientSmoke -PdrawerSmokeOnly --offlinepassed, including unavailable-area and multi-processor outline regressions, equipment interactions and drawer restoration.spotlessCheck,verifyMachineImports, JSON parsing and diff checks passed. Full suites remain for CI.