Ronbo So how would I set it when I spawn a villager, as I want something like /v1 and it will spawn a villager with that name. Ronbo Ok I made a command that will spawn a villager, how/where will I add the method you suggested in my code? Here is my code so far. Code:java package me.niknea.Mobs; import org.bukkit.command.Command;import org.bukkit.command.CommandExecutor;import org.bukkit.command.CommandSender;import org.bukkit.entity.CreatureType;import org.bukkit.entity.Player; @SuppressWarnings("deprecation")public class V1 implements CommandExecutor{ public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = (Player) sender; if(cmd.getName().equalsIgnoreCase("v1")) { player.getWorld().spawnCreature(player.getLocation(), CreatureType.VILLAGER); } return true; } } Thanks again!
there is actuall a very simple way. just take a spawn villager, than put it in the anvil, then click ont eh text that says spawn villager. chage it to whatever you want. asi was saying, put the spawn villager in anvil, then you need to click on the txt that says spawn villager. change it to whatever you want
Don't use deprecated methods. Code:java Entity ent = player.getWorld().spawnEntity(player.getLocation(), EntityType.VILLAGER);((Villager)ent).setCustomName("NewName");((Villager)ent).setCustomNameVisible(true);
It donĀ“t works for me. Code:java LivingEntity ent = p.getWorld().spawnCreature(p.getLocation(), EntityType.VILLAGER); ent.setCustomName(""); ent.setCustomNameVisible(true); A villager is a LivingEntity.