The Hot City?

When I told someone Chengdu is a hot city, I meant both food and the city itself. Hopefully, I finally remembered that I forgot procrastinated to post my photos I took when I travelled to Chengdu and stayed for a few days this winter. Still, these pictures are taken from my old Canon 50D DSLR and the mediocre lens.

Continue reading The Hot City?

Lake superior and sunset

Lake Superior – Sugarloaf Cove

Position: 47°29’11″N 90°58’59″W

Cobblestone underwater. Taken on sugarloaf cove beach with waterproof Xperia Z5.
Cobblestone underwater on sugarloaf cove beach with waterproof Xperia Z5.

I took this photo with the waterproof Xperia upside down with camera underwater. Not exactly what I expected but still amazing enough to see colorful cobblestone underwater.

Colorful cobblestones on the beach of Lake Superior
Colorful cobblestones on the beach of Lake Superior

Yet another regular collection of colorful stone beach.

Lake Mille Lacs

Position: 46°10’52″N 93°43’42″W

Lake Mille Lacs, partially frozen. Taken on a trail 2m from the shore.
Lake Mille Lacs, partially frozen. Taken on a trail 2m from the shore.

This one is pretty off-road on the side of a trail beyond Indians point. Cold, but beautiful.

Minnesota Route 1

Sunset on MN-1 westbound
Sunset on MN-1 westbound

Unfortunately I lost Geo-tag in this photo… So I don’t know the precise location on the road.

Self burn notice

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Qzone is now completely abandoned. All correspondence, articles, pictures, codes are only released here from now on.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEg1wZoHV/Mn9J13Mv0iaRjCEfa7AFAlidXUMACgkQ0iaRjCEf
a7CLVxAAqZgf4xp6v9srZob0/vMiYtzTT5UCQ84GtaH0NqtK6RQeQA06lT7kJiPE
uBfJlwc18lOQutrQsH8M7LSr3l/cDBhxgSqTKL7MR+XljPCiB/+en7Jc+KrLToHk
QAJ34NS1vQIg216Qsf1KBOaiRmpr7G+pD5OpS4tQi2I80Nzc/ziFyR2JVtkYo6G7
Zi3OkiXqZhX3aQrGgtjFO8wZ+w6ADG8sf8Wi2ppck76pJKUE/3Iq0lRau1bPvGFU
qHxdtt0cQpDY2JOohp4Xdv2G5Ce5+1Pf6Y60I5zsrPug10SCQUo8IDxNp0O6VPH1
8fsU8yAK7aqDKNE9UaNQPMHVN4JKc5CTbn0kimLsIrSLO9fUKuZSeq8MdPmxZx39
MpqcOsYPIrxZtAhTb3sve5l5M9tBGnNTZ8t4AuL3zeVxhQLQ+5BQFC8gYGTP6F2b
+JZAXn/Lk8LlxONWmDXRMC0kBirLipBGlUqWu4pPhnPVhNmXUG7LQk1Fx5FrWnf4
fYRCl/+QYIzOtkERBUf0LrvD5IyOJr/ByHLyoX0RRJ3TxV9mN1U1Yw8RUqRlcVOG
2UiA/hHticRlsOW36ObAEBX+L05/MQ8EUHn4HxY4L85EsI/JiKVj2NJM3nTi2ldL
GOSPUXex5iv/xqNO1gI2CelY9aa2PYq+gEcsUlEnpeYhUH52N8A=
=wOjD
-----END PGP SIGNATURE-----

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 与渲染

Minecraft 1.8 Forge API BlockState 与红石详解

由于网上找到的 Minecraft Forge 文档实在是少的可怜,我决定自己写一份以防未来的自己忘记。具体的实践可以在我的客运铁路 mod 见到。

红石的更新本质上也是方块更新,因此当一个方块想要检测红石信号,处理的代码应当放在 Block 类的 onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) 方法。

BlockStateIBlockState

可以在方块的 Class 建立 BlockState 以允许方块拥有不同的状态 (IProperty),不同的状态可以在 assets/<MODID>/blockstates/<block_instance_name>.json 中定义不同的方块模型。

每一个 IProperty 拥有自己的 name 和可以取到的有限个值,这些值在 Java 内部以 enum 的形式实现。关于 enum 变量类型,可以在王八壳的 javadoc 上找到。

一个方块的 BlockState 可以包含一个或多个 IProperty,可以使用已经定义好的 IProperty 子类(PropertyDirection, PropertyBool)也可以自己定义 enum 建立 PropertyEnum

Class: public CustomBlock extends Block

通过以下方式建立 IProperty 及其子类的实例:

  • public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
    建立新的方向属性,名称为 "facing" ,可以取的值为平面方向的朝向,为 EnumFacing 下的 NORTHEASTSOUTHWEST
  • public static final PropertyBool POWERED = PropertyBool.create("powered");
    建立布尔型只能为 truefalse 的方块属性。

Continue reading Minecraft 1.8 Forge API BlockState 与红石详解

Midymidy Cth 客运铁路企划 Part I

Part I 展示区,后续 Part 将会给出具体的设计规范。对我不会弃坑的

目前在 Midymidy 服务器的创造维度进行规划设计,并且在未来计划将这样的设计应用至生存维度中连接各地点和玩家聚集区的铁路。

海湾铁路桥

The Gulf Bridge for Line C1 in Midymidy R3 Creative World
The Gulf Bridge for Line C1 in Midymidy R3 Creative World

Continue reading Midymidy Cth 客运铁路企划 Part I