[Tutorial] [1.7] Creating a Custom Entity

Discussion in 'Resources' started by Jogy34, Dec 29, 2013.

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

    Jogy34

    It doesn't look like you are ever trying to actually spawn it.
     
  2. Offline

    phondeux

    I thought uncommenting those lines would allow the spawn via skeleton egg (per your initial post)?
     
  3. Offline

    Jogy34

    I also said that you also would have to use those fields in the addCustomEntity() method, which you never added them to it.
     
  4. Offline

    phondeux

    I guess I'm not following, from what I see I'm doing everything you did in your initial post and uncommenting everything necessary to spawn the new mob from an egg? What fields do I need to add to addCustomEntity()?

    Your initial post says to uncomment mapIdToClassField, which I did.
     
  5. Offline

    Jogy34

    I did not add in actually using of the mapIdToClassField into the addCustomEntity() as I had though it would have been self explanatory as to what you would have to do with it from all of the other ones. You have to add it into the addCustomEntity() method yourself.
     
  6. Offline

    phondeux

    I assumed the example code in your OP was complete, I'm just an idiot as it's not self-explanatory to me, sorry. :(
     
  7. Offline

    RamonSGomes

    Jogy34
    I just made a custom EnderDragon, and I was wondering how to make it to be damageble, cause it doesn't takes any hit
    Sorry for bad english
     
  8. Offline

    Jogy34

    The enderdragon itself doesn't really have a hit box, it relies on complex parts for that. If you post your code I can probably help you out more.
     
  9. Offline

    RamonSGomes

    http://pastebin.com/Re9eLs1w
     
  10. Offline

    Jogy34

    I believe the problem you're having is that you aren't updating all of the ender dragon's ComplexPart's due to overriding the e() method. What you could try doing is calling super.e() in your overridden method to handle that but it may end up having some non-wanted consequences. So if that doesn't work how you want it to then look in here. Up at the top there are 7 ComplexPart objects. Look through the code and see what happens with them then transfer it over into your code to see if it works.
     
  11. Offline

    elraro

    works great! thx!

    but how the hell can i do, for example, if right click on the entity, follow the player? :/
     
  12. Offline

    Jogy34

    You can either use some math to make your entity walk towards a specific point, use some path finding to make it walk to a specific point, try to find out what wolves and cats do, or extends from EntityTameableAnimal.

    I personally only have experience with using trig to make an entity walk somewhere and extending off of EntityTameableAnimal.

    Here's the math part if you want it though, I use this for making my own NPC's walk to a desired location in a straight line.
    Code:java
    1.  
    2. Location walkTo = //near player
    3.  
    4.  
    5. Vector v = walkTo.toVector().subtract(new Vector(this.locX, this.locY, this.locZ));
    6. this.move((Math.abs(v.getX()) > 0.15 ? (v.getX() < 0 ? -0.15 : 0.15) : v.getX()),
    7. (Math.abs(v.getY()) > 0.15 ? (v.getY() < 0 ? -0.15 : 0.15) : v.getY()),
    8. (Math.abs(v.getZ()) > 0.15 ? (v.getZ() < 0 ? -0.15 : 0.15) : v.getZ()));
     
  13. Offline

    elraro

    uhm, but can i extend, for example, from zombie and EntityTameableAnimal at the same time? or village and EntityTameableAnimal?

    im testing now with a skeleton, but i pretend make a villager
     
  14. Offline

    elraro

    some help please? :(
     
  15. Offline

    Jogy34

    Java doesn't support double inheritance. You could try copying the behavior over from one while extending the other though.
     
Thread Status:
Not open for further replies.

Share This Page