Record Class GameTestOptions

java.lang.Object
java.lang.Record
net.ixdarklord.coolcatcore.api.gametest.GameTestOptions
Record Components:
structure - the structure the test is built in, from a data pack (data/<ns>/structures/...); PLATFORM is an empty 8 × 6 × 8 space on a stone floor
maxTicks - how long the test may run before it fails
setupTicks - ticks to wait after building the structure, before the test starts
required - whether its failing fails the run (an optional test's failure is only reported)
rotation - how the structure, and the test's positions with it, are turned
manualOnly - only run when asked for by name (/test run), not with all the others
maxAttempts - how many times it may be tried
requiredSuccesses - how many of those tries must pass
skyAccess - whether the structure is built with open sky above it rather than in a closed space; on this version every test structure has open sky, so this changes nothing
padding - extra space left around the structure, 0 to 128 blocks; on this version the game lays tests out on its own grid, so this changes nothing
batch - the batch the test runs in, with the tests of the same batch, or null for its mod's (the namespace of its id)

public record GameTestOptions(net.minecraft.resources.ResourceLocation structure, int maxTicks, int setupTicks, boolean required, net.minecraft.world.level.block.Rotation rotation, boolean manualOnly, int maxAttempts, int requiredSuccesses, boolean skyAccess, int padding, @Nullable String batch) extends Record
How a game test runs. DEFAULT is what most tests want; change what you need with the with methods:

 GameTestOptions.DEFAULT.withStructure(MyMod.id("gametest/furnace_room")).withMaxTicks(200)
 
There are no test environments on this version (newer versions have an environment option, for game rules, weather and time); set those up in the test itself. Tests run in batches instead, one per mod unless withBatch(String) says otherwise.
  • Field Details

    • PLATFORM

      public static final net.minecraft.resources.ResourceLocation PLATFORM
      CoolCatLib's own test structure: an empty 8 × 6 × 8 space on a stone floor.
    • DEFAULT

      public static final GameTestOptions DEFAULT
  • Constructor Details

    • GameTestOptions

      public GameTestOptions(net.minecraft.resources.ResourceLocation structure, int maxTicks, int setupTicks, boolean required, net.minecraft.world.level.block.Rotation rotation, boolean manualOnly, int maxAttempts, int requiredSuccesses, boolean skyAccess, int padding, @Nullable @Nullable String batch)
      Creates an instance of a GameTestOptions record class.
      Parameters:
      structure - the value for the structure record component
      maxTicks - the value for the maxTicks record component
      setupTicks - the value for the setupTicks record component
      required - the value for the required record component
      rotation - the value for the rotation record component
      manualOnly - the value for the manualOnly record component
      maxAttempts - the value for the maxAttempts record component
      requiredSuccesses - the value for the requiredSuccesses record component
      skyAccess - the value for the skyAccess record component
      padding - the value for the padding record component
      batch - the value for the batch record component
  • Method Details

    • withStructure

      public GameTestOptions withStructure(net.minecraft.resources.ResourceLocation structure)
    • withMaxTicks

      public GameTestOptions withMaxTicks(int maxTicks)
    • withSetupTicks

      public GameTestOptions withSetupTicks(int setupTicks)
    • optional

      public GameTestOptions optional()
    • withRotation

      public GameTestOptions withRotation(net.minecraft.world.level.block.Rotation rotation)
    • asManualOnly

      public GameTestOptions asManualOnly()
    • withAttempts

      public GameTestOptions withAttempts(int maxAttempts, int requiredSuccesses)
      Tried up to maxAttempts times; passes once requiredSuccesses tries have. For flaky tests.
    • withSkyAccess

      public GameTestOptions withSkyAccess()
    • withPadding

      public GameTestOptions withPadding(int padding)
    • withBatch

      public GameTestOptions withBatch(String batch)
      Runs in this batch, with the other tests of the same batch. The tests of a batch are built and run together, and a batch starts once the one before it has finished.
    • of

      public static GameTestOptions of(GameTest test)
      The options an annotated method asks for.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • structure

      public net.minecraft.resources.ResourceLocation structure()
      Returns the value of the structure record component.
      Returns:
      the value of the structure record component
    • maxTicks

      public int maxTicks()
      Returns the value of the maxTicks record component.
      Returns:
      the value of the maxTicks record component
    • setupTicks

      public int setupTicks()
      Returns the value of the setupTicks record component.
      Returns:
      the value of the setupTicks record component
    • required

      public boolean required()
      Returns the value of the required record component.
      Returns:
      the value of the required record component
    • rotation

      public net.minecraft.world.level.block.Rotation rotation()
      Returns the value of the rotation record component.
      Returns:
      the value of the rotation record component
    • manualOnly

      public boolean manualOnly()
      Returns the value of the manualOnly record component.
      Returns:
      the value of the manualOnly record component
    • maxAttempts

      public int maxAttempts()
      Returns the value of the maxAttempts record component.
      Returns:
      the value of the maxAttempts record component
    • requiredSuccesses

      public int requiredSuccesses()
      Returns the value of the requiredSuccesses record component.
      Returns:
      the value of the requiredSuccesses record component
    • skyAccess

      public boolean skyAccess()
      Returns the value of the skyAccess record component.
      Returns:
      the value of the skyAccess record component
    • padding

      public int padding()
      Returns the value of the padding record component.
      Returns:
      the value of the padding record component
    • batch

      @Nullable public @Nullable String batch()
      Returns the value of the batch record component.
      Returns:
      the value of the batch record component