-
Notifications
You must be signed in to change notification settings - Fork 43
Developing with LevelledMobs
Penal Buffalo edited this page Feb 2, 2023
·
8 revisions
This page was last updated for LevelledMobs 3.1.0 b475
Add the JitPack repository.
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
Add the LevelledMobs dependency.
<dependency>
<groupId>com.github.lokka30</groupId>
<artifactId>LevelledMobs</artifactId>
<version>REPLACE ME</version>
</dependency>
Replace REPLACE ME
with the latest version (not including build number!) of LevelledMobs, e.g. 3.1.0
.
We offer the LevelInterface class to interact directly with LevelledMobs.
We also offer a bunch of events which you can listen to and modify.
You can prevent mobs from being levelled, run stuff after they have been levelled, and so on.
You may view the javadocs we have compiled so far.
These show our code documentation which we are gradually improving.
If you want to integrate your plugin directly into LM's custom drop system, we have an API for it. Sample code is below.
private void testCustomDrops(){
ItemStack itemStack = new ItemStack(Material.NETHERITE_SWORD);
ItemMeta meta = itemStack.getItemMeta();
assert meta != null;
meta.setDisplayName("Cool Netherite Sword");
meta.setLore(List.of("Created via API"));
itemStack.setItemMeta(meta);
// https://arcaneplugins.github.io/LevelledMobs/3.9.3/me/lokka30/levelledmobs/LevelledMobs.html
LevelledMobs lm = LevelledMobs.getInstance();
// https://arcaneplugins.github.io/LevelledMobs/3.9.3/me/lokka30/levelledmobs/customdrops/CustomDropItem.html
CustomDropItem customDropItem = new CustomDropItem(lm); // must pass instance to LevelledMobs main class
customDropItem.setItemStack(itemStack);
// these options correspond to many of the item specific options shown here:
// https://github.com/ArcanePlugins/LevelledMobs/wiki/Documentation---customdrops.yml
customDropItem.chance = 1.0F;
customDropItem.equippedSpawnChance = 1.0F;
// https://arcaneplugins.github.io/LevelledMobs/3.9.3/me/lokka30/levelledmobs/customdrops/CustomDropInstance.html
final CustomDropInstance customDropInstance = new CustomDropInstance(EntityType.ZOMBIE);
customDropInstance.customItems.add(customDropItem);
// mob specific options can be set on customDropInstance
lm.customDropsHandler.externalCustomDrops.addCustomDrop(customDropInstance);
// the drop is now registered just as if it were in customdrops.yml
main.getLogger().info("Added a new drop for zombie");
}
If you need assistance in using LevelledMobs with your plugin, please contact us! :)
- π₯ Compatibilities
- π Installation
- π Commands
- π©ββοΈ Permissions
- πββοΈ Frequently Asked Questions
- π LevelledMobs 4.0 Wiki
- π§ Settings (settings.yml)
- π Rules (rules.yml)
- β Custom Drops (customdrops.yml)
- π¬ Messages (messages.yml)
- π Official Config Translations
- π Unofficial Config Translations