- drop per-guide Validation sections; manual gates stay in MANUAL_CHECKS - drop audit/provenance lines (reference checkouts, dated refreshes, commit pins) - state version status and Scala-free compile check once in API.md - replace API.md status prose with link to migration status - fix RELEASE_NOTES dangling sentence - rewrite README for GTNH fork and Java port
2.4 KiB
Saw cutting strength
ItemSaw.setHarvestLevel(int) changes an existing FMP saw's cutting strength without reflection. The value is read
by harvestLevel(), getCuttingStrength(ItemStack) and getMaxCuttingStrength(), so recipes and FMP's 3D saw
renderer observe the same updated tier.
IguanaTweaksTConstruct can replace its private-field lookup and write with direct calls:
ItemSaw saw = (ItemSaw) item;
int oldStrength = saw.harvestLevel();
int updatedStrength = HarvestLevelTweaks.getUpdatedHarvestLevel(oldStrength);
saw.setHarvestLevel(updatedStrength);
The compiling example contains the setter call.
Iguana's client proxy also reads the three built-in saws and the renderer mode through MicroblockProxy$.MODULE$.
The Java facade exposes the same state directly:
Item stoneSaw = MicroblockProxy.sawStone();
Item ironSaw = MicroblockProxy.sawIron();
Item diamondSaw = MicroblockProxy.sawDiamond();
if (!MicroblockProxy.useSawIcons()) {
// Register the existing 3D saw renderers.
}
Keep the companion access only for already released binaries; rebuilt Java consumers should use the static facade.
State and lifecycle
The setter changes only cutting strength. It does not recalculate the saw's durability or alter existing item-stack damage. This matches Iguana's current post-construction field mutation. The integer is intentionally unrestricted, like the constructor and legacy field; the consumer owns its tier mapping.
FMP calculates MicroMaterialRegistry.getMaxCuttingStrength() once during ForgeMicroblock post-initialization.
Startup integrations that add or relevel saws must finish first so the cached maximum sees the final tiers. Iguana's
optional ordering should therefore include before:ForgeMicroblock while retaining its existing FMP presence gate.
Call the setter on the main initialization thread, before recipes can be used.
The method is specific to ItemSaw. Other Saw implementations may derive strength from each ItemStack and do
not promise mutable global strength.
Legacy compatibility
The private harvestLevel: int field remains in place for existing Iguana releases. It is mutable so the supported
setter and legacy reflection update the same storage. New integrations should use the public getter and setter and
should not catch and ignore API failures.