package top.r3944realms.lib39.util;

import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import top.r3944realms.lib39.Lib39;

/**
 * The type Plant helper.
 */
public class PlantHelper {
    /**
     * The enum Plant.
     */
    public enum Plant implements StringRepresentable {
        /**
         * Acacia sapling plant.
         */
// 树苗
        ACACIA_SAPLING("acacia_sapling", Items.ACACIA_SAPLING),
        /**
         * Bamboo plant.
         */
        BAMBOO("bamboo_stage0", Items.BAMBOO),
        /**
         * Birch sapling plant.
         */
        BIRCH_SAPLING("birch_sapling", Items.BIRCH_SAPLING),
        /**
         * Cherry sapling plant.
         */
        CHERRY_SAPLING("cherry_sapling", Items.CHERRY_SAPLING),
        /**
         * Dark oak sapling plant.
         */
        DARK_OAK_SAPLING("dark_oak_sapling", Items.DARK_OAK_SAPLING),
        /**
         * Dead bush plant.
         */
        DEAD_BUSH("dead_bush", Items.DEAD_BUSH),
        /**
         * Jungle sapling plant.
         */
        JUNGLE_SAPLING("jungle_sapling", Items.JUNGLE_SAPLING),
        /**
         * Oak sapling plant.
         */
        OAK_SAPLING("oak_sapling", Items.OAK_SAPLING),
        /**
         * Spruce sapling plant.
         */
        SPRUCE_SAPLING("spruce_sapling", Items.SPRUCE_SAPLING),

        /**
         * Allium plant.
         */
// 花
        ALLIUM("allium", Items.ALLIUM),
        /**
         * Azure bluet plant.
         */
        AZURE_BLUET("azure_bluet", Items.AZURE_BLUET),
        /**
         * Cornflower plant.
         */
        CORNFLOWER("cornflower",  Items.CORNFLOWER),
        /**
         * Dandelion plant.
         */
        DANDELION("dandelion", Items.DANDELION),
        /**
         * Lily of the valley plant.
         */
        LILY_OF_THE_VALLEY("lily_of_the_valley", Items.LILY_OF_THE_VALLEY),
        /**
         * Oxeye daisy plant.
         */
        OXEYE_DAISY("oxeye_daisy", Items.OXEYE_DAISY),
        /**
         * Orange tulip plant.
         */
        ORANGE_TULIP("orange_tulip", Items.ORANGE_TULIP),
        /**
         * Pink tulip plant.
         */
        PINK_TULIP("pink_tulip", Items.PINK_TULIP),
        /**
         * Red tulip plant.
         */
        RED_TULIP("red_tulip", Items.RED_TULIP),
        /**
         * White tulip plant.
         */
        WHITE_TULIP("white_tulip", Items.WHITE_TULIP),
        /**
         * Wither rose plant.
         */
        WITHER_ROSE("wither_rose", Items.WITHER_ROSE),
        /**
         * Poppy plant.
         */
        POPPY("poppy", Items.POPPY),


        /**
         * Amethyst cluster plant.
         */
// 晶体
        AMETHYST_CLUSTER("amethyst_cluster", Items.AMETHYST_CLUSTER),

        /**
         * Brain coral plant.
         */
// 珊瑚
        BRAIN_CORAL("brain_coral", Items.BRAIN_CORAL),
        /**
         * Brain coral fan plant.
         */
        BRAIN_CORAL_FAN("brain_coral_fan", Items.BRAIN_CORAL_FAN),
        /**
         * Bubble coral plant.
         */
        BUBBLE_CORAL("bubble_coral", Items.BUBBLE_CORAL),
        /**
         * Bubble coral fan plant.
         */
        BUBBLE_CORAL_FAN("bubble_coral_fan", Items.BUBBLE_CORAL_FAN),
        /**
         * Fire coral plant.
         */
        FIRE_CORAL("fire_coral", Items.FIRE_CORAL),
        /**
         * Fire coral fan plant.
         */
        FIRE_CORAL_FAN("fire_coral_fan", Items.FIRE_CORAL_FAN),
        /**
         * Horn coral plant.
         */
        HORN_CORAL("horn_coral", Items.HORN_CORAL),
        /**
         * Horn coral fan plant.
         */
        HORN_CORAL_FAN("horn_coral_fan", Items.HORN_CORAL_FAN),
        /**
         * Tube coral plant.
         */
        TUBE_CORAL("tube_coral", Items.TUBE_CORAL),
        /**
         * Tube coral fan plant.
         */
        TUBE_CORAL_FAN("tube_coral_fan", Items.TUBE_CORAL_FAN),
        /**
         * Dead fire coral plant.
         */
        DEAD_FIRE_CORAL("dead_fire_coral", Items.DEAD_FIRE_CORAL),
        /**
         * Dead fire coral fan plant.
         */
        DEAD_FIRE_CORAL_FAN("dead_fire_coral_fan", Items.DEAD_FIRE_CORAL_FAN),
        /**
         * Dead horn coral plant.
         */
        DEAD_HORN_CORAL("dead_horn_coral", Items.DEAD_HORN_CORAL),
        /**
         * Dead horn coral fan plant.
         */
        DEAD_HORN_CORAL_FAN("dead_horn_coral_fan", Items.DEAD_HORN_CORAL_FAN),
        /**
         * Dead tube coral plant.
         */
        DEAD_TUBE_CORAL("dead_tube_coral", Items.DEAD_TUBE_CORAL),
        /**
         * Dead tube coral fan plant.
         */
        DEAD_TUBE_CORAL_FAN("dead_tube_coral_fan", Items.DEAD_TUBE_CORAL_FAN),
        /**
         * Dead brain coral plant.
         */
        DEAD_BRAIN_CORAL("dead_brain_coral", Items.DEAD_BRAIN_CORAL),
        /**
         * Dead brain coral fan plant.
         */
        DEAD_BRAIN_CORAL_FAN("dead_brain_coral_fan", Items.DEAD_BRAIN_CORAL_FAN),
        /**
         * Dead bubble coral plant.
         */
        DEAD_BUBBLE_CORAL("dead_bubble_coral", Items.DEAD_BUBBLE_CORAL),
        /**
         * Dead bubble coral fan plant.
         */
        DEAD_BUBBLE_CORAL_FAN("dead_bubble_coral_fan", Items.DEAD_BUBBLE_CORAL_FAN),

        /**
         * Crimson fungus plant.
         */
// 蘑菇
        CRIMSON_FUNGUS("crimson_fungus", Items.CRIMSON_FUNGUS),
        /**
         * Red mushroom plant.
         */
        RED_MUSHROOM("red_mushroom", Items.RED_MUSHROOM),
        /**
         * Brown mushroom plant.
         */
        BROWN_MUSHROOM("brown_mushroom", Items.BROWN_MUSHROOM),
        /**
         * Warped fungus plant.
         */
        WARPED_FUNGUS("warped_fungus", Items.WARPED_FUNGUS),


        /**
         * Crimson roots pot plant.
         */
// Grass
//        CRIMSON_ROOTS("crimson_roots"),
        CRIMSON_ROOTS_POT("crimson_roots_pot", Items.CRIMSON_ROOTS),
        /**
         * Warped roots pot plant.
         */
//        WARPED_ROOTS("warped_roots"),
        WARPED_ROOTS_POT("warped_roots_pot", Items.WARPED_ROOTS),

        /**
         * Cobweb plant.
         */
// Other
        COBWEB("cobweb", Items.COBWEB),
        /**
         * Redstone torch plant.
         */
        REDSTONE_TORCH("redstone_torch", Items.REDSTONE_TORCH),
        /**
         * Torch plant.
         */
        TORCH("torch", Items.TORCH),
        ;
        /**
         * The Name.
         */
        public final String name;
        /**
         * The Item.
         */
        public final Item item;
        Plant(String name, Item item) {
            this.name = name;
            this.item = item;
        }
        @Override
        public @NotNull String toString() {
            return super.toString().toLowerCase();
        }

        @Override
        public @NotNull String getSerializedName() {
            return name;
        }
    }

    /**
     * Gets texture rl.
     *
     * @param plant the plant
     * @return the texture rl
     */
    @Contract("_ -> new")
    public static @NotNull ResourceLocation getTextureRL(@NotNull Plant plant) {
        return Lib39.mrl("block/" + plant.name);
    }

    /**
     * Gets directly texture rl.
     *
     * @param plant the plant
     * @return the directly texture rl
     */
    @Contract("_ -> new")
    public static @NotNull ResourceLocation getDirectlyTextureRL(@NotNull Plant plant) {
        return Lib39.mrl("textures/block/" + plant.name + ".png");
    }
}
