| /** |
| * This file is automatically generated based on a section of |
| * the wiki source text from http://www.minecraftwiki.net/wiki/Data_values. |
| * Edit util/mcw-block-defs.txt and parse-mcw-blocks.rb and re-run |
| * rather than editing this file directly. |
| */ |
| |
| package togos.minecraft.maprend.world; |
| |
| import java.util.HashMap; |
| |
| import togos.minecraft.maprend.world.Material; |
| |
| public class Materials |
| { |
| public static final int BLOCK_TYPE_MASK = 0xFF; |
| public static final int BLOCK_TYPE_COUNT = 256; |
| |
| public static Material[] byBlockType = new Material[BLOCK_TYPE_COUNT]; |
| static HashMap byName = new HashMap(); |
| static HashMap byIcon = new HashMap(); |
| |
| public static String normalizeName(String name) { |
| name = name.replace("state", ""); |
| name = name.replace(" ", ""); |
| name = name.replace("'", ""); |
| name = name.replace("-", ""); |
| name = name.replace("\"", ""); |
| name = name.replace("(", ""); |
| name = name.replace(")", ""); |
| name = name.toLowerCase(); |
| return name; |
| } |
| |
| static void add( Material m ) { |
| byBlockType[m.blockType] = m; |
| byName.put(normalizeName(m.name), m); |
| byIcon.put(m.icon, m); |
| } |
| |
| public static Material getByBlockType(int blockType) { |
| return byBlockType[blockType & BLOCK_TYPE_MASK]; |
| } |
| |
| public static Material getByName(String name) { |
| return (Material)byName.get(normalizeName(name)); |
| } |
| |
| public static Material getByIcon(String icon) { |
| return (Material)byIcon.get(icon); |
| } |
| |
| static { |
| Material voidMaterial = new Material( (byte)0x00, (byte)0x00, 0x00000000, " ", "" ); |
| for( int i=0; i<BLOCK_TYPE_COUNT; ++i ) { |
| byBlockType[i] = voidMaterial; |
| } |
| add(new Material( (byte)0x00, (byte)0x00, 0x00000000, ". ", "Air" )); |
| add(new Material( (byte)0x01, (byte)0x00, 0xFF888888, "XX", "Stone" )); |
| add(new Material( (byte)0x02, (byte)0x00, 0xFF008800, "GD", "Grass" )); |
| add(new Material( (byte)0x03, (byte)0x00, 0xFF884400, "DD", "Dirt" )); |
| add(new Material( (byte)0x04, (byte)0x00, 0xFF666666, "CC", "Cobblestone" )); |
| add(new Material( (byte)0x05, (byte)0x00, 0xFFAA8844, "? ", "Wooden Plank" )); |
| add(new Material( (byte)0x06, (byte)0x00, 0xFF00AA00, "? ", "Sapling" )); |
| add(new Material( (byte)0x07, (byte)0x00, 0xFF444444, "##", "Bedrock" )); |
| add(new Material( (byte)0x08, (byte)0x00, 0xFF0000AA, "? ", "Moving water" )); |
| add(new Material( (byte)0x09, (byte)0x00, 0xFF000088, "WW", "Water" )); |
| add(new Material( (byte)0x0A, (byte)0x00, 0xFFFF4400, "? ", "Moving lava" )); |
| add(new Material( (byte)0x0B, (byte)0x00, 0xFFFF4411, "? ", "Lava" )); |
| add(new Material( (byte)0x0C, (byte)0x00, 0xFFAAAA66, "SS", "Sand" )); |
| add(new Material( (byte)0x0D, (byte)0x00, 0xFF664444, "? ", "Gravel" )); |
| add(new Material( (byte)0x0E, (byte)0x00, 0xFFFF00FF, "? ", "Gold Ore" )); |
| add(new Material( (byte)0x0F, (byte)0x00, 0xFFFF00FF, "? ", "Iron Ore" )); |
| add(new Material( (byte)0x10, (byte)0x00, 0xFFFF00FF, "? ", "Coal Ore" )); |
| add(new Material( (byte)0x11, (byte)0x00, 0xFF883322, "? ", "Log" )); |
| add(new Material( (byte)0x12, (byte)0x00, 0xFF006633, "? ", "Leaves" )); |
| add(new Material( (byte)0x13, (byte)0x00, 0xFFFF00FF, "? ", "Sponge" )); |
| add(new Material( (byte)0x14, (byte)0x00, 0xFF77AAAA, "? ", "Glass" )); |
| add(new Material( (byte)0x15, (byte)0x00, 0xFF546283, "? ", "Lapis Lazuli Ore" )); |
| add(new Material( (byte)0x16, (byte)0x00, 0xFF1741A9, "? ", "Lapis Lazuli Block" )); |
| add(new Material( (byte)0x17, (byte)0x00, 0xFFFF00FF, "? ", "Dispenser" )); |
| add(new Material( (byte)0x18, (byte)0x00, 0xFFFF00FF, "? ", "Sandstone" )); |
| add(new Material( (byte)0x19, (byte)0x00, 0xFFFF00FF, "? ", "Note Block" )); |
| add(new Material( (byte)0x1A, (byte)0x00, 0xFFFF00FF, "? ", "Bed" )); |
| add(new Material( (byte)0x1B, (byte)0x00, 0xFFFF00FF, "? ", "Powered Rail" )); |
| add(new Material( (byte)0x1C, (byte)0x00, 0xFFFF00FF, "? ", "Detector Rail" )); |
| add(new Material( (byte)0x1D, (byte)0x00, 0xFFFF00FF, "? ", "Sticky Piston" )); |
| add(new Material( (byte)0x1E, (byte)0x00, 0xFFFF00FF, "? ", "Cobweb" )); |
| add(new Material( (byte)0x1F, (byte)0x00, 0xFF00AA00, "? ", "Tall Grass" )); |
| add(new Material( (byte)0x20, (byte)0x00, 0xFFFF00FF, "? ", "Dead Shrubs" )); |
| add(new Material( (byte)0x21, (byte)0x00, 0xFFFF00FF, "? ", "Piston" )); |
| add(new Material( (byte)0x22, (byte)0x00, 0xFFFF00FF, "? ", "Piston Extension" )); |
| add(new Material( (byte)0x23, (byte)0x00, 0xFFFF00FF, "? ", "Wool" )); |
| add(new Material( (byte)0x24, (byte)0x00, 0xFFFF00FF, "? ", "Block moved by Piston" )); |
| add(new Material( (byte)0x25, (byte)0x00, 0xFFFF00FF, "? ", "Dandelion" )); |
| add(new Material( (byte)0x26, (byte)0x00, 0xFFFF00FF, "? ", "Rose" )); |
| add(new Material( (byte)0x27, (byte)0x00, 0xFFFF00FF, "? ", "Brown Mushroom" )); |
| add(new Material( (byte)0x28, (byte)0x00, 0xFFFF00FF, "? ", "Red Mushroom" )); |
| add(new Material( (byte)0x29, (byte)0x00, 0xFFFF00FF, "? ", "Gold Block" )); |
| add(new Material( (byte)0x2A, (byte)0x00, 0xFFFF00FF, "? ", "Iron Block" )); |
| add(new Material( (byte)0x2B, (byte)0x00, 0xFFFF00FF, "? ", "Double Slabs" )); |
| add(new Material( (byte)0x2C, (byte)0x00, 0xFFFF00FF, "? ", "Slabs" )); |
| add(new Material( (byte)0x2D, (byte)0x00, 0xFFFF00FF, "? ", "Brick Block" )); |
| add(new Material( (byte)0x2E, (byte)0x00, 0xFFFF00FF, "? ", "TNT" )); |
| add(new Material( (byte)0x2F, (byte)0x00, 0xFFFF00FF, "? ", "Bookshelf" )); |
| add(new Material( (byte)0x30, (byte)0x00, 0xFFFF00FF, "? ", "Moss Stone" )); |
| add(new Material( (byte)0x31, (byte)0x00, 0xFF442244, "? ", "Obsidian" )); |
| add(new Material( (byte)0x32, (byte)0x00, 0xFFFFFFEE, "? ", "Torch" )); |
| add(new Material( (byte)0x33, (byte)0x00, 0xFFFFDDCC, "? ", "Fire" )); |
| add(new Material( (byte)0x34, (byte)0x00, 0xFFFF00FF, "? ", "Monster Spawner" )); |
| add(new Material( (byte)0x35, (byte)0x00, 0xFFFF00FF, "? ", "Wooden Stairs" )); |
| add(new Material( (byte)0x36, (byte)0x00, 0xFFFF00FF, "? ", "Chest" )); |
| add(new Material( (byte)0x37, (byte)0x00, 0xFFFF00FF, "? ", "Redstone Wire" )); |
| add(new Material( (byte)0x38, (byte)0x00, 0xFFFF00FF, "? ", "Diamond Ore" )); |
| add(new Material( (byte)0x39, (byte)0x00, 0xFFFF00FF, "? ", "Diamond Block" )); |
| add(new Material( (byte)0x3A, (byte)0x00, 0xFFFF00FF, "? ", "Crafting Table" )); |
| add(new Material( (byte)0x3B, (byte)0x00, 0xFFFF00FF, "? ", "Seeds" )); |
| add(new Material( (byte)0x3C, (byte)0x00, 0xFFFF00FF, "? ", "Farmland" )); |
| add(new Material( (byte)0x3D, (byte)0x00, 0xFFFF00FF, "? ", "Furnace" )); |
| add(new Material( (byte)0x3E, (byte)0x00, 0xFFFF00FF, "? ", "Burning Furnace" )); |
| add(new Material( (byte)0x3F, (byte)0x00, 0xFFFF00FF, "? ", "Sign Post" )); |
| add(new Material( (byte)0x40, (byte)0x00, 0xFFFF00FF, "? ", "Door" )); |
| add(new Material( (byte)0x41, (byte)0x00, 0xFFFF00FF, "? ", "Ladders" )); |
| add(new Material( (byte)0x42, (byte)0x00, 0xFFFF00FF, "? ", "Rails" )); |
| add(new Material( (byte)0x43, (byte)0x00, 0xFFFF00FF, "? ", "Cobblestone Stairs" )); |
| add(new Material( (byte)0x44, (byte)0x00, 0xFFFF00FF, "? ", "Wall Sign" )); |
| add(new Material( (byte)0x45, (byte)0x00, 0xFFFF00FF, "? ", "Lever" )); |
| add(new Material( (byte)0x46, (byte)0x00, 0xFFFF00FF, "? ", "Pressure Plate" )); |
| add(new Material( (byte)0x47, (byte)0x00, 0xFFFF00FF, "? ", "Door" )); |
| add(new Material( (byte)0x48, (byte)0x00, 0xFFFF00FF, "? ", "Pressure Plate" )); |
| add(new Material( (byte)0x49, (byte)0x00, 0xFFFF00FF, "? ", "Redstone Ore" )); |
| add(new Material( (byte)0x4A, (byte)0x00, 0xFFFF00FF, "? ", "Glowing Redstone Ore" )); |
| add(new Material( (byte)0x4B, (byte)0x00, 0xFFFF00FF, "? ", "Redstone Torch (\"off\" state)" )); |
| add(new Material( (byte)0x4C, (byte)0x00, 0xFFFF00FF, "? ", "Redstone Torch (\"on\" state)" )); |
| add(new Material( (byte)0x4D, (byte)0x00, 0xFFFF00FF, "? ", "Stone Button" )); |
| add(new Material( (byte)0x4E, (byte)0x00, 0xFFCCCCCC, "? ", "Snow" )); |
| add(new Material( (byte)0x4F, (byte)0x00, 0xFF7799AA, "? ", "Ice" )); |
| add(new Material( (byte)0x50, (byte)0x00, 0xFFEEEEEE, "? ", "Snow Block" )); |
| add(new Material( (byte)0x51, (byte)0x00, 0xFF226622, "? ", "Cactus" )); |
| add(new Material( (byte)0x52, (byte)0x00, 0xFFFF00FF, "? ", "Clay Block" )); |
| add(new Material( (byte)0x53, (byte)0x00, 0xFFFF00FF, "? ", "Sugar Cane" )); |
| add(new Material( (byte)0x54, (byte)0x00, 0xFFFF00FF, "? ", "Jukebox" )); |
| add(new Material( (byte)0x55, (byte)0x00, 0xFFFF00FF, "? ", "Fence" )); |
| add(new Material( (byte)0x56, (byte)0x00, 0xFFFF00FF, "? ", "Pumpkin" )); |
| add(new Material( (byte)0x57, (byte)0x00, 0xFFFF00FF, "? ", "Netherrack" )); |
| add(new Material( (byte)0x58, (byte)0x00, 0xFFFF00FF, "? ", "Soul Sand" )); |
| add(new Material( (byte)0x59, (byte)0x00, 0xFFFF00FF, "? ", "Glowstone Block" )); |
| add(new Material( (byte)0x5A, (byte)0x00, 0xFFFF00FF, "? ", "Portal" )); |
| add(new Material( (byte)0x5B, (byte)0x00, 0xFFFF00FF, "? ", "Jack-O-Lantern" )); |
| add(new Material( (byte)0x5C, (byte)0x00, 0xFFFF00FF, "? ", "Cake Block" )); |
| add(new Material( (byte)0x5D, (byte)0x00, 0xFFFF00FF, "? ", "Redstone Repeater (\"off\" state)" )); |
| add(new Material( (byte)0x5E, (byte)0x00, 0xFFFF00FF, "? ", "Redstone Repeater (\"on\" state)" )); |
| add(new Material( (byte)0x5F, (byte)0x00, 0xFFFF00FF, "? ", "Locked Chest" )); |
| add(new Material( (byte)0x60, (byte)0x00, 0xFFFF00FF, "? ", "Trapdoor" )); |
| } |
| } |