Adding a Loot Table

Next, we'll enhance the custom Ghost entity by adding some more basic mechanics to it:

Loot tables

First, we'll make the ghost drop Ectoplasm upon death: create the following file:

TODO: needs to be finished

BP/loot_tables/entities/ghost.jsonCopy
{
	"pools": [
		{
			"rolls": 1,
			"entries": [
				{
					"type": "item",
					"name": "wiki:ectoplasm",
					"weight": 1,
					"functions": [
						{
							"function": "set_count",
							"count": {
								"min": 1,
								"max": 3
							}
						}
					]
				}
			]
		}
	]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

Spawn rules

Next, we'll make the ghost spawn in deserts at night:

BP/spawn_rules/ghost.jsonCopy
{
  "format_version": "1.8.0",
  "minecraft:spawn_rules": {
    "description": {
      "identifier": "wiki:ghost",
      "population_control": "monster"
    },
    "conditions": [
      {
        "minecraft:spawns_on_surface": {
        },
        "minecraft:brightness_filter": {
          "min": 0,
          "max": 7,
          "adjust_for_weather": true
        },
        "minecraft:difficulty_filter": {
          "min": "easy",
          "max": "hard"
        },
        "minecraft:weight": {
          "default": 80
        },
        "minecraft:herd": {
          "min_size": 1,
          "max_size": 3
        },
        "minecraft:biome_filter": {
          "test": "has_biome_tag",
          "operator": "==",
          "value": "desert"
        }
      }
    ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

Crafting recipes

And finally, as an introduction to recipes, we'll make the Ectoplasm craftable into Slime Blocks:

BP/recipes/ectoplasm_slime_blocks.jsonCopy
{
	"format_version": "1.12.0",
	"minecraft:recipe_shaped": {
		"description": {
			"identifier": "wiki:ectoplasm_slime_block"
		},
    "tags": [ "crafting_table" ],
		"pattern": [
			"###",
			"###",
			"###"
		],
		"key": {
			"#": {
				"item": "wiki:ectoplasm"
			}
		},
		"result": {
			"item": "minecraft:slime"
		}
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

Your progress so far:

What you've done:

  • [x] Setup your pack;
  • [x] Create a custom item;
  • [x] Create a custom entity;
  • [x] Create the entity's loot, spawn rules, and a custom recipe;

What are you to do next: Congratulations! you have finished the Guide and created your first Add-on.

Contributors

Ultr4Anubiscda94581SirLichsermah