2015-08-29 14:33:25 +02:00
|
|
|
/*
|
|
|
|
* This file ("BookletChapter.java") is part of the Actually Additions Mod for Minecraft.
|
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
|
|
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2015-11-02 20:55:19 +01:00
|
|
|
* © 2015 Ellpeck
|
2015-08-29 14:33:25 +02:00
|
|
|
*/
|
|
|
|
|
2015-08-29 23:01:13 +02:00
|
|
|
package ellpeck.actuallyadditions.booklet;
|
2015-08-28 21:17:09 +02:00
|
|
|
|
2015-09-10 21:25:34 +02:00
|
|
|
import ellpeck.actuallyadditions.booklet.page.BookletPage;
|
2015-08-28 21:17:09 +02:00
|
|
|
import ellpeck.actuallyadditions.util.ModUtil;
|
|
|
|
import ellpeck.actuallyadditions.util.StringUtil;
|
2015-09-10 21:25:34 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
2015-10-23 19:05:02 +02:00
|
|
|
import net.minecraft.util.EnumChatFormatting;
|
2015-08-28 21:17:09 +02:00
|
|
|
|
|
|
|
public class BookletChapter{
|
|
|
|
|
2015-09-10 21:25:34 +02:00
|
|
|
public final BookletPage[] pages;
|
2015-08-28 21:17:09 +02:00
|
|
|
public final BookletIndexEntry entry;
|
2015-09-10 21:25:34 +02:00
|
|
|
public final ItemStack displayStack;
|
2015-10-03 10:16:18 +02:00
|
|
|
private final String unlocalizedName;
|
2015-10-23 19:05:02 +02:00
|
|
|
public EnumChatFormatting color;
|
2015-08-28 21:17:09 +02:00
|
|
|
|
2015-09-10 21:25:34 +02:00
|
|
|
public BookletChapter(String unlocalizedName, BookletIndexEntry entry, ItemStack displayStack, BookletPage... pages){
|
2015-08-28 21:17:09 +02:00
|
|
|
this.pages = pages.clone();
|
2015-08-29 10:59:03 +02:00
|
|
|
|
2015-08-28 21:17:09 +02:00
|
|
|
this.unlocalizedName = unlocalizedName;
|
|
|
|
entry.addChapter(this);
|
2015-08-29 14:31:02 +02:00
|
|
|
InitBooklet.allAndSearch.addChapter(this);
|
2015-08-28 21:17:09 +02:00
|
|
|
this.entry = entry;
|
2015-09-10 21:25:34 +02:00
|
|
|
this.displayStack = displayStack;
|
2015-08-28 21:17:09 +02:00
|
|
|
|
2015-09-10 21:25:34 +02:00
|
|
|
for(BookletPage page : this.pages){
|
2015-08-28 21:17:09 +02:00
|
|
|
page.setChapter(this);
|
|
|
|
}
|
2015-10-23 19:05:02 +02:00
|
|
|
|
|
|
|
this.color = EnumChatFormatting.RESET;
|
2015-08-28 21:17:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getUnlocalizedName(){
|
|
|
|
return this.unlocalizedName;
|
|
|
|
}
|
|
|
|
|
2015-10-23 19:05:02 +02:00
|
|
|
public String getNameWithColor(){
|
|
|
|
return this.color+this.getLocalizedName();
|
|
|
|
}
|
|
|
|
|
2015-10-28 14:46:04 +01:00
|
|
|
public String getLocalizedName(){
|
|
|
|
return StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".chapter."+this.unlocalizedName+".name");
|
|
|
|
}
|
|
|
|
|
2015-10-23 19:05:02 +02:00
|
|
|
public BookletChapter setImportant(){
|
|
|
|
this.color = EnumChatFormatting.DARK_GREEN;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public BookletChapter setSpecial(){
|
2015-12-17 22:18:37 +01:00
|
|
|
this.color = EnumChatFormatting.DARK_PURPLE;
|
2015-10-23 19:05:02 +02:00
|
|
|
return this;
|
2015-08-28 21:17:09 +02:00
|
|
|
}
|
|
|
|
}
|