-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHammer v0.5.js
139 lines (128 loc) · 4.84 KB
/
Hammer v0.5.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//Mod By Darkserver follow me on Twitter @pierce_manasseh
var defaultDestroyTime = [ null, 1.5, 0.6, 0.5, 2, 2, 0, -1, null, null, null /*10*/, null, 0.5, 0.6, 3, 3, 3, 2, 0.2, 0.6, 0.3/*20*/, 3, 3, 10, 0.8, null, 0.2, 0.7, null, null, 4/*30*/, 0, 0, 1, 1.5, 0.8, null, 0, 0, 0, 0 /*40*/, 3, 5, 2, 2, 2, 0, 1.5, 2, 50, 0 /*50*/, 0, 5, 2, 2.5, null, 3, 5, 2.5, 0, 0.6/*60*/, 3.5, 3.5, 1, 3, 0.4, 0.7, 2, 1, null, null/*70*/, 5, null, 3, 3, null, null, null, 0.1, 0.5, 0.2 /*80*/, 0.4, 0.6, 0, null, 2, 1, 0.5, 0.3, null, 1 /*90*/, 0.5, null, null, -1, 3, null, 0.75, 1.5, 0.2, 0.2 /*100*/, 0.3, 1, 1, 0, null, 0.2, 2, 1.5, null, 0.6 /*110*/, 0, null, 2, null, null, null, null, null, null, -1 /*120*/, 3, null, null, null, null, null, 0.2, null, 3, null /*130*/, null, null, 5, 2, 2, 2, null, 2,2 , 0 /*140*/, 0, null, null, null, null, null, null, null, null, null /*150*/, null, 0.4, 3, 0.8, 0.8, 2, 2, 2, 1.25, null /*160*/, 0.2, 2, 2, 2, null, null, null, null, 0.5, 0.1 /*170*/, 0.1, 1.25, 5, 0.5, 0, 1.5, 1.5, 1.5, 1.5, 2 /*180*/, 2, null, 1.5, 2, 0.5, 2, 0.6, 0.6, 0.5, 0.5 /*190*/, 0.5, 0.5, 0.2, 1, 2, 2, 2, 2, 2, null /*200*/, null, null, 1.5, 1.5, 1.5, 1.5, null, 2, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, 3.5, 50, 5, 0.6, 0.6, null, null, null, null, null, 0 ];
ModPE.setItem(390,"axe",4,"Hammer");
Item.setMaxDamage(390,251);
Item.addShapedRecipe(390,1,0,["iri","dpd","iri"],["i",42,0,"r",331,0,"d",264,0,"p",278,0]);
//Item.addCraftRecipe(390,1,0,[278,1,0,264,2,0,42,4,0]);
var stone = [1,2,3,4,5,6,12,13,14,15,16,17,19,21,22,24,41,42,43,44,45,48,49,56,57,67,73,74,87,89,98,101,108,109,112,114,128,139,155,156,173,247,33,34,152,153,174,175,176,177,178,179,188,190,191,192,193,194,195,196,197,198,199];
function destroyBlock(x, y, z, side) {
var data = Player.getCarriedItemData();
var count = Player.getCarriedItemCount();
var b0 = Level.getTile(x,y,z);
var b1 = Level.getTile(x-1,y,z);
var b2 = Level.getTile(x+1,y,z);
var b3 = Level.getTile(x-1,y-1,z);
var b4 = Level.getTile(x,y-1,z);
var b5 = Level.getTile(x+1,y-1,z);
var b6 = Level.getTile(x-1,y+1,z);
var b7 = Level.getTile(x,y+1,z);
var b8 = Level.getTile(x+1,y+1,z);
var b9 = Level.getTile(x,y,z);
var b10 = Level.getTile(x,y,z-1);
var b11 = Level.getTile(x,y,z+1);
var b12 = Level.getTile(x,y-1,z-1);
var b13 = Level.getTile(x,y-1,z);
var b14 = Level.getTile(x,y-1,z+1);
var b15 = Level.getTile(x,y+1,z-1);
var b16 = Level.getTile(x,y+1,z);
var b17 = Level.getTile(x,y+1,z+1);
var item = Player.getCarriedItem();
if (item == 390) {
data ++;
Entity.setCarriedItem(Player.getEntity(),parseInt(item),count,data);
if(data==251) {
Entity.setCarriedItem(Player.getEntity(),parseInt(0),0,0);
}
if(side === 0||side === 1) {
if (stone.indexOf(b9)>=0) {
Level.destroyBlock(x,y,z,true);
}
}
if(side === 4||side === 5) {
if (stone.indexOf(b9)>=0) {
Level.destroyBlock(x,y,z,true);
}
if (stone.indexOf(b10)>=0) {
Level.destroyBlock(x,y,z-1,true);
}
if (stone.indexOf(b11)>=0) {
Level.destroyBlock(x,y,z+1,true);
}
if (stone.indexOf(b12)>=0) {
Level.destroyBlock(x,y-1,z-1,true);
}
if (stone.indexOf(b13)>=0) {
Level.destroyBlock(x,y-1,z,true);
}
if (stone.indexOf(b14)>=0) {
Level.destroyBlock(x,y-1,z+1,true);
}
if (stone.indexOf(b15)>=0) {
Level.destroyBlock(x,y+1,z-1,true);
}
if (stone.indexOf(b16)>=0) {
Level.destroyBlock(x,y+1,z,true);
}
if (stone.indexOf(b17)>=0) {
Level.destroyBlock(x,y+1,z+1,true);
}
}
if (side == 2 || side == 3) {
if (stone.indexOf(b0)>=0) {
Level.destroyBlock(x,y,z,true);
}
if (stone.indexOf(b1)>=0) {
Level.destroyBlock(x-1,y,z,true);
}
if (stone.indexOf(b2)>=0) {
Level.destroyBlock(x+1,y,z,true);
}
if (stone.indexOf(b3)>=0) {
Level.destroyBlock(x-1,y-1,z,true);
}
if (stone.indexOf(b4)>=0) {
Level.destroyBlock(x,y-1,z,true);
}
if (stone.indexOf(b5)>=0) {
Level.destroyBlock(x+1,y-1,z,true);
}
if (stone.indexOf(b6)>=0) {
Level.destroyBlock(x-1,y+1,z,true);
}
if (stone.indexOf(b7)>=0) {
Level.destroyBlock(x,y+1,z,true);
}
if (stone.indexOf(b8)>=0) {
Level.destroyBlock(x+1,y+1,z,true);
}
}
}
}
var sb = false;
function fastDestroy() {
for(var i = 0; i < 256; i++) {
var S = 0.07;
var BT = defaultDestroyTime[i]*1.5;
var NT = BT*S;
Block.setDestroyTime(i, NT);
}
Block.setDestroyTime(120,-1);
Block.setDestroyTime(7,-1);
}
function defaultDestroy() {
for(var i = 0; i < 256; i++){
Block.setDestroyTime(i, defaultDestroyTime[i]);
}
}
function modTick() {
if(Player.getCarriedItem() == 390 && sb == false) {
fastDestroy();
sb = true;
}
if(Player.getCarriedItem() !== 390 && sb == true) {
defaultDestroy();
sb = false;
}
}
/*
*/