On Item/Weapon in main hand swing

Started by gustavowizard123 on Wed, 07/22/2020 - 22:40

Topic category: Help with modding (Java Edition)

Last seen on 21:26, 18. Nov 2020
Joined Sep 2016
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
On Item/Weapon in main hand swing
Wed, 07/22/2020 - 22:40

im trying to set up a procedure or edit the code to make a sword (item) make a swing soung when the player swing the weapon on main haind, is this possible?

 

thanks in advance

Last seen on 21:26, 18. Nov 2020
Joined Sep 2016
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
i just find a procedure to…
Thu, 07/23/2020 - 08:18

i just find a procedure to Make the main hand swing (prb usefull to make mobs move arms when attacking and stuff), but i dont think i can use this one on this case, i need just the weapon to make a quick sound when swing (lightsaber 'wooon') :D

Last seen on 21:26, 18. Nov 2020
Joined Sep 2016
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
anybody?
Thu, 07/23/2020 - 08:18

anybody?

Last seen on 08:35, 23. Nov 2020
Joined Nov 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
hook the net.minecraftforge…
Thu, 07/23/2020 - 10:15

hook the net.minecraftforge.client.event.MouseEvent. if left mouse button clicked with your item in main hand, do whatever

Last seen on 21:26, 18. Nov 2020
Joined Sep 2016
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
i found this but i dont know…
Thu, 07/23/2020 - 21:09

i found this but i dont know how to use it; (what part to vamp:

 

public static final int MOUSE_FIRST         = 500;

    /**
     * The last number in the range of ids used for mouse events.
     */
    public static final int MOUSE_LAST          = 507;

    /**
     * The "mouse clicked" event. This <code>MouseEvent</code>
     * occurs when a mouse button is pressed and released.
     */
    public static final int MOUSE_CLICKED = MOUSE_FIRST;

    /**
     * The "mouse pressed" event. This <code>MouseEvent</code>
     * occurs when a mouse button is pushed down.
     */

 

then i need to put a 'return' to play my lightsaber sound i supose? like

 

@Override  // <--- exempla of a simple custom sound
        public net.minecraft.util.SoundEvent getHurtSound(DamageSource ds) {
            return (net.minecraft.util.SoundEvent) ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("wizard_animals_plus:crocodile_hurt"));
        }

Last seen on 21:26, 18. Nov 2020
Joined Sep 2016
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
i think i need a IF too…
Thu, 07/23/2020 - 21:10

i think i need a IF too right? :/

Last seen on 21:26, 18. Nov 2020
Joined Sep 2016
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
i will try this (i dont know…
Thu, 07/23/2020 - 21:17

i will try this (i dont know coding lol):

@Override
        public ActionResult<ItemStack> onItemLeftClick(World world, PlayerEntity entity, Hand hand) {

    
            return (net.minecraft.util.SoundEvent) ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("wizard_animals_plus:crocodile_hurt"));
        }

Last seen on 21:26, 18. Nov 2020
Joined Sep 2016
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
looool nvm i just download…
Thu, 07/23/2020 - 21:34

looool nvm i just download the new snapshot (the one they released today), and there is a 'when entity swing item' option now! hurray!

Last seen on 08:35, 23. Nov 2020
Joined Nov 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
haha, you so lucky
Thu, 07/23/2020 - 21:43

haha, you so lucky

Last seen on 21:26, 18. Nov 2020
Joined Sep 2016
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
haha also, im so impressed…
Thu, 07/23/2020 - 21:49

haha

also, im so impressed how much 2020.4 is better than 2020.3... congratulations to the owners/programers!

Last seen on 04:17, 12. Nov 2020
Joined Apr 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
  HELLO .  were you able to…
Sat, 10/24/2020 - 22:18

 

HELLO .  were you able to apply the sound file to the swing of your sword?