|
15 | 15 | import net.minecraft.client.StringSplitter; |
16 | 16 | import net.minecraft.client.gui.Font; |
17 | 17 | import net.minecraft.client.gui.GuiGraphics; |
18 | | -import net.minecraft.client.gui.components.AbstractWidget; |
| 18 | +import net.minecraft.client.gui.components.EditBox; |
19 | 19 | import net.minecraft.client.gui.components.events.GuiEventListener; |
20 | 20 | import net.minecraft.client.gui.font.TextFieldHelper; |
21 | 21 | import net.minecraft.client.gui.narration.NarratedElementType; |
|
60 | 60 | * @author rubensworks |
61 | 61 | */ |
62 | 62 | @OnlyIn(Dist.CLIENT) |
63 | | -public class WidgetTextArea extends AbstractWidget implements GuiEventListener { |
| 63 | +public class WidgetTextArea extends EditBox implements GuiEventListener { |
64 | 64 |
|
65 | 65 | public static final int ROW_HEIGHT = 9; |
66 | 66 |
|
@@ -89,7 +89,7 @@ public class WidgetTextArea extends AbstractWidget implements GuiEventListener { |
89 | 89 | private int firstRow; |
90 | 90 |
|
91 | 91 | public WidgetTextArea(Font font, int x, int y, int width, int height, Component narrationMessage, boolean scrollBar, boolean showLineNumbers) { |
92 | | - super(x, y, width, height, narrationMessage); |
| 92 | + super(font, x, y, width, height, narrationMessage); |
93 | 93 | this.font = font; |
94 | 94 | this.showLineNumbers = showLineNumbers; |
95 | 95 | this.textFieldHelper = new TextFieldHelperExtended(this::getValue, this::setValuePassive, this::getClipboard, this::setClipboard, s -> true, this::setSelected, this::onCursorPosChanged); |
@@ -211,7 +211,7 @@ public void setSelectionPos(int pos) { |
211 | 211 | } |
212 | 212 |
|
213 | 213 | @Override |
214 | | - protected void updateWidgetNarration(NarrationElementOutput narrationElementOutput) { |
| 214 | + public void updateWidgetNarration(NarrationElementOutput narrationElementOutput) { |
215 | 215 | narrationElementOutput.add(NarratedElementType.TITLE, Component.translatable("narration.edit_box", this.getValue())); |
216 | 216 | } |
217 | 217 |
|
@@ -439,7 +439,7 @@ private void keyEnd() { |
439 | 439 | } |
440 | 440 |
|
441 | 441 | @Override |
442 | | - protected void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { |
| 442 | + public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { |
443 | 443 | // Determine lines to show |
444 | 444 | DisplayCache displayCache = this.getDisplayCache(); |
445 | 445 | List<LineInfo> lines = Arrays.asList(displayCache.lines); |
|
0 commit comments