ProgressScreen
This commit is contained in:
parent
898668ae96
commit
469e97b790
10 changed files with 273 additions and 36 deletions
|
@ -12,7 +12,7 @@ import java.util.function.Function;
|
||||||
class GridCell extends GridCellDefinition {
|
class GridCell extends GridCellDefinition {
|
||||||
public final float height;
|
public final float height;
|
||||||
Function<GridTransform, Object> componentPlacer;
|
Function<GridTransform, Object> componentPlacer;
|
||||||
final TriConsumer<PoseStack, GridTransform, Object> customRender;
|
TriConsumer<PoseStack, GridTransform, Object> customRender;
|
||||||
|
|
||||||
GridCell(double width, double height, GridLayout.GridValueType widthType, Function<GridTransform, Object> componentPlacer, TriConsumer<PoseStack, GridTransform, Object> customRender) {
|
GridCell(double width, double height, GridLayout.GridValueType widthType, Function<GridTransform, Object> componentPlacer, TriConsumer<PoseStack, GridTransform, Object> customRender) {
|
||||||
super(width, widthType);
|
super(width, widthType);
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package ru.bclib.gui.gridlayout;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
|
import ru.bclib.gui.gridlayout.GridLayout.GridValueType;
|
||||||
|
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public abstract class GridCustomRenderCell extends GridCell{
|
||||||
|
protected GridCustomRenderCell(double width, GridValueType widthType, double height) {
|
||||||
|
super(width, height, widthType, null, null);
|
||||||
|
this.customRender = this::onRender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void onRender(PoseStack poseStack, GridTransform transform, Object context);
|
||||||
|
}
|
|
@ -86,6 +86,7 @@ public class GridLayout extends GridColumn {
|
||||||
public static final int COLOR_RED = 0x00FF0000;
|
public static final int COLOR_RED = 0x00FF0000;
|
||||||
public static final int COLOR_GREEN = 0x0000FF00;
|
public static final int COLOR_GREEN = 0x0000FF00;
|
||||||
public static final int COLOR_BLUE = 0x000000FF;
|
public static final int COLOR_BLUE = 0x000000FF;
|
||||||
|
public static final int COLOR_GRAY = 0x007F7F7F;
|
||||||
|
|
||||||
public final GridScreen screen;
|
public final GridScreen screen;
|
||||||
public final int screenHeight;
|
public final int screenHeight;
|
||||||
|
|
|
@ -11,41 +11,51 @@ import ru.bclib.gui.gridlayout.GridLayout.GridValueType;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
class GridMessageCell extends GridCell {
|
public class GridMessageCell extends GridCell {
|
||||||
private final Font font;
|
private final Font font;
|
||||||
private final Component text;
|
private Component text;
|
||||||
private MultiLineLabel label;
|
private MultiLineLabel lastLabel;
|
||||||
|
private GridTransform lastTransform;
|
||||||
|
|
||||||
GridMessageCell(double width, GridValueType widthType, Alignment contentAlignment, Font font, Component text) {
|
GridMessageCell(double width, GridValueType widthType, Alignment contentAlignment, Font font, Component text) {
|
||||||
this(width, widthType, contentAlignment, font, text, GridLayout.COLOR_WHITE);
|
this(width, widthType, contentAlignment, font, text, GridLayout.COLOR_WHITE);
|
||||||
}
|
}
|
||||||
GridMessageCell(double width, GridValueType widthType, Alignment contentAlignment, Font font, Component text, int color) {
|
GridMessageCell(double width, GridValueType widthType, Alignment contentAlignment, Font font, Component text, int color) {
|
||||||
super(width, -1, widthType, null, (poseStack, transform, context) -> {
|
super(width, -1, widthType, null, null);
|
||||||
MultiLineLabel label = (MultiLineLabel) context;
|
|
||||||
if (contentAlignment == Alignment.CENTER) {
|
|
||||||
label.renderCentered(poseStack, transform.width / 2 + transform.left, transform.top, font.lineHeight, color);
|
|
||||||
}
|
|
||||||
else if (contentAlignment == Alignment.LEFT) {
|
|
||||||
label.renderLeftAligned(poseStack, transform.left, transform.top, font.lineHeight, color);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.font = font;
|
this.font = font;
|
||||||
this.text = text;
|
this.text = text;
|
||||||
|
|
||||||
|
customRender = (poseStack, transform, context) -> {
|
||||||
|
//MultiLineLabel label = (MultiLineLabel) context;
|
||||||
|
if (contentAlignment == Alignment.CENTER) {
|
||||||
|
lastLabel.renderCentered(poseStack, transform.width / 2 + transform.left, transform.top, font.lineHeight, color);
|
||||||
|
}
|
||||||
|
else if (contentAlignment == Alignment.LEFT) {
|
||||||
|
lastLabel.renderLeftAligned(poseStack, transform.left, transform.top, font.lineHeight, color);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(Component text){
|
||||||
|
this.text = text;
|
||||||
|
if (lastTransform!=null) {
|
||||||
|
create(lastTransform);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private MultiLineLabel getLabel(GridTransform transform) {
|
private MultiLineLabel getLabel(GridTransform transform) {
|
||||||
return label;
|
return lastLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void create(GridTransform transform) {
|
protected void create(GridTransform transform) {
|
||||||
this.label = MultiLineLabel.create(font, text, transform.width);
|
this.lastTransform = transform;
|
||||||
|
this.lastLabel = MultiLineLabel.create(font, text, transform.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected GridElement buildElementAt(int left, int top, int width, List<GridElement> collector) {
|
protected GridElement buildElementAt(int left, int top, int width, List<GridElement> collector) {
|
||||||
create(new GridTransform(left, top, width, 0));
|
create(new GridTransform(left, top, width, 0));
|
||||||
int promptLines = this.label.getLineCount() + 1;
|
int promptLines = this.lastLabel.getLineCount() + 1;
|
||||||
int height = promptLines * 9;
|
int height = promptLines * 9;
|
||||||
|
|
||||||
return new GridElement(left, top, width, height, this::getLabel, customRender);
|
return new GridElement(left, top, width, height, this::getLabel, customRender);
|
||||||
|
|
|
@ -122,6 +122,10 @@ public class GridRow extends GridContainer {
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GridCustomRenderCell addCustomRender(GridCustomRenderCell cell) {
|
||||||
|
this.cells.add(cell);
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
|
||||||
public GridCell addImage(ResourceLocation location, int width, int height) {
|
public GridCell addImage(ResourceLocation location, int width, int height) {
|
||||||
return addImage(location, 1.0f, width, height);
|
return addImage(location, 1.0f, width, height);
|
||||||
|
@ -170,48 +174,48 @@ public class GridRow extends GridContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public GridCell addMessage(Component text, Font font, Alignment contentAlignment) {
|
public GridMessageCell addMessage(Component text, Font font, Alignment contentAlignment) {
|
||||||
return addMessage(text, font, GridLayout.COLOR_WHITE, contentAlignment);
|
return addMessage(text, font, GridLayout.COLOR_WHITE, contentAlignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridCell addMessage(Component text, Font font, int color, Alignment contentAlignment) {
|
public GridMessageCell addMessage(Component text, Font font, int color, Alignment contentAlignment) {
|
||||||
return addMessage(text, 1.0, GridLayout.GridValueType.PERCENTAGE, font, color, contentAlignment);
|
return addMessage(text, 1.0, GridLayout.GridValueType.PERCENTAGE, font, color, contentAlignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridCell addMessage(Component text, double width, GridValueType widthType, Font font, Alignment contentAlignment) {
|
public GridMessageCell addMessage(Component text, double width, GridValueType widthType, Font font, Alignment contentAlignment) {
|
||||||
return addMessage(text, width, widthType, font, GridLayout.COLOR_WHITE, contentAlignment);
|
return addMessage(text, width, widthType, font, GridLayout.COLOR_WHITE, contentAlignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridCell addMessage(Component text, double width, GridValueType widthType, Font font, int color, Alignment contentAlignment) {
|
public GridMessageCell addMessage(Component text, double width, GridValueType widthType, Font font, int color, Alignment contentAlignment) {
|
||||||
GridCell cell = new GridMessageCell(width, widthType, Alignment.LEFT, font, text, color);
|
GridMessageCell cell = new GridMessageCell(width, widthType, contentAlignment, font, text, color);
|
||||||
this.cells.add(cell);
|
this.cells.add(cell);
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridCell addString(Component text, GridScreen parent) {
|
public GridStringCell addString(Component text, GridScreen parent) {
|
||||||
return this.addString(text, GridLayout.COLOR_WHITE, parent);
|
return this.addString(text, GridLayout.COLOR_WHITE, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridCell addString(Component text, int color, GridScreen parent) {
|
|
||||||
final int width = parent.getFont()
|
public GridStringCell addString(Component text, int color, GridScreen parent) {
|
||||||
.width(text.getVisualOrderText());
|
final int width = parent.getWidth(text);
|
||||||
return this.addString(text, width, GridValueType.CONSTANT, GridLayout.COLOR_WHITE, Alignment.CENTER, parent);
|
return this.addString(text, width, GridValueType.CONSTANT, GridLayout.COLOR_WHITE, Alignment.CENTER, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridCell addString(Component text, Alignment contentAlignment, GridScreen parent) {
|
public GridStringCell addString(Component text, Alignment contentAlignment, GridScreen parent) {
|
||||||
return this.addString(text, GridLayout.COLOR_WHITE, contentAlignment, parent);
|
return this.addString(text, GridLayout.COLOR_WHITE, contentAlignment, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridCell addString(Component text, int color, Alignment contentAlignment, GridScreen parent) {
|
public GridStringCell addString(Component text, int color, Alignment contentAlignment, GridScreen parent) {
|
||||||
return this.addString(text, 1.0, GridLayout.GridValueType.PERCENTAGE, color, contentAlignment, parent);
|
return this.addString(text, 1.0, GridLayout.GridValueType.PERCENTAGE, color, contentAlignment, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridCell addString(Component text, double width, GridValueType widthType, Alignment contentAlignment, GridScreen parent) {
|
public GridStringCell addString(Component text, double width, GridValueType widthType, Alignment contentAlignment, GridScreen parent) {
|
||||||
return addString(text, width, widthType, GridLayout.COLOR_WHITE, contentAlignment, parent);
|
return addString(text, width, widthType, GridLayout.COLOR_WHITE, contentAlignment, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridCell addString(Component text, double width, GridValueType widthType, int color, Alignment contentAlignment, GridScreen parent) {
|
public GridStringCell addString(Component text, double width, GridValueType widthType, int color, Alignment contentAlignment, GridScreen parent) {
|
||||||
GridCell cell = new GridStringCell(width, widthType, parent.getFont().lineHeight, contentAlignment, parent, text, color);
|
GridStringCell cell = new GridStringCell(width, widthType, parent.getFont().lineHeight, contentAlignment, parent, text, color);
|
||||||
this.cells.add(cell);
|
this.cells.add(cell);
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,4 +96,12 @@ public abstract class GridScreen extends Screen {
|
||||||
|
|
||||||
super.render(poseStack, i, j, f);
|
super.render(poseStack, i, j, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getWidth(Component text, Font font) {
|
||||||
|
return font.width(text.getVisualOrderText());
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWidth(Component text) {
|
||||||
|
return getWidth(text, getFont());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,19 +7,26 @@ import ru.bclib.gui.gridlayout.GridLayout.Alignment;
|
||||||
import ru.bclib.gui.gridlayout.GridLayout.GridValueType;
|
import ru.bclib.gui.gridlayout.GridLayout.GridValueType;
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
class GridStringCell extends GridCell {
|
public class GridStringCell extends GridCell {
|
||||||
|
private Component text;
|
||||||
GridStringCell(double width, GridValueType widthType, int height, Alignment contentAlignment, GridScreen parent, Component text) {
|
GridStringCell(double width, GridValueType widthType, int height, Alignment contentAlignment, GridScreen parent, Component text) {
|
||||||
this(width, widthType, height, contentAlignment, parent, text, GridLayout.COLOR_WHITE);
|
this(width, widthType, height, contentAlignment, parent, text, GridLayout.COLOR_WHITE);
|
||||||
|
|
||||||
}
|
}
|
||||||
GridStringCell(double width, GridValueType widthType, int height, Alignment contentAlignment, GridScreen parent, Component text, int color) {
|
GridStringCell(double width, GridValueType widthType, int height, Alignment contentAlignment, GridScreen parent, Component text, int color) {
|
||||||
super(width, height, widthType, null, (poseStack, transform, context) -> {
|
super(width, height, widthType, null, null);
|
||||||
|
this.text = text;
|
||||||
|
this.customRender = (poseStack, transform, context) -> {
|
||||||
if (contentAlignment == Alignment.CENTER) {
|
if (contentAlignment == Alignment.CENTER) {
|
||||||
parent.drawCenteredString(poseStack, parent.getFont(), text, transform.width / 2 + transform.left, transform.top, color);
|
parent.drawCenteredString(poseStack, parent.getFont(), this.text, transform.width / 2 + transform.left, transform.top, color);
|
||||||
}
|
}
|
||||||
else if (contentAlignment == Alignment.LEFT) {
|
else if (contentAlignment == Alignment.LEFT) {
|
||||||
parent.drawString(poseStack, parent.getFont(), text, transform.left, transform.top, color);
|
parent.drawString(poseStack, parent.getFont(), this.text, transform.left, transform.top, color);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(Component newText){
|
||||||
|
this.text = newText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
186
src/main/java/ru/bclib/gui/screens/ProgressScreen.java
Normal file
186
src/main/java/ru/bclib/gui/screens/ProgressScreen.java
Normal file
|
@ -0,0 +1,186 @@
|
||||||
|
package ru.bclib.gui.screens;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import net.minecraft.client.gui.GuiComponent;
|
||||||
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.util.ProgressListener;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import ru.bclib.BCLib;
|
||||||
|
import ru.bclib.gui.gridlayout.GridColumn;
|
||||||
|
import ru.bclib.gui.gridlayout.GridCustomRenderCell;
|
||||||
|
import ru.bclib.gui.gridlayout.GridLayout;
|
||||||
|
import ru.bclib.gui.gridlayout.GridLayout.Alignment;
|
||||||
|
import ru.bclib.gui.gridlayout.GridLayout.GridValueType;
|
||||||
|
import ru.bclib.gui.gridlayout.GridLayout.VerticalAlignment;
|
||||||
|
import ru.bclib.gui.gridlayout.GridMessageCell;
|
||||||
|
import ru.bclib.gui.gridlayout.GridRow;
|
||||||
|
import ru.bclib.gui.gridlayout.GridScreen;
|
||||||
|
import ru.bclib.gui.gridlayout.GridStringCell;
|
||||||
|
import ru.bclib.gui.gridlayout.GridTransform;
|
||||||
|
|
||||||
|
class ProgressLogoRender extends GridCustomRenderCell {
|
||||||
|
public static final int SIZE = 64;
|
||||||
|
public static final int LOGO_SIZE = 512;
|
||||||
|
public static final int PIXELATED_SIZE = 512;
|
||||||
|
float percentage = 0;
|
||||||
|
double time = 0;
|
||||||
|
protected ProgressLogoRender() {
|
||||||
|
super(SIZE, GridValueType.CONSTANT, SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRender(PoseStack poseStack, GridTransform transform, Object context) {
|
||||||
|
time += 0.03;
|
||||||
|
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||||
|
RenderSystem.enableBlend();
|
||||||
|
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||||
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0f);
|
||||||
|
|
||||||
|
final float fScale = (float)(0.3*((Math.sin(time)+1.0)*0.5) + 0.7);
|
||||||
|
int height = (int)(transform.height*fScale);
|
||||||
|
int width = (int)(transform.width*fScale);
|
||||||
|
width -= ((transform.width-width)%2);
|
||||||
|
height -= ((transform.height-height)%2);
|
||||||
|
final int yOffset = (transform.height-height)/2;
|
||||||
|
final int xOffset = (transform.width-width)/2;
|
||||||
|
|
||||||
|
final int yBarLocal = (int)(transform.height*percentage);
|
||||||
|
final int yBar = transform.top + yBarLocal;
|
||||||
|
|
||||||
|
final float relativeY = ((float)(yBarLocal - yOffset)/height);
|
||||||
|
|
||||||
|
final int uvTopLogo = (int)(relativeY * LOGO_SIZE);
|
||||||
|
final int uvTopPixelated = (int)(relativeY * PIXELATED_SIZE);
|
||||||
|
|
||||||
|
if (uvTopLogo>0) {
|
||||||
|
RenderSystem.setShaderTexture(0, BCLibScreen.BCLIB_LOGO_LOCATION);
|
||||||
|
GuiComponent.blit(poseStack,
|
||||||
|
xOffset + transform.left,
|
||||||
|
yOffset + transform.top,
|
||||||
|
width,
|
||||||
|
yBarLocal - yOffset,
|
||||||
|
0, 0, LOGO_SIZE, uvTopLogo,
|
||||||
|
LOGO_SIZE, LOGO_SIZE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uvTopPixelated<PIXELATED_SIZE) {
|
||||||
|
RenderSystem.setShaderTexture(0, ProgressScreen.BCLIB_LOGO_PIXELATED_LOCATION);
|
||||||
|
GuiComponent.blit(poseStack,
|
||||||
|
xOffset + transform.left,
|
||||||
|
yBar,
|
||||||
|
width,
|
||||||
|
height-(yBarLocal - yOffset),
|
||||||
|
0, uvTopPixelated, PIXELATED_SIZE, PIXELATED_SIZE-uvTopPixelated,
|
||||||
|
PIXELATED_SIZE, PIXELATED_SIZE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (percentage>0 && percentage<1.0){
|
||||||
|
GuiComponent.fill(poseStack,
|
||||||
|
transform.left,
|
||||||
|
yBar,
|
||||||
|
transform.left+transform.width,
|
||||||
|
yBar+1,
|
||||||
|
0x3FFFFFFF
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ProgressScreen extends GridScreen implements ProgressListener {
|
||||||
|
static final ResourceLocation BCLIB_LOGO_PIXELATED_LOCATION = new ResourceLocation(BCLib.MOD_ID, "iconpixelated.png");
|
||||||
|
public ProgressScreen(@Nullable Screen parent, Component title, Component description) {
|
||||||
|
super(parent, title, 20, false);
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
Component description;
|
||||||
|
private Component stageComponent;
|
||||||
|
private GridMessageCell stage;
|
||||||
|
private GridStringCell progress;
|
||||||
|
private ProgressLogoRender progressImage;
|
||||||
|
private int currentProgress = 0;
|
||||||
|
public boolean shouldCloseOnEsc() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Component getProgressComponent(){
|
||||||
|
return getProgressComponent(currentProgress);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Component getProgressComponent(int pg){
|
||||||
|
return new TranslatableComponent("title.bclib.progress").append(": " + pg + "%");
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void initLayout() {
|
||||||
|
grid.addSpacerRow();
|
||||||
|
|
||||||
|
GridRow row = grid.addRow(VerticalAlignment.CENTER);
|
||||||
|
row.addFiller();
|
||||||
|
progressImage = new ProgressLogoRender();
|
||||||
|
progressImage.percentage = currentProgress / 100.0f;
|
||||||
|
row.addCustomRender(progressImage);
|
||||||
|
row.addSpacer();
|
||||||
|
|
||||||
|
int textWidth = Math.max(getWidth(description), getWidth(getProgressComponent(100)));
|
||||||
|
GridColumn textCol = row.addColumn(textWidth, GridValueType.CONSTANT);
|
||||||
|
textCol.addRow().addString(description, this);
|
||||||
|
textCol.addSpacerRow();
|
||||||
|
progress = textCol.addRow().addString(getProgressComponent(), GridLayout.COLOR_GRAY, Alignment.LEFT, this);
|
||||||
|
|
||||||
|
row.addFiller();
|
||||||
|
|
||||||
|
grid.addSpacerRow(20);
|
||||||
|
row = grid.addRow();
|
||||||
|
stage = row.addMessage(stageComponent!=null?stageComponent:new TextComponent(""), font, Alignment.CENTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressStartNoAbort(Component component) {
|
||||||
|
this.progressStage(component);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressStart(Component component) {
|
||||||
|
this.progressStage(component);
|
||||||
|
this.progressStagePercentage(30);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressStage(Component component) {
|
||||||
|
stageComponent = component;
|
||||||
|
if (stage!=null) stage.setText(component);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progressStagePercentage(int i) {
|
||||||
|
if (i!=currentProgress) {
|
||||||
|
currentProgress = i;
|
||||||
|
if (progressImage!=null) progressImage.percentage = currentProgress / 100.0f;
|
||||||
|
BCLib.LOGGER.info(" -> progress: " + i + "%");
|
||||||
|
if (progress!=null) progress.setText(getProgressComponent());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
double time = 0;
|
||||||
|
@Override
|
||||||
|
public void render(PoseStack poseStack, int i, int j, float f) {
|
||||||
|
//time += 0.05;
|
||||||
|
//progressStagePercentage(((int)time)%100);
|
||||||
|
//progressStagePercentage(1);
|
||||||
|
super.render(poseStack, i, j, f);
|
||||||
|
}
|
||||||
|
}
|
BIN
src/main/resources/assets/bclib/iconpixelated.png
Normal file
BIN
src/main/resources/assets/bclib/iconpixelated.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
|
@ -17,6 +17,10 @@
|
||||||
"message.bclib.confirmrestart": "The requested content was synchronized. You need to restart Minecraft now.",
|
"message.bclib.confirmrestart": "The requested content was synchronized. You need to restart Minecraft now.",
|
||||||
"title.link.bclib.discord": "Discord",
|
"title.link.bclib.discord": "Discord",
|
||||||
"title.bclib.modmenu.main": "BCLib Settings",
|
"title.bclib.modmenu.main": "BCLib Settings",
|
||||||
|
"title.bclib.progress": "Progress",
|
||||||
|
"title.bclib.filesync.progress": "File Transfer",
|
||||||
|
"message.bclib.filesync.progress": "Syncing File-Content with Server",
|
||||||
|
"message.bclib.filesync.progress.stage.empty": "",
|
||||||
|
|
||||||
"title.config.bclib.client.auto_sync.enabled": "Enable Auto-Sync",
|
"title.config.bclib.client.auto_sync.enabled": "Enable Auto-Sync",
|
||||||
"title.config.bclib.client.auto_sync.acceptConfigs": "Accept incoming Confog Files",
|
"title.config.bclib.client.auto_sync.acceptConfigs": "Accept incoming Confog Files",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue