@Override
 public void writeData(SpoutOutputStream output) throws IOException {
   output.writeInt(x);
   output.writeShort(y);
   output.writeInt(z);
   output.writeShort(blockId);
   output.write(data);
 }
Пример #2
0
  @Override
  public void writeData(SpoutOutputStream output) throws IOException {
    super.writeData(output);
    output.writeInt(stack.getTypeId());
    output.writeShort((short) stack.getAmount());
    output.writeShort(stack.getDurability());
    output.writeInt(depth);
    output.writeBoolean(renderAmount);

    if (stack.hasItemMeta() && stack.getItemMeta().hasDisplayName()) {
      output.writeBoolean(true);
      output.writeString(stack.getItemMeta().getDisplayName());
    } else {
      output.writeBoolean(false);
    }

    if (stack.hasItemMeta() && stack.getItemMeta().hasLore()) {
      output.writeBoolean(true);
      output.writeInt(stack.getItemMeta().getLore().size());
      for (String l : stack.getItemMeta().getLore()) {
        output.writeString(l);
      }
    } else {
      output.writeBoolean(false);
    }

    if (stack.hasItemMeta() && stack.getItemMeta().hasEnchants()) {
      output.writeBoolean(true);
      output.writeInt(stack.getItemMeta().getEnchants().size());
      for (Entry e : stack.getItemMeta().getEnchants().entrySet()) {
        output.writeInt(((Enchantment) e.getKey()).getId());
        output.writeInt((Integer) e.getValue());
      }
    } else {
      output.writeBoolean(false);
    }
  }
 @Override
 public void writeData(SpoutOutputStream output) throws IOException {
   output.writeInt(id);
   output.writeShort(data);
   output.writeString(name);
 }