How to Make a World Border in Minecraft Bedrock | MCBE Add-on Tutorial

< Back to "Videos, Tutorials, & Assets"

This page is a WIP. You can download the example pack hereopen in new window.

Code

Place this after "is_summonable": false of the player.json file in the entities folder:

,
"scripts": {
	"animate": [
		"world_border"
	]
},
"animations": {
	"world_border": "controller.animation.world_border"
}
1
2
3
4
5
6
7
8
9

Place this inside the world_border.json file in the animation_controllers folder:

{
	"format_version": "1.10.0",
	"animation_controllers": {
		"controller.animation.world_border": {
			"initial_state": "default",
			"states": {
				"default": {
					"transitions": [
						{
							"px": "query.position(0) > 10"
						},
						{
							"nx": "query.position(0) < -10"
						},
						{
							"pz": "query.position(2) > 10"
						},
						{
							"nz": "query.position(2) < -10"
						}
					]
				},
				"px": {
					"transitions": [
						{
							"default": "1.0"
						}
					],
					"on_entry": [
						"/tp @s 9 ~~",
						"/tellraw @s {\"rawtext\":[{\"text\":\"You're out of the border!\"}]}"
					]
				},
				"nx": {
					"transitions": [
						{
							"default": "1.0"
						}
					],
					"on_entry": [
						"/tp @s -9 ~~",
						"/tellraw @s {\"rawtext\":[{\"text\":\"You're out of the border!\"}]}"
					]
				},
				"pz": {
					"transitions": [
						{
							"default": "1.0"
						}
					],
					"on_entry": [
						"/tp @s ~~ 9",
						"/tellraw @s {\"rawtext\":[{\"text\":\"You're out of the border!\"}]}"
					]
				},
				"nz": {
					"transitions": [
						{
							"default": "1.0"
						}
					],
					"on_entry": [
						"/tp @s ~~ -9",
						"/tellraw @s {\"rawtext\":[{\"text\":\"You're out of the border!\"}]}"
					]
				}
			}
		}
	}
}
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70