fabric-rendering-v1-16.2.0+bee81f016f.jar

Download file
    package net.fabricmc.fabric.api.client.rendering.v1;

import java.util.Objects;
import java.util.Set;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.impl.client.rendering.EntityModelLayerImpl;
import net.fabricmc.fabric.mixin.client.rendering.EntityModelLayersAccessor;
import net.minecraft.class_11677;
import net.minecraft.class_5601;
import net.minecraft.class_5607;

@Environment(EnvType.CLIENT)
public final class EntityModelLayerRegistry {
   public static void registerModelLayer(class_5601 modelLayer, TexturedModelDataProvider provider) {
      Objects.requireNonNull(modelLayer, "EntityModelLayer cannot be null");
      Objects.requireNonNull(provider, "TexturedModelDataProvider cannot be null");
      if (EntityModelLayerImpl.PROVIDERS.putIfAbsent(modelLayer, provider) != null) {
         throw new IllegalArgumentException(String.format("Cannot replace registration for entity model layer \"%s\"", modelLayer));
      } else {
         EntityModelLayersAccessor.getLayers().add(modelLayer);
      }
   }

   public static void registerEquipmentModelLayers(class_11677<class_5601> equipmentModelData, TexturedEquipmentModelDataProvider provider) {
      Objects.requireNonNull(equipmentModelData, "EquipmentModelData cannot be null");
      Objects.requireNonNull(provider, "TexturedEquipmentModelDataProvider cannot be null");
      if (EntityModelLayerImpl.EQUIPMENT_PROVIDERS.putIfAbsent(equipmentModelData, provider) != null) {
         throw new IllegalArgumentException(String.format("Cannot replace registration for entity equipment model layer \"%s\"", equipmentModelData));
      } else {
         Set var10001 = EntityModelLayersAccessor.getLayers();
         Objects.requireNonNull(var10001);
         equipmentModelData.method_72962(var10001::add);
      }
   }

   private EntityModelLayerRegistry() {
   }

   @FunctionalInterface
   @Environment(EnvType.CLIENT)
   public interface TexturedEquipmentModelDataProvider {
      class_11677<class_5607> createEquipmentModelData();
   }

   @FunctionalInterface
   @Environment(EnvType.CLIENT)
   public interface TexturedModelDataProvider {
      class_5607 createModelData();
   }
}
    
Download file