|
8 | 8 | import net.minecraft.client.StringSplitter; |
9 | 9 | import net.minecraft.client.gui.Font; |
10 | 10 | import net.minecraft.client.gui.GuiGraphics; |
11 | | -import net.minecraft.client.gui.components.AbstractWidget; |
| 11 | +import net.minecraft.client.gui.components.EditBox; |
12 | 12 | import net.minecraft.client.gui.components.events.GuiEventListener; |
13 | 13 | import net.minecraft.client.gui.font.TextFieldHelper; |
14 | 14 | import net.minecraft.client.gui.narration.NarratedElementType; |
|
53 | 53 | * @author rubensworks |
54 | 54 | */ |
55 | 55 | @OnlyIn(Dist.CLIENT) |
56 | | -public class WidgetTextArea extends AbstractWidget implements GuiEventListener { |
| 56 | +public class WidgetTextArea extends EditBox implements GuiEventListener { |
57 | 57 |
|
58 | 58 | public static final int ROW_HEIGHT = 9; |
59 | 59 |
|
@@ -82,7 +82,7 @@ public class WidgetTextArea extends AbstractWidget implements GuiEventListener { |
82 | 82 | private int firstRow; |
83 | 83 |
|
84 | 84 | public WidgetTextArea(Font font, int x, int y, int width, int height, Component narrationMessage, boolean scrollBar, boolean showLineNumbers) { |
85 | | - super(x, y, width, height, narrationMessage); |
| 85 | + super(font, x, y, width, height, narrationMessage); |
86 | 86 | this.font = font; |
87 | 87 | this.showLineNumbers = showLineNumbers; |
88 | 88 | this.textFieldHelper = new TextFieldHelperExtended(this::getValue, this::setValuePassive, this::getClipboard, this::setClipboard, s -> true, this::setSelected, this::onCursorPosChanged); |
@@ -204,7 +204,7 @@ public void setSelectionPos(int pos) { |
204 | 204 | } |
205 | 205 |
|
206 | 206 | @Override |
207 | | - protected void updateWidgetNarration(NarrationElementOutput narrationElementOutput) { |
| 207 | + public void updateWidgetNarration(NarrationElementOutput narrationElementOutput) { |
208 | 208 | narrationElementOutput.add(NarratedElementType.TITLE, Component.translatable("narration.edit_box", this.getValue())); |
209 | 209 | } |
210 | 210 |
|
@@ -432,7 +432,7 @@ private void keyEnd() { |
432 | 432 | } |
433 | 433 |
|
434 | 434 | @Override |
435 | | - protected void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { |
| 435 | + public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { |
436 | 436 | // Determine lines to show |
437 | 437 | DisplayCache displayCache = this.getDisplayCache(); |
438 | 438 | List<LineInfo> lines = Arrays.asList(displayCache.lines); |
|
0 commit comments