Better Cushion Placement

Quick rating

Better Cushion Placement

No reviews yet

Cushions snap to the pixel grid or block grid, stack on one another, & render a placement preview. With game rules, they support one another with no block support, and can be sub-pixel placed in cauldrons/composters/hoppers regardless of block tags.

Mod Loaders
Fabric
Minecraft

Community voices

Reviews

Versions
Loading versions…
Match includes

Click once to include, again to exclude, again to clear

Rating Any
Any 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
Min
Max
Play Status
Reviews
Time Played
hrs+
Verified developers only
Has developer response
List view
Grid view
Compact view
Sort by
Date
Rating
Helpful
Unhelpful
Edited
Sort ascending
Delete this review?

This removes your review from the project. You can write a new review after.

Review submitted for moderation

Your review has been sent to moderators, who will check that it meets our guidelines before it appears publicly.

No reviews yet. Be the first to review this project!

Get it on

Available Platforms

Compatibility

Supported Environments

Dev Environment
Client Optional
Server Required

About

Project Details

Type
Mod
License
Creative Commons Zero v1.0 Universal
Latest Version
1.3.0
Authors

For authors

Embed Badge

If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.

Custom banner text
ModDex rating badge preview

Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.

Identifiers

Platform IDs

Modrinth ID

Resources

External Links

Source Issues Wiki Discord

About

Description

Visual Summary

Cushion Placement



Placement Mechanics

Block GridVertical Pixel Grid Snap: On

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).

Pixel Grid

Holding Control

  • Place a cushion horizontally centered on the closest vertex of the pixel grid.

Off-Grid

Holding Shift + Control

  • Place a cushion horizontally centered exactly where clicked, completely off-grid.

Block Center

Holding neither (Vanilla behavior)

  • Place a cushion horizontally centered on the closest block grid tile center.


Placement Preview

Cushion 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.
Config GUI

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) 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
      • Disabled

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
Cushion Flush With Block Cushion Almost Flush With Block

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
      • Disabled

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
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
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:

  1. 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.

Screenshots

Gallery

  • Cushions Stacking / Sub-Pixel & Block/Pixel Grid Placement
    Cushions Stacking / Sub-Pixel & Block/Pixel Grid Placement Cushions snap to a block grid vertex with the sneak, pixel grid with the sprint, off-grid with both. Cushions can stack on one another with sneak. Game rules allows cushions to support one another, and allow sub-pixel cauldron/composter/hopper placement.
  • Placement Preview
    Placement Preview A box renders where a cushion will place with the color it will have when placed. Cushions snap to vertices of the block grid with the sneak, the pixel grid with the sprint, and off-grid with both.
  • Config GUI
    Config GUI Placement preview screen of the config GUI.
  • Industrial Structure
    Industrial Structure The cushions of the center base section were placed while holding shift to snap them to vertices of the block grid.
  • Decorative Pattern
    Decorative Pattern Cushions were placed while holding control to snap them to vertices of the pixel grid.
  • Block Grid Placement
    Block Grid Placement Hold shift to snap a cushion to the closest vertex of the block grid.
  • Pixel Grid Placement
    Pixel Grid Placement Hold control to snap a cushion to the closest vertex of the pixel grid.
  • Off-Grid Placement
    Off-Grid Placement Hold shift and control to place a cushion exactly where clicked, preventing it from snapping to anything.
  • Block Center Placement
    Block Center Placement Vanilla behavior: Hold neither shift nor control to place a cushion snapped to the center of a block.

Versions

Files

Relations

Project Relations

More like this

Similar Mods

Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.

On ModDex

Community snapshot

0
Ratings
0
Followers
0
In stacks

By the numbers

Statistics

<1,000
Downloads
Last Updated
CurseForge
Created
Last synced
When ModDex last fetched this project from CurseForge or Modrinth. Every project is re-checked on a schedule, and any project that ships a new file is synced automatically within hours of the release.
New file updates sync automatically
How syncing works