Skip to content

Commit

Permalink
remove custom screen
Browse files Browse the repository at this point in the history
update fusion reactor
  • Loading branch information
ghzdude committed Jan 29, 2025
1 parent 5b8bac4 commit 7a332ba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,44 +281,34 @@ protected Flow createBars(@NotNull ModularPanel mainPanel,
return column;
}

public MultiblockUIFactory customScreen(Supplier<IWidget> customScreen) {
this.customScreen = customScreen;
return this;
}

public MultiblockUIFactory addScreenChildren(Consumer<List<IWidget>> consumer) {
this.childrenConsumer = consumer;
return this;
}

protected Widget<?> createScreen(PanelSyncManager syncManager) {
ParentWidget<?> root = new ParentWidget<>();
if (customScreen != null && customScreen.get() != null) {
root.child(customScreen.get());
} else {
Builder display = builder();
display.setAction(this.displayText);
display.sync("display", syncManager);

var scrollWidget = new ScrollWidget<>(new VerticalScrollData())
.sizeRel(1f)
.child(new RichTextWidget()
.sizeRel(1f)
.alignment(Alignment.TopLeft)
.margin(4, 4)
.autoUpdate(true)
.textBuilder(display::build));

if (this.childrenConsumer != null) {
List<IWidget> extra = new ArrayList<>();
this.childrenConsumer.accept(extra);
extra.forEach(scrollWidget::child);
}

root.child(scrollWidget);
}

return root.child(createIndicator(syncManager))
Builder display = builder();
display.setAction(this.displayText);
display.sync("display", syncManager);

var scrollWidget = new ScrollWidget<>(new VerticalScrollData())
.sizeRel(1f)
.child(new RichTextWidget()
.sizeRel(1f)
.alignment(Alignment.TopLeft)
.margin(4, 4)
.autoUpdate(true)
.textBuilder(display::build));

if (this.childrenConsumer != null) {
List<IWidget> extra = new ArrayList<>();
this.childrenConsumer.accept(extra);
extra.forEach(scrollWidget::child);
}

return new ParentWidget<>()
.child(scrollWidget)
.child(createIndicator(syncManager))
.background(GTGuiTextures.DISPLAY)
.size(190, screenHeight)
.pos(4, 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,14 +454,15 @@ protected MultiblockUIFactory createUIFactory() {
.setSize(198, 236)
.setScreenHeight(138)
.configureDisplayText(false, builder -> {})
.customScreen(() -> new Column()
.addScreenChildren(widgets -> widgets.add(new Column()
.padding(4)
.expanded()
.child(title.asWidget()
.marginBottom(8)
.size(69, 12))
.child(new ProgressWidget()
.size(77, 77)
// todo status tooltip
.background(GTGuiTextures.FUSION_DIAGRAM.asIcon()
.size(89, 101)
.marginTop(11))
Expand All @@ -471,7 +472,7 @@ protected MultiblockUIFactory createUIFactory() {
.child(GTGuiTextures.FUSION_LEGEND.asWidget()
.left(4)
.bottom(4)
.size(108, 41)));
.size(108, 41))));
}

private void addEnergyBarHoverText(List<ITextComponent> hoverList) {
Expand Down

0 comments on commit 7a332ba

Please sign in to comment.