Search in sources :

Example 1 with ArmPose

use of net.minecraft.client.model.ModelBiped.ArmPose in project Wizardry by TeamWizardry.

the class BloodRenderLayer method setModelVisibilities.

private void setModelVisibilities(AbstractClientPlayer clientPlayer) {
    ModelPlayer modelplayer = render.getMainModel();
    if (clientPlayer.isSpectator()) {
        modelplayer.setVisible(true);
        modelplayer.bipedHead.showModel = true;
        modelplayer.bipedHeadwear.showModel = true;
    } else {
        ItemStack stackMain = clientPlayer.getHeldItemMainhand();
        ItemStack stackOff = clientPlayer.getHeldItemOffhand();
        modelplayer.setVisible(false);
        modelplayer.bipedHeadwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.HAT);
        modelplayer.bipedBodyWear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.JACKET);
        modelplayer.bipedLeftLegwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.LEFT_PANTS_LEG);
        modelplayer.bipedRightLegwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_PANTS_LEG);
        modelplayer.bipedLeftArmwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.LEFT_SLEEVE);
        modelplayer.bipedRightArmwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_SLEEVE);
        modelplayer.isSneak = clientPlayer.isSneaking();
        ArmPose poseMain = ArmPose.EMPTY;
        if (!stackMain.isEmpty()) {
            poseMain = ArmPose.ITEM;
            if (clientPlayer.getItemInUseCount() > 0) {
                EnumAction enumaction = stackMain.getItemUseAction();
                if (enumaction == EnumAction.BLOCK) {
                    poseMain = ArmPose.BLOCK;
                } else if (enumaction == EnumAction.BOW) {
                    poseMain = ArmPose.BOW_AND_ARROW;
                }
            }
        }
        ArmPose poseOff = ArmPose.EMPTY;
        if (!stackOff.isEmpty()) {
            poseOff = ArmPose.ITEM;
            if (clientPlayer.getItemInUseCount() > 0) {
                EnumAction enumaction1 = stackOff.getItemUseAction();
                if (enumaction1 == EnumAction.BLOCK) {
                    poseOff = ArmPose.BLOCK;
                }
            }
        }
        if (clientPlayer.getPrimaryHand() == EnumHandSide.RIGHT) {
            modelplayer.rightArmPose = poseMain;
            modelplayer.leftArmPose = poseOff;
        } else {
            modelplayer.rightArmPose = poseOff;
            modelplayer.leftArmPose = poseMain;
        }
    }
}
Also used : ModelPlayer(net.minecraft.client.model.ModelPlayer) ItemStack(net.minecraft.item.ItemStack) ArmPose(net.minecraft.client.model.ModelBiped.ArmPose) EnumAction(net.minecraft.item.EnumAction)

Aggregations

ArmPose (net.minecraft.client.model.ModelBiped.ArmPose)1 ModelPlayer (net.minecraft.client.model.ModelPlayer)1 EnumAction (net.minecraft.item.EnumAction)1 ItemStack (net.minecraft.item.ItemStack)1