Ejemplo n.º 1
0
  public void saveNeedle(ItemStack needle) {
    Debug.debug("Saving Needle Data");
    RPStorageData data = getData();

    if (needle == null || needle.getType().equals(Material.AIR)) {
      data.setNeedle(RPNeedle.NONE.id());
    } else {
      Needle n = (Needle) (new SpoutItemStack(needle)).getMaterial();
      data.setNeedle(n.getNeedleType().id());
    }

    JukeIt.getInstance().getDatabase().save(data);
    RecordPlayer.stopMusic(block.getLocation(), RPNeedle.getById(data.getNeedle()), false);
    RecordPlayer.updateBlockDesign(block, data);
  }
Ejemplo n.º 2
0
  public RecordPlayerGUI(SpoutPlayer player, SpoutBlock block) {

    this.player = player;
    this.block = block;

    GenericTexture border = new GenericTexture("machinegui.png");
    border.setX(-88).setY(-83);
    border.setPriority(RenderPriority.Highest);
    border.setWidth(176).setHeight(166);
    border.setFixed(true);
    border.setAnchor(WidgetAnchor.CENTER_CENTER);

    recordSlot = new RecordSlot(this);
    recordSlot.setX(19).setY(-34);
    recordSlot.setWidth(16).setHeight(16);
    recordSlot.setPriority(RenderPriority.Normal);
    recordSlot.setFixed(true);
    recordSlot.setAnchor(WidgetAnchor.CENTER_CENTER);

    needleSlot = new NeedleSlot(this);
    needleSlot.setX(-35).setY(-63);
    needleSlot.setWidth(16).setHeight(16);
    needleSlot.setPriority(RenderPriority.Normal);
    needleSlot.setFixed(true);
    needleSlot.setAnchor(WidgetAnchor.CENTER_CENTER);

    // Select button
    PlayButton playButton = new PlayButton(block);
    playButton.setX(-60).setY(-35);
    playButton.setWidth(60).setHeight(20);
    playButton.setPriority(RenderPriority.Normal);
    playButton.setFixed(true);
    playButton.setAnchor(WidgetAnchor.CENTER_CENTER);

    setTransparent(true);
    attachWidgets(JukeIt.getInstance(), border, recordSlot, needleSlot, playButton);

    int xposition = 0;
    int yposition = 58;

    // i know theres some kind of cool math equation to do this, but i cant remember how to figure
    // it out. doin it the cheap way
    for (int i = 0; i < 36; i++) {

      PlayerInventorySlot slot = new PlayerInventorySlot(player, i);
      if (xposition == 9) xposition = 0;
      if (i > 8) yposition = 0;
      if (i > 17) yposition = 18;
      if (i > 26) yposition = 36;

      slot.setY(1 + yposition);
      slot.setX(-80 + (xposition * 18));
      slot.setWidth(16).setHeight(16);
      slot.setPriority(RenderPriority.Normal);
      slot.setFixed(true);
      slot.setAnchor(WidgetAnchor.CENTER_CENTER);

      playerSlots[i] = slot;
      this.attachWidget(JukeIt.getInstance(), playerSlots[i]);

      xposition++;
    }

    updatePlayerSlots();
  }