Solved NoSuchMethodException (adding arg to custom-mob instance constructor)

Discussion in 'Plugin Development' started by Quaro, Mar 1, 2014.

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

    Quaro

    -deleted-

    edited code, was a bit wrong... Help please.

    Up.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  2. Offline

    Quaro

    Up.... Please, really need help...
     
  3. Offline

    SuperOmegaCow

    Quaro
    can't find the method:
    Code:java
    1. java.lang.NoSuchMethodException: mobs.neutral.CustomMob.<init>(net.minecraft.server.v1_7_R1.World)
     
    Quaro likes this.
  4. Offline

    Quaro

    SuperOmegaCow Yes, but error is from server(bukkt) side. When i add one more argument(location) to custom mob instance, bukkit can't find instance. The main question is, how to make that i could add location argument to mob instance, and bukkit would find it. (It searches for normal instance arg: world, when i add one more arg, it can't find)
     
  5. Offline

    xTrollxDudex

    Quaro
    Show full custom mob code.
     
    Quaro likes this.
  6. Offline

    SuperOmegaCow

    Quaro
    Try spawning the custom entity like this:
    Code:java
    1. public void spawnCustomEntity(Location loc, String player)
    2. {
    3. net.minecraft.server.v1_7_R1.World nmsWorld = ((CraftWorld) loc.getWorld()).getHandle();
    4. CustomEntityZombie customZombie = new CustomEntityZombie(nmsWorld, player);
    5. customZombie.setPosition(loc.getX(), loc.getY(), loc.getZ());
    6. nmsWorld.addEntity(customZombie);
    7. }
     
    Quaro likes this.
  7. Offline

    Quaro

    -deleted-
     
  8. Offline

    xTrollxDudex

    Quaro
    What I don't understand is why you use reflection to instantiate you class. Just do new CustomMob(...)
     
    Quaro likes this.
  9. Offline

    Quaro

    SuperOmegaCow I tried. Same.
    xTrollxDudex Because it was a method with more mobs, and that is necessary.

    Thanks you both for trying to help me again. I found way to solved it (a bit mirroring helped). THANKS!
     

  10. It would be a pleasure for me if you share your solution.
     
Thread Status:
Not open for further replies.

Share This Page