Search in sources :

Example 1 with BipedModel

use of net.minecraft.client.renderer.entity.model.BipedModel in project iChunUtil by iChun.

the class HeadInfo method preChildEntHeadRenderCalls.

@OnlyIn(Dist.CLIENT)
public void preChildEntHeadRenderCalls(E living, MatrixStack stack, LivingRenderer<E, ?> render) {
    if (// I don't like this if statement any more than you do.
    living.isChild()) {
        if (// there is a child override
        childEntityScale != null || childEntityOffset != null) {
            if (childEntityScale != null) {
                stack.scale(childEntityScale[0], childEntityScale[1], childEntityScale[2]);
            }
            if (childEntityOffset != null) {
                stack.translate(childEntityOffset[0], childEntityOffset[1], childEntityOffset[2]);
            }
        } else // default to MC scaling
        {
            float modelScale = 0.0625F;
            Model model = render.getEntityModel();
            if (model instanceof BipedModel) {
                stack.scale(0.75F, 0.75F, 0.75F);
                stack.translate(0.0F, 16.0F * modelScale, 0.0F);
            } else if (model instanceof AgeableModel) {
                AgeableModel<?> ageableModel = (AgeableModel<?>) model;
                if (ageableModel.isChildHeadScaled) {
                    float f = 1.5F / ageableModel.childHeadScale;
                    stack.scale(f, f, f);
                }
                stack.translate(0.0F, ageableModel.childHeadOffsetY * modelScale, ageableModel.childHeadOffsetZ * modelScale);
            }
        }
    }
}
Also used : AgeableModel(net.minecraft.client.renderer.entity.model.AgeableModel) EntityModel(net.minecraft.client.renderer.entity.model.EntityModel) BipedModel(net.minecraft.client.renderer.entity.model.BipedModel) AgeableModel(net.minecraft.client.renderer.entity.model.AgeableModel) Model(net.minecraft.client.renderer.model.Model) BipedModel(net.minecraft.client.renderer.entity.model.BipedModel) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 2 with BipedModel

use of net.minecraft.client.renderer.entity.model.BipedModel in project BudschieMorphMod by Budschie.

the class PlayerRendererMixin method renderLeftArm.

@Inject(at = @At("HEAD"), method = "renderLeftArm(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/player/AbstractClientPlayerEntity;)V", cancellable = true)
private void renderLeftArm(MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, AbstractClientPlayerEntity playerIn, CallbackInfo info) {
    if (checkMorphPresent(playerIn)) {
        // RenderHandler.checkCache(playerIn);
        info.cancel();
        Entity cachedEntity = RenderHandler.getCachedEntity(playerIn);
        EntityRenderer<?> renderer = Minecraft.getInstance().getRenderManager().getRenderer(cachedEntity);
        if (renderer instanceof LivingRenderer<?, ?>) {
            ModelRenderer armRenderer = null;
            LivingRenderer<? super LivingEntity, ?> living = (LivingRenderer<? super LivingEntity, ?>) renderer;
            if (living.entityModel instanceof BipedModel<?>)
                armRenderer = ((BipedModel<?>) living.entityModel).bipedRightArm;
            if (living.entityModel instanceof QuadrupedModel<?>)
                armRenderer = ((QuadrupedModel<?>) living.entityModel).legFrontLeft;
            if (armRenderer != null)
                renderArm(true, playerIn, armRenderer, matrixStackIn, combinedLightIn, bufferIn, living, (LivingEntity) cachedEntity, combinedLightIn);
        }
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) MobEntity(net.minecraft.entity.MobEntity) AbstractClientPlayerEntity(net.minecraft.client.entity.player.AbstractClientPlayerEntity) Entity(net.minecraft.entity.Entity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) ModelRenderer(net.minecraft.client.renderer.model.ModelRenderer) QuadrupedModel(net.minecraft.client.renderer.entity.model.QuadrupedModel) LivingRenderer(net.minecraft.client.renderer.entity.LivingRenderer) BipedModel(net.minecraft.client.renderer.entity.model.BipedModel) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 3 with BipedModel

use of net.minecraft.client.renderer.entity.model.BipedModel in project BudschieMorphMod by Budschie.

the class PlayerRendererMixin method renderRightArm.

@Inject(at = @At("HEAD"), method = "renderRightArm(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;ILnet/minecraft/client/entity/player/AbstractClientPlayerEntity;)V", cancellable = true)
private void renderRightArm(MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, AbstractClientPlayerEntity playerIn, CallbackInfo info) {
    if (checkMorphPresent(playerIn)) {
        // RenderHandler.checkCache(playerIn);
        info.cancel();
        Entity cachedEntity = RenderHandler.getCachedEntity(playerIn);
        EntityRenderer<?> renderer = Minecraft.getInstance().getRenderManager().getRenderer(cachedEntity);
        if (renderer instanceof LivingRenderer<?, ?>) {
            ModelRenderer armRenderer = null;
            LivingRenderer<? super LivingEntity, ?> living = (LivingRenderer<? super LivingEntity, ?>) renderer;
            if (living.entityModel instanceof BipedModel<?>)
                armRenderer = ((BipedModel<?>) living.entityModel).bipedRightArm;
            if (living.entityModel instanceof QuadrupedModel<?>)
                armRenderer = ((QuadrupedModel<?>) living.entityModel).legFrontRight;
            if (armRenderer != null)
                renderArm(false, playerIn, armRenderer, matrixStackIn, combinedLightIn, bufferIn, living, (LivingEntity) cachedEntity, combinedLightIn);
        }
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) MobEntity(net.minecraft.entity.MobEntity) AbstractClientPlayerEntity(net.minecraft.client.entity.player.AbstractClientPlayerEntity) Entity(net.minecraft.entity.Entity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) ModelRenderer(net.minecraft.client.renderer.model.ModelRenderer) QuadrupedModel(net.minecraft.client.renderer.entity.model.QuadrupedModel) LivingRenderer(net.minecraft.client.renderer.entity.LivingRenderer) BipedModel(net.minecraft.client.renderer.entity.model.BipedModel) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 4 with BipedModel

use of net.minecraft.client.renderer.entity.model.BipedModel in project Kingdom-Keys by Wehavecookies56.

the class BaseArmorItem method getArmorModel.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
@OnlyIn(Dist.CLIENT)
public BipedModel getArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlotType armorSlot, BipedModel original) {
    BipedModel armorModel = ProxyClient.armorModels.get(this);
    if (armorModel != null) {
        armorModel.bipedHead.showModel = armorSlot == EquipmentSlotType.HEAD;
        armorModel.bipedHeadwear.showModel = false;
        armorModel.bipedBody.showModel = armorSlot == EquipmentSlotType.CHEST || armorSlot == EquipmentSlotType.LEGS;
        armorModel.bipedRightArm.showModel = armorSlot == EquipmentSlotType.CHEST;
        armorModel.bipedLeftArm.showModel = armorSlot == EquipmentSlotType.CHEST;
        armorModel.bipedRightLeg.showModel = armorSlot == EquipmentSlotType.FEET || armorSlot == EquipmentSlotType.FEET;
        armorModel.bipedLeftLeg.showModel = armorSlot == EquipmentSlotType.LEGS || armorSlot == EquipmentSlotType.FEET;
    }
    return armorModel;
}
Also used : BipedModel(net.minecraft.client.renderer.entity.model.BipedModel) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 5 with BipedModel

use of net.minecraft.client.renderer.entity.model.BipedModel in project CustomPlayerModels by tom5454.

the class ElytraLayerMixin method onGetRenderTypeNoSkin.

@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderType;armorCutoutNoCull(" + "Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType;", ordinal = 0), method = "render(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;I" + "Lnet/minecraft/entity/LivingEntity;FFFFFF)V")
private RenderType onGetRenderTypeNoSkin(ResourceLocation resLoc, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn, LivingEntity entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
    if (getParentModel() instanceof BipedModel) {
        ModelTexture mt = new ModelTexture(resLoc, PlayerRenderManager.armor);
        ClientProxy.mc.getPlayerRenderManager().bindSkin(elytraModel, mt, TextureSheetType.ELYTRA);
        return mt.getRenderType();
    }
    return RenderType.armorCutoutNoCull(resLoc);
}
Also used : BipedModel(net.minecraft.client.renderer.entity.model.BipedModel) ModelTexture(com.tom.cpm.client.ModelTexture) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Aggregations

BipedModel (net.minecraft.client.renderer.entity.model.BipedModel)11 LivingRenderer (net.minecraft.client.renderer.entity.LivingRenderer)4 ModelRenderer (net.minecraft.client.renderer.model.ModelRenderer)3 LivingEntity (net.minecraft.entity.LivingEntity)3 PlayerEntity (net.minecraft.entity.player.PlayerEntity)3 AbstractClientPlayerEntity (net.minecraft.client.entity.player.AbstractClientPlayerEntity)2 QuadrupedModel (net.minecraft.client.renderer.entity.model.QuadrupedModel)2 Entity (net.minecraft.entity.Entity)2 MobEntity (net.minecraft.entity.MobEntity)2 ItemStack (net.minecraft.item.ItemStack)2 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)2 Inject (org.spongepowered.asm.mixin.injection.Inject)2 ModelTexture (com.tom.cpm.client.ModelTexture)1 NandbricArmorModel (io.github.bioplethora.client.armor.model.NandbricArmorModel)1 ReinforcedFleignariteArmorModel (io.github.bioplethora.client.armor.model.ReinforcedFleignariteArmorModel)1 Supplier (java.util.function.Supplier)1 Stream (java.util.stream.Stream)1 Proxy (me.paulf.wings.Proxy)1 WingsMod (me.paulf.wings.WingsMod)1 WingForm (me.paulf.wings.client.apparatus.WingForm)1