2015-08-29 14:33:25 +02:00
|
|
|
/*
|
2016-05-16 22:52:27 +02:00
|
|
|
* This file ("BookletChapter.java") is part of the Actually Additions mod for Minecraft.
|
2015-08-29 14:33:25 +02:00
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
2016-05-16 22:52:27 +02:00
|
|
|
* http://ellpeck.de/actaddlicense
|
2015-08-29 14:33:25 +02:00
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2016-05-16 22:54:42 +02:00
|
|
|
* © 2015-2016 Ellpeck
|
2015-08-29 14:33:25 +02:00
|
|
|
*/
|
|
|
|
|
2016-01-05 04:47:35 +01:00
|
|
|
package de.ellpeck.actuallyadditions.mod.booklet.chapter;
|
2015-08-28 21:17:09 +02:00
|
|
|
|
2016-01-05 14:57:50 +01:00
|
|
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
|
|
|
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
|
|
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
|
|
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
2015-09-10 21:25:34 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
2016-03-18 23:47:22 +01:00
|
|
|
import net.minecraft.util.text.TextFormatting;
|
2015-08-28 21:17:09 +02:00
|
|
|
|
2016-01-05 14:57:50 +01:00
|
|
|
public class BookletChapter implements IBookletChapter{
|
2015-08-28 21:17:09 +02:00
|
|
|
|
2015-09-10 21:25:34 +02:00
|
|
|
public final BookletPage[] pages;
|
2016-01-05 14:57:50 +01:00
|
|
|
public final IBookletEntry 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;
|
2016-03-18 23:47:22 +01:00
|
|
|
public TextFormatting color;
|
2015-08-28 21:17:09 +02:00
|
|
|
|
2016-01-05 14:57:50 +01:00
|
|
|
public BookletChapter(String unlocalizedName, IBookletEntry 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);
|
2016-01-05 14:57:50 +01:00
|
|
|
ActuallyAdditionsAPI.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
|
|
|
|
2016-03-18 23:47:22 +01:00
|
|
|
this.color = TextFormatting.RESET;
|
2015-08-28 21:17:09 +02:00
|
|
|
}
|
|
|
|
|
2016-01-05 14:57:50 +01:00
|
|
|
@Override
|
|
|
|
public BookletPage[] getPages(){
|
|
|
|
return this.pages;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-08-28 21:17:09 +02:00
|
|
|
public String getUnlocalizedName(){
|
|
|
|
return this.unlocalizedName;
|
|
|
|
}
|
|
|
|
|
2016-01-05 14:57:50 +01:00
|
|
|
@Override
|
|
|
|
public String getLocalizedName(){
|
2016-04-20 21:39:03 +02:00
|
|
|
return StringUtil.localize("booklet."+ModUtil.MOD_ID+".chapter."+this.unlocalizedName+".name");
|
2016-01-05 14:57:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getLocalizedNameWithFormatting(){
|
2015-10-23 19:05:02 +02:00
|
|
|
return this.color+this.getLocalizedName();
|
|
|
|
}
|
|
|
|
|
2016-01-05 14:57:50 +01:00
|
|
|
@Override
|
|
|
|
public IBookletEntry getEntry(){
|
|
|
|
return this.entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ItemStack getDisplayItemStack(){
|
|
|
|
return this.displayStack;
|
2015-10-28 14:46:04 +01:00
|
|
|
}
|
|
|
|
|
2016-05-19 20:05:12 +02:00
|
|
|
public void setImportant(){
|
2016-03-18 23:47:22 +01:00
|
|
|
this.color = TextFormatting.DARK_GREEN;
|
2015-10-23 19:05:02 +02:00
|
|
|
}
|
|
|
|
|
2016-06-17 23:50:38 +02:00
|
|
|
public void setSpecial(){
|
2016-03-18 23:47:22 +01:00
|
|
|
this.color = TextFormatting.DARK_PURPLE;
|
2015-08-28 21:17:09 +02:00
|
|
|
}
|
|
|
|
}
|