Пример #1
0
  @Override
  protected void actionPerformed(GuiButton button) {
    super.actionPerformed(button);

    if (button.id == 0) {
      filler.currentPattern =
          (FillerPattern) FillerManager.registry.getPreviousPattern(filler.currentPattern);
    } else if (button.id == 1) {
      filler.currentPattern =
          (FillerPattern) FillerManager.registry.getNextPattern(filler.currentPattern);
    } else if (button.id == 2) {
      filler.setExcavate(!filler.isExcavate());

      buttonList.set(2, getExcavateButton());

      BuildCraftCore.instance.sendToServer(
          new PacketCommand(
              filler,
              "setFlags",
              new CommandWriter() {
                public void write(ByteBuf data) {
                  data.writeBoolean(filler.isExcavate());
                }
              }));
    }

    filler.rpcSetPatternFromString(filler.currentPattern.getUniqueTag());
  }
Пример #2
0
 private GuiBetterButton getExcavateButton() {
   return new GuiBetterButton(2, guiLeft + 150, guiTop + 30, 16, getExcavateTexture(), "")
       .setToolTip(
           new ToolTip(
               500,
               new ToolTipLine(
                   StatCollector.translateToLocal(
                       "tip.filler.excavate." + (filler.isExcavate() ? "on" : "off")))));
 }
Пример #3
0
 @Override
 public void actionActivate(
     TileEntity target,
     ForgeDirection side,
     IStatementContainer source,
     IStatementParameter[] parameters) {
   if (target instanceof TileFiller) {
     ((TileFiller) target).setPattern(pattern);
     ((TileFiller) target).patternParameters = parameters;
   }
 }
Пример #4
0
  @Override
  protected void mouseClicked(int x, int y, int k) {
    super.mouseClicked(x, y, k);

    AdvancedSlot slot = getSlotAtLocation(x, y);

    if (slot != null) {
      int i = ((FillerParameterSlot) slot).slot;
      if (i < filler.patternParameters.length) {
        if (filler.patternParameters[i] != null) {
          filler.patternParameters[i].onClick(
              filler,
              filler.currentPattern,
              mc.thePlayer.inventory.getItemStack(),
              new StatementMouseClick(k, isShiftKeyDown()));
        } else {
          filler.patternParameters[i] = filler.currentPattern.createParameter(i);
        }
        filler.rpcSetParameter(i, filler.patternParameters[i]);
      }
    }
  }
Пример #5
0
 private IButtonTextureSet getExcavateTexture() {
   return filler.isExcavate() ? EXCAVATE_ON : EXCAVATE_OFF;
 }