GuideBook (WIP) fix
This commit is contained in:
parent
88afa6a2c9
commit
08e31b8743
8 changed files with 22 additions and 13 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,16 @@ import ru.betterend.registry.EndItems;
|
|||
public class SmithingRecipes {
|
||||
public static void register() {
|
||||
AnvilSmithingRecipe.Builder.create("ender_pearl_to_dust")
|
||||
.setInput(Items.ENDER_PEARL, EndItems.ENDER_SHARD)
|
||||
.setInput(Items.ENDER_PEARL)
|
||||
.setOutput(EndItems.ENDER_DUST, 1)
|
||||
.setLevel(4)
|
||||
.setDamage(5)
|
||||
.build();
|
||||
AnvilSmithingRecipe.Builder.create("ender_shard_to_dust")
|
||||
.setInput(EndItems.ENDER_SHARD)
|
||||
.setOutput(EndItems.ENDER_DUST, 1)
|
||||
.setLevel(2)
|
||||
.setDamage(3)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,8 @@ public class EndItems {
|
|||
|
||||
// Other //
|
||||
public static final Item ETERNAL_CRYSTAL = registerItem("eternal_crystal", new EternalCrystal());
|
||||
public static final Item GUIDE_BOOK = registerItem(GuideBook.BOOK_ID, new GuideBook());
|
||||
public static final Item GUIDE_BOOK = EndItems.registerItem(GuideBook.BOOK_ID, new GuideBook());
|
||||
|
||||
|
||||
protected static Item registerItem(String name) {
|
||||
return registerItem(BetterEnd.makeID(name), new PatternedItem(makeItemSettings()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue