Another UI reshuffle

- 'Backstepping' is now a button
- Added little labels for hovered buttons at the bottom
- Moved ponder/transition-specific logic out of the generic screen class
This commit is contained in:
simibubi 2021-03-16 03:24:34 +01:00
parent 9a545a09a4
commit 27eaf55b45
24 changed files with 419 additions and 226 deletions

View file

@ -402,19 +402,19 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
2b12f3cf99e498899207a8c4855210e7b5dc55cd assets/create/lang/en_ud.json
212de32a4245c53011c14d5a449cc9845ba8a897 assets/create/lang/en_us.json
68692dcac5364521de8437c653b64791e962628a assets/create/lang/unfinished/de_de.json
ea0fb50d4198972c4c7865d2471cdbc75977cc70 assets/create/lang/unfinished/es_es.json
5a54f2e9ad6264bdbb41fe6390b6674904219bfe assets/create/lang/unfinished/es_mx.json
a1a8a74c61650c1bb59a4187864d952f534100c7 assets/create/lang/unfinished/fr_fr.json
07992e28b58ec1bc837a80ab633dca672ad236e4 assets/create/lang/unfinished/it_it.json
8b84abd9b61ab88fdbbf9c0cc1979e95b34b3580 assets/create/lang/unfinished/ja_jp.json
fcd3bde020b3e904d5a31032c01e2e5b9c05a702 assets/create/lang/unfinished/ko_kr.json
2e4780fe25cef72f9bb3b43be76a379e3dde9f00 assets/create/lang/unfinished/nl_nl.json
edd45f6e468d4976d2bcd714066ae3284fc27ddb assets/create/lang/unfinished/pt_br.json
8c27872585a9a180ede3ccdd1d07014863501b89 assets/create/lang/unfinished/ru_ru.json
dead3a1a62323e91d41a8e8864b7179fd2f30583 assets/create/lang/unfinished/zh_cn.json
41faa5ab5d3f812e46d8d0e1580e83cd9f2f4bb3 assets/create/lang/unfinished/zh_tw.json
f7bdf2fb1af4cae8bca1735861d603cce0870985 assets/create/lang/en_us.json
f83d2acecd5ce6ebe8dfddffde3c5c3a68abd492 assets/create/lang/unfinished/de_de.json
35e50f9ba61af0ef900154213b0b25d1dc5469d3 assets/create/lang/unfinished/es_es.json
98c26496201d8f12be5f6fc0ddaf919d9098f825 assets/create/lang/unfinished/es_mx.json
161ac9821b2445c96c6d594885c2d32cd784e8c5 assets/create/lang/unfinished/fr_fr.json
0c1baeb251ff32329a8d34a7200101de2cb724c4 assets/create/lang/unfinished/it_it.json
b0ccadbcc765e7ddee1089b3ca65414f5aa1ad95 assets/create/lang/unfinished/ja_jp.json
9551b6b6df919ff7e2b7e14361e8061b65cd4857 assets/create/lang/unfinished/ko_kr.json
552b3ef71a2898d7e263035ade5b47fb0bcfec23 assets/create/lang/unfinished/nl_nl.json
1661f76a0ba088209fcd837a8a1676dbed186368 assets/create/lang/unfinished/pt_br.json
621af99986c9e334d224f9a356c25d7468a1ef47 assets/create/lang/unfinished/ru_ru.json
6340ad62aedc1fec27abb6b490c36b1fd1317214 assets/create/lang/unfinished/zh_cn.json
56a1fedad3d453a36c456085c836fcfbf9740b1d assets/create/lang/unfinished/zh_tw.json
846200eb548d3bfa2e77b41039de159b4b6cfb45 assets/create/models/block/acacia_window.json
1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets/create/models/block/acacia_window_pane_noside.json
1763ea2c9b981d187f5031ba608f3d5d3be3986a assets/create/models/block/acacia_window_pane_noside_alt.json

View file

@ -1816,6 +1816,12 @@
"create.ponder.pondering": "Pondering about...",
"create.ponder.identify_mode": "Identify mode active.\nUnpause with [%1$s]",
"create.ponder.associated": "Associated Entries",
"create.ponder.close": "Close",
"create.ponder.identify": "Identify",
"create.ponder.next": "Next Scene",
"create.ponder.previous": "Previous Scene",
"create.ponder.replay": "Replay",
"create.ponder.think_back": "Think Back",
"create.ponder.shared.movement_anchors": "With the help of Chassis or Super Glue, larger structures can be moved.",
"create.ponder.shared.rpm32": "32 RPM",
"create.ponder.shared.sneak_and": "Sneak +",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1296",
"_": "Missing Localizations: 1302",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1817,6 +1817,12 @@
"create.ponder.pondering": "UNLOCALIZED: Pondering about...",
"create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]",
"create.ponder.associated": "UNLOCALIZED: Associated Entries",
"create.ponder.close": "UNLOCALIZED: Close",
"create.ponder.identify": "UNLOCALIZED: Identify",
"create.ponder.next": "UNLOCALIZED: Next Scene",
"create.ponder.previous": "UNLOCALIZED: Previous Scene",
"create.ponder.replay": "UNLOCALIZED: Replay",
"create.ponder.think_back": "UNLOCALIZED: Think Back",
"create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.",
"create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM",
"create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 327",
"_": "Missing Localizations: 333",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1817,6 +1817,12 @@
"create.ponder.pondering": "UNLOCALIZED: Pondering about...",
"create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]",
"create.ponder.associated": "UNLOCALIZED: Associated Entries",
"create.ponder.close": "UNLOCALIZED: Close",
"create.ponder.identify": "UNLOCALIZED: Identify",
"create.ponder.next": "UNLOCALIZED: Next Scene",
"create.ponder.previous": "UNLOCALIZED: Previous Scene",
"create.ponder.replay": "UNLOCALIZED: Replay",
"create.ponder.think_back": "UNLOCALIZED: Think Back",
"create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.",
"create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM",
"create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1226",
"_": "Missing Localizations: 1232",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1817,6 +1817,12 @@
"create.ponder.pondering": "UNLOCALIZED: Pondering about...",
"create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]",
"create.ponder.associated": "UNLOCALIZED: Associated Entries",
"create.ponder.close": "UNLOCALIZED: Close",
"create.ponder.identify": "UNLOCALIZED: Identify",
"create.ponder.next": "UNLOCALIZED: Next Scene",
"create.ponder.previous": "UNLOCALIZED: Previous Scene",
"create.ponder.replay": "UNLOCALIZED: Replay",
"create.ponder.think_back": "UNLOCALIZED: Think Back",
"create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.",
"create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM",
"create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1008",
"_": "Missing Localizations: 1014",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1817,6 +1817,12 @@
"create.ponder.pondering": "UNLOCALIZED: Pondering about...",
"create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]",
"create.ponder.associated": "UNLOCALIZED: Associated Entries",
"create.ponder.close": "UNLOCALIZED: Close",
"create.ponder.identify": "UNLOCALIZED: Identify",
"create.ponder.next": "UNLOCALIZED: Next Scene",
"create.ponder.previous": "UNLOCALIZED: Previous Scene",
"create.ponder.replay": "UNLOCALIZED: Replay",
"create.ponder.think_back": "UNLOCALIZED: Think Back",
"create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.",
"create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM",
"create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 344",
"_": "Missing Localizations: 350",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1817,6 +1817,12 @@
"create.ponder.pondering": "UNLOCALIZED: Pondering about...",
"create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]",
"create.ponder.associated": "UNLOCALIZED: Associated Entries",
"create.ponder.close": "UNLOCALIZED: Close",
"create.ponder.identify": "UNLOCALIZED: Identify",
"create.ponder.next": "UNLOCALIZED: Next Scene",
"create.ponder.previous": "UNLOCALIZED: Previous Scene",
"create.ponder.replay": "UNLOCALIZED: Replay",
"create.ponder.think_back": "UNLOCALIZED: Think Back",
"create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.",
"create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM",
"create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 351",
"_": "Missing Localizations: 357",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1817,6 +1817,12 @@
"create.ponder.pondering": "UNLOCALIZED: Pondering about...",
"create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]",
"create.ponder.associated": "UNLOCALIZED: Associated Entries",
"create.ponder.close": "UNLOCALIZED: Close",
"create.ponder.identify": "UNLOCALIZED: Identify",
"create.ponder.next": "UNLOCALIZED: Next Scene",
"create.ponder.previous": "UNLOCALIZED: Previous Scene",
"create.ponder.replay": "UNLOCALIZED: Replay",
"create.ponder.think_back": "UNLOCALIZED: Think Back",
"create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.",
"create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM",
"create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 397",
"_": "Missing Localizations: 403",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1817,6 +1817,12 @@
"create.ponder.pondering": "UNLOCALIZED: Pondering about...",
"create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]",
"create.ponder.associated": "UNLOCALIZED: Associated Entries",
"create.ponder.close": "UNLOCALIZED: Close",
"create.ponder.identify": "UNLOCALIZED: Identify",
"create.ponder.next": "UNLOCALIZED: Next Scene",
"create.ponder.previous": "UNLOCALIZED: Previous Scene",
"create.ponder.replay": "UNLOCALIZED: Replay",
"create.ponder.think_back": "UNLOCALIZED: Think Back",
"create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.",
"create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM",
"create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1495",
"_": "Missing Localizations: 1501",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1817,6 +1817,12 @@
"create.ponder.pondering": "UNLOCALIZED: Pondering about...",
"create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]",
"create.ponder.associated": "UNLOCALIZED: Associated Entries",
"create.ponder.close": "UNLOCALIZED: Close",
"create.ponder.identify": "UNLOCALIZED: Identify",
"create.ponder.next": "UNLOCALIZED: Next Scene",
"create.ponder.previous": "UNLOCALIZED: Previous Scene",
"create.ponder.replay": "UNLOCALIZED: Replay",
"create.ponder.think_back": "UNLOCALIZED: Think Back",
"create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.",
"create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM",
"create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1561",
"_": "Missing Localizations: 1567",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1817,6 +1817,12 @@
"create.ponder.pondering": "UNLOCALIZED: Pondering about...",
"create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]",
"create.ponder.associated": "UNLOCALIZED: Associated Entries",
"create.ponder.close": "UNLOCALIZED: Close",
"create.ponder.identify": "UNLOCALIZED: Identify",
"create.ponder.next": "UNLOCALIZED: Next Scene",
"create.ponder.previous": "UNLOCALIZED: Previous Scene",
"create.ponder.replay": "UNLOCALIZED: Replay",
"create.ponder.think_back": "UNLOCALIZED: Think Back",
"create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.",
"create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM",
"create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 347",
"_": "Missing Localizations: 353",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1817,6 +1817,12 @@
"create.ponder.pondering": "UNLOCALIZED: Pondering about...",
"create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]",
"create.ponder.associated": "UNLOCALIZED: Associated Entries",
"create.ponder.close": "UNLOCALIZED: Close",
"create.ponder.identify": "UNLOCALIZED: Identify",
"create.ponder.next": "UNLOCALIZED: Next Scene",
"create.ponder.previous": "UNLOCALIZED: Previous Scene",
"create.ponder.replay": "UNLOCALIZED: Replay",
"create.ponder.think_back": "UNLOCALIZED: Think Back",
"create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.",
"create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM",
"create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 345",
"_": "Missing Localizations: 351",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1817,6 +1817,12 @@
"create.ponder.pondering": "UNLOCALIZED: Pondering about...",
"create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]",
"create.ponder.associated": "UNLOCALIZED: Associated Entries",
"create.ponder.close": "UNLOCALIZED: Close",
"create.ponder.identify": "UNLOCALIZED: Identify",
"create.ponder.next": "UNLOCALIZED: Next Scene",
"create.ponder.previous": "UNLOCALIZED: Previous Scene",
"create.ponder.replay": "UNLOCALIZED: Replay",
"create.ponder.think_back": "UNLOCALIZED: Think Back",
"create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.",
"create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM",
"create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 350",
"_": "Missing Localizations: 356",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1817,6 +1817,12 @@
"create.ponder.pondering": "UNLOCALIZED: Pondering about...",
"create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]",
"create.ponder.associated": "UNLOCALIZED: Associated Entries",
"create.ponder.close": "UNLOCALIZED: Close",
"create.ponder.identify": "UNLOCALIZED: Identify",
"create.ponder.next": "UNLOCALIZED: Next Scene",
"create.ponder.previous": "UNLOCALIZED: Previous Scene",
"create.ponder.replay": "UNLOCALIZED: Replay",
"create.ponder.think_back": "UNLOCALIZED: Think Back",
"create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.",
"create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM",
"create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +",

View file

@ -2,18 +2,10 @@ package com.simibubi.create.foundation.gui;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.commons.lang3.mutable.MutableBoolean;
import org.apache.commons.lang3.mutable.MutableInt;
import org.lwjgl.glfw.GLFW;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.Widget;
@ -26,19 +18,11 @@ public abstract class AbstractSimiScreen extends Screen {
protected int sWidth, sHeight;
protected int guiLeft, guiTop;
protected int depthPointX, depthPointY;
protected List<Widget> widgets;
public final LerpedFloat transition = LerpedFloat.linear()
.startWithValue(0)
.chase(0, .1f, LerpedFloat.Chaser.LINEAR);
protected AbstractSimiScreen() {
super(new StringTextComponent(""));
widgets = new ArrayList<>();
MainWindow window = Minecraft.getInstance()
.getWindow();
depthPointX = window.getScaledWidth() / 2;
depthPointY = window.getScaledHeight() / 2;
}
protected void setWindowSize(int width, int height) {
@ -48,12 +32,6 @@ public abstract class AbstractSimiScreen extends Screen {
guiTop = (this.height - sHeight) / 2;
}
@Override
public void tick() {
super.tick();
transition.tickChaser();
}
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
partialTicks = partialTicks == 10 ? 0
@ -62,72 +40,19 @@ public abstract class AbstractSimiScreen extends Screen {
RenderSystem.pushMatrix();
renderTransition(mouseX, mouseY, partialTicks);
renderWindowBackground(mouseX, mouseY, partialTicks);
renderWindow(mouseX, mouseY, partialTicks);
for (Widget widget : widgets)
widget.render(mouseX, mouseY, partialTicks);
renderWindowForeground(mouseX, mouseY, partialTicks);
for (Widget widget : widgets)
widget.renderToolTip(mouseX, mouseY);
RenderSystem.popMatrix();
renderBreadcrumbs(mouseX, mouseY, partialTicks);
}
private void renderTransition(int mouseX, int mouseY, float partialTicks) {
if (transition.getChaseTarget() == 0) {
protected void renderWindowBackground(int mouseX, int mouseY, float partialTicks) {
renderBackground();
return;
}
renderBackground();
Screen lastScreen = ScreenOpener.getPreviouslyRenderedScreen();
float transitionValue = transition.getValue(partialTicks);
double scale = 1 + 0.5 * transitionValue;
// draw last screen into buffer
if (lastScreen != null && lastScreen != this) {
RenderSystem.pushMatrix();// 1
UIRenderHelper.framebuffer.framebufferClear(Minecraft.IS_RUNNING_ON_MAC);
UIRenderHelper.prepFramebufferSize();
RenderSystem.pushMatrix();// 2
RenderSystem.translated(0, 0, -1000);
UIRenderHelper.framebuffer.bindFramebuffer(true);
lastScreen.render(mouseX, mouseY, 10);
RenderSystem.popMatrix();// 2
// use the buffer texture
Minecraft.getInstance()
.getFramebuffer()
.bindFramebuffer(true);
MainWindow window = Minecraft.getInstance()
.getWindow();
int dpx = window.getScaledWidth() / 2;
int dpy = window.getScaledHeight() / 2;
if (lastScreen instanceof AbstractSimiScreen) {
dpx = ((AbstractSimiScreen) lastScreen).depthPointX;
dpy = ((AbstractSimiScreen) lastScreen).depthPointY;
}
// transitionV is 1/-1 when the older screen is hidden
// transitionV is 0 when the older screen is still fully visible
RenderSystem.translated(dpx, dpy, 0);
RenderSystem.scaled(scale, scale, 1);
RenderSystem.translated(-dpx, -dpy, 0);
UIRenderHelper.drawFramebuffer(1f - Math.abs(transitionValue));
RenderSystem.popMatrix();// 1
}
// modify current screen as well
scale = transitionValue > 0 ? 1 - 0.5 * (1 - transitionValue) : 1 + .5 * (1 + transitionValue);
RenderSystem.translated(depthPointX, depthPointY, 0);
RenderSystem.scaled(scale, scale, 1);
RenderSystem.translated(-depthPointX, -depthPointY, 0);
}
@Override
@ -144,12 +69,6 @@ public abstract class AbstractSimiScreen extends Screen {
for (Widget widget : widgets)
if (widget.keyPressed(code, p_keyPressed_2_, p_keyPressed_3_))
return true;
if (code == GLFW.GLFW_KEY_BACKSPACE) {
ScreenOpener.openPreviousScreen(this, Optional.empty());
return true;
}
return super.keyPressed(code, p_keyPressed_2_, p_keyPressed_3_);
}
@ -188,12 +107,6 @@ public abstract class AbstractSimiScreen extends Screen {
return true;
}
@Override
public void onClose() {
ScreenOpener.clearStack();
super.onClose();
}
@Override
public boolean isPauseScreen() {
return false;
@ -201,56 +114,6 @@ public abstract class AbstractSimiScreen extends Screen {
protected abstract void renderWindow(int mouseX, int mouseY, float partialTicks);
protected void renderBreadcrumbs(int mouseX, int mouseY, float partialTicks) {
List<Screen> history = ScreenOpener.getScreenHistory();
if (history.isEmpty())
return;
history.add(0, Minecraft.getInstance().currentScreen);
int spacing = 20;
List<String> names = history.stream()
.map(AbstractSimiScreen::screenTitle)
.collect(Collectors.toList());
int bWidth = names.stream()
.mapToInt(s -> font.getStringWidth(s) + spacing)
.sum();
MutableInt x = new MutableInt(width - bWidth);
MutableInt y = new MutableInt(height - 18);
MutableBoolean first = new MutableBoolean(true);
if (x.getValue() < 25)
x.setValue(25);
RenderSystem.pushMatrix();
RenderSystem.translated(0, 0, 600);
names.forEach(s -> {
int sWidth = font.getStringWidth(s);
// UIRenderHelper.breadcrumbArrow(x.getValue(), y.getValue(), sWidth + spacing,
// 14, spacing/2, 0xbbababab, 0x22ababab);
UIRenderHelper.breadcrumbArrow(x.getValue(), y.getValue(), sWidth + spacing, 14, spacing / 2, 0xdd101010,
0x44101010);
drawString(font, s, x.getValue() + 5, y.getValue() + 3, first.getValue() ? 0xffeeffee : 0xffddeeff);
first.setFalse();
x.add(sWidth + spacing);
});
RenderSystem.popMatrix();
}
private static String screenTitle(Screen screen) {
if (screen instanceof AbstractSimiScreen)
return ((AbstractSimiScreen) screen).getBreadcrumbTitle();
return "<";
}
protected String getBreadcrumbTitle() {
return this.getClass()
.getSimpleName();
}
protected void renderWindowForeground(int mouseX, int mouseY, float partialTicks) {
for (Widget widget : widgets) {
if (!widget.isHovered())
@ -263,22 +126,4 @@ public abstract class AbstractSimiScreen extends Screen {
}
}
public void centerScalingOn(int x, int y) {
depthPointX = x;
depthPointY = y;
}
public void centerScalingOnMouse() {
MainWindow w = minecraft.getWindow();
double mouseX = minecraft.mouseHelper.getMouseX() * w.getScaledWidth() / w.getWidth();
double mouseY = minecraft.mouseHelper.getMouseY() * w.getScaledHeight() / w.getHeight();
centerScalingOn((int) mouseX, (int) mouseY);
}
public boolean isEquivalentTo(AbstractSimiScreen other) {
return false;
}
public void shareContextWith(AbstractSimiScreen other) {}
}

View file

@ -8,6 +8,7 @@ import java.util.Optional;
import javax.annotation.Nullable;
import com.simibubi.create.foundation.ponder.NavigatableSimiScreen;
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
import net.minecraft.client.Minecraft;
@ -35,13 +36,13 @@ public class ScreenOpener {
openScreen(toOpen);
}
public static void openPreviousScreen(Screen current, Optional<AbstractSimiScreen> screenWithContext) {
public static void openPreviousScreen(Screen current, Optional<NavigatableSimiScreen> screenWithContext) {
if (backStack.isEmpty())
return;
backSteppedFrom = current;
Screen previousScreen = backStack.pop();
if (previousScreen instanceof AbstractSimiScreen) {
AbstractSimiScreen previousAbstractSimiScreen = (AbstractSimiScreen) previousScreen;
if (previousScreen instanceof NavigatableSimiScreen) {
NavigatableSimiScreen previousAbstractSimiScreen = (NavigatableSimiScreen) previousScreen;
screenWithContext.ifPresent(s -> s.shareContextWith(previousAbstractSimiScreen));
previousAbstractSimiScreen.transition.startWithValue(-0.1)
.chase(-1, .4f, LerpedFloat.Chaser.EXP);
@ -51,7 +52,7 @@ public class ScreenOpener {
// transitions are only supported in simiScreens atm. they take care of all the
// rendering for it
public static void transitionTo(AbstractSimiScreen screen) {
public static void transitionTo(NavigatableSimiScreen screen) {
if (tryBackTracking(screen))
return;
screen.transition.startWithValue(0.1)
@ -59,14 +60,14 @@ public class ScreenOpener {
open(screen);
}
private static boolean tryBackTracking(AbstractSimiScreen screen) {
private static boolean tryBackTracking(NavigatableSimiScreen screen) {
List<Screen> screenHistory = getScreenHistory();
if (screenHistory.isEmpty())
return false;
Screen previouslyRenderedScreen = screenHistory.get(0);
if (!(previouslyRenderedScreen instanceof AbstractSimiScreen))
return false;
if (!screen.isEquivalentTo((AbstractSimiScreen) previouslyRenderedScreen))
if (!screen.isEquivalentTo((NavigatableSimiScreen) previouslyRenderedScreen))
return false;
openPreviousScreen(Minecraft.getInstance().currentScreen, Optional.of(screen));

View file

@ -0,0 +1,231 @@
package com.simibubi.create.foundation.ponder;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.commons.lang3.mutable.MutableBoolean;
import org.apache.commons.lang3.mutable.MutableInt;
import org.lwjgl.glfw.GLFW;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
import com.simibubi.create.foundation.gui.IScreenRenderable;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.gui.UIRenderHelper;
import com.simibubi.create.foundation.ponder.content.PonderTagScreen;
import com.simibubi.create.foundation.ponder.ui.PonderButton;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.item.ItemStack;
public abstract class NavigatableSimiScreen extends AbstractSimiScreen {
public static final String THINK_BACK = PonderLocalization.LANG_PREFIX + "think_back";
protected int depthPointX, depthPointY;
public final LerpedFloat transition = LerpedFloat.linear()
.startWithValue(0)
.chase(0, .1f, LerpedFloat.Chaser.LINEAR);
protected PonderButton backTrack;
public NavigatableSimiScreen() {
MainWindow window = Minecraft.getInstance()
.getWindow();
depthPointX = window.getScaledWidth() / 2;
depthPointY = window.getScaledHeight() / 2;
}
@Override
public void onClose() {
ScreenOpener.clearStack();
super.onClose();
}
@Override
public void tick() {
super.tick();
transition.tickChaser();
}
@Override
protected void init() {
super.init();
List<Screen> screenHistory = ScreenOpener.getScreenHistory();
if (screenHistory.isEmpty())
return;
if (!(screenHistory.get(0) instanceof NavigatableSimiScreen))
return;
Screen screen = screenHistory.get(0);
IScreenRenderable icon = null;
ItemStack altIcon = null;
if (screen instanceof PonderUI)
altIcon = ((PonderUI) screen).stack;
if (screen instanceof PonderTagScreen)
icon = ((PonderTagScreen) screen).getTag();
widgets.add(backTrack = new PonderButton(31, height - 31 - PonderButton.SIZE, () -> {
ScreenOpener.openPreviousScreen(this, Optional.empty());
}).fade(0, -1));
backTrack.fade(1);
if (icon != null)
backTrack.showing(icon);
if (altIcon != null)
backTrack.showing(altIcon);
}
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
super.render(mouseX, mouseY, partialTicks);
// renderZeloBreadcrumbs(mouseX, mouseY, partialTicks);
if (backTrack == null)
return;
RenderSystem.pushMatrix();
RenderSystem.translated(0, 0, 500);
if (backTrack.isHovered())
drawString(font, Lang.translate(THINK_BACK), 15, height - 16, 0xffa3a3a3);
RenderSystem.popMatrix();
}
@Override
protected void renderWindowBackground(int mouseX, int mouseY, float partialTicks) {
if (transition.getChaseTarget() == 0) {
renderBackground();
return;
}
renderBackground();
Screen lastScreen = ScreenOpener.getPreviouslyRenderedScreen();
float transitionValue = transition.getValue(partialTicks);
double scale = 1 + 0.5 * transitionValue;
// draw last screen into buffer
if (lastScreen != null && lastScreen != this) {
RenderSystem.pushMatrix();// 1
UIRenderHelper.framebuffer.framebufferClear(Minecraft.IS_RUNNING_ON_MAC);
UIRenderHelper.prepFramebufferSize();
RenderSystem.pushMatrix();// 2
RenderSystem.translated(0, 0, -1000);
UIRenderHelper.framebuffer.bindFramebuffer(true);
lastScreen.render(mouseX, mouseY, 10);
RenderSystem.popMatrix();// 2
// use the buffer texture
Minecraft.getInstance()
.getFramebuffer()
.bindFramebuffer(true);
MainWindow window = Minecraft.getInstance()
.getWindow();
int dpx = window.getScaledWidth() / 2;
int dpy = window.getScaledHeight() / 2;
if (lastScreen instanceof AbstractSimiScreen) {
dpx = ((NavigatableSimiScreen) lastScreen).depthPointX;
dpy = ((NavigatableSimiScreen) lastScreen).depthPointY;
}
// transitionV is 1/-1 when the older screen is hidden
// transitionV is 0 when the older screen is still fully visible
RenderSystem.translated(dpx, dpy, 0);
RenderSystem.scaled(scale, scale, 1);
RenderSystem.translated(-dpx, -dpy, 0);
UIRenderHelper.drawFramebuffer(1f - Math.abs(transitionValue));
RenderSystem.popMatrix();// 1
}
// modify current screen as well
scale = transitionValue > 0 ? 1 - 0.5 * (1 - transitionValue) : 1 + .5 * (1 + transitionValue);
RenderSystem.translated(depthPointX, depthPointY, 0);
RenderSystem.scaled(scale, scale, 1);
RenderSystem.translated(-depthPointX, -depthPointY, 0);
if (backTrack != null) {
UIRenderHelper.breadcrumbArrow(21, height - 51, 30, 20, 5, 0x40aa9999, 0x10aa9999);
UIRenderHelper.breadcrumbArrow(-19, height - 51, 40, 20, 5, 0x40aa9999, 0x10aa9999);
}
}
@Override
public boolean keyPressed(int code, int p_keyPressed_2_, int p_keyPressed_3_) {
if (code == GLFW.GLFW_KEY_BACKSPACE) {
ScreenOpener.openPreviousScreen(this, Optional.empty());
return true;
}
return super.keyPressed(code, p_keyPressed_2_, p_keyPressed_3_);
}
public void centerScalingOn(int x, int y) {
depthPointX = x;
depthPointY = y;
}
public void centerScalingOnMouse() {
MainWindow w = minecraft.getWindow();
double mouseX = minecraft.mouseHelper.getMouseX() * w.getScaledWidth() / w.getWidth();
double mouseY = minecraft.mouseHelper.getMouseY() * w.getScaledHeight() / w.getHeight();
centerScalingOn((int) mouseX, (int) mouseY);
}
public boolean isEquivalentTo(NavigatableSimiScreen other) {
return false;
}
public void shareContextWith(NavigatableSimiScreen other) {}
protected void renderZeloBreadcrumbs(int mouseX, int mouseY, float partialTicks) {
List<Screen> history = ScreenOpener.getScreenHistory();
if (history.isEmpty())
return;
history.add(0, Minecraft.getInstance().currentScreen);
int spacing = 20;
List<String> names = history.stream()
.map(NavigatableSimiScreen::screenTitle)
.collect(Collectors.toList());
int bWidth = names.stream()
.mapToInt(s -> font.getStringWidth(s) + spacing)
.sum();
MutableInt x = new MutableInt(width - bWidth);
MutableInt y = new MutableInt(height - 18);
MutableBoolean first = new MutableBoolean(true);
if (x.getValue() < 25)
x.setValue(25);
RenderSystem.pushMatrix();
RenderSystem.translated(0, 0, 600);
names.forEach(s -> {
int sWidth = font.getStringWidth(s);
UIRenderHelper.breadcrumbArrow(x.getValue(), y.getValue(), sWidth + spacing, 14, spacing / 2, 0xdd101010,
0x44101010);
drawString(font, s, x.getValue() + 5, y.getValue() + 3, first.getValue() ? 0xffeeffee : 0xffddeeff);
first.setFalse();
x.add(sWidth + spacing);
});
RenderSystem.popMatrix();
}
private static String screenTitle(Screen screen) {
if (screen instanceof NavigatableSimiScreen)
return ((NavigatableSimiScreen) screen).getBreadcrumbTitle();
return "<";
}
protected String getBreadcrumbTitle() {
return this.getClass()
.getSimpleName();
}
}

View file

@ -74,6 +74,13 @@ public class PonderLocalization {
addGeneral(object, PonderUI.IDENTIFY_MODE, "Identify mode active.\nUnpause with [%1$s]");
addGeneral(object, PonderTagScreen.ASSOCIATED, "Associated Entries");
addGeneral(object, PonderUI.CLOSE, "Close");
addGeneral(object, PonderUI.IDENTIFY, "Identify");
addGeneral(object, PonderUI.NEXT, "Next Scene");
addGeneral(object, PonderUI.PREVIOUS, "Previous Scene");
addGeneral(object, PonderUI.REPLAY, "Replay");
addGeneral(object, PonderUI.THINK_BACK, "Think Back");
shared.forEach((k, v) -> object.addProperty(Create.ID + "." + langKeyForShared(k), v));
tag.forEach((k, v) -> {
object.addProperty(Create.ID + "." + langKeyForTag(k), v.getFirst());

View file

@ -3,7 +3,6 @@ package com.simibubi.create.foundation.ponder;
import java.util.List;
import com.google.common.base.Strings;
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.ponder.content.PonderIndexScreen;
import com.simibubi.create.foundation.ponder.content.PonderTagScreen;
@ -79,9 +78,8 @@ public class PonderTooltipHandler {
if (!subject && InputMappings.isKeyDown(window, keyCode)) {
if (value >= 1) {
if (currentScreen instanceof AbstractSimiScreen)
((AbstractSimiScreen) currentScreen).centerScalingOnMouse();
if (currentScreen instanceof NavigatableSimiScreen)
((NavigatableSimiScreen) currentScreen).centerScalingOnMouse();
ScreenOpener.transitionTo(PonderUI.of(stack));
holdWProgress.startWithValue(0);
return;

View file

@ -10,7 +10,6 @@ import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
import com.simibubi.create.foundation.gui.AllGuiTextures;
import com.simibubi.create.foundation.gui.AllIcons;
import com.simibubi.create.foundation.gui.GuiGameElement;
@ -28,10 +27,10 @@ import com.simibubi.create.foundation.utility.ColorHelper;
import com.simibubi.create.foundation.utility.FontHelper;
import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
import com.simibubi.create.foundation.utility.Pair;
import com.simibubi.create.foundation.utility.Pointing;
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
import net.minecraft.client.ClipboardHelper;
import net.minecraft.client.GameSettings;
@ -54,7 +53,7 @@ import net.minecraft.world.gen.feature.template.Template;
import net.minecraftforge.fml.client.gui.GuiUtils;
import net.minecraftforge.registries.ForgeRegistries;
public class PonderUI extends AbstractSimiScreen {
public class PonderUI extends NavigatableSimiScreen {
public static int ponderTicks;
public static float ponderPartialTicksPaused;
@ -62,6 +61,11 @@ public class PonderUI extends AbstractSimiScreen {
public static final String PONDERING = PonderLocalization.LANG_PREFIX + "pondering";
public static final String IDENTIFY_MODE = PonderLocalization.LANG_PREFIX + "identify_mode";
public static final String IN_CHAPTER = PonderLocalization.LANG_PREFIX + "in_chapter";
public static final String IDENTIFY = PonderLocalization.LANG_PREFIX + "identify";
public static final String PREVIOUS = PonderLocalization.LANG_PREFIX + "previous";
public static final String CLOSE = PonderLocalization.LANG_PREFIX + "close";
public static final String NEXT = PonderLocalization.LANG_PREFIX + "next";
public static final String REPLAY = PonderLocalization.LANG_PREFIX + "replay";
private List<PonderScene> scenes;
private List<PonderTag> tags;
@ -83,7 +87,7 @@ public class PonderUI extends AbstractSimiScreen {
private int index = 0;
private PonderTag referredToByTag;
private PonderButton left, right, scan, chap, userMode;
private PonderButton left, right, scan, chap, userMode, close, replay;
private PonderProgressBar progressBar;
private int skipCooling = 0;
@ -133,8 +137,8 @@ public class PonderUI extends AbstractSimiScreen {
@Override
protected void init() {
super.init();
widgets.clear();
super.init();
tagButtons = new ArrayList<>();
tagFades = new ArrayList<>();
@ -187,7 +191,7 @@ public class PonderUI extends AbstractSimiScreen {
.fade(0, -1));
if (PonderIndex.EDITOR_MODE) {
widgets.add(userMode = new PonderButton(31, bY, () -> {
widgets.add(userMode = new PonderButton(width - 20 - 31, bY, () -> {
userViewMode = !userViewMode;
}).showing(AllIcons.I_MTD_USER_MODE)
.fade(0, -1));
@ -199,7 +203,7 @@ public class PonderUI extends AbstractSimiScreen {
.fade(0, -1));
bX += 20 + spacing;
widgets.add(new PonderButton(bX, bY, this::onClose).showing(AllIcons.I_MTD_CLOSE)
widgets.add(close = new PonderButton(bX, bY, this::onClose).showing(AllIcons.I_MTD_CLOSE)
.shortcut(bindings.keyBindInventory)
.fade(0, -1));
@ -209,7 +213,7 @@ public class PonderUI extends AbstractSimiScreen {
.fade(0, -1));
bX += 50 + spacing;
widgets.add(new PonderButton(bX, bY, this::replay).showing(AllIcons.I_MTD_REPLAY)
widgets.add(replay = new PonderButton(bX, bY, this::replay).showing(AllIcons.I_MTD_REPLAY)
.shortcut(bindings.keyBindBack)
.fade(0, -1));
}
@ -460,6 +464,7 @@ public class PonderUI extends AbstractSimiScreen {
for (Widget widget : widgets)
noWidgetsHovered &= !widget.isMouseOver(mouseX, mouseY);
int tooltipColor = 0xffa3a3a3;
{
// Chapter title
RenderSystem.pushMatrix();
@ -480,14 +485,15 @@ public class PonderUI extends AbstractSimiScreen {
.scale(2)
.render();
drawString(font, Lang.translate(PONDERING), x, y - 6, 0xffa3a3a3);
drawString(font, Lang.translate(PONDERING), x, y - 6, tooltipColor);
y += 8;
x += 0;
// RenderSystem.translated(0, 3 * (indexDiff), 0);
RenderSystem.translated(x, y, 0);
RenderSystem.rotatef(indexDiff * -75, 1, 0, 0);
RenderSystem.translated(0, 0, 5);
FontHelper.drawSplitString(font, title, 0, 0, left.x - 51, ColorHelper.applyAlpha(textColor, 1 - indexDiff));
FontHelper.drawSplitString(font, title, 0, 0, left.x - 51,
ColorHelper.applyAlpha(textColor, 1 - indexDiff));
RenderSystem.popMatrix();
if (chapter != null) {
@ -496,12 +502,17 @@ public class PonderUI extends AbstractSimiScreen {
RenderSystem.translated(chap.x - 4 - 4, chap.y, 0);
UIRenderHelper.streak(180, 4, 10, 26, (int) (150 * fade), 0x101010);
drawRightAlignedString(font, Lang.translate(IN_CHAPTER), 0, 0, 0xffa3a3a3);
drawRightAlignedString(font, Lang.translate(IN_CHAPTER), 0, 0, tooltipColor);
drawRightAlignedString(font,
Lang.translate(PonderLocalization.LANG_PREFIX + "chapter." + chapter.getId()), 0, 12, 0xffeeeeee);
RenderSystem.popMatrix();
}
UIRenderHelper.breadcrumbArrow(width / 2 - 20, height - 51, 20, 20, 5, 0x40aa9999, 0x20aa9999);
UIRenderHelper.breadcrumbArrow(width / 2 + 20, height - 51, -20, 20, -5, 0x40aa9999, 0x20aa9999);
UIRenderHelper.breadcrumbArrow(width / 2 - 90, height - 51, 70, 20, 5, 0x40aa9999, 0x10aa9999);
UIRenderHelper.breadcrumbArrow(width / 2 + 90, height - 51, -70, 20, -5, 0x40aa9999, 0x10aa9999);
}
if (identifyMode) {
@ -612,6 +623,21 @@ public class PonderUI extends AbstractSimiScreen {
RenderSystem.popMatrix();
});
RenderSystem.pushMatrix();
RenderSystem.translated(0, 0, 500);
int tooltipY = height - 16;
if (scan.isHovered())
drawCenteredString(font, Lang.translate(IDENTIFY), scan.x + 10, tooltipY, tooltipColor);
if (index != 0 && left.isHovered())
drawCenteredString(font, Lang.translate(PREVIOUS), left.x + 10, tooltipY, tooltipColor);
if (close.isHovered())
drawCenteredString(font, Lang.translate(CLOSE), close.x + 10, tooltipY, tooltipColor);
if (index != scenes.size() - 1 && right.isHovered())
drawCenteredString(font, Lang.translate(NEXT), right.x + 10, tooltipY, tooltipColor);
if (replay.isHovered())
drawCenteredString(font, Lang.translate(REPLAY), replay.x + 10, tooltipY, tooltipColor);
RenderSystem.popMatrix();
}
protected void lowerButtonGroup(int index, int mouseX, int mouseY, float fade, AllIcons icon, KeyBinding key) {
@ -838,14 +864,14 @@ public class PonderUI extends AbstractSimiScreen {
}
@Override
public boolean isEquivalentTo(AbstractSimiScreen other) {
public boolean isEquivalentTo(NavigatableSimiScreen other) {
if (other instanceof PonderUI)
return stack.isItemEqual(((PonderUI) other).stack);
return super.isEquivalentTo(other);
}
@Override
public void shareContextWith(AbstractSimiScreen other) {
public void shareContextWith(NavigatableSimiScreen other) {
if (other instanceof PonderUI) {
PonderUI ponderUI = (PonderUI) other;
ponderUI.referredToByTag = referredToByTag;

View file

@ -1,16 +1,23 @@
package com.simibubi.create.foundation.ponder.content;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.apache.commons.lang3.mutable.MutableBoolean;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.components.crank.ValveHandleBlock;
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.gui.UIRenderHelper;
import com.simibubi.create.foundation.ponder.NavigatableSimiScreen;
import com.simibubi.create.foundation.ponder.PonderRegistry;
import com.simibubi.create.foundation.ponder.PonderUI;
import com.simibubi.create.foundation.ponder.ui.ChapterLabel;
import com.simibubi.create.foundation.ponder.ui.LayoutHelper;
import com.simibubi.create.foundation.ponder.ui.PonderButton;
import net.minecraft.block.Block;
import net.minecraft.client.MainWindow;
import net.minecraft.client.gui.widget.Widget;
@ -20,13 +27,8 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.registries.ForgeRegistries;
import org.apache.commons.lang3.mutable.MutableBoolean;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class PonderIndexScreen extends AbstractSimiScreen {
public class PonderIndexScreen extends NavigatableSimiScreen {
protected final List<PonderChapter> chapters;
private final double chapterXmult = 0.5;
@ -47,10 +49,8 @@ public class PonderIndexScreen extends AbstractSimiScreen {
@Override
protected void init() {
super.init();
// populate lists
widgets.clear();
super.init();
chapters.clear();
// chapters.addAll(PonderRegistry.chapters.getAllChapters());
@ -210,7 +210,7 @@ public class PonderIndexScreen extends AbstractSimiScreen {
}
@Override
public boolean isEquivalentTo(AbstractSimiScreen other) {
public boolean isEquivalentTo(NavigatableSimiScreen other) {
return other instanceof PonderIndexScreen;
}

View file

@ -7,9 +7,9 @@ import java.util.Objects;
import org.apache.commons.lang3.mutable.MutableBoolean;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.gui.UIRenderHelper;
import com.simibubi.create.foundation.ponder.NavigatableSimiScreen;
import com.simibubi.create.foundation.ponder.PonderLocalization;
import com.simibubi.create.foundation.ponder.PonderRegistry;
import com.simibubi.create.foundation.ponder.PonderUI;
@ -28,11 +28,11 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.registries.ForgeRegistries;
public class PonderTagScreen extends AbstractSimiScreen {
public class PonderTagScreen extends NavigatableSimiScreen {
public static final String ASSOCIATED = PonderLocalization.LANG_PREFIX + "associated";
protected final PonderTag tag;
private final PonderTag tag;
protected final List<Item> items;
private final double itemXmult = 0.5;
protected Rectangle2d itemArea;
@ -52,8 +52,8 @@ public class PonderTagScreen extends AbstractSimiScreen {
@Override
protected void init() {
super.init();
widgets.clear();
super.init();
// items
items.clear();
@ -146,6 +146,8 @@ public class PonderTagScreen extends AbstractSimiScreen {
double mouseX = minecraft.mouseHelper.getMouseX() * w.getScaledWidth() / w.getWidth();
double mouseY = minecraft.mouseHelper.getMouseY() * w.getScaledHeight() / w.getHeight();
for (Widget widget : widgets) {
if (widget == backTrack)
continue;
if (widget instanceof PonderButton)
if (widget.isMouseOver(mouseX, mouseY)) {
hoveredItem = ((PonderButton) widget).getItem();
@ -200,6 +202,7 @@ public class PonderTagScreen extends AbstractSimiScreen {
RenderSystem.translated(0, 0, 100);
FontHelper.drawSplitString(font, desc, x, y, w, 0xeeeeee);
RenderSystem.popMatrix();
}
protected void renderItems(int mouseX, int mouseY, float partialTicks) {
@ -293,7 +296,7 @@ public class PonderTagScreen extends AbstractSimiScreen {
}
@Override
public boolean isEquivalentTo(AbstractSimiScreen other) {
public boolean isEquivalentTo(NavigatableSimiScreen other) {
if (other instanceof PonderTagScreen)
return tag == ((PonderTagScreen) other).tag;
return super.isEquivalentTo(other);
@ -304,4 +307,8 @@ public class PonderTagScreen extends AbstractSimiScreen {
return true;
}
public PonderTag getTag() {
return tag;
}
}

View file

@ -751,7 +751,7 @@ public class RedstoneScenes {
scene.idle(10);
scene.overlay.showText(70)
.colored(PonderPalette.GREEN)
.text("Receivers will emit the redstone power of transmitters within a range of 128 blocks")
.text("Receivers emit the redstone power of transmitters within 128 blocks")
.placeNearTarget()
.pointAt(link2Vec);
scene.idle(80);
@ -820,7 +820,7 @@ public class RedstoneScenes {
scene.effects.indicateRedstone(link2Pos);
scene.overlay.showText(90)
.attachKeyFrame()
.text("Only the links with matching Frequency combinations will communicate")
.text("Only the links with matching Frequencies will communicate")
.placeNearTarget()
.pointAt(link2Vec);
scene.idle(100);

View file

@ -103,7 +103,7 @@ public class TextWindowElement extends AnimatedOverlayElement {
boxWidth = Math.max(boxWidth, screen.getFontRenderer()
.getStringWidth(string));
int boxHeight = screen.getFontRenderer()
.getWordWrappedHeight(bakedText, textWidth);
.getWordWrappedHeight(bakedText, boxWidth);
RenderSystem.pushMatrix();
RenderSystem.translatef(0, sceneToScreen.y, 400);