mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-28 07:56:11 +00:00
feat: add inverse button orientation lookup
This commit is contained in:
1 parent
ebbc92378d
commit
9a6d1ec4fc
6 files changed
+71
-3
No files matched your search
@@ -35,6 +35,25 @@ This method does not define a vanilla button block's bounds. `ButtonPart` captur
|
||||
class initialization, after normal class transformations; a mod adding metadata orientations must still make its
|
||||
button block expose the matching bounds.
|
||||
|
||||
## Reading orientation metadata
|
||||
|
||||
`ButtonPart.metaForSide(int)` returns the current metadata for an attachment face index (`0` through `5`), including
|
||||
`-1` for an unmapped face. It reads the live inverse mapping, so both `setOrientation` and legacy array mutations or
|
||||
replacement remain visible. Invalid indices throw `IndexOutOfBoundsException`; the accessor does not mask indices,
|
||||
check world support, construct a part or reject an unmapped result on the caller's behalf.
|
||||
|
||||
ProjectRed's `ItemPartButtonCommons.newPart` can replace `ButtonPart.sideMetaMap(side ^ 1)` with:
|
||||
|
||||
```scala
|
||||
val b = getNewInst(ButtonPart.metaForSide(side ^ 1))
|
||||
```
|
||||
|
||||
Keep its existing vertical-face rejection, support check, custom factory and `onPlaced` call. Here `side` is the
|
||||
clicked face, so `side ^ 1` is the attachment face. `sideForMeta` performs the opposite lookup;
|
||||
`ButtonPart.placement` is not a replacement because it constructs an ordinary button and applies its own validation.
|
||||
The accessor is additive on this branch; rebuild/publish the development artifact before compiling a consumer
|
||||
against it. It is not yet tied to a released minimum FMP version.
|
||||
|
||||
## Migrating Et Futurum Requiem
|
||||
|
||||
Replace the reflective reads, four array writes and reflective field assignments with the two calls above. Do not
|
||||
@@ -43,11 +62,12 @@ Keep Et Futurum's existing FMP presence/version gate so older FMP versions never
|
||||
|
||||
The public mutable `metaSideMap` and `sideMetaMap` fields remain binary and reflective compatibility surfaces for old
|
||||
releases. New integrations should not read, replace or mutate them directly. Their removal still requires a released
|
||||
Et Futurum migration, target-pack adoption and a fresh consumer scan.
|
||||
Et Futurum migration, ProjectRed's inverse-lookup migration, target-pack adoption and a fresh consumer scan.
|
||||
|
||||
## Validation
|
||||
|
||||
Forge characterization first freezes the old Et Futurum mutation and verifies exact metadata and placement on all six
|
||||
faces. API tests verify the two direct calls produce the same arrays, displaced pairs remain one-to-one, invalid input
|
||||
is atomic, and the example compiles. A physical client with Et Futurum must still complete the
|
||||
is atomic, and the example compiles. Inverse-lookup coverage checks all faces, unmapped results, remapping, legacy
|
||||
mutation/replacement and invalid indices. A physical client with Et Futurum must still complete the
|
||||
[all-face button check](../migration/MANUAL_CHECKS.md) before release.
|
||||
Reference in new issue
Block a user