package com.dairymoose.modernlife.items;

import com.dairymoose.entity.BicycleEntity;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/* loaded from: outputsrg.jar:com/dairymoose/modernlife/items/BicycleItem.class */
public class BicycleItem extends Item {
    private static final Logger LOGGER = LogManager.getLogger();

    public BicycleItem(Properties p_i48530_4_) {
        super(p_i48530_4_);
    }

    public void appendHoverText(ItemStack itemStack, @Nullable Level world, List<Component> text, TooltipFlag flag) {
        text.add(new TextComponent("Right click to deploy"));
    }

    public InteractionResult useOn(UseOnContext context) {
        Level world = context.getLevel();
        context.getItemInHand().shrink(1);
        if (world instanceof ServerLevel) {
            BicycleEntity bike = (BicycleEntity) BicycleEntity.BICYCLE_ENTITY.create(world);
            Vec3 loc = context.getClickLocation();
            bike.setPos(loc.x, loc.y, loc.z);
            bike.setYRot(context.getPlayer().getYRot());
            world.m_7967_(bike);
        }
        return InteractionResult.CONSUME;
    }
}
