|
10 | 10 | import java.util.AbstractList; |
11 | 11 |
|
12 | 12 | /** |
13 | | - * A bare bones implementation of the {@link AbstractList} / {@link net.minecraft.client.gui.widget.list.ExtendedList} |
| 13 | + * A bare bones implementation of the {@link AbstractList} |
14 | 14 | * without the background or borders. With GL_SCISSOR to crop out the overflow |
15 | 15 | * |
16 | 16 | * This is how an abstract implementation should look... :cry: |
17 | 17 | */ |
18 | 18 | public class ScrollingList<E extends AbstractSelectionList.Entry<E>> extends AbstractSelectionList<E> { |
19 | 19 | public ScrollingList(int x, int y, int width, int height, int slotHeightIn) { |
20 | | - super(Minecraft.getInstance(), width, height, y - (height / 2), (y - (height / 2)) + height, slotHeightIn); |
21 | | - this.setLeftPos(x - (width / 2)); |
| 20 | + super(Minecraft.getInstance(), width, height, y - (height / 2), slotHeightIn); |
| 21 | + this.setX(x - (width / 2)); |
22 | 22 | this.setRenderBackground(false); |
23 | 23 |
|
24 | 24 | // this.setRenderTopAndBottom(false); // removes background |
25 | 25 | } |
26 | 26 |
|
27 | 27 | @Override |
28 | | - public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { |
| 28 | + public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { |
29 | 29 | double scale = Minecraft.getInstance().getWindow().getGuiScale(); |
30 | 30 |
|
31 | 31 | GL11.glEnable(GL11.GL_SCISSOR_TEST); |
32 | | - GL11.glScissor((int)(this.x0 * scale), (int)(Minecraft.getInstance().getWindow().getHeight() - ((this.y0 + this.height) * scale)), |
| 32 | + GL11.glScissor((int)(this.getX() * scale), (int)(Minecraft.getInstance().getWindow().getHeight() - ((this.getX() + this.height) * scale)), |
33 | 33 | (int)(this.width * scale), (int)(this.height * scale)); |
34 | 34 |
|
35 | | - super.render(guiGraphics, mouseX, mouseY, partialTicks); |
| 35 | + super.renderWidget(guiGraphics, mouseX, mouseY, partialTicks); |
36 | 36 |
|
37 | 37 | GL11.glDisable(GL11.GL_SCISSOR_TEST); |
38 | 38 | } |
39 | 39 |
|
40 | | - @Override // @mcp: getScrollbarPosition = getScrollbarPosition |
41 | | - protected int getScrollbarPosition() { |
42 | | - return (this.x0 + this.width) - 6; |
43 | | - } |
44 | | - |
45 | 40 | @Override |
46 | | - public void updateNarration(NarrationElementOutput p_169152_) { |
| 41 | + protected void updateWidgetNarration(NarrationElementOutput p_259858_) { |
47 | 42 |
|
48 | 43 | } |
| 44 | + |
| 45 | + @Override // @mcp: getScrollbarPosition = getScrollbarPosition |
| 46 | + protected int getScrollbarPosition() { |
| 47 | + return (this.getX() + this.width) - 6; |
| 48 | + } |
49 | 49 | } |
0 commit comments