Skip to content

Commit 734e058

Browse files
committed
adding block-colors module
1 parent 4a2ea3c commit 734e058

3 files changed

Lines changed: 29 additions & 19 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
var colors = {
2+
white: 0,
3+
orange: 1,
4+
magenta: 2,
5+
lightblue: 3,
6+
yellow: 4,
7+
lime: 5,
8+
pink: 6,
9+
gray: 7,
10+
lightgray: 8,
11+
cyan: 9,
12+
purple: 10,
13+
blue: 11,
14+
brown: 12,
15+
green: 13,
16+
red: 14,
17+
black: 15
18+
};
19+
module.exports = colors;

src/main/js/modules/blockhelper.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,15 @@ function applyFacing( block, metadata ){
128128
function applyColors( block, metadata ){
129129
switch( block.typeId){
130130
case blocks.wool.white:
131+
case 35:
131132
case blocks.stained_clay.white:
133+
case 159:
132134
case blocks.stained_glass.white:
135+
case 95:
133136
case blocks.stained_glass_pane.white:
137+
case 160:
134138
case blocks.carpet.white:
139+
case 171:
135140
property(block).set('color',metadata);
136141
}
137142
}

src/main/js/modules/blocks.js

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ approximations).
2020
The blocks module is globally exported by the Drone module.
2121
2222
***/
23+
var colors = require('./block-colors');
24+
2325
var blocks = {
2426
air: 0,
2527
stone: 1,
@@ -291,23 +293,6 @@ var blocks = {
291293

292294
// Add all available colors to colorized block collections
293295

294-
var colors = {
295-
orange: ':1',
296-
magenta: ':2',
297-
lightblue: ':3',
298-
yellow: ':4',
299-
lime: ':5',
300-
pink: ':6',
301-
gray: ':7',
302-
lightgray: ':8',
303-
cyan: ':9',
304-
purple: ':10',
305-
blue: ':11',
306-
brown: ':12',
307-
green: ':13',
308-
red: ':14',
309-
black: ':15'
310-
};
311296
var colorized_blocks = [
312297
'wool',
313298
'stained_clay',
@@ -321,7 +306,7 @@ for (var i = 0, len = colorized_blocks.length; i < len; i++) {
321306
data_value = blocks[block].white;
322307

323308
for (var color in colors) {
324-
blocks[block][color] = data_value + colors[color];
309+
blocks[block][color] = data_value + ':' + colors[color];
325310
}
326311
};
327312

@@ -338,6 +323,7 @@ blocks.rainbow = [
338323
blocks.stained_glass.lime,
339324
blocks.stained_glass.lightblue,
340325
blocks.stained_glass.blue,
341-
blocks.stained_glass.purple];
326+
blocks.stained_glass.purple
327+
];
342328

343329
module.exports = blocks;

0 commit comments

Comments
 (0)