/*
 * Copyright (c) 2026 盐灯水母
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

package com.remains_cave.client.model;

import com.remains_cave.RemainsCaveMod;
import com.remains_cave.block.ModBlocks;
import com.remains_cave.block.entity.TrophyBlockEntity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import software.bernie.geckolib.model.GeoModel;

public class TrophyModel extends GeoModel<TrophyBlockEntity> {
    @Override
    public ResourceLocation getModelResource(TrophyBlockEntity animatable) {
        Block block = animatable.getBlockState().getBlock();
        ResourceLocation modelPath;
        if (block == ModBlocks.SKELETON_ARCHER_TROPHY.get()) {
            modelPath = ResourceLocation.fromNamespaceAndPath(RemainsCaveMod.MODID, "geo/block/skeleton_archer_trophy.geo.json");
        } else if (block == ModBlocks.SKELETON_KING_TROPHY.get()) {
            modelPath = ResourceLocation.fromNamespaceAndPath(RemainsCaveMod.MODID, "geo/block/skeleton_king_trophy.geo.json");
        } else if (block == ModBlocks.SKELETON_WARLOCK_TROPHY.get()) {
            modelPath = ResourceLocation.fromNamespaceAndPath(RemainsCaveMod.MODID, "geo/block/skeleton_warlock_trophy.geo.json");
        } else if (block == ModBlocks.SKELETON_WARRIOR_TROPHY.get()) {
            modelPath = ResourceLocation.fromNamespaceAndPath(RemainsCaveMod.MODID, "geo/block/skeleton_warrior_trophy.geo.json");
        } else {
            modelPath = null;
        }
        return modelPath;
    }

    @Override
    public ResourceLocation getTextureResource(TrophyBlockEntity animatable) {
        Block block = animatable.getBlockState().getBlock();
        ResourceLocation texturePath;
        if (block == ModBlocks.SKELETON_ARCHER_TROPHY.get()) {
            texturePath = ResourceLocation.fromNamespaceAndPath(RemainsCaveMod.MODID, "textures/entity/skeleton_archer.png");
        } else if (block == ModBlocks.SKELETON_KING_TROPHY.get()) {
            texturePath = ResourceLocation.fromNamespaceAndPath(RemainsCaveMod.MODID, "textures/entity/skeleton_king.png");
        } else if (block == ModBlocks.SKELETON_WARLOCK_TROPHY.get()) {
            texturePath = ResourceLocation.fromNamespaceAndPath(RemainsCaveMod.MODID, "textures/entity/skeleton_warlock.png");
        } else if (block == ModBlocks.SKELETON_WARRIOR_TROPHY.get()) {
            texturePath = ResourceLocation.fromNamespaceAndPath(RemainsCaveMod.MODID, "textures/entity/skeleton_warrior.png");
        } else {
            texturePath = null;
        }
        return texturePath;
    }

    @Override
    public ResourceLocation getAnimationResource(TrophyBlockEntity animatable) {
        return null; // 无动画
    }
}