示例#1
0
 ImmutableMap.Builder<String, Object> serialize(ImmutableMap.Builder<String, Object> builder) {
   super.serialize(builder);
   if (hasEffect()) {
     builder.put(EXPLOSION.BUKKIT, this.effect);
   }
   return builder;
 }
  @Override
  void applyToItem(NBTTagCompound tag) {
    super.applyToItem(tag);

    if (blockEntityTag != null) {
      tag.set(BLOCK_ENTITY_TAG.NBT, blockEntityTag);
    }
  }
示例#3
0
  CraftMetaBook(Map<String, Object> map) {
    super(map);

    setAuthor(SerializableMeta.getString(map, BOOK_AUTHOR.BUKKIT, true));

    setTitle(SerializableMeta.getString(map, BOOK_TITLE.BUKKIT, true));

    Iterable<?> pages = SerializableMeta.getObject(Iterable.class, map, BOOK_PAGES.BUKKIT, true);
    CraftMetaItem.safelyAdd(pages, this.pages, MAX_PAGE_LENGTH);
  }
示例#4
0
  @Override
  Builder<String, Object> serialize(Builder<String, Object> builder) {
    super.serialize(builder);

    if (hasCustomEffects()) {
      builder.put(POTION_EFFECTS.BUKKIT, ImmutableList.copyOf(this.customEffects));
    }

    return builder;
  }
示例#5
0
  @Override
  void applyToItem(NBTTagCompound itemData) {
    super.applyToItem(itemData);

    if (hasTitle()) {
      itemData.setString(BOOK_TITLE.NBT, this.title);
    }

    if (hasAuthor()) {
      itemData.setString(BOOK_AUTHOR.NBT, this.author);
    }

    if (hasPages()) {
      itemData.set(BOOK_PAGES.NBT, createStringList(pages, BOOK_PAGES));
    }
  }
示例#6
0
  @Override
  void applyToItem(NBTTagCompound tag) {
    super.applyToItem(tag);
    if (hasCustomEffects()) {
      NBTTagList effectList = new NBTTagList();
      tag.set(POTION_EFFECTS.NBT, effectList);

      for (PotionEffect effect : customEffects) {
        NBTTagCompound effectData = new NBTTagCompound();
        effectData.setByte(ID.NBT, (byte) effect.getType().getId());
        effectData.setByte(AMPLIFIER.NBT, (byte) effect.getAmplifier());
        effectData.setInt(DURATION.NBT, effect.getDuration());
        effectData.setBoolean(AMBIENT.NBT, effect.isAmbient());
        effectList.add(effectData);
      }
    }
  }
示例#7
0
  @Override
  Builder<String, Object> serialize(Builder<String, Object> builder) {
    super.serialize(builder);

    if (hasTitle()) {
      builder.put(BOOK_TITLE.BUKKIT, title);
    }

    if (hasAuthor()) {
      builder.put(BOOK_AUTHOR.BUKKIT, author);
    }

    if (hasPages()) {
      builder.put(BOOK_PAGES.BUKKIT, pages);
    }

    return builder;
  }
示例#8
0
 public void setPages(List<String> pages) {
   this.pages.clear();
   CraftMetaItem.safelyAdd(pages, this.pages, MAX_PAGE_LENGTH);
 }
 @Override
 ImmutableMap.Builder<String, Object> serialize(ImmutableMap.Builder<String, Object> builder) {
   super.serialize(builder);
   builder.put("blockMaterial", material.name());
   return builder;
 }
示例#10
0
 void applyToItem(NBTTagCompound itemTag) {
   super.applyToItem(itemTag);
   if (hasEffect()) {
     itemTag.set(EXPLOSION.NBT, CraftMetaFirework.getExplosion(this.effect));
   }
 }