DontDespawn 模组
DontDespawn 是一款简洁而强大的 Minecraft Fabric 模组,可防止指定物品消失(即在一段时间后自动消失)。如果未能及时拾取贵重或重要物品,该模组能极大地帮助避免其永久丢失。
工作原理
模组初始化时,会读取位于 config/dontdespawn.items 的配置文件。该文件应包含一行一个的物品名称列表,这些是你希望防止消失的物品。例如:
minecraft:diamond
minecraft:netherite_ingot
modid:custom_item
在每个服务器刻中,模组会遍历世界中所有的物品实体。如果某个物品实体的物品与配置文件中列出的名称之一匹配,其存在时间将被重置为 0,从而有效地防止其消失。
安装方法
- 为你的 Minecraft 版本安装 Fabric 加载器。
- 下载 DontDespawn 模组文件(例如
dontdespawn-1.0.0.jar)。
- 将模组文件放入你的
mods 文件夹中。
- 在你的 Minecraft 实例的
config 文件夹中新建一个名为 dontdespawn.items 的文件。
- 将希望防止消失的物品名称添加到
dontdespawn.items 文件中,每行一个。
配置说明
配置文件(config/dontdespawn.items)允许你指定哪些物品不应消失。文件中的每一行应包含一个物品的命名空间 ID,格式为 namespace:item_name。例如:
minecraft:diamond
minecraft:netherite_ingot
modid:custom_item
如果未找到配置文件,模组将记录一条警告信息,且不会阻止任何物品消失。
日志记录
DontDespawn 模组使用 Simple Logging Facade for Java (SLF4J) 进行日志记录。日志消息会打印到 Minecraft 的日志文件中,该文件位于你的 Minecraft 实例的 logs 文件夹内。
初始化时,模组会记录一条信息消息,表明其已成功初始化。如果在读取配置文件时出现问题,则会相应地记录警告或错误消息。
兼容性
DontDespawn 模组兼容 Fabric 加载器,并应与大多数 Minecraft 版本及其他模组配合使用。但无法保证完全兼容。
DontDespawn Mod
The DontDespawn Mod is a simple yet powerful Fabric mod for Minecraft that prevents specified items from despawning (disappearing after a certain amount of time). This can be incredibly useful for keeping valuable or important items from being lost forever if not picked up quickly enough.
How It Works
Upon initialization, the mod reads a configuration file located at config/dontdespawn.items. This file should contain a list of item names (one per line) that you want to prevent from despawning. For example:
minecraft:diamond
minecraft:netherite_ingot
modid:custom_item
During each server tick, the mod iterates through all item entities in the world. If an item entity's item matches one of the names in the configuration file, its age is reset to 0, effectively preventing it from despawning.
Installation
- Install the Fabric mod loader for your Minecraft version.
- Download the DontDespawn mod file (e.g.,
dontdespawn-1.0.0.jar).
- Place the mod file in your
mods folder.
- Create a new file called
dontdespawn.items in the config folder of your Minecraft instance.
- Add the names of the items you want to prevent from despawning to the
dontdespawn.items file, one per line.
Configuration
The configuration file (config/dontdespawn.items) allows you to specify which items should not despawn. Each line in the file should contain the namespaced ID of an item, following the format namespace:item_name. For example:
minecraft:diamond
minecraft:netherite_ingot
modid:custom_item
If the configuration file is not found, the mod will log a warning, and no items will be prevented from despawning.
Logging
The DontDespawn mod uses the Simple Logging Facade for Java (SLF4J) for logging purposes. Log messages are printed to the Minecraft log file, which can be found in the logs folder of your Minecraft instance.
Upon initialization, the mod will log an informational message indicating that it has been initialized. If there are any issues reading the configuration file, warning or error messages will be logged accordingly.
Compatibility
The DontDespawn mod is compatible with the Fabric mod loader and should work with most Minecraft versions and other mods. However, compatibility is not guaranteed.
评论 0
登录后参与评分
还没有评论,来抢沙发吧