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;
}