跳到正文

Modify Drops API

作者:TigerOfTroy

Allows for more complex and context-sensitive item drops

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

Modify Drops API

 

Modify Drops API allows for more complex and context-sensitive item drops. It is an API created for use in Chest Cavity and Hellish Materials, but is valuable to anyone who wants to have greater control over the output of loot tables.

 

How it Works

Whenever loot is generated from a loot table (even if the result is no drops), Modify Drops API will call the following events in order: GenerateLootCallbackAddLoot, GenerateLootCallbackModifyLoot, and GenerateLootCallbackAddUnmodifiableLoot.

 

GenerateLootCallbackAddLoot listeners accept the loot table’s LootContextType and LootContext, and return a List<Itemstack>. Anything in the returned list is added to the existing list of drops. GenerateEntity and GenerateBlockLootCallbackAddLoot are called if the LootContextType is ENTITY or BLOCK, and so can be used when adding drops to those loot events instead of checking the LootContextType yourself.

 

GenerateLootCallbackModifyLoot listerners accept the loot table’s LootContextType, LootContext, and the List<Itemstack> of drops. They return a List<Itemstack> which will replace the old loot. ModifyLoot, like AddLoot, calls Entity and Block sub-events for ease of use.

 

GenerateLootCallbackAddUnmodifiableLoot functions identically to AddLoot, but is called after ModifyLoot and so is for drops that you do not want other listeners to interact with.

 

Importing Modify Drops API

 

To use Modify Drops API in your mod, add the following line to your dependencies in build.gradle:

modApi “com.github.tigereye504:modify-drops-api:x.x.x”

Optionally, you can embed Modify Drops API as a jar-in-jar by also including the following in your dependencies:

include “com.github.tigereye504:modify-drops-api:x.x.x”

where x.x.x is the version of the API you wish to use.

常见问题

Modify Drops API 支持哪些 Minecraft 版本?

Modify Drops API 支持 Minecraft Java 版 1.16.1–1.16.4,共 4 个版本,可用的加载器:Fabric。下载时注意选择和你游戏版本一致的文件。

Modify Drops API 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。

评论

登录后评论和评分

TigerOfTroy 的其他作品

查看全部 →