| 1 | package net.minecraft.client.gui;
|
| 2 |
|
| 3 | import com.google.common.collect.Lists;
|
| 4 | import java.io.IOException;
|
| 5 | import java.util.Collections;
|
| 6 | import java.util.List;
|
| 7 | import net.minecraft.item.ItemStack;
|
| 8 | import net.minecraft.realms.RealmsButton;
|
| 9 | import net.minecraft.realms.RealmsScreen;
|
| 10 |
|
| 11 | public class GuiScreenRealmsProxy extends GuiScreen
|
| 12 | {
|
| 13 | private RealmsScreen field_154330_a;
|
| 14 |
|
| 15 | public GuiScreenRealmsProxy(RealmsScreen p_i1087_1_)
|
| 16 | {
|
| 17 | this.field_154330_a = p_i1087_1_;
|
| 18 | super.buttonList = Collections.<GuiButton>synchronizedList(Lists.<GuiButton>newArrayList());
|
| 19 | }
|
| 20 |
|
| 21 | public RealmsScreen func_154321_a()
|
| 22 | {
|
| 23 | return this.field_154330_a;
|
| 24 | }
|
| 25 |
|
| 26 | /**
|
| 27 | * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
|
| 28 | * window resizes, the buttonList is cleared beforehand.
|
| 29 | */
|
| 30 | public void initGui()
|
| 31 | {
|
| 32 | this.field_154330_a.init();
|
| 33 | super.initGui();
|
| 34 | }
|
| 35 |
|
| 36 | public void func_154325_a(String p_154325_1_, int p_154325_2_, int p_154325_3_, int p_154325_4_)
|
| 37 | {
|
| 38 | super.drawCenteredString(this.fontRendererObj, p_154325_1_, p_154325_2_, p_154325_3_, p_154325_4_);
|
| 39 | }
|
| 40 |
|
| 41 | public void func_154322_b(String p_154322_1_, int p_154322_2_, int p_154322_3_, int p_154322_4_, boolean p_154322_5_)
|
| 42 | {
|
| 43 | if (p_154322_5_)
|
| 44 | {
|
| 45 | super.drawString(this.fontRendererObj, p_154322_1_, p_154322_2_, p_154322_3_, p_154322_4_);
|
| 46 | }
|
| 47 | else
|
| 48 | {
|
| 49 | this.fontRendererObj.drawString(p_154322_1_, p_154322_2_, p_154322_3_, p_154322_4_);
|
| 50 | }
|
| 51 | }
|
| 52 |
|
| 53 | /**
|
| 54 | * Draws a textured rectangle at the stored z-value. Args: x, y, u, v, width, height
|
| 55 | */
|
| 56 | public void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height)
|
| 57 | {
|
| 58 | this.field_154330_a.blit(x, y, textureX, textureY, width, height);
|
| 59 | super.drawTexturedModalRect(x, y, textureX, textureY, width, height);
|
| 60 | }
|
| 61 |
|
| 62 | /**
|
| 63 | * Draws a rectangle with a vertical gradient between the specified colors (ARGB format). Args : x1, y1, x2, y2,
|
| 64 | * topColor, bottomColor
|
| 65 | */
|
| 66 | public void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor)
|
| 67 | {
|
| 68 | super.drawGradientRect(left, top, right, bottom, startColor, endColor);
|
| 69 | }
|
| 70 |
|
| 71 | /**
|
| 72 | * Draws either a gradient over the background screen (when it exists) or a flat gradient over background.png
|
| 73 | */
|
| 74 | public void drawDefaultBackground()
|
| 75 | {
|
| 76 | super.drawDefaultBackground();
|
| 77 | }
|
| 78 |
|
| 79 | /**
|
| 80 | * Returns true if this GUI should pause the game when it is displayed in single-player
|
| 81 | */
|
| 82 | public boolean doesGuiPauseGame()
|
| 83 | {
|
| 84 | return super.doesGuiPauseGame();
|
| 85 | }
|
| 86 |
|
| 87 | public void drawWorldBackground(int tint)
|
| 88 | {
|
| 89 | super.drawWorldBackground(tint);
|
| 90 | }
|
| 91 |
|
| 92 | /**
|
| 93 | * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
|
| 94 | */
|
| 95 | public void drawScreen(int mouseX, int mouseY, float partialTicks)
|
| 96 | {
|
| 97 | this.field_154330_a.render(mouseX, mouseY, partialTicks);
|
| 98 | }
|
| 99 |
|
| 100 | public void renderToolTip(ItemStack stack, int x, int y)
|
| 101 | {
|
| 102 | super.renderToolTip(stack, x, y);
|
| 103 | }
|
| 104 |
|
| 105 | /**
|
| 106 | * Draws the text when mouse is over creative inventory tab. Params: current creative tab to be checked, current
|
| 107 | * mouse x position, current mouse y position.
|
| 108 | */
|
| 109 | public void drawCreativeTabHoveringText(String tabName, int mouseX, int mouseY)
|
| 110 | {
|
| 111 | super.drawCreativeTabHoveringText(tabName, mouseX, mouseY);
|
| 112 | }
|
| 113 |
|
| 114 | /**
|
| 115 | * Draws a List of strings as a tooltip. Every entry is drawn on a seperate line.
|
| 116 | */
|
| 117 | public void drawHoveringText(List<String> textLines, int x, int y)
|
| 118 | {
|
| 119 | super.drawHoveringText(textLines, x, y);
|
| 120 | }
|
| 121 |
|
| 122 | /**
|
| 123 | * Called from the main game loop to update the screen.
|
| 124 | */
|
| 125 | public void updateScreen()
|
| 126 | {
|
| 127 | this.field_154330_a.tick();
|
| 128 | super.updateScreen();
|
| 129 | }
|
| 130 |
|
| 131 | public int func_154329_h()
|
| 132 | {
|
| 133 | return this.fontRendererObj.FONT_HEIGHT;
|
| 134 | }
|
| 135 |
|
| 136 | public int func_154326_c(String p_154326_1_)
|
| 137 | {
|
| 138 | return this.fontRendererObj.getStringWidth(p_154326_1_);
|
| 139 | }
|
| 140 |
|
| 141 | public void func_154319_c(String p_154319_1_, int p_154319_2_, int p_154319_3_, int p_154319_4_)
|
| 142 | {
|
| 143 | this.fontRendererObj.drawStringWithShadow(p_154319_1_, (float)p_154319_2_, (float)p_154319_3_, p_154319_4_);
|
| 144 | }
|
| 145 |
|
| 146 | public List<String> func_154323_a(String p_154323_1_, int p_154323_2_)
|
| 147 | {
|
| 148 | return this.fontRendererObj.listFormattedStringToWidth(p_154323_1_, p_154323_2_);
|
| 149 | }
|
| 150 |
|
| 151 | /**
|
| 152 | * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
|
| 153 | */
|
| 154 | public final void actionPerformed(GuiButton button) throws IOException
|
| 155 | {
|
| 156 | this.field_154330_a.buttonClicked(((GuiButtonRealmsProxy)button).getRealmsButton());
|
| 157 | }
|
| 158 |
|
| 159 | public void func_154324_i()
|
| 160 | {
|
| 161 | super.buttonList.clear();
|
| 162 | }
|
| 163 |
|
| 164 | public void func_154327_a(RealmsButton p_154327_1_)
|
| 165 | {
|
| 166 | super.buttonList.add(p_154327_1_.getProxy());
|
| 167 | }
|
| 168 |
|
| 169 | public List<RealmsButton> func_154320_j()
|
| 170 | {
|
| 171 | List<RealmsButton> list = Lists.<RealmsButton>newArrayListWithExpectedSize(super.buttonList.size());
|
| 172 |
|
| 173 | for (GuiButton guibutton : super.buttonList)
|
| 174 | {
|
| 175 | list.add(((GuiButtonRealmsProxy)guibutton).getRealmsButton());
|
| 176 | }
|
| 177 |
|
| 178 | return list;
|
| 179 | }
|
| 180 |
|
| 181 | public void func_154328_b(RealmsButton p_154328_1_)
|
| 182 | {
|
| 183 | super.buttonList.remove(p_154328_1_.getProxy());
|
| 184 | }
|
| 185 |
|
| 186 | /**
|
| 187 | * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
|
| 188 | */
|
| 189 | public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
|
| 190 | {
|
| 191 | this.field_154330_a.mouseClicked(mouseX, mouseY, mouseButton);
|
| 192 | super.mouseClicked(mouseX, mouseY, mouseButton);
|
| 193 | }
|
| 194 |
|
| 195 | /**
|
| 196 | * Handles mouse input.
|
| 197 | */
|
| 198 | public void handleMouseInput() throws IOException
|
| 199 | {
|
| 200 | this.field_154330_a.mouseEvent();
|
| 201 | super.handleMouseInput();
|
| 202 | }
|
| 203 |
|
| 204 | /**
|
| 205 | * Handles keyboard input.
|
| 206 | */
|
| 207 | public void handleKeyboardInput() throws IOException
|
| 208 | {
|
| 209 | this.field_154330_a.keyboardEvent();
|
| 210 | super.handleKeyboardInput();
|
| 211 | }
|
| 212 |
|
| 213 | /**
|
| 214 | * Called when a mouse button is released. Args : mouseX, mouseY, releaseButton
|
| 215 | */
|
| 216 | public void mouseReleased(int mouseX, int mouseY, int state)
|
| 217 | {
|
| 218 | this.field_154330_a.mouseReleased(mouseX, mouseY, state);
|
| 219 | }
|
| 220 |
|
| 221 | /**
|
| 222 | * Called when a mouse button is pressed and the mouse is moved around. Parameters are : mouseX, mouseY,
|
| 223 | * lastButtonClicked & timeSinceMouseClick.
|
| 224 | */
|
| 225 | public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick)
|
| 226 | {
|
| 227 | this.field_154330_a.mouseDragged(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
|
| 228 | }
|
| 229 |
|
| 230 | /**
|
| 231 | * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
|
| 232 | * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
|
| 233 | */
|
| 234 | public void keyTyped(char typedChar, int keyCode) throws IOException
|
| 235 | {
|
| 236 | this.field_154330_a.keyPressed(typedChar, keyCode);
|
| 237 | }
|
| 238 |
|
| 239 | public void confirmClicked(boolean result, int id)
|
| 240 | {
|
| 241 | this.field_154330_a.confirmResult(result, id);
|
| 242 | }
|
| 243 |
|
| 244 | /**
|
| 245 | * Called when the screen is unloaded. Used to disable keyboard repeat events
|
| 246 | */
|
| 247 | public void onGuiClosed()
|
| 248 | {
|
| 249 | this.field_154330_a.removed();
|
| 250 | super.onGuiClosed();
|
| 251 | }
|
| 252 | }
|
| 253 |
|