Class GTNHGameTestHelper
GameTestHelper.gtnh().
All TestPos arguments use test-local (relative) coordinates — the same
convention as the int-coordinate overloads on GameTestHelper. Internally they are
converted to world-absolute coordinates via GameTestHelper.absolute(int, int, int).
Time-warping (fastForwardTicks(int)/runUntilMachineIdle(com.gtnewhorizons.horizonqa.api.TestPos, int)) is fully synchronous:
GT tile entities in the test region are force-ticked without advancing global server time, so
recipe completion tests finish in milliseconds of wall-clock time.
-
Constructor Summary
ConstructorsConstructorDescriptionGTNHGameTestHelper(GameTestHelper base, net.minecraft.world.WorldServer world, int originX, int originY, int originZ) -
Method Summary
Modifier and TypeMethodDescriptionadapter()Adapter used to read GT-internal state through one quarantined seam.voidassertCleanroomStatus(TestPos relPos, int expectedEfficiency) Assert that the cleanroom controller atrelPoshas an efficiency of at leastexpectedEfficiency(0–10000, representing 0–100.00 %).voidassertEUStored(TestPos relPos, long expectedEU) Assert that the GT tile entity atrelPoshas at leastexpectedEUstored EU.voidassertFluidInHatch(TestPos relPos, String fluidName, int amount) Assert that the fluid hatch atrelPoscontains at leastamountmB of the named fluid.voidassertItemInBus(TestPos relPos, String registryName, int meta, int count) Assert that the output bus / inventory atrelPoscontains at leastcountitems ofregistryNameat the given metadata value.voidassertItemInBus(TestPos relPos, net.minecraft.item.ItemStack itemStack) voidassertMachineExploded(TestPos relPos) Assert that the block atrelPosis no longer a GT tile entity — i.e.voidassertMachineFormed(TestPos relPos) Assert that the multiblock controller atrelPosreports a fully formed structure (mMachine == true).voidassertMachineHasIssues(TestPos relPos, MaintenanceType... expected) Assert that the multiblock atrelPoscurrently has all of the given maintenance issues active (i.e.voidassertPollutionEmitted(long expectedPollution) Assert that at leastexpectedPollutionunits of pollution were emitted in the origin chunk since this helper was created (i.e.voidfastForwardTicks(int ticks) Force-tick every GT tile entity in the test region for the given number of simulated ticks without advancing global server time.voidfastForwardTicks(int ticks, List<TestPos> watchedControllersAbs) Same asfastForwardTicks(int)but registerswatchedControllersAbs(world-absolute positions) with the warp differ so per-tick recipe / formation / maintenance / explosion transitions are emitted asTestEvents into the per-test recorder.voidFill the fluid hatch atrelPoswithamountmB of the named fluid.voidFill the fluid hatch atrelPoswith the givenFluidStack.voidfixAllMaintenanceIssues(TestPos relPos) Fix all maintenance issues on the multiblock atrelPosby callingMTEMultiBlockBase.fixAllIssues().gregtech.api.interfaces.tileentity.IGregTechTileEntityLow-level escape hatch: the GregTech tile entity atrelPos.voidinsertProgrammedCircuit(TestPos relPos, int config) Configure the programmed circuit slot of the input bus atrelPostoconfig(1–24).gregtech.api.interfaces.metatileentity.IMetaTileEntitymetaTileEntity(TestPos relPos) Low-level escape hatch: the meta tile entity atrelPos.multiblock(TestPos relPos) Controller atrelPos(test-local coordinates).gregtech.api.metatileentity.implementations.MTEMultiBlockBasemultiBlockController(TestPos relPos) Low-level escape hatch: the multiblock controller meta tile entity atrelPos.static voidrotateStructureTileNbt(net.minecraft.nbt.NBTTagCompound nbt, int rotation) voidrunUntilMachineIdle(TestPos relPos, int timeoutTicks) Fast-forward the test region until the machine atrelPosreportsisActive() == false, or untiltimeoutTickssimulated ticks have elapsed.voidRegister a virtual EU supply job.voidwithTestRecipe(Multiblock multi, gregtech.api.util.GTRecipe recipe) Inject a syntheticGTRecipeinto the multiblock's recipemap for the rest of the test.voidwithTestRecipe(Multiblock multi, gregtech.api.util.GTRecipeBuilder builder) Buildsbuilderand injects the result into the multiblock's recipemap for the rest of the test.withWarpRange(int blocks) Override the default 32-block fast-forward region.
-
Constructor Details
-
GTNHGameTestHelper
public GTNHGameTestHelper(GameTestHelper base, net.minecraft.world.WorldServer world, int originX, int originY, int originZ)
-
-
Method Details
-
adapter
Adapter used to read GT-internal state through one quarantined seam. -
gtTile
Low-level escape hatch: the GregTech tile entity atrelPos.Prefer role-based helpers such as
multiblock(TestPos),Multiblock.inputBus(int), andMultiblock.energyHatch(int)when they cover the case under test. -
metaTileEntity
Low-level escape hatch: the meta tile entity atrelPos.Prefer role-based helpers when possible. This is useful for exotic hatch paths or direct fixture setup that the facade does not model yet.
-
multiBlockController
public gregtech.api.metatileentity.implementations.MTEMultiBlockBase multiBlockController(TestPos relPos) Low-level escape hatch: the multiblock controller meta tile entity atrelPos.Prefer
multiblock(TestPos)for normal tests. -
rotateStructureTileNbt
public static void rotateStructureTileNbt(net.minecraft.nbt.NBTTagCompound nbt, int rotation) -
withWarpRange
Override the default 32-block fast-forward region. Increase for very large multiblocks (e.g. Fusion Reactors) whose hatches extend far from the controller. -
assertMachineFormed
Assert that the multiblock controller atrelPosreports a fully formed structure (mMachine == true). If the flag isfalse,MTEMultiBlockBase.checkStructure(boolean, gregtech.api.interfaces.tileentity.IGregTechTileEntity)is called withforceReset=truebefore failing, to handle cases where the structure placer did not trigger a block-update chain.- See Also:
-
fixAllMaintenanceIssues
Fix all maintenance issues on the multiblock atrelPosby callingMTEMultiBlockBase.fixAllIssues(). Equivalent to using every maintenance tool on the machine, setting all six flags totrue.- See Also:
-
assertMachineHasIssues
Assert that the multiblock atrelPoscurrently has all of the given maintenance issues active (i.e. the corresponding tool flag isfalse). -
fastForwardTicks
public void fastForwardTicks(int ticks) Force-tick every GT tile entity in the test region for the given number of simulated ticks without advancing global server time. EU supply jobs (fromsupplyEU(com.gtnewhorizons.horizonqa.api.TestPos, long, long, int)) are processed once per simulated tick before the GT TE pass. -
fastForwardTicks
Same asfastForwardTicks(int)but registerswatchedControllersAbs(world-absolute positions) with the warp differ so per-tick recipe / formation / maintenance / explosion transitions are emitted asTestEvents into the per-test recorder. -
runUntilMachineIdle
Fast-forward the test region until the machine atrelPosreportsisActive() == false, or untiltimeoutTickssimulated ticks have elapsed. ThrowsGameTestAssertExceptionif the machine is still active at timeout. -
supplyEU
Register a virtual EU supply job. Starting from the next call tofastForwardTicks(int)/runUntilMachineIdle(com.gtnewhorizons.horizonqa.api.TestPos, int), the energy hatch atrelPoswill receivevoltage × amperageEU added to its buffer per simulated tick fordurationTicksticks.- Parameters:
relPos- test-local position of the energy hatchvoltage- EU per packet (e.g. 1920 for EV)amperage- amps per tickdurationTicks- number of simulated ticks to sustain the supply
-
assertEUStored
Assert that the GT tile entity atrelPoshas at leastexpectedEUstored EU. -
assertMachineExploded
Assert that the block atrelPosis no longer a GT tile entity — i.e. the machine exploded and was replaced by air or debris. -
fillHatch
Fill the fluid hatch atrelPoswithamountmB of the named fluid.For GT tile entities the fill is applied directly on the
IMetaTileEntityto bypass themTickTimer > 5guard inBaseMetaTileEntity, which would return 0 when called before the hatch has been ticked (e.g. during test setup).- Parameters:
relPos- test-local position of the fluid hatchfluidName- Forge registry fluid name (e.g."nitrogen")amount- mB to fill
-
fillHatch
Fill the fluid hatch atrelPoswith the givenFluidStack.For GT tile entities the fill is applied directly on the
IMetaTileEntityto bypass themTickTimer > 5guard inBaseMetaTileEntity. -
assertFluidInHatch
Assert that the fluid hatch atrelPoscontains at leastamountmB of the named fluid.For GT tile entities the drain-peek is applied directly on the
IMetaTileEntityto bypass themTickTimer > 5guard inBaseMetaTileEntity. -
insertProgrammedCircuit
Configure the programmed circuit slot of the input bus atrelPostoconfig(1–24). The circuit is written directly intoIConfigurationCircuitSupport.getCircuitSlot()on theIMetaTileEntity, bypassing normal inventory insertion which explicitly skips that slot (isValidSlotreturnsfalsefor it).- Throws:
IllegalArgumentException- ifconfigis out of range or the item is unavailableGameTestAssertException- if the tile atrelPosis not a GT input bus
-
assertItemInBus
Assert that the output bus / inventory atrelPoscontains at leastcountitems ofregistryNameat the given metadata value.- Parameters:
relPos- test-local position of the output busregistryName- Forge registry name, e.g."gregtech:gt.metaitem.01"meta- item damage/meta valuecount- minimum stack size to find
-
assertItemInBus
-
assertPollutionEmitted
public void assertPollutionEmitted(long expectedPollution) Assert that at leastexpectedPollutionunits of pollution were emitted in the origin chunk since this helper was created (i.e. sinceGameTestHelper.gtnh()was first called). -
assertCleanroomStatus
Assert that the cleanroom controller atrelPoshas an efficiency of at leastexpectedEfficiency(0–10000, representing 0–100.00 %). -
multiblock
Controller atrelPos(test-local coordinates).Multiblockreads hatch lists from the live tile each time. -
withTestRecipe
Inject a syntheticGTRecipeinto the multiblock's recipemap for the rest of the test. The recipe (and its backend caches) is automatically removed when the test ends.- Throws:
GameTestAssertException- if the controller does not expose a RecipeMap
-
withTestRecipe
Buildsbuilderand injects the result into the multiblock's recipemap for the rest of the test. The recipe is automatically removed when the test ends. Fails the test immediately if the builder produces no recipe.- Throws:
GameTestAssertException- if the builder produces no recipe or the controller does not expose a RecipeMap
-