/*
 *  Copyright 2025-2026 R3944Realms
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package top.r3944realms.eroticdungeongame.datagen.provider;


import io.zershyan.sccore.animation.data.GenericAnimationData;
import net.minecraft.data.DataGenerator;
import net.minecraft.world.phys.Vec3;
import top.leisuretimedock.animationcore.animation.AnimationDataBuilder;
import top.leisuretimedock.animationcore.animation.data.ACAnimationProvider;
import top.r3944realms.eroticdungeongame.EroticDungeon;
import top.r3944realms.eroticdungeongame.content.animation.EDGAnimation;

import java.util.function.Consumer;


public class EDGAnimationProvider extends ACAnimationProvider {
    public EDGAnimationProvider(DataGenerator generator) {
        super(generator, EroticDungeon.MOD_ID);
    }

    @Override
    protected void registerAnimations(Consumer<GenericAnimationData> consumer) {
        GenericAnimationData cuff_bed = AnimationDataBuilder
                .create(EDGAnimation.CUFF_BED.getDefaultRL())
                .withName("cuff_bed")
                .withCamPitch(-90.0f)   // 垂直旋转（向上看90度）
                .addCamPosOffset(new Vec3(0, -0.75, -1)) // 向后移动1格
                .withCamPosOffsetRelative(true)
                .buildGeneric();
        consumer.accept(cuff_bed);

        GenericAnimationData prone_bench = AnimationDataBuilder
                .create(EDGAnimation.PRONE_BENCH.getDefaultRL())
                .withName("prone_bench")
                .withCamPitch(90.0f)
                .addCamPosOffset(new Vec3(0, -0.9, 0.8))
                .withCamPosOffsetRelative(true).buildGeneric();
        consumer.accept(prone_bench);

        GenericAnimationData iron_cage = AnimationDataBuilder
                .create(EDGAnimation.IRON_CAGE.getDefaultRL())
                .withName("iron_cage")
                .withCamPosOffsetRelative(true)
                .buildGeneric();
        consumer.accept(iron_cage);

        GenericAnimationData spanishDonkeyUp = AnimationDataBuilder
                .create(EDGAnimation.SPANISH_DONKEY.getDefaultRL())
                .withName("spanish_donkey_up")
                .addCamPosOffset(new Vec3(0, 0, 0.35))
                .withCamPosOffsetRelative(true)
                .buildGeneric();
        GenericAnimationData spanishDonkeyUpWithRoute = AnimationDataBuilder
                .create(EDGAnimation.SPANISH_DONKEY.getVarietyRL(2))
                .withName("spanish_donkey_up_with_route")
                .addCamPosOffset(new Vec3(0, 0, 0.35))
                .withCamPosOffsetRelative(true)
                .buildGeneric();

        GenericAnimationData spanishDonkeyChangeRoute = AnimationDataBuilder
                .create(EDGAnimation.SPANISH_DONKEY.getVarietyRL(3))
                .withName("spanish_donkey_change_route")
                .addCamPosOffset(new Vec3(0, 0, 0.35))
                .withCamPosOffsetRelative(true)
                .buildGeneric();
        GenericAnimationData spanishDonkeyChangeNotRoute = AnimationDataBuilder
                .create(EDGAnimation.SPANISH_DONKEY.getVarietyRL(4))
                .withName("spanish_donkey_change_not_route")
                .addCamPosOffset(new Vec3(0, 0, 0.35))
                .withCamPosOffsetRelative(true)
                .buildGeneric();

        consumer.accept(spanishDonkeyUp);
        consumer.accept(spanishDonkeyUpWithRoute);
        consumer.accept(spanishDonkeyChangeRoute);
        consumer.accept(spanishDonkeyChangeNotRoute);

        GenericAnimationData crux = AnimationDataBuilder
                .create(EDGAnimation.CRUX.getDefaultRL())
                .withName("crux")
                .withCamPosOffsetRelative(true)
                .withCamPosOffset(new Vec3(0, 0.0, 0.2))
                .buildGeneric();
        consumer.accept(crux);

        GenericAnimationData cuffPole = AnimationDataBuilder
                .create(EDGAnimation.CUFF_POLE.getDefaultRL())
                .withName("cuff_pole")
                .withCamPosOffsetRelative(true)
                .withCamPosOffset(new Vec3(0, 0.0, 0.2))
                .buildGeneric();
        consumer.accept(cuffPole);

        GenericAnimationData hangingPost = AnimationDataBuilder
                .create(EDGAnimation.HANGING_POST.getDefaultRL())
                .withName("hanging_post")
                .withCamPitch(25f)
                .withCamPosOffset(new Vec3(0, -0.2, 0.2))
                .withCamPosOffsetRelative(true)
                .buildGeneric();
        consumer.accept(hangingPost);

        GenericAnimationData petrineCross = AnimationDataBuilder
                .create(EDGAnimation.PETRINE_CROSS.getDefaultRL())
                .withName("petrine_cross")
                .withCamPosOffset(new Vec3(0, 0.0, 0.2))
                .withCamPosOffsetRelative(true)
                .buildGeneric();
        consumer.accept(petrineCross);

        GenericAnimationData pillory = AnimationDataBuilder
                .create(EDGAnimation.PILLORY.getDefaultRL())
                .withName("pillory")
                .addCamPosOffset(new Vec3(0, -0.5, 0.7))
                .withCamPitch(90.0f)
                .withCamPosOffsetRelative(true)
                .buildGeneric();
        consumer.accept(pillory);

        GenericAnimationData rack = AnimationDataBuilder
                .create(EDGAnimation.RACK.getDefaultRL())
                .withName("rack")
                .withCamPitch(-90.0f)
                .addCamPosOffset(new Vec3(0, -0.75, -1)) // 向后移动1格
                .withCamPosOffsetRelative(true)
                .buildGeneric();
        consumer.accept(rack);

        GenericAnimationData xCross = AnimationDataBuilder
                .create(EDGAnimation.X_CROSS.getDefaultRL())
                .withName("x_cross")
                .withCamPosOffset(new Vec3(0, 0.0, 0.2))
                .withCamPosOffsetRelative(true)
                .buildGeneric();
        consumer.accept(xCross);

        GenericAnimationData wallRack = AnimationDataBuilder
                .create(EDGAnimation.WALL_RACK.getDefaultRL())
                .withName("wall_rack")
                .withCamPosOffsetRelative(true)
                .withCamPosOffset(new Vec3(0, 0.0, 0.1))
                .buildGeneric();
        consumer.accept(wallRack);
    }
}
