net.minecraft.client.model.ModelPart Java Examples

The following examples show how to use net.minecraft.client.model.ModelPart. 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: TreasureChestModel.java    From the-hallow with MIT License 7 votes vote down vote up
public TreasureChestModel() {
	super(RenderLayer::getEntityCutoutNoCull);
	this.lid.addCuboid(0.0F, -5.0F, -14.0F, 14, 5, 14, 0.0F);
	this.lid.pivotX = 1.0F;
	this.lid.pivotY = 7.0F;
	this.lid.pivotZ = 15.0F;
	
	this.hatch = (new ModelPart(this, 0, 0)).setTextureSize(64, 64);
	this.hatch.addCuboid(-1.0F, -2.0F, -15.0F, 2, 4, 1, 0.0F);
	this.hatch.pivotX = 8.0F;
	this.hatch.pivotY = 7.0F;
	this.hatch.pivotZ = 15.0F;
	
	this.base = (new ModelPart(this, 0, 19)).setTextureSize(64, 64);
	this.base.addCuboid(0.0F, 0.0F, 0.0F, 14, 10, 14, 0.0F);
	this.base.pivotX = 1.0F;
	this.base.pivotY = 6.0F;
	this.base.pivotZ = 1.0F;
}
 
Example #2
Source File: PonyTail.java    From MineLittlePony with MIT License 6 votes vote down vote up
@Override
public void init(ModelContext context) {
    theModel = context.getModel();

    tail = new ModelPart(theModel);

    try {
        int segments = context.getLocals().getValue("segments").get().intValue();

        ModelContext subContext = context.resolve(this);

        for (int i = 0; i < segments; i++) {
            Segment segment = subContext.findByName("segment_" + i);
            segment.index = i;
            tail.addChild(segment);
        }

    } catch (InterruptedException | ExecutionException e) {
        throw new RuntimeException(e);
    }
}
 
Example #3
Source File: BreezieModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
protected void raiseArm(ModelPart up, ModelPart down, float factor) {
    up.yaw = head.yaw + (factor / 10);
    up.pitch = head.pitch - (PI / 2);

    down.yaw = head.yaw - (factor / 2);
    down.pitch = head.pitch - (PI / 2);
}
 
Example #4
Source File: AbstractPonyModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
/**
 * Animates arm swinging.
 *
 * @param arm       The arm to swing
 */
protected void swingArm(ModelPart arm) {
    float swing = 1 - (float)Math.pow(1 - getSwingAmount(), 3);

    float deltaX = MathHelper.sin(swing * PI);
    float deltaZ = MathHelper.sin(getSwingAmount() * PI);

    float deltaAim = deltaZ * (0.7F - head.pitch) * 0.75F;

    arm.pitch -= deltaAim + deltaX * 1.2F;
    arm.yaw += torso.yaw * 2;
    arm.roll = -deltaZ * 0.4F;
}
 
Example #5
Source File: EvolvedCreeperEntityModel.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
public EvolvedCreeperEntityModel(float scale) {
    super();
    this.textureWidth = 128;
    this.textureHeight = 64;
    this.body = new ModelPart(this, 16, 16);
    this.body.setPivot(0.0F, 6.0F, 0.0F);
    this.body.addCuboid(-4.0F, 0.0F, -2.0F, 8, 12, 4, scale);
    this.oxygenMask = new ModelPart(this, 0, 44);
    this.oxygenMask.setPivot(0.0F, 6.0F, 0.0F);
    this.oxygenMask.addCuboid(-5.0F, -9.0F, -5.0F, 10, 10, 10, scale);
    this.leg3 = new ModelPart(this, 0, 16);
    this.leg3.setPivot(-2.0F, 18.0F, -4.0F);
    this.leg3.addCuboid(-2.0F, 0.0F, -2.0F, 4, 6, 4, scale);
    this.leg1 = new ModelPart(this, 0, 16);
    this.leg1.setPivot(-2.0F, 18.0F, 4.0F);
    this.leg1.addCuboid(-2.0F, 0.0F, -2.0F, 4, 6, 4, scale);
    this.oxygenTank1 = new ModelPart(this, 0, 34);
    this.oxygenTank1.setPivot(0.0F, 6.0F, 0.0F);
    this.oxygenTank1.addCuboid(-4.0F, 1.0F, 2.0F, 8, 6, 4, scale);
    this.creeperArmor = new ModelPart(this, 32, 0);
    this.creeperArmor.setPivot(0.0F, 6.0F, 0.0F);
    this.creeperArmor.addCuboid(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.5F);
    this.head = new ModelPart(this, 0, 0);
    this.head.setPivot(0.0F, 6.0F, 0.0F);
    this.head.addCuboid(-4.0F, -8.0F, -4.0F, 8, 8, 8, scale);
    this.oxygenTankPipe1 = new ModelPart(this, 40, 51);
    this.oxygenTankPipe1.setPivot(0.0F, 2.0F, 0.0F);
    this.oxygenTankPipe1.addCuboid(-2.0F, -3.0F, 0.0F, 4, 5, 8, scale);
    this.leg4 = new ModelPart(this, 0, 16);
    this.leg4.setPivot(2.0F, 18.0F, -4.0F);
    this.leg4.addCuboid(-2.0F, 0.0F, -2.0F, 4, 6, 4, scale);
    this.leg2 = new ModelPart(this, 0, 16);
    this.leg2.setPivot(2.0F, 18.0F, 4.0F);
    this.leg2.addCuboid(-2.0F, 0.0F, -2.0F, 4, 6, 4, scale);
    this.oxygenTank1.addChild(this.oxygenTankPipe1);
}
 
Example #6
Source File: AbstractPonyModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
protected void aimBow(ModelPart arm, float ticks) {
    arm.pitch = ROTATE_270 + head.pitch + (MathHelper.sin(ticks * 0.067F) * 0.05F);
    arm.yaw = head.yaw - 0.06F;
    arm.roll = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;

    if (isSneaking) {
        arm.pivotY += 4;
    }
}
 
Example #7
Source File: BreezieModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
protected void rotateArm(ModelPart arm, ArmPose pose, float factor) {
    switch (pose) {
        case EMPTY:
            arm.yaw = 0;
            break;
        case ITEM:
            arm.pitch = arm.pitch / 2 - (PI / 10);
            arm.yaw = 0;
        case BLOCK:
            arm.pitch = arm.pitch / 2 - 0.9424779F;
            arm.yaw = factor * 0.5235988F;
            break;
        default:
    }
}
 
Example #8
Source File: AbstractPonyModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
public ModelPart getBodyPart(BodyPart part) {
    switch (part) {
        default:
        case HEAD: return head;
        case NECK: return neck;
        case TAIL:
        case LEGS:
        case BODY: return torso;
    }
}
 
Example #9
Source File: UnicornModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
public ModelPart getArm(Arm side) {
    if (canCast() && getArmPoseForSide(side) != ArmPose.EMPTY) {
        return getUnicornArmForSide(side);
    }
    return super.getArm(side);
}
 
Example #10
Source File: GlowingItemFeature.java    From MineLittlePony with MIT License 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected void renderArm(Arm arm, MatrixStack stack) {
    if (isUnicorn()) {
        ((IUnicorn<ModelPart>)getContextModel()).getUnicornArmForSide(arm).rotate(stack);
    } else {
        super.renderArm(arm, stack);
    }
}
 
Example #11
Source File: ClientPonyModel.java    From MineLittlePony with MIT License 4 votes vote down vote up
@Override
public ModelPart getArm(Arm side) {
    return super.getArm(side);
}
 
Example #12
Source File: UnicornModel.java    From MineLittlePony with MIT License 4 votes vote down vote up
@Override
public ModelPart getUnicornArmForSide(Arm side) {
    return side == Arm.LEFT ? unicornArmLeft : unicornArmRight;
}
 
Example #13
Source File: AbstractGear.java    From MineLittlePony with MIT License 4 votes vote down vote up
public void addPart(ModelPart t) {
    parts.add(t);
}
 
Example #14
Source File: PonySkullModel.java    From MineLittlePony with MIT License 4 votes vote down vote up
@Override
public ModelPart getHead() {
    return skull;
}
 
Example #15
Source File: ClientPonyModel.java    From MineLittlePony with MIT License 4 votes vote down vote up
@Override
public ModelPart getHead() {
    return head;
}
 
Example #16
Source File: IPonyMixinModel.java    From MineLittlePony with MIT License 4 votes vote down vote up
@Override
default ModelPart getBodyPart(BodyPart part) {
    return mixin().getBodyPart(part);
}
 
Example #17
Source File: AbstractPonyModel.java    From MineLittlePony with MIT License 4 votes vote down vote up
/**
 * Aligns an arm for the appropriate arm pose
 *
 * @param arm   The arm model to align
 * @param pose  The post to align to
 * @param both  True if we have something in both hands
 * @param swing     Degree to which each 'limb' swings.
 */
protected void alignArmForAction(ModelPart arm, ArmPose pose, ArmPose complement, boolean both, float swing, float reflect) {
    switch (pose) {
        case ITEM:
            arm.yaw = 0;

            if ((!both || reflect == (attributes.isLeftHanded ? 1 : -1)) && complement != ArmPose.BLOCK) {
                float swag = 1;
                if (!isFlying() && both) {
                    swag -= (float)Math.pow(swing, 2);
                }

                float mult = 1 - swag/2;
                arm.pitch = arm.pitch * mult - (PI / 10) * swag;
                arm.roll = -reflect * (PI / 15);

                if (attributes.isCrouching) {
                    arm.pivotX -= reflect * 2;
                }
            }

            break;
        case EMPTY:
            arm.yaw = 0;
            break;
        case BLOCK:
            arm.pitch = (arm.pitch / 2 - 0.9424779F) - 0.3F;
            arm.yaw = reflect * PI / 9;
            if (complement == pose) {
                arm.yaw -= reflect * PI / 18;
            }
            arm.pivotX += reflect;
            arm.pivotZ += 3;
            if (attributes.isCrouching) {
                arm.pivotY += 4;
            }
            break;
        case BOW_AND_ARROW:
            aimBow(arm, swing);
            break;
        case CROSSBOW_HOLD:
            aimBow(arm, swing);

            arm.pitch = head.pitch - ROTATE_90;
            arm.yaw = head.yaw + 0.06F;
            break;
        case CROSSBOW_CHARGE:
            aimBow(arm, swing);

            arm.pitch = -0.8F;
            arm.yaw = head.yaw + 0.06F;
            break;
        case THROW_SPEAR:
            arm.pitch = ROTATE_90 * 2;
            break;
    }
}
 
Example #18
Source File: IPonyMixinModel.java    From MineLittlePony with MIT License 4 votes vote down vote up
@Override
default ModelPart getHead() {
    return mixin().getHead();
}
 
Example #19
Source File: BasicSolarPanelBlockEntityRenderer.java    From Galacticraft-Rewoven with MIT License 4 votes vote down vote up
public BasicSolarPanelBlockEntityRenderer(BlockEntityRenderDispatcher dispatcher) {
    super(dispatcher);
    this.panelMain = new ModelPart(256, 128, 0, 0);
    this.panelMain.addCuboid(-23F, -0.5F, -23F, 46, 1, 46);
    this.panelMain.setPivot(0F, 0F, 0F);
    this.panelMain.setTextureSize(256, 128);
    this.panelMain.mirror = true;
    this.setRotation(this.panelMain);
    this.sideHorizontal0 = new ModelPart(256, 128, 0, 48);
    this.sideHorizontal0.addCuboid(-24F, -1.111F, -23F, 1, 1, 46);
    this.sideHorizontal0.setPivot(0F, 0F, 0F);
    this.sideHorizontal0.setTextureSize(256, 128);
    this.sideHorizontal0.mirror = true;
    this.setRotation(this.sideHorizontal0);
    this.sideVertical0 = new ModelPart(256, 128, 94, 48);
    this.sideVertical0.addCuboid(-24F, -1.1F, 23F, 48, 1, 1);
    this.sideVertical0.setPivot(0F, 0F, 0F);
    this.sideVertical0.setTextureSize(256, 128);
    this.sideVertical0.mirror = true;
    this.setRotation(this.sideVertical0);
    this.sideVertical2 = new ModelPart(256, 128, 94, 48);
    this.sideVertical2.addCuboid(-24F, -1.1F, -24F, 48, 1, 1);
    this.sideVertical2.setPivot(0F, 0F, 0F);
    this.sideVertical2.setTextureSize(256, 128);
    this.sideVertical2.mirror = true;
    this.setRotation(this.sideVertical2);
    this.sideVertical1 = new ModelPart(256, 128, 94, 48);
    this.sideVertical1.addCuboid(-24F, -1.1F, -0.5F, 48, 1, 1);
    this.sideVertical1.setPivot(0F, 0F, 0F);
    this.sideVertical1.setTextureSize(256, 128);
    this.sideVertical1.mirror = true;
    this.setRotation(this.sideVertical1);
    this.sideHorizontal1 = new ModelPart(256, 128, 0, 48);
    this.sideHorizontal1.addCuboid(-9F, -1.111F, -23F, 1, 1, 46);
    this.sideHorizontal1.setPivot(0F, 0F, 0F);
    this.sideHorizontal1.setTextureSize(256, 128);
    this.sideHorizontal1.mirror = true;
    this.setRotation(this.sideHorizontal1);
    this.sideHorizontal3 = new ModelPart(256, 128, 0, 48);
    this.sideHorizontal3.addCuboid(23F, -1.111F, -23F, 1, 1, 46);
    this.sideHorizontal3.setPivot(0F, 0F, 0F);
    this.sideHorizontal3.setTextureSize(256, 128);
    this.sideHorizontal3.mirror = true;
    this.setRotation(this.sideHorizontal3);
    this.sideHorizontal2 = new ModelPart(256, 128, 0, 48);
    this.sideHorizontal2.addCuboid(8F, -1.111F, -23F, 1, 1, 46);
    this.sideHorizontal2.setPivot(0F, 0F, 0F);
    this.sideHorizontal2.setTextureSize(256, 128);
    this.sideHorizontal2.mirror = true;
    this.setRotation(this.sideHorizontal2);
    this.pole = new ModelPart(256, 128, 94, 50);
    this.pole.addCuboid(-1.5F, 0.0F, -1.5F, 3, 24, 3);
    this.pole.setPivot(0F, 0F, 0F);
    this.pole.setTextureSize(256, 128);
    this.pole.mirror = true;
    this.setRotation(this.pole);
}
 
Example #20
Source File: EnderStallionModel.java    From MineLittlePony with MIT License 4 votes vote down vote up
@Override
public void rotateArmHolding(ModelPart arm, float direction, float swingProgress, float ticks) {
    arm.pitch = -0.3707964F;
    arm.pitch += 0.4F + MathHelper.sin(ticks * 0.067F) / 10;
}
 
Example #21
Source File: BreezieModel.java    From MineLittlePony with MIT License 4 votes vote down vote up
@Override
protected Iterable<ModelPart> getBodyParts() {
    return Iterables.concat(super.getBodyParts(), ImmutableList.of(neck, leftWing, rightWing));
}
 
Example #22
Source File: PonyElytra.java    From MineLittlePony with MIT License 4 votes vote down vote up
@Override
protected Iterable<ModelPart> getBodyParts() {
    return ImmutableList.of(leftWing, rightWing);
}
 
Example #23
Source File: PonyElytra.java    From MineLittlePony with MIT License 4 votes vote down vote up
@Override
protected Iterable<ModelPart> getHeadParts() {
    return ImmutableList.of();
}
 
Example #24
Source File: CultistModel.java    From the-hallow with MIT License 4 votes vote down vote up
public void setRotationAngle(ModelPart cuboid, float x, float y, float z) {
	cuboid.pitch = x;
	cuboid.yaw = y;
	cuboid.roll = z;
}
 
Example #25
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 #26
Source File: TreasureChestModel.java    From the-hallow with MIT License 4 votes vote down vote up
public ModelPart getLid() {
	return this.lid;
}
 
Example #27
Source File: CrowEntityModel.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
public ModelPart getHead() {
	return head;
}
 
Example #28
Source File: CrowEntityModel.java    From the-hallow with MIT License 4 votes vote down vote up
public void setRotationAngle(ModelPart ModelPart, float x, float y, float z) {
	ModelPart.pitch = x;
	ModelPart.yaw = y;
	ModelPart.roll = z;
}
 
Example #29
Source File: CrowEntityModel.java    From the-hallow with MIT License 4 votes vote down vote up
public CrowEntityModel() {
	textureWidth = 32;
	textureHeight = 16;
	
	body = new ModelPart(this, 0, 0);
	body.setPivot(0.0F, 22.0F, 0.0F);
	setRotationAngle(body, 0.6109F, 0.0F, 0.0F);
	body.addCuboid(-1.5F, -5.5F, -1.0F, 3, 6, 3, 0.0F, false);
	
	leftLeg = new ModelPart(this);
	leftLeg.setPivot(1.0F, 0.0F, 1.0F);
	setRotationAngle(leftLeg, -0.6109F, 0.0F, 0.0F);
	body.addChild(leftLeg);
	leftLeg.addCuboid("left_leg", -0.75F, -0.5F, 0.0F, 1, 3, 0, 0.0F, 0, 0);
	leftLeg.addCuboid("left_foot", -0.75F, 2.5F, -1.0F, 1, 0, 1, 0.0F, 6, 9);
	
	rightLeg = new ModelPart(this);
	rightLeg.setPivot(-1.0F, 0.0F, 1.0F);
	setRotationAngle(rightLeg, -0.6109F, 0.0F, 0.0F);
	body.addChild(rightLeg);
	rightLeg.addCuboid("right_leg", -0.25F, -0.5F, 0.0F, 1, 3, 0, 0.0F, 10, 0);
	rightLeg.addCuboid("right_foot", -0.25F, 2.5F, -1.0F, 1, 0, 1, 0.0F, 6, 10);
	
	tail = new ModelPart(this, 8, 9);
	tail.setPivot(0.0F, 0.0F, 1.5F);
	setRotationAngle(tail, -0.8727F, 0.0F, 0.0F);
	body.addChild(tail);
	tail.addCuboid(-1.5F, -0.5F, -0.5F, 3, 1, 3, 0.0F, false);
	
	leftWing = new ModelPart(this, 12, 0);
	leftWing.setPivot(1.5F, -5.0F, 0.5F);
	setRotationAngle(leftWing, 0.3491F, 0.0F, 0.0F);
	body.addChild(leftWing);
	leftWing.addCuboid(-0.25F, 0.0F, -2.0F, 1, 5, 3, 0.0F, false);
	
	rightWing = new ModelPart(this, 20, 0);
	rightWing.setPivot(-1.5F, -5.0F, 0.5F);
	setRotationAngle(rightWing, 0.3491F, 0.0F, 0.0F);
	body.addChild(rightWing);
	rightWing.addCuboid(-0.75F, 0.0F, -2.0F, 1, 5, 3, 0.0F, false);
	
	head = new ModelPart(this);
	head.setPivot(0.0F, -5.5F, 1.0F);
	setRotationAngle(head, -0.4363F, 0.0F, 0.0F);
	body.addChild(head);
	head.addCuboid("head", -1.0F, -2.0F, -1.5F, 2, 3, 2, 0.0F, 0, 9);
	head.addCuboid("beak", -0.5F, -1.0F, -3.0F, 1, 1, 2, 0.0F, 17, 0);
}
 
Example #30
Source File: EvolvedZombieModel.java    From Galacticraft-Rewoven with MIT License 4 votes vote down vote up
@Override
protected Iterable<ModelPart> getBodyParts() {
    return ImmutableList.of(this.torso, this.rightArm, this.leftArm, this.rightLeg, this.leftLeg, this.helmet, this.oxygenTankWire0, this.oxygenTankWire1,
            this.oxygenTankWire2, this.oxygenTankWire3, this.oxygenTankWire4, this.oxygenTankWire5, this.oxygenMask, this.oxygenTank0, this.oxygenTank1
    );
}