Add blocks added with 1.6, DRY up color variation setting
This commit is contained in:
parent
9ee6e229f0
commit
d25a91e37b
5 changed files with 115 additions and 90 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,4 +4,5 @@ target
|
||||||
*.js#
|
*.js#
|
||||||
*.iml
|
*.iml
|
||||||
*.idea
|
*.idea
|
||||||
|
.DS_Store
|
||||||
build.local.properties
|
build.local.properties
|
||||||
|
|
101
docs/api.md
101
docs/api.md
|
@ -349,12 +349,12 @@ Example
|
||||||
-------
|
-------
|
||||||
To create a black structure 4 blocks wide, 9 blocks tall and 1 block long...
|
To create a black structure 4 blocks wide, 9 blocks tall and 1 block long...
|
||||||
|
|
||||||
box(blocks.black, 4, 9, 1);
|
box(blocks.wool.black, 4, 9, 1);
|
||||||
|
|
||||||
... or the following code does the same but creates a variable that can be used for further methods...
|
... or the following code does the same but creates a variable that can be used for further methods...
|
||||||
|
|
||||||
var drone = new Drone();
|
var drone = new Drone();
|
||||||
drone.box(blocks.black, 4, 9, 1);
|
drone.box(blocks.wool.black, 4, 9, 1);
|
||||||
|
|
||||||
![box example 1](img/boxex1.png)
|
![box example 1](img/boxex1.png)
|
||||||
|
|
||||||
|
@ -395,8 +395,8 @@ Example
|
||||||
-------
|
-------
|
||||||
Construct a rainbow-colored road 100 blocks long...
|
Construct a rainbow-colored road 100 blocks long...
|
||||||
|
|
||||||
var rainbowColors = [blocks.red, blocks.orange, blocks.yellow, blocks.lime,
|
var rainbowColors = [blocks.wool.red, blocks.wool.orange, blocks.wool.yellow, blocks.wool.lime,
|
||||||
blocks.lightblue, blocks.blue, blocks.purple];
|
blocks.wool.lightblue, blocks.wool.blue, blocks.wool.purple];
|
||||||
|
|
||||||
boxa(rainbowColors,7,1,30);
|
boxa(rainbowColors,7,1,30);
|
||||||
|
|
||||||
|
@ -920,6 +920,23 @@ To create a 2-line high message using glowstone...
|
||||||
|
|
||||||
[imgbt1]: img/blocktype1.png
|
[imgbt1]: img/blocktype1.png
|
||||||
|
|
||||||
|
Drone.rainbow() method
|
||||||
|
======================
|
||||||
|
Creates a Rainbow.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
|
||||||
|
* radius (optional - default:18) - The radius of the rainbow
|
||||||
|
|
||||||
|
Example
|
||||||
|
-------
|
||||||
|
|
||||||
|
var d = new Drone();
|
||||||
|
d.rainbow(30);
|
||||||
|
|
||||||
|
![rainbow example](img/rainbowex1.png)
|
||||||
|
|
||||||
Blocks Module
|
Blocks Module
|
||||||
=============
|
=============
|
||||||
You hate having to lookup [Data Values][dv] when you use ScriptCraft's Drone() functions. So do I.
|
You hate having to lookup [Data Values][dv] when you use ScriptCraft's Drone() functions. So do I.
|
||||||
|
@ -932,8 +949,35 @@ Examples
|
||||||
box( blocks.sand, 3, 2, 1 ); // creates a block of sand 3 wide x 2 high x 1 long
|
box( blocks.sand, 3, 2, 1 ); // creates a block of sand 3 wide x 2 high x 1 long
|
||||||
box( blocks.wool.green, 2 ); // creates a block of green wool 2 blocks wide
|
box( blocks.wool.green, 2 ); // creates a block of green wool 2 blocks wide
|
||||||
|
|
||||||
In addition, each of the wool colors is also available as a block property so you can use either
|
In addition, there's a convenience array `blocks.rainbow` which is an array of the 7 colors of the rainbow (or closest approximations).
|
||||||
`blocks.wool.green` or the more concise `blocks.green`. There's also a convenience array `blocks.rainbow` which is an array of the 7 colors of the rainbow (or closest approximations).
|
|
||||||
|
Drone.spiral_stairs() method
|
||||||
|
============================
|
||||||
|
Constructs a spiral staircase with slabs at each corner.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
|
||||||
|
* stairBlock - The block to use for stairs, should be one of the following...
|
||||||
|
- 'oak'
|
||||||
|
- 'spruce'
|
||||||
|
- 'birch'
|
||||||
|
- 'jungle'
|
||||||
|
- 'cobblestone'
|
||||||
|
- 'brick'
|
||||||
|
- 'stone'
|
||||||
|
- 'nether'
|
||||||
|
- 'sandstone'
|
||||||
|
- 'quartz'
|
||||||
|
* flights - The number of flights of stairs to build.
|
||||||
|
|
||||||
|
![Spiral Staircase](img/spiralstair1.png)
|
||||||
|
|
||||||
|
Example
|
||||||
|
-------
|
||||||
|
To construct a spiral staircase 5 floors high made of oak...
|
||||||
|
|
||||||
|
spiral_stairs('oak', 5);
|
||||||
|
|
||||||
Drone.sphere() method
|
Drone.sphere() method
|
||||||
=====================
|
=====================
|
||||||
|
@ -1013,51 +1057,6 @@ To create a glass 'north' hemisphere with a radius of 20 blocks...
|
||||||
|
|
||||||
![hemisphere example](img/hemisphereex2.png)
|
![hemisphere example](img/hemisphereex2.png)
|
||||||
|
|
||||||
Drone.rainbow() method
|
|
||||||
======================
|
|
||||||
Creates a Rainbow.
|
|
||||||
|
|
||||||
Parameters
|
|
||||||
----------
|
|
||||||
|
|
||||||
* radius (optional - default:18) - The radius of the rainbow
|
|
||||||
|
|
||||||
Example
|
|
||||||
-------
|
|
||||||
|
|
||||||
var d = new Drone();
|
|
||||||
d.rainbow(30);
|
|
||||||
|
|
||||||
![rainbow example](img/rainbowex1.png)
|
|
||||||
|
|
||||||
Drone.spiral_stairs() method
|
|
||||||
============================
|
|
||||||
Constructs a spiral staircase with slabs at each corner.
|
|
||||||
|
|
||||||
Parameters
|
|
||||||
----------
|
|
||||||
|
|
||||||
* stairBlock - The block to use for stairs, should be one of the following...
|
|
||||||
- 'oak'
|
|
||||||
- 'spruce'
|
|
||||||
- 'birch'
|
|
||||||
- 'jungle'
|
|
||||||
- 'cobblestone'
|
|
||||||
- 'brick'
|
|
||||||
- 'stone'
|
|
||||||
- 'nether'
|
|
||||||
- 'sandstone'
|
|
||||||
- 'quartz'
|
|
||||||
* flights - The number of flights of stairs to build.
|
|
||||||
|
|
||||||
![Spiral Staircase](img/spiralstair1.png)
|
|
||||||
|
|
||||||
Example
|
|
||||||
-------
|
|
||||||
To construct a spiral staircase 5 floors high made of oak...
|
|
||||||
|
|
||||||
spiral_stairs('oak', 5);
|
|
||||||
|
|
||||||
Classroom Module
|
Classroom Module
|
||||||
================
|
================
|
||||||
The `classroom` object contains a couple of utility functions for use
|
The `classroom` object contains a couple of utility functions for use
|
||||||
|
|
|
@ -11,8 +11,7 @@ Examples
|
||||||
box( blocks.sand, 3, 2, 1 ); // creates a block of sand 3 wide x 2 high x 1 long
|
box( blocks.sand, 3, 2, 1 ); // creates a block of sand 3 wide x 2 high x 1 long
|
||||||
box( blocks.wool.green, 2 ); // creates a block of green wool 2 blocks wide
|
box( blocks.wool.green, 2 ); // creates a block of green wool 2 blocks wide
|
||||||
|
|
||||||
In addition, each of the wool colors is also available as a block property so you can use either
|
Color aliased properties that were a direct descendant of the blocks object are no longer used to avoid confusion with carpet and stained clay blocks. In addition, there's a convenience array `blocks.rainbow` which is an array of the 7 colors of the rainbow (or closest approximations).
|
||||||
`blocks.wool.green` or the more concise `blocks.green`. There's also a convenience array `blocks.rainbow` which is an array of the 7 colors of the rainbow (or closest approximations).
|
|
||||||
|
|
||||||
***/
|
***/
|
||||||
var blocks = {
|
var blocks = {
|
||||||
|
@ -60,22 +59,7 @@ var blocks = {
|
||||||
piston: 33,
|
piston: 33,
|
||||||
piston_extn: 34,
|
piston_extn: 34,
|
||||||
wool: {
|
wool: {
|
||||||
white: 35,
|
white: 35 // All other colors added below
|
||||||
orange: '35:1',
|
|
||||||
magenta: '35:2',
|
|
||||||
lightblue: '35:3',
|
|
||||||
yellow: '35:4',
|
|
||||||
lime: '35:5',
|
|
||||||
pink: '35:6',
|
|
||||||
gray: '35:7',
|
|
||||||
lightgray: '35:8',
|
|
||||||
cyan: '35:9',
|
|
||||||
purple: '35:10',
|
|
||||||
blue: '35:11',
|
|
||||||
brown: '35:12',
|
|
||||||
green: '35:13',
|
|
||||||
red: '35:14',
|
|
||||||
black: '35:15'
|
|
||||||
},
|
},
|
||||||
dandelion: 37,
|
dandelion: 37,
|
||||||
flower_yellow: 37,
|
flower_yellow: 37,
|
||||||
|
@ -165,7 +149,7 @@ var blocks = {
|
||||||
mycelium: 110,
|
mycelium: 110,
|
||||||
lily_pad: 111,
|
lily_pad: 111,
|
||||||
nether: 112,
|
nether: 112,
|
||||||
neter_fence: 113,
|
nether_fence: 113,
|
||||||
netherwart: 115,
|
netherwart: 115,
|
||||||
table_enchantment: 116,
|
table_enchantment: 116,
|
||||||
brewing_stand: 117,
|
brewing_stand: 117,
|
||||||
|
@ -231,19 +215,60 @@ var blocks = {
|
||||||
hopper: 154,
|
hopper: 154,
|
||||||
quartz: 155,
|
quartz: 155,
|
||||||
rail_activator: 157,
|
rail_activator: 157,
|
||||||
dropper: 158
|
dropper: 158,
|
||||||
|
stained_clay: {
|
||||||
|
white: 159 // All other colors added below
|
||||||
|
},
|
||||||
|
hay: 170,
|
||||||
|
carpet: {
|
||||||
|
white: 171 // All other colors added below
|
||||||
|
},
|
||||||
|
hardened_clay: 172,
|
||||||
|
coal_block: 173
|
||||||
};
|
};
|
||||||
// make colors top level for convenience
|
|
||||||
for (var c in blocks.wool){
|
(function() {
|
||||||
blocks[c] = blocks.wool[c];
|
// Add all available colors to colorized block collections
|
||||||
}
|
|
||||||
/*
|
var colors = {
|
||||||
|
orange: ':1',
|
||||||
|
magenta: ':2',
|
||||||
|
lightblue: ':3',
|
||||||
|
yellow: ':4',
|
||||||
|
lime: ':5',
|
||||||
|
pink: ':6',
|
||||||
|
gray: ':7',
|
||||||
|
lightgray: ':8',
|
||||||
|
cyan: ':9',
|
||||||
|
purple: ':10',
|
||||||
|
blue: ':11',
|
||||||
|
brown: ':12',
|
||||||
|
green: ':13',
|
||||||
|
red: ':14',
|
||||||
|
black: ':15'
|
||||||
|
};
|
||||||
|
var colorized_blocks = ["wool", "stained_clay", "carpet"];
|
||||||
|
|
||||||
|
for (var i = 0, len = colorized_blocks.length; i < len; i++) {
|
||||||
|
var block = colorized_blocks[i],
|
||||||
|
data_value = blocks[block].white;
|
||||||
|
|
||||||
|
for (var color in colors) {
|
||||||
|
blocks[block][color] = data_value + colors[color];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
rainbow colors - a convenience
|
rainbow colors - a convenience
|
||||||
*/
|
Color aliased properties that were a direct descendant of the blocks
|
||||||
blocks.rainbow = [blocks.red,
|
object are no longer used to avoid confusion with carpet and stained
|
||||||
blocks.orange,
|
clay blocks.
|
||||||
blocks.yellow,
|
*/
|
||||||
blocks.lime,
|
blocks.rainbow = [blocks.wool.red,
|
||||||
blocks.lightblue,
|
blocks.wool.orange,
|
||||||
blocks.blue,
|
blocks.wool.yellow,
|
||||||
blocks.purple];
|
blocks.wool.lime,
|
||||||
|
blocks.wool.lightblue,
|
||||||
|
blocks.wool.blue,
|
||||||
|
blocks.wool.purple];
|
||||||
|
})();
|
||||||
|
|
|
@ -332,7 +332,7 @@ To create a 2-line high message using glowstone...
|
||||||
this.chkpt('blocktext');
|
this.chkpt('blocktext');
|
||||||
|
|
||||||
if (typeof fg == "undefined")
|
if (typeof fg == "undefined")
|
||||||
fg = blocks.black;
|
fg = blocks.wool.black;
|
||||||
|
|
||||||
var bmfg = this._getBlockIdAndMeta(fg);
|
var bmfg = this._getBlockIdAndMeta(fg);
|
||||||
var bmbg = null;
|
var bmbg = null;
|
||||||
|
|
|
@ -122,12 +122,12 @@ Example
|
||||||
-------
|
-------
|
||||||
To create a black structure 4 blocks wide, 9 blocks tall and 1 block long...
|
To create a black structure 4 blocks wide, 9 blocks tall and 1 block long...
|
||||||
|
|
||||||
box(blocks.black, 4, 9, 1);
|
box(blocks.wool.black, 4, 9, 1);
|
||||||
|
|
||||||
... or the following code does the same but creates a variable that can be used for further methods...
|
... or the following code does the same but creates a variable that can be used for further methods...
|
||||||
|
|
||||||
var drone = new Drone();
|
var drone = new Drone();
|
||||||
drone.box(blocks.black, 4, 9, 1);
|
drone.box(blocks.wool.black, 4, 9, 1);
|
||||||
|
|
||||||
![box example 1](img/boxex1.png)
|
![box example 1](img/boxex1.png)
|
||||||
|
|
||||||
|
@ -168,8 +168,8 @@ Example
|
||||||
-------
|
-------
|
||||||
Construct a rainbow-colored road 100 blocks long...
|
Construct a rainbow-colored road 100 blocks long...
|
||||||
|
|
||||||
var rainbowColors = [blocks.red, blocks.orange, blocks.yellow, blocks.lime,
|
var rainbowColors = [blocks.wool.red, blocks.wool.orange, blocks.wool.yellow, blocks.wool.lime,
|
||||||
blocks.lightblue, blocks.blue, blocks.purple];
|
blocks.wool.lightblue, blocks.wool.blue, blocks.wool.purple];
|
||||||
|
|
||||||
boxa(rainbowColors,7,1,30);
|
boxa(rainbowColors,7,1,30);
|
||||||
|
|
||||||
|
|
Reference in a new issue