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>/structure/...);PLATFORMis an empty 8 × 6 × 8 space on a stone floormaxTicks- how long the test may run before it failssetupTicks- ticks to wait after building the structure, before the test startsrequired- 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 turnedmanualOnly- only run when asked for by name (/test run), not with all the othersmaxAttempts- how many times it may be triedrequiredSuccesses- how many of those tries must passskyAccess- whether the structure is built with open sky above it rather than in a closed spacepadding- extra space left around the structure, 0 to 128 blocksenvironment- the conditions it runs in (game rules, weather, time...), or null for none
public record GameTestOptions(net.minecraft.resources.Identifier 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 net.minecraft.gametest.framework.TestEnvironmentDefinition<?> environment)
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)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final GameTestOptionsstatic final net.minecraft.resources.IdentifierCoolCatLib's own test structure: an empty 8 × 6 × 8 space on a stone floor. -
Constructor Summary
ConstructorsConstructorDescriptionGameTestOptions(net.minecraft.resources.Identifier 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 net.minecraft.gametest.framework.TestEnvironmentDefinition<?> environment) Creates an instance of aGameTestOptionsrecord class. -
Method Summary
Modifier and TypeMethodDescription@Nullable net.minecraft.gametest.framework.TestEnvironmentDefinition<?> Returns the value of theenvironmentrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns the value of themanualOnlyrecord component.intReturns the value of themaxAttemptsrecord component.intmaxTicks()Returns the value of themaxTicksrecord component.static GameTestOptionsThe options an annotated method asks for.optional()intpadding()Returns the value of thepaddingrecord component.booleanrequired()Returns the value of therequiredrecord component.intReturns the value of therequiredSuccessesrecord component.net.minecraft.world.level.block.Rotationrotation()Returns the value of therotationrecord component.intReturns the value of thesetupTicksrecord component.booleanReturns the value of theskyAccessrecord component.net.minecraft.resources.IdentifierReturns the value of thestructurerecord component.final StringtoString()Returns a string representation of this record class.withAttempts(int maxAttempts, int requiredSuccesses) Tried up tomaxAttemptstimes; passes oncerequiredSuccessestries have.withEnvironment(net.minecraft.gametest.framework.TestEnvironmentDefinition<?> environment) Runs in these conditions, such asnew TestEnvironmentDefinition.Weather(Weather.Type.THUNDER).withMaxTicks(int maxTicks) withPadding(int padding) withRotation(net.minecraft.world.level.block.Rotation rotation) withSetupTicks(int setupTicks) withStructure(net.minecraft.resources.Identifier structure)
-
Field Details
-
PLATFORM
public static final net.minecraft.resources.Identifier PLATFORMCoolCatLib's own test structure: an empty 8 × 6 × 8 space on a stone floor. -
DEFAULT
-
-
Constructor Details
-
GameTestOptions
public GameTestOptions(net.minecraft.resources.Identifier 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 net.minecraft.gametest.framework.TestEnvironmentDefinition<?> environment) Creates an instance of aGameTestOptionsrecord class.- Parameters:
structure- the value for thestructurerecord componentmaxTicks- the value for themaxTicksrecord componentsetupTicks- the value for thesetupTicksrecord componentrequired- the value for therequiredrecord componentrotation- the value for therotationrecord componentmanualOnly- the value for themanualOnlyrecord componentmaxAttempts- the value for themaxAttemptsrecord componentrequiredSuccesses- the value for therequiredSuccessesrecord componentskyAccess- the value for theskyAccessrecord componentpadding- the value for thepaddingrecord componentenvironment- the value for theenvironmentrecord component
-
-
Method Details
-
withStructure
-
withMaxTicks
-
withSetupTicks
-
optional
-
withRotation
-
asManualOnly
-
withAttempts
Tried up tomaxAttemptstimes; passes oncerequiredSuccessestries have. For flaky tests. -
withSkyAccess
-
withPadding
-
withEnvironment
public GameTestOptions withEnvironment(net.minecraft.gametest.framework.TestEnvironmentDefinition<?> environment) Runs in these conditions, such asnew TestEnvironmentDefinition.Weather(Weather.Type.THUNDER). -
of
The options an annotated method asks for. -
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
structure
-
maxTicks
-
setupTicks
public int setupTicks()Returns the value of thesetupTicksrecord component.- Returns:
- the value of the
setupTicksrecord component
-
required
-
rotation
-
manualOnly
public boolean manualOnly()Returns the value of themanualOnlyrecord component.- Returns:
- the value of the
manualOnlyrecord component
-
maxAttempts
public int maxAttempts()Returns the value of themaxAttemptsrecord component.- Returns:
- the value of the
maxAttemptsrecord component
-
requiredSuccesses
public int requiredSuccesses()Returns the value of therequiredSuccessesrecord component.- Returns:
- the value of the
requiredSuccessesrecord component
-
skyAccess
-
padding
-
environment
@Nullable public @Nullable net.minecraft.gametest.framework.TestEnvironmentDefinition<?> environment()Returns the value of theenvironmentrecord component.- Returns:
- the value of the
environmentrecord component
-