Example #1
0
 @Override
 public void updateScreen() {
   super.updateScreen();
   iconDisplay.setEnabled(
       inventorySlots.getSlot(0).getStack() != null
           && inventorySlots.getSlot(0).isItemValid(inventorySlots.getSlot(0).getStack()));
 }
Example #2
0
  @Override
  public void componentMouseDown(BaseComponent component, int offsetX, int offsetY, int button) {

    Stencil[] stencils = Stencil.values();
    if (component.equals(buttonDraw)) {
      getContainer().getOwner().onRequestStencilCreate(stencils[patternIndex]);
    } else {
      if (component.equals(buttonLeft)) {
        patternIndex--;
        if (patternIndex < 0) {
          patternIndex = stencils.length - 1;
        }
      } else if (component.equals(buttonRight)) {
        patternIndex++;
        patternIndex = patternIndex % stencils.length;
      }
      iconDisplay.setIcon(stencils[patternIndex].getBlockIcon());
    }
  }