Triangle Garden (Blender Rendering Teaser)

New features I discovered in blender: manual (and sophiscated) water surface reflection controls! I tried some techiques from the computer graphics class I’m taking this semester, and the result is over fancy. I forgot to ask blender to keep rendering specs. The only specs I remembered are 4096 samples per pixels and that I started blender before I went to sleep, and the process actually had finished before I woke up the next day for classes.

Anyways, here’s the pic. As usual, the image here is downscaled so that the page loads in acceptable time. Shoot me an email for the full image at 4320×2160 if you have 4K (?) displays. See Minecraft Server Page to join the server where I built this thing.

Triangle Garden Rev2 2:1 2160x1080
Triangle Garden Rev2 2:1 2160×1080

Minecraft 1.8 Forge API IBlockState 与渲染

在 Minecraft 内部,方块也可以看作是可放置的物品,使用 Item 类的静态方法 getItemFromBlock(Block someBlock) 可以获得对应的物品。向游戏内注册该方块也是类似的使用 GameRegistry.registerBlock(Block blockToReg, String unlocalizedName)。然而在处理渲染时需要多额外的一步。

以下为 Item 渲染

String nameToReg = MOD_ID + ':' + item.getUnlocalizedName().substring(5);
Minecraft.getMinecraft()
        .getRenderItem().getItemModelMesher()
        .register(item, 0,
        new ModelResourceLocation(nameToReg, "inventory");

以下为 Block 渲染

Item item = Item.getItemFromBlock(block);
// 从 Block 得到对应的 Item
String nameToReg = MOD_ID + ':' + item.getUnlocalizedName().substring(5);
Minecraft.getMinecraft()
        .getRenderItem().getItemModelMesher()
        .register(item, 0,
        new ModelResourceLocation(nameToReg, "inventory");

区别主要在于多了一句从 Block 获得 Item。虽然是以 Item 注册了渲染,实际上这里和 Item 处理渲染的方法并不相同。

assets/<MOD_ID>/blockstates/<blockUnlocalizedName>.json

我所写的 mod 中许多方块都会根据不同的 BlockState 改变渲染模型,而 BlockState 中不同 IProperty 组合所对应状态所对应的模型在这里指定。关于 BlockState,见上一篇 Forge API 详解。我在这里以 TransitRailMod 的电缆架作为例子。

在源代码中,WirePanel 是 CustomDirectionalBlock 的子类,因此继承其 EnumFacing FACING 的属性,这个方块又根据电缆架上是否插了日光灯改变 EnumBool LAMP 属性、是否是封闭的改变 EnumBool SHUT 属性。因此罗列一下: Continue reading Minecraft 1.8 Forge API IBlockState 与渲染