Search in sources :

Example 1 with ModelMultiBase

use of net.sistr.littlemaidmodelloader.maidmodel.ModelMultiBase in project LittleMaidModelLoader-Fabric by SistrScarlet.

the class MultiModelRenderer method render.

@Override
public void render(T livingEntity, float entityYaw, float partialTicks, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light) {
    Profiler profiler = MinecraftClient.getInstance().getProfiler();
    profiler.push("littlemaidmodelloader:mm");
    livingEntity.getModel(IHasMultiModel.Layer.SKIN, IHasMultiModel.Part.HEAD).filter(model -> model instanceof ModelMultiBase).ifPresent(model -> syncCaps(livingEntity, (ModelMultiBase) model, partialTicks));
    for (IHasMultiModel.Part part : IHasMultiModel.Part.values()) {
        livingEntity.getModel(IHasMultiModel.Layer.INNER, part).filter(model -> model instanceof ModelMultiBase).ifPresent(model -> syncCaps(livingEntity, (ModelMultiBase) model, partialTicks));
        livingEntity.getModel(IHasMultiModel.Layer.OUTER, part).filter(model -> model instanceof ModelMultiBase).ifPresent(model -> syncCaps(livingEntity, (ModelMultiBase) model, partialTicks));
    }
    super.render(livingEntity, entityYaw, partialTicks, matrixStack, vertexConsumerProvider, light);
    profiler.pop();
}
Also used : LivingEntityRenderer(net.minecraft.client.render.entity.LivingEntityRenderer) IHasMultiModel(net.sistr.littlemaidmodelloader.entity.compound.IHasMultiModel) LivingEntity(net.minecraft.entity.LivingEntity) Environment(net.fabricmc.api.Environment) MatrixStack(net.minecraft.client.util.math.MatrixStack) MMMatrixStack(net.sistr.littlemaidmodelloader.multimodel.layer.MMMatrixStack) VertexConsumerProvider(net.minecraft.client.render.VertexConsumerProvider) LittleMaidModelLoader(net.sistr.littlemaidmodelloader.LittleMaidModelLoader) EntityRenderDispatcher(net.minecraft.client.render.entity.EntityRenderDispatcher) Arm(net.minecraft.util.Arm) Profiler(net.minecraft.util.profiler.Profiler) EnvType(net.fabricmc.api.EnvType) Identifier(net.minecraft.util.Identifier) MinecraftClient(net.minecraft.client.MinecraftClient) Hand(net.minecraft.util.Hand) IModelCaps(net.sistr.littlemaidmodelloader.maidmodel.IModelCaps) ModelMultiBase(net.sistr.littlemaidmodelloader.maidmodel.ModelMultiBase) IHasMultiModel(net.sistr.littlemaidmodelloader.entity.compound.IHasMultiModel) Profiler(net.minecraft.util.profiler.Profiler) ModelMultiBase(net.sistr.littlemaidmodelloader.maidmodel.ModelMultiBase)

Example 2 with ModelMultiBase

use of net.sistr.littlemaidmodelloader.maidmodel.ModelMultiBase in project LittleMaidModelLoader-Fabric by SistrScarlet.

the class LMModelManager method addModel.

public void addModel(String modelName, Class<? extends ModelMultiBase> modelClass) {
    try {
        Constructor<? extends ModelMultiBase> constructor = modelClass.getConstructor(float.class);
        ModelMultiBase skin = constructor.newInstance(0.0F);
        float[] size = skin.getArmorModelsSize();
        ModelMultiBase inner = constructor.newInstance(size[0]);
        ModelMultiBase outer = constructor.newInstance(size[1]);
        models.put(modelName.toLowerCase(), new ModelHolder(skin, inner, outer));
    } catch (Exception e) {
        LOGGER.debug("インスタンス化に失敗しました。抽象クラスまたは非対応のモデルである可能性があります。 : " + modelClass);
        e.printStackTrace();
        return;
    }
    if (LMMLConfig.isDebugMode())
        LOGGER.debug("Loaded Model : " + modelClass);
}
Also used : ModelMultiBase(net.sistr.littlemaidmodelloader.maidmodel.ModelMultiBase)

Aggregations

ModelMultiBase (net.sistr.littlemaidmodelloader.maidmodel.ModelMultiBase)2 EnvType (net.fabricmc.api.EnvType)1 Environment (net.fabricmc.api.Environment)1 MinecraftClient (net.minecraft.client.MinecraftClient)1 VertexConsumerProvider (net.minecraft.client.render.VertexConsumerProvider)1 EntityRenderDispatcher (net.minecraft.client.render.entity.EntityRenderDispatcher)1 LivingEntityRenderer (net.minecraft.client.render.entity.LivingEntityRenderer)1 MatrixStack (net.minecraft.client.util.math.MatrixStack)1 LivingEntity (net.minecraft.entity.LivingEntity)1 Arm (net.minecraft.util.Arm)1 Hand (net.minecraft.util.Hand)1 Identifier (net.minecraft.util.Identifier)1 Profiler (net.minecraft.util.profiler.Profiler)1 LittleMaidModelLoader (net.sistr.littlemaidmodelloader.LittleMaidModelLoader)1 IHasMultiModel (net.sistr.littlemaidmodelloader.entity.compound.IHasMultiModel)1 IModelCaps (net.sistr.littlemaidmodelloader.maidmodel.IModelCaps)1 MMMatrixStack (net.sistr.littlemaidmodelloader.multimodel.layer.MMMatrixStack)1