|
8 | 8 | import io.github.axolotlclient.modules.hud.util.Rectangle; |
9 | 9 | import io.github.axolotlclient.util.Util; |
10 | 10 | import net.minecraft.client.MinecraftClient; |
11 | | -import net.minecraft.client.gui.AbstractParentElement; |
12 | 11 | import net.minecraft.client.gui.Element; |
13 | 12 | import net.minecraft.client.gui.Selectable; |
14 | 13 | import net.minecraft.client.gui.screen.Screen; |
|
32 | 31 | import java.util.ArrayList; |
33 | 32 | import java.util.HashMap; |
34 | 33 | import java.util.List; |
35 | | -import java.util.stream.Collectors; |
36 | 34 |
|
37 | 35 | public class CreditsScreen extends Screen { |
38 | 36 |
|
@@ -191,14 +189,6 @@ public boolean mouseScrolled(double mouseX, double mouseY, double amount) { |
191 | 189 | return super.mouseScrolled(mouseX, mouseY, amount) || creditsList.mouseScrolled(mouseX, mouseY, amount); |
192 | 190 | } |
193 | 191 |
|
194 | | - @Override |
195 | | - public boolean changeFocus(boolean lookForwards) { |
196 | | - /*if(creditOverlay != null){ |
197 | | - setFocused(creditOverlay); |
198 | | - }*/ |
199 | | - return super.changeFocus(lookForwards); |
200 | | - } |
201 | | - |
202 | 192 | @Override |
203 | 193 | public List<? extends Element> children() { |
204 | 194 | if(CreditsScreen.this.creditOverlay != null){ |
@@ -228,6 +218,15 @@ public CreditsList(MinecraftClient minecraftClient, int width, int height, int t |
228 | 218 | @Override |
229 | 219 | public void appendNarrations(NarrationMessageBuilder builder) { |
230 | 220 | builder.put(NarrationPart.TITLE, "credits"); |
| 221 | + super.appendNarrations(builder); |
| 222 | + if(creditOverlay != null){ |
| 223 | + builder.put(NarrationPart.TITLE, creditOverlay.credit.name); |
| 224 | + StringBuilder cs = new StringBuilder(); |
| 225 | + for(String s:creditOverlay.credit.things){ |
| 226 | + cs.append(s).append(". "); |
| 227 | + } |
| 228 | + builder.put(NarrationPart.HINT, cs.toString()); |
| 229 | + } |
231 | 230 | } |
232 | 231 |
|
233 | 232 | @Override |
@@ -258,11 +257,12 @@ private class Credit extends ElementListWidget.Entry<Credit> { |
258 | 257 |
|
259 | 258 | private boolean hovered; |
260 | 259 |
|
261 | | - private final ButtonWidget c = new ButtonWidget(-2, -2, 1, 1, Text.empty(), buttonWidget -> creditOverlay = new Overlay(this)); |
| 260 | + private final ButtonWidget c; |
262 | 261 |
|
263 | 262 | public Credit(String name, String... things){ |
264 | 263 | this.name=name; |
265 | 264 | this.things=things; |
| 265 | + c = new ButtonWidget(-2, -2, 1, 1, Text.of(name), buttonWidget -> creditOverlay = new Overlay(this)); |
266 | 266 | } |
267 | 267 |
|
268 | 268 | @Override |
@@ -370,6 +370,10 @@ public void mouseClicked(double mouseX, double mouseY) { |
370 | 370 | } |
371 | 371 | }); |
372 | 372 | } |
| 373 | + |
| 374 | + public String[] getThings(){ |
| 375 | + return credit.things; |
| 376 | + } |
373 | 377 | } |
374 | 378 |
|
375 | 379 | private class SpacerTitle extends Credit { |
|
0 commit comments