Hi dere, I've been working on a plugin which can spawn custom entities. So far so good, they've been spawned. Only I encountered a small issue: they're invisible... Here's some of the code which should contains the mistake: Code:java /** * Spawns an NPC * @param vn */ public NPC s(VirtualNPC vn){ Location l = vn.getSpawnLocation(); CraftWorld cw = (CraftWorld)l.getWorld(); WorldServer w = cw.getHandle(); EntityInsentient e = null; Class<? extends EntityInsentient> c = vn.getNpcClass().getNpcClass(); /** * CHATTY */ if(c.equals(cDairyCow.class)){ e = new cDairyCow(w); } //Owen else if(c.equals(Owen_Tutorial01.class)){ e = new Owen_Tutorial01(w); } else if(c.equals(Owen_Tutorial02.class)){ e = new Owen_Tutorial02(w); } /** * MERCHANT */ /** * MOB */ if(e == null)return null; //e.spawnIn(w); e.setLocation(l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch()); w.addEntity(e, SpawnReason.NATURAL); NPC n = new NPC(vn.getNpcClass(), CraftEntity.getEntity((CraftServer)Bukkit.getServer(), e)); a(n); return n; } and here's the entity I used for testing: Code:java package net.invasioncraft.rpg.npc.chatty.owen; import java.util.List; import org.bukkit.entity.EntityType;import org.bukkit.entity.Villager.Profession;import org.bukkit.event.entity.EntityDamageEvent;import org.bukkit.event.entity.EntityDeathEvent;import org.bukkit.event.entity.EntityTargetEvent;import org.bukkit.event.player.PlayerInteractEntityEvent; import net.minecraft.server.v1_7_R4.*;import net.invasioncraft.rpg.icRpg;import net.invasioncraft.rpg.npc.npcManager;import net.invasioncraft.rpg.npc.chatty.Chatty;import net.invasioncraft.rpg.npc.chatty.ConversationComponent; public abstract class Owen extends EntityVillager implements Chatty{ private static String chatName = "§a[§fOwen§a] §f", customName = "§a[§fOwen§a]"; private static EntityType entityType = EntityType.VILLAGER; private static Profession profession = Profession.LIBRARIAN; private ConversationComponent[] conversationComponents; private int conversationSpeed; @SuppressWarnings("rawtypes") public Owen(World world, String idSuffix, ConversationComponent[] conversationComponents, int conversationSpeed){ super(world); this.conversationComponents = conversationComponents; this.conversationSpeed = conversationSpeed; npcManager m = icRpg.getNpcManager(); List goalB = (List)m.g("b", PathfinderGoalSelector.class, goalSelector); goalB.clear(); List goalC = (List)m.g("c", PathfinderGoalSelector.class, goalSelector); goalC.clear(); List targetB = (List)m.g("b", PathfinderGoalSelector.class, targetSelector); targetB.clear(); List targetC = (List)m.g("c", PathfinderGoalSelector.class, targetSelector); targetC.clear(); this.goalSelector.a(0, new PathfinderGoalFloat(this)); this.goalSelector.a(1, new PathfinderGoalRandomStroll(this, 1.0D)); this.goalSelector.a(2, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F)); this.goalSelector.a(3, new PathfinderGoalRandomLookaround(this)); } @Override @SuppressWarnings("deprecation") public int getProfession(){ return profession.getId(); } public Profession getBukkitProfession(){ return profession; } public String getCustomName(){ return customName; } public String getChatName(){ return chatName; } public EntityType getEntityType(){ return entityType; } public ConversationComponent[] getConversation(){ return conversationComponents; } public int getConversationSpeed(){ return conversationSpeed; } public void onEvent(EntityDamageEvent event){ event.setCancelled(true); } public void onEvent(PlayerInteractEntityEvent event){ } public void onEvent(EntityDeathEvent event){ return; } public void onEvent(EntityTargetEvent event){ event.setCancelled(true); }} Thanks for your time
jeussa Here's a project I did that also has custom Entities: https://github.com/Europia79/Extraction Here's a good tutorial: http://forums.bukkit.org/threads/nms-tutorial-how-to-override-default-minecraft-mobs.216788/ Here's one of the custom entities: https://github.com/Europia79/Extrac...euro/extraction/nms/v1_7_R4/CraftHostage.java Here is the class that spawns it: https://github.com/Europia79/Extrac...pi/src/mc/euro/extraction/nms/NPCFactory.java My code is working. So if you look over it and the tutorial, it might give you some ideas on how to fix yours.
I've tried recoding the part of my plugin where I create and spawn custom entities about 3 times (the final time with your code), and I'm still getting the same result: I can hear entities walk, idle, even bukkit knows it's there (because I'm selecting the nearest entity to a commandSender after spawning it) However still no textures, not even if I try to relog. Even though my actions are the same as yours :/ I also tried spawning normal entities to see if any plugin is blocking them from spawning. However the entities were able to spawn so no plugin should be interferring.
I've been doing some testing with spawning a normal EntityCow and an empty class extending EntityWolf only containing public TestWolf(World world) The cow has spawned, the dog however hasnt't. So I think something is going wrong with registering the custom enity. Which seems quite odd because I even tried a copy of the source provided by Europia79