voxel / voxel-land

a terrain generator with grass, dirt, stone, and trees (addon for voxel-engine)
6 stars 2 forks source link

Move terrain blocks to separate plugin? (voxel-terrain-blocks? refactor with voxel-clientmc) #22

Open deathcap opened 8 years ago

deathcap commented 8 years ago

voxel-land generates chunks, but it also registers blocks:

    this.registry.registerBlock('grass', {texture: ['grass_top', 'dirt', 'grass_side'], hardness:1.0, itemDrop: 'dirt', effectiveTool: 'spade'});
    this.registry.registerBlock('dirt', {texture: 'dirt', hardness:0.75, effectiveTool: 'spade'});
    this.registry.registerBlock('stone', {displayName: 'Smooth Stone', texture: 'stone', hardness:10.0, itemDrop: 'cobblestone', effectiveTool: 'pickaxe', requiredTool: 'pickaxe'});
    this.registry.registerBlock('logOak', {displayName: 'Oak Wood', texture: ['log_oak_top', 'log_oak_top', 'log_oak'], hardness:2.0, effectiveTool: 'axe', creativeTab: 'plants'});
    this.registry.registerBlock('cobblestone', {texture: 'cobblestone', hardness:10.0, effectiveTool: 'pickaxe', requiredTool: 'pickaxe'});
    this.registry.registerBlock('oreCoal', {displayName: 'Coal Ore', texture: 'coal_ore', itemDrop: 'coal', hardness:15.0, requiredTool: 'pickaxe'});
    this.registry.registerBlock('oreIron', {displayName: 'Iron Ore', texture: 'iron_ore', hardness:15.0, requiredTool: 'pickaxe'});
    this.registry.registerBlock('brick', {texture: 'brick'}); // some of the these blocks don't really belong here..do they?
    this.registry.registerBlock('obsidian', {texture: 'obsidian', hardness: 128, requiredTool: 'pickaxe'});
    this.registry.registerBlock('leavesOak', {displayName: 'Oak Leaves', texture: 'leaves_oak', transparent: true, hardness: 0.1, creativeTab: 'plants',
      // if voxel-food apple is enabled, drop it when breaking laves (oak apples)
      itemDrop: this.registry.getItemProps('apple') ? 'apple' : null});

    this.registry.registerBlock('logBirch', {texture: ['log_birch_top', 'log_birch_top', 'log_birch'], hardness:2.0,
      displayName: 'Birch Wood', effectiveTool: 'axe', creativeTab: 'plants'}); // TODO: generate

voxel-clientmc gets its chunks server-side, so it doesn't need the client-side chunk generation of voxel-land. But it does need the terrain blocks. So it registers its own blocks - duplicating part of voxel-land. Maybe could move this common "terrain block" code out of voxel-land/voxel-clientmc into a separate plugin, voxel-terrain-blocks or such. Or to more specific plugins.

  grass: {texture: ['grass_top', 'dirt', 'grass_side'], hardness:1.0, itemDrop: 'dirt', effectiveTool: 'spade'},
  dirt: {texture: 'dirt', hardness:0.75, effectiveTool: 'spade'},
  farmland: {texture: 'farmland_dry'},
  mycelium: {texture: ['mycelium_top', 'dirt', 'mycelium_side']},
  stone: {displayName: 'Smooth Stone', texture: 'stone', hardness:10.0, itemDrop: 'cobblestone', effectiveTool: 'pickaxe', requiredTool: 'pickaxe'},
  waterFlow: {texture: 'water_flow'}, // TODO: animation
  water: {texture: 'water_still'}, // TODO: animation
  lavaFlow: {texture: 'lava_flow'}, // TODO: animation
  lava: {texture: 'lava_still'}, // TODO: animation
  sand: {texture: 'sand'},
  gravel: {texture: 'gravel'},
…
  logOak: {displayName: 'Oak Wood', texture: ['log_oak_top', 'log_oak_top', 'log_oak'], hardness:2.0, effectiveTool: 'axe', creativeTab: 'plants'},
  cobblestone: {texture: 'cobblestone', hardness:10.0, effectiveTool: 'pickaxe', requiredTool: 'pickaxe'},
  brick: {texture: 'brick'},
  leavesOak: {displayName: 'Oak Leaves', texture: 'leaves_oak', transparent: true, hardness: 0.1, creativeTab: 'plants'},
  leavesAcacia: {displayName: 'Acacia Leaves', texture: 'leaves_acacia', transparent: true, hardness: 0.1, creativeTab: 'plants'},
  logBirch: {texture: ['log_birch_top', 'log_birch_top', 'log_birch'], hardness:2.0, displayName: 'Birch Wood', effectiveTool: 'axe', creativeTab: 'plants'},
  logAcacia: {displayName: 'Acacia Wood', texture: ['log_acacia_top', 'log_acacia_top', 'log_acacia'], hardness:2.0, effectiveTool: 'axe', creativeTab: 'plants'},