Skip to content

Butterflies

BonsUnleashed edited this page Oct 7, 2026 · 3 revisions

Butterflies

Minecraft 1.20.1 / Forge: this page documents that build and its measurements. For the separate 170-control Minecraft 1.21.1 port, see Minecraft 1.21.1 NeoForge.

One control for Butterflies 7.10.9 (mod id butterflies): the landing rules are answered from a set of blocks and a cached list of tags, in the same order as before. The switch checks the code it would change against the tested build; another build is left untouched with one WARN line (see How the patches are applied).

Key Target Side Since Kind Result
butterflies_landing_rule_lookup Butterflies 7.10.9 BOTH 1.0.13 opt 61–69 → 41.5 ns per check

butterflies_landing_rule_lookup

Since: 1.0.13 · Script (1.0.19 and earlier): furious13-butterflies.js Patched: com.bokmcdok.butterflies.butterfly_data.LandingRules (isValidLandingBlock) Mixin (since 1.0.20): LandingRulesMixin

What upstream did. For every block a resting butterfly considered, the landing check walked two HashSets (allowed block tags, then explicit blocks) with iterators.

What the patch does. A set lookup for the explicit blocks plus a cached array of the tags, in the same tag-before-block order with the same early returns. Tag membership is still checked against the current block state, so tag reloads remain effective.

What stays the same. Same answers: Block has identity equality, the constructor never adds null, and the check is an OR of side-effect-free tests. 0 mismatches in 75.4 million checks (68 species × every block state). Search radius, cadence, candidate positions and landing decisions are unchanged.

Measured. 61–69 → 41.5 ns per check.

Bons and Furious

Minecraft 1.20.1 / Forge 1.0.34

Compatibility

Controls by mod

Links

Clone this wiki locally