Java Code Examples for net.minecraft.client.gui.ScaledResolution#getScaledWidth()
The following examples show how to use
net.minecraft.client.gui.ScaledResolution#getScaledWidth() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfigValues.java From SkyblockAddons with MIT License | 6 votes |
public void setClosestAnchorPoint(Feature feature) { float x1 = getActualX(feature); float y1 = getActualY(feature); ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); int maxX = sr.getScaledWidth(); int maxY = sr.getScaledHeight(); double shortestDistance = -1; EnumUtils.AnchorPoint closestAnchorPoint = EnumUtils.AnchorPoint.BOTTOM_MIDDLE; // default for (EnumUtils.AnchorPoint point : EnumUtils.AnchorPoint.values()) { double distance = Point2D.distance(x1, y1, point.getX(maxX), point.getY(maxY)); if (shortestDistance == -1 || distance < shortestDistance) { closestAnchorPoint = point; shortestDistance = distance; } } if (this.getAnchorPoint(feature) == closestAnchorPoint) { return; } float targetX = getActualX(feature); float targetY = getActualY(feature); float x = targetX-closestAnchorPoint.getX(maxX); float y = targetY-closestAnchorPoint.getY(maxY); anchorPoints.put(feature, closestAnchorPoint); setCoords(feature, x, y); }
Example 2
Source File: DisplayElementConfig.java From Hyperium with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void updateScreen() { ScaledResolution current = ResolutionUtil.current(); if (current.getScaledWidth() != lastWidth || current.getScaledHeight() != lastHeight) { repack(); lastWidth = current.getScaledWidth(); lastHeight = current.getScaledHeight(); } if (element.isRGB()) element.recalculateColor(); buttonList.forEach(guiButton -> { Consumer<GuiButton> guiButtonConsumer = updates.get(guiButton); if (guiButtonConsumer != null) guiButtonConsumer.accept(guiButton); }); }
Example 3
Source File: SimpleWindow.java From ehacks-pro with GNU General Public License v3.0 | 6 votes |
public void windowDragged(int x, int y) { if (!dragging) { return; } this.xPos = this.prevXPos + (x - this.dragX); this.yPos = this.prevYPos + (y - this.dragY); ScaledResolution res = new ScaledResolution(Wrapper.INSTANCE.mc(), Wrapper.INSTANCE.mc().displayWidth, Wrapper.INSTANCE.mc().displayHeight); if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { if (this.xPos < 20) { this.xPos = 2; } if (this.yPos < 20) { this.yPos = 2; } if (this.xPos + this.width > res.getScaledWidth() - 20) { this.xPos = res.getScaledWidth() - this.width - 2; } if (this.yPos + this.height > res.getScaledHeight() - 20) { this.yPos = res.getScaledHeight() - this.height - 2; } } }
Example 4
Source File: TacoCmd.java From ForgeWurst with GNU General Public License v3.0 | 6 votes |
@SubscribeEvent public void onRenderGUI(RenderGameOverlayEvent.Post event) { if(event.getType() != ElementType.ALL || mc.gameSettings.showDebugInfo) return; if(wurst.getHax().rainbowUiHack.isEnabled()) { float[] acColor = wurst.getGui().getAcColor(); GL11.glColor4f(acColor[0], acColor[1], acColor[2], 1); }else GL11.glColor4f(1, 1, 1, 1); int tacoId = WMinecraft.getPlayer().ticksExisted % 32 / 8; ResourceLocation tacoLocation = tacos[tacoId]; mc.getTextureManager().bindTexture(tacoLocation); ScaledResolution sr = new ScaledResolution(mc); int x = sr.getScaledWidth() / 2 + 44; int y = sr.getScaledHeight() - 51; int w = 64; int h = 32; Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, w, h, w, h); }
Example 5
Source File: HyperiumOverlay.java From Hyperium with GNU Lesser General Public License v3.0 | 6 votes |
public void handleMouseInput() { ScaledResolution sr = ResolutionUtil.current(); int sw = sr.getScaledWidth(); int sh = sr.getScaledHeight(); int mx = Mouse.getX() * sw / Minecraft.getMinecraft().displayWidth; int my = sh - Mouse.getY() * sh / Minecraft.getMinecraft().displayHeight - 1; Integer[] counter = new Integer[]{0}; components.forEach(c -> c.handleMouseInput(mx, my, sr.getScaledWidth() / 6 * 2, sr.getScaledHeight() / 4 + 20 * counter[0]++ + offsetY, sr.getScaledWidth() / 6 * 2, 20)); int i = Mouse.getEventDWheel(); if (i > 0 && offsetY != 0) offsetY += 5; else if (i < 0) offsetY -= 5; }
Example 6
Source File: VanillaEnhancementsHud.java From Hyperium with GNU Lesser General Public License v3.0 | 6 votes |
@InvokeEvent public void renderDamage(RenderHUDEvent e) { if (Settings.DAMAGE_ABOVE_HOTBAR) { ItemStack heldItemStack = mc.thePlayer.inventory.getCurrentItem(); if (heldItemStack != null) { GL11.glPushMatrix(); GL11.glScalef(0.5f, 0.5f, 0.5f); ScaledResolution res = ResolutionUtil.current(); String attackDamage = getAttackDamageString(heldItemStack); int y = res.getScaledHeight() - 59; y += (mc.playerController.shouldDrawHUD() ? -1 : 14); y = y + mc.fontRendererObj.FONT_HEIGHT; y <<= 1; y += mc.fontRendererObj.FONT_HEIGHT; int x = res.getScaledWidth() - (mc.fontRendererObj.getStringWidth(attackDamage) >> 1); mc.fontRendererObj.drawString(attackDamage, x, y, 13421772); GL11.glScalef(2.0f, 2.0f, 2.0f); GL11.glPopMatrix(); } } }
Example 7
Source File: VanillaEnhancementsHud.java From Hyperium with GNU Lesser General Public License v3.0 | 6 votes |
@InvokeEvent public void renderEnchantments(RenderHUDEvent e) { if (Settings.ENCHANTMENTS_ABOVE_HOTBAR) { ItemStack heldItemStack = mc.thePlayer.inventory.getCurrentItem(); if (heldItemStack != null) { String toDraw = heldItemStack.getItem() instanceof ItemPotion ? getPotionEffectString(heldItemStack) : getEnchantmentString(heldItemStack); GL11.glPushMatrix(); GL11.glScalef(0.5f, 0.5f, 0.5f); ScaledResolution res = ResolutionUtil.current(); int y = res.getScaledHeight() - 59; y += (mc.playerController.shouldDrawHUD() ? -2 : 14); y = y + mc.fontRendererObj.FONT_HEIGHT; y <<= 1; int x = res.getScaledWidth() - (mc.fontRendererObj.getStringWidth(toDraw) >> 1); mc.fontRendererObj.drawString(toDraw, x, y, 13421772); GL11.glScalef(2.0f, 2.0f, 2.0f); GL11.glPopMatrix(); } } }
Example 8
Source File: HudElementBase.java From Cyberware with MIT License | 6 votes |
@Override public void render(EntityPlayer player, ScaledResolution resolution, boolean hudjackAvailable, boolean isConfigOpen, float partialTicks) { int x = getX(); int y = getY(); if (getHorizontalAnchor() == EnumAnchorHorizontal.RIGHT) { x = resolution.getScaledWidth() - x - getWidth(); } if (getVerticalAnchor() == EnumAnchorVertical.BOTTOM) { y = resolution.getScaledHeight() - y - getHeight(); } renderElement(x, y, player, resolution, hudjackAvailable, isConfigOpen, partialTicks); }
Example 9
Source File: MixinGuiOverlayDebug.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
private void renderOldDebugInfoRight(ScaledResolution scaledResolution) { int scaledWidth = scaledResolution.getScaledWidth(); FontRenderer fontRendererObj = mc.fontRendererObj; long maxMemory = Runtime.getRuntime().maxMemory(); long totalMemory = Runtime.getRuntime().totalMemory(); long freeMemory = Runtime.getRuntime().freeMemory(); long usedMemory = totalMemory - freeMemory; String memoryStr = "Used memory: " + usedMemory * 100L / maxMemory + "% (" + usedMemory / 1024L / 1024L + "MB) of " + maxMemory / 1024L / 1024L + "MB"; fontRendererObj.drawStringWithShadow(memoryStr, scaledWidth - fontRendererObj.getStringWidth(memoryStr) - 2, 2, -1); memoryStr = "Allocated memory: " + totalMemory * 100L / maxMemory + "% (" + totalMemory / 1024L / 1024L + "MB)"; fontRendererObj.drawStringWithShadow(memoryStr, scaledWidth - fontRendererObj.getStringWidth(memoryStr) - 2, 12, -1); String versionString = "Hyperium " + Metadata.getVersion(); fontRendererObj.drawStringWithShadow(versionString, scaledWidth - fontRendererObj.getStringWidth(versionString) - 2, 22, -1); }
Example 10
Source File: SplashProgress.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
/** * Render the progress bar and text */ private static void drawProgress() { if (Minecraft.getMinecraft().gameSettings == null || Minecraft.getMinecraft().getTextureManager() == null) return; // Declare the font to be used if (raleway == null) raleway = new HyperiumFontRenderer("Raleway", 20); if (roboto == null) roboto = new HyperiumFontRenderer("Roboto", 20); // Get the users screen width and height to apply ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); // Calculate the progress bar double nProgress = PROGRESS; double calc = (nProgress / DEFAULT_MAX) * sr.getScaledWidth(); // Draw the transparent bar before the green bar Gui.drawRect(0, sr.getScaledHeight() - 35, sr.getScaledWidth(), sr.getScaledHeight(), new Color(0, 0, 0, 50).getRGB()); // Draw the current splash text raleway.drawString(CURRENT, 20, sr.getScaledHeight() - 25, 0xffffffff); // Draw the current amount of progress / max amount of progress String s = PROGRESS + "/" + DEFAULT_MAX; roboto.drawString(s, sr.getScaledWidth() - 20 - roboto.getWidth(s), sr.getScaledHeight() - 25, 0xe1e1e1ff); // Render the blue progress bar Gui.drawRect(0, sr.getScaledHeight() - 2, (int) calc, sr.getScaledHeight(), new Color(3, 169, 244).getRGB()); // Render the bar base Gui.drawRect(0, sr.getScaledHeight() - 2, sr.getScaledWidth(), sr.getScaledHeight(), new Color(0, 0, 0, 10).getRGB()); }
Example 11
Source File: EntityTrackUpgradeHandler.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override @SideOnly(Side.CLIENT) public GuiAnimatedStat getAnimatedStat(){ if(entityTrackInfo == null) { Minecraft minecraft = Minecraft.getMinecraft(); ScaledResolution sr = new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight); entityTrackInfo = new GuiAnimatedStat(null, "Current tracked entities:", new ItemStack(Itemss.machineUpgrade, 1, ItemMachineUpgrade.UPGRADE_ENTITY_TRACKER), statX != -1 ? statX : sr.getScaledWidth() - 2, statY, 0x3000AA00, null, statLeftSided); entityTrackInfo.setMinDimensionsAndReset(0, 0); } return entityTrackInfo; }
Example 12
Source File: VanillaEnhancementsHud.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
@InvokeEvent public void renderHotbarNumbers(RenderHUDEvent event) { if (Settings.HOTBAR_KEYS) { ScaledResolution resolution = ResolutionUtil.current(); int x = resolution.getScaledWidth() / 2 - 87; int y = resolution.getScaledHeight() - 18; int[] hotbarKeys = getHotbarKeys(); for (int slot = 0; slot < 9; slot++) { mc.fontRendererObj.drawString(getKeyString(hotbarKeys[slot]), x + slot * 20, y, -1); } } }
Example 13
Source File: GuiPneumaticContainerBase.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
protected void refreshScreen(){ ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); int i = scaledresolution.getScaledWidth(); int j = scaledresolution.getScaledHeight(); setWorldAndResolution(Minecraft.getMinecraft(), i, j); for(IGuiWidget widget : widgets) { if(widget instanceof GuiAnimatedStat) { widget.update(); } } }
Example 14
Source File: BlockTrackUpgradeHandler.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public GuiAnimatedStat getAnimatedStat(){ if(blockTrackInfo == null) { Minecraft minecraft = Minecraft.getMinecraft(); ScaledResolution sr = new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight); blockTrackInfo = new GuiAnimatedStat(null, "Current tracked blocks:", new ItemStack(Itemss.machineUpgrade, 1, ItemMachineUpgrade.UPGRADE_BLOCK_TRACKER), statX != -1 ? statX : sr.getScaledWidth() - 2, statY, 0x3000AA00, null, statLeftSided); blockTrackInfo.setMinDimensionsAndReset(0, 0); } return blockTrackInfo; }
Example 15
Source File: TileEntityShipHelm.java From Valkyrien-Skies with Apache License 2.0 | 5 votes |
@SideOnly(Side.CLIENT) @Override public void renderPilotText(FontRenderer renderer, ScaledResolution gameResolution) { // White text. int color = 0xFFFFFF; // Extra spaces so the that the text is closer to the middle when rendered. String message = "Wheel Rotation: "; int i = gameResolution.getScaledWidth(); int height = gameResolution.getScaledHeight() - 35; float middle = (float) (i / 2 - renderer.getStringWidth(message) / 2); message = "Wheel Rotation: " + Math.round(wheelRotation); renderer.drawStringWithShadow(message, middle, height, color); }
Example 16
Source File: HackButton.java From ForgeWurst with GNU General Public License v3.0 | 4 votes |
@Override public void handleMouseClick(int mouseX, int mouseY, int mouseButton) { if(mouseButton != 0) return; if(!hack.getSettings().isEmpty() && mouseX > getX() + getWidth() - 12) { if(settingsWindow != null && !settingsWindow.isClosing()) { settingsWindow.close(); settingsWindow = null; return; } settingsWindow = new Window(hack.getName() + " Settings"); for(Setting setting : hack.getSettings().values()) settingsWindow.add(setting.getComponent()); settingsWindow.setClosable(true); settingsWindow.setMinimizable(false); settingsWindow.pack(); int scroll = getParent().isScrollingEnabled() ? getParent().getScrollOffset() : 0; int x = getParent().getX() + getParent().getWidth() + 5; int y = getParent().getY() + 12 + getY() + scroll; ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); if(x + settingsWindow.getWidth() > sr.getScaledWidth()) x = getParent().getX() - settingsWindow.getWidth() - 5; if(y + settingsWindow.getHeight() > sr.getScaledHeight()) y -= settingsWindow.getHeight() - 14; settingsWindow.setX(x); settingsWindow.setY(y); ClickGui gui = ForgeWurst.getForgeWurst().getGui(); gui.addWindow(settingsWindow); return; } hack.setEnabled(!hack.isEnabled()); }
Example 17
Source File: ConfirmationPopup.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
public boolean render() { if (framesLeft <= 0) return true; if (text.equalsIgnoreCase("Party request from " + acceptFrom)) { callback.accept(true); return true; } while (systemTime < Minecraft.getSystemTime() + (1000 / 60)) { framesLeft--; systemTime += (1000 / 60); } percentComplete = HyperiumGui.clamp( HyperiumGui.easeOut( percentComplete, framesLeft < lowerThreshold ? 0.0f : framesLeft > upperThreshold ? 1.0f : framesLeft, 0.01f, 15f ), 0.0f, 1.0f ); FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); int middle = sr.getScaledWidth() / 2; int halfWidth = 105; int currWidth = (int) (halfWidth * percentComplete); // Background Gui.drawRect( middle - currWidth, 50, middle + currWidth, 95, new Color(27, 27, 27).getRGB() ); if (percentComplete == 1.0F) { long length = upperThreshold - lowerThreshold; long current = framesLeft - lowerThreshold; float progress = 1.0F - HyperiumGui.clamp((float) current / (float) length, 0.0F, 1.0F); // Progress Gui.drawRect( middle - currWidth, 93, (int) (middle - currWidth + (210 * progress)), 95, new Color(128, 226, 126).getRGB() ); fr.drawString(text, sr.getScaledWidth() / 2 - fr.getStringWidth(text) / 2, 58, 0xFFFFFF); String s = ChatColor.GREEN + "[Y] Accept " + ChatColor.RED + "[N] Deny"; fr.drawString(s, sr.getScaledWidth() / 2 - fr.getStringWidth(s) / 2, 70, -1); } return false; }
Example 18
Source File: MixinLoadingScreenRenderer.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
/** * @author ConorTheDev * @reason Custom screen when loading to a new world */ @Inject(method = "setLoadingProgress", at = @At("HEAD"), cancellable = true) private void setLoadingProgress(CallbackInfo ci) { if (Settings.HYPERIUM_LOADING_SCREEN) { long nanoTime = Minecraft.getSystemTime(); if (nanoTime - systemTime >= 100L) { systemTime = nanoTime; ScaledResolution scaledresolution = new ScaledResolution(mc); int scaleFactor = scaledresolution.getScaleFactor(); int scaledWidth = scaledresolution.getScaledWidth(); int scaledHeight = scaledresolution.getScaledHeight(); if (OpenGlHelper.isFramebufferEnabled()) { framebuffer.framebufferClear(); } else { GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT); } framebuffer.bindFramebuffer(false); GlStateManager.matrixMode(GL11.GL_PROJECTION); GlStateManager.loadIdentity(); GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 100.0D, 300.0D); GlStateManager.matrixMode(GL11.GL_MODELVIEW); GlStateManager.loadIdentity(); GlStateManager.translate(0.0F, 0.0F, -200.0F); if (!OpenGlHelper.isFramebufferEnabled()) GlStateManager.clear(16640); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); mc.getTextureManager().bindTexture(new ResourceLocation("textures/world-loading.png")); Gui.drawModalRectWithCustomSizedTexture(0, 0, 0.0f, 0.0f, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight()); int progress; if ("Loading world".equals(currentlyDisplayedText)) { if (message.isEmpty()) { progress = 33; } else if (message.equals("Converting world")) { progress = 66; } else if (message.equals("Building terrain")) { progress = 90; } else { progress = 100; } } else { progress = -1; } if (progress >= 0) { int maxProgress = 100; int barTop = 2; int barHeight = scaledResolution.getScaledHeight() - 15; GlStateManager.disableTexture2D(); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(maxProgress, barHeight, 0.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos(maxProgress, barHeight + barTop, 0.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos(maxProgress + maxProgress, barHeight + barTop, 0.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos(maxProgress + maxProgress, barHeight, 0.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos(maxProgress, barHeight, 0.0D).color(128, 255, 128, 255).endVertex(); worldrenderer.pos(maxProgress, barHeight + barTop, 0.0D).color(128, 255, 128, 255).endVertex(); worldrenderer.pos(maxProgress + progress, barHeight + barTop, 0.0D).color(128, 255, 128, 255).endVertex(); worldrenderer.pos(maxProgress + progress, barHeight, 0.0D).color(128, 255, 128, 255).endVertex(); tessellator.draw(); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); Gui.drawRect(0, scaledResolution.getScaledHeight() - 35, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), new Color(0, 0, 0, 50).getRGB()); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); GlStateManager.enableTexture2D(); } GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); mc.fontRendererObj.drawString(currentlyDisplayedText, 5, scaledResolution.getScaledHeight() - 30, -1); mc.fontRendererObj.drawString(message, 5, scaledResolution.getScaledHeight() - 15, -1); framebuffer.unbindFramebuffer(); if (OpenGlHelper.isFramebufferEnabled()) { framebuffer.framebufferRender(scaledWidth * scaleFactor, scaledHeight * scaleFactor); } mc.updateDisplay(); try { Thread.yield(); } catch (Exception ignored) { } } ci.cancel(); } }
Example 19
Source File: AbstractTab.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
/** * Render - Renders the Tab * * @param x - Given X Position * @param y - Given Y Position * @param width - Given Width * @param height - Given Height */ public void render(int x, int y, int width, int height) { ScaledResolution sr = ResolutionUtil.current(); int sw = sr.getScaledWidth(); int sh = sr.getScaledHeight(); int xg = width / 9; // X grid /* Begin new scissor state */ ScissorState.scissor(x, y, width, height, true); /* Get mouse X and Y */ final int mx = Mouse.getX() * sw / Minecraft.getMinecraft().displayWidth; // Mouse X final int my = sh - Mouse.getY() * sh / Minecraft.getMinecraft().displayHeight - 1; // Mouse Y if (scrollAnim.getValue() != scroll * 18 && scrollAnim.isFinished()) { scrollAnim = new SimpleAnimValue(1000L, scrollAnim.getValue(), scroll * 18); } y += scrollAnim.getValue(); /* Render each tab component */ for (AbstractTabComponent comp : filter == null ? components : components.stream().filter(c -> c.filter(filter)).collect(Collectors.toList())) { comp.render(x, y, width, mx, my); /* If mouse is over component, set as hovered */ if (mx >= x && mx <= x + width && my > y && my <= y + comp.getHeight()) { comp.hover = true; //For slider comp.mouseEvent(mx - xg, my - y /* Make the Y relevant to the component */); if (Mouse.isButtonDown(0)) { if (!clickStates.computeIfAbsent(comp, ignored -> false)) { comp.onClick(mx, my - y /* Make the Y relevant to the component */); clickStates.put(comp, true); } } else if (clickStates.computeIfAbsent(comp, ignored -> false)) clickStates.put(comp, false); } else { comp.hover = false; } y += comp.getHeight(); } /* End scissor state */ ScissorState.endScissor(); }
Example 20
Source File: PurchaseCarousel.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
public void mouseClicked(int x, int y, int centerX) { ScaledResolution current = ResolutionUtil.current(); int totalWidth = current.getScaledWidth() / 3; int panel = totalWidth / 5; int mainWidth = panel * 3; int centerY = current.getScaledHeight() / 2; int leftX = centerX - mainWidth / 2; int rightX = centerX + mainWidth / 2; if (x >= leftX - 8 && x <= leftX && y >= centerY - 5 && y <= centerY + 5) { rotateLeft(); } else if (x >= rightX && x <= rightX + 8 && y >= centerY - 5 && y <= centerY + 5) { rotateRight(); } int objLeft = centerX - mainWidth / 2; int purchaseLeft = objLeft + 5; int purchaseRight = (objLeft + 50); int mainHeight = current.getScaledHeight() / 5 * 3; int objBottom = centerY + mainHeight / 2; int barHeight = 16; int purchaseTop = objBottom - 20; int purchaseBottom = purchaseTop + barHeight; if (x >= purchaseLeft && x <= purchaseRight && y <= purchaseBottom && y >= purchaseTop) { getCurrent().getOnPurchase().accept(getCurrent()); } int settingsLeft = purchaseRight + barHeight / 2; int settingsRight = settingsLeft + barHeight; if (x >= settingsLeft && x <= settingsRight && y <= purchaseBottom && y >= purchaseTop) { getCurrent().getOnSettingsClick().accept(getCurrent()); } if (activeBlock != null && activeBlock.isMouseOver(x, y)) { getCurrent().getOnActivate().accept(getCurrent()); } }