Sal_fish 的属性库 (双拼原味咸鱼罐头)
一个轻量级的 Minecraft Forge 1.20.1 属性库,旨在通过原版属性系统赋予整合包制作者和玩家对实体属性的精细控制。它还包含一个跨会话的命令记忆功能,可以在游戏会话之间持久化保存命令历史。
? 共享属性(应用于所有生物)
这些属性会自动添加到每个生物身上。整合包制作者可以全局或按生物类型设置默认值,其他模组也可以动态修改它们。
generic.scale – 控制实体的视觉大小和碰撞箱。默认值:1.0
generic.step_height – 实体在不跳跃的情况下能够行走的最大方块高度。默认值:0.6
generic.safe_fall_distance – 实体在受到跌落伤害之前所能承受的最大垂直下落距离。默认值:3.0
? 仅限玩家的属性
这些属性仅添加给玩家,影响游戏平衡和交互范围。
generic.creative_flight – 如果设置为大于 0 的值,无论游戏模式如何,玩家都可以飞行。默认值:0
player.block_interaction_range – 玩家可以与方块交互(放置、破坏、使用)的最大距离。默认值:4.5
player.entity_interaction_range – 玩家可以与实体交互(攻击、使用)的最大距离。默认值:3.0
player.block_break_speed – 应用于玩家方块破坏速度的乘数。默认值:1.0
所有属性支持任何值(技术上受 Java 整数限制约束),允许打包作者微调从移动能力到交互范围的各个方面,而无需创建数十个单独的修饰器。
? 命令记忆系统
该模组会自动记住聊天中输入的最后 50 条命令(以 / 开头的消息),并将它们保存到 Minecraft 游戏目录中的 command_history.txt 文件中。
历史记录在世界切换后以及完全退出游戏后依然保留。
命令按顺序存储,可以通过聊天屏幕中的 ↑ / ↓ 方向键访问,就像原版聊天历史记录一样。
无需额外配置——开箱即用。
? 使用方法
只需在服务器和客户端安装此模组即可。不需要配置文件或依赖项。
对于整合包作者:使用提供的属性注册表,通过命令方块、脚本(CraftTweaker、KubeJS)或您自己的模组为玩家和怪物分配自定义值。
对于其他开发者:将此库作为依赖项添加,并直接从 ModAttributes 访问属性注册表对象。
? 技术说明
属性使用 Forge 的 DeferredRegister 进行注册,并在服务器和客户端之间完全同步。
实体渲染(缩放、阴影大小)通过 mixins 自动调整,确保视觉一致性。
命令历史功能使用本地文件来存储命令;它永远不会向服务器发送任何数据。
欢迎在整合包中使用、修改和分发本模组。反馈和建议始终受欢迎!
Sal_fish's Attribute Lib (双拼原味咸鱼罐头)
A lightweight attribute library for Minecraft Forge 1.20.1, designed to give modpack creators and players fine-grained control over entity properties through the vanilla attribute system. It also includes a cross-session command memory feature that persists command history across game sessions.
? Shared Attributes (applied to all living entities)
These attributes are automatically added to every living entity. Modpack makers can set default values globally or per entity type, and other mods can modify them dynamically.
generic.scale – Controls the visual size and hitbox of the entity. Default: 1.0
generic.step_height – The maximum block height the entity can walk up without jumping. Default: 0.6
generic.safe_fall_distance – The maximum vertical distance the entity can fall before taking fall damage. Default: 3.0
? Player-Only Attributes
These are added only to players and affect gameplay balance and interaction ranges.
generic.creative_flight – If set to a value greater than 0, the player can fly regardless of game mode. Default: 0
player.block_interaction_range – The maximum distance at which the player can interact with blocks (place, break, use). Default: 4.5
player.entity_interaction_range – The maximum distance at which the player can interact with entities (attack, use). Default: 3.0
player.block_break_speed – A multiplier applied to the player’s block breaking speed. Default: 1.0
All attributes support any value (technically bounded by Java integer limits), allowing pack authors to fine-tune everything from movement to reach without creating dozens of separate modifiers.
? Command Memory System
The mod automatically remembers the last 50 commands typed in chat (messages starting with /) and saves them to a command_history.txt file in the Minecraft game directory.
History persists across world changes and even after completely exiting the game.
Commands are stored in order and are accessible via the ↑ / ↓ arrow keys in the chat screen, just like the vanilla chat history.
No extra configuration needed – it works out of the box.
? Usage
Simply install this mod on both server and client. No configuration files or dependencies required.
For modpack authors: Use the provided attribute registries to assign custom values to players and mobs via command blocks, scripts (CraftTweaker, KubeJS), or your own mods.
For other developers: Add this library as a dependency and access the attribute registry objects directly from ModAttributes.
? Technical Notes
Attributes are registered using Forge’s DeferredRegister and are fully synced between server and client.
Entity rendering (scale, shadow size) is adjusted automatically via mixins, ensuring visual consistency.
The command history feature uses a local file to store commands; it never sends anything to a server.
Feel free to use, modify, and distribute in modpacks. Feedback and suggestions are always welcome!
评论 0
登录后参与评分
还没有评论,来抢沙发吧