Skip to content

Commit

Permalink
Add MM item resolver and return items from external resolvers everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSzabo committed Nov 15, 2024
1 parent d52bb68 commit e32add7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,18 @@ public MythicMobsHook(AuraSkills plugin, ConfigurationNode config) {
this.plugin = plugin;
this.damageHandler = new DamageHandler();

registerItemProvider();

// Wait for loot manager to be created, but add parser before it is loaded
plugin.getScheduler().executeSync(() ->
plugin.getLootTableManager().getLootManager().registerCustomEntityParser(new MythicEntityLootParser(plugin)));
}

private void registerItemProvider() {
plugin.getItemRegistry().registerExternalItemProvider("mythicmobs",
(id) -> MythicBukkit.inst().getItemManager().getItemStack(id));
}

@EventHandler
public void onMythicSkillDamage(MythicDamageEvent event) {
// This is always some sort of skill/mechanic damage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,14 @@ public ItemStack getItem(NamespacedId key) {
ItemStack item = items.get(key);
if (item != null) {
return item.clone();
} else {
return null;
}

ExternalItemProvider provider = externalItemProviders.get(key.getNamespace());
if(provider != null) {
return provider.getItem(key.getKey());
}

return null;
}

public Map<NamespacedId, ItemStack> getItems() {
Expand Down

0 comments on commit e32add7

Please sign in to comment.