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