mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Made the all items chapter use all chapters on its own
This commit is contained in:
parent
b295672585
commit
2760c794d6
6 changed files with 24 additions and 5 deletions
|
@ -77,6 +77,7 @@ public final class ActuallyAdditionsAPI{
|
|||
public static IBookletEntry entryItemsNonRF;
|
||||
public static IBookletEntry entryItemsRF;
|
||||
public static IBookletEntry entryMisc;
|
||||
//This is added to automatically, you don't need to add anything to this entry
|
||||
public static IBookletEntry allAndSearch;
|
||||
|
||||
//These are getting initialized in Actually Additions' PreInit phase
|
||||
|
|
|
@ -35,8 +35,6 @@ public class BookletChapter implements IBookletChapter{
|
|||
this.color = TextFormatting.RESET;
|
||||
|
||||
this.entry.addChapter(this);
|
||||
ActuallyAdditionsAPI.allAndSearch.addChapter(this);
|
||||
|
||||
for(IBookletPage page : this.pages){
|
||||
page.setChapter(this);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
|||
public class BookletEntry implements IBookletEntry{
|
||||
|
||||
private final String identifier;
|
||||
public List<IBookletChapter> chapters = new ArrayList<IBookletChapter>();
|
||||
private final List<IBookletChapter> chapters = new ArrayList<IBookletChapter>();
|
||||
private TextFormatting color;
|
||||
|
||||
public BookletEntry(String identifier){
|
||||
|
@ -61,7 +61,7 @@ public class BookletEntry implements IBookletEntry{
|
|||
|
||||
@Override
|
||||
public List<IBookletChapter> getChaptersForGuiDisplaying(GuiBookletBase gui, String searchBarText){
|
||||
return this.chapters;
|
||||
return this.getAllChapters();
|
||||
}
|
||||
|
||||
public BookletEntry setImportant(){
|
||||
|
|
|
@ -10,9 +10,24 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.booklet.entry;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BookletEntryAllItems extends BookletEntry{
|
||||
|
||||
public BookletEntryAllItems(String identifier){
|
||||
super(identifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChapter(IBookletChapter chapter){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IBookletChapter> getAllChapters(){
|
||||
return ActuallyAdditionsAPI.ALL_CHAPTERS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
|||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
|
@ -77,6 +79,8 @@ public class ItemDisplay{
|
|||
public void onMousePress(int button, int mouseX, int mouseY){
|
||||
if(button == 0 && this.isHovered(mouseX, mouseY)){
|
||||
if(this.page != null && this.page != this.gui.pages[0] && this.page != this.gui.pages[1]){
|
||||
this.gui.mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
||||
|
||||
GuiBooklet gui = BookletUtils.createPageGui(this.gui.previousScreen, this.gui, this.page);
|
||||
this.gui.mc.displayGuiScreen(gui);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
|||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.*;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllItems;
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||
import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
|
||||
import de.ellpeck.actuallyadditions.mod.event.ClientEvents;
|
||||
|
@ -65,7 +66,7 @@ public class ClientProxy implements IProxy{
|
|||
String bookletText = "";
|
||||
|
||||
for(IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES){
|
||||
if(entry != ActuallyAdditionsAPI.allAndSearch){
|
||||
if(!(entry instanceof BookletEntryAllItems)){
|
||||
bookletWordCount += entry.getLocalizedName().split(" ").length;
|
||||
bookletCharCount += entry.getLocalizedName().length();
|
||||
bookletText += entry.getLocalizedName()+"\n\n";
|
||||
|
|
Loading…
Reference in a new issue