# Custom Chair Model Introduction

Version 1.1.3 and above added the function for custom chair models, user only need to create the resource packs through a specified method, and load it ingame, to add more models and textures for the chair.

To simplify changing model and usage, we used JSON file description for model format from Minecraft Bedrock edition '1.10.0'.

Model loading supports hot reload, you can hot reload it using the vanilla reload resource pack function.

# Description

  • This description is valid for Touhou Little Maid mod version 1.2.0 and above;
  • To add custom models, some understanding on the structure of vanilla Mincraft resource pack is needed;
  • Basic knowledge on JSON format;
  • Recommended to use Blockbench version 3.x, this is a block and entity model building software that is suitable for Minecraft;
  • Currently only support models for older version of Bedrock (1.10.0). Anyone using Blockbench 3.x should note, the default export version for Bedrock models is version '1.12.0', which is not compatible with older version of Bedrock models.
  • For editing script software, Notepad++ or VSCode is recommended, relavant script files requires to be saved using UTF-8 without BOM.
  • Do not limit yourself by the name "chair", you can use it to create other decorative ornaments.

# Resource pack structure

To understand how to create a resource pack, we listed out the structure for resource pack here.

Resource pack folder (Name whatever you want, it's best it is named in English)
├─pack.mcmeta   (Description files  for vanilla resource pack, fixed name and location)
│
└─assets    (Fixed name and location for resource folder, under one resource folder you can have multiple resource domain folder)
    └─my_model_pack  (Resource domain, name whatever you like, just need to write it in lowercase English alphabets and underscored, do not have name conflicts with naming convention)
        ├─maid_chair.json   (Description files for model packs, fixed name and location)
        │
        ├─lang   (Language folder, fixed name and location)
        │    ├─en_us.lang
        │    └─zh_cn.lang
        │
        ├─models   (Model folder)
        │     └─entity
        │            ├─cushion.json
        │            └─wheel_chair.json
        │
        └─textures   (Texture folder)
                 └─entity
                        ├─cushion.png
                        └─wheel_chair.png

# Model Packs Description file Description

During the resource pack loading phase, the game will try to read all 'maid_chair.json' file under all resource domain menu, and check for model loading, the file complete structure is as below, only the parts marked '(Required)' requires to be filled, you don't have to fill everything.

The model supports JSON file with comments, please use at your discretion.

{
    "pack_name": "Blind Custom Chair Texture File", // Model pack name (Required)
    "author": ["TartaricAcid", "SuccinicAcid"],     // Author list
    "description": ["Default Chair Texture Pack"],      // Description script for model packs
    "version": "1.0.3",               // Model pack version
    "date": "2019-08-20",             // Date creation for model pack
    // Model pack icon, without this, the texture pack will have no icon
    "icon": "touhou_little_maid:textures/maid_icon.png",
    "model_list": [{                  // Model list (Required, cannot be blank)
    	// Model id, use the format for vanilla resource (required, resource domain must be the domain located currently)
    	"model_id": "touhou_little_maid:cushion",
        // Model location, use the full resource path
        "model": "touhou_little_maid:models/entity/cushion.json",
        // The path for the texture used by the model, use the full resource path
        "texture": "touhou_little_maid:textures/entity/cushion.png",
        "render_item_scale": 0.9,     // The model size when rendering the item form        
        "mounted_height": 3,          // The entity height above ground when sat on, unit is the number of pixels above ground
        "tameable_can_ride": false,   // Will tamed entities such as maids actively sit on it? Mainly used for models that cannot be sat on
        "name": "Chair",               // Model name
        "description": ["Just a normal chair"], // The description for said model
        // Animation script, without this part, chair will not have any animation
        "animation": ["touhou_little_maid:animation/maid.default.js"]
    }]
}

The example above listed all usable field, only the field with '(Required)' are needed, the rest can be left blank.

For simplicity, you could write a file like this:

{
    "pack_name": "Blind Custom Chair Texture File", // Model pack name (Required)
    "model_list": [{                  // Model list (Required)
        // Model id, use the format for vanilla resource (Required)
    	"model_id": "touhou_little_maid:cushion"
    }]
}

If we do not fill the field for model or texture, it will choose the default model and texture based on model_id.

For the example above, model_id is touhou_little_maid:cushion, then the model file will be cushion.json under models/entity folder that resource domain, the texture is cushion.png under textures/entity folder under that resource domain.

IF we filled the field for model or texture, then the content has no limit, you can even use models from other model packs, just need to fill in the corresponding resource path.

mounted_height is the height of the entity when it is riding the model, the unit is the pixels above ground, you can use decimals. Note, The X and Z position of the riding entity will always be the center of the chair entity, please preset the X and Z of the chair models when designing the models.

# Animated icon

Icon does not have size limit, supports both static and animated icons.

任意为 1:1 的图标均会被解析为静态图标。不为 1:1 的长图,会以 0.1 秒的间隔逐次显示,从而形成动态图效果。

TIP

下图就为模组自带的图标,左侧被解析为静态图标,右侧被解析为动态图标

020

# Model Files Description

  • This mod is using JSON files in Bedrock 1.10.0 for model loading, the document can be exported via model building software Blockbench, without additional edits.

  • Blockbench version 3.x uses models from Bedrock edtion 1.12.0 by defauly, please make sure to change it to old Bedrock models in Files -> Conversion menu.

  • Model can be made using custom animations, you can find the introduction in the custom animation chapter.

  • Currently it does not support animations in Bedrock.

# Chair animation

The latest version of chair by default does not have any animation, which requires model creators to write js animation script to apply the animation.

# Internationlization Description

As a game that are facing internationlization, part of the contents of resource packs also have internationalization compability.

  • pack_name and description field in model packs support internationalization;
  • name and description field in model list support internationalization.

The method of adding internationalization is pretty simple, just need to begin it using { and end it using }, the middle section is the language file key, and then followed by the corresponding language file.

For example we wrote the description as follow (taking just a small section)

"pack_name": "{pack.vanilla_chair_model.name}",
"description": ["{pack.vanilla_chair_model.desc}"]

and then under resource pack domain, in the lang folder we create en_us.lang file, and write the content below:

pack.vanilla_chair_model.name=Vanilla Chair Model
pack.vanilla_chair_model.desc=Default Chair Model Pack

We only added the English file, but if we want to support Chinese, we can create zh_cn.lang file and write the content as below:

pack.vanilla_chair_model.name=原版坐垫资源包
pack.vanilla_chair_model.desc=默认的坐垫模型包

For the first example, if we did not fill the name file, then the system will automatically create the local key based on model_id, for example model_id is touhou_little_maid:cushion, then the generated language key is model.touhou_little_maid.cushion.name.

description file is not generated by default, you will need to fill that in.

# Other questions

# Z-fighting issue

This is an issue with OpenGL itself, during the process of creating models if we used flat or two coinciding solids, we will have this issue.

004

For the issue of one flat graphics, you can add texture to one of the sides and keep the others empty, it will solve the issue; for two coinciding geometries, move the geometry slightly, or delete the coinciding part will do.

# Uppercasing and lowercasing file names

In Minecraft resource packs, uppercase and lowercase in a file is all determined by pack_format field in pack.mcmeta file of the resource pack. If it is 3,then all the internal file needs to be lowercase, we recommend this method.

# Name conflies

For model skeletons (which is folder icon on the left side of Blockbench) no name conflicts are allowed, even if they are in different locations, or you may cause a model error. But blocks (which is block icon on the left side of Blockbench) are not affected.