Working on The Architect book - working out well~
This commit is contained in:
parent
1c806c4328
commit
f87da36775
13 changed files with 499 additions and 298 deletions
|
@ -139,7 +139,6 @@ public class BUEntries
|
|||
/** Debug */
|
||||
debug = new Entry(new IEntry[]{new EntryText("Debug"), new EntryImage("bloodutils:textures/misc/screenshots/t1.png", 854, 480, "Debug")}, EnumChatFormatting.AQUA + "De" + EnumChatFormatting.RED + "bug", 1);
|
||||
|
||||
registerKeys();
|
||||
registerEntries();
|
||||
}
|
||||
|
||||
|
@ -258,11 +257,6 @@ public class BUEntries
|
|||
|
||||
public static Entry debug;
|
||||
|
||||
public void registerKeys()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void registerEntries()
|
||||
{
|
||||
/* Architect */
|
||||
|
@ -347,7 +341,7 @@ public class BUEntries
|
|||
|
||||
|
||||
|
||||
this.registerCategory(BUEntries.categoryTest, EntryRegistry.test, BookParser.parseTextFile());
|
||||
this.registerCategory(BUEntries.categoryTest, EntryRegistry.test, BookParser.parseTextFile("/assets/alchemicalwizardryBooks/books/book.txt"));
|
||||
}
|
||||
|
||||
public void registerCategory(Category cat, HashMap<String, Entry> entryMap, List<Entry> entries)
|
||||
|
|
|
@ -12,11 +12,14 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
|
||||
import WayofTime.alchemicalWizardry.book.compact.Entry;
|
||||
import WayofTime.alchemicalWizardry.book.entries.EntryCraftingRecipeCustomText;
|
||||
import WayofTime.alchemicalWizardry.book.entries.EntryImageCustomText;
|
||||
import WayofTime.alchemicalWizardry.book.entries.EntryItemCustomText;
|
||||
import WayofTime.alchemicalWizardry.book.entries.EntryTextCustomText;
|
||||
import WayofTime.alchemicalWizardry.book.entries.IEntryCustomText;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
@ -25,7 +28,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
public class BookParser
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static List<Entry> parseTextFile()
|
||||
public static List<Entry> parseTextFile(String location)
|
||||
{
|
||||
File textFiles = new File("config/BloodMagic/bookDocs");
|
||||
ArrayList<Entry> entryList = new ArrayList();
|
||||
|
@ -34,7 +37,7 @@ public class BookParser
|
|||
try {
|
||||
System.out.println("I am in an island of files!");
|
||||
|
||||
InputStream input = AlchemicalWizardry.class.getResourceAsStream("/assets/alchemicalwizardryBooks/books/book.txt");
|
||||
InputStream input = AlchemicalWizardry.class.getResourceAsStream(location);
|
||||
|
||||
Minecraft.getMinecraft().fontRenderer.setUnicodeFlag(true);
|
||||
|
||||
|
@ -138,7 +141,7 @@ public class BookParser
|
|||
List list = Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(strLine, 110);
|
||||
if(list != null)
|
||||
{
|
||||
System.out.println("Number of lines: " + list.size());
|
||||
//System.out.println("Number of lines: " + list.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +197,7 @@ public class BookParser
|
|||
}
|
||||
}
|
||||
|
||||
System.out.println("" + strLine);
|
||||
//System.out.println("" + strLine);
|
||||
}
|
||||
|
||||
strings[currentPage] = strings[currentPage];
|
||||
|
@ -261,7 +264,7 @@ public class BookParser
|
|||
|
||||
public static boolean containsSpecialInfo(String unparsedString)
|
||||
{
|
||||
return unparsedString.startsWith("//IMAGE") || unparsedString.startsWith("//CRAFTING");
|
||||
return unparsedString.startsWith("//IMAGE") || unparsedString.startsWith("//CRAFTING") || unparsedString.startsWith("//ITEM");
|
||||
}
|
||||
|
||||
public static IEntryCustomText getEntryForStringTitle(String unparsedString)
|
||||
|
@ -287,11 +290,20 @@ public class BookParser
|
|||
}else if(unparsedString.startsWith("//CRAFTING "))
|
||||
{
|
||||
String lines = unparsedString.replaceFirst("//CRAFTING ", "");
|
||||
IRecipe recipe = SpecialEntryRegistry.getIRecipeForKey(lines);
|
||||
ItemStack stack = APISpellHelper.getItemStackForString(lines);
|
||||
IRecipe recipe = APISpellHelper.getRecipeForItemStack(stack);
|
||||
if(recipe != null)
|
||||
{
|
||||
return new EntryCraftingRecipeCustomText(recipe);
|
||||
}
|
||||
}else if(unparsedString.startsWith("//ITEM "))
|
||||
{
|
||||
String lines = unparsedString.replaceFirst("//ITEM ", "");
|
||||
ItemStack stack = APISpellHelper.getItemStackForString(lines);
|
||||
if(stack != null)
|
||||
{
|
||||
return new EntryItemCustomText(stack);
|
||||
}
|
||||
}
|
||||
|
||||
return new EntryTextCustomText();
|
||||
|
@ -312,6 +324,9 @@ public class BookParser
|
|||
}else if(unparsedString.startsWith("//CRAFTING "))
|
||||
{
|
||||
return 0;
|
||||
}else if(unparsedString.startsWith("//ITEM "))
|
||||
{
|
||||
return 9;
|
||||
}
|
||||
|
||||
return def;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue