use of net.minecraft.nbt.NBTTagString in project Railcraft by Railcraft.
the class InvTools method addItemToolTip.
// @Deprecated
// public static boolean isSynthetic(ItemStack stack) {
// NBTTagCompound nbt = stack.getTagCompound();
// return nbt != null && nbt.hasKey("synthetic");
// }
//
// @SuppressWarnings("unused")
// public static void markItemSynthetic(ItemStack stack) {
// NBTTagCompound nbt = getItemData(stack);
// nbt.setBoolean("synthetic", true);
// NBTTagCompound display = nbt.getCompoundTag("display");
// nbt.setTag("display", display);
// NBTTagList lore = display.getTagList("Lore", 8);
// display.setTag("Lore", lore);
// lore.appendTag(new NBTTagString("\u00a77\u00a7o" + LocalizationPlugin.translate("item.synthetic")));
// }
public static void addItemToolTip(ItemStack stack, String msg) {
NBTTagCompound nbt = getItemData(stack);
NBTTagCompound display = nbt.getCompoundTag("display");
nbt.setTag("display", display);
NBTTagList lore = display.getTagList("Lore", 8);
display.setTag("Lore", lore);
lore.appendTag(new NBTTagString(msg));
}
use of net.minecraft.nbt.NBTTagString in project Railcraft by Railcraft.
the class ItemPost method addInformation.
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flag) {
if (stack.getItemDamage() == EnumPost.EMBLEM.ordinal() && stack.hasTagCompound()) {
NBTTagCompound nbt = stack.getTagCompound();
NBTTagString emblemIdent = (NBTTagString) nbt.getTag("emblem");
if (emblemIdent == null || EmblemToolsClient.packageManager == null)
return;
Emblem emblem = EmblemToolsClient.packageManager.getEmblem(emblemIdent.getString());
if (emblem != null)
tooltip.add(TextFormatting.GRAY + emblem.displayName);
}
}
use of net.minecraft.nbt.NBTTagString in project Railcraft by Railcraft.
the class ItemRoutingTable method getPages.
@Nullable
public static List<List<String>> getPages(ItemStack routingTable) {
if (InvTools.isEmpty(routingTable) || !isRoutingTable(routingTable))
return null;
NBTTagCompound nbt = routingTable.getTagCompound();
if (nbt == null)
return null;
List<NBTTagList> pagesList = NBTPlugin.getNBTList(nbt, "pages", NBTTagList.class);
List<List<String>> contents = new ArrayList<>();
for (NBTTagList pageNBT : pagesList) {
List<NBTTagString> pageList = NBTPlugin.asList(pageNBT);
List<String> page = new ArrayList<>();
contents.add(page);
for (NBTTagString line : pageList) {
page.add(line.getString());
}
}
return contents;
}
use of net.minecraft.nbt.NBTTagString in project Wizardry by TeamWizardry.
the class SpellUtils method deserializeModuleList.
public static List<List<ModuleInstance>> deserializeModuleList(@Nonnull NBTTagList list) {
List<List<ModuleInstance>> modules = new ArrayList<>();
List<ModuleInstance> moduleList = new ArrayList<>();
for (int i = 0; i < list.tagCount(); i++) {
NBTBase base = list.get(i);
if (!(base instanceof NBTTagString))
continue;
NBTTagString string = (NBTTagString) base;
if (string.isEmpty()) {
if (!moduleList.isEmpty())
modules.add(moduleList);
moduleList = new ArrayList<>();
}
ModuleInstance module = ModuleInstance.deserialize(string);
if (module == null)
continue;
moduleList.add(module);
}
if (!moduleList.isEmpty())
modules.add(moduleList);
return modules;
}
use of net.minecraft.nbt.NBTTagString in project Wizardry by TeamWizardry.
the class TileHaloInfuser method updateItems.
public void updateItems(boolean soft) {
NBTTagList slots = NBTHelper.getList(getHalo(), "slots", NBTTagString.class);
if (slots == null || slots.tagCount() < HaloInfusionItemRegistry.getItems().size() - 1) {
slots = new NBTTagList();
for (int i = 0; i < HaloInfusionItemRegistry.getItems().size(); i++) {
slots.appendTag(new NBTTagString(HaloInfusionItemRegistry.EMPTY.getNbtName()));
}
NBTHelper.setList(getHalo(), "slots", slots);
}
for (int i = 0; i < HaloInfusionItemRegistry.getItems().size(); i++) {
EntityHaloInfusionItem entity = entities.get(i);
String itemName = slots.getStringTagAt(i);
entity.setHaloInfusionItem(HaloInfusionItemRegistry.getItemFromName(itemName), soft);
}
}
Aggregations