2017-02-18 00:54:58 +01:00
|
|
|
/*
|
|
|
|
* This file ("BookletChapterTrials.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://ellpeck.de/actaddlicense
|
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
|
|
|
* © 2015-2017 Ellpeck
|
|
|
|
*/
|
|
|
|
|
|
|
|
package de.ellpeck.actuallyadditions.mod.booklet.chapter;
|
|
|
|
|
|
|
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
2018-05-10 11:38:58 +02:00
|
|
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
2017-02-18 00:54:58 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.booklet.page.PageTrials;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.text.TextFormatting;
|
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
|
|
|
|
|
|
public class BookletChapterTrials extends BookletChapter{
|
|
|
|
|
|
|
|
public BookletChapterTrials(String identifier, ItemStack displayStack, boolean secondPageText){
|
|
|
|
super(identifier, ActuallyAdditionsAPI.entryTrials, displayStack, new PageTrials(1, false, true), new PageTrials(2, true, secondPageText));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public String getLocalizedName(){
|
2018-05-10 11:38:58 +02:00
|
|
|
return StringUtil.localize("booklet."+ActuallyAdditions.MODID+".trials."+this.getIdentifier()+".name");
|
2017-02-18 00:54:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-02-18 00:58:02 +01:00
|
|
|
@SideOnly(Side.CLIENT)
|
2017-02-18 00:54:58 +01:00
|
|
|
public String getLocalizedNameWithFormatting(){
|
|
|
|
EntityPlayer player = Minecraft.getMinecraft().player;
|
|
|
|
PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);
|
|
|
|
boolean completed = data.completedTrials.contains(this.getIdentifier());
|
|
|
|
|
2017-02-19 13:10:43 +01:00
|
|
|
return (completed ? TextFormatting.DARK_GREEN : TextFormatting.DARK_RED)+TextFormatting.ITALIC.toString()+this.getLocalizedName();
|
2017-02-18 00:54:58 +01:00
|
|
|
}
|
|
|
|
}
|