本文整理汇总了Java中net.minecraft.server.NBTTagString类的典型用法代码示例。如果您正苦于以下问题:Java NBTTagString类的具体用法?Java NBTTagString怎么用?Java NBTTagString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NBTTagString类属于net.minecraft.server包,在下文中一共展示了NBTTagString类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyToItem
import net.minecraft.server.NBTTagString; //导入依赖的package包/类
@Overridden
void applyToItem(NBTTagCompound itemTag) {
if (hasDisplayName()) {
setDisplayTag(itemTag, NAME.NBT, new NBTTagString(displayName));
}
if (hasLore()) {
setDisplayTag(itemTag, LORE.NBT, createStringList(lore));
}
applyEnchantments(enchantments, itemTag, ENCHANTMENTS);
if (hasRepairCost()) {
itemTag.setInt(REPAIR.NBT, repairCost);
}
if (attributes != null) {
itemTag.set(ATTRIBUTES.NBT, attributes);
}
}
示例2: applyToItem
import net.minecraft.server.NBTTagString; //导入依赖的package包/类
@Overridden
void applyToItem(NBTTagCompound itemTag) {
if (hasDisplayName()) {
setDisplayTag(itemTag, NAME.NBT, new NBTTagString(displayName));
}
if (hasLore()) {
setDisplayTag(itemTag, LORE.NBT, createStringList(lore));
}
if (hideFlag != 0) {
itemTag.setInt(HIDEFLAGS.NBT, hideFlag);
}
applyEnchantments(enchantments, itemTag, ENCHANTMENTS);
if (hasRepairCost()) {
itemTag.setInt(REPAIR.NBT, repairCost);
}
for (Map.Entry<String, NBTBase> e : unhandledTags.entrySet()) {
itemTag.set(e.getKey(), e.getValue());
}
}
示例3: applyToItem
import net.minecraft.server.NBTTagString; //导入依赖的package包/类
@Overridden
void applyToItem(NBTTagCompound itemTag) {
if (hasDisplayName()) {
setDisplayTag(itemTag, NAME.NBT, new NBTTagString(NAME.NBT, displayName));
}
if (hasLore()) {
setDisplayTag(itemTag, LORE.NBT, createStringList(lore, LORE));
}
applyEnchantments(enchantments, itemTag, ENCHANTMENTS);
if (hasRepairCost()) {
itemTag.setInt(REPAIR.NBT, repairCost);
}
if (attributes != null) {
itemTag.set(ATTRIBUTES.NBT, attributes);
}
}
示例4: CraftMetaBook
import net.minecraft.server.NBTTagString; //导入依赖的package包/类
CraftMetaBook(NBTTagCompound tag) {
super(tag);
if (tag.hasKey(BOOK_TITLE.NBT)) {
this.title = tag.getString(BOOK_TITLE.NBT);
}
if (tag.hasKey(BOOK_AUTHOR.NBT)) {
this.author = tag.getString(BOOK_AUTHOR.NBT);
}
if (tag.hasKey(BOOK_PAGES.NBT)) {
NBTTagList pages = tag.getList(BOOK_PAGES.NBT);
String[] pageArray = new String[pages.size()];
for (int i = 0; i < pages.size(); i++) {
String page = ((NBTTagString) pages.get(i)).data;
pageArray[i] = page;
}
addPage(pageArray);
}
}
示例5: CraftMetaItem
import net.minecraft.server.NBTTagString; //导入依赖的package包/类
CraftMetaItem(NBTTagCompound tag) {
if (tag.hasKey(DISPLAY.NBT)) {
NBTTagCompound display = tag.getCompound(DISPLAY.NBT);
if (display.hasKey(NAME.NBT)) {
displayName = display.getString(NAME.NBT);
}
if (display.hasKey(LORE.NBT)) {
NBTTagList list = display.getList(LORE.NBT);
lore = new ArrayList<String>(list.size());
for (int index = 0; index < list.size(); index++) {
String line = ((NBTTagString) list.get(index)).data;
lore.add(line);
}
}
}
this.enchantments = buildEnchantments(tag, ENCHANTMENTS);
if (tag.hasKey(REPAIR.NBT)) {
repairCost = tag.getInt(REPAIR.NBT);
}
}
示例6: applyToItem
import net.minecraft.server.NBTTagString; //导入依赖的package包/类
@Overridden
void applyToItem(NBTTagCompound itemTag) {
if (hasDisplayName()) {
setDisplayTag(itemTag, NAME.NBT, new NBTTagString(NAME.NBT, displayName));
}
if (hasLore()) {
setDisplayTag(itemTag, LORE.NBT, createStringList(lore, LORE));
}
applyEnchantments(enchantments, itemTag, ENCHANTMENTS);
if (hasRepairCost()) {
itemTag.setInt(REPAIR.NBT, repairCost);
}
}
示例7: createStringList
import net.minecraft.server.NBTTagString; //导入依赖的package包/类
static NBTTagList createStringList(List<String> list) {
if (list == null || list.isEmpty()) {
return null;
}
NBTTagList tagList = new NBTTagList();
for (String value : list) {
tagList.add(new NBTTagString(value));
}
return tagList;
}
示例8: applyToItem
import net.minecraft.server.NBTTagString; //导入依赖的package包/类
@Override
void applyToItem(NBTTagCompound itemData) {
super.applyToItem(itemData, false);
if (hasTitle()) {
itemData.setString(BOOK_TITLE.NBT, this.title);
} else {
itemData.setString(BOOK_TITLE.NBT, " ");
}
if (hasAuthor()) {
itemData.setString(BOOK_AUTHOR.NBT, this.author);
} else {
itemData.setString(BOOK_AUTHOR.NBT, " ");
}
if (hasPages()) {
NBTTagList list = new NBTTagList();
for (IChatBaseComponent page : pages) {
list.add(new NBTTagString(
ChatSerializer.a(page)
));
}
itemData.set(BOOK_PAGES.NBT, list);
}
itemData.setBoolean(RESOLVED.NBT, true);
if (generation != null) {
itemData.setInt(GENERATION.NBT, generation);
} else {
itemData.setInt(GENERATION.NBT, 0);
}
}
示例9: applyToItem
import net.minecraft.server.NBTTagString; //导入依赖的package包/类
void applyToItem(NBTTagCompound itemData, boolean handlePages) {
super.applyToItem(itemData);
if (hasTitle()) {
itemData.setString(BOOK_TITLE.NBT, this.title);
}
if (hasAuthor()) {
itemData.setString(BOOK_AUTHOR.NBT, this.author);
}
if (handlePages) {
if (hasPages()) {
NBTTagList list = new NBTTagList();
for (IChatBaseComponent page : pages) {
list.add(new NBTTagString(CraftChatMessage.fromComponent(page)));
}
itemData.set(BOOK_PAGES.NBT, list);
}
itemData.remove(RESOLVED.NBT);
}
if (generation != null) {
itemData.setInt(GENERATION.NBT, generation);
}
}
示例10: createStringList
import net.minecraft.server.NBTTagString; //导入依赖的package包/类
static NBTTagList createStringList(List<String> list, ItemMetaKey key) {
if (list == null || list.isEmpty()) {
return null;
}
NBTTagList tagList = new NBTTagList(key.NBT);
for (String value : list) {
tagList.add(new NBTTagString("", value));
}
return tagList;
}
示例11: applyToItem
import net.minecraft.server.NBTTagString; //导入依赖的package包/类
@Overridden
void applyToItem(NBTTagCompound itemTag) {
if (hasDisplayName()) {
setDisplayTag(itemTag, NAME.NBT, new NBTTagString(displayName));
}
if (hasLore()) {
setDisplayTag(itemTag, LORE.NBT, createStringList(lore));
}
if (hideFlag != 0) {
itemTag.setInt(HIDEFLAGS.NBT, hideFlag);
}
applyEnchantments(enchantments, itemTag, ENCHANTMENTS);
// Spigot start
if ( spigot.isUnbreakable() )
{
itemTag.setBoolean( UNBREAKABLE.NBT, true );
}
// Spigot end
if (hasRepairCost()) {
itemTag.setInt(REPAIR.NBT, repairCost);
}
for (Map.Entry<String, NBTBase> e : unhandledTags.entrySet()) {
itemTag.set(e.getKey(), e.getValue());
}
}