Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.examplemod.client.model;
- import com.example.examplemod.entity.WarpedPiglinBruteEntity;
- import com.example.examplemod.entity.WarpedPiglinEntity;
- import com.google.common.collect.ImmutableList;
- import com.google.common.collect.Iterables;
- import com.mojang.blaze3d.matrix.MatrixStack;
- import com.mojang.blaze3d.vertex.IVertexBuilder;
- import net.minecraft.client.renderer.entity.model.BipedModel;
- import net.minecraft.client.renderer.entity.model.EntityModel;
- import net.minecraft.client.renderer.entity.model.PlayerModel;
- import net.minecraft.client.renderer.model.ModelHelper;
- import net.minecraft.client.renderer.model.ModelRenderer;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityType;
- import net.minecraft.entity.monster.piglin.AbstractPiglinEntity;
- import net.minecraft.entity.monster.piglin.PiglinAction;
- import net.minecraft.entity.monster.piglin.PiglinEntity;
- import net.minecraft.util.math.MathHelper;
- // Made with Blockbench 4.1.2
- // Exported for Minecraft version 1.15 - 1.16 with Mojang mappings
- // Paste this class into your mod and generate all required imports
- public class WarpedPiglinModel extends PlayerModel<WarpedPiglinEntity> {
- private final ModelRenderer earLeft;
- private final ModelRenderer leftArmDefault;
- private final ModelRenderer rightArmDefault;
- private final ModelRenderer body_r1;
- private final ModelRenderer body_r2;
- private final ModelRenderer rightItem;
- private final ModelRenderer earRight;
- private final ModelRenderer headDefault;
- private final ModelRenderer body_r3;
- private final ModelRenderer body_r4;
- private final ModelRenderer bodyDefault;
- private final ModelRenderer body_r5;
- private final ModelRenderer body_r6;
- public WarpedPiglinModel() {
- super(0.0F, false);
- texWidth = 128;
- texHeight = 128;
- leftLeg = new ModelRenderer(this);
- leftLeg.setPos(1.9F, 12.0F, 0.0F);
- leftLeg.texOffs(44, 42).addBox(-1.9F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, 0.0F, false);
- leftLeg.texOffs(36, 10).addBox(-1.9F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, 0.25F, false);
- rightLeg = new ModelRenderer(this);
- rightLeg.setPos(-1.9F, 12.0F, 0.0F);
- rightLeg.texOffs(16, 46).addBox(-2.1F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, 0.0F, false);
- rightLeg.texOffs(0, 46).addBox(-2.1F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, 0.25F, false);
- leftArmDefault = new ModelRenderer(this);
- leftArmDefault.setPos(5.0F, 2.0F, 0.0F);
- leftArmDefault.texOffs(52, 0).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, 0.0F, false);
- leftArmDefault.texOffs(48, 22).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, 0.25F, false);
- rightArmDefault = new ModelRenderer(this);
- rightArmDefault.setPos(-5.0F, 2.0F, 0.0F);
- rightArmDefault.texOffs(56, 54).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, 0.0F, false);
- rightArmDefault.texOffs(32, 54).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, 0.25F, false);
- body_r1 = new ModelRenderer(this);
- body_r1.setPos(1.0F, 6.5F, 2.5F);
- rightArmDefault.addChild(body_r1);
- setRotationAngle(body_r1, 1.4292F, -0.1666F, -0.8608F);
- body_r1.texOffs(0, 0).addBox(0.0F, -2.5F, -2.5F, 0.0F, 5.0F, 5.0F, 0.0F, false);
- body_r2 = new ModelRenderer(this);
- body_r2.setPos(1.0F, 6.5F, 2.5F);
- rightArmDefault.addChild(body_r2);
- setRotationAngle(body_r2, -0.8727F, -1.3526F, 1.5708F);
- body_r2.texOffs(0, 0).addBox(0.0F, -2.5F, -2.5F, 0.0F, 5.0F, 5.0F, 0.0F, false);
- headDefault = new ModelRenderer(this);
- headDefault.setPos(0.0F, 0.0F, 0.0F);
- headDefault.texOffs(0, 14).addBox(-5.0F, -8.0F, -4.0F, 10.0F, 8.0F, 8.0F, -0.02F, false);
- headDefault.texOffs(36, 26).addBox(-3.0F, 0.0F, -4.0F, 6.0F, 2.0F, 0.0F, -0.02F, false);
- headDefault.texOffs(0, 0).addBox(-2.0F, -4.0F, -5.0F, 4.0F, 4.0F, 1.0F, 0.0F, false);
- headDefault.texOffs(4, 14).addBox(2.0F, -2.0F, -5.0F, 1.0F, 2.0F, 1.0F, 0.0F, false);
- headDefault.texOffs(0, 14).addBox(-3.0F, -2.0F, -5.0F, 1.0F, 2.0F, 1.0F, 0.0F, false);
- body_r3 = new ModelRenderer(this);
- body_r3.setPos(0.0F, -9.5F, 0.5F);
- headDefault.addChild(body_r3);
- setRotationAngle(body_r3, 0.0F, -1.0036F, 1.8762F);
- body_r3.texOffs(0, 0).addBox(0.0F, -2.5F, -2.5F, 0.0F, 5.0F, 5.0F, 0.0F, false);
- body_r4 = new ModelRenderer(this);
- body_r4.setPos(0.0F, -9.5F, 0.5F);
- headDefault.addChild(body_r4);
- setRotationAngle(body_r4, 1.0036F, 0.0F, 0.3054F);
- body_r4.texOffs(0, 0).addBox(0.0F, -2.5F, -2.5F, 0.0F, 5.0F, 5.0F, 0.0F, false);
- earRight = new ModelRenderer(this);
- earRight.setPos(-5.0F, -6.0F, 0.0F);
- headDefault.addChild(earRight);
- setRotationAngle(earRight, 0.0F, 0.0F, 0.5236F);
- earRight.texOffs(30, 0).addBox(0.0F, 0.0F, -2.0F, 1.0F, 5.0F, 4.0F, 0.0F, false);
- earLeft = new ModelRenderer(this);
- earLeft.setPos(5.0F, -6.0F, 0.0F);
- headDefault.addChild(earLeft);
- setRotationAngle(earLeft, 0.0F, 0.0F, -0.5236F);
- earLeft.texOffs(40, 0).addBox(-1.0F, 0.0F, -2.0F, 1.0F, 5.0F, 4.0F, 0.0F, false);
- hat = new ModelRenderer(this);
- hat.setPos(0.0F, 0.0F, 0.0F);
- head.addChild(hat);
- rightItem = new ModelRenderer(this);
- rightItem.setPos(-1.0F, 7.0F, 1.0F);
- rightArmDefault.addChild(rightItem);
- bodyDefault = new ModelRenderer(this);
- bodyDefault.setPos(0.0F, 0.0F, 0.0F);
- bodyDefault.texOffs(24, 30).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, 0.0F, false);
- bodyDefault.texOffs(0, 30).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, 0.25F, false);
- body_r5 = new ModelRenderer(this);
- body_r5.setPos(1.0F, 6.5F, 2.5F);
- bodyDefault.addChild(body_r5);
- setRotationAngle(body_r5, 0.0F, -0.9163F, 1.8762F);
- body_r5.texOffs(0, 0).addBox(0.0F, -2.5F, -2.5F, 0.0F, 5.0F, 5.0F, 0.0F, false);
- body_r6 = new ModelRenderer(this);
- body_r6.setPos(1.0F, 6.5F, 2.5F);
- bodyDefault.addChild(body_r6);
- setRotationAngle(body_r6, 0.9163F, 0.0F, 0.3054F);
- body_r6.texOffs(0, 0).addBox(0.0F, -2.5F, -2.5F, 0.0F, 5.0F, 5.0F, 0.0F, false);
- }
- public void setupAnim(WarpedPiglinEntity pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) {
- super.setupAnim(pEntity, pLimbSwing, pLimbSwingAmount, pAgeInTicks, pNetHeadYaw, pHeadPitch);
- this.body.copyFrom(this.bodyDefault);
- this.head.copyFrom(this.headDefault);
- this.leftArm.copyFrom(this.leftArmDefault);
- this.rightArm.copyFrom(this.rightArmDefault);
- float f = ((float)Math.PI / 6F);
- float f1 = pAgeInTicks * 0.1F + pLimbSwing * 0.5F;
- float f2 = 0.08F + pLimbSwingAmount * 0.4F;
- this.earRight.zRot = (-(float)Math.PI / 6F) - MathHelper.cos(f1 * 1.2F) * f2;
- this.earLeft.zRot = ((float)Math.PI / 6F) + MathHelper.cos(f1) * f2;
- PiglinAction piglinaction = ((AbstractPiglinEntity)pEntity).getArmPose();
- if (piglinaction == PiglinAction.DANCING) {
- float f3 = pAgeInTicks / 60.0F;
- this.earLeft.zRot = ((float)Math.PI / 6F) + ((float)Math.PI / 180F) * MathHelper.sin(f3 * 30.0F) * 10.0F;
- this.earRight.zRot = (-(float)Math.PI / 6F) - ((float)Math.PI / 180F) * MathHelper.cos(f3 * 30.0F) * 10.0F;
- this.head.x = MathHelper.sin(f3 * 10.0F);
- this.head.y = MathHelper.sin(f3 * 40.0F) + 0.4F;
- this.rightArm.zRot = ((float)Math.PI / 180F) * (70.0F + MathHelper.cos(f3 * 40.0F) * 10.0F);
- this.leftArm.zRot = this.rightArm.zRot * -1.0F;
- this.rightArm.y = MathHelper.sin(f3 * 40.0F) * 0.5F + 1.5F;
- this.leftArm.y = MathHelper.sin(f3 * 40.0F) * 0.5F + 1.5F;
- this.body.y = MathHelper.sin(f3 * 40.0F) * 0.35F;
- } else if (piglinaction == PiglinAction.ATTACKING_WITH_MELEE_WEAPON && this.attackTime == 0.0F) {
- this.holdWeaponHigh(pEntity);
- } else if (piglinaction == PiglinAction.CROSSBOW_HOLD) {
- ModelHelper.animateCrossbowHold(this.rightArm, this.leftArm, this.head, !pEntity.isLeftHanded());
- } else if (piglinaction == PiglinAction.CROSSBOW_CHARGE) {
- ModelHelper.animateCrossbowCharge(this.rightArm, this.leftArm, pEntity, !pEntity.isLeftHanded());
- } else if (piglinaction == PiglinAction.ADMIRING_ITEM) {
- this.head.xRot = 0.5F;
- this.head.yRot = 0.0F;
- if (pEntity.isLeftHanded()) {
- this.rightArm.yRot = -0.5F;
- this.rightArm.xRot = -0.9F;
- } else {
- this.leftArm.yRot = 0.5F;
- this.leftArm.xRot = -0.9F;
- }
- }
- }
- protected void setupAttackAnimation(WarpedPiglinEntity p_230486_1_, float p_230486_2_) {
- if (this.attackTime > 0.0F && p_230486_1_ instanceof PiglinEntity && ((PiglinEntity)p_230486_1_).getArmPose() == PiglinAction.ATTACKING_WITH_MELEE_WEAPON) {
- ModelHelper.swingWeaponDown(this.rightArm, this.leftArm, p_230486_1_, this.attackTime, p_230486_2_);
- } else {
- super.setupAttackAnimation(p_230486_1_, p_230486_2_);
- }
- }
- private void holdWeaponHigh(WarpedPiglinEntity p_239117_1_) {
- if (p_239117_1_.isLeftHanded()) {
- this.leftArm.xRot = -1.8F;
- } else {
- this.rightArm.xRot = -1.8F;
- }
- }
- public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
- modelRenderer.xRot = x;
- modelRenderer.yRot = y;
- modelRenderer.zRot = z;
- }
- @Override
- protected Iterable<ModelRenderer> bodyParts() {
- return ImmutableList.of(leftArmDefault, rightArmDefault, bodyDefault, leftLeg, rightLeg, body_r1, body_r2, body_r5, body_r6);
- }
- @Override
- protected Iterable<ModelRenderer> headParts() {
- return ImmutableList.of(headDefault, earLeft, earRight, body_r4, body_r5);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement