All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.magistuarmory.api.client.render.model.ModModelsProvider Maven / Gradle / Ivy

There is a newer version: 8.10
Show newest version
package com.magistuarmory.api.client.render.model;

import com.magistuarmory.EpicKnights;
import com.magistuarmory.api.item.ModItemsProvider;
import com.magistuarmory.client.render.ModRender;
import dev.architectury.registry.client.level.entity.EntityModelLayerRegistry;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.class_2960;
import net.minecraft.class_5601;
import net.minecraft.class_5607;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;


@Environment(EnvType.CLIENT)
public class ModModelsProvider
{
	public final String modId;
	
	public final Map> layers = new HashMap<>();
	
	public ModModelsProvider(String modId)
	{
		this.modId = modId;
	}
	
	public class_5601 addDecorationModel(String name, Supplier definition)
	{
		class_5601 location = createDecorationLocation(name);
		layers.put(location, definition);
		return location;
	}

	public class_5601 addArmorModel(String name, Supplier definition)
	{
		class_5601 location = createArmorLocation(name);
		layers.put(location, definition);
		return location;
	}

	public class_5601 addModel(String name, Supplier definition)
	{
		class_5601 location = createLocation(name);
		layers.put(location, definition);
		return location;
	}
	
	public void init(ModItemsProvider content)
	{
		this.layers.forEach(EntityModelLayerRegistry::register);
		ModRender.registerModelsLoadListener(content);
	}

	public static class_5601 createDecorationLocation(String name)
	{
		return createLocation(name, "decorations");
	}

	public static class_5601 createArmorLocation(String name)
	{
		return createLocation(name, "armor");
	}

	public static class_5601 createLocation(String name)
	{
		return new class_5601(new class_2960(EpicKnights.ID, name), "main");
	}

	public static class_5601 createLocation(String name, String layer)
	{
		return new class_5601(new class_2960(EpicKnights.ID, name), layer);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy