com.magistuarmory.api.client.render.model.ModModelsProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of 1.20.2-epic-knights-common Show documentation
Show all versions of 1.20.2-epic-knights-common Show documentation
mod that adds medieval stuff to the game
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);
}
}