mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Piglins are ponified \0/
This commit is contained in:
parent
83d0544959
commit
f2016efcc4
4 changed files with 43 additions and 19 deletions
|
@ -2,40 +2,59 @@ package com.minelittlepony.client.model.entity;
|
||||||
|
|
||||||
import net.minecraft.entity.mob.HostileEntity;
|
import net.minecraft.entity.mob.HostileEntity;
|
||||||
import net.minecraft.entity.mob.PiglinEntity;
|
import net.minecraft.entity.mob.PiglinEntity;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
import com.minelittlepony.client.model.entity.race.AlicornModel;
|
import com.minelittlepony.client.render.EquineRenderManager;
|
||||||
|
import com.minelittlepony.pony.IPony;
|
||||||
|
|
||||||
public class PiglinPonyModel extends AlicornModel<HostileEntity> {
|
public class PiglinPonyModel extends ZomponyModel<HostileEntity> {
|
||||||
|
|
||||||
private boolean isPegasus;
|
private PiglinEntity.Activity activity;
|
||||||
|
|
||||||
public PiglinPonyModel() {
|
|
||||||
super(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void animateModel(HostileEntity entity, float move, float swing, float ticks) {
|
public void updateLivingState(HostileEntity entity, IPony pony, EquineRenderManager.Mode mode) {
|
||||||
isPegasus = entity.getUuid().getLeastSignificantBits() % 30 == 0;
|
super.updateLivingState(entity, pony, mode);
|
||||||
|
leftArmPose = ArmPose.EMPTY;
|
||||||
|
rightArmPose = entity.getMainHandStack().isEmpty() ? ArmPose.EMPTY : ArmPose.ITEM;
|
||||||
|
|
||||||
if (entity instanceof PiglinEntity) {
|
if (entity instanceof PiglinEntity) {
|
||||||
PiglinEntity piglinEntity = (PiglinEntity)entity;
|
PiglinEntity piglinEntity = (PiglinEntity)entity;
|
||||||
PiglinEntity.Activity activity = piglinEntity.getActivity();
|
activity = piglinEntity.getActivity();
|
||||||
|
|
||||||
leftArmPose = ArmPose.EMPTY;
|
|
||||||
rightArmPose = ArmPose.EMPTY;
|
|
||||||
|
|
||||||
if (activity == PiglinEntity.Activity.CROSSBOW_HOLD) {
|
if (activity == PiglinEntity.Activity.CROSSBOW_HOLD) {
|
||||||
rightArmPose = ArmPose.CROSSBOW_HOLD;
|
rightArmPose = ArmPose.CROSSBOW_HOLD;
|
||||||
} else if (activity == PiglinEntity.Activity.CROSSBOW_CHARGE) {
|
} else if (activity == PiglinEntity.Activity.CROSSBOW_CHARGE) {
|
||||||
rightArmPose = ArmPose.BOW_AND_ARROW;
|
rightArmPose = ArmPose.CROSSBOW_CHARGE;
|
||||||
} else if (activity == PiglinEntity.Activity.ADMIRING_ITEM) {
|
} else if (activity == PiglinEntity.Activity.ADMIRING_ITEM) {
|
||||||
leftArmPose = ArmPose.ITEM;
|
leftArmPose = ArmPose.ITEM;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
activity = PiglinEntity.Activity.DEFAULT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canFly() {
|
public void setAngles(HostileEntity entity, float move, float swing, float ticks, float headYaw, float headPitch) {
|
||||||
return isPegasus;
|
super.setAngles(entity, move, swing, ticks, headYaw, headPitch);
|
||||||
|
|
||||||
|
if (activity == PiglinEntity.Activity.ADMIRING_ITEM) {
|
||||||
|
leftArm.yaw = 0.5F;
|
||||||
|
leftArm.pitch = -1.9F;
|
||||||
|
leftArm.pivotY += 4;
|
||||||
|
leftArm.pivotZ += 3;
|
||||||
|
leftArm.pivotX += 2;
|
||||||
|
head.pitch = MathHelper.sin(ticks / 12) / 6 + 0.5F;
|
||||||
|
head.yaw = 0;
|
||||||
|
|
||||||
|
head.roll = MathHelper.sin(ticks / 10) / 3F;
|
||||||
|
|
||||||
|
|
||||||
|
helmet.copyPositionAndRotation(head);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isZombified(HostileEntity entity) {
|
||||||
|
return !(entity instanceof PiglinEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ public class ZomponyModel<Zombie extends HostileEntity> extends AlicornModel<Zom
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void animateModel(Zombie entity, float move, float swing, float ticks) {
|
public void animateModel(Zombie entity, float move, float swing, float ticks) {
|
||||||
|
super.animateModel(entity, move, swing, ticks);
|
||||||
isPegasus = entity.getUuid().getLeastSignificantBits() % 30 == 0;
|
isPegasus = entity.getUuid().getLeastSignificantBits() % 30 == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ public class ZomponyModel<Zombie extends HostileEntity> extends AlicornModel<Zom
|
||||||
protected void rotateLegs(float move, float swing, float ticks, Zombie entity) {
|
protected void rotateLegs(float move, float swing, float ticks, Zombie entity) {
|
||||||
super.rotateLegs(move, swing, ticks, entity);
|
super.rotateLegs(move, swing, ticks, entity);
|
||||||
|
|
||||||
if (rightArmPose == ArmPose.EMPTY) {
|
if (isZombified(entity)) {
|
||||||
if (islookAngleRight(move)) {
|
if (islookAngleRight(move)) {
|
||||||
rotateArmHolding(rightArm, 1, getSwingAmount(), ticks);
|
rotateArmHolding(rightArm, 1, getSwingAmount(), ticks);
|
||||||
((MsonPart)rightArm).shift(0.5F, 1.5F, 3);
|
((MsonPart)rightArm).shift(0.5F, 1.5F, 3);
|
||||||
|
@ -35,6 +36,10 @@ public class ZomponyModel<Zombie extends HostileEntity> extends AlicornModel<Zom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean isZombified(Zombie entity) {
|
||||||
|
return rightArmPose == ArmPose.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean islookAngleRight(float move) {
|
public boolean islookAngleRight(float move) {
|
||||||
return MathHelper.sin(move / 20) < 0;
|
return MathHelper.sin(move / 20) < 0;
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 4.4 KiB |
Loading…
Reference in a new issue