Class StonecutterScreen

All Implemented Interfaces:
ContainerEventHandler, GuiEventListener, Renderable, TabOrderedElement, MenuAccess<StonecutterMenu>

public class StonecutterScreen extends AbstractContainerScreen<StonecutterMenu>
  • Field Details

    • SCROLLER_SPRITE

      private static final ResourceLocation SCROLLER_SPRITE
    • SCROLLER_DISABLED_SPRITE

      private static final ResourceLocation SCROLLER_DISABLED_SPRITE
    • RECIPE_SELECTED_SPRITE

      private static final ResourceLocation RECIPE_SELECTED_SPRITE
    • RECIPE_HIGHLIGHTED_SPRITE

      private static final ResourceLocation RECIPE_HIGHLIGHTED_SPRITE
    • RECIPE_SPRITE

      private static final ResourceLocation RECIPE_SPRITE
    • BG_LOCATION

      private static final ResourceLocation BG_LOCATION
    • SCROLLER_WIDTH

      private static final int SCROLLER_WIDTH
      See Also:
    • SCROLLER_HEIGHT

      private static final int SCROLLER_HEIGHT
      See Also:
    • RECIPES_COLUMNS

      private static final int RECIPES_COLUMNS
      See Also:
    • RECIPES_ROWS

      private static final int RECIPES_ROWS
      See Also:
    • RECIPES_IMAGE_SIZE_WIDTH

      private static final int RECIPES_IMAGE_SIZE_WIDTH
      See Also:
    • RECIPES_IMAGE_SIZE_HEIGHT

      private static final int RECIPES_IMAGE_SIZE_HEIGHT
      See Also:
    • SCROLLER_FULL_HEIGHT

      private static final int SCROLLER_FULL_HEIGHT
      See Also:
    • RECIPES_X

      private static final int RECIPES_X
      See Also:
    • RECIPES_Y

      private static final int RECIPES_Y
      See Also:
    • scrollOffs

      private float scrollOffs
    • scrolling

      private boolean scrolling
      Is true if the player clicked on the scroll wheel in the GUI.
    • startIndex

      private int startIndex
      The index of the first recipe to display. The number of recipes displayed at any time is 12 (4 recipes per row, and 3 rows). If the player scrolled down one row, this value would be 4 (representing the index of the first slot on the second row).
    • displayRecipes

      private boolean displayRecipes
  • Constructor Details

  • Method Details

    • render

      public void render(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick)
      Renders the graphical user interface (GUI) element.
      Specified by:
      render in interface Renderable
      Overrides:
      render in class AbstractContainerScreen<StonecutterMenu>
      Parameters:
      pGuiGraphics - the GuiGraphics object used for rendering.
      pMouseX - the x-coordinate of the mouse cursor.
      pMouseY - the y-coordinate of the mouse cursor.
      pPartialTick - the partial tick time.
    • renderBg

      protected void renderBg(GuiGraphics pGuiGraphics, float pPartialTick, int pMouseX, int pMouseY)
      Specified by:
      renderBg in class AbstractContainerScreen<StonecutterMenu>
    • renderTooltip

      protected void renderTooltip(GuiGraphics pGuiGraphics, int pX, int pY)
      Overrides:
      renderTooltip in class AbstractContainerScreen<StonecutterMenu>
    • renderButtons

      private void renderButtons(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, int pX, int pY, int pLastVisibleElementIndex)
    • renderRecipes

      private void renderRecipes(GuiGraphics pGuiGraphics, int pX, int pY, int pStartIndex)
    • mouseClicked

      public boolean mouseClicked(double pMouseX, double pMouseY, int pButton)
      Called when a mouse button is clicked within the GUI element.

      Specified by:
      mouseClicked in interface ContainerEventHandler
      Specified by:
      mouseClicked in interface GuiEventListener
      Overrides:
      mouseClicked in class AbstractContainerScreen<StonecutterMenu>
      Parameters:
      pMouseX - the X coordinate of the mouse.
      pMouseY - the Y coordinate of the mouse.
      pButton - the button that was clicked.
      Returns:
      true if the event is consumed, false otherwise.
    • mouseDragged

      public boolean mouseDragged(double pMouseX, double pMouseY, int pButton, double pDragX, double pDragY)
      Called when the mouse is dragged within the GUI element.

      Specified by:
      mouseDragged in interface ContainerEventHandler
      Specified by:
      mouseDragged in interface GuiEventListener
      Overrides:
      mouseDragged in class AbstractContainerScreen<StonecutterMenu>
      Parameters:
      pMouseX - the X coordinate of the mouse.
      pMouseY - the Y coordinate of the mouse.
      pButton - the button that is being dragged.
      pDragX - the X distance of the drag.
      pDragY - the Y distance of the drag.
      Returns:
      true if the event is consumed, false otherwise.
    • mouseScrolled

      public boolean mouseScrolled(double pMouseX, double pMouseY, double pScrollX, double pScrollY)
    • isScrollBarActive

      private boolean isScrollBarActive()
    • getOffscreenRows

      protected int getOffscreenRows()
    • containerChanged

      private void containerChanged()