net.minecraft.client.render.entity.model.BipedEntityModel Java Examples

The following examples show how to use net.minecraft.client.render.entity.model.BipedEntityModel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArmourFeature.java    From MineLittlePony with MIT License 6 votes vote down vote up
private static <T extends LivingEntity, V extends BipedEntityModel<T> & IArmour> void renderArmourPart(
        MatrixStack matrices, VertexConsumerProvider provider,
        int light, boolean glint, V model, float r, float g, float b, IArmourTextureResolver<T> resolver, ArmourLayer layer, Identifier texture) {

    VertexConsumer vertices = ItemRenderer.method_27952(provider, RenderLayer.getArmorCutoutNoCull(texture), false, glint);

    model.setVariant(resolver.getArmourVariant(layer, texture));
    model.render(matrices, vertices, light, OverlayTexture.DEFAULT_UV, r, g, b, 1);
}
 
Example #2
Source File: PonyArmourModel.java    From MineLittlePony with MIT License 6 votes vote down vote up
@Override
public void synchroniseAngles(IModel model) {
    if (model instanceof BipedEntityModel) {
        @SuppressWarnings("unchecked")
        BipedEntityModel<T> mainModel = (BipedEntityModel<T>)model;
        head.copyPositionAndRotation(mainModel.head);
        helmet.copyPositionAndRotation(mainModel.helmet);

        torso.copyPositionAndRotation(mainModel.torso);
        rightArm.copyPositionAndRotation(mainModel.rightArm);
        leftArm.copyPositionAndRotation(mainModel.leftArm);
        rightLeg.copyPositionAndRotation(mainModel.rightLeg);
        leftLeg.copyPositionAndRotation(mainModel.leftLeg);

        steveLeftLeg.copyPositionAndRotation(mainModel.leftLeg);
        steveRightLeg.copyPositionAndRotation(mainModel.rightLeg);
    }
}
 
Example #3
Source File: ClientPonyModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
/**
 * Copies this model's attributes into the passed model.
 */
@Override
public void setAttributes(BipedEntityModel<T> model) {
    super.setAttributes(model);

    if (model instanceof ClientPonyModel) {
        ((ClientPonyModel<T>)model).attributes = attributes;
        ((ClientPonyModel<T>)model).metadata = metadata;
    }
}
 
Example #4
Source File: CultistModel.java    From the-hallow with MIT License 4 votes vote down vote up
public CultistModel() {
	super(1);
	textureWidth = 128;
	textureHeight = 64;
	
	leftArmPose = BipedEntityModel.ArmPose.EMPTY;
	rightArmPose = BipedEntityModel.ArmPose.EMPTY;
	
	head = new ModelPart(this, 0, 20);
	head.setPivot(0.0F, 0.0F, 0.0F);
	head.addCuboid(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.0F, false);
	
	hood1 = new ModelPart(this, 0, 0);
	hood1.setPivot(0.0F, 1.0F, -1.0F);
	setRotationAngle(hood1, 0.1745F, 0.0F, 0.0F);
	head.addChild(hood1);
	hood1.addCuboid(-5.0F, -11.0875F, -2.0046F, 10, 11, 9, 0.0F, false);
	
	hood2 = new ModelPart(this, 32, 23);
	hood2.setPivot(0.0F, -1.0875F, 1.9954F);
	setRotationAngle(hood2, -0.2618F, 0.0F, 0.0F);
	hood1.addChild(hood2);
	hood2.addCuboid(-4.0F, -9.0F, 0.0F, 8, 7, 6, 0.0F, false);
	
	torso = new ModelPart(this, 90, 16);
	torso.setPivot(0.0F, 0.0F, 0.0F);
	torso.addCuboid(-4.0F, 0.0F, -2.0F, 8, 12, 4, 0.0F, false);
	
	cape = new ModelPart(this, 38, 0);
	cape.setPivot(0.0F, 1.0F, 2.5F);
	cape.addCuboid(-6.0F, -1.0F, -0.5F, 12, 22, 1, 0.0F, false);
	
	rightArm = new ModelPart(this);
	rightArm.setPivot(-5.0F, 2.0F, 0.0F);
	rightArm.addCuboid("right_arm", -3.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F, 64, 0);
	rightArm.addCuboid("right_garb", -4.0F, 6.0F, -3.0F, 6, 3, 7, 0.0F, 64, 16);
	rightArm.mirror = true;
	
	leftArm = new ModelPart(this);
	leftArm.setPivot(5.0F, 2.0F, 0.0F);
	leftArm.addCuboid("left_arm", -1.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F, 80, 0);
	leftArm.addCuboid("left_garb", -2.0F, 6.0F, -3.0F, 6, 3, 7, 0.0F, 64, 26);
	
	rightLeg = new ModelPart(this, 96, 0);
	rightLeg.setPivot(-1.9F, 12.0F, 0.0F);
	rightLeg.addCuboid(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F, false);
	rightLeg.mirror = true;
	
	leftLeg = new ModelPart(this, 112, 0);
	leftLeg.setPivot(1.9F, 12.0F, 0.0F);
	leftLeg.addCuboid(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F, false);
}
 
Example #5
Source File: ArmourFeature.java    From MineLittlePony with MIT License 4 votes vote down vote up
public static <T extends LivingEntity, V extends BipedEntityModel<T> & IArmour> void renderArmor(
        ModelWrapper<T, ? extends IPonyModel<T>> pony, MatrixStack stack,
                VertexConsumerProvider renderContext, int lightUv, T entity,
                float limbDistance, float limbAngle,
                float age, float headYaw, float headPitch,
                EquipmentSlot armorSlot, ArmourLayer layer) {

    ItemStack itemstack = entity.getEquippedStack(armorSlot);

    if (!itemstack.isEmpty() && itemstack.getItem() instanceof ArmorItem) {

        V model = pony.<V>getArmor().getArmorForLayer(layer);

        if (model.prepareToRender(armorSlot, layer)) {
            pony.getBody().copyAttributes(model);
            model.setAngles(entity, limbAngle, limbDistance, age, headYaw, headPitch);
            model.synchroniseAngles(pony.getBody());

            ArmorItem item = (ArmorItem) itemstack.getItem();

            float red = 1;
            float green = 1;
            float blue = 1;

            if (item instanceof DyeableArmorItem) {
                int color = ((DyeableArmorItem)item).getColor(itemstack);
                red = Color.r(color);
                green = Color.g(color);
                blue = Color.b(color);
            }

            @SuppressWarnings("unchecked")
            IArmourTextureResolver<T> resolver = model instanceof IArmourTextureResolver ? (IArmourTextureResolver<T>)model : (IArmourTextureResolver<T>)DEFAULT;

            boolean glint = itemstack.hasEnchantmentGlint();

            renderArmourPart(stack, renderContext, lightUv, glint, model, red, green, blue, resolver, layer, resolver.getArmourTexture(entity, itemstack, armorSlot, layer, null));

            if (item instanceof DyeableArmorItem) {
                renderArmourPart(stack, renderContext, lightUv, false, model, 1, 1, 1, resolver, layer, resolver.getArmourTexture(entity, itemstack, armorSlot, layer, "overlay"));
            }
        }
    }
}
 
Example #6
Source File: ClientPonyModel.java    From MineLittlePony with MIT License 4 votes vote down vote up
@Override
public void copyAttributes(BipedEntityModel<T> other) {
    setAttributes(other);
}
 
Example #7
Source File: IPonyMixinModel.java    From MineLittlePony with MIT License 4 votes vote down vote up
@Override
default void copyAttributes(BipedEntityModel<T> other) {
    mixin().copyAttributes(other);
}
 
Example #8
Source File: IForgeItem.java    From patchwork-api with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Override this method to have an item handle its own armor rendering.
 *
 * @param entityLiving The entity wearing the armor
 * @param itemStack    The itemStack to render the model of
 * @param armorSlot    The slot the armor is in
 * @param _default     Original armor model. Will have attributes set.
 * @return A BipedEntityModel to render instead of the default
 */
@Environment(EnvType.CLIENT)
@Nullable
default <A extends BipedEntityModel<?>> A getArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlot armorSlot, A _default) {
	return null;
}
 
Example #9
Source File: IPonyModel.java    From MineLittlePony with MIT License votes vote down vote up
void copyAttributes(BipedEntityModel<T> other);