diff --git a/overviewer_core/src/iterate.c b/overviewer_core/src/iterate.c index 5c9c51b..00a6ace 100644 --- a/overviewer_core/src/iterate.c +++ b/overviewer_core/src/iterate.c @@ -16,6 +16,7 @@ */ #include "overviewer.h" +#include "mc_id.h" static PyObject *textures = NULL; @@ -250,20 +251,20 @@ is_stairs(int block) { * Determines if a block is stairs of any material */ switch (block) { - case 53: /* oak wood stairs */ - case 67: /* cobblestone stairs */ - case 108: /* brick stairs */ - case 109: /* stone brick stairs */ - case 114: /* nether brick stairs */ - case 128: /* sandstone stairs */ - case 134: /* spruce wood stairs */ - case 135: /* birch wood stairs */ - case 136: /* jungle wood stairs */ - case 156: /* quartz stairs */ - case 163: /* acacia wood stairs */ - case 164: /* dark wood stairs */ - case 180: /* red sandstone stairs */ - case 203: /* purpur stairs */ + case block_oak_stairs: + case block_stone_stairs: + case block_brick_stairs: + case block_stone_brick_stairs: + case block_nether_brick_stairs: + case block_sandstone_stairs: + case block_spruce_stairs: + case block_birch_stairs: + case block_jungle_stairs: + case block_quartz_stairs: + case block_acacia_stairs: + case block_dark_oak_stairs: + case block_red_sandstone_stairs: + case block_purpur_stairs: return 1; } return 0; @@ -278,18 +279,18 @@ generate_pseudo_data(RenderState *state, unsigned short ancilData) { int x = state->x, y = state->y, z = state->z; unsigned short data = 0; - if (state->block == 2) { /* grass */ + if (state->block == block_grass) { /* grass */ /* return 0x10 if grass is covered in snow */ if (get_data(state, BLOCKS, x, y+1, z) == 78) return 0x10; return ancilData; - } else if (state->block == 8 || state->block == 9) { /* water */ + } else if (state->block == block_flowing_water || state->block == block_water) { /* water */ data = check_adjacent_blocks(state, x, y, z, state->block) ^ 0x0f; /* an aditional bit for top is added to the 4 bits of check_adjacent_blocks */ if (get_data(state, BLOCKS, x, y+1, z) != state->block) data |= 0x10; return data; - } else if ((state->block == 20) || (state->block == 79) || (state->block == 95)) { /* glass and ice and stained glass*/ + } else if ((state->block == block_glass) || (state->block == block_ice) || (state->block == block_stained_glass)) { /* glass and ice and stained glass*/ /* an aditional bit for top is added to the 4 bits of check_adjacent_blocks * Note that stained glass encodes 16 colors using 4 bits. this pushes us over the 8-bits of an unsigned char, * forcing us to use an unsigned short to hold 16 bits of pseudo ancil data @@ -301,14 +302,14 @@ generate_pseudo_data(RenderState *state, unsigned short ancilData) { } data = (check_adjacent_blocks(state, x, y, z, state->block) ^ 0x0f) | data; return (data << 4) | (ancilData & 0x0f); - } else if ((state->block == 85) || (state->block == 188) || (state->block == 189) || - (state->block == 190) || (state->block == 191) || (state->block == 192)) { /* fences */ + } else if ((state->block == block_fence) || (state->block == block_spruce_fence) || (state->block == block_birch_fence) || + (state->block == block_jungle_fence) || (state->block == block_dark_oak_fence) || (state->block == block_acacia_fence)) { /* fences */ /* check for fences AND fence gates */ - return check_adjacent_blocks(state, x, y, z, state->block) | check_adjacent_blocks(state, x, y, z, 107) | - check_adjacent_blocks(state, x, y, z, 183) | check_adjacent_blocks(state, x, y, z, 184) | check_adjacent_blocks(state, x, y, z, 185) | - check_adjacent_blocks(state, x, y, z, 186) | check_adjacent_blocks(state, x, y, z, 187); + return check_adjacent_blocks(state, x, y, z, state->block) | check_adjacent_blocks(state, x, y, z, block_fence_gate) | + check_adjacent_blocks(state, x, y, z, block_fence_gate) | check_adjacent_blocks(state, x, y, z, block_birch_fence_gate) | check_adjacent_blocks(state, x, y, z, block_jungle_fence_gate) | + check_adjacent_blocks(state, x, y, z, block_dark_oak_fence_gate) | check_adjacent_blocks(state, x, y, z, block_acacia_fence_gate); - } else if (state->block == 55) { /* redstone */ + } else if (state->block == block_redstone_wire) { /* redstone */ /* three addiotional bit are added, one for on/off state, and * another two for going-up redstone wire in the same block * (connection with the level y+1) */ @@ -342,7 +343,7 @@ generate_pseudo_data(RenderState *state, unsigned short ancilData) { } return final_data; - } else if (state->block == 54 || state->block == 146) { /* normal chests and trapped chests */ + } else if (state->block == block_chest || state->block == block_trapped_chest) { /* Orientation is given by ancilData, pseudo data needed to * choose from single or double chest and the correct half of * the chest. */ @@ -379,7 +380,7 @@ generate_pseudo_data(RenderState *state, unsigned short ancilData) { } return final_data; - } else if ((state->block == 101) || (state->block == 102) || (state->block == 160)) { + } else if ((state->block == block_iron_bars) || (state->block == block_glass_pane) || (state->block == block_stained_glass_pane)) { /* iron bars and glass panes: * they seem to stick to almost everything but air, * not sure yet! Still a TODO! */ @@ -388,13 +389,13 @@ generate_pseudo_data(RenderState *state, unsigned short ancilData) { data = (check_adjacent_blocks(state, x, y, z, 0) ^ 0x0f); return (data << 4) | (ancilData & 0xf); - } else if ((state->block == 90) || (state->block == 113)) { + } else if ((state->block == block_portal) || (state->block == block_nether_brick_fence)) { /* portal and nether brick fences */ return check_adjacent_blocks(state, x, y, z, state->block); - } else if ((state->block == 64) || (state->block == 71) || (state->block == 193) || - (state->block == 194) || (state->block == 195) || (state->block == 196) || - (state->block ==197)) { + } else if ((state->block == block_wooden_door) || (state->block == block_iron_door) || (state->block == block_spruce_door) || + (state->block == block_birch_door) || (state->block == block_jungle_door) || (state->block == block_acacia_door) || + (state->block == block_dark_oak_door)) { /* use bottom block data format plus one bit for top/down * block (0x8) and one bit for hinge position (0x10) */ @@ -420,14 +421,14 @@ generate_pseudo_data(RenderState *state, unsigned short ancilData) { } return data; - } else if (state->block == 139) { /* cobblestone and mossy cobbleston wall */ + } else if (state->block == block_cobblestone_wall) { /* check for walls and add one bit with the type of wall (mossy or cobblestone)*/ if (ancilData == 0x1) { return check_adjacent_blocks(state, x, y, z, state->block) | 0x10; } else { return check_adjacent_blocks(state, x, y, z, state->block); } - } else if (state->block == 111) { /* lilypads */ + } else if (state->block == block_waterlily) { int wx,wz,wy,rotation; long pr; /* calculate the global block coordinates of this position */ @@ -547,11 +548,11 @@ generate_pseudo_data(RenderState *state, unsigned short ancilData) { } return ancilData; - } else if (state->block == 175) { /* doublePlants */ + } else if (state->block == block_double_plant) { /* doublePlants */ /* use bottom block data format plus one bit for top * block (0x8) */ - if( get_data(state, BLOCKS, x, y-1, z) == 175 ) { + if( get_data(state, BLOCKS, x, y-1, z) == block_double_plant ) { data = get_data(state, DATA, x, y-1, z) | 0x8; } else { data = ancilData; @@ -663,10 +664,9 @@ chunk_render(PyObject *self, PyObject *args) { unsigned short ancilData; state.imgy -= 12; - /* get blockid */ state.block = getArrayShort3D(blocks_py, state.x, state.y, state.z); - if (state.block == 0 || render_mode_hidden(rendermode, state.x, state.y, state.z)) { + if (state.block == block_air || render_mode_hidden(rendermode, state.x, state.y, state.z)) { continue; } @@ -698,24 +698,28 @@ chunk_render(PyObject *self, PyObject *args) { * grass, water, glass, chest, restone wire, * ice, fence, portal, iron bars, glass panes, * trapped chests, stairs */ - if ((state.block == 2) || - (state.block == 8) || (state.block == 9) || - (state.block == 20) || (state.block == 54) || - (state.block == 55) || + if ((state.block == block_grass) || + (state.block == block_flowing_water) || (state.block == block_water) || + (state.block == block_glass) || (state.block == block_chest) || + (state.block == block_redstone_wire) || /* doors */ - (state.block == 64) || (state.block == 193) || - (state.block == 194) || (state.block == 195) || - (state.block == 196) || (state.block == 197) || - (state.block == 71) || /* end doors */ - (state.block == 79) || - (state.block == 85) || (state.block == 90) || - (state.block == 101) || (state.block == 102) || - (state.block == 111) || (state.block == 113) || - (state.block == 139) || (state.block == 175) || - (state.block == 160) || (state.block == 95) || - (state.block == 146) || (state.block == 188) || - (state.block == 189) || (state.block == 190) || - (state.block == 191) || (state.block == 192) || + (state.block == block_wooden_door ) || + (state.block == block_iron_door ) || + (state.block == block_spruce_door ) || + (state.block == block_birch_door ) || + (state.block == block_jungle_door ) || + (state.block == block_acacia_door ) || + (state.block == block_dark_oak_door) || + /* end doors */ + (state.block == block_ice) || + (state.block == block_fence) || (state.block == block_portal) || + (state.block == block_iron_bars) || (state.block == block_glass_pane) || + (state.block == block_waterlily) || (state.block == block_nether_brick_fence) || + (state.block == block_cobblestone_wall) || (state.block == block_double_plant) || + (state.block == block_stained_glass_pane) || (state.block == block_stained_glass) || + (state.block == block_trapped_chest) || (state.block == block_spruce_fence) || + (state.block == block_birch_fence) || (state.block == block_jungle_fence) || + (state.block == block_dark_oak_fence) || (state.block == block_acacia_fence) || is_stairs(state.block)) { ancilData = generate_pseudo_data(&state, ancilData); state.block_pdata = ancilData; @@ -738,7 +742,7 @@ chunk_render(PyObject *self, PyObject *args) { if (t != NULL && t != Py_None) { PyObject *src, *mask, *mask_light; - int do_rand = (state.block == 31 /*|| state.block == 38 || state.block == 175*/); + int do_rand = (state.block == block_tallgrass /*|| state.block == block_red_flower || state.block == block_double_plant*/); int randx = 0, randy = 0; src = PyTuple_GetItem(t, 0); mask = PyTuple_GetItem(t, 0); @@ -762,7 +766,7 @@ chunk_render(PyObject *self, PyObject *args) { state.imgx -= randx; state.imgy -= randy; } - } + } } } } diff --git a/overviewer_core/src/mc_id.h b/overviewer_core/src/mc_id.h new file mode 100644 index 0000000..aa18562 --- /dev/null +++ b/overviewer_core/src/mc_id.h @@ -0,0 +1,480 @@ +#ifndef __MC_ID_H_INCLUDED__ +#define __MC_ID_H_INCLUDED__ + +#include + +enum mc_block_id +{ + block_air = 0, + block_stone = 1, + block_grass = 2, + block_dirt = 3, + block_cobblestone = 4, + block_planks = 5, + block_sapling = 6, + block_bedrock = 7, + block_flowing_water = 8, + block_water = 9, + block_flowing_lava = 10, + block_lava = 11, + block_sand = 12, + block_gravel = 13, + block_gold_ore = 14, + block_iron_ore = 15, + block_coal_ore = 16, + block_log = 17, + block_leaves = 18, + block_sponge = 19, + block_glass = 20, + block_lapis_ore = 21, + block_lapis_block = 22, + block_dispenser = 23, + block_sandstone = 24, + block_noteblock = 25, + block_bed = 26, + block_golden_rail = 27, + block_detector_rail = 28, + block_sticky_piston = 29, + block_web = 30, + block_tallgrass = 31, + block_deadbush = 32, + block_piston = 33, + block_piston_head = 34, + block_wool = 35, + block_yellow_flower = 37, + block_red_flower = 38, + block_brown_mushroom = 39, + block_red_mushroom = 40, + block_gold_block = 41, + block_iron_block = 42, + block_double_stone_slab = 43, + block_stone_slab = 44, + block_brick_block = 45, + block_tnt = 46, + block_bookshelf = 47, + block_mossy_cobblestone = 48, + block_obsidian = 49, + block_torch = 50, + block_fire = 51, + block_mob_spawner = 52, + block_oak_stairs = 53, + block_chest = 54, + block_redstone_wire = 55, + block_diamond_ore = 56, + block_diamond_block = 57, + block_crafting_table = 58, + block_wheat = 59, + block_farmland = 60, + block_furnace = 61, + block_lit_furnace = 62, + block_standing_sign = 63, + block_wooden_door = 64, + block_ladder = 65, + block_rail = 66, + block_stone_stairs = 67, + block_wall_sign = 68, + block_lever = 69, + block_stone_pressure_plate = 70, + block_iron_door = 71, + block_wooden_pressure_plate = 72, + block_redstone_ore = 73, + block_lit_redstone_ore = 74, + block_unlit_redstone_torch = 75, + block_redstone_torch = 76, + block_stone_button = 77, + block_snow_layer = 78, + block_ice = 79, + block_snow = 80, + block_cactus = 81, + block_clay = 82, + block_reeds = 83, + block_jukebox = 84, + block_fence = 85, + block_pumpkin = 86, + block_netherrack = 87, + block_soul_sand = 88, + block_glowstone = 89, + block_portal = 90, + block_lit_pumpkin = 91, + block_cake = 92, + block_unpowered_repeater = 93, + block_powered_repeater = 94, + block_stained_glass = 95, + block_trapdoor = 96, + block_monster_egg = 97, + block_stonebrick = 98, + block_brown_mushroom_block = 99, + block_red_mushroom_block = 100, + block_iron_bars = 101, + block_glass_pane = 102, + block_melon_block = 103, + block_pumpkin_stem = 104, + block_melon_stem = 105, + block_vine = 106, + block_fence_gate = 107, + block_brick_stairs = 108, + block_stone_brick_stairs = 109, + block_mycelium = 110, + block_waterlily = 111, + block_nether_brick = 112, + block_nether_brick_fence = 113, + block_nether_brick_stairs = 114, + block_nether_wart = 115, + block_enchanting_table = 116, + block_brewing_stand = 117, + block_cauldron = 118, + block_end_portal = 119, + block_end_portal_frame = 120, + block_end_stone = 121, + block_dragon_egg = 122, + block_redstone_lamp = 123, + block_lit_redstone_lamp = 124, + block_double_wooden_slab = 125, + block_wooden_slab = 126, + block_cocoa = 127, + block_sandstone_stairs = 128, + block_emerald_ore = 129, + block_ender_chest = 130, + block_tripwire_hook = 131, + block_tripwire_wire = 132, + block_emerald_block = 133, + block_spruce_stairs = 134, + block_birch_stairs = 135, + block_jungle_stairs = 136, + block_command_block = 137, + block_beacon = 138, + block_cobblestone_wall = 139, + block_flower_pot = 140, + block_carrots = 141, + block_potatoes = 142, + block_wooden_button = 143, + block_skull = 144, + block_anvil = 145, + block_trapped_chest = 146, + block_light_weighted_pressure_plate = 147, + block_heavy_weighted_pressure_plate = 148, + block_unpowered_comparator = 149, + block_powered_comparator = 150, + block_daylight_detector = 151, + block_redstone_block = 152, + block_quartz_ore = 153, + block_hopper = 154, + block_quartz_block = 155, + block_quartz_stairs = 156, + block_activator_rail = 157, + block_dropper = 158, + block_stained_hardened_clay = 159, + block_stained_glass_pane = 160, + block_leaves2 = 161, + block_log2 = 162, + block_acacia_stairs = 163, + block_dark_oak_stairs = 164, + block_slime = 165, + block_barrier = 166, + block_iron_trapdoor = 167, + block_prismarine = 168, + block_sea_lantern = 169, + block_hay_block = 170, + block_carpet = 171, + block_hardened_clay = 172, + block_coal_block = 173, + block_packed_ice = 174, + block_double_plant = 175, + block_standing_banner = 176, + block_wall_banner = 177, + block_daylight_detector_inverted = 178, + block_red_sandstone = 179, + block_red_sandstone_stairs = 180, + block_double_stone_slab2 = 181, + block_stone_slab2 = 182, + block_spruce_fence_gate = 183, + block_birch_fence_gate = 184, + block_jungle_fence_gate = 185, + block_dark_oak_fence_gate = 186, + block_acacia_fence_gate = 187, + block_spruce_fence = 188, + block_birch_fence = 189, + block_jungle_fence = 190, + block_dark_oak_fence = 191, + block_acacia_fence = 192, + block_spruce_door = 193, + block_birch_door = 194, + block_jungle_door = 195, + block_acacia_door = 196, + block_dark_oak_door = 197, + block_end_rod = 198, + block_chorus_plant = 199, + block_chorus_flower = 200, + block_purpur_block = 201, + block_purpur_pillar = 202, + block_purpur_stairs = 203, + block_purpur_double_slab = 204, + block_purpur_slab = 205, + block_end_bricks = 206, + block_beetroots = 207, + block_grass_path = 208, + block_end_gateway = 209, + block_repeating_command_block = 210, + block_chain_command_block = 211, + block_frosted_ice = 212, + block_magma = 213, + block_nether_wart_block = 214, + block_red_nether_brick = 215, + block_bone_block = 216, + block_structure_void = 217, + block_observer = 218, + block_white_shulker_box = 219, + block_orange_shulker_box = 220, + block_magenta_shulker_box = 221, + block_light_blue_shulker_box = 222, + block_yellow_shulker_box = 223, + block_lime_shulker_box = 224, + block_pink_shulker_box = 225, + block_gray_shulker_box = 226, + block_silver_shulker_box = 227, + block_cyan_shulker_box = 228, + block_purple_shulker_box = 229, + block_blue_shulker_box = 230, + block_brown_shulker_box = 231, + block_green_shulker_box = 232, + block_red_shulker_box = 233, + block_black_shulker_box = 234, + block_white_glazed_terracotta = 235, + block_orange_glazed_terracotta = 236, + block_magenta_glazed_terracotta = 237, + block_light_blue_glazed_terracotta = 238, + block_yellow_glazed_terracotta = 239, + block_lime_glazed_terracotta = 240, + block_pink_glazed_terracotta = 241, + block_gray_glazed_terracotta = 242, + block_light_gray_glazed_terracotta = 243, + block_cyan_glazed_terracotta = 244, + block_purple_glazed_terracotta = 245, + block_blue_glazed_terracotta = 246, + block_brown_glazed_terracotta = 247, + block_green_glazed_terracotta = 248, + block_red_glazed_terracotta = 249, + block_black_glazed_terracotta = 250, + block_concrete = 251, + block_concrete_powder = 252, + block_structure_block = 255, +}; + +typedef uint16_t mc_block_t; + + +enum mc_item_id +{ + item_iron_shovel = 256, + item_iron_pickaxe = 257, + item_iron_axe = 258, + item_flint_and_steel = 259, + item_apple = 260, + item_bow = 261, + item_arrow = 262, + item_coal = 263, + item_diamond = 264, + item_iron_ingot = 265, + item_gold_ingot = 266, + item_iron_sword = 267, + item_wooden_sword = 268, + item_wooden_shovel = 269, + item_wooden_pickaxe = 270, + item_wooden_axe = 271, + item_stone_sword = 272, + item_stone_shovel = 273, + item_stone_pickaxe = 274, + item_stone_axe = 275, + item_diamond_sword = 276, + item_diamond_shovel = 277, + item_diamond_pickaxe = 278, + item_diamond_axe = 279, + item_stick = 280, + item_bowl = 281, + item_mushroom_stew = 282, + item_golden_sword = 283, + item_golden_shovel = 284, + item_golden_pickaxe = 285, + item_golden_axe = 286, + item_string = 287, + item_feather = 288, + item_gunpowder = 289, + item_wooden_hoe = 290, + item_stone_hoe = 291, + item_iron_hoe = 292, + item_diamond_hoe = 293, + item_golden_hoe = 294, + item_wheat_seeds = 295, + item_wheat = 296, + item_bread = 297, + item_leather_helmet = 298, + item_leather_chestplate = 299, + item_leather_leggings = 300, + item_leather_boots = 301, + item_chainmail_helmet = 302, + item_chainmail_chestplate = 303, + item_chainmail_leggings = 304, + item_chainmail_boots = 305, + item_iron_helmet = 306, + item_iron_chestplate = 307, + item_iron_leggings = 308, + item_iron_boots = 309, + item_diamond_helmet = 310, + item_diamond_chestplate = 311, + item_diamond_leggings = 312, + item_diamond_boots = 313, + item_golden_helmet = 314, + item_golden_chestplate = 315, + item_golden_leggings = 316, + item_golden_boots = 317, + item_flint = 318, + item_porkchop = 319, + item_cooked_porkchop = 320, + item_painting = 321, + item_golden_apple = 322, + item_sign = 323, + item_wooden_door = 324, + item_bucket = 325, + item_water_bucket = 326, + item_lava_bucket = 327, + item_minecart = 328, + item_saddle = 329, + item_iron_door = 330, + item_redstone = 331, + item_snowball = 332, + item_boat = 333, + item_leather = 334, + item_milk_bucket = 335, + item_brick = 336, + item_clay_ball = 337, + item_reeds = 338, + item_paper = 339, + item_book = 340, + item_slime_ball = 341, + item_chest_minecart = 342, + item_furnace_minecart = 343, + item_egg = 344, + item_compass = 345, + item_fishing_rod = 346, + item_clock = 347, + item_glowstone_dust = 348, + item_fish = 349, + item_cooked_fish = 350, + item_dye = 351, + item_bone = 352, + item_sugar = 353, + item_cake = 354, + item_bed = 355, + item_repeater = 356, + item_cookie = 357, + item_filled_map = 358, + item_shears = 359, + item_melon = 360, + item_pumpkin_seeds = 361, + item_melon_seeds = 362, + item_beef = 363, + item_cooked_beef = 364, + item_chicken = 365, + item_cooked_chicken = 366, + item_rotten_flesh = 367, + item_ender_pearl = 368, + item_blaze_rod = 369, + item_ghast_tear = 370, + item_gold_nugget = 371, + item_nether_wart = 372, + item_potion = 373, + item_glass_bottle = 374, + item_spider_eye = 375, + item_fermented_spider_eye = 376, + item_blaze_powder = 377, + item_magma_cream = 378, + item_brewing_stand = 379, + item_cauldron = 380, + item_ender_eye = 381, + item_speckled_melon = 382, + item_spawn_egg = 383, + item_experience_bottle = 384, + item_fire_charge = 385, + item_writable_book = 386, + item_written_book = 387, + item_emerald = 388, + item_item_frame = 389, + item_flower_pot = 390, + item_carrot = 391, + item_potato = 392, + item_baked_potato = 393, + item_poisonous_potato = 394, + item_map = 395, + item_golden_carrot = 396, + item_skull = 397, + item_carrot_on_a_stick = 398, + item_nether_star = 399, + item_pumpkin_pie = 400, + item_fireworks = 401, + item_firework_charge = 402, + item_enchanted_book = 403, + item_comparator = 404, + item_netherbrick = 405, + item_quartz = 406, + item_tnt_minecart = 407, + item_hopper_minecart = 408, + item_prismarine_shard = 409, + item_prismarine_crystals = 410, + item_rabbit = 411, + item_cooked_rabbit = 412, + item_rabbit_stew = 413, + item_rabbit_foot = 414, + item_rabbit_hide = 415, + item_armor_stand = 416, + item_iron_horse_armor = 417, + item_golden_horse_armor = 418, + item_diamond_horse_armor = 419, + item_lead = 420, + item_name_tag = 421, + item_command_block_minecart = 422, + item_mutton = 423, + item_cooked_mutton = 424, + item_banner = 425, + item_end_crystal = 426, + item_spruce_door = 427, + item_birch_door = 428, + item_jungle_door = 429, + item_acacia_door = 430, + item_dark_oak_door = 431, + item_chorus_fruit = 432, + item_popped_chorus_fruit = 433, + item_beetroot = 434, + item_beetroot_seeds = 435, + item_beetroot_soup = 436, + item_dragon_breath = 437, + item_splash_potion = 438, + item_spectral_arrow = 439, + item_tipped_arrow = 440, + item_lingering_potion = 441, + item_shield = 442, + item_elytra = 443, + item_spruce_boat = 444, + item_birch_boat = 445, + item_jungle_boat = 446, + item_acacia_boat = 447, + item_dark_oak_boat = 448, + item_totem_of_undying = 449, + item_shulker_shell = 450, + item_iron_nugget = 452, + item_knowledge_book = 453, + item_record_13 = 2256, + item_record_cat = 2257, + item_record_blocks = 2258, + item_record_chirp = 2259, + item_record_far = 2260, + item_record_mall = 2261, + item_record_mellohi = 2262, + item_record_stal = 2263, + item_record_strad = 2264, + item_record_ward = 2265, + item_record_11 = 2266, + item_record_wait = 2267 +}; + +typedef uint16_t mc_item_t; +#endif \ No newline at end of file diff --git a/overviewer_core/src/overviewer.h b/overviewer_core/src/overviewer.h index ca29186..5f8001b 100644 --- a/overviewer_core/src/overviewer.h +++ b/overviewer_core/src/overviewer.h @@ -33,7 +33,7 @@ // increment this value if you've made a change to the c extesion // and want to force users to rebuild -#define OVERVIEWER_EXTENSION_VERSION 56 +#define OVERVIEWER_EXTENSION_VERSION 57 /* Python PIL, and numpy headers */ #include diff --git a/overviewer_core/src/primitives/base.c b/overviewer_core/src/primitives/base.c index 3a955e2..099cdd8 100644 --- a/overviewer_core/src/primitives/base.c +++ b/overviewer_core/src/primitives/base.c @@ -16,6 +16,7 @@ */ #include "../overviewer.h" +#include "../mc_id.h" #include "biomes.h" typedef struct { @@ -93,24 +94,24 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec * biome-compliant ones! The tinting is now all done here. */ if (/* grass, but not snowgrass */ - (state->block == 2 && get_data(state, BLOCKS, state->x, state->y+1, state->z) != 78) || + (state->block == block_grass && get_data(state, BLOCKS, state->x, state->y+1, state->z) != 78) || /* water */ - state->block == 8 || state->block == 9 || + state->block == block_flowing_water || state->block == block_water || /* leaves */ - state->block == 18 || state->block == 161 || + state->block == block_leaves || state->block == block_leaves2 || /* tallgrass, but not dead shrubs */ - (state->block == 31 && state->block_data != 0) || + (state->block == block_tallgrass && state->block_data != 0) || /* pumpkin/melon stem, not fully grown. Fully grown stems * get constant brown color (see textures.py) */ - (((state->block == 104) || (state->block == 105)) && (state->block_data != 7)) || + (((state->block == block_pumpkin_stem) || (state->block == block_melon_stem)) && (state->block_data != 7)) || /* vines */ - state->block == 106 || + state->block == block_vine || /* lily pads */ - state->block == 111 || + state->block == block_waterlily || /* doublePlant grass & ferns */ - (state->block == 175 && (state->block_data == 2 || state->block_data == 3)) || + (state->block == block_double_plant && (state->block_data == 2 || state->block_data == 3)) || /* doublePlant grass & ferns tops */ - (state->block == 175 && below_block == 175 && (below_data == 2 || below_data == 3)) ) + (state->block == block_double_plant && below_block == block_double_plant && (below_data == 2 || below_data == 3)) ) { /* do the biome stuff! */ PyObject *facemask = mask; @@ -118,7 +119,7 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec PyObject *color_table = NULL; unsigned char flip_xy = 0; - if (state->block == 2) { + if (state->block == block_grass) { /* grass needs a special facemask */ facemask = self->grass_texture; } diff --git a/overviewer_core/src/primitives/edge-lines.c b/overviewer_core/src/primitives/edge-lines.c index a82624f..1f2e948 100644 --- a/overviewer_core/src/primitives/edge-lines.c +++ b/overviewer_core/src/primitives/edge-lines.c @@ -16,6 +16,7 @@ */ #include "../overviewer.h" +#include "../mc_id.h" typedef struct { float opacity; @@ -34,16 +35,16 @@ edge_lines_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, P PrimitiveEdgeLines *self = (PrimitiveEdgeLines *)data; /* Draw some edge lines! */ - if (state->block == 44 || state->block == 78 || !is_transparent(state->block)) { + if (state->block == block_stone_slab || state->block == block_snow_layer || !is_transparent(state->block)) { Imaging img_i = imaging_python_to_c(state->img); unsigned char ink[] = {0, 0, 0, 255 * self->opacity}; unsigned short side_block; int x = state->x, y = state->y, z = state->z; int increment=0; - if ((state->block == 44 || state->block == 126) && ((state->block_data & 0x8) == 0 )) // half-steps BUT no upsidown half-steps + if ((state->block == block_stone_slab || state->block == block_wooden_slab) && ((state->block_data & 0x8) == 0 )) // half-steps BUT no upsidown half-steps increment=6; - else if ((state->block == 78) || (state->block == 93) || (state->block == 94)) // snow, redstone repeaters (on and off) + else if ((state->block == block_snow_layer) || (state->block == block_unpowered_repeater) || (state->block == block_powered_repeater)) // snow, redstone repeaters (on and off) increment=9; /* +X side */ @@ -51,9 +52,9 @@ edge_lines_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, P if (side_block != state->block && (is_transparent(side_block) || render_mode_hidden(state->rendermode, x+1, y, z)) && /* WARNING: ugly special case approaching */ /* if the block is a slab and the side block is a stair don't draw anything, it can give very ugly results */ - !((state->block == 44 || state->block == 126) && ((side_block == 53) || (side_block == 67) || (side_block == 108) || - (side_block == 109) || (side_block == 114) || (side_block == 128) || (side_block == 134) || (side_block == 135) || - (side_block == 136)))) { + !((state->block == block_stone_slab || state->block == block_wooden_slab) && ((side_block == block_oak_stairs) || (side_block == block_stone_stairs) || (side_block == block_brick_stairs) || + (side_block == block_stone_brick_stairs) || (side_block == block_nether_brick_stairs) || (side_block == block_sandstone_stairs) || (side_block == block_spruce_stairs) || (side_block == block_birch_stairs) || + (side_block == block_jungle_stairs)))) { ImagingDrawLine(img_i, state->imgx+12, state->imgy+1+increment, state->imgx+22+1, state->imgy+5+1+increment, &ink, 1); ImagingDrawLine(img_i, state->imgx+12, state->imgy+increment, state->imgx+22+1, state->imgy+5+increment, &ink, 1); } @@ -63,9 +64,9 @@ edge_lines_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, P if (side_block != state->block && (is_transparent(side_block) || render_mode_hidden(state->rendermode, x, y, z-1)) && /* WARNING: ugly special case approaching */ /* if the block is a slab and the side block is a stair don't draw anything, it can give very ugly results */ - !((state->block == 44 || state->block == 126) && ((side_block == 53) || (side_block == 67) || (side_block == 108) || - (side_block == 109) || (side_block == 114) || (side_block == 128) || (side_block == 134) || (side_block == 135) || - (side_block == 136)))) { + !((state->block == block_stone_slab || state->block == block_wooden_slab) && ((side_block == block_oak_stairs) || (side_block == block_stone_stairs) || (side_block == block_brick_stairs) || + (side_block == block_stone_brick_stairs) || (side_block == block_nether_brick_stairs) || (side_block == block_sandstone_stairs) || (side_block == block_spruce_stairs) || (side_block == block_birch_stairs) || + (side_block == block_jungle_stairs)))) { ImagingDrawLine(img_i, state->imgx, state->imgy+6+1+increment, state->imgx+12+1, state->imgy+1+increment, &ink, 1); ImagingDrawLine(img_i, state->imgx, state->imgy+6+increment, state->imgx+12+1, state->imgy+increment, &ink, 1); } diff --git a/overviewer_core/src/primitives/hide.c b/overviewer_core/src/primitives/hide.c index cdb24e8..c3dff6c 100644 --- a/overviewer_core/src/primitives/hide.c +++ b/overviewer_core/src/primitives/hide.c @@ -16,6 +16,7 @@ */ #include "../overviewer.h" +#include "../mc_id.h" struct HideRule { unsigned short blockid; @@ -90,7 +91,7 @@ hide_hidden(void *data, RenderState *state, int x, int y, int z) { return 0; block = get_data(state, BLOCKS, x, y, z); - for (i = 0; self->rules[i].blockid != 0; i++) { + for (i = 0; self->rules[i].blockid != block_air; i++) { if (block == self->rules[i].blockid) { unsigned char data; diff --git a/overviewer_core/src/primitives/lighting.c b/overviewer_core/src/primitives/lighting.c index 97f7f0a..9539368 100644 --- a/overviewer_core/src/primitives/lighting.c +++ b/overviewer_core/src/primitives/lighting.c @@ -16,6 +16,7 @@ */ #include "../overviewer.h" +#include "../mc_id.h" #include "lighting.h" #include @@ -138,7 +139,7 @@ estimate_blocklevel(RenderPrimitiveLighting *self, RenderState *state, blocklevel = get_data(state, BLOCKLIGHT, x, y, z); /* no longer a guess */ - if (!(block == 44 || block == 53 || block == 67 || block == 108 || block == 109 || block == 180 || block == 182 || block == 205) && authoratative) { + if (!(block == block_stone_slab || block == block_oak_stairs || block == block_stone_stairs || block == block_brick_stairs || block == block_stone_brick_stairs || block == block_red_sandstone_stairs || block == block_stone_slab2 || block == block_purpur_slab ) && authoratative) { *authoratative = 1; } @@ -159,9 +160,9 @@ get_lighting_color(RenderPrimitiveLighting *self, RenderState *state, /* special half-step handling, stairs handling */ /* Anvil also needs to be here, blockid 145 */ - if (block == 44 || block == 53 || block == 67 || block == 108 || block == 109 || block == 114 || - block == 128 || block == 134 || block == 135 || block == 136 || block == 145 || block == 156 || - block == 163 || block == 164 || block == 180 || block == 182 || block == 203 || block == 205) { + if (block == block_stone_slab || block == block_oak_stairs || block == block_stone_stairs || block == block_brick_stairs || block == block_stone_brick_stairs || block == block_nether_brick_stairs || + block == block_sandstone_stairs || block == block_spruce_stairs || block == block_birch_stairs || block == block_jungle_stairs || block == block_anvil || block == block_quartz_stairs || + block == block_acacia_stairs || block == block_dark_oak_stairs || block == block_red_sandstone_stairs || block == block_stone_slab2 || block == block_purpur_stairs || block == block_purpur_slab ) { unsigned int upper_block; /* stairs and half-blocks take the skylevel from the upper block if it's transparent */ @@ -170,10 +171,10 @@ get_lighting_color(RenderPrimitiveLighting *self, RenderState *state, do { upper_counter++; upper_block = get_data(state, BLOCKS, x, y + upper_counter, z); - } while (upper_block == 44 || upper_block == 53 || upper_block == 67 || upper_block == 108 || - upper_block == 109 || upper_block == 114 || upper_block == 128 || upper_block == 134 || - upper_block == 135 || upper_block == 136 || upper_block == 156 || upper_block == 163 || - upper_block == 164 || upper_block == 180 || upper_block == 182 || upper_block == 203 || upper_block == 205); + } while (upper_block == block_stone_slab || upper_block == block_oak_stairs || upper_block == block_stone_stairs || upper_block == block_brick_stairs || + upper_block == block_stone_brick_stairs || upper_block == block_nether_brick_stairs || upper_block == block_sandstone_stairs || upper_block == block_spruce_stairs || + upper_block == block_birch_stairs || upper_block == block_jungle_stairs || upper_block == block_quartz_stairs || upper_block == block_acacia_stairs || + upper_block == block_dark_oak_stairs || upper_block == block_red_sandstone_stairs || upper_block == block_stone_slab2 || upper_block == block_purpur_stairs || upper_block == block_purpur_slab ); if (is_transparent(upper_block)) { skylevel = get_data(state, SKYLIGHT, x, y + upper_counter, z); } else { @@ -186,7 +187,7 @@ get_lighting_color(RenderPrimitiveLighting *self, RenderState *state, } - if (block == 10 || block == 11) { + if (block == block_flowing_lava || block == block_lava) { /* lava blocks should always be lit! */ *r = 255; *g = 255; @@ -305,7 +306,7 @@ lighting_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyO self = (RenderPrimitiveLighting *)data; x = state->x, y = state->y, z = state->z; - if ((state->block == 8) || (state->block == 9)) { /* special case for water */ + if ((state->block == block_flowing_water) || (state->block == block_water)) { /* special case for water */ /* looks like we need a new case for lighting, there are * blocks that are transparent for occlusion calculations and * need per-face shading if the face is drawn. */ diff --git a/overviewer_core/src/primitives/nether.c b/overviewer_core/src/primitives/nether.c index c086dd8..407be7c 100644 --- a/overviewer_core/src/primitives/nether.c +++ b/overviewer_core/src/primitives/nether.c @@ -16,6 +16,7 @@ */ #include "../overviewer.h" +#include "../mc_id.h" #include "nether.h" static void @@ -26,16 +27,16 @@ walk_chunk(RenderState *state, RenderPrimitiveNether *data) { for (x = -1; x < WIDTH + 1; x++) { for (z = -1; z < DEPTH + 1; z++) { id = get_data(state, BLOCKS, x, NETHER_ROOF - (state->chunky * 16), z); - if (id == 7) { + if (id == block_bedrock) { data->remove_block[x+1][NETHER_ROOF][z+1] = 1; id = get_data(state, BLOCKS, x, (NETHER_ROOF + 1) - (state->chunky * 16), z); - if (id == 39 || id == 40) + if (id == block_brown_mushroom || id == block_red_mushroom) data->remove_block[x+1][NETHER_ROOF + 1][z+1] = 1; } for (y = NETHER_ROOF-1; y>=0; y--) { id = get_data(state, BLOCKS, x, y - (state->chunky * 16), z); - if (id == 7 || id == 87 || id == 153 || id == 11) + if (id == block_bedrock || id == block_netherrack || id == block_quartz_ore || id == block_lava) data->remove_block[x+1][y][z+1] = 1; else break; diff --git a/overviewer_core/src/primitives/overlay-mineral.c b/overviewer_core/src/primitives/overlay-mineral.c index d831419..e7cd203 100644 --- a/overviewer_core/src/primitives/overlay-mineral.c +++ b/overviewer_core/src/primitives/overlay-mineral.c @@ -16,6 +16,7 @@ */ #include "overlay.h" +#include "../mc_id.h" typedef struct { /* inherits from overlay */ @@ -31,17 +32,17 @@ struct MineralColor { /* put more valuable ores first -- they take precedence */ static struct MineralColor default_minerals[] = { - {48 /* Mossy Stone */, 31, 153, 9}, + {block_mossy_cobblestone, 31, 153, 9}, - {56 /* Diamond Ore */, 32, 230, 220}, + {block_diamond_ore, 32, 230, 220}, - {21 /* Lapis Lazuli */, 0, 23, 176}, - {14 /* Gold Ore */, 255, 234, 0}, + {block_lapis_ore, 0, 23, 176}, + {block_gold_ore, 255, 234, 0}, - {15 /* Iron Ore */, 204, 204, 204}, - {73 /* Redstone */, 186, 0, 0}, - {74 /* Lit Redstone */, 186, 0, 0}, - {16 /* Coal Ore */, 54, 54, 54}, + {block_iron_ore, 204, 204, 204}, + {block_redstone_ore, 186, 0, 0}, + {block_lit_redstone_ore, 186, 0, 0}, + {block_coal_ore, 54, 54, 54}, /* end of list marker */ {0, 0, 0, 0} @@ -61,7 +62,7 @@ static void get_color(void *data, RenderState *state, int i, tmp; unsigned short blockid = get_data(state, BLOCKS, x, y, z); - for (i = 0; (max_i == -1 || i < max_i) && minerals[i].blockid != 0; i++) { + for (i = 0; (max_i == -1 || i < max_i) && minerals[i].blockid != block_air; i++) { if (minerals[i].blockid == blockid) { *r = minerals[i].r; *g = minerals[i].g; diff --git a/overviewer_core/src/primitives/overlay-structure.c b/overviewer_core/src/primitives/overlay-structure.c index b0292cb..bc4a7cf 100644 --- a/overviewer_core/src/primitives/overlay-structure.c +++ b/overviewer_core/src/primitives/overlay-structure.c @@ -16,6 +16,7 @@ */ #include "overlay.h" +#include "../mc_id.h" typedef enum { false, true } bool; diff --git a/overviewer_core/src/primitives/overlay.c b/overviewer_core/src/primitives/overlay.c index ff7ce75..8fce0bc 100644 --- a/overviewer_core/src/primitives/overlay.c +++ b/overviewer_core/src/primitives/overlay.c @@ -16,6 +16,7 @@ */ #include "overlay.h" +#include "../mc_id.h" static void get_color(void *data, RenderState *state, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a) { @@ -85,9 +86,9 @@ overlay_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyOb // exactly analogous to edge-line code for these special blocks int increment=0; - if (state->block == 44) // half-step + if (state->block == block_stone_slab) // half-step increment=6; - else if (state->block == 78) // snow + else if (state->block == block_snow_layer) // snow increment=9; /* skip rendering the overlay if we can't see it */ diff --git a/overviewer_core/src/primitives/smooth-lighting.c b/overviewer_core/src/primitives/smooth-lighting.c index e8cd369..fb28be6 100644 --- a/overviewer_core/src/primitives/smooth-lighting.c +++ b/overviewer_core/src/primitives/smooth-lighting.c @@ -16,6 +16,7 @@ */ #include "../overviewer.h" +#include "../mc_id.h" #include "lighting.h" #include @@ -218,7 +219,7 @@ smooth_lighting_draw(void *data, RenderState *state, PyObject *src, PyObject *ma /* special case for leaves, water 8, water 9, ice 79 -- these are also smooth-lit! */ - if (state->block != 18 && state->block != 8 && state->block != 9 && state->block != 79 && is_transparent(state->block)) + if (state->block != block_leaves && state->block != block_flowing_water && state->block != block_water && state->block != block_ice && is_transparent(state->block)) { /* transparent blocks are rendered as usual, with flat lighting */ primitive_lighting.draw(data, state, src, mask, mask_light); @@ -228,7 +229,7 @@ smooth_lighting_draw(void *data, RenderState *state, PyObject *src, PyObject *ma /* non-transparent blocks get the special smooth treatment */ /* special code for water */ - if (state->block == 9) + if (state->block == block_water) { if (!(state->block_pdata & (1 << 4))) light_top = 0;