mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Made the booklet always show the search bar and just put you into the all items section
This commit is contained in:
parent
1aaa3c64e4
commit
13351e498e
7 changed files with 42 additions and 46 deletions
|
@ -11,6 +11,7 @@
|
|||
package de.ellpeck.actuallyadditions.api;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.api.internal.IMethodHandler;
|
||||
import de.ellpeck.actuallyadditions.api.laser.ILaserRelayConnectionHandler;
|
||||
|
@ -42,6 +43,9 @@ public final class ActuallyAdditionsAPI{
|
|||
public static final List<CompostRecipe> COMPOST_RECIPES = new ArrayList<CompostRecipe>();
|
||||
public static final Map<String, Integer> OIL_GENERATOR_RECIPES = new HashMap<String, Integer>();
|
||||
public static final List<IBookletEntry> BOOKLET_ENTRIES = new ArrayList<IBookletEntry>();
|
||||
//This is added to automatically, you don't need to add anything to this list
|
||||
public static final List<IBookletChapter> ALL_CHAPTERS = new ArrayList<IBookletChapter>();
|
||||
//This is added to automatically, you don't need to add anything to this list
|
||||
public static final List<BookletPage> BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA = new ArrayList<BookletPage>();
|
||||
public static final List<WeightedOre> STONE_ORES = new ArrayList<WeightedOre>();
|
||||
public static final List<WeightedOre> NETHERRACK_ORES = new ArrayList<WeightedOre>();
|
||||
|
|
|
@ -233,22 +233,34 @@ public final class BookletUtils{
|
|||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void updateSearchBar(GuiBooklet booklet){
|
||||
if(booklet.currentEntrySet.getCurrentEntry() instanceof BookletEntryAllSearch){
|
||||
BookletEntryAllSearch currentEntry = (BookletEntryAllSearch)booklet.currentEntrySet.getCurrentEntry();
|
||||
if(booklet.searchField.getText() != null && !booklet.searchField.getText().isEmpty()){
|
||||
currentEntry.chapters.clear();
|
||||
boolean change = false;
|
||||
|
||||
for(IBookletChapter chapter : currentEntry.allChapters){
|
||||
String searchFieldText = booklet.searchField.getText().toLowerCase(Locale.ROOT);
|
||||
if(chapter.getLocalizedName().toLowerCase(Locale.ROOT).contains(searchFieldText) || getChapterStacksContainString(searchFieldText, chapter)){
|
||||
currentEntry.chapters.add(chapter);
|
||||
}
|
||||
IBookletEntry current = booklet.currentEntrySet.getCurrentEntry();
|
||||
boolean isAllSearch = current instanceof BookletEntryAllSearch;
|
||||
|
||||
if(booklet.searchField.getText() != null && !booklet.searchField.getText().isEmpty()){
|
||||
if(!isAllSearch){
|
||||
openIndexEntry(booklet, ActuallyAdditionsAPI.allAndSearch, 1, false);
|
||||
current = booklet.currentEntrySet.getCurrentEntry();
|
||||
}
|
||||
|
||||
current.getChapters().clear();
|
||||
for(IBookletChapter chapter : ActuallyAdditionsAPI.ALL_CHAPTERS){
|
||||
String searchFieldText = booklet.searchField.getText().toLowerCase(Locale.ROOT);
|
||||
if(chapter.getLocalizedName().toLowerCase(Locale.ROOT).contains(searchFieldText) || getChapterStacksContainString(searchFieldText, chapter)){
|
||||
current.getChapters().add(chapter);
|
||||
}
|
||||
}
|
||||
else{
|
||||
currentEntry.setChapters((ArrayList<IBookletChapter>)currentEntry.allChapters.clone());
|
||||
}
|
||||
openIndexEntry(booklet, booklet.currentEntrySet.getCurrentEntry(), booklet.currentEntrySet.getPageInIndex(), false);
|
||||
|
||||
change = true;
|
||||
}
|
||||
else if(isAllSearch){
|
||||
current.setChapters(ActuallyAdditionsAPI.ALL_CHAPTERS);
|
||||
change = true;
|
||||
}
|
||||
|
||||
if(change){
|
||||
openIndexEntry(booklet, current, booklet.currentEntrySet.getPageInIndex(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,12 +306,10 @@ public final class BookletUtils{
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void openIndexEntry(GuiBooklet booklet, IBookletEntry entry, int page, boolean resetTextField){
|
||||
booklet.searchField.setVisible(entry instanceof BookletEntryAllSearch);
|
||||
booklet.searchField.setFocused(entry instanceof BookletEntryAllSearch);
|
||||
if(resetTextField){
|
||||
booklet.searchField.setText("");
|
||||
if(entry instanceof BookletEntryAllSearch){
|
||||
entry.setChapters((List<IBookletChapter>)((BookletEntryAllSearch)entry).allChapters.clone());
|
||||
entry.setChapters(ActuallyAdditionsAPI.ALL_CHAPTERS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -381,10 +391,6 @@ public final class BookletUtils{
|
|||
return;
|
||||
}
|
||||
|
||||
booklet.searchField.setVisible(false);
|
||||
booklet.searchField.setFocused(false);
|
||||
booklet.searchField.setText("");
|
||||
|
||||
booklet.currentEntrySet.setChapter(chapter);
|
||||
|
||||
if(booklet.currentEntrySet.getCurrentPage() != null){
|
||||
|
|
|
@ -18,7 +18,6 @@ import de.ellpeck.actuallyadditions.api.internal.IEntrySet;
|
|||
import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.button.IndexButton;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.button.TexturedButton;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllSearch;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.entry.EntrySet;
|
||||
import de.ellpeck.actuallyadditions.mod.config.GuiConfiguration;
|
||||
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
||||
|
@ -131,8 +130,9 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
//Draws the search bar
|
||||
if(this.currentEntrySet.getCurrentEntry() instanceof BookletEntryAllSearch && this.currentEntrySet.getCurrentChapter() == null){
|
||||
this.drawTexturedModalRect(this.guiLeft+146, this.guiTop+160, 146, 80, 70, 14);
|
||||
this.drawTexturedModalRect(this.guiLeft+146, this.guiTop+160, 146, 80, 70, 14);
|
||||
if(!this.searchField.isFocused() && (this.searchField.getText() == null || this.searchField.getText().isEmpty())){
|
||||
this.drawString(this.fontRendererObj, TextFormatting.ITALIC+"Click to search...", this.guiLeft+148, this.guiTop+162, 0xFFFFFF);
|
||||
}
|
||||
|
||||
//Draws Achievement Info
|
||||
|
@ -373,10 +373,9 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
this.buttonList.add(this.bookmarkButtons[i]);
|
||||
}
|
||||
|
||||
this.searchField = new GuiTextField(4500, this.fontRendererObj, this.guiLeft+148, this.guiTop+162, 66, 10);
|
||||
this.searchField = new GuiTextField(4500, this.fontRendererObj, this.guiLeft+148, this.guiTop+162, 70, 10);
|
||||
this.searchField.setMaxStringLength(30);
|
||||
this.searchField.setEnableBackgroundDrawing(false);
|
||||
this.searchField.setCanLoseFocus(false);
|
||||
|
||||
this.currentEntrySet.removeEntry();
|
||||
|
||||
|
|
|
@ -68,6 +68,10 @@ public final class InitBooklet{
|
|||
int count = 0;
|
||||
for(IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES){
|
||||
for(IBookletChapter chapter : entry.getChapters()){
|
||||
if(!ActuallyAdditionsAPI.ALL_CHAPTERS.contains(chapter)){
|
||||
ActuallyAdditionsAPI.ALL_CHAPTERS.add(chapter);
|
||||
}
|
||||
|
||||
for(BookletPage page : chapter.getPages()){
|
||||
ItemStack[] items = page.getItemStacksForPage();
|
||||
FluidStack[] fluids = page.getFluidStacksForPage();
|
||||
|
|
|
@ -40,7 +40,8 @@ public class BookletEntry implements IBookletEntry{
|
|||
|
||||
@Override
|
||||
public void setChapters(List<IBookletChapter> chapters){
|
||||
this.chapters = chapters;
|
||||
this.chapters.clear();
|
||||
this.chapters.addAll(chapters);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,28 +10,10 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.booklet.entry;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BookletEntryAllSearch extends BookletEntry{
|
||||
|
||||
public ArrayList<IBookletChapter> allChapters = new ArrayList<IBookletChapter>();
|
||||
|
||||
public BookletEntryAllSearch(String unlocalizedName){
|
||||
super(unlocalizedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChapters(List<IBookletChapter> chapters){
|
||||
this.allChapters = (ArrayList<IBookletChapter>)chapters;
|
||||
this.chapters = (ArrayList<IBookletChapter>)this.allChapters.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChapter(IBookletChapter chapter){
|
||||
this.allChapters.add(chapter);
|
||||
this.chapters = (ArrayList<IBookletChapter>)this.allChapters.clone();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -729,7 +729,7 @@ booklet.actuallyadditions.indexEntry.gettingStarted.name=Getting Started
|
|||
booklet.actuallyadditions.indexEntry.misc.name=Miscellaneous
|
||||
booklet.actuallyadditions.indexEntry.crossover.name=Mod Crossover
|
||||
booklet.actuallyadditions.indexEntry.functionalNoRF.name=Blocks that don't use RF
|
||||
booklet.actuallyadditions.indexEntry.allAndSearch.name=All Items and Search
|
||||
booklet.actuallyadditions.indexEntry.allAndSearch.name=A list of everything
|
||||
booklet.actuallyadditions.indexEntry.functionalRF.name=Blocks that use RF
|
||||
booklet.actuallyadditions.indexEntry.generatingRF.name=Blocks that generate RF
|
||||
booklet.actuallyadditions.indexEntry.itemsNoRF.name=Items that don't use RF
|
||||
|
@ -921,7 +921,7 @@ booklet.actuallyadditions.chapter.crystals.name=Crystals and Reconstructor
|
|||
booklet.actuallyadditions.chapter.crystals.text.1=The <item>Atomic Reconstructor<r> is used to craft <item>Crystals<r>, which are the main crafting ingredient in most items from <imp>Actually Additions<r>. <n>Upon being supplied with power, it shoots out a Laser. <tifisgrin>When the Laser hits a block<r>, it will convert all surrounding items and blocks, provided they can be converted. <n>When shooting a laser, it uses <imp><rf> RF<r>, but additional rates vary depending on the conversion.
|
||||
booklet.actuallyadditions.chapter.crystals.text.2=There are various <item>Lenses<r> that can be attached to the Reconstructor that don't all follow the default behavior of the Reconstructor and are able to do some neat things. <n>See the <imp>Reconstruction section<r> in the booklet <imp>for more information<r>. <n><n>When right-clicking the Reconstructor with a <item>Redstone Torch<r> in hand, it will change between a mode where it <imp>gets deactivated by Redstone<r> and a mode where it <imp>responds to pulses<r>.
|
||||
booklet.actuallyadditions.chapter.crystals.text.3=It should be noted that any recipes listed without information about Lenses <imp>don't use one<r>. <n><i>I thought that was obvious.
|
||||
booklet.actuallyadditions.chapter.crystals.text.5=When you have crafted a couple of items, you might want to find a way to <imp>automate this<r>. <n>There is a very simple way to do accomplish this: <n>Place the <item>Atomic Reconstructor<r> down facing into a <item>Precision Dropper<r> (to find it, look it up in the <imp>All Items and Search<r> Entry!). <n>Next, place a <item>Ranged Collector<r> in the area that has the converted items set as a whitelist. <n>Now you can just chuck your raw materials into the Dropper to convert them!
|
||||
booklet.actuallyadditions.chapter.crystals.text.5=When you have crafted a couple of items, you might want to find a way to <imp>automate this<r>. <n>There is a very simple way to do accomplish this: <n>Place the <item>Atomic Reconstructor<r> down facing into a <item>Precision Dropper<r> (to find it, look it up in the <imp>All Items<r> Entry!). <n>Next, place a <item>Ranged Collector<r> in the area that has the converted items set as a whitelist. <n>Now you can just chuck your raw materials into the Dropper to convert them!
|
||||
booklet.actuallyadditions.chapter.crystals.text.6=<n><n><n><i>Molecular Transformilator
|
||||
|
||||
booklet.actuallyadditions.chapter.bookTutorial.name=Intro to the Manual
|
||||
|
|
Loading…
Reference in a new issue