Class Multiblock

java.lang.Object
com.gtnewhorizons.horizonqa.api.gt.Multiblock

public final class Multiblock extends Object
Facade for a multiblock controller at a fixed world position. Hatch and bus handles are read from the live controller on each call (not cached), so they stay valid across structure rescans.

Create with GTNHGameTestHelper.multiblock(TestPos). Mod-specific controllers that keep hatches off the standard MTEMultiBlockBase lists are not covered.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Asserts the controller is fully formed.
    void
    Negative invariant helper for invalid templates.
    void
    Negative invariant helper for invalid templates.
    void
    Fails if the controller block is no longer a GregTech tile entity.
    void
    Forces a structure check and fails if the controller reports formed afterward.
    void
    Forces a structure check and fails with message if the controller reports formed afterward.
    boolean
    checkStructure(boolean forceReset)
    Runs the controller's structure check and returns whether it reports formed afterward.
    energyHatch(int index)
    Energy hatch by index in MTEMultiBlockBase.mEnergyHatches.
    void
    MTEMultiBlockBase.fixAllIssues() then MTEMultiBlockBase.enableWorking().
    boolean
    Forces the controller to run MTEMultiBlockBase.checkStructure(boolean, IGregTechTileEntity) with forceReset = true, then returns whether it reports formed.
    int
     
    inputBus(int index)
    Input bus by index in MTEMultiBlockBase.mInputBusses.
    inputHatch(int index)
    Fluid input hatch by index in MTEMultiBlockBase.mInputHatches.
    All input buses from MTEMultiBlockBase.mInputBusses, skipping invalid tiles and MTEHatchCraftingInputME.
    boolean
    Whether the controller reports a formed structure.
    boolean
    Whether the controller is in the middle of a recipe cycle.
    outputBus(int index)
    Output bus by index in MTEMultiBlockBase.mOutputBusses.
    outputHatch(int index)
    Fluid output hatch by index in the multiblock's canonical output-hatch ordering.
    All output buses from MTEMultiBlockBase.mOutputBusses that are valid.
    int
    Current progress ticks for the active recipe, or zero when idle.
    void
    MTEMultiBlockBase.enableWorking() then time-warps until the machine starts processing and becomes idle again, with a default tick bound.
    void
    runRecipe(int maxTicks)
    MTEMultiBlockBase.enableWorking() then time-warps until the machine starts processing and becomes idle again, or until maxTicks simulated ticks have elapsed.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • assertFormed

      public void assertFormed()
      Asserts the controller is fully formed. Runs MTEMultiBlockBase.checkStructure(boolean, IGregTechTileEntity) with forceReset = true once if the structure is not yet valid, then fails if still unformed.

      Sets mStartUpCheck = -1 on success, disabling the controller's periodic structure-re-check loop for the remainder of the test. This is intentional: a mid-test re-check could silently un-form the structure and invalidate subsequent assertions.

    • forceStructureCheck

      public boolean forceStructureCheck()
      Forces the controller to run MTEMultiBlockBase.checkStructure(boolean, IGregTechTileEntity) with forceReset = true, then returns whether it reports formed.

      Use this after mutating a placed template when you need to invalidate a stale mMachine=true flag.

    • checkStructure

      public boolean checkStructure(boolean forceReset)
      Runs the controller's structure check and returns whether it reports formed afterward.

      Passing forceReset = true clears and rebuilds hatch lists even when the controller currently reports formed. Passing false mirrors GregTech's normal "only if changed" behavior.

    • assertNotFormed

      public void assertNotFormed()
      Forces a structure check and fails if the controller reports formed afterward.
    • assertNotFormed

      public void assertNotFormed(String message)
      Forces a structure check and fails with message if the controller reports formed afterward.
    • assertNeverForms

      public void assertNeverForms()
      Negative invariant helper for invalid templates. Asserts unformed immediately, then on every game-test tick, and marks the test successful at timeout.

      Pair this with a finite @GameTest(timeoutTicks = ...).

    • assertNeverForms

      public void assertNeverForms(String message)
      Negative invariant helper for invalid templates. Asserts unformed immediately, then on every game-test tick, and marks the test successful at timeout.

      Pair this with a finite @GameTest(timeoutTicks = ...).

    • isFormed

      public boolean isFormed()
      Whether the controller reports a formed structure.
    • fixMaintenance

      public void fixMaintenance()
      MTEMultiBlockBase.fixAllIssues() then MTEMultiBlockBase.enableWorking().
    • inputBus

      public Bus inputBus(int index)
      Input bus by index in MTEMultiBlockBase.mInputBusses.
      Throws:
      IndexOutOfBoundsException - if index is not in range
      GameTestAssertException - if the resolved hatch is an MTEHatchCraftingInputME (ME crafting buffer); use inputs() to iterate non-ME input buses instead
    • outputBus

      public Bus outputBus(int index)
      Output bus by index in MTEMultiBlockBase.mOutputBusses.
      Throws:
      IndexOutOfBoundsException - if index is not in range
    • inputs

      public BusGroup inputs()
      All input buses from MTEMultiBlockBase.mInputBusses, skipping invalid tiles and MTEHatchCraftingInputME.
    • outputs

      public BusGroup outputs()
      All output buses from MTEMultiBlockBase.mOutputBusses that are valid.
    • energyHatch

      public Hatch energyHatch(int index)
      Energy hatch by index in MTEMultiBlockBase.mEnergyHatches. Controllers that route power only through other hatch lists need GTNHGameTestHelper.supplyEU(com.gtnewhorizons.horizonqa.api.TestPos, long, long, int) at known coordinates instead.
      Throws:
      IndexOutOfBoundsException - if index is not in range
    • inputHatch

      public Hatch inputHatch(int index)
      Fluid input hatch by index in MTEMultiBlockBase.mInputHatches. Supports MTEHatchMultiInput (multi-slot hatches).
      Throws:
      IndexOutOfBoundsException - if index is not in range
      GameTestAssertException - if the resolved hatch is an MTEHatchInputME (virtual ME fluid hatch) or MTEHatchInputDebug; neither is fillable in the normal sense. ME fluid hatches are not supported in v0.1.
    • outputHatch

      public Hatch outputHatch(int index)
      Fluid output hatch by index in the multiblock's canonical output-hatch ordering. For most multiblocks this is MTEMultiBlockBase.mOutputHatches; the Distillation Tower routes through its per-layer list instead (the i-th call returns a hatch on layer i, matching recipe output slot order). Detection happens in the adapter.
      Throws:
      GameTestAssertException - if index is out of range or the hatch slot is empty
    • runRecipe

      public void runRecipe()
      MTEMultiBlockBase.enableWorking() then time-warps until the machine starts processing and becomes idle again, with a default tick bound.
    • runRecipe

      public void runRecipe(int maxTicks)
      MTEMultiBlockBase.enableWorking() then time-warps until the machine starts processing and becomes idle again, or until maxTicks simulated ticks have elapsed.

      Uses a two-phase stop condition: first waits for the machine to become active (recipe found and started), then waits for it to return to idle (recipe completed). This avoids the false-idle problem where the machine hasn't yet picked up a recipe on the first tick.

      Throws:
      GameTestAssertException - if the machine never starts processing within maxTicks, or if it is still active at timeout
    • assertNoExplosion

      public void assertNoExplosion()
      Fails if the controller block is no longer a GregTech tile entity.
    • progress

      public int progress()
      Current progress ticks for the active recipe, or zero when idle.
    • isProcessing

      public boolean isProcessing()
      Whether the controller is in the middle of a recipe cycle.
    • getEfficiency

      public int getEfficiency()
      Returns:
      Current cleanness of this cleanroom. Max at 10,000