AutoDropX
AutoDropX 是一款轻量级且直观的 Minecraft 客户端模组,当拾取物品时会根据你的规则自动丢弃多余物品,保持背包整洁。它具备三种匹配模式(物品 ID / ID+NBT / 物品标签)、通过鼠标滚轮快速调整数量、支持 JEI 幽灵拖拽,以及可在 9 个配置页面间快速切换的功能(带有类似 JEI 的 [<] 1/9 [>] 导航器)。
主要使用 Kotlin 编写。
功能一览
- 自动丢弃溢出物品:遵循“保留最小数量”规则,仅保留你需要的数量。
- 三种匹配模式:
- ID:仅通过物品 ID 进行匹配。
- ID+NBT:精确匹配物品及其 NBT 数据。
- Item Tag:匹配物品的标签(如果可用,支持在多个标签间循环切换)。
- 用户友好界面:
- 使用鼠标滚轮调整保留的最小数量(默认步长:1;Shift:×8;Ctrl:×64)。
- 右键点击可切换匹配模式(在标签模式下会循环遍历可用的标签)。
- 中键点击可删除一条规则。
- 将光标悬停在配置槽上并按 F 键,可快速启用或禁用该规则。
- 使用顶部的 [<] 1/9 [>] 导航器在“配置页面”之间切换,每个页面拥有独立的一套规则。
- JEI 幽灵拖拽:直接从 JEI 面板将物品拖入配置槽以创建规则(无需实际物品)。
- 自动保存:更改立即保存到磁盘;游戏重启后设置会自动恢复。
默认按键绑定
- 全局切换模组:
B(可在控制设置中修改)
- 打开配置 GUI:
N(可在控制设置中修改)
如何使用配置屏幕
- 左键点击配置槽:
- 空手时:“拾取”槽中的物品(并删除该规则)。
- 手持物品时:将手中的物品“放置”到槽中(数量显示将自动调整为保留的最小数量)。
- 鼠标滚轮:调整“保留的最小数量”(Shift:×8,Ctrl:×64)。
- 右键点击:在 ID → ID+NBT → Item Tag 模式之间切换。在标签模式下,它会循环遍历物品的可用标签。
- 中键点击:删除该槽中的规则。
- F 键:切换光标所在槽的规则状态(启用/禁用)。
- 顶部标签页:使用 [<] 1/9 [>] 导航器进行类似 JEI 的分页翻页。这九个页面拥有独立的规则,切换前会自动保存当前页面的设置。
- 当鼠标指针持有物品时:
- 点击配置槽将其放置。
- 点击 GUI 的空闲区域或玩家背包以清除鼠标指针上的物品。
配置文件路径
- 当前页面:
config/autodropx/active_profile.txt(包含 1-9 之间的数字)
- 页面规则:
config/autodropx/profiles/pageN.snbt(其中 N=1..9)
- 旧版迁移:如果存在
config/autodropx.snbt,它将在首次启动时自动迁移到第 1 页。
JEI 幽灵拖拽
- 打开 JEI 搜索面板并将所需物品拖入配置槽以创建规则(不会消耗任何实际物品)。
构建和运行
- 依赖项:JDK 17+
- 构建:
- Windows:运行
./gradlew.bat build
- Linux/macOS:运行
./gradlew build
- 产物:各平台的模组 jar 文件位于对应子项目的
build/libs/ 目录中。
- 开发运行(可选):
- Forge Client:
./gradlew :forge:runClient
- Fabric Client:
./gradlew :fabric:runClient
- Quilt Client:
./gradlew :quilt:runClient
实际支持的 Minecraft/加载器版本定义在 gradle.properties 中。
常见问题 (FAQ)
- “保留的最小数量”为什么显示为物品的堆叠数量?
- 这是一种视觉辅助,用于更直观地预览规则的阈值;你的实际库存不会被修改。
- 我可以为不同的游玩风格保存不同的一组规则吗?
- 可以。使用顶部的 [<] 1/9 [>] 导航器切换到不同的“页面”。每个页面的规则相互独立。
- 与 JEI 一起使用时有什么需要注意的吗?
- JEI 幽灵拖拽仅用于创建或替换规则。它不会消耗任何实际物品。
快速定位源代码
- Forge 配置屏幕:
forge/src/main/kotlin/ench/autodropx/forge/feature/config/ConfigContainerScreen.kt:1
- Forge 配置管理器:
forge/src/main/kotlin/ench/autodropx/forge/feature/config/ConfigManager.kt:1
- Forge 按键绑定:
forge/src/main/kotlin/ench/autodropx/forge/KeyBinding.kt:1
贡献
- 欢迎提交 Pull Requests (PR) 和 Issues!在提交之前,请确保问题具有可复现性,并且与现有功能集保持一致。
- 请尽量保持代码风格与现有的 Kotlin 格式一致。对于功能性更改,请附带简要描述。
致谢
- 感谢 JEI 提供了优秀的 UI 交互范式。
- 感谢社区提供的反馈和建议。
许可证
- 本项目采用 GNU Lesser General Public License v2.1 (LGPL-2.1) 许可。
- 详情请参阅仓库根目录下的
LICENSE 文件。
- 通过提交贡献,即表示你同意将你的作品以相同许可证授权。
AutoDropX
AutoDropX is a lightweight and intuitive Minecraft client-side mod that automatically discards excess items based on your rules when you pick them up, keeping your inventory tidy. It features three matching modes (Item ID / ID+NBT / Item Tag), rapid quantity adjustment with the mouse wheel, support for JEI ghost dragging, and quick switching between 9 configuration pages (with a JEI-style [<] 1/9 [>] navigator).
Primarily written in Kotlin.
Features at a Glance
- Auto-Discard Overflow: Adheres to a "Minimum Quantity to Keep" rule, only retaining the amount you need.
- Three Matching Modes:
- ID: Matches by item ID only.
- ID+NBT: Matches the item and its NBT data precisely.
- Item Tag: Matches the item's tags (supports cycling through multiple tags if available).
- User-Friendly Interface:
- Adjust the minimum quantity with the mouse wheel (Default step: 1; Shift: ×8; Ctrl: ×64).
- Right-click to switch matching modes (cycles through available tags in Tag mode).
- Middle-click to delete a rule.
- Hover over a config slot and press F to quickly enable/disable that rule.
- Use the top [<] 1/9 [>] navigator to switch between "Configuration Pages," each with its own independent set of rules.
- JEI Ghost Dragging: Drag items directly from the JEI panel into a configuration slot to create a rule (no actual item needed).
- Auto-Save: Changes are saved to disk immediately; settings are automatically restored after a game restart.
Default Key Binds
- Toggle Mod Globally:
B (configurable in Controls)
- Open Config GUI:
N (configurable in Controls)
How to Use the Config Screen
- Left-click on a config slot:
- With an empty hand: "Picks up" the item from the slot (and deletes the rule).
- With an item in hand: "Places" the held item into the slot (the count will automatically display the minimum quantity to keep).
- Mouse Wheel: Adjusts the "Minimum Quantity to Keep" (Shift: ×8, Ctrl: ×64).
- Right-click: Switches between ID → ID+NBT → Item Tag modes. In Tag mode, it cycles through the item's available tags.
- Middle-click: Deletes the rule in that slot.
- F key: Toggles the rule for the slot under the cursor (enable/disable).
- Top Tabs: Use the [<] 1/9 [>] navigator for JEI-style page turning. The nine pages have independent rules, and the current page is saved automatically before switching.
- When holding an item on your cursor:
- Click a config slot to place it.
- Click an empty area of the GUI or your player inventory to clear the item from your cursor.
Configuration File Paths
- Current Page:
config/autodropx/active_profile.txt (contains a number from 1-9)
- Page Rules:
config/autodropx/profiles/pageN.snbt (where N=1..9)
- Legacy Migration: If
config/autodropx.snbt exists, it will be automatically migrated to Page 1 on the first launch.
JEI Ghost Dragging
- Open the JEI search panel and drag the desired item into a config slot to create a rule (no actual item is consumed).
Building and Running
- Dependencies: JDK 17+
- Build:
- Windows: Run
./gradlew.bat build
- Linux/macOS: Run
./gradlew build
- Artifacts: The mod jars for each platform can be found in the corresponding subproject's
build/libs/ directory.
- Run for Development (Optional):
- Forge Client:
./gradlew :forge:runClient
- Fabric Client:
./gradlew :fabric:runClient
- Quilt Client:
./gradlew :quilt:runClient
The actual supported Minecraft/loader versions are defined in gradle.properties.
Frequently Asked Questions (FAQ)
- Why is the "Minimum Quantity to Keep" shown as the item's stack count?
- This is a visual aid to preview the rule's threshold more intuitively; your actual inventory is not modified.
- Can I save different sets of rules for different playstyles?
- Yes. Use the top [<] 1/9 [>] navigator to switch to a different "page." Each page's rules are independent of the others.
- Is there anything to note when using this with JEI?
- JEI ghost dragging is only for creating or replacing a rule. It does not consume any actual items.
Quickly Locating Source Code
- Forge Config Screen:
forge/src/main/kotlin/ench/autodropx/forge/feature/config/ConfigContainerScreen.kt:1
- Forge Config Manager:
forge/src/main/kotlin/ench/autodropx/forge/feature/config/ConfigManager.kt:1
- Forge Key Binding:
forge/src/main/kotlin/ench/autodropx/forge/KeyBinding.kt:1
Contributing
- Pull Requests (PRs) and Issues are welcome! Before submitting, please ensure the issue is consistently reproducible and aligns with the existing feature set.
- Please try to maintain a code style consistent with the existing Kotlin format. For functional changes, please include a brief description.
Acknowledgments
- Thanks to JEI for providing an excellent UI interaction paradigm.
- Thanks to the community for their feedback and suggestions.
License
- This project is licensed under the GNU Lesser General Public License v2.1 (LGPL-2.1).
- For details, see the
LICENSE file in the repository's root directory.
- By submitting a contribution, you agree to license your work under the same license.
评论 0
登录后参与评分
还没有评论,来抢沙发吧