use of am2.lore.Story in project ArsMagica2 by Mithion.
the class ItemLostJournal method getSubItems.
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List par3List) {
super.getSubItems(item, par2CreativeTabs, par3List);
int sCount = 0;
for (Story s : StoryManager.INSTANCE.allStories()) {
int meta = sCount << 16;
for (short i = 0; i < s.getNumParts(); ++i) {
meta = sCount + i;
ItemStack stack = new ItemStack(item, 1, meta);
stack.stackTagCompound = new NBTTagCompound();
s.WritePartToNBT(stack.stackTagCompound, i);
stack.stackTagCompound.setString("title", s.getTitle());
par3List.add(stack);
}
}
}
use of am2.lore.Story in project ArsMagica2 by Mithion.
the class ItemLostJournal method getStory.
public Story getStory(ItemStack stack) {
if (stack.hasTagCompound()) {
NBTTagCompound compound = stack.getTagCompound();
String nbtTitle = compound.getString("title");
Story s = StoryManager.INSTANCE.getByTitle(nbtTitle);
return s;
}
return null;
}
Aggregations