Made pages show even unlocalized text if it isn't turned off by default now, made you have to have a booklet in your inventory to use the keybind

This commit is contained in:
Ellpeck 2015-09-14 11:02:16 +02:00
parent faa4009992
commit 47890c5012
8 changed files with 37 additions and 17 deletions

View file

@ -50,11 +50,11 @@ public class InitBooklet{
chapterIntro = new BookletChapter("intro", entryMisc, new ItemStack(InitItems.itemLexicon), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeBook));
//Miscellaneous
new BookletChapter("craftingIngs", entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeCoil), new PageCrafting(3, ItemCrafting.recipeCoilAdvanced), new PageCrafting(4, BlockCrafting.recipeCase), new PageCrafting(5, BlockCrafting.recipeStoneCase), new PageCrafting(6, BlockCrafting.recipeEnderPearlBlock), new PageCrafting(7, BlockCrafting.recipeEnderCase), new PageCrafting(8, ItemCrafting.recipeRing), new PageCrafting(9, ItemCrafting.recipeKnifeHandle), new PageCrafting(10, ItemCrafting.recipeKnifeBlade), new PageCrafting(11, ItemCrafting.recipeKnife), new PageCrafting(12, ItemCrafting.recipeDough), new PageCrafting(13, ItemCrafting.recipeRiceDough));
new BookletChapter("quartz", entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new PageTextOnly(1).setStack(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("<lowest>", ConfigIntValues.BLACK_QUARTZ_MIN_HEIGHT.getValue()).addTextReplacement("<highest>", ConfigIntValues.BLACK_QUARTZ_MAX_HEIGHT.getValue()), new PageTextOnly(2).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock), new PageCrafting(4, BlockCrafting.recipeQuartzPillar), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled));
new BookletChapter("cloud", entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud));
new BookletChapter("coalStuff", entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.TINY_COAL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeTinyCoal), new PageCrafting(3, ItemCrafting.recipeTinyChar), new PageCrafting(4, BlockCrafting.recipeBlockChar));
new BookletChapter("lamps", entryMisc, new ItemStack(InitBlocks.blockColoredLampOn, 1, TheColoredLampColors.GREEN.ordinal()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipePowerer), new PageCrafting(3, BlockCrafting.recipesLamps[0]), new PageCrafting(4, BlockCrafting.recipesLamps[1]), new PageCrafting(5, BlockCrafting.recipesLamps[2]), new PageCrafting(6, BlockCrafting.recipesLamps[3]), new PageCrafting(7, BlockCrafting.recipesLamps[4]), new PageCrafting(8, BlockCrafting.recipesLamps[5]), new PageCrafting(9, BlockCrafting.recipesLamps[6]), new PageCrafting(10, BlockCrafting.recipesLamps[7]), new PageCrafting(11, BlockCrafting.recipesLamps[8]), new PageCrafting(12, BlockCrafting.recipesLamps[9]), new PageCrafting(13, BlockCrafting.recipesLamps[10]), new PageCrafting(14, BlockCrafting.recipesLamps[11]), new PageCrafting(15, BlockCrafting.recipesLamps[12]), new PageCrafting(16, BlockCrafting.recipesLamps[13]), new PageCrafting(17, BlockCrafting.recipesLamps[14]), new PageCrafting(18, BlockCrafting.recipesLamps[15]));
new BookletChapter("craftingIngs", entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeCoil).setNoText(), new PageCrafting(3, ItemCrafting.recipeCoilAdvanced).setNoText(), new PageCrafting(4, BlockCrafting.recipeCase).setNoText(), new PageCrafting(5, BlockCrafting.recipeStoneCase).setNoText(), new PageCrafting(6, BlockCrafting.recipeEnderPearlBlock).setNoText(), new PageCrafting(7, BlockCrafting.recipeEnderCase).setNoText(), new PageCrafting(8, ItemCrafting.recipeRing).setNoText(), new PageCrafting(9, ItemCrafting.recipeKnifeHandle).setNoText(), new PageCrafting(10, ItemCrafting.recipeKnifeBlade).setNoText(), new PageCrafting(11, ItemCrafting.recipeKnife).setNoText(), new PageCrafting(12, ItemCrafting.recipeDough).setNoText(), new PageCrafting(13, ItemCrafting.recipeRiceDough).setNoText());
new BookletChapter("quartz", entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new PageTextOnly(1).setStack(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("<lowest>", ConfigIntValues.BLACK_QUARTZ_MIN_HEIGHT.getValue()).addTextReplacement("<highest>", ConfigIntValues.BLACK_QUARTZ_MAX_HEIGHT.getValue()), new PageTextOnly(2).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock).setNoText(), new PageCrafting(4, BlockCrafting.recipeQuartzPillar).setNoText(), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled).setNoText());
new BookletChapter("cloud", entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setNoText());
new BookletChapter("coalStuff", entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.TINY_COAL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeTinyCoal).setNoText(), new PageCrafting(3, ItemCrafting.recipeTinyChar).setNoText(), new PageCrafting(4, BlockCrafting.recipeBlockChar).setNoText());
new BookletChapter("lamps", entryMisc, new ItemStack(InitBlocks.blockColoredLampOn, 1, TheColoredLampColors.GREEN.ordinal()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipePowerer).setNoText(), new PageCrafting(3, BlockCrafting.recipesLamps[0]).setNoText(), new PageCrafting(4, BlockCrafting.recipesLamps[1]).setNoText(), new PageCrafting(5, BlockCrafting.recipesLamps[2]).setNoText(), new PageCrafting(6, BlockCrafting.recipesLamps[3]).setNoText(), new PageCrafting(7, BlockCrafting.recipesLamps[4]).setNoText(), new PageCrafting(8, BlockCrafting.recipesLamps[5]).setNoText(), new PageCrafting(9, BlockCrafting.recipesLamps[6]).setNoText(), new PageCrafting(10, BlockCrafting.recipesLamps[7]).setNoText(), new PageCrafting(11, BlockCrafting.recipesLamps[8]).setNoText(), new PageCrafting(12, BlockCrafting.recipesLamps[9]).setNoText(), new PageCrafting(13, BlockCrafting.recipesLamps[10]).setNoText(), new PageCrafting(14, BlockCrafting.recipesLamps[11]).setNoText(), new PageCrafting(15, BlockCrafting.recipesLamps[12]).setNoText(), new PageCrafting(16, BlockCrafting.recipesLamps[13]).setNoText(), new PageCrafting(17, BlockCrafting.recipesLamps[14]).setNoText(), new PageCrafting(18, BlockCrafting.recipesLamps[15]).setNoText());
new BookletChapter("treasureChest", entryMisc, new ItemStack(InitBlocks.blockTreasureChest), new PageTextOnly(1).setStack(new ItemStack(InitBlocks.blockTreasureChest)));
//No RF Using Blocks

View file

@ -35,11 +35,17 @@ public class BookletPage{
protected int id;
protected BookletChapter chapter;
private boolean hasNoText;
public BookletPage(int id){
this.id = id;
}
public BookletPage setNoText(){
this.hasNoText = true;
return this;
}
public int getID(){
return this.id;
}
@ -53,6 +59,10 @@ public class BookletPage{
}
public final String getText(){
if(this.hasNoText){
return null;
}
String base = StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".chapter."+this.chapter.getUnlocalizedName()+".text."+this.id).replaceAll("<imp>", EnumChatFormatting.DARK_GREEN+"").replaceAll("<item>", EnumChatFormatting.BLUE+"").replaceAll("<r>", EnumChatFormatting.BLACK+"").replaceAll("<n>", "\n").replaceAll("<i>", EnumChatFormatting.ITALIC+"").replaceAll("<rs>", EnumChatFormatting.RESET+"");
for(Object o : this.textReplacements.entrySet()){
Map.Entry e = (Map.Entry)o;

View file

@ -60,7 +60,7 @@ public class PageCrafting extends BookletPage{
}
String text = gui.currentPage.getText();
if(text != null && !text.isEmpty() && !text.contains("booklet.")){
if(text != null && !text.isEmpty()){
gui.unicodeRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+100, 115, 0);
}

View file

@ -53,7 +53,7 @@ public class PageCrusherRecipe extends BookletPage{
}
String text = gui.currentPage.getText();
if(text != null && !text.isEmpty() && !text.contains("booklet.")){
if(text != null && !text.isEmpty()){
gui.unicodeRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+100, 115, 0);
}

View file

@ -61,7 +61,7 @@ public class PageFurnace extends BookletPage{
}
String text = gui.currentPage.getText();
if(text != null && !text.isEmpty() && !text.contains("booklet.")){
if(text != null && !text.isEmpty()){
gui.unicodeRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+100, 115, 0);
}

View file

@ -38,7 +38,7 @@ public class PageTextOnly extends BookletPage{
@Override
public void renderPre(GuiBooklet gui, int mouseX, int mouseY, boolean mouseClick){
String text = gui.currentPage.getText();
if(text != null && !text.isEmpty() && !text.contains("booklet.")){
if(text != null && !text.isEmpty()){
gui.unicodeRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+11, 115, 0);
}
}

View file

@ -16,6 +16,7 @@ import ellpeck.actuallyadditions.booklet.GuiBooklet;
import ellpeck.actuallyadditions.booklet.InitBooklet;
import ellpeck.actuallyadditions.booklet.page.BookletPage;
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.util.KeyBinds;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil;
@ -61,6 +62,7 @@ public class TooltipEvent{
for(BookletPage page : InitBooklet.pagesWithItemStackData){
if(page.getItemStackForPage() != null && page.getItemStackForPage().isItemEqual(stack)){
int keyCode = KeyBinds.keybindOpenBooklet.getKeyCode();
if(Minecraft.getMinecraft().thePlayer.inventory.hasItem(InitItems.itemLexicon)){
event.toolTip.add(EnumChatFormatting.GOLD+StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".keyToSeeRecipe", keyCode > 0 && keyCode < Keyboard.KEYBOARD_SIZE ? "'"+Keyboard.getKeyName(keyCode)+"'" : "[NONE]"));
//TODO Find a better method to do this eventually
@ -71,6 +73,10 @@ public class TooltipEvent{
book.openIndexEntry(page.getChapter().entry, InitBooklet.entries.indexOf(page.getChapter().entry)/GuiBooklet.BUTTONS_PER_PAGE+1, true);
book.openChapter(page.getChapter(), page);
}
}
else{
event.toolTip.addAll(Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(EnumChatFormatting.DARK_RED+StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".noBookletInInventory"), GuiBooklet.TOOLTIP_SPLIT_LENGTH));
}
break;
}
}

View file

@ -1,6 +1,9 @@
itemGroup.actuallyadditions=Actually Additions
achievement.page.actuallyadditions=Actually Additions
key.actuallyadditions.category=Actually Additions
key.actuallyadditions.openBooklet.name=Open Booklet in Inventory
fluid.oil=Oil
fluid.canolaoil=Canola Oil
@ -380,6 +383,7 @@ booklet.actuallyadditions.recipeDisabled=The crafting recipe for this item is di
booklet.actuallyadditions.clickToSeeRecipe=Click to see more Information
booklet.actuallyadditions.keyToSeeRecipe=Press %s to see more Information
booklet.actuallyadditions.noBookletInInventory=If you had an Actually Additions Information Manual, you could check out more Information :(
booklet.actuallyadditions.chapter.intro.name=An Introduction to ActAdd
booklet.actuallyadditions.chapter.intro.text.1=<i>This book, written years ago, found by the player, used to help understand the wonders of this world, finally opened, finally looked at, full of glory, full of grace, will be used to help the player along on their journey through <imp>Actually Additions<r><i>. <n>What is <imp>Actually Additions<r><i>, you may ask. <n><imp>Actually Additions<r><i> adds blocks, items, and features to make the player's experience easier, automate the world and properly do what you've always wanted to do.