@Override public void drawScreen(int mouseX, int mouseY, float par3) { boolean flag = Mouse.isButtonDown(0); if (flag) { if (!clicked) { int x = mouseX - guiLeft - 56; int y = mouseY - guiTop - 7; if (0 <= x && x < 130 && 0 <= y && y < 105) { System.out.println(String.format("%d %d", x, y)); int value = scroller.getValue(); int index = ((value + y) / 16) % 16; isMoveGui[index] = !isMoveGui[index]; } clicked = true; } } else { clicked = false; } if (scroller.mouseOver(mouseX, mouseY)) { scroller.scrollTo(flag, mouseX, mouseY); } super.drawScreen(mouseX, mouseY, par3); }
@Override public void handleMouseInput() { super.handleMouseInput(); if (scroller.mouseOver()) { scroller.scrollTo(); } }
@Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { int value = scroller.getValue(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); scroller.drawScrollBar(); // // 56, 7 mc.getTextureManager().bindTexture(texture); for (int y = 0; y < 16; y++) { boolean flag = isMove[y] && isMoveGui[y]; int val = y * 16 - value; if (val < 0 && 0 < val + 16) // 上端 { drawTexturedModalRect( guiLeft + 56, guiTop + 7, 0, 196 + (flag ? 0 : 16) - val, 130, 16 + val); // TODO flagでの描画処理 } else if (0 <= val && val + 16 < 105) { drawTexturedModalRect(guiLeft + 56, guiTop + 7 + val, 0, 196 + (flag ? 0 : 16), 130, 16); // TODO flagでの描画処理 } else if (105 <= val + 16 && val < 105) // 下端 { drawTexturedModalRect( guiLeft + 56, guiTop + 7 + val, 0, 196 + (flag ? 0 : 16), 130, (105 - val)); // TODO flagでの描画処理 } } }
@Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { int value = scroller.getValue(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); isMove = inv.getFlags(); for (int y = 0; y < 16; y++) { boolean flag = isMove[y] && isMoveGui[y]; int val = y * 16 - value; if (-8 <= val && val + 16 < 105 + 16) { // drawTexturedModalRect(guiLeft+56, guiTop+7+val, 0, 196 +(flag?0:24), 130, 24); fontRenderer.drawString(matches[y], 56 + 4, 7 + 4 + val, 0xFFFFFF); } } }