Class ColorPalette

java.lang.Object
com.minecolonies.core.client.gui.ColorPalette

public class ColorPalette extends Object
A custom "widget" of sorts that lays out minecraft's DyeColors as buttons to choose from.
  • Field Details

    • DYES

      public static final net.minecraft.world.item.DyeColor[] DYES
    • BUTTON_SIZE

      public static int BUTTON_SIZE
    • buttons

      protected List<ColorPalette.PaletteButton> buttons
    • selected

      protected net.minecraft.world.item.DyeColor selected
    • onchange

      public ColorPalette.ChangeEvent onchange
  • Constructor Details

    • ColorPalette

      public ColorPalette(int x, int y, int col, ColorPalette.IWidgetAdder adder)
      Parameters:
      x - the x position of the top left button
      y - the y position of the top left button
      col - the number of columns to sort this palette into
      adder - a function to add each button to the calling screen. Call with this::addButton if unsure.
    • ColorPalette

      public ColorPalette(net.minecraft.client.gui.screens.Screen gui, ColorPalette.IWidgetAdder adder)
      A more generic form of the constructor
      Parameters:
      gui - the screen to interact with this color palette
      adder - the function to add the buttons. Likely this::addButton from a Screen
  • Method Details

    • getSelected

      public net.minecraft.world.item.DyeColor getSelected()
    • setSelected

      public void setSelected(net.minecraft.world.item.DyeColor selected)