RetryOptions .java

net.minecraft.gametest.framework.RetryOptions (record): members: numberOfTries, haltOnFailure, unlimitedTries, hasTriesLeft, NO_RETRIES, hasRetries.

net.minecraft.gametest.frameworkrecord24 linescommon673 B

API Surface (5)

record RetryOptions(int numberOfTries, boolean haltOnFailure)
RetryOptions noRetries()
boolean unlimitedTries()
boolean hasTriesLeft(final int attempts, final int successes)
boolean hasRetries()

Fields & Constants (1)

NO_RETRIES

Full Source

RetryOptions.java24 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.gametest.framework;
2
3
public record RetryOptions(int numberOfTries, boolean haltOnFailure) {
4
	private static final RetryOptions NO_RETRIES = new RetryOptions(1, true);
5
6
	public static RetryOptions noRetries() {
7
		return NO_RETRIES;
8
	}
9
10
	public boolean unlimitedTries() {
11
		return this.numberOfTries < 1;
12
	}
13
14
	public boolean hasTriesLeft(final int attempts, final int successes) {
15
		boolean hasFailures = attempts != successes;
16
		boolean hasMoreAttempts = this.unlimitedTries() || attempts < this.numberOfTries;
17
		return hasMoreAttempts && (!hasFailures || !this.haltOnFailure);
18
	}
19
20
	public boolean hasRetries() {
21
		return this.numberOfTries != 1;
22
	}
23
}
24

Decompiled Minecraft 26.3 source of RetryOptions (net/minecraft/gametest/framework/RetryOptions.java) with Mojang official mappings, stored verbatim on the site.