mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Fix skeleton bow aiming (and maybe other mobs)
This commit is contained in:
parent
379388bb3f
commit
0ee3250930
2 changed files with 41 additions and 6 deletions
|
@ -110,9 +110,7 @@ public class ModelSkeletonPony extends ModelPlayerPony {
|
||||||
this.unicornArmLeft.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
|
this.unicornArmLeft.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.leftArmPose == ArmPose.BOW_AND_ARROW || this.rightArmPose == ArmPose.BOW_AND_ARROW) {
|
this.aimBow(this.leftArmPose, this.rightArmPose, tick);
|
||||||
this.aimBow(this.leftArmPose, this.rightArmPose, tick);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,7 +15,9 @@ import net.minecraft.client.model.ModelBiped.ArmPose;
|
||||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLiving;
|
||||||
|
import net.minecraft.item.EnumAction;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumHandSide;
|
||||||
|
|
||||||
public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving<T> implements IRenderPony {
|
public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving<T> implements IRenderPony {
|
||||||
|
|
||||||
|
@ -44,10 +46,45 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void preRenderCallback(T entitylivingbaseIn, float partialTickTime) {
|
protected void preRenderCallback(T entity, float partialTickTime) {
|
||||||
|
ItemStack main = entity.getHeldItemMainhand();
|
||||||
|
ItemStack off = entity.getHeldItemOffhand();
|
||||||
|
ArmPose mainPose = ArmPose.EMPTY;
|
||||||
|
ArmPose offPose = ArmPose.EMPTY;
|
||||||
|
|
||||||
ItemStack heldItem = entitylivingbaseIn.getHeldItemMainhand();
|
if (main != null) {
|
||||||
this.playerModel.getModel().rightArmPose = heldItem == null ? ArmPose.EMPTY : ArmPose.ITEM;
|
mainPose = ArmPose.ITEM;
|
||||||
|
|
||||||
|
if (entity.getItemInUseCount() > 0) {
|
||||||
|
EnumAction action = main.getItemUseAction();
|
||||||
|
|
||||||
|
if (action == EnumAction.BLOCK) {
|
||||||
|
mainPose = ArmPose.BLOCK;
|
||||||
|
} else if (action == EnumAction.BOW) {
|
||||||
|
mainPose = ArmPose.BOW_AND_ARROW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (off != null) {
|
||||||
|
offPose = ArmPose.ITEM;
|
||||||
|
|
||||||
|
if (entity.getItemInUseCount() > 0) {
|
||||||
|
EnumAction action = off.getItemUseAction();
|
||||||
|
|
||||||
|
if (action == EnumAction.BLOCK) {
|
||||||
|
offPose = ArmPose.BLOCK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.getPrimaryHand() == EnumHandSide.RIGHT) {
|
||||||
|
this.playerModel.getModel().rightArmPose = mainPose;
|
||||||
|
this.playerModel.getModel().leftArmPose = offPose;
|
||||||
|
} else {
|
||||||
|
this.playerModel.getModel().rightArmPose = offPose;
|
||||||
|
this.playerModel.getModel().leftArmPose = mainPose;
|
||||||
|
}
|
||||||
|
|
||||||
this.playerModel.getModel().isSneak = false;
|
this.playerModel.getModel().isSneak = false;
|
||||||
this.playerModel.getModel().isFlying = false;
|
this.playerModel.getModel().isFlying = false;
|
||||||
|
|
Loading…
Reference in a new issue