Topic category: Help with Minecraft modding (Java Edition)
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
Why double posting? Read https://mcreator.net/wiki/general-publishing-guidelines
sorry i posted twice
can you delete all the post so i can post just 1 ?
can can post it now . I really need answers
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!
You already can do that in 2020.5.
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)