{
	"format_version": "1.20.80",
	"minecraft:entity": {
		"description": {
			"identifier": "shapescape_mb:guide_book",
			"is_spawnable": true,
			"is_summonable": true,
			"properties": {
				"shapescape_mb:active_texture": {
					"client_sync": true,
					"type": "int",
					"default": 0,
					"range": [
						0,
						10
					]
				}
			}
		},
		"component_groups": {
			"shapescape_mb:can_interact": {
				"minecraft:interact": {
					"interactions": [
						{
							"on_interact": {
								"filters": {
									"all_of": [
										{
											"test": "is_family",
											"subject": "other",
											"value": "player"
										},
										{
											"test": "is_sneaking",
											"subject": "other",
											"value": false
										}
									]
								},
								"event": "shapescape_mb:on_interact",
								"target": "self"
							}
						},
						{
							"on_interact": {
								"filters": {
									"all_of": [
										{
											"test": "is_family",
											"subject": "other",
											"value": "player"
										}
									]
								},
								"event": "shapescape_mb:drop_self",
								"target": "self"
							}
						}
					]
				},
				"minecraft:damage_sensor": {
					"triggers": [
						{
							"deals_damage": false,
							"on_damage": {
								"filters": {
									"all_of": [
										{
											"test": "is_family",
											"subject": "other",
											"value": "player"
										},
										{
											"test": "is_sneaking",
											"subject": "other",
											"value": false
										}
									]
								},
								"event": "shapescape_mb:on_interact",
								"target": "self"
							}
						},
						{
							"deals_damage": false,
							"on_damage": {
								"filters": {
									"all_of": [
										{
											"test": "is_family",
											"subject": "other",
											"value": "player"
										}
									]
								},
								"event": "shapescape_mb:drop_self",
								"target": "self"
							}
						},
						{
							"deals_damage": false
						}
					]
				}
			},
			"shapescape_mb:despawn": {
				"minecraft:instant_despawn": {}
			},
			"shapescape_mb:player_is_futher_away": {
				"minecraft:environment_sensor": {
					"triggers": [
						{
							"event": "shapescape_mb:player_is_near",
							"target": "self",
							"filters": {
								"test": "distance_to_nearest_player",
								"operator": "<=",
								"value": 2
							}
						}
					]
				}
			},
			"shapescape_mb:player_is_near": {
				"minecraft:environment_sensor": {
					"triggers": [
						{
							"event": "shapescape_mb:player_is_futher_away",
							"target": "self",
							"filters": {
								"test": "distance_to_nearest_player",
								"operator": ">",
								"value": 2
							}
						}
					]
				}
			}
		},
		"components": {
			"minecraft:health": {
				"value": 1,
				"max": 1
			},
			"minecraft:collision_box": {
				"height": 1.5,
				"width": 0.1
			},
			"minecraft:custom_hit_test": {
				"hitboxes": [
					{
						"width": 2,
						"height": 1,
						"pivot": [
							0,
							1.5,
							0
						]
					}
				]
			},
			"minecraft:type_family": {
				"family": [
					"inanimate"
				]
			},
			"minecraft:physics": {}
		},
		"events": {
			"minecraft:entity_spawned": {
				"sequence": [
					{
						"add": {
							"component_groups": [
								"shapescape_mb:can_interact",
								"shapescape_mb:player_is_futher_away"
							]
						}
					},
					{
						"queue_command": {
							"command": [
								"titleraw @a[r=5] actionbar {\"rawtext\":[{\"translate\":\"shapescape_mb.actionbar.guide_book.hint_on_spawn\", \"with\": [\"\\n\"]}]}"
							]
						}
					}
				]
			},
			"shapescape_mb:player_is_near": {
				"remove": {
					"component_groups": [
						"shapescape_mb:player_is_futher_away"
					]
				},
				"add": {
					"component_groups": [
						"shapescape_mb:player_is_near"
					]
				},
				"queue_command": {
					"command": [
						"titleraw @a[r=5] actionbar {\"rawtext\":[{\"translate\":\"shapescape_mb.actionbar.guide_book.hint_on_spawn\", \"with\": [\"\\n\"]}]}"
					]
				}
			},
			"shapescape_mb:player_is_futher_away": {
				"remove": {
					"component_groups": [
						"shapescape_mb:player_is_near"
					]
				},
				"add": {
					"component_groups": [
						"shapescape_mb:player_is_futher_away"
					]
				}
			},
			"shapescape_mb:on_interact": {
				"queue_command": {
					"command": [
						"scriptevent shapescape_mb:guide_book_interaction"
					]
				}
			},
			"shapescape_mb:drop_self": {
				"sequence": [
					{
						"remove": {
							"component_groups": [
								"shapescape_mb:can_interact"
							]
						}
					},
					{
						"queue_command": {
							"command": [
								"loot spawn ~ ~1 ~ loot \"shapescape/mb/guide_book\"",
								"event entity @s shapescape_mb:despawn"
							]
						}
					}
				]
			},
			"shapescape_mb:despawn": {
				"add": {
					"component_groups": [
						"shapescape_mb:despawn"
					]
				}
			},
			"shapescape_mb:set_property_active_texture_0": {
				"set_property": {
					"shapescape_mb:active_texture": 0
				}
			},
			"shapescape_mb:set_property_active_texture_1": {
				"set_property": {
					"shapescape_mb:active_texture": 1
				}
			},
			"shapescape_mb:set_property_active_texture_2": {
				"set_property": {
					"shapescape_mb:active_texture": 2
				}
			},
			"shapescape_mb:set_property_active_texture_3": {
				"set_property": {
					"shapescape_mb:active_texture": 3
				}
			},
			"shapescape_mb:set_property_active_texture_4": {
				"set_property": {
					"shapescape_mb:active_texture": 4
				}
			},
			"shapescape_mb:set_property_active_texture_5": {
				"set_property": {
					"shapescape_mb:active_texture": 5
				}
			},
			"shapescape_mb:set_property_active_texture_6": {
				"set_property": {
					"shapescape_mb:active_texture": 6
				}
			},
			"shapescape_mb:set_property_active_texture_7": {
				"set_property": {
					"shapescape_mb:active_texture": 7
				}
			},
			"shapescape_mb:set_property_active_texture_8": {
				"set_property": {
					"shapescape_mb:active_texture": 8
				}
			},
			"shapescape_mb:set_property_active_texture_9": {
				"set_property": {
					"shapescape_mb:active_texture": 9
				}
			},
			"shapescape_mb:set_property_active_texture_10": {
				"set_property": {
					"shapescape_mb:active_texture": 10
				}
			}
		}
	}
}