视觉概览
放置机制


按住 Shift
- 将靠垫水平放置在距方块网格顶点最近的位置并居中。
- 通过交互操作,将手持的靠垫堆叠在世界中的靠垫上(前提是它具有方块支撑)。
按住 Control
同时按住 Shift + Control
- 将靠垫水平放置在点击的确切位置,完全脱离网格对齐。
都不按住 (原版行为)
- 将靠垫水平放置在距方块网格图块中心最近的位置并居中。
放置预览
当靠垫被放置时,会渲染一个显示其最终颜色的框体作为预览。
方块标签
- ID
#normal_cushion_placement
- 描述
- 在对具有此标签的方块进行放置时,强制使用正常的方块中心放置方式。
- 默认包含
配置文件
文件夹:config/bettercushionplacement/
配置界面
- 可通过
Mod Menu 访问 Yet Another Config Lib 的配置界面,以在游戏中更改配置。
- 仅当同时安装了
Mod Menu 和 Yet Another Config Lib 时可用。
- 如果仅安装了
Mod Menu,仍可查看本地化的模组名称、描述和摘要。
客户端配置 bcp-client.conf
Placement Preview(放置预览):配置如何渲染靠垫的放置预览框
Enabled(启用)
Line Width Override(线条宽度覆盖)
- 如果为正数,框体的线条将以该值渲染。
- 如果为负数,它们将以默认大小渲染。
- 如果为零,则跳过渲染。
Opacity(不透明度)
Color(颜色)
- 框体将渲染为此颜色。颜色可以是:
CUSHION_COLOR:靠垫放置时的染料颜色。
DYE_COLOR_OVERRIDE:由 Dye Color Override 配置指定的染料颜色。
- 在这两种情况下,染料颜色的变体将由 'Dye Color Variant' 配置指定。
COLOR_OVERRIDE:由 Color Override 配置指定的颜色。
Dye Color Override(染料颜色覆盖)
- 如果
Color 配置设置为 DYE_COLOR_OVERRIDE,框体将以此染料颜色渲染。
Color Override(颜色覆盖)
- 如果
Color 配置设置为 COLOR_OVERRIDE,框体将以此颜色渲染。
Dye Color Variant(染料颜色变体)
- 如果
Color 配置设置为 COLOR_OVERRIDE,框体将以此颜色渲染。
通用配置 bcp-common.conf
游戏规则特性(Cushions Support Each Other 和 Snap Cushion Elevation To Pixel Grid,见下文)可以在 config 文件夹中的 bettercushionplacement-gamerules.properties 文件中设置为始终启用或始终禁用。
- 如果设置为始终启用/禁用,对应的规则将不存在,但特性本身会存在。
- 如果设置为始终禁用,提供该特性的对应 mixin 将不会被应用。
- 这意味着即使 mixin 导致的 method call 产生的微小性能开销也会被避免。
游戏规则
无需方块支撑即可直接将靠垫堆叠在一起
- ID
bettercushionplacement:cushions_support_each_other
- 名称
- 描述
- 靠垫除了由方块支撑外,还可以由其他靠垫支撑,从而实现直接堆叠。
- 默认状态
背景说明
原版靠垫支撑逻辑如下 Cushion_wouldSuriveAt:
- L156-158 通过获取靠垫所在或可能所在的边界框,并略微水平收缩它以及向下垂直扩展 1/4 像素来创建一个锚点框。
- 159 遍历与该区域额外向下扩展 4 像素相交的方块。
- 160 对于每个方块,获取其大致形状。
- 161 如果该形状不为空且与锚点框相交,则认为其具有支撑。
如果未找到方块支撑,此游戏规则还会检查其下方的其他靠垫实体,如果找到一个,则认为其具有支撑。
| 无需数据包即可实现平整放置 |
通过告示牌实现近平整放置 |
 |
 |
通过游戏规则绕过内部墙壁子像素放置的方块标签限制
- ID
bettercushionplacement:allow_inner_wall_cushion_placement
- 名称
- 描述
- 忽略
#cushion_uses_collision_shape 方块标签,从而无需数据包即可在锅、堆肥桶和漏斗的内部墙壁上进行子像素靠垫放置。
- 默认值
背景说明
原版方块交互行为如下 BlockGetter_clipWithInteractionOverride:
- 第87行 对方块的主要形状进行射线追踪。
- 第88行 检查是否命中。
- 第89行 如果命中,则对方块的交互形状进行射线追踪。
- 第90行 检查是否命中,并判断其是否比主要形状的命中点更靠近眼睛。
- 第91行 如果交互形状的命中点比主要形状的命中点更近,则将命中结果的方向替换为新方向。
默认情况下,方块没有交互形状 BlockBehaviour_getInteractionShape,以下方块除外:
无论返回完整方块形状还是仅内部空洞形状,所有这些方块都具有具有实心平坦顶面的交互形状,且该顶面与方块空间的顶部齐平。
| 堆肥桶交互形状 |
漏斗交互形状 |
 |
 |
要对这些方块形状的内部墙壁获得射线追踪命中,唯一的方法是对其交互形状的顶面获得更近的命中。这意味着任何内部命中都将具有预期的内部位置向量,但方向为 Direction.UP(向上)。因此,尽管靠垫通常需要与向上的面进行交互 CushionItem_useOn#L38,但这些方块独特地绕过了此要求。
虽然子像素放置仍然可行(例如在墙上告示牌 WallSignBlock_SHAPES 上),但在水平面上放置以及任意 Y 轴定位并非设计初衷。这就是 Mojang 添加 #cushion_uses_collision_shape 方块标签的原因,它强制使用碰撞形状射线追踪的结果 CushionItem_recalculateContextForSpecialCollisionShapes#L81-88。
| 墙壁碰撞放置 |
灵魂沙碰撞放置 |
 |
 |
请注意,射线追踪是从眼睛 L84 到略微超出退出结果向量的位置 L85-86,并且命中失败默认使用原始命中结果 L88。这意味着当碰撞形状命中比主形状命中更靠近眼睛时(例如墙壁方块 WallBlock_collisionShapes),将使用碰撞形状。但当主形状命中更近时(例如灵魂沙方块 SoulSandBlock_SHAPE),即使带有标签,也将使用主形状。
仅限服务器安装
如果此模组仅安装在服务器上而未安装在客户端上,一切功能将按预期工作,但存在以下纯视觉上的例外情况:
- 玩家的手部会摆动
- 玩家的手部不会摆动
- 当在坩埚、堆肥桶或漏斗的内壁上放置垫子时。
- 当将一个垫子叠放在另一个垫子上时。
Visual Summary
Placement Mechanics


Holding Shift
- Place a cushion horizontally centered on the closest vertex of the block grid.
- Stack a held cushion on one in the world by interacting with it (if it will have block support).
Holding Control
- Place a cushion horizontally centered on the closest vertex of the pixel grid.
Holding Shift + Control
- Place a cushion horizontally centered exactly where clicked, completely off-grid.
Holding neither (Vanilla behavior)
- Place a cushion horizontally centered on the closest block grid tile center.
Placement Preview
A box renders where a cushion will place with the color it will have when placed.
Block Tags
- ID
#normal_cushion_placement
- Description
- Forces the normal center-of-block placement of cushions when placing them against blocks with this tag.
- Default
- Contains blocks with the
#signs block tag.
Configs
Folder: config/bettercushionplacement/
Config Screen
Yet Another Config Lib config screen is accessible through Mod Menu for changing configs in-game.
- Only when
Mod Menu and Yet Another Config Lib are both installed.
- Localized mod name, description, and summary can still be viewed if only
Mod Menu is installed.
Client Config bcp-client.conf
Placement Preview: Configures how to render a placement preview box for cushions
Enabled
- Whether to render a placement preview box for cushions.
Line Width Override
- If positive, the lines of the box will render with this.
- If negative, they will render with the default size.
- If zero, rendering will be skipped.
Opacity
- The box will render with this alpha value.
- If zero, rendering will be skipped.
Color
- The color the box will render as. The color will be:
CUSHION_COLOR: The dye color the cushion will be when placed.
DYE_COLOR_OVERRIDE: The dye color specified by the Dye Color Override confg.
- In both cases, the variant of the dye color will be specified by the 'Dye Color Variant' config.
COLOR_OVERRIDE: The color specified by the Color Override confg.
Dye Color Override
- If the
Color config is set to DYE_COLOR_OVERRIDE, the box will render as this dye color.
- Otherwise, this will be ignored.
Color Override
- If the
Color config is set to COLOR_OVERRIDE, the box will render as this color.
- Otherwise, this will be ignored.
Dye Color Variant
- If the
Color config is set to COLOR_OVERRIDE, the box will render as this color.
- Otherwise, this will be ignored.
Common Config bcp-common.conf
Game rule features (Cushions Support Each Other and Snap Cushion Elevation To Pixel Grid, see below) can be set to always enabled or always disabled in the bettercushionplacement-gamerules.properties file in the config folder.
- If set to always enabled/disabled the corresponding rule will not exist, but the feature will.
- If set to always disabled, the corresponding mixin that provides the feature will not be applied.
- This means that even the negligible performance cost of the method call the mixin results in will be prevented.
Game Rules
Stack cushions directly on one another without block support
- ID
bettercushionplacement:cushions_support_each_other
- Name
- Cushions Support Each Other
- Description
- Instead of only being supported by blocks, cushions can also be supported by other cushions, allowing direct stacking.
- Default
Background Explanation
Vanilla cushion support is as follows Cushion_wouldSuriveAt:
- L156-158 Make an anchor box by taking the bounding box a cushion is or might be, and slightly horizontally shrinking it and vertically expanding it down by 1/4 pixel.
- 159 Iterate the blocks intersecting that area additionally expanded down by another 4 pixels.
- 160 For each block, get its general shape.
- 161 Consider it supported if that shape is not empty and if it intersects the anchor box.
If no block support is found, this game rule additionally checks for other cushion entities below it, and considers it supported if one is found.
| Flush placement w/o datapack |
Close to flush via a sign |
 |
 |
Bypass block tags for inner wall sub-pixel placement with a game rule
- ID
bettercushionplacement:allow_inner_wall_cushion_placement
- Name
- Allow Inner Wall Cushion Placement
- Description
- Ignores
#cushion_uses_collision_shape block tags, thus allowing sub-pixel cushion placement on the inner walls of cauldrons, composters, and hoppers without a data pack.
- Default
Background Explanation
Vanilla block interaction behavior is as follows BlockGetter_clipWithInteractionOverride:
- L87 Raytrace a block's main shape.
- L88 Check for hit.
- L89 If hit, raytrace the block's interaction shape.
- L90 Check for hit, and check if it's closer to the eyes than the main shape hit.
- L91 If the interaction shape hit is closer than main shape hit, substitute the direction of the hit result with the new direction.
Blocks by default have no interaction shape BlockBehaviour_getInteractionShape, with the following exceptions:
Whether returning a full block shape or just the inner void shape, all of these blocks have interactions shapes with solid flat tops flush with the top of the block space.
| Composter interaction shape |
Hopper interaction shape |
 |
 |
The only way to get a raytrace hit on the inner walls of the shapes of these blocks is to get an even closer hit on the top face of their interaction shapes. This means that any inner hit will have the expected inner location vector, but with a direction of Direction.UP. So although cushions require interacting with an upward face CushionItem_useOn#L38, these blocks uniquely bypass this requirement.
While sub-pixel placement is still possible (on signs WallSignBlock_SHAPES, for example), placement on horizontal faces and arbitrary Y positioning was not intended. This is why Mojang added the #cushion_uses_collision_shape block tag, which forces the use of the collision shape raytrace result CushionItem_recalculateContextForSpecialCollisionShapes#L81-88.
| Wall collision placement |
Soul Sand collision placement |
 |
 |
Note that raytrace is from the eyes L84 to the slightly past the exiting hit result vector L85-86, and that hit failure defaults to the original hit result L88. This means that when a collision shape hit is closer to the eyes than the main shape hit, as with wall blocks WallBlock_collisionShapes, the collision shape will be used. But when the main shape hit is closer, as with soul sand blocks SoulSandBlock_SHAPE, the main shape will be used in spite of having the tag.
Server-only Installation
If this mod is installed on a server, but not a client, everything will work as intended, with the following purely visual exceptions:
- The player's hand will swing
- Even when cushion placement fails due to intersection with an existing cushion.
- The player's hand will not swing
- When placing a cushion on the inner wall of a cauldron, composter, or hopper.
- When stacking a cushion on another cushion.
评论 0
登录后参与评分
还没有评论,来抢沙发吧