예제 #1
0
  private void syncDataSlots() {
    RPStorageData data = getData();

    if (data.hasDisc()) {
      ItemStack i = BurnedDisc.createDisc(data);
      if (!recordSlot.getItem().equals(i)) {
        recordSlot.setItem(i);
      }
    } else {
      recordSlot.setItem(new ItemStack(Material.AIR));
    }

    if (!RPNeedle.getById(data.getNeedle()).equals(RPNeedle.NONE)) {
      if (!recordSlot.getItem().equals(RPNeedle.getById(data.getNeedle()).getItem())) {
        needleSlot.setItem(new SpoutItemStack(RPNeedle.getById(data.getNeedle()).getItem(), 1));
      }
    } else {
      needleSlot.setItem(new ItemStack(Material.AIR));
    }
  }
예제 #2
0
  public void saveRecord(ItemStack record) {
    Debug.debug("Saving Record Data");
    RPStorageData data = getData();

    if (record == null || record.getType().equals(Material.AIR)) {
      data = RPStorageData.removeDisc(block);
    } else {
      data = RPStorageData.setDisc(block, record);
    }
    RecordPlayer.stopMusic(block.getLocation(), RPNeedle.getById(data.getNeedle()), false);
    RecordPlayer.updateBlockDesign(block, data);
  }
예제 #3
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);
  }