Wanderson Luis Postado Setembro 5, 2017 Denunciar Compartilhar Postado Setembro 5, 2017 Alguem poderia me encinar como posso spawnar um vilager , colocar um comando nele, ele setar pra ele nao levar dano e mexer etc? Sem usar outro plugin nem api somente em java se alguem souber e puder falar agradaço Link para o comentário Compartilhar em outros sites More sharing options...
VictorHeaven Postado Setembro 5, 2017 Denunciar Compartilhar Postado Setembro 5, 2017 Para criar o npc use Villager npc = (Villager)p.getWorld().spawnEntity(p.getLocation(), EntityType.VILLAGER); npc.setAdult(); npc.setProfession(Villager.Profession.PRIEST); npc.setCustomName("NOME"); npc.setCustomNameVisible(false); npc.setCanPickupItems(false); NoAIUtils.noAI((Entity)npc); p.sendMessage("§aAldeão criado com sucesso!"); return true; Para setar um comando no villager use @EventHandler public void aoInteragir(PlayerInteractEntityEvent e) { if (e.getRightClicked() instanceof Villager) { Villager npc = (Villager) e.getRightClicked(); Player p = e.getPlayer(); if (npc.getCustomName() == null) { return; } if (npc.getCustomName().equals("NOME DO VILLAGER")) { } } } Para fazer ele ficar parado use isso quando for spawnar ele, seta o noAI nele public static void noAI(final Entity bukkitEntity) { final net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity)bukkitEntity).getHandle(); NBTTagCompound tag = nmsEntity.getNBTTag(); if (tag == null) { tag = new NBTTagCompound(); } nmsEntity.c(tag); tag.setInt("NoAI", 1); nmsEntity.f(tag); } Para ele não levar dano use @EventHandler public void aoDarDano(EntityDamageByEntityEvent e) { if (!(e.getEntity() instanceof Villager)) { return; } Villager npc = (Villager) e.getEntity(); if (e.getEntity() instanceof Villager) { if (npc.getCustomName() == null) { return; } if (npc.getCustomName().equals("§r§r§a")) { if (e.getDamager() instanceof Player) { Player p = (Player) e.getDamager(); if (p.hasPermission("admin.usar")) { if (p.getItemInHand().getType() == Material.GOLD_SWORD) { npc.setHealth(0.0); } else { e.setCancelled(true); } } else { e.setCancelled(true); } } } } } 2 Link para o comentário Compartilhar em outros sites More sharing options...
Po_Royal Postado Setembro 5, 2017 Denunciar Compartilhar Postado Setembro 5, 2017 Alguem poderia me encinar como posso spawnar um vilager , colocar um comando nele, ele setar pra ele nao levar dano e mexer etc? Sem usar outro plugin nem api somente em java se alguem souber e puder falar agradaço Acho que sem um plugin isso não é possivel. Link para o comentário Compartilhar em outros sites More sharing options...
Wanderson Luis Postado Setembro 5, 2017 Autor Denunciar Compartilhar Postado Setembro 5, 2017 Acho que sem um plugin isso não é possivel. Deve da sim eu ja vi alguns plugins aqui no forum que tem isso sem api e sem outro pl. Link para o comentário Compartilhar em outros sites More sharing options...
Po_Royal Postado Setembro 5, 2017 Denunciar Compartilhar Postado Setembro 5, 2017 Deve da sim eu ja vi alguns plugins aqui no forum que tem isso sem api e sem outro pl. Entendi que era sem plugin nenhum kkkk Link para o comentário Compartilhar em outros sites More sharing options...
Wanderson Luis Postado Setembro 5, 2017 Autor Denunciar Compartilhar Postado Setembro 5, 2017 Para criar o npc use Villager npc = (Villager)p.getWorld().spawnEntity(p.getLocation(), EntityType.VILLAGER); npc.setAdult(); npc.setProfession(Villager.Profession.PRIEST); npc.setCustomName("NOME"); npc.setCustomNameVisible(false); npc.setCanPickupItems(false); NoAIUtils.noAI((Entity)npc); p.sendMessage("§aAldeão criado com sucesso!"); return true; Para setar um comando no villager use @EventHandler public void aoInteragir(PlayerInteractEntityEvent e) { if (e.getRightClicked() instanceof Villager) { Villager npc = (Villager) e.getRightClicked(); Player p = e.getPlayer(); if (npc.getCustomName() == null) { return; } if (npc.getCustomName().equals("NOME DO VILLAGER")) { } } } Para fazer ele ficar parado use isso quando for spawnar ele, seta o noAI nele public static void noAI(final Entity bukkitEntity) { final net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity)bukkitEntity).getHandle(); NBTTagCompound tag = nmsEntity.getNBTTag(); if (tag == null) { tag = new NBTTagCompound(); } nmsEntity.c(tag); tag.setInt("NoAI", 1); nmsEntity.f(tag); } Para ele não levar dano use @EventHandler public void aoDarDano(EntityDamageByEntityEvent e) { if (!(e.getEntity() instanceof Villager)) { return; } Villager npc = (Villager) e.getEntity(); if (e.getEntity() instanceof Villager) { if (npc.getCustomName() == null) { return; } if (npc.getCustomName().equals("§r§r§a")) { if (e.getDamager() instanceof Player) { Player p = (Player) e.getDamager(); if (p.hasPermission("admin.usar")) { if (p.getItemInHand().getType() == Material.GOLD_SWORD) { npc.setHealth(0.0); } else { e.setCancelled(true); } } else { e.setCancelled(true); } } } } } Vlw Link para o comentário Compartilhar em outros sites More sharing options...
K A C E Y Postado Setembro 5, 2017 Denunciar Compartilhar Postado Setembro 5, 2017 Para criar o npc use Villager npc = (Villager)p.getWorld().spawnEntity(p.getLocation(), EntityType.VILLAGER); npc.setAdult(); npc.setProfession(Villager.Profession.PRIEST); npc.setCustomName("NOME"); npc.setCustomNameVisible(false); npc.setCanPickupItems(false); NoAIUtils.noAI((Entity)npc); p.sendMessage("§aAldeão criado com sucesso!"); return true; Para setar um comando no villager use @EventHandler public void aoInteragir(PlayerInteractEntityEvent e) { if (e.getRightClicked() instanceof Villager) { Villager npc = (Villager) e.getRightClicked(); Player p = e.getPlayer(); if (npc.getCustomName() == null) { return; } if (npc.getCustomName().equals("NOME DO VILLAGER")) { } } } Para fazer ele ficar parado use isso quando for spawnar ele, seta o noAI nele public static void noAI(final Entity bukkitEntity) { final net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity)bukkitEntity).getHandle(); NBTTagCompound tag = nmsEntity.getNBTTag(); if (tag == null) { tag = new NBTTagCompound(); } nmsEntity.c(tag); tag.setInt("NoAI", 1); nmsEntity.f(tag); } Para ele não levar dano use @EventHandler public void aoDarDano(EntityDamageByEntityEvent e) { if (!(e.getEntity() instanceof Villager)) { return; } Villager npc = (Villager) e.getEntity(); if (e.getEntity() instanceof Villager) { if (npc.getCustomName() == null) { return; } if (npc.getCustomName().equals("§r§r§a")) { if (e.getDamager() instanceof Player) { Player p = (Player) e.getDamager(); if (p.hasPermission("admin.usar")) { if (p.getItemInHand().getType() == Material.GOLD_SWORD) { npc.setHealth(0.0); } else { e.setCancelled(true); } } else { e.setCancelled(true); } } } } } full THG ahusahusa mas boa Link para o comentário Compartilhar em outros sites More sharing options...
jeta Postado Setembro 5, 2017 Denunciar Compartilhar Postado Setembro 5, 2017 Sua dúvida foi marcada como [Resolvido] e movido à área de dúvidas resolvidas.Atenciosamente,Gamer's Board Link para o comentário Compartilhar em outros sites More sharing options...
Pergunta
Wanderson Luis
Alguem poderia me encinar como posso spawnar um vilager , colocar um comando nele, ele setar pra ele nao levar dano e mexer etc? Sem usar outro plugin nem api somente em java se alguem souber e puder falar agradaço
Link para o comentário
Compartilhar em outros sites
7 respostass a esta questão
Posts Recomendados