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.19.2-epic-knights-fabric Show documentation
Show all versions of 1.19.2-epic-knights-fabric Show documentation
mod that adds medieval stuff to the game
The newest version!
package com.magistuarmory.api.client.render.model;
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 abstract 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 = this.createDecorationLocation(name);
layers.put(location, definition);
return location;
}
public class_5601 addArmorModel(String name, Supplier definition)
{
class_5601 location = this.createArmorLocation(name);
layers.put(location, definition);
return location;
}
public class_5601 addModel(String name, Supplier definition)
{
class_5601 location = this.createLocation(name);
layers.put(location, definition);
return location;
}
public class_5601 createDecorationLocation(String name)
{
return createDecorationLocation(new class_2960(this.modId, name));
}
public class_5601 createArmorLocation(String name)
{
return createArmorLocation(new class_2960(this.modId, name));
}
public class_5601 createLocation(String name)
{
return createLocation(new class_2960(this.modId, name));
}
public class_5601 createLocation(String name, String layer)
{
return createLocation(new class_2960(this.modId, name), layer);
}
public static class_5601 createDecorationLocation(class_2960 location)
{
return createLocation(location, "decorations");
}
public static class_5601 createArmorLocation(class_2960 location)
{
return createLocation(location, "armor");
}
public static class_5601 createLocation(class_2960 location)
{
return createLocation(location, "main");
}
public static class_5601 createLocation(class_2960 location, String layer)
{
return new class_5601(location, layer);
}
public void init(ModItemsProvider content)
{
this.layers.forEach(EntityModelLayerRegistry::register);
ModRender.registerModelsLoadListener(content);
}
}