-
Notifications
You must be signed in to change notification settings - Fork 0
/
mobs.js
66 lines (66 loc) · 1.42 KB
/
mobs.js
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
dragonblocks.registerEntity({
name: "mobs:ball",
desc: "Ball",
texture: "mobs_ball.png",
width: 0.75,
height: 0.75,
verticalSpeed: 10,
gravity: true,
onpunch: self => {
self.despawn();
},
onclick: self => {
self.jumpOnce();
},
});
mobs.registerSpawner("mobs:ball");
dragonblocks.registerEntity({
name: "mobs:bubble",
desc: "Bubble",
texture: "mobs_bubble.png",
width: 0.5,
height: 0.5,
verticalSpeed: 1,
gravity: false,
onpunch: self => {
self.despawn();
},
oncollide: self => {
self.despawn();
},
oninit: self => {
self.horizontalSpeed = dblib.random(0, 10) / 10;
self.moveUp();
dblib.random(0, 1) == 0 ? self.moveRight() : self.moveLeft();
},
onspawn: self => {
dragonblocks.setTimer("burstTimer", dblib.random(10, 40) / 10, _ => {self.despawn()}, self.meta);
}
});
mobs.registerSpawner("mobs:bubble");
dragonblocks.registerEntity({
name: "mobs:snowball",
desc: "Snowball",
texture: "mobs_snowball.png",
width: 1,
height: 1,
horizontalSpeed: 1,
verticalSpeed: 1,
gravity: true,
oncollide: self => {
self.despawn();
},
oninit: self => {
self.horizontalSpeed = (self.x - dragonblocks.player.x) * 5;
self.verticalSpeed = (self.y - dragonblocks.player.y) * 5;
self.x = dragonblocks.player.x;
self.y = dragonblocks.player.y;
self.moveDown();
self.moveRight();
},
});
mobs.registerSpawner("mobs:snowball");
dragonblocks.registerRecipe({
result: "mobs:snowball 4",
recipe: [["core:snow"]],
});