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:
Now you can modify the entitiy:
Spawning the mob:
Creating custom Pathfinder example:
Planned/Missing features:
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!
!!!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);
}
}
public TestMob(World world) {
super(world, EntityType.BLAZE);
}
}
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)
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)
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
EntityLib.spawn(tm, event.getPlayer().getLocation());
//You don't have to register the mob somewhere, just start spawning them
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();
}
}
}
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();
}
}
}
- 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
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!
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 1.8, 1.12
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
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.