Create icon indicating copy to clipboard operation
Create copied to clipboard

Unhardcode Treecutter

Open VoidLeech opened this issue 1 year ago • 0 comments

Issues Fixed

Vertical plants and giant mushrooms were hardcoded with the mechanical saw.

Implemented Solution

Added some new block tags, all but two to contain the existing hardcoded blocks:

  • create:mushroom_stems
  • create:non_decaying_leaf_dist1 (for very small mushrooms)
  • create:non_decaying_leaf_dist2
  • create:non_decaying_leaf_dist3
  • create:non_decaying_leaf_dist4 (for very large mushrooms)
  • create:vertical_plants

Replace the hardcoded checks for blocks with checking for the tag instead. The non-leaf distance is resolved from greatest to smallest, should a block be in multiple of the tags, preferring overcutting a nearby mushroom too close instead of undercutting. I've immediately added compat for a couple of mods:

  • Quark (Glow Shroom) (dist 1)
  • Gardens of the Dead (Whistlecane) (vert)
  • Unusual End (Chorus Cane) (vert)
  • Undergarden (Indigo, Blood, Ink and Veil Mushrooms) (dist 3/4)
  • Aether Redux (Jellyshroom, Cloudcap, finishing off a concern in #7084) (dist 2)
  • Deep Aether (Lightcap Mushroom) (dist 2)
  • Biomes O' Plenty (Glowshroom, Toadstool) (dist 1/2)
  • Oh the Biomes We've Gone (Giant Flowers, Green, Wood Blewit, and Weeping Milkcap Mushrooms) (dist 2/3/4)
  • Regions Unexplored has already tagged their bioshroom blocks as wart blocks so they already work in the current release.

Concerns

  • The existing strict horizontal distance distance comparison from where the saw cut that happens for non-decaying leaf blocks can leave portions of a mushroom floating if the mushroom doesn't always grow perfectly straight. Particularly noticeable with the blood mushroom which grows in a 2x2 space and so has the distance depending on saw position too. Bumping every such mushroom up a tag in distance could work but then you're overcutting even in cases where the mushroom does grow straight.
  • All these mods have potential data compat, but I didn't want to tie that to this PR, so that's instead in #7220
  • There's still no clean way to handle Deeper and Darker's blooming_stem, which grows (generates, afaik there's no way to renew it) in a chorus-like pattern. Replacing this with a tag would have all of these break together though which seemed undesired (see 92975231d7b6e1f25edfc8aebce70ad3ddb0c3fa). Adding the stems to the logs tag would work but since the mod authors haven't, I don't. That's also why I don't add the stripped stem to the modded_stripped_logs tag in the data PR (and that transforming non-full block stems into full-block casings is odd).

VoidLeech avatar Dec 17 '24 01:12 VoidLeech