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;
|
2021-02-26 22:15:48 +01:00
|
|
|
import net.minecraft.entity.player.PlayerEntity;
|
2017-02-18 00:54:58 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.text.TextFormatting;
|
2021-02-26 22:15:48 +01:00
|
|
|
import net.minecraftforge.fml.relauncher.OnlyIn;
|
2017-02-18 00:54:58 +01:00
|
|
|
|
2019-05-02 09:10:29 +02:00
|
|
|
public class BookletChapterTrials extends BookletChapter {
|
2017-02-18 00:54:58 +01:00
|
|
|
|
2019-05-02 09:10:29 +02:00
|
|
|
public BookletChapterTrials(String identifier, ItemStack displayStack, boolean secondPageText) {
|
2017-02-18 00:54:58 +01:00
|
|
|
super(identifier, ActuallyAdditionsAPI.entryTrials, displayStack, new PageTrials(1, false, true), new PageTrials(2, true, secondPageText));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-02-26 22:15:48 +01:00
|
|
|
@OnlyIn(Dist.CLIENT)
|
2019-05-02 09:10:29 +02:00
|
|
|
public String getLocalizedName() {
|
|
|
|
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trials." + this.getIdentifier() + ".name");
|
2017-02-18 00:54:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-02-26 22:15:48 +01:00
|
|
|
@OnlyIn(Dist.CLIENT)
|
2019-05-02 09:10:29 +02:00
|
|
|
public String getLocalizedNameWithFormatting() {
|
2021-02-26 22:15:48 +01:00
|
|
|
PlayerEntity player = Minecraft.getInstance().player;
|
2017-02-18 00:54:58 +01:00
|
|
|
PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);
|
|
|
|
boolean completed = data.completedTrials.contains(this.getIdentifier());
|
|
|
|
|
2021-02-26 22:15:48 +01:00
|
|
|
return (completed
|
|
|
|
? TextFormatting.DARK_GREEN
|
|
|
|
: TextFormatting.DARK_RED) + TextFormatting.ITALIC.toString() + this.getLocalizedName();
|
2017-02-18 00:54:58 +01:00
|
|
|
}
|
|
|
|
}
|