package com.r3944realms.leashedplayer.client.renderer.item.properties.conditionalRange;

import com.mojang.serialization.MapCodec;
import com.r3944realms.leashedplayer.LeashedPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.ExtraCodecs;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public class ConditionalRangeItemModelProperties {
    private static final ExtraCodecs.LateBoundIdMapper<ResourceLocation, MapCodec<? extends ConditionalRangeItemModelProperty>> ID_MAPPER = new ExtraCodecs.LateBoundIdMapper<>();
    public static final MapCodec<ConditionalRangeItemModelProperty> MAP_CODEC = ID_MAPPER.codec(ResourceLocation.CODEC)
            .dispatchMap("property", ConditionalRangeItemModelProperty::type, mapCodec -> mapCodec);
    public static void bootstrap() {
        ID_MAPPER.put(ResourceLocation.fromNamespaceAndPath(LeashedPlayer.MOD_ID, "bow_pull"), BowPull.MAP_CODEC);
        net.neoforged.fml.ModLoader.postEvent(new com.r3944realms.leashedplayer.content.events.RegisterConditionalRangeItemPropertyEvent(ID_MAPPER));
    }
}
