| 1 | package net.minecraft.client.gui;
|
| 2 |
|
| 3 | import net.minecraft.client.Minecraft;
|
| 4 | import net.minecraft.realms.RealmsClickableScrolledSelectionList;
|
| 5 | import net.minecraft.realms.Tezzelator;
|
| 6 | import org.lwjgl.input.Mouse;
|
| 7 |
|
| 8 | public class GuiClickableScrolledSelectionListProxy extends GuiSlot
|
| 9 | {
|
| 10 | private final RealmsClickableScrolledSelectionList field_178046_u;
|
| 11 |
|
| 12 | public GuiClickableScrolledSelectionListProxy(RealmsClickableScrolledSelectionList selectionList, int p_i45526_2_, int p_i45526_3_, int p_i45526_4_, int p_i45526_5_, int p_i45526_6_)
|
| 13 | {
|
| 14 | super(Minecraft.getMinecraft(), p_i45526_2_, p_i45526_3_, p_i45526_4_, p_i45526_5_, p_i45526_6_);
|
| 15 | this.field_178046_u = selectionList;
|
| 16 | }
|
| 17 |
|
| 18 | protected int getSize()
|
| 19 | {
|
| 20 | return this.field_178046_u.getItemCount();
|
| 21 | }
|
| 22 |
|
| 23 | /**
|
| 24 | * The element in the slot that was clicked, boolean for whether it was double clicked or not
|
| 25 | */
|
| 26 | protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY)
|
| 27 | {
|
| 28 | this.field_178046_u.selectItem(slotIndex, isDoubleClick, mouseX, mouseY);
|
| 29 | }
|
| 30 |
|
| 31 | /**
|
| 32 | * Returns true if the element passed in is currently selected
|
| 33 | */
|
| 34 | protected boolean isSelected(int slotIndex)
|
| 35 | {
|
| 36 | return this.field_178046_u.isSelectedItem(slotIndex);
|
| 37 | }
|
| 38 |
|
| 39 | protected void drawBackground()
|
| 40 | {
|
| 41 | this.field_178046_u.renderBackground();
|
| 42 | }
|
| 43 |
|
| 44 | protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn)
|
| 45 | {
|
| 46 | this.field_178046_u.renderItem(entryID, p_180791_2_, p_180791_3_, p_180791_4_, mouseXIn, mouseYIn);
|
| 47 | }
|
| 48 |
|
| 49 | public int func_178044_e()
|
| 50 | {
|
| 51 | return super.width;
|
| 52 | }
|
| 53 |
|
| 54 | public int func_178042_f()
|
| 55 | {
|
| 56 | return super.mouseY;
|
| 57 | }
|
| 58 |
|
| 59 | public int func_178045_g()
|
| 60 | {
|
| 61 | return super.mouseX;
|
| 62 | }
|
| 63 |
|
| 64 | /**
|
| 65 | * Return the height of the content being scrolled
|
| 66 | */
|
| 67 | protected int getContentHeight()
|
| 68 | {
|
| 69 | return this.field_178046_u.getMaxPosition();
|
| 70 | }
|
| 71 |
|
| 72 | protected int getScrollBarX()
|
| 73 | {
|
| 74 | return this.field_178046_u.getScrollbarPosition();
|
| 75 | }
|
| 76 |
|
| 77 | public void handleMouseInput()
|
| 78 | {
|
| 79 | super.handleMouseInput();
|
| 80 |
|
| 81 | if (this.scrollMultiplier > 0.0F && Mouse.getEventButtonState())
|
| 82 | {
|
| 83 | this.field_178046_u.customMouseEvent(this.top, this.bottom, this.headerPadding, this.amountScrolled, this.slotHeight);
|
| 84 | }
|
| 85 | }
|
| 86 |
|
| 87 | public void func_178043_a(int p_178043_1_, int p_178043_2_, int p_178043_3_, Tezzelator p_178043_4_)
|
| 88 | {
|
| 89 | this.field_178046_u.renderSelected(p_178043_1_, p_178043_2_, p_178043_3_, p_178043_4_);
|
| 90 | }
|
| 91 |
|
| 92 | /**
|
| 93 | * Draws the selection box around the selected slot element.
|
| 94 | */
|
| 95 | protected void drawSelectionBox(int p_148120_1_, int p_148120_2_, int mouseXIn, int mouseYIn)
|
| 96 | {
|
| 97 | int i = this.getSize();
|
| 98 |
|
| 99 | for (int j = 0; j < i; ++j)
|
| 100 | {
|
| 101 | int k = p_148120_2_ + j * this.slotHeight + this.headerPadding;
|
| 102 | int l = this.slotHeight - 4;
|
| 103 |
|
| 104 | if (k > this.bottom || k + l < this.top)
|
| 105 | {
|
| 106 | this.func_178040_a(j, p_148120_1_, k);
|
| 107 | }
|
| 108 |
|
| 109 | if (this.showSelectionBox && this.isSelected(j))
|
| 110 | {
|
| 111 | this.func_178043_a(this.width, k, l, Tezzelator.instance);
|
| 112 | }
|
| 113 |
|
| 114 | this.drawSlot(j, p_148120_1_, k, l, mouseXIn, mouseYIn);
|
| 115 | }
|
| 116 | }
|
| 117 | }
|
| 118 |
|