本文整理匯總了Java中net.minecraft.client.entity.AbstractClientPlayer.getHeldItemMainhand方法的典型用法代碼示例。如果您正苦於以下問題:Java AbstractClientPlayer.getHeldItemMainhand方法的具體用法?Java AbstractClientPlayer.getHeldItemMainhand怎麽用?Java AbstractClientPlayer.getHeldItemMainhand使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.client.entity.AbstractClientPlayer
的用法示例。
在下文中一共展示了AbstractClientPlayer.getHeldItemMainhand方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setModelVisibilities
import net.minecraft.client.entity.AbstractClientPlayer; //導入方法依賴的package包/類
private void setModelVisibilities(AbstractClientPlayer clientPlayer)
{
ModelPlayer modelplayer = this.getMainModel();
if (clientPlayer.isSpectator())
{
modelplayer.setInvisible(false);
modelplayer.bipedHead.showModel = true;
modelplayer.bipedHeadwear.showModel = true;
}
else
{
ItemStack itemstack = clientPlayer.getHeldItemMainhand();
ItemStack itemstack1 = clientPlayer.getHeldItemOffhand();
modelplayer.setInvisible(true);
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();
ModelBiped.ArmPose modelbiped$armpose = ModelBiped.ArmPose.EMPTY;
ModelBiped.ArmPose modelbiped$armpose1 = ModelBiped.ArmPose.EMPTY;
if (!itemstack.func_190926_b())
{
modelbiped$armpose = ModelBiped.ArmPose.ITEM;
if (clientPlayer.getItemInUseCount() > 0)
{
EnumAction enumaction = itemstack.getItemUseAction();
if (enumaction == EnumAction.BLOCK)
{
modelbiped$armpose = ModelBiped.ArmPose.BLOCK;
}
else if (enumaction == EnumAction.BOW)
{
modelbiped$armpose = ModelBiped.ArmPose.BOW_AND_ARROW;
}
}
}
if (!itemstack1.func_190926_b())
{
modelbiped$armpose1 = ModelBiped.ArmPose.ITEM;
if (clientPlayer.getItemInUseCount() > 0)
{
EnumAction enumaction1 = itemstack1.getItemUseAction();
if (enumaction1 == EnumAction.BLOCK)
{
modelbiped$armpose1 = ModelBiped.ArmPose.BLOCK;
}
}
}
if (clientPlayer.getPrimaryHand() == EnumHandSide.RIGHT)
{
modelplayer.rightArmPose = modelbiped$armpose;
modelplayer.leftArmPose = modelbiped$armpose1;
}
else
{
modelplayer.rightArmPose = modelbiped$armpose1;
modelplayer.leftArmPose = modelbiped$armpose;
}
}
}
示例2: setModelVisibilities
import net.minecraft.client.entity.AbstractClientPlayer; //導入方法依賴的package包/類
private void setModelVisibilities(AbstractClientPlayer clientPlayer)
{
ModelPlayer modelplayer = this.getMainModel();
if (clientPlayer.isSpectator())
{
modelplayer.setInvisible(false);
modelplayer.bipedHead.showModel = true;
modelplayer.bipedHeadwear.showModel = true;
}
else
{
ItemStack itemstack = clientPlayer.getHeldItemMainhand();
ItemStack itemstack1 = clientPlayer.getHeldItemOffhand();
modelplayer.setInvisible(true);
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();
ModelBiped.ArmPose modelbiped$armpose = ModelBiped.ArmPose.EMPTY;
ModelBiped.ArmPose modelbiped$armpose1 = ModelBiped.ArmPose.EMPTY;
if (itemstack != null)
{
modelbiped$armpose = ModelBiped.ArmPose.ITEM;
if (clientPlayer.getItemInUseCount() > 0)
{
EnumAction enumaction = itemstack.getItemUseAction();
if (enumaction == EnumAction.BLOCK)
{
modelbiped$armpose = ModelBiped.ArmPose.BLOCK;
}
else if (enumaction == EnumAction.BOW)
{
modelbiped$armpose = ModelBiped.ArmPose.BOW_AND_ARROW;
}
}
}
if (itemstack1 != null)
{
modelbiped$armpose1 = ModelBiped.ArmPose.ITEM;
if (clientPlayer.getItemInUseCount() > 0)
{
EnumAction enumaction1 = itemstack1.getItemUseAction();
if (enumaction1 == EnumAction.BLOCK)
{
modelbiped$armpose1 = ModelBiped.ArmPose.BLOCK;
}
// FORGE: fix MC-88356 allow offhand to use bow and arrow animation
else if (enumaction1 == EnumAction.BOW)
{
modelbiped$armpose1 = ModelBiped.ArmPose.BOW_AND_ARROW;
}
}
}
if (clientPlayer.getPrimaryHand() == EnumHandSide.RIGHT)
{
modelplayer.rightArmPose = modelbiped$armpose;
modelplayer.leftArmPose = modelbiped$armpose1;
}
else
{
modelplayer.rightArmPose = modelbiped$armpose1;
modelplayer.leftArmPose = modelbiped$armpose;
}
}
}