Advertisement
Guest User

Untitled

a guest
Aug 31st, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. public void onSpawn(CreatureSpawnEvent event){
  2. if (event.isCancelled()) return;
  3.  
  4. Location location = event.getLocation();
  5. Entity entity = event.getEntity();
  6. EntityType creatureType = event.getEntityType();
  7. World world = location.getWorld();
  8.  
  9. net.minecraft.server.World mcWorld = ((CraftWorld) world).getHandle();
  10. net.minecraft.server.Entity mcEntity = (((CraftEntity) entity).getHandle());
  11.  
  12. if (creatureType == EntityType.VILLAGER && mcEntity instanceof HumanNPC == false){
  13. HumanNPC npc = new HumanNPC(((CraftServer)Bukkit.getServer()).getServer(), mcWorld, "Bard", new ItemInWorldManager(mcWorld));
  14.  
  15. npc.setPosition(location.getX(), location.getY(), location.getZ());
  16.  
  17. mcWorld.removeEntity((net.minecraft.server.EntityVillager) mcEntity);
  18. mcWorld.addEntity(npc, SpawnReason.CUSTOM);
  19.  
  20. return;
  21. }
  22.  
  23. public void onSpawn2(CreatureSpawnEvent event){
  24. if (event.isCancelled()) return;
  25.  
  26. Location location = event.getLocation();
  27. Entity entity = event.getEntity();
  28. EntityType creatureType = event.getEntityType();
  29. World world = location.getWorld();
  30.  
  31. net.minecraft.server.World mcWorld = ((CraftWorld) world).getHandle();
  32. net.minecraft.server.Entity mcEntity = (((CraftEntity) entity).getHandle());
  33.  
  34. if (creatureType == EntityType.VILLAGER && mcEntity instanceof HumanNPC == false){
  35. HumanNPC npc = new HumanNPC(((CraftServer)Bukkit.getServer()).getServer(), mcWorld, "Archer", new ItemInWorldManager(mcWorld));
  36.  
  37. npc.setPosition(location.getX(), location.getY(), location.getZ());
  38.  
  39. mcWorld.removeEntity((net.minecraft.server.EntityVillager) mcEntity);
  40. mcWorld.addEntity(npc, SpawnReason.CUSTOM);
  41.  
  42. return;
  43. }
  44.  
  45. public void onSpawn3(CreatureSpawnEvent event){
  46. if (event.isCancelled()) return;
  47.  
  48. Location location = event.getLocation();
  49. Entity entity = event.getEntity();
  50. EntityType creatureType = event.getEntityType();
  51. World world = location.getWorld();
  52.  
  53. net.minecraft.server.World mcWorld = ((CraftWorld) world).getHandle();
  54. net.minecraft.server.Entity mcEntity = (((CraftEntity) entity).getHandle());
  55.  
  56. if (creatureType == EntityType.VILLAGER && mcEntity instanceof HumanNPC == false){
  57. HumanNPC npc = new HumanNPC(((CraftServer)Bukkit.getServer()).getServer(), mcWorld, "Diamond", new ItemInWorldManager(mcWorld));
  58.  
  59. npc.setPosition(location.getX(), location.getY(), location.getZ());
  60.  
  61. mcWorld.removeEntity((net.minecraft.server.EntityVillager) mcEntity);
  62. mcWorld.addEntity(npc, SpawnReason.CUSTOM);
  63.  
  64. return;
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement