GuideBook (WIP) fix

This commit is contained in:
Aleksey 2020-12-06 00:13:42 +03:00
parent 88afa6a2c9
commit 08e31b8743
8 changed files with 22 additions and 13 deletions

View file

@ -6,21 +6,21 @@ import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import net.minecraft.text.TextColor;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
import ru.betterend.BetterEnd;
import ru.betterend.registry.EndItems;
import ru.betterend.util.LangUtil;
import vazkii.patchouli.api.PatchouliAPI;
public class GuideBook extends PatternedItem {
private static final Style TEXT_STYLE = Style.EMPTY.withColor(TextColor.fromRgb(0x7e6b9a)).withItalic(true);
public final static Identifier BOOK_ID = BetterEnd.makeID("guidebook");
public GuideBook() {
@ -29,7 +29,7 @@ public class GuideBook extends PatternedItem {
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
if (!world.isClient && user instanceof ServerPlayerEntity) {
if (!world.isClient && user instanceof ServerPlayerEntity) {
PatchouliAPI.get().openBookGUI((ServerPlayerEntity) user, BOOK_ID);
return TypedActionResult.success(user.getStackInHand(hand));
}
@ -38,6 +38,6 @@ public class GuideBook extends PatternedItem {
@Override
public void appendTooltip(ItemStack stack, World world, List<Text> tooltip, TooltipContext context) {
tooltip.add(new TranslatableText("book.betterend.subtitle").setStyle(TEXT_STYLE));
tooltip.add(LangUtil.getText("book.betterend", "subtitle").formatted(Formatting.DARK_PURPLE, Formatting.ITALIC));
}
}