HomeJavaModsEntityLib
EntityLib
EntityLib
!!!This is an early development version of this Libary! The API isn't finalized, and merge requests/ideas for changes are welcome!!!

This API allows you to create custom entities, without having to worry about using NMS or having to reflect into the Entity registry. Since the API provides a layer between NMS and other plugins, your custom entities will work across Minecraft versions(Currently only 1.8 and 1.12 are implemented!).

What do I have to do as server owner?
Just download the jar and drop it in the plugins folder. Done. Keep in mind that the libary depends on ProtocolLib!

Dependency:
- ProtocolLib

How can I use the API as developer?
Create a custom entitiy:
Code (Text):
public class TestMob extends CustomEntity{
    public TestMob(World world) {
        super(world, EntityType.BLAZE);
    }
}
Now you can modify the entitiy:
Code (Text):
//Add pathfinder goals/targets:
addGoalSelector(1, ...);
addTargetSelector(1, ...);
getHandler().addNMSGoalSelector(1, ...); //For adding the NMS Selectors
getHandler().addNMSTargetSelector(1, ...);

//or use the predefined ones(WIP)
getHandler().addGoalRandomLookaround(0);
getHandler().addGoalRandomStroll(1, 0.5);

//you can access the Bukkit Entity to do normal changes
bukkit().setHealth(1);
bukkit().setCustomName("TestMob");
bukkit().setCustomNameVisible(true);

(WIP)
Spawning the mob:
Code (Text):
TestMob tm = new TestMob(event.getPlayer().getWorld());
EntityLib.spawn(tm, event.getPlayer().getLocation());
//You don't have to register the mob somewhere, just start spawning them
 
Creating custom Pathfinder example:
Code (Text):
public class PathfinderGoalFloat extends PathfinderGoal{
    CustomEntity ent;
    public PathfinderGoalFloat(CustomEntity entity) {
        ent = entity;
    }

    @Override
    public boolean shouldExecute() {
        return ent.inWater();
    }

    @Override
    public void updateTask() {
        if (ent.getRandom().nextFloat() < 0.8F) {
            ent.jump();
        }
    }
}
Planned/Missing features:
Git: https://github.com/tr7zw/EntityLib
Feel free to create forks for your need, or create merge requests! (Send me a message on Spigot if you want stuff to be added)

If you like this Resource, donate me a Coffee :) Paypal.me
Thank for the donations made by MrDienns and evilLamer!

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

EntityLib is a free Minecraft Java mod. Compatible with Minecraft 1.8, 1.12. Downloaded 265 times (via Spigot). Download it and open it directly in the game.

Explore more