package com.r3944realms.leashedplayer.content.events;


import com.mojang.serialization.MapCodec;
import com.r3944realms.leashedplayer.client.renderer.item.properties.conditionalRange.ConditionalRangeItemModelProperty;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.ExtraCodecs;
import net.neoforged.bus.api.Event;
import net.neoforged.fml.event.IModBusEvent;
import org.jetbrains.annotations.ApiStatus;
/**
 * Event fired when special model renderers are registered.
 * <p>
 * This event is fired during the model registration process for conditional range select item model properties.
 * It is used to register property codecs which can be used to create custom conditional range select item model properties.
 * <p>
 * This event is fired on the mod event bus.
 */
public class RegisterConditionalRangeItemPropertyEvent extends Event implements IModBusEvent {
    private final ExtraCodecs.LateBoundIdMapper<ResourceLocation, MapCodec<? extends ConditionalRangeItemModelProperty>> idMapper;
    @ApiStatus.Internal
    public RegisterConditionalRangeItemPropertyEvent(ExtraCodecs.LateBoundIdMapper<ResourceLocation, MapCodec<? extends ConditionalRangeItemModelProperty>> idMapper) {
        this.idMapper = idMapper;
    }

    public void register(ResourceLocation location, MapCodec<? extends ConditionalRangeItemModelProperty> source) {
        this.idMapper.put(location, source);
    }
}
