跳到正文

Salicin: Block Scale

作者:MCXCC

Easily and conveniently resize & rotate blocks (with BERs and collision boxes)

收藏

截图

介绍

中文介绍正在准备中,下面暂时显示原文。

Easily and conveniently resize and rotate blocks (including their block entity renderers and collision boxes) with a single interface.

This is a library mod for Minecraft Forge 1.20.1. Have your Block implement IScalableBlock and/or IRotatableBlock, and it automatically gets scaled/rotated model rendering, BER rendering, and VoxelShape collision, no per-block mixin registration required.

Features

  • One interface, everything scaled: implement IScalableBlock, return an SBSProp config, done.
  • One interface, everything rotated: implement IRotatableBlock, return an SBSRProp config, and blocks rotate around any axis at any angle.
  • Block model rendering: BakedQuad vertices transformed via BakedModel proxy at model bake time, ensuring compatibility with rendering replacers like Embeddium & Oculus.
  • Block entity rendering: BERs (chests, signs, etc.) scale and rotate together with their parent block via Mixin injection into BlockEntityRenderDispatcher.
  • Collision box scaling & translation: VoxelShape automatically transformed when scaleShape is enabled; intelligently translated to match rotated model center.
  • Compound transforms: blocks can implement both interfaces — rotation is applied first, then scaling.
  • Configurable pivot: scale and rotate around any anchor point within the block.
  • Zero configuration: no mixin config, no JSON, no data-gen. Pure API.

Usage

public class MyBlock extends Block implements IScalableBlock, IRotatableBlock {

    @Override
    public SBSProp getScaleConfig(BlockState state) {
        // Scale to 50% around the block center, including collision
        return new SBSProp(0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, true);
    }

    @Override
    public SBSRProp getRotationConfig(BlockState state) {
        // Rotate 45° around Y axis, centered on the block
        return new SBSRProp(45f, Direction.Axis.Y, 0.5f, 0.5f, 0.5f);
    }

    @Override
    public VoxelShape getShape(BlockState state,
                               BlockGetter level,
                               BlockPos pos,
                               CollisionContext ctx) {
        VoxelShape rotatedShape = getTranslatedShape(state, level, pos, ctx, 
                                                     super.getShape(state, level, pos, ctx));
        return getScaledShape(state, level, pos, ctx, rotatedShape);
    }
}

SBSProp Parameters

| Field | Description |
|——-|————-|
| scaleX / Y / Z | Scale multiplier per axis (1.0 = original) |
| pivotX / Y / Z | Anchor point in block coordinates (0~1, 0.5 = center) |
| scaleShape | Whether to also scale the collision VoxelShape |

SBSRProp Parameters

| Field | Description |
|——-|————-|
| degree | Rotation angle in degrees |
| axis | Rotation axis (Direction.Axis.X / Y / Z) |
| pivotX / Y / Z | Anchor point in block coordinates (0~1, 0.5 = center) |

Compatible

This mod is designed to be compatible with Embeddium & Oculus. Any incompatibility is welcome to feedback.

Feedback

If you have issues/pr to submit, please first send a brief description about the issue to [email protected], you will be redirected to a gitea website with username & password. You can continue your issues/pr there.

常见问题

Salicin: Block Scale 支持哪些 Minecraft 版本?

Salicin: Block Scale 支持 Minecraft Java 版 1.20.1,可用的加载器:Forge。下载时注意选择和你游戏版本一致的文件。

Salicin: Block Scale 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Forge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:仅客户端。

评论

登录后评论和评分

MCXCC 的其他作品

查看全部 →