added hemispheres and blocks ids

This commit is contained in:
walterhiggins 2013-02-01 22:14:53 +00:00
parent 63712518dc
commit 4a586a115c
2 changed files with 243 additions and 0 deletions

View file

@ -0,0 +1,186 @@
var blocks = {
air: 0,
stone: 1,
grass: 2,
dirt: 3,
cobblestone: 4,
oak: 5,
spruce: '5:1',
birch: '5:2',
jungle: '5:3',
sapling: 6,
bedrock: 7,
water: 8,
water_still: 9,
lava: 10,
lava_still: 11,
sand: 12,
gravel: 13,
gold_ore: 14,
iron_ore: 15,
coal_ore: 16,
wood: 17,
leaves: 18,
sponge: 19,
glass: 20,
lapis_lazuli_ore: 21,
lapis_lazuli_block: 22,
dispenser: 23,
sandstone: 24,
note: 25,
bed: 26,
powered_rail: 27,
detector_rail: 28,
sticky_piston: 29,
cobweb: 30,
grass_tall: 31,
dead_bush: 32,
piston: 33,
piston_extn: 34,
white: 35, // white is white wool
black: '35:15',
wool: {
white: 35,
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,
flower_yellow: 37,
rose: 38,
flower_red: 38,
mushroom_brown: 39,
mushroom_red: 40,
gold: 41,
iron: 42,
slab: 44,
brick: 45,
redbrick: 45,
tnt: 46,
bookshelf: 47,
moss_stone: 48,
obsidian: 49,
torch: 50,
fire: 51,
monster_spawner: 52,
stairs_wood: 53,
chest: 54,
redstone_wire: 55,
diamond_ore: 56,
diamond: 57,
crafting_table: 58,
wheat_seeds: 59,
farmland: 60,
furnace: 61,
furnace_burning: 62,
sign_post: 63,
door_wood: 64,
ladder: 65,
rail: 66,
stairs_cobblestone: 67,
sign: 68,
lever: 69,
pressure_plate_stone: 70,
door_iron: 71,
pressure_plate_wood: 72,
redstone_ore: 73,
redstone_ore_glowing: 74,
torch_redstone: 75,
torch_redstone_active: 76,
stone_button: 77,
slab_snow: 78,
ice: 79,
snow: 80,
cactus: 81,
clay: 82,
sugar_cane: 83,
jukebox: 84,
fence: 85,
pumpkin: 86,
netherrack: 87,
soulsand: 88,
glowstone: 89,
netherportal: 90,
jackolantern: 91,
cake: 92,
redstone_repeater: 93,
redeston_repeater_active: 94,
chest_locked: 95,
trapdoor: 96,
monster_egg: 97,
stone_brick: 98,
stone_brick_mossy: '98:1',
stone_brick_cracked: '98:2',
stone_brick_chiseled: '98:3',
mushroom_brown_huge: 99,
mushroom_red_huge: 100,
iron_bars: 101,
glass_pane: 102,
melon: 103,
pumpkin_stem: 104,
melon_stem: 105,
vines: 106,
fence_gate: 107,
stairs_brick: 108,
stairs_stone: 109,
mycelium: 110,
lily_pad: 111,
nether: 112,
neter_fence: 113,
stairs_nether: 114,
netherwart: 115,
table_enchantment: 116,
brewing_stand: 117,
cauldron: 118,
endportal: 119,
endportal_frame: 120,
endstone: 121,
dragon_egg: 122,
redstone_lamp: 123,
redstone_lamp_active: 124,
slab_wood: 126,
cocoa: 127,
stairs_sandstone: 128,
emerald_ore: 129,
enderchest: 130,
tripwire_hook: 131,
tripwire: 132,
emerald: 133,
stairs_wood_spruce: 134,
stairs_wood_birch: 135,
stairs_wood_jungle: 136,
command: 137,
beacon: 138,
cobblestone_wall: 139,
flowerpot: 140,
carrots: 141,
potatoes: 142,
button_wood: 143,
mobhead: 144,
anvil: 145,
chest_trapped: 146,
pressure_plate_weighted_light: 147,
pressure_plate_weighted_heavy: 148,
redstone_comparator: 149,
redstone_comparator_active: 150,
daylight_sensor: 151,
redstone: 152,
netherquartzore: 153,
hopper: 154,
quartz: 155,
stairs_quartz: 156,
rail_activator: 157,
dropper: 158
};

View file

@ -56,3 +56,60 @@ Drone.extend('sphere0', function(block,radius)
.sphere(0,radius-1) .sphere(0,radius-1)
.back().left().down(); .back().left().down();
}); });
Drone.extend('hemisphere', function(block,radius, northSouth){
var lastRadius = radius;
var slices = [[radius,0]];
var diameter = radius*2;
var world = this._getWorld();
var bm = this._getBlockIdAndMeta(block);
var r2 = radius*radius;
for (var i = 0; i <= radius;i++){
var newRadius = Math.round(Math.sqrt(r2 - i*i));
if (newRadius == lastRadius)
slices[slices.length-1][1]++;
else
slices.push([newRadius,1]);
lastRadius = newRadius;
}
this.chkpt('hsphere');
//
// mid section
//
if (northSouth == "north"){
this.cylinder(block,radius,slices[0][1],{blockType: bm[0],meta: bm[1],world: world});
} else {
this.up(radius - slices[0][1])
.cylinder(block,radius,slices[0][1],{blockType: bm[0],meta: bm[1],world: world})
.down(radius - slices[0][1]);
}
var yOffset = -1;
for (var i = 1; i < slices.length;i++)
{
yOffset += slices[i-1][1];
var sr = slices[i][0];
var sh = slices[i][1];
var v = yOffset, h = radius-sr;
if (northSouth == "north") {
// northern hemisphere
this.up(v).fwd(h).right(h)
.cylinder(block,sr,sh,{blockType: bm[0],meta: bm[1],world: world})
.left(h).back(h).down(v);
}else{
// southern hemisphere
v = radius - (yOffset+sh+1);
this.up(v).fwd(h).right(h)
.cylinder(block,sr,sh,{blockType: bm[0],meta: bm[1],world: world})
.left(h).back(h). down(v);
}
}
return this.move('hsphere');
});
Drone.extend('hemisphere0', function(block,radius,northSouth){
return this.hemisphere(block,radius,northSouth)
.fwd().right().up(northSouth=="north"?0:1)
.hemisphere(0,radius-1,northSouth)
.back().left().down(northSouth=="north"?0:1);
});