This repository has been archived by the owner on Jan 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 710
/
Copy pathMidasTouch_tombailey94.js
66 lines (51 loc) · 2.15 KB
/
MidasTouch_tombailey94.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
// MidasTouch mod by tombailey94
// version 0.0.1
var blockId = 41;
function procCmd(command) {
command = command.split(" ");
if (command[0] == "midas") {
blockId = command[1];
}
clientMessage("Warning: all blocks you touch or walk near will turn to the block with ID " + blockId + "!");
}
function newLevel() {
clientMessage("Warning: all blocks you touch or walk near will turn to gold!");
}
function modTick() {
var playerX = getPlayerX();
var playerY = getPlayerY();
var playerZ = getPlayerZ();
if (getTile(playerX,playerY+1,playerZ)!=0) { //if the block above the player's head is not air
setTile(playerX,playerY+1,playerZ,blockId,0);
}
if (getTile(playerX,playerY-2,playerZ)!=0) { //if the block below the player's legs is not air
setTile(playerX,playerY-2,playerZ,blockId,0);
}
if (getTile(playerX,playerY-1,playerZ+1)!=0) { //if the block to the side of the player's legs is not air
setTile(playerX,playerY-1,playerZ+1,blockId,0);
}
if (getTile(playerX,playerY-1,playerZ-1)!=0) { //if the block to the other side of the player's legs is not air
setTile(playerX,playerY-1,playerZ-1,blockId,0);
}
if (getTile(playerX,playerY,playerZ+1)!=0) { //if the block to the side of the player's head is not air
setTile(playerX,playerY,playerZ+1,blockId,0);
}
if (getTile(playerX,playerY,playerZ-1)!=0) { //if the block to the other side of the player's head is not air
setTile(playerX,playerY,playerZ-1,blockId,0);
}
if (getTile(playerX+1,playerY-1,playerZ)!=0) { //if the block to the side of the player's legs is not air
setTile(playerX+1,playerY-1,playerZ,blockId,0);
}
if (getTile(playerX-1,playerY-1,playerZ)!=0) { //if the block to the other side of the player's legs is not air
setTile(playerX-1,playerY-1,playerZ,blockId,0);
}
if (getTile(playerX+1,playerY,playerZ)!=0) { //if the block to the side of the player's head is not air
setTile(playerX+1,playerY,playerZ,blockId,0);
}
if (getTile(playerX-1,playerY,playerZ)!=0) { //if the block to the other side of the player's head is not air
setTile(playerX-1,playerY,playerZ,blockId,0);
}
}
function useItem(x,y,z,itemId,blockId,side) {
setTile(x,y,z,blockId,0);
}