How can i shoot custom projectile like shoot arrow procedure ?

Started by Expesx on

Topic category: Help with modding (Java Edition)

Last seen on 10:49, 9. Jan 2021
Joined Nov 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can i shoot custom projectile like shoot arrow procedure ?
Wed, 11/11/2020 - 07:49 (edited)

I need to shoot a custom projectile like shoot arrow procedure but failed . I making mod a that gonna have a barrage punch when right click with an item , and there is no shoot custom projectile . I tried to edit the arrow to the custom projectile , this is the original code :

  

package net.ger.kauzilax.procedure;

import net.minecraft.world.World;
import net.minecraft.entity.projectile.EntityTippedArrow;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.Entity;

import net.ger.kauzilax.ElementsKuajix;

@ElementsKuajix.ModElement.Tag
public class ProcedureBarrage extends ElementsKuajix.ModElement {
    public ProcedureBarrage(ElementsKuajix instance) {
        super(instance, 24);
    }

    public static void executeProcedure(java.util.HashMap<String, Object> dependencies) {
        if (dependencies.get("entity") == null) {
            System.err.println("Failed to load dependency entity for procedure Barrage!");
            return;
        }
        if (dependencies.get("world") == null) {
            System.err.println("Failed to load dependency world for procedure Barrage!");
            return;
        }
        Entity entity = (Entity) dependencies.get("entity");
        World world = (World) dependencies.get("world");
        if (!world.isRemote && entity instanceof EntityLivingBase) {
            EntityTippedArrow entityToSpawn = new EntityTippedArrow(world, (EntityLivingBase) entity);
            entityToSpawn.shoot(entity.getLookVec().x, entity.getLookVec().y, entity.getLookVec().z, ((float) 1) * 2.0F, 0);
            entityToSpawn.setDamage(((float) 5) * 2.0F);
            entityToSpawn.setKnockbackStrength((int) 5);
            world.spawnEntity(entityToSpawn);
        }
    }
}

  But i when edited it , it always showed an error . How can i edit the arrow to the custom projectile i want. Can you help me with this . Thanks 
 

Edited by Expesx on Wed, 11/11/2020 - 07:49
Last seen on 10:49, 9. Jan 2021
Joined Nov 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
sorry i posted twice can you…
Thu, 11/12/2020 - 04:51

sorry i posted twice

can you delete all the post so i can post just 1 ?

Last seen on 10:49, 9. Jan 2021
Joined Nov 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
can can post it now . I…
Thu, 11/12/2020 - 04:54

can can post it now . I really need answers

 

Last seen on 15:54, 12. Apr 2021
Joined Jul 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
But, are you going to solve…
Sun, 03/07/2021 - 12:29

But, are you going to solve it or not?

we want custom arrow entities as the ones we shoot from ranged items, but in procedure!

Last seen on 14:43, 2. Aug 2022
Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You already can do that in…
Sun, 03/07/2021 - 14:26

You already can do that in 2020.5.

Sadly, there's no way to do…
Tue, 06/08/2021 - 08:29

Sadly, there's no way to do it for 1.12.2 without coding ;-; so I would love to see tutorial on that (though knowing that world, tutorial will come after I find solution elsewhere... would be helpful for others though)