On Item/Weapon in main hand swing

Started by gustavowizard123 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
On Item/Weapon in main hand swing

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

Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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

Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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"));
        }

Joined Sep 2016
Points:

User statistics:

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

i think i need a IF too right? :/

Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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"));
        }

Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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!

Joined Nov 2019
Points:

User statistics:

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

haha, you so lucky

Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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!

Joined Apr 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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?