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 pathEnergyCondenser_tombailey94.js
85 lines (78 loc) · 1.77 KB
/
EnergyCondenser_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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// EngergyCondenser by TomBailey94; a recreation of the energy condenser from Equivalent Exchange (version 2 not 3) with reference to http://tekkitclassic.wikia.com/wiki/Energy_Condenser
// version 0.0.1; not finished yet
var itemToDispense = 0;
var ecx;
var ecy;
var ecz;
var cx;
var cy;
var cz;
var EC = 28;
var counter = 0;
function procCmd(command) {
if (command == "ec") {
Level.dropItem(getPlayerX(), getPlayerY(), getPlayerZ(), 5, EC, 1, 0);
}
}
function newLevel() {
Block.defineBlock(EC, "Energy Condenser", ["coal_block", 0], 1, false, 0);
Block.setDestroyTime(EC, 0.3);
Block.setExplosionResistance(EC, 9001); //it's over 9000!
}
function useItem(x, y, z, itemId, blockId, side) {
if (blockId == 54) { //if the block is a chest
itemToDispense = Level.getChestSlot(x,y,z,1);
if (Level.getTile(x+1,y,z+1) == EC) {
if (itemToDispense != 0) {
ecx = x+1;
ecy = y;
ecz = z+1;
cx = x;
cy = y;
cz = z;
}
} else if (Level.getTile(x+1,y,z-1) == EC) {
if (itemToDispense != 0) {
ecx = x+1;
ecy = y;
ecz = z-1;
cx = x;
cy = y;
cz = z;
}
} else if (Level.getTile(x-1,y,z+1) == EC) {
if (itemToDispense != 0) {
ecx = x-1;
ecy = y;
ecz = z+1;
cx = x;
cy = y;
cz = z;
}
} else if (Level.getTile(x-1,y,z-1) == EC) {
if (itemToDispense != 0) {
ecx = x-1;
ecy = y;
ecz = z-1;
cx = x;
cy = y;
cz = z;
}
}
}
}
function modTick() {
counter++;
if (counter == 20) { //every second
if (itemToDispense != 0) {
//Level.dropItem(ecx, ecy, ecz, 5, itemToDispense, 1, 0);
for (var i = 1; i < 28; i++) {
if (Level.getChestSlotCount(cx,cy,cz) != 64) {
Level.setChestSlot(ecx,ecy,ecz,2,EC,0,1); //add an item to the chest
break;
}
}
}
counter = 0;
}
}