EntityLib 0.0.1

Create custom Mobs for Gamemodes without NMS working cross Minecraft versions

  1. tr7zw
    Tested Minecraft Versions:
    • 1.8
    • 1.12
    Source Code:
    https://github.com/tr7zw/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:
    • Implementing all Vanilla pathfinders
    • More control about where mobs will go
    • More Minecraft versions
    • Hooks/Event handler for all usefull internal methods/events
    • Fix everything to allow custom entities to be persistent. Currently the will despawn, and forcing them persistent breaks them in that case
    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!

Recent Reviews

  1. IncognitoJam
    IncognitoJam
    4/5,
    Version: 0.0.1
    There are still lots of features to be added but works well in it's current form and is useful in developing my plugins.