[1.2.5/1.3.1]Sparrow API v1.1.0 (1.3.1 beta!)

  • #1
    Sparrow API v1.1.0

    Download Sparrow1.1.0 Client Here!

    Download Sparrow1.1.0 Server Here!

    Download Sparrow1.1.0's Source Here!

    Download Beta for 1.3.2 HERE!

    Betas for 1.3.1:

    Beta Client

    Beta Client Source

    Beta Server

    Beta Server Source

    Example Sparrow Entity Here

    Please let me know if there are any issues with the beta, We haven't had any multiplayer mods to test it on yet.

    Changelog:



    v1.1.0: Added server version, removed getTier(), as it was ambiguous and not very useful, and there was no real reason to make people fill it out.

    What is Sparrow?

    Sparrow is an API that allows for better interaction between Entities. It has two main components: SparrowAPI (made by RaustBlackDragon), and SimplyID (made by Lil Avii).

    SparrowAPI is an interface that any entity can implement, and it adds various methods of obtaining and giving out standardized bits of information, so that entities can make more informed decisions.

    SimplyID is a system that allows for entities to save and load entities by giving each Sparrow-using entity a unique ID that they keep until they die.

    Sparrow is easy to use, edits no base classes, and won't conflict with any mod that doesn't use it, so there are no downsides to joining! To adopt the API, just make your entities implement SparrowAPI, and then assign values for each of the functions contained within SparrowAPI.

    Here's the source code for SparrowAPI, and the kinds of questions you can ask by implementing it:

    package net.minecraft.src;
    public interface SparrowAPI
    {
    /**Is this thing like a creeper, in that engaging it in combat has unexpected consequences? Would this entity and its allies be better off not fighting it at all? Set this to true if the attacker's combat abilities are basically a non-factor in what will happen to it if it fights this.*/
    public boolean isStupidToAttack();
    /**When a mod triggers an event that would set an entity to be dead with no reference to damage, should this entity be spared?*/
    public boolean doNotVaporize();
    /**Does this entity attack non-player entities on sight?*/
    public boolean isPredator();
    /**Does this entity attack the player on sight?*/
    public boolean isHostile();
    /**Is this entity incapable of combat?*/
    public boolean isPeaceful();
    /**Is this entity viable prey for a predator?*/
    public boolean isPrey();
    /**Will this entity attack, but only when provoked?*/
    public boolean isNeutral();
    /**Is this entity incapable of taking damage, and thus pointless to attack?*/
    public boolean isUnkillable();
    /**Should this entity be considered a threat to par1entity?*/
    public boolean isThreatTo(Entity par1entity);
    /**Should this entity be considered a friend of par1entity?*/
    public boolean isFriendOf(Entity par1entity);
    /**Is this entity what people would generally consider to be an NPC?*/
    public boolean isNPC();
    /**Is this a pet? 0 if not, 1 if it can be but isn't currently, 2 if it is.*/
    public int isPet();
    /**Who is this pet's owner?*/
    public Entity getPetOwner();
    /**What is the name of this individual entity?*/
    public String getName();
    /**What is this entity currently targeting with intent to kill? Used to differentiate between the attack method monsters use and the attack method used for breeding and following*/
    public Entity getAttackingTarget();
    /**What is the size of this entity? Multiply its two dimensions (X and Z are considered the same) in terms of blocks and put in the result ( a chicken would be .3 * .7, which is roughly .2)*/
    public float getSize();
    /**What should this entity be referred to as? (Dog, Cat, Human, Enderman, etc.)*/
    public String getSpecies();
    
    /**What is this entity's gender? 1 for male, 2 for female, 0 for neither*/
    public int getGender();
    /**This is for mod-specific features. A mod can search for a response to a custom string, and you can add in whether or not they'll respond to it here, and what the response will be.*/
    public String customStringAndResponse(String s);
    /**Have this return the string you store your simplyID in. Use the function SimplyID.getNextSimplyID(this) to assign a simplyID to your entities that implement Sparrow.*/
    public String getSimplyID();
    
    }



    Note about SimplyID:

    Set it to "needID" by default, save and load it with NBT tags, and add this into onLivingUpdate():

    if(simplyID == "needID")
    	{
    		simplyID = SimplyID.getNextSimplyID(this);
    	}


    HOW TO INSTALL:

    Take the class files in the zip file download, and put them directly into your minecraft jar. It edits no base classes, but it needs to go into the jar to make sure it loads before any folder-loaded mods that use it.

    DISTRIBUTION:


    Sparrow is distributed freely, and neither I nor Lil' Avii have any issues with you adding Sparrow into your own API to reduce the number of downloads needed, which would be quite convenient for your users.

    All we ask is that you don't claim it as your own original work, and that you mention it in any API you include it in, so people know where to ask questions about it.


    If you have any questions about the API, please contact me, RaustBlackDragon, via PM.
    Last edited by RaustBlackDragon: 10/7/2012 4:43:39 PM
  • #2
    Nice
  • #3
    ^ Nice profile picture
    good mod
    Last edited by TGI_Chris: 4/25/2012 7:57:30 PM
  • #4
    Cool a better AI for dogs for Doggy Talents

    No wood required!
  • #5
    Great Stuff guys! Avii, I didn't know you were involved with this? Sneaky! ;)

    Thanks for sharing this with everyone. Perhaps an example list could be provided in OP of the kinds of information this API would allow people to share and gain regarding mobs and how it would benefit them? What you showed me certainly made me a believer. :)
  • #6
    Quote from MineCrak

    Great Stuff guys! Avii, I didn't know you were involved with this? Sneaky! ;)

    Thanks for sharing this with everyone. Perhaps an example list could be provided in OP of the kinds of information this API would allow people to share and gain regarding mobs and how it would benefit them? What you showed me certainly made me a believer. :)


    Excellent Idea, I've just posted the source code in the OP!
  • #7
    Looks nice But does it help mods run together?


    My Names Joey :)
  • #8
    Quote from ZombiExDJ

    Looks nice But does it help mods run together?


    Yes it does. Basically, it lets entities get a more accurate assessment of eachother, categorize them, etc. You can make mass-attacks not harm your friends/pets, you can have your mobs easily determine what they should and shouldn't attack, among other things :)
  • #9
    great idea for an api, especially since the native AI of MC is a bit lacking in a number of areas.
  • #10
    It seems to be working with magic launcher even though it claims there are no mods in the zip. heh
  • #11
    Only one question is this compatible with Forge?
  • #12
    Quote from Texasjake95

    Only one question is this compatible with Forge?


    It's compatible with everything, it edits no base classes :)
  • #13
    Quote from RaustBlackDragon

    It's compatible with everything, it edits no base classes :)

    Sweet thanks!!!
  • #14
    Can you include the source in the download?
  • #15
    Quote from DjGyarados

    Can you include the source in the download?


    Sure thing!Alright, just added the download for the source code to the OP. It's separate so as not to complicate the download for mod-users, but I think it's just as convenient for mod-makers.
  • #16
    I hope to see this used in other mods soon :)
  • #17
    This is pretty amazing, it would be wonderful to start seeing more meaningful interaction between MC creatures. =D
  • #18
    Quote from Callabain

    I hope to see this used in other mods soon :)

    Quote from GreyD

    This is pretty amazing, it would be wonderful to start seeing more meaningful interaction between MC creatures. =D


    Thanks for the votes of confidence! We're trying to get more modders to use it, and we've gotten a few who sound interested. If you know any modders who could benefit from this API, feel free to let them know about it!
  • #19
    This looks like a neat little API, and I'll gladly use it for my projects. The more good options, the better, eh? ^^
  • #20
    I'll certainly use this for my mod when I get around to making entities.

    ...

    Although, I do have one question: What new features will this API have in the near future?
  • To post a comment, please or register a new account.
Posts Quoted:
Reply
Clear All Quotes