Solved Spawning Zombie, Client crash...

Discussion in 'Plugin Development' started by Jalau, Nov 17, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Jalau

    I need some help, when i spawn the zombie the client crashes:

    Code:java
    1. //Calling Method
    2. Mobs.Bandit(player.getWorld().getSpawnLocation());
    3.  
    4. //Method
    5. public static void Bandit(Location l) {
    6. MobAttributes.createRandomZombie(l, "Bandit", 1, 20F, 10, new ItemStack[]{new ItemStack(Material.ROTTEN_FLESH)}, new int[]{100}, new int[]{100}, new ItemStack[]{new ItemStack(Material.WOOD_SWORD), new ItemStack(Material.LEATHER_BOOTS), new ItemStack(Material.LEATHER_LEGGINGS), new ItemStack(Material.LEATHER_CHESTPLATE), new ItemStack(Material.LEATHER_HELMET)});
    7. }
    8.  
    9. //Spawning Method
    10.  
    11. public static void createRandomZombie(Location location, String name, int tier, float maxHealth, int healthRange, org.bukkit.inventory.ItemStack[] drops, int[] dropC, int[] dropA, org.bukkit.inventory.ItemStack[] equipment) {
    12. equipment[0] = swords.randomSword(tier);
    13. equipment[1] = helm.randomHelmet(tier);
    14. equipment[2] = cp.randomChest(tier);
    15. equipment[3] = legg.randomLeggings(tier);
    16. equipment[4] = boots.randomBoots(tier);
    17.  
    18. CustomZombie z = new CustomZombie(location.getWorld(), name, maxHealth, drops, dropC, dropA, equipment);
    19. z.setLocation(location.getBlockX(), location.getBlockY(), location.getBlockZ(), 0, 0);
    20. ((CraftWorld)location.getWorld()).getHandle().addEntity(z, SpawnReason.CUSTOM);
    21. }
    22.  
    23. //NMS Method
    24.  
    25. public CustomZombie(org.bukkit.World world, String name, float maxHealth, org.bukkit.inventory.ItemStack[] drops, int[] dropC, int[] dropA, org.bukkit.inventory.ItemStack[] equipment) {
    26. this(((CraftWorld)world).getHandle(), maxHealth);
    27.  
    28. this.setCustomName(name);
    29.  
    30. this.drops = drops;
    31. this.dropC = dropC;
    32. this.dropA = dropA;
    33.  
    34. for(int e = 0; e < equipment.length ;e++) {
    35. this.setEquipment(e, CraftItemStack.asNMSCopy(equipment[e]));
    36. }
    37. }


    //Crash:
    Description: Exception in world tick

    java.lang.NullPointerException
    at bcw.a(SourceFile:571)
    at dg.a(SourceFile:87)
    at co.b(SourceFile:354)
    at bcw.e(SourceFile:98)
    at bdd.b(SourceFile:60)
    at atv.k(SourceFile:1386)
    at atv.S(SourceFile:663)
    at atv.d(SourceFile:619)
    at net.minecraft.client.main.Main.main(SourceFile:101)
     
Thread Status:
Not open for further replies.

Share This Page