mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-25 06:24:27 +00:00
Added a new category to the Lexica Botania. The "Lexicon Index" category, which shows every single entry in alphabetical order.
This commit is contained in:
1 parent
71bac0ea9a
commit
e32a5a91d1
5 files changed
+24
-12
No files matched your search
@@ -253,6 +253,13 @@ public final class BotaniaAPI {
|
||||
return categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all registered entries.
|
||||
*/
|
||||
public static List<LexiconEntry> getAllEntries() {
|
||||
return allEntries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Lexicon Entry and adds it to the category passed in.
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@API(owner = "Botania", apiVersion = "6", provides = "BotaniaAPI")
|
||||
@API(owner = "Botania", apiVersion = "7", provides = "BotaniaAPI")
|
||||
package vazkii.botania.api;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -131,17 +131,15 @@ public class GuiLexicon extends GuiScreen {
|
||||
if(par1GuiButton.id >= BOOKMARK_START)
|
||||
handleBookmark(par1GuiButton);
|
||||
else {
|
||||
int i = par1GuiButton.id - 3;
|
||||
int i = par1GuiButton.id - 2;
|
||||
if(i < 0)
|
||||
return;
|
||||
|
||||
List<LexiconCategory> categoryList = BotaniaAPI.getAllCategories();
|
||||
LexiconCategory category = i >= categoryList.size() ? null : categoryList.get(i);
|
||||
|
||||
if(category != null) {
|
||||
mc.displayGuiScreen(new GuiLexiconIndex(category));
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
mc.displayGuiScreen(new GuiLexiconIndex(category));
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,13 +196,17 @@ public class GuiLexicon extends GuiScreen {
|
||||
|
||||
void populateIndex() {
|
||||
List<LexiconCategory> categoryList = BotaniaAPI.getAllCategories();
|
||||
for(int i = 3; i < 12; i++) {
|
||||
int i_ = i - 3;
|
||||
int shift = 2;
|
||||
for(int i = shift; i < 12; i++) {
|
||||
int i_ = i - shift;
|
||||
GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i);
|
||||
LexiconCategory category = i_ >= categoryList.size() ? null : categoryList.get(i_);
|
||||
if(category != null)
|
||||
button.displayString = StatCollector.translateToLocal(category.getUnlocalizedName());
|
||||
else button.displayString = "";
|
||||
else {
|
||||
button.displayString = StatCollector.translateToLocal("botaniamisc.lexiconIndex");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.ILexicon;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -28,6 +29,7 @@ import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonBack;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonInvisible;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonPage;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
|
||||
public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
|
||||
@@ -42,7 +44,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
|
||||
public GuiLexiconIndex(LexiconCategory category) {
|
||||
this.category = category;
|
||||
title = StatCollector.translateToLocal(category.getUnlocalizedName());
|
||||
title = StatCollector.translateToLocal(category == null ? "botaniamisc.lexiconIndex" : category.getUnlocalizedName());
|
||||
parent = new GuiLexicon();
|
||||
}
|
||||
|
||||
@@ -65,7 +67,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
|
||||
entriesToDisplay.clear();
|
||||
ILexicon lex = (ILexicon) stackUsed.getItem();
|
||||
for(LexiconEntry entry : category.entries) {
|
||||
for(LexiconEntry entry : category == null ? BotaniaAPI.getAllEntries() : category.entries) {
|
||||
if(lex.isKnowledgeUnlocked(stackUsed, entry.getKnowledgeType()))
|
||||
entriesToDisplay.add(entry);
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ botaniamisc.coarseDirt0=Coarse Dirt, grass
|
||||
botaniamisc.coarseDirt1=won't grow on it
|
||||
botaniamisc.spawnerTip=Tip: Use a Spawn Egg to change the mob
|
||||
botaniamisc.shardLevel=Shard Power %s
|
||||
botaniamisc.lexiconIndex=Lexicon Index
|
||||
|
||||
# COLORS
|
||||
botania.color0=White
|
||||
@@ -684,7 +685,7 @@ item.botania:superLavaPendant.name=Crimson Pendant
|
||||
item.botania:enderHand.name=Hand of Ender
|
||||
|
||||
# GUI TEXT
|
||||
botania.gui.lexicon.header=Lexica Botania, %s Edition's Index - Pick which category you would like to study:
|
||||
botania.gui.lexicon.header=Lexica Botania, %s Edition Table of Contents
|
||||
botania.gui.lexicon.wip=(This entry is a Work In Progress. It's not even it's final form)
|
||||
|
||||
# LEXICON CATEGORIES
|
||||
|
||||
Reference in new issue
Block a user