Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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;

    }

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.