Plugin Help Registering Custom Entity Not Working

Discussion in 'Plugin Help/Development/Requests' started by Max604, Apr 7, 2015.

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

    Max604

  2. Offline

    Europia79

    @Max604

    it looks like your spawn code inside onEnable() is just there to test out your plugin ? If so, I would suggest just moving the spawn code to a command class.

    Also, for your Main class, it appears that you need to delete the import for me.Max604.ClashOfClans.NMS.EntityTypes; and replace it with net.minecraft.server.v1_8_R1.EntityTypes;
    Code:java
    1.  
    2. /**
    3. * delete this import
    4. * import me.Max604.ClashOfClans.NMS.EntityTypes;
    5. *
    6. * replace with this:
    7. */
    8. import net.minecraft.server.v1_8_R1.EntityTypes;
    9.  


    Also, read this:
    http://bukkit.org/threads/how-to-override-default-minecraft-mobs.216788/

    it may help you with your problem
     
    Last edited: Apr 7, 2015
  3. Offline

    Max604

    @Europia79
    I've changed the import type, but now there is no error and still no pig spawning.

    @Europia79
    It needs to be my EntityTypes class
     
    Last edited by a moderator: Apr 7, 2015
  4. Offline

    Europia79

    I'm not familiar with that approach.

    Did you read this thread on Custom Entities ? it's very good:
    http://bukkit.org/threads/how-to-override-default-minecraft-mobs.216788/

    Here's some code that I wrote to spawn a custom Villager:
    https://github.com/Europia79/Extrac...ction/nms/v1_7_R4/HostageFactory.java#L61-L66

    This is what you do in onEnable():
    https://github.com/Europia79/Extrac...src/mc/euro/extraction/HostagePlugin.java#L66
    https://github.com/Europia79/Extrac...rc/mc/euro/extraction/HostagePlugin.java#L131

    Which does this:
    https://github.com/Europia79/Extrac...ion/nms/v1_7_R4/CustomEntityType.java#L64-L67

    then this:
    https://github.com/Europia79/Extrac...n/nms/v1_7_R4/CustomEntityType.java#L187-L193

    Notice how it's modifying net.minecraft.server.v1_7_R4.EntityTypes; Or in your case, it would be net.minecraft.server.v1_8_R1.EntityTypes
     
  5. Offline

    Max604

    I'm trying to spawn a custom entity manually, instead of replacing pigs entirely.
    That's why I have my own EntityTypes class.
    If you see the log, these lines are causing issues.

    mapD = (Map<?, ?>) fieldMapD.get(null);

    eggInfo.put(Integer.valueOf(i),new MonsterEggInfo(i,j,k));
     
  6. Offline

    Europia79

  7. Offline

    Max604

    @Europia79
    Thanks, it all works now!!!!!
    I'll try edit my pig class for 1.8.3
     
Thread Status:
Not open for further replies.

Share This Page