ProgressScreen .java

net.minecraft.client.gui.screens.ProgressScreen (class): members: clearScreenAfterStop, progressStagePercentage, progressStartNoAbort, progressStage, stop.

net.minecraft.client.gui.screensclass79 linesclientextends Screen2.0 KB

Implements

API Surface (8)

boolean shouldCloseOnEsc()
boolean shouldNarrateNavigation()
void progressStartNoAbort(final Component string)
void progressStart(final Component string)
void progressStage(final Component string)
void progressStagePercentage(final int i)
void stop()
void extractRenderState(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final float a)

Fields & Constants (5)

header
stage
progress
stop
clearScreenAfterStop

String literals (1)

"menu.working"

Code Graph: Dependencies (5)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

ProgressScreen.java79 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.gui.screens;
2
3
import net.fabricmc.api.EnvType;
4
import net.fabricmc.api.Environment;
5
import net.minecraft.client.GameNarrator;
6
import net.minecraft.client.gui.GuiGraphicsExtractor;
7
import net.minecraft.network.chat.Component;
8
import net.minecraft.util.ProgressListener;
9
import org.jspecify.annotations.Nullable;
10
11
@Environment(EnvType.CLIENT)
12
public class ProgressScreen extends Screen implements ProgressListener {
13
	private @Nullable Component header;
14
	private @Nullable Component stage;
15
	private int progress;
16
	private boolean stop;
17
	private final boolean clearScreenAfterStop;
18
19
	public ProgressScreen(final boolean clearScreenAfterStop) {
20
		super(GameNarrator.NO_TITLE);
21
		this.clearScreenAfterStop = clearScreenAfterStop;
22
	}
23
24
	@Override
25
	public boolean shouldCloseOnEsc() {
26
		return false;
27
	}
28
29
	@Override
30
	protected boolean shouldNarrateNavigation() {
31
		return false;
32
	}
33
34
	@Override
35
	public void progressStartNoAbort(final Component string) {
36
		this.progressStart(string);
37
	}
38
39
	@Override
40
	public void progressStart(final Component string) {
41
		this.header = string;
42
		this.progressStage(Component.translatable("menu.working"));
43
	}
44
45
	@Override
46
	public void progressStage(final Component string) {
47
		this.stage = string;
48
		this.progressStagePercentage(0);
49
	}
50
51
	@Override
52
	public void progressStagePercentage(final int i) {
53
		this.progress = i;
54
	}
55
56
	@Override
57
	public void stop() {
58
		this.stop = true;
59
	}
60
61
	@Override
62
	public void extractRenderState(final GuiGraphicsExtractor graphics, final int mouseX, final int mouseY, final float a) {
63
		if (this.stop) {
64
			if (this.clearScreenAfterStop) {
65
				this.minecraft.gui.setScreen(null);
66
			}
67
		} else {
68
			super.extractRenderState(graphics, mouseX, mouseY, a);
69
			if (this.header != null) {
70
				graphics.centeredText(this.font, this.header, this.width / 2, 70, -1);
71
			}
72
73
			if (this.stage != null && this.progress != 0) {
74
				graphics.centeredText(this.font, Component.empty().append(this.stage).append(" " + this.progress + "%"), this.width / 2, 90, -1);
75
			}
76
		}
77
	}
78
}
79

Decompiled Minecraft 26.3 source of ProgressScreen (net/minecraft/client/gui/screens/ProgressScreen.java) with Mojang official mappings, stored verbatim on the site.