Jump to content

Raise Arm of Player


izzie.llg

Recommended Posts

Hi Guys

 

I'm trying to make a news guy with a camera mounted on his shoulder. Does anyone know Flan's Mod, the way some of his guns, like the D8 rocket launcher, when equipped changes the position of the arms and it looks like the rocket launcher is resting on the character's shoulder, with the arms holding it up. But for the life of me I can't find where the code does that? Does anyone know how to achieve this? How to I get the playerEntity to change the arm position?

 

Thanks!

 

EDIT:

My original post got locked, but I found the solution so I'll post it in case somebody else needs it!

 

I actually found what I was looking for. I basically took a few functions from the ItemBow class and modified them.

 

Code:

 

    /* Creates a new Arrow (aboout to shoot) event and starts using the current item */

    public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {

        ArrowNockEvent event = new ArrowNockEvent(player, itemStack);

        MinecraftForge.EVENT_BUS.post(event);

        if (event.isCanceled()) {

            return event.result;

        }

 

        player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack));

 

        return itemStack;

    }

 

    /* In the bow class this is much shorter, its the time after which the bow is automatically released, but I don't want it to automatically release use of item that fast. */

    public int getMaxItemUseDuration(ItemStack p_77626_1_) { return 999999999; }

 

    /* There are five pre-programmed arm positions: none, eat, drink, block, bow; */

    public EnumAction getItemUseAction(ItemStack p_77661_1_) {

        return EnumAction.bow;

    }

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.