#Projectile Firing

1 messages · Page 1 of 1 (latest)

proper musk
#

good

loud nexus
#

wat

#

?

proper musk
#

use player.launchprojectile

#

instead of spawning an entity

loud nexus
#

which one do I chose

#

the one with vector

#

or without?

proper musk
#

i think if u use the vector u can change how much power is applied to the arrow

loud nexus
proper musk
#

Arrow.class

#

vector not int

loud nexus
#
player.launchProjectile(Material.ARROW.class)```
#

this

#

?

#

ARROW.class

#

or mat.arrow.class

loud nexus
proper musk
#

Arrow.class i think

loud nexus
#
    @EventHandler
    public static void onRightClick(PlayerInteractEvent event) {
        if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if (event.getItem() != null) {
                Player player = event.getPlayer();
                player.launchProjectile(Arrow.class);```
#

this will work right?

proper musk
#

should

loud nexus
#
public class Terminator implements ToolStatistics, BowFunction, Ability {
    @Override
    public String getAbilityName() {
        return "COMING SOON!";
    }

    @Override
    public String getAbilityDescription() {
        return "Sorry but the ability is currently under development!";
    }

    @Override
    public void onAbilityUse(Player player, SItem sItem) {
    }

    @Override
    public int getAbilityCooldownTicks() {
        return 0;
    }

    @Override
    public int getManaCost() {
        return 0;
    }

    @Override
    public String getDisplayName() {
        return "Terminator";
    }

    @Override
    public Rarity getRarity() {
        return Rarity.LEGENDARY;
    }

    @Override
    public GenericItemType getType() {
        return GenericItemType.RANGED_WEAPON;
    }

    @Override
    public SpecificItemType getSpecificType() {
        return SpecificItemType.BOW;
    }

    @Override
    public AbilityActivation getAbilityActivation() {
        return AbilityActivation.NO_ACTIVATION;
    }

    @Override
    public int getBaseDamage() {
        return 251;
    }

    @Override
    public double getBaseStrength() {
        return 101;
    }

    @Override
    public double getBaseCritDamage() {
        return 0.09;
    }

    @EventHandler
    public static void onRightClick(PlayerInteractEvent event) {
        if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if (event.getItem() != null) {
                Player player = event.getPlayer();
                player.launchProjectile(Arrow.class);
            }
        }
    }
}```
proper musk
#

Projectile Firing

loud nexus
#
    @EventHandler
    public static void onRightClick(PlayerInteractEvent event) {
        Player p = event.getPlayer();
        ItemStack item = p.getItemInHand();
        if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) {
            if (item.getType() == Material.BOW) {
                if (event.getItem() != null) {
                    Player player = event.getPlayer();
                    player.launchProjectile(Arrow.class);
                }
            }
        }
    }
}
#

modified the code do u see any errors?

proper musk
#

event.getItem and p.getItemInHand

loud nexus
#

o

loud nexus
#

or just event.getItem

#

?

proper musk
#

not sure

#

but be consistent

#

and use the same one throughout

loud nexus
#

alr

#

its p.getItemInHand