• 0

[Resolvido] Ajuda?


DaviDEV
 Share

Question

7 answers to this question

Recommended Posts

Por favor, registre-se ou entre para visualizar isso.

achei no google tbm e-e testa ai.

 

Não foi, eu uso esse cod para lançar o ovo séra que é ele:

 

@EventHandler
public void aoInteragir(PlayerInteractEvent e)
{
Player p  =e.getPlayer();
ItemStack hand = p.getItemInHand();
if (e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR)
{
if (hand.getType() == Material.WOOD_SPADE)
{
p.launchProjectile(Egg.class);
p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 1.0F, 1.0F);
}
if (hand.getType() == Material.STONE_SPADE)
{
for (int i = 0; i<2; i+=1)
{
p.launchProjectile(Egg.class);
}
p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 1.0F, 1.0F);
}
}
}

Share this post


Link to post
Share on other sites

 

Não foi, eu uso esse cod para lançar o ovo séra que é ele:

 

@EventHandler
public void aoInteragir(PlayerInteractEvent e)
{
Player p  =e.getPlayer();
ItemStack hand = p.getItemInHand();
if (e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR)
{
if (hand.getType() == Material.WOOD_SPADE)
{
p.launchProjectile(Egg.class);
p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 1.0F, 1.0F);
}
if (hand.getType() == Material.STONE_SPADE)
{
for (int i = 0; i<2; i+=1)
{
p.launchProjectile(Egg.class);
}
p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 1.0F, 1.0F);
}
}
}

 

Sei la eu nao manjo java mais eu tento ajudar e-e agora o negocio e esperar os devs .

Share this post


Link to post
Share on other sites

Consegui galerin
Pra quem quiser o cod:
 

@SuppressWarnings("deprecation")
@EventHandler
public void onEggHit(ProjectileHitEvent e) {
Entity en = e.getEntity();
if(en instanceof Egg) {   
BlockIterator bi = new BlockIterator(e.getEntity().getWorld(), e.getEntity().getLocation().toVector(), e.getEntity().getVelocity().normalize(), 0.0D, 4);
Block hit = null;
while (bi.hasNext())
{
hit = bi.next();
if (hit.getTypeId() != 0) {
break;
}
}
hit.setType(Material.AIR);
en.getLocation().getBlock().setType(Material.AIR);
}
}
}

Share this post


Link to post
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.