Alex's Caves

Alex's Caves

11M Downloads

Crash during Whalefall structure generation: Illegal `facing=up` on `smooth_bone_stairs`

Closed this issue · 2 comments

commented

When generating the “Whalefall” feature, the server attempts to place a smooth_bone_stairs block with facing=up, but StairBlock only accepts [north, south, west, east]. This causes a hard crash in the chunk‐generation phase.

To Reproduce

  1. Minecraft 1.20.1, Forge 47.4.0, Alex’s Caves v2.0.2
  2. Create or load a world with the default Alex’s Caves features.
  3. Travel (or /locate structure alexscaves:whalefall) to approximately X=103, Z=–26 in the Overworld.
  4. As the chunk loads, the server throws an IllegalArgumentException and crashes.

Expected behavior
The feature generator should never set facing=up on a stair block. Instead it should choose one of the four horizontal directions or skip placing the block.

Mod & Environment

  • Alex’s Caves: 2.0.2
  • Minecraft: 1.20.1 (server-1.20.1-20230612.114412-srg.jar)
  • Forge: net.minecraftforge:47.4.0
  • Seed: -4997362238323014790
  • Coordinates: chunk at CenterX=103, CenterZ=–26

Relevant stack trace

java.lang.IllegalArgumentException: Cannot set property DirectionProperty{name=facing, … values=[north, south, west, east]} to up on Block{alexscaves:smooth_bone_stairs}
    at net.minecraft.world.level.block.state.StateHolder.m_61124_(StateHolder.java:130)
    at net.minecraft.world.level.block.StairBlock.m_6843_(StairBlock.java:221)
    at com.github.alexmodguy.alexscaves.server.level.feature.WhalefallFeature.generateStructurePiece(WhalefallFeature.java:67)
    …  

Workarounds

  • Disable the Whalefall feature in the config or via a world‐gen script.
  • Manually patch WhalefallFeature.generateStructurePiece to filter out up before setting the block state.

Additional context
This is blocking world generation on any new chunk containing a Whalefall structure. A check for valid horizontal facings (or a default fallback) would prevent the crash.

Thank you for looking into this! Any guidance on a proper patch or config flag would be much appreciated.

Crash log attached:
crash-2025-05-15_19.45.38-server.txt

commented

I’m seeing a second, related crash in the same WhalefallFeature logic. This one happens at line 48 when the code tries to rotate a non-horizontal direction:

java.lang.IllegalStateException: Unable to get CCW facing of up
    at net.minecraft.core.Direction.m_122428_(Direction.java:232)
    at com.github.alexmodguy.alexscaves.server.level.feature.WhalefallFeature.m_142674_(WhalefallFeature.java:48)
    …
  • What’s happening:
    After placing a stair with facing=up, the generator calls Direction.getCounterClockWise() (aka “rotate Y-CCW”) on that UP value. Since UP isn’t on the horizontal plane, that method throws IllegalStateException.

  • Where it occurs:

    • First crash was at generateStructurePiece(...) line 67 (IllegalArgumentException setting facing=up).
    • This second crash is earlier in the same class (obfuscated to m_142674_) at line 48 during a CCW rotation on UP.
  • Suggested fix:

    1. Clamp orientations to horizontal before any rotation or placement.

    2. In pseudo-code:

      // before rotateY() or setValue(FACING, …):
      if (!facing.getAxis().isHorizontal()) {
          facing = Direction.NORTH; // or pick randomly from horizonal values
      }
    3. This guard will prevent both the “invalid facing” and the “unable to rotate UP” crashes in one go.

Crash log attached for reference:
crash-2025-05-15_20.50.41-server.txt

commented

Confirmed that it is caused by another MOD redirector :)