Started by
squidud
on
Topic category: Help with Minecraft modding (Java Edition)
I was working on a mod and I wanted to add a machine gun. It works great and everything, it just looks odd because the player's hand swings the gun every time it shoots. Is there a way to ensure the gun (and player's hand) don't move when shooting the gun?
This may not be the best way to go about this, but on onItemRightClick your gonna want to return a ActionResult.resultFail(yourItem). This will cancel the "animation". Here is an example I use in one of my mods.
DISREGARD THE OTHER CODE JUST LOOK AT THE RETURN STATEMENT!!!
OOPS I forgot that was a succes return!!! USE THIS INSTEAD:
I think someone should open a ticket to make this an option.
i suport it
if anybody wants to know, i manage to 'fix' this manually on code (on 2020.4/2020.3):
//@Override
//public UseAction getUseAction(ItemStack stack) {
// return UseAction.BOW;
//} <-------------- DISABLE THIS PART HERE
@Override
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity entity, Hand hand) {
entity.setActiveHand(hand);
return new ActionResult(ActionResultType.FAIL, entity.getHeldItem(hand)); //<------------- Change SUCESS to FAIL here
}
guns dont move when shoting now :)
Did you not read my first post......................... lol..........
Howdy stranger! So how would one go about inserting this code into a procedure? because as far as I know it only uses code blocks.
You got to lock the class and change the code there. It's not applicable to do in a procedure.
So I went about adding this script to my mod and I received this;
10 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.3/userguide/command_line_interface.html#se…
BUILD FAILED in 1s
1 actionable task: 1 executed
How would one go about fixing this?
This did not work
btw gustavowizard123 where do i paste trhe code?