Reformated
This commit is contained in:
parent
079b51e3f6
commit
852e5a6abc
385 changed files with 6924 additions and 5656 deletions
|
@ -1,11 +1,12 @@
|
|||
package org.betterx.bclib.client.gui.gridlayout;
|
||||
|
||||
import org.betterx.bclib.interfaces.TriConsumer;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import org.betterx.bclib.interfaces.TriConsumer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
|
@ -15,11 +16,13 @@ class GridCell extends GridCellDefinition {
|
|||
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) {
|
||||
GridCell(
|
||||
double width,
|
||||
double height,
|
||||
GridLayout.GridValueType widthType,
|
||||
Function<GridTransform, Object> componentPlacer,
|
||||
TriConsumer<PoseStack, GridTransform, Object> customRender
|
||||
) {
|
||||
super(width, widthType);
|
||||
this.height = (float) height;
|
||||
this.componentPlacer = componentPlacer;
|
||||
|
|
|
@ -12,13 +12,15 @@ import java.util.function.Consumer;
|
|||
class SignalingCheckBox extends Checkbox {
|
||||
private final Consumer<Boolean> onChange;
|
||||
|
||||
public SignalingCheckBox(int left,
|
||||
int top,
|
||||
int width,
|
||||
int height,
|
||||
Component component,
|
||||
boolean checked,
|
||||
Consumer<Boolean> onChange) {
|
||||
public SignalingCheckBox(
|
||||
int left,
|
||||
int top,
|
||||
int width,
|
||||
int height,
|
||||
Component component,
|
||||
boolean checked,
|
||||
Consumer<Boolean> onChange
|
||||
) {
|
||||
super(left, top, width, height, component, checked);
|
||||
this.onChange = onChange;
|
||||
if (onChange != null)
|
||||
|
@ -40,22 +42,26 @@ public class GridCheckboxCell extends GridCell implements GridWidgetWithEnabledS
|
|||
private boolean enabled;
|
||||
private final float alpha;
|
||||
|
||||
GridCheckboxCell(Component text,
|
||||
boolean checked,
|
||||
float alpha,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
double height) {
|
||||
GridCheckboxCell(
|
||||
Component text,
|
||||
boolean checked,
|
||||
float alpha,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
double height
|
||||
) {
|
||||
this(text, checked, alpha, width, widthType, height, null);
|
||||
}
|
||||
|
||||
GridCheckboxCell(Component text,
|
||||
boolean checked,
|
||||
float alpha,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
double height,
|
||||
Consumer<Boolean> onChange) {
|
||||
GridCheckboxCell(
|
||||
Component text,
|
||||
boolean checked,
|
||||
float alpha,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
double height,
|
||||
Consumer<Boolean> onChange
|
||||
) {
|
||||
super(width, height, widthType, null, null);
|
||||
lastCheckbox = null;
|
||||
enabled = true;
|
||||
|
|
|
@ -20,11 +20,13 @@ public class GridColumn extends GridContainer {
|
|||
}
|
||||
|
||||
public GridRow addRow(GridLayout.VerticalAlignment align) {
|
||||
GridRow row = new GridRow(1.0,
|
||||
GridRow row = new GridRow(
|
||||
1.0,
|
||||
widthType == GridLayout.GridValueType.INHERIT
|
||||
? GridLayout.GridValueType.INHERIT
|
||||
: GridLayout.GridValueType.PERCENTAGE,
|
||||
align);
|
||||
align
|
||||
);
|
||||
this.cells.add(row);
|
||||
return row;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package org.betterx.bclib.client.gui.gridlayout;
|
||||
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout.GridValueType;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout.GridValueType;
|
||||
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public abstract class GridCustomRenderCell extends GridCell {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.betterx.bclib.client.gui.gridlayout;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
@ -7,30 +9,32 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class GridImageCell extends GridCell {
|
||||
GridImageCell(ResourceLocation location,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
double height,
|
||||
float alpha,
|
||||
int uvLeft,
|
||||
int uvTop,
|
||||
int uvWidth,
|
||||
int uvHeight,
|
||||
int resourceWidth,
|
||||
int resourceHeight) {
|
||||
GridImageCell(
|
||||
ResourceLocation location,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
double height,
|
||||
float alpha,
|
||||
int uvLeft,
|
||||
int uvTop,
|
||||
int uvWidth,
|
||||
int uvHeight,
|
||||
int resourceWidth,
|
||||
int resourceHeight
|
||||
) {
|
||||
super(width, height, widthType, null, (poseStack, transform, context) -> {
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, location);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA,
|
||||
GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
RenderSystem.blendFunc(
|
||||
GlStateManager.SourceFactor.SRC_ALPHA,
|
||||
GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA
|
||||
);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, alpha);
|
||||
GuiComponent.blit(poseStack,
|
||||
GuiComponent.blit(
|
||||
poseStack,
|
||||
transform.left,
|
||||
transform.top,
|
||||
transform.width,
|
||||
|
@ -40,7 +44,8 @@ public class GridImageCell extends GridCell {
|
|||
uvWidth,
|
||||
uvHeight,
|
||||
resourceWidth,
|
||||
resourceHeight);
|
||||
resourceHeight
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package org.betterx.bclib.client.gui.gridlayout;
|
||||
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout.GridValueType;
|
||||
import org.betterx.bclib.interfaces.TriConsumer;
|
||||
import org.betterx.bclib.util.Pair;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout.GridValueType;
|
||||
import org.betterx.bclib.interfaces.TriConsumer;
|
||||
import org.betterx.bclib.util.Pair;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
@ -35,12 +35,14 @@ abstract class GridCellDefinition {
|
|||
}
|
||||
}
|
||||
|
||||
final GridElement buildElement(final int parentWidth,
|
||||
final int autoWidth,
|
||||
final float autoWidthSum,
|
||||
int left,
|
||||
final int top,
|
||||
final List<GridElement> collector) {
|
||||
final GridElement buildElement(
|
||||
final int parentWidth,
|
||||
final int autoWidth,
|
||||
final float autoWidthSum,
|
||||
int left,
|
||||
final int top,
|
||||
final List<GridElement> collector
|
||||
) {
|
||||
final int width = widthType == GridValueType.FILL
|
||||
? (int) ((this.width / autoWidthSum) * autoWidth)
|
||||
: calculateWidth(parentWidth);
|
||||
|
@ -61,12 +63,14 @@ class GridElement extends GridTransform {
|
|||
final TriConsumer<PoseStack, GridTransform, Object> customRender;
|
||||
Object renderContext;
|
||||
|
||||
GridElement(int left,
|
||||
int top,
|
||||
int width,
|
||||
int height,
|
||||
Function<GridTransform, Object> componentPlacer,
|
||||
TriConsumer<PoseStack, GridTransform, Object> customRender) {
|
||||
GridElement(
|
||||
int left,
|
||||
int top,
|
||||
int width,
|
||||
int height,
|
||||
Function<GridTransform, Object> componentPlacer,
|
||||
TriConsumer<PoseStack, GridTransform, Object> customRender
|
||||
) {
|
||||
super(left, top, width, height);
|
||||
this.componentPlacer = componentPlacer;
|
||||
this.customRender = customRender;
|
||||
|
@ -181,9 +185,11 @@ public class GridLayout extends GridColumn {
|
|||
elements
|
||||
.stream()
|
||||
.filter(element -> element.customRender != null)
|
||||
.forEach(element -> element.customRender.accept(poseStack,
|
||||
.forEach(element -> element.customRender.accept(
|
||||
poseStack,
|
||||
element.transformWithPadding(sidePadding, topPadding),
|
||||
element.renderContext));
|
||||
element.renderContext
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,20 +16,24 @@ public class GridMessageCell extends GridCell {
|
|||
private MultiLineLabel lastLabel;
|
||||
private GridTransform lastTransform;
|
||||
|
||||
GridMessageCell(double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
GridLayout.Alignment contentAlignment,
|
||||
Font font,
|
||||
Component text) {
|
||||
GridMessageCell(
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
GridLayout.Alignment contentAlignment,
|
||||
Font font,
|
||||
Component text
|
||||
) {
|
||||
this(width, widthType, contentAlignment, font, text, GridLayout.COLOR_WHITE);
|
||||
}
|
||||
|
||||
GridMessageCell(double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
GridLayout.Alignment contentAlignment,
|
||||
Font font,
|
||||
Component text,
|
||||
int color) {
|
||||
GridMessageCell(
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
GridLayout.Alignment contentAlignment,
|
||||
Font font,
|
||||
Component text,
|
||||
int color
|
||||
) {
|
||||
super(width, -1, widthType, null, null);
|
||||
this.font = font;
|
||||
this.text = text;
|
||||
|
@ -37,11 +41,13 @@ public class GridMessageCell extends GridCell {
|
|||
customRender = (poseStack, transform, context) -> {
|
||||
//MultiLineLabel label = (MultiLineLabel) context;
|
||||
if (contentAlignment == GridLayout.Alignment.CENTER) {
|
||||
lastLabel.renderCentered(poseStack,
|
||||
lastLabel.renderCentered(
|
||||
poseStack,
|
||||
transform.width / 2 + transform.left,
|
||||
transform.top,
|
||||
font.lineHeight,
|
||||
color);
|
||||
color
|
||||
);
|
||||
} else if (contentAlignment == GridLayout.Alignment.LEFT) {
|
||||
lastLabel.renderLeftAligned(poseStack, transform.left, transform.top, font.lineHeight, color);
|
||||
}
|
||||
|
|
|
@ -47,10 +47,12 @@ public class GridRow extends GridContainer {
|
|||
return addComponent(1.0, GridLayout.GridValueType.PERCENTAGE, height, componentPlacer);
|
||||
}
|
||||
|
||||
public GridCell addComponent(double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
double height,
|
||||
Function<GridTransform, Object> componentPlacer) {
|
||||
public GridCell addComponent(
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
double height,
|
||||
Function<GridTransform, Object> componentPlacer
|
||||
) {
|
||||
GridCell cell = new GridCell(width, height, widthType, componentPlacer, null);
|
||||
this.cells.add(cell);
|
||||
return cell;
|
||||
|
@ -74,27 +76,33 @@ public class GridRow extends GridContainer {
|
|||
return addButton(text, alpha, width, GridLayout.GridValueType.CONSTANT, height, onPress);
|
||||
}
|
||||
|
||||
public GridCell addButton(Component text,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
double height,
|
||||
OnPress onPress) {
|
||||
public GridCell addButton(
|
||||
Component text,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
double height,
|
||||
OnPress onPress
|
||||
) {
|
||||
return addButton(text, 1.0f, width, widthType, height, onPress);
|
||||
}
|
||||
|
||||
public GridCell addButton(Component text,
|
||||
float alpha,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
double height,
|
||||
OnPress onPress) {
|
||||
public GridCell addButton(
|
||||
Component text,
|
||||
float alpha,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
double height,
|
||||
OnPress onPress
|
||||
) {
|
||||
GridCell cell = new GridCell(width, height, widthType, (transform) -> {
|
||||
Button customButton = new Button(transform.left,
|
||||
Button customButton = new Button(
|
||||
transform.left,
|
||||
transform.top,
|
||||
transform.width,
|
||||
transform.height,
|
||||
text,
|
||||
onPress);
|
||||
onPress
|
||||
);
|
||||
customButton.setAlpha(alpha);
|
||||
return customButton;
|
||||
}, null);
|
||||
|
@ -107,8 +115,10 @@ public class GridRow extends GridContainer {
|
|||
return addCheckbox(text, checked, width, widthType, onChange);
|
||||
}
|
||||
|
||||
public GridCheckboxCell addCheckbox(Component text, boolean checked, double width,
|
||||
GridLayout.GridValueType widthType, Consumer<Boolean> onChange) {
|
||||
public GridCheckboxCell addCheckbox(
|
||||
Component text, boolean checked, double width,
|
||||
GridLayout.GridValueType widthType, Consumer<Boolean> onChange
|
||||
) {
|
||||
|
||||
GridCheckboxCell cell = new GridCheckboxCell(text, checked, 1.0f, width, widthType, 20, onChange);
|
||||
this.cells.add(cell);
|
||||
|
@ -132,20 +142,24 @@ public class GridRow extends GridContainer {
|
|||
return addCheckbox(text, checked, alpha, width, GridLayout.GridValueType.CONSTANT, height);
|
||||
}
|
||||
|
||||
public GridCheckboxCell addCheckbox(Component text,
|
||||
boolean checked,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int height) {
|
||||
public GridCheckboxCell addCheckbox(
|
||||
Component text,
|
||||
boolean checked,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int height
|
||||
) {
|
||||
return addCheckbox(text, checked, 1.0f, width, widthType, height);
|
||||
}
|
||||
|
||||
public GridCheckboxCell addCheckbox(Component text,
|
||||
boolean checked,
|
||||
float alpha,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int height) {
|
||||
public GridCheckboxCell addCheckbox(
|
||||
Component text,
|
||||
boolean checked,
|
||||
float alpha,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int height
|
||||
) {
|
||||
GridCheckboxCell cell = new GridCheckboxCell(text, checked, alpha, width, widthType, height);
|
||||
this.cells.add(cell);
|
||||
return cell;
|
||||
|
@ -161,7 +175,8 @@ public class GridRow extends GridContainer {
|
|||
}
|
||||
|
||||
public GridCell addImage(ResourceLocation location, float alpha, int width, int height) {
|
||||
return addImage(location,
|
||||
return addImage(
|
||||
location,
|
||||
alpha,
|
||||
width,
|
||||
GridLayout.GridValueType.CONSTANT,
|
||||
|
@ -171,26 +186,32 @@ public class GridRow extends GridContainer {
|
|||
width,
|
||||
height,
|
||||
width,
|
||||
height);
|
||||
height
|
||||
);
|
||||
}
|
||||
|
||||
public GridCell addImage(ResourceLocation location,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int height,
|
||||
int resourceWidth,
|
||||
int resourceHeight) {
|
||||
public GridCell addImage(
|
||||
ResourceLocation location,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int height,
|
||||
int resourceWidth,
|
||||
int resourceHeight
|
||||
) {
|
||||
return addImage(location, 1.0f, width, widthType, height, resourceWidth, resourceHeight);
|
||||
}
|
||||
|
||||
public GridCell addImage(ResourceLocation location,
|
||||
float alpha,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int height,
|
||||
int resourceWidth,
|
||||
int resourceHeight) {
|
||||
return addImage(location,
|
||||
public GridCell addImage(
|
||||
ResourceLocation location,
|
||||
float alpha,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int height,
|
||||
int resourceWidth,
|
||||
int resourceHeight
|
||||
) {
|
||||
return addImage(
|
||||
location,
|
||||
alpha,
|
||||
width,
|
||||
widthType,
|
||||
|
@ -200,20 +221,24 @@ public class GridRow extends GridContainer {
|
|||
resourceWidth,
|
||||
resourceWidth,
|
||||
resourceWidth,
|
||||
resourceHeight);
|
||||
resourceHeight
|
||||
);
|
||||
}
|
||||
|
||||
public GridCell addImage(ResourceLocation location,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int height,
|
||||
int uvLeft,
|
||||
int uvTop,
|
||||
int uvWidth,
|
||||
int uvHeight,
|
||||
int resourceWidth,
|
||||
int resourceHeight) {
|
||||
return addImage(location,
|
||||
public GridCell addImage(
|
||||
ResourceLocation location,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int height,
|
||||
int uvLeft,
|
||||
int uvTop,
|
||||
int uvWidth,
|
||||
int uvHeight,
|
||||
int resourceWidth,
|
||||
int resourceHeight
|
||||
) {
|
||||
return addImage(
|
||||
location,
|
||||
1.0f,
|
||||
width,
|
||||
widthType,
|
||||
|
@ -223,21 +248,25 @@ public class GridRow extends GridContainer {
|
|||
uvWidth,
|
||||
uvHeight,
|
||||
resourceWidth,
|
||||
resourceHeight);
|
||||
resourceHeight
|
||||
);
|
||||
}
|
||||
|
||||
public GridCell addImage(ResourceLocation location,
|
||||
float alpha,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int height,
|
||||
int uvLeft,
|
||||
int uvTop,
|
||||
int uvWidth,
|
||||
int uvHeight,
|
||||
int resourceWidth,
|
||||
int resourceHeight) {
|
||||
GridCell cell = new GridImageCell(location,
|
||||
public GridCell addImage(
|
||||
ResourceLocation location,
|
||||
float alpha,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int height,
|
||||
int uvLeft,
|
||||
int uvTop,
|
||||
int uvWidth,
|
||||
int uvHeight,
|
||||
int resourceWidth,
|
||||
int resourceHeight
|
||||
) {
|
||||
GridCell cell = new GridImageCell(
|
||||
location,
|
||||
width,
|
||||
widthType,
|
||||
height,
|
||||
|
@ -247,7 +276,8 @@ public class GridRow extends GridContainer {
|
|||
uvWidth,
|
||||
uvHeight,
|
||||
resourceWidth,
|
||||
resourceHeight);
|
||||
resourceHeight
|
||||
);
|
||||
this.cells.add(cell);
|
||||
return cell;
|
||||
}
|
||||
|
@ -281,20 +311,24 @@ public class GridRow extends GridContainer {
|
|||
return addMessage(text, 1.0, GridLayout.GridValueType.PERCENTAGE, font, color, contentAlignment);
|
||||
}
|
||||
|
||||
public GridMessageCell addMessage(Component text,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
Font font,
|
||||
GridLayout.Alignment contentAlignment) {
|
||||
public GridMessageCell addMessage(
|
||||
Component text,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
Font font,
|
||||
GridLayout.Alignment contentAlignment
|
||||
) {
|
||||
return addMessage(text, width, widthType, font, GridLayout.COLOR_WHITE, contentAlignment);
|
||||
}
|
||||
|
||||
public GridMessageCell addMessage(Component text,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
Font font,
|
||||
int color,
|
||||
GridLayout.Alignment contentAlignment) {
|
||||
public GridMessageCell addMessage(
|
||||
Component text,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
Font font,
|
||||
int color,
|
||||
GridLayout.Alignment contentAlignment
|
||||
) {
|
||||
GridMessageCell cell = new GridMessageCell(width, widthType, contentAlignment, font, text, color);
|
||||
this.cells.add(cell);
|
||||
return cell;
|
||||
|
@ -307,46 +341,56 @@ public class GridRow extends GridContainer {
|
|||
|
||||
public GridStringCell addString(Component text, int color, GridScreen parent) {
|
||||
final int width = parent.getWidth(text);
|
||||
return this.addString(text,
|
||||
return this.addString(
|
||||
text,
|
||||
width,
|
||||
GridLayout.GridValueType.CONSTANT,
|
||||
color,
|
||||
GridLayout.Alignment.CENTER,
|
||||
parent);
|
||||
parent
|
||||
);
|
||||
}
|
||||
|
||||
public GridStringCell addString(Component text, GridLayout.Alignment contentAlignment, GridScreen parent) {
|
||||
return this.addString(text, GridLayout.COLOR_WHITE, contentAlignment, parent);
|
||||
}
|
||||
|
||||
public GridStringCell addString(Component text,
|
||||
int color,
|
||||
GridLayout.Alignment contentAlignment,
|
||||
GridScreen parent) {
|
||||
public GridStringCell addString(
|
||||
Component text,
|
||||
int color,
|
||||
GridLayout.Alignment contentAlignment,
|
||||
GridScreen parent
|
||||
) {
|
||||
return this.addString(text, 1.0, GridLayout.GridValueType.PERCENTAGE, color, contentAlignment, parent);
|
||||
}
|
||||
|
||||
public GridStringCell addString(Component text,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
GridLayout.Alignment contentAlignment,
|
||||
GridScreen parent) {
|
||||
public GridStringCell addString(
|
||||
Component text,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
GridLayout.Alignment contentAlignment,
|
||||
GridScreen parent
|
||||
) {
|
||||
return addString(text, width, widthType, GridLayout.COLOR_WHITE, contentAlignment, parent);
|
||||
}
|
||||
|
||||
public GridStringCell addString(Component text,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int color,
|
||||
GridLayout.Alignment contentAlignment,
|
||||
GridScreen parent) {
|
||||
GridStringCell cell = new GridStringCell(width,
|
||||
public GridStringCell addString(
|
||||
Component text,
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int color,
|
||||
GridLayout.Alignment contentAlignment,
|
||||
GridScreen parent
|
||||
) {
|
||||
GridStringCell cell = new GridStringCell(
|
||||
width,
|
||||
widthType,
|
||||
parent.getFont().lineHeight,
|
||||
contentAlignment,
|
||||
parent,
|
||||
text,
|
||||
color);
|
||||
color
|
||||
);
|
||||
this.cells.add(cell);
|
||||
return cell;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.betterx.bclib.client.gui.gridlayout;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.*;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
|
@ -12,9 +14,6 @@ import net.minecraft.util.Mth;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.*;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
|
@ -49,11 +48,13 @@ public abstract class GridScreen extends Screen {
|
|||
this(null, title, topPadding, sidePadding, centerVertically);
|
||||
}
|
||||
|
||||
public GridScreen(@Nullable Screen parent,
|
||||
Component title,
|
||||
int topPadding,
|
||||
int sidePadding,
|
||||
boolean centerVertically) {
|
||||
public GridScreen(
|
||||
@Nullable Screen parent,
|
||||
Component title,
|
||||
int topPadding,
|
||||
int sidePadding,
|
||||
boolean centerVertically
|
||||
) {
|
||||
super(title);
|
||||
|
||||
this.parent = parent;
|
||||
|
|
|
@ -10,33 +10,39 @@ import net.fabricmc.api.Environment;
|
|||
public class GridStringCell extends GridCell {
|
||||
private Component text;
|
||||
|
||||
GridStringCell(double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int height,
|
||||
GridLayout.Alignment contentAlignment,
|
||||
GridScreen parent,
|
||||
Component text) {
|
||||
GridStringCell(
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int height,
|
||||
GridLayout.Alignment contentAlignment,
|
||||
GridScreen parent,
|
||||
Component text
|
||||
) {
|
||||
this(width, widthType, height, contentAlignment, parent, text, GridLayout.COLOR_WHITE);
|
||||
|
||||
}
|
||||
|
||||
GridStringCell(double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int height,
|
||||
GridLayout.Alignment contentAlignment,
|
||||
GridScreen parent,
|
||||
Component text,
|
||||
int color) {
|
||||
GridStringCell(
|
||||
double width,
|
||||
GridLayout.GridValueType widthType,
|
||||
int height,
|
||||
GridLayout.Alignment contentAlignment,
|
||||
GridScreen parent,
|
||||
Component text,
|
||||
int color
|
||||
) {
|
||||
super(width, height, widthType, null, null);
|
||||
this.text = text;
|
||||
this.customRender = (poseStack, transform, context) -> {
|
||||
if (contentAlignment == GridLayout.Alignment.CENTER) {
|
||||
GuiComponent.drawCenteredString(poseStack,
|
||||
GuiComponent.drawCenteredString(
|
||||
poseStack,
|
||||
parent.getFont(),
|
||||
this.text,
|
||||
transform.width / 2 + transform.left,
|
||||
transform.top,
|
||||
color);
|
||||
color
|
||||
);
|
||||
} else if (contentAlignment == GridLayout.Alignment.LEFT) {
|
||||
GuiComponent.drawString(poseStack, parent.getFont(), this.text, transform.left, transform.top, color);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package org.betterx.bclib.client.gui.modmenu;
|
||||
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
import org.betterx.bclib.client.gui.gridlayout.*;
|
||||
import org.betterx.bclib.config.ConfigKeeper;
|
||||
import org.betterx.bclib.config.Configs;
|
||||
|
@ -11,6 +7,10 @@ import org.betterx.bclib.config.NamedPathConfig;
|
|||
import org.betterx.bclib.config.NamedPathConfig.ConfigTokenDescription;
|
||||
import org.betterx.bclib.config.NamedPathConfig.DependendConfigToken;
|
||||
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
@ -50,13 +50,15 @@ public class MainScreen extends GridScreen {
|
|||
if (option.leftPadding > 0) {
|
||||
row.addSpacer(option.leftPadding);
|
||||
}
|
||||
GridCheckboxCell cb = row.addCheckbox(getComponent(config, option, "title"),
|
||||
GridCheckboxCell cb = row.addCheckbox(
|
||||
getComponent(config, option, "title"),
|
||||
config.getRaw(option.token),
|
||||
font,
|
||||
(state) -> {
|
||||
config.set(option.token, state);
|
||||
updateEnabledState();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
if (option.token instanceof DependendConfigToken) {
|
||||
dependentWidgets.put(cb, () -> option.token.dependenciesTrue(config));
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
package org.betterx.bclib.client.gui.screens;
|
||||
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridRow;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridScreen;
|
||||
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
@ -7,11 +12,6 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridRow;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridScreen;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
@ -38,11 +38,13 @@ abstract class BCLibScreen extends GridScreen {
|
|||
super(title, topPadding, sidePadding, centerVertically);
|
||||
}
|
||||
|
||||
public BCLibScreen(@Nullable Screen parent,
|
||||
Component title,
|
||||
int topPadding,
|
||||
int sidePadding,
|
||||
boolean centerVertically) {
|
||||
public BCLibScreen(
|
||||
@Nullable Screen parent,
|
||||
Component title,
|
||||
int topPadding,
|
||||
int sidePadding,
|
||||
boolean centerVertically
|
||||
) {
|
||||
super(parent, title, topPadding, sidePadding, centerVertically);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package org.betterx.bclib.client.gui.screens;
|
||||
|
||||
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridCheckboxCell;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridRow;
|
||||
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
@ -8,10 +12,6 @@ import net.minecraft.network.chat.Component;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridCheckboxCell;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridRow;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
@ -34,18 +34,22 @@ public class ConfirmFixScreen extends BCLibScreen {
|
|||
grid.addSpacerRow();
|
||||
|
||||
GridRow row = grid.addRow();
|
||||
GridCheckboxCell backup = row.addCheckbox(Component.translatable("bclib.datafixer.backupWarning.backup"),
|
||||
GridCheckboxCell backup = row.addCheckbox(
|
||||
Component.translatable("bclib.datafixer.backupWarning.backup"),
|
||||
true,
|
||||
BUTTON_HEIGHT,
|
||||
this.font);
|
||||
this.font
|
||||
);
|
||||
|
||||
grid.addSpacerRow(10);
|
||||
|
||||
row = grid.addRow();
|
||||
GridCheckboxCell fix = row.addCheckbox(Component.translatable("bclib.datafixer.backupWarning.fix"),
|
||||
GridCheckboxCell fix = row.addCheckbox(
|
||||
Component.translatable("bclib.datafixer.backupWarning.fix"),
|
||||
true,
|
||||
BUTTON_HEIGHT,
|
||||
this.font);
|
||||
this.font
|
||||
);
|
||||
|
||||
grid.addSpacerRow(20);
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package org.betterx.bclib.client.gui.screens;
|
||||
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridRow;
|
||||
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridRow;
|
||||
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class ConfirmRestartScreen extends BCLibScreen {
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package org.betterx.bclib.client.gui.screens;
|
||||
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridColumn;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridRow;
|
||||
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
@ -7,10 +11,6 @@ import net.minecraft.network.chat.Component;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridColumn;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridRow;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class LevelFixErrorScreen extends BCLibScreen {
|
||||
private final String[] errors;
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
package org.betterx.bclib.client.gui.screens;
|
||||
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.loader.api.metadata.ModEnvironment;
|
||||
|
||||
import org.betterx.bclib.api.v2.dataexchange.handler.autosync.HelloClient;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridColumn;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout;
|
||||
|
@ -17,6 +9,14 @@ import org.betterx.bclib.util.ModUtil;
|
|||
import org.betterx.bclib.util.PathUtil;
|
||||
import org.betterx.bclib.util.Triple;
|
||||
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.loader.api.metadata.ModEnvironment;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -34,37 +34,45 @@ public class ModListScreen extends BCLibScreen {
|
|||
return list;
|
||||
}
|
||||
|
||||
public ModListScreen(Screen parent,
|
||||
Component title,
|
||||
Component description,
|
||||
Map<String, ModUtil.ModInfo> mods,
|
||||
HelloClient.IServerModMap serverInfo) {
|
||||
public ModListScreen(
|
||||
Screen parent,
|
||||
Component title,
|
||||
Component description,
|
||||
Map<String, ModUtil.ModInfo> mods,
|
||||
HelloClient.IServerModMap serverInfo
|
||||
) {
|
||||
this(parent, title, description, CommonComponents.GUI_BACK, mods, serverInfo);
|
||||
}
|
||||
|
||||
public ModListScreen(Screen parent,
|
||||
Component title,
|
||||
Component description,
|
||||
List<ModUtil.ModInfo> mods,
|
||||
HelloClient.IServerModMap serverInfo) {
|
||||
public ModListScreen(
|
||||
Screen parent,
|
||||
Component title,
|
||||
Component description,
|
||||
List<ModUtil.ModInfo> mods,
|
||||
HelloClient.IServerModMap serverInfo
|
||||
) {
|
||||
this(parent, title, description, CommonComponents.GUI_BACK, mods, serverInfo);
|
||||
}
|
||||
|
||||
public ModListScreen(Screen parent,
|
||||
Component title,
|
||||
Component description,
|
||||
Component button,
|
||||
Map<String, ModUtil.ModInfo> mods,
|
||||
HelloClient.IServerModMap serverInfo) {
|
||||
public ModListScreen(
|
||||
Screen parent,
|
||||
Component title,
|
||||
Component description,
|
||||
Component button,
|
||||
Map<String, ModUtil.ModInfo> mods,
|
||||
HelloClient.IServerModMap serverInfo
|
||||
) {
|
||||
this(parent, title, description, button, extractModList(mods), serverInfo);
|
||||
}
|
||||
|
||||
public ModListScreen(Screen parent,
|
||||
Component title,
|
||||
Component description,
|
||||
Component button,
|
||||
List<ModUtil.ModInfo> mods,
|
||||
HelloClient.IServerModMap serverInfo) {
|
||||
public ModListScreen(
|
||||
Screen parent,
|
||||
Component title,
|
||||
Component description,
|
||||
Component button,
|
||||
List<ModUtil.ModInfo> mods,
|
||||
HelloClient.IServerModMap serverInfo
|
||||
) {
|
||||
super(parent, title, 10, true);
|
||||
this.mods = mods;
|
||||
this.serverInfo = serverInfo;
|
||||
|
@ -96,10 +104,12 @@ public class ModListScreen extends BCLibScreen {
|
|||
}
|
||||
|
||||
|
||||
public static void addModDesc(GridColumn grid,
|
||||
java.util.List<ModUtil.ModInfo> mods,
|
||||
HelloClient.IServerModMap serverInfo,
|
||||
GridScreen parent) {
|
||||
public static void addModDesc(
|
||||
GridColumn grid,
|
||||
java.util.List<ModUtil.ModInfo> mods,
|
||||
HelloClient.IServerModMap serverInfo,
|
||||
GridScreen parent
|
||||
) {
|
||||
final int STATE_OK = 6;
|
||||
final int STATE_SERVER_MISSING_CLIENT_MOD = 5;
|
||||
final int STATE_MISSING_NOT_OFFERED = 4;
|
||||
|
@ -128,9 +138,11 @@ public class ModListScreen extends BCLibScreen {
|
|||
stateString += ", offered by server";
|
||||
}
|
||||
|
||||
items.add(new Triple<>(modid,
|
||||
items.add(new Triple<>(
|
||||
modid,
|
||||
nfo.canDownload() ? STATE_MISSING : STATE_MISSING_NOT_OFFERED,
|
||||
stateString));
|
||||
stateString
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
package org.betterx.bclib.client.gui.screens;
|
||||
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.client.gui.gridlayout.*;
|
||||
|
||||
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;
|
||||
|
@ -7,12 +13,6 @@ import net.minecraft.network.chat.Component;
|
|||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.ProgressListener;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.client.gui.gridlayout.*;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -78,7 +78,8 @@ class ProgressLogoRender extends GridCustomRenderCell {
|
|||
}
|
||||
|
||||
if (percentage > 0 && percentage < 1.0) {
|
||||
GuiComponent.fill(poseStack,
|
||||
GuiComponent.fill(
|
||||
poseStack,
|
||||
transform.left,
|
||||
yBar,
|
||||
transform.left + transform.width,
|
||||
|
@ -91,8 +92,10 @@ class ProgressLogoRender extends GridCustomRenderCell {
|
|||
|
||||
public class ProgressScreen extends GridScreen implements ProgressListener, AtomicProgressListener {
|
||||
|
||||
static final ResourceLocation BCLIB_LOGO_PIXELATED_LOCATION = new ResourceLocation(BCLib.MOD_ID,
|
||||
"iconpixelated.png");
|
||||
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, true);
|
||||
|
@ -155,9 +158,11 @@ public class ProgressScreen extends GridScreen implements ProgressListener, Atom
|
|||
|
||||
grid.addSpacerRow(20);
|
||||
row = grid.addRow();
|
||||
stage = row.addMessage(stageComponent != null ? stageComponent : Component.literal(""),
|
||||
stage = row.addMessage(
|
||||
stageComponent != null ? stageComponent : Component.literal(""),
|
||||
font,
|
||||
GridLayout.Alignment.CENTER);
|
||||
GridLayout.Alignment.CENTER
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
package org.betterx.bclib.client.gui.screens;
|
||||
|
||||
import org.betterx.bclib.api.v2.dataexchange.handler.autosync.HelloClient;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridCheckboxCell;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridRow;
|
||||
import org.betterx.bclib.util.ModUtil;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
@ -7,12 +13,6 @@ import net.minecraft.network.chat.Component;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import org.betterx.bclib.api.v2.dataexchange.handler.autosync.HelloClient;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridCheckboxCell;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridRow;
|
||||
import org.betterx.bclib.util.ModUtil;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class SyncFilesScreen extends BCLibScreen {
|
||||
private final Component description;
|
||||
|
@ -23,13 +23,15 @@ public class SyncFilesScreen extends BCLibScreen {
|
|||
private final boolean shouldDelete;
|
||||
private final HelloClient.IServerModMap serverInfo;
|
||||
|
||||
public SyncFilesScreen(int modFiles,
|
||||
int configFiles,
|
||||
int singleFiles,
|
||||
int folderFiles,
|
||||
int deleteFiles,
|
||||
HelloClient.IServerModMap serverInfo,
|
||||
Listener listener) {
|
||||
public SyncFilesScreen(
|
||||
int modFiles,
|
||||
int configFiles,
|
||||
int singleFiles,
|
||||
int folderFiles,
|
||||
int deleteFiles,
|
||||
HelloClient.IServerModMap serverInfo,
|
||||
Listener listener
|
||||
) {
|
||||
super(Component.translatable("title.bclib.syncfiles"));
|
||||
|
||||
this.serverInfo = serverInfo;
|
||||
|
@ -55,10 +57,12 @@ public class SyncFilesScreen extends BCLibScreen {
|
|||
|
||||
final GridCheckboxCell mods;
|
||||
row = grid.addRow();
|
||||
mods = row.addCheckbox(Component.translatable("message.bclib.syncfiles.mods"),
|
||||
mods = row.addCheckbox(
|
||||
Component.translatable("message.bclib.syncfiles.mods"),
|
||||
hasMods,
|
||||
BUTTON_HEIGHT,
|
||||
this.font);
|
||||
this.font
|
||||
);
|
||||
mods.setEnabled(hasMods);
|
||||
|
||||
row.addSpacer();
|
||||
|
@ -78,10 +82,12 @@ public class SyncFilesScreen extends BCLibScreen {
|
|||
|
||||
final GridCheckboxCell configs;
|
||||
row = grid.addRow();
|
||||
configs = row.addCheckbox(Component.translatable("message.bclib.syncfiles.configs"),
|
||||
configs = row.addCheckbox(
|
||||
Component.translatable("message.bclib.syncfiles.configs"),
|
||||
hasConfigFiles,
|
||||
BUTTON_HEIGHT,
|
||||
this.font);
|
||||
this.font
|
||||
);
|
||||
configs.setEnabled(hasConfigFiles);
|
||||
|
||||
grid.addSpacerRow();
|
||||
|
@ -89,18 +95,22 @@ public class SyncFilesScreen extends BCLibScreen {
|
|||
row = grid.addRow();
|
||||
|
||||
final GridCheckboxCell folder;
|
||||
folder = row.addCheckbox(Component.translatable("message.bclib.syncfiles.folders"),
|
||||
folder = row.addCheckbox(
|
||||
Component.translatable("message.bclib.syncfiles.folders"),
|
||||
hasFiles,
|
||||
BUTTON_HEIGHT,
|
||||
this.font);
|
||||
this.font
|
||||
);
|
||||
folder.setEnabled(hasFiles);
|
||||
row.addSpacer();
|
||||
|
||||
GridCheckboxCell delete;
|
||||
delete = row.addCheckbox(Component.translatable("message.bclib.syncfiles.delete"),
|
||||
delete = row.addCheckbox(
|
||||
Component.translatable("message.bclib.syncfiles.delete"),
|
||||
shouldDelete,
|
||||
BUTTON_HEIGHT,
|
||||
this.font);
|
||||
this.font
|
||||
);
|
||||
delete.setEnabled(shouldDelete);
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package org.betterx.bclib.client.gui.screens;
|
||||
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridRow;
|
||||
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridRow;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class WarnBCLibVersionMismatch extends BCLibScreen {
|
||||
private final Component description;
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
package org.betterx.bclib.client.gui.screens;
|
||||
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.api.v2.generator.BCLBiomeSource;
|
||||
import org.betterx.bclib.api.v2.levelgen.LevelGenUtil;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridCheckboxCell;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout;
|
||||
|
||||
import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen;
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldCreationContext;
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
|
@ -12,12 +18,6 @@ import net.minecraft.world.level.dimension.LevelStem;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.api.v2.generator.BCLBiomeSource;
|
||||
import org.betterx.bclib.api.v2.levelgen.LevelGenUtil;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridCheckboxCell;
|
||||
import org.betterx.bclib.client.gui.gridlayout.GridLayout;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
@ -70,20 +70,24 @@ public class WorldSetupScreen extends BCLibScreen {
|
|||
colNether.addSpacerRow(2);
|
||||
row = colNether.addRow();
|
||||
row.addSpacer(20);
|
||||
netherLegacy = row.addCheckbox(Component.translatable("title.screen.bclib.worldgen.legacy_square"),
|
||||
netherLegacy = row.addCheckbox(
|
||||
Component.translatable("title.screen.bclib.worldgen.legacy_square"),
|
||||
endVersion == BCLBiomeSource.BIOME_SOURCE_VERSION_SQUARE,
|
||||
1.0,
|
||||
GridLayout.GridValueType.PERCENTAGE,
|
||||
(state) -> {
|
||||
});
|
||||
bclibNether = mainSettingsRow.addCheckbox(Component.translatable(
|
||||
}
|
||||
);
|
||||
bclibNether = mainSettingsRow.addCheckbox(
|
||||
Component.translatable(
|
||||
"title.screen.bclib.worldgen.custom_biome_source"),
|
||||
netherVersion != BCLBiomeSource.BIOME_SOURCE_VERSION_VANILLA,
|
||||
1.0,
|
||||
GridLayout.GridValueType.PERCENTAGE,
|
||||
(state) -> {
|
||||
netherLegacy.setEnabled(state);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
row = colEnd.addRow(GridLayout.VerticalAlignment.CENTER);
|
||||
|
@ -96,21 +100,25 @@ public class WorldSetupScreen extends BCLibScreen {
|
|||
row = colEnd.addRow();
|
||||
row.addSpacer(20);
|
||||
|
||||
endLegacy = row.addCheckbox(Component.translatable("title.screen.bclib.worldgen.legacy_square"),
|
||||
endLegacy = row.addCheckbox(
|
||||
Component.translatable("title.screen.bclib.worldgen.legacy_square"),
|
||||
endVersion == BCLBiomeSource.BIOME_SOURCE_VERSION_SQUARE,
|
||||
1.0,
|
||||
GridLayout.GridValueType.PERCENTAGE,
|
||||
(state) -> {
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
bclibEnd = mainSettingsRow.addCheckbox(Component.translatable(
|
||||
bclibEnd = mainSettingsRow.addCheckbox(
|
||||
Component.translatable(
|
||||
"title.screen.bclib.worldgen.custom_biome_source"),
|
||||
endVersion != BCLBiomeSource.BIOME_SOURCE_VERSION_VANILLA,
|
||||
1.0,
|
||||
GridLayout.GridValueType.PERCENTAGE,
|
||||
(state) -> {
|
||||
endLegacy.setEnabled(state);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
grid.addSpacerRow(36);
|
||||
row = grid.addRow();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue