Using Custom Entities

It isn’t necessary to create entities based on templates. If we want, we can write out entities by hand. This is useful when we want to include some of our own events, component groups, or components.

Just remember that if you are often creating similar entities, it might be worth it to turn your entity into a snippet, and then simple call that snippet in each template file. This can be done by adding the template into custom_settings.json.

Template:

{
    "header": {
        "output_type": "here",
        "default_state": "main",
    },
    "states": [
        {
            "name": "main",
            "text": [
                "Hi there!",
                "This is a generic line of dialogue"
            ]
        }
    ],
    "entity": {
            "format_version": "1.14.0",
            "minecraft:entity": {
                "description": {
                    "identifier": "sirlich:example",
                    "is_spawnable": true,
                    "is_summonable": true,
                    "is_experimental": false
                },
                "components": {
                    "minecraft:collision_box": {
                        "width": 1,
                        "height": 2
                    },
                    "minecraft:push_through": {
                        "value": 1
                    },
                    "minecraft:health": {
                        "value": 5,
                        "max": 5
                    },
                    "minecraft:physics": {},
                    "minecraft:nameable": {}
                },
                "component_groups": {},
                "events": {}
            }
}

With Comments:

{
    //Header like normal
    "header": {
        "output_type": "here",
        "default_state": "main",
    },

    //Simple state definition
    "states": [
        {
            "name": "main",
            "text": [
                "Some random dialogue",
                "A second, random dialogue line."
            ]
        }
    ],

    //Instead of using the string version, we can type a normal Minecraft entity definition here
    //Echo will use this as the base, and will add Echo code around it.
    "entity": {

            //Echo is only set up to work with 1.14.0 entities.
            "format_version": "1.14.0",
            "minecraft:entity": {
                "description": {

                    //Remember to set an identifier!
                    "identifier": "sirlich:example",
                    "is_spawnable": true,
                    "is_summonable": true,
                    "is_experimental": false
                },
                "components": {
                    //Add your own components

                    "minecraft:collision_box": {
                        "width": 1,
                        "height": 2
                    },
                    "minecraft:push_through": {
                        "value": 1
                    },
                    "minecraft:health": {
                        "value": 5,
                        "max": 5
                    },
                    "minecraft:physics": {},
                    "minecraft:nameable": {}
                },
                "component_groups": {
                    //Add your own component groups
                },
                "events": {
                    //Add your own events
                }
            }
}