content: package dev.notalpha.dashloader.client.model;
  
  import dev.notalpha.dashloader.api.DashObject;
  import dev.notalpha.dashloader.api.RegistryReader;
  import dev.notalpha.dashloader.api.RegistryWriter;
  import dev.notalpha.dashloader.client.model.components.DashWeightedModelEntry;
  import dev.notalpha.dashloader.mixin.accessor.WeightedBakedModelAccessor;
  import net.minecraft.client.render.model.BakedModel;
  import net.minecraft.client.render.model.WeightedBakedModel;
  import net.minecraft.util.collection.Weighted.Present;
  
  import java.util.ArrayList;
  import java.util.List;
  
  public final class DashWeightedBakedModel implements DashObject<WeightedBakedModel> {
  	public final List<DashWeightedModelEntry> models;
  
  	public DashWeightedBakedModel(List<DashWeightedModelEntry> models) {
  		this.models = models;
  	}
  
  	public DashWeightedBakedModel(WeightedBakedModel model, RegistryWriter writer) {
  		this.models = new ArrayList<>();
  		for (var weightedModel : ((WeightedBakedModelAccessor) model).getBakedModels()) {
  			this.models.add(new DashWeightedModelEntry(weightedModel, writer));
  		}
  	}
  
  	@Override
  	public WeightedBakedModel export(RegistryReader reader) {
  		var modelsOut = new ArrayList<Present<BakedModel>>();
  		for (DashWeightedModelEntry model : this.models) {
  			modelsOut.add(model.export(reader));
  		}
  		return new WeightedBakedModel(modelsOut);
  	}
  
  	@Override
  	public boolean equals(Object o) {
  		if (this == o) return true;
  		if (o == null || getClass() != o.getClass()) return false;
  
  		DashWeightedBakedModel that = (DashWeightedBakedModel) o;
  
  		return models.equals(that.models);
  	}
  
  	@Override
  	public int hashCode() {
  		return models.hashCode();
  	}
  }
  