package com.tiedup.remake.v2.blocks;

import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;

/**
 * Base block entity for blocks that render with OBJ models.
 * Subclasses define the model and texture locations.
 */
public abstract class ObjBlockEntity extends BlockEntity {

    public ObjBlockEntity(
        BlockEntityType<?> type,
        BlockPos pos,
        BlockState state
    ) {
        super(type, pos, state);
    }

    /**
     * Get the OBJ model resource location.
     * Example: "tiedup:models/obj/blocks/bowl/model.obj"
     */
    @Nullable
    public abstract ResourceLocation getModelLocation();

    /**
     * Get the texture resource location.
     * Example: "tiedup:textures/block/bowl.png"
     */
    @Nullable
    public abstract ResourceLocation getTextureLocation();

    /**
     * Get the model scale (default 1.0).
     * Override to scale the model up or down.
     */
    public float getModelScale() {
        return 1.0f;
    }

    /**
     * Get the model position offset (x, y, z).
     * Override to adjust model position within the block.
     */
    public float[] getModelOffset() {
        return new float[] { 0.0f, 0.0f, 0.0f };
    }

    @Override
    protected void saveAdditional(CompoundTag tag) {
        super.saveAdditional(tag);
        // Subclasses can override to save additional data
    }

    @Override
    public void load(CompoundTag tag) {
        super.load(tag);
        // Subclasses can override to load additional data
    }
}
