diff options
-rw-r--r-- | src/Block.cpp | 220 | ||||
-rw-r--r-- | src/World.cpp | 2 |
2 files changed, 218 insertions, 4 deletions
diff --git a/src/Block.cpp b/src/Block.cpp index 56fa371..6756960 100644 --- a/src/Block.cpp +++ b/src/Block.cpp @@ -53,6 +53,18 @@ std::pair<std::string, std::string> TransformBlockIdToBlockStateName(BlockId blo }; return ids[blockId.state]; } + case 13: { + return std::make_pair("gravel", "normal"); + } + case 14: { + return std::make_pair("gold_ore", "normal"); + } + case 15: { + return std::make_pair("iron_ore", "normal"); + } + case 16: { + return std::make_pair("coal_ore", "normal"); + } case 17: { unsigned char type = blockId.state & 0x3; unsigned char dir = (blockId.state & 0xC) >> 2; @@ -79,6 +91,12 @@ std::pair<std::string, std::string> TransformBlockIdToBlockStateName(BlockId blo }; return ids[blockId.state & 0x3]; } + case 20: { + return std::make_pair("glass", "normal"); + } + case 21: { + return std::make_pair("lapis_ore", "normal"); + } case 31: { if (blockId.state > 2) break; @@ -103,6 +121,7 @@ std::pair<std::string, std::string> TransformBlockIdToBlockStateName(BlockId blo std::pair<std::string,std::string>("cyan_wool", "normal"), std::pair<std::string,std::string>("purple_wool", "normal"), std::pair<std::string,std::string>("blue_wool", "normal"), + std::pair<std::string,std::string>("brown_wool", "normal"), std::pair<std::string,std::string>("green_wool", "normal"), std::pair<std::string,std::string>("red_wool", "normal"), std::pair<std::string,std::string>("black_wool", "normal"), @@ -119,7 +138,7 @@ std::pair<std::string, std::string> TransformBlockIdToBlockStateName(BlockId blo std::pair<std::string,std::string>("poppy", "normal"), std::pair<std::string,std::string>("blue_orchid", "normal"), std::pair<std::string,std::string>("allium", "normal"), - std::pair<std::string,std::string>("Azure Bluet", "normal"), + std::pair<std::string,std::string>("houstonia", "normal"), std::pair<std::string,std::string>("red_tulip", "normal"), std::pair<std::string,std::string>("orange_tulip", "normal"), std::pair<std::string,std::string>("white_tulip", "normal"), @@ -128,17 +147,206 @@ std::pair<std::string, std::string> TransformBlockIdToBlockStateName(BlockId blo }; return ids[blockId.state]; } + case 39: { + return std::make_pair("brown_mushroom","normal"); + } + case 44: { + return std::make_pair("stone_slab", "half=" + std::string(!(blockId.state >> 3) ? "bottom" : "top")); + } + case 46: { + return std::make_pair("tnt", "normal"); + } + case 48: { + return std::make_pair("mossy_cobblestone", "normal"); + } + case 49: { + return std::make_pair("obsidian", "normal"); + } + case 50: { + if (blockId.state > 5) + break; + static const std::pair<std::string, std::string> ids[] = { + std::pair<std::string,std::string>("", ""), + std::pair<std::string,std::string>("torch", "facing=east"), + std::pair<std::string,std::string>("torch", "facing=west"), + std::pair<std::string,std::string>("torch", "facing=south"), + std::pair<std::string,std::string>("torch", "facing=north"), + std::pair<std::string,std::string>("torch", "facing=up"), + }; + return ids[blockId.state]; + } + case 53: { + bool isUp = blockId.state >> 2; + unsigned char dir = blockId.state & 0x3; + static const std::string dirs[] = { + "facing=east,half=", + "facing=west,half=", + "facing=south,half=", + "facing=north,half=", + }; + + return std::make_pair("oak_stairs", dirs[dir] + (isUp? "top" : "bottom") +",shape=straight"); + } + case 59: { + return std::make_pair("wheat", "age=" + std::to_string(blockId.state)); + } + case 60: { + return std::make_pair("farmland", "moisture=" + std::to_string(7 - blockId.state)); + } + case 61: { + static const std::string dirs[] = { + "", + "", + "facing=north", + "facing=south", + "facing=west", + "facing=east", + }; + return std::make_pair("furnace", dirs[blockId.state]); + } + case 64: { + bool isUp = !(blockId.state >> 3); + bool hingeIsLeft = true; + bool isOpen = 0; + unsigned char dir = 0; + if (isUp) + hingeIsLeft = blockId.state & 0x1; + else { + isOpen = (blockId.state >> 1) & 0x1; + dir = blockId.state >> 2; + } + static const std::string dirs[] = { + "east", + "south", + "west", + "north", + }; + + return std::make_pair("wooden_door", "facing=" + dirs[dir] + ",half=" + (isUp ? "upper" : "lower") + ",hinge=" + (hingeIsLeft ? "left" : "right") + ",open=" + (isOpen ? "true" : "false")); + } + case 67: { + bool isUp = blockId.state >> 2; + unsigned char dir = blockId.state & 0x3; + static const std::string dirs[] = { + "facing=east,half=", + "facing=west,half=", + "facing=south,half=", + "facing=north,half=", + }; + + return std::make_pair("stone_stairs", dirs[dir] + (isUp ? "top" : "bottom") + ",shape=straight"); + } + case 69: { + bool isActive = blockId.state >> 3; + static const std::string types[] = { + "facing=down_x", + "facing=east", + "facing=west", + "facing=south", + "facing=north", + "facing=up_z", + "facing=up_x", + "facing=down_z", + }; + + return std::make_pair("lever", types[blockId.state & 0x7] + ",powered=" + (isActive ? "true" : "false")); + } + case 78: { + if (blockId.state > 7) + break; + static const std::pair<std::string, std::string> ids[] = { + std::pair<std::string,std::string>("snow_layer", "layers=1"), + std::pair<std::string,std::string>("snow_layer", "layers=2"), + std::pair<std::string,std::string>("snow_layer", "layers=3"), + std::pair<std::string,std::string>("snow_layer", "layers=4"), + std::pair<std::string,std::string>("snow_layer", "layers=5"), + std::pair<std::string,std::string>("snow_layer", "layers=6"), + std::pair<std::string,std::string>("snow_layer", "layers=7"), + std::pair<std::string,std::string>("snow_layer", "layers=8"), + }; + return ids[blockId.state]; + } + case 79: { + return std::make_pair("ice", "normal"); + } + case 83: { + return std::make_pair("reeds", "normal"); + } + case 86: { + if (blockId.state > 3) + break; + static const std::pair<std::string, std::string> ids[] = { + std::pair<std::string,std::string>("pumpkin", "facing=south"), + std::pair<std::string,std::string>("pumpkin", "facing=west"), + std::pair<std::string,std::string>("pumpkin", "facing=north"), + std::pair<std::string,std::string>("pumpkin", "facing=east"), + }; + return ids[blockId.state]; + } + case 89: { + return std::make_pair("glowstone", "normal"); + } + case 93: { + static const std::string dirs[] = { + "east", + "south", + "west", + "north", + }; + unsigned char dir = blockId.state & 0x3; + unsigned char delay = (blockId.state >> 2) + 1; + return std::make_pair("unpowered_repeater", "delay=" + std::to_string(delay) + ",facing=" + dirs[dir] + ",locked=false"); + } + case 94: { + static const std::string dirs[] = { + "east", + "south", + "west", + "north", + }; + unsigned char dir = blockId.state & 0x3; + unsigned char delay = (blockId.state >> 2) + 1; + return std::make_pair("powered_repeater", "delay=" + std::to_string(delay) + ",facing=" + dirs[dir] + ",locked=false"); + } + case 106: { + static const std::string values[] = { + "false", + "true", + }; + return std::make_pair("vine", "east=" + values[(blockId.state >> 3) & 0x1] + ",north=" + values[(blockId.state >> 2) & 0x1] + ",south=" + values[blockId.state & 0x1] + ",up=" + values[blockId.state == 0] + ",west=" + values[(blockId.state >> 1) & 0x1]); + } + case 111: { + return std::make_pair("waterlily", "normal"); + } + case 141: { + return std::make_pair("carrots", "age=" + std::to_string(blockId.state)); + } + case 142: { + return std::make_pair("potatoes", "age=" + std::to_string(blockId.state)); + } + case 149: { + static const std::string dirs[] = { + "east", + "south", + "west", + "north", + }; + unsigned char dir = blockId.state & 0x3; + bool substractMode = (blockId.state >> 2) & 0x1; + bool isPowered = blockId.state >> 3; + return std::make_pair("unpowered_comparator", "facing=" + dirs[dir] + ",mode=" + (substractMode ? "subtract" : "compare") + ",powered=" + (isPowered ? "true" : "false")); + } case 175: { bool high = ((blockId.state >> 3) & 0x1); unsigned char type = blockId.state & 0x7; static const std::string types[] = { "sunflower", - "Lilac", + "syringa", "double_grass", "double_fern", "double_rose", - "Peony", + "paeonia", }; static const std::string isHigh[] = { @@ -147,6 +355,12 @@ std::pair<std::string, std::string> TransformBlockIdToBlockStateName(BlockId blo }; return std::make_pair(types[type], isHigh[high]); } + case 207: { + return std::make_pair("beetroots", "age=" + std::to_string(blockId.state)); + } + case 208: { + return std::make_pair("grass_path", "normal"); + } default: break; } diff --git a/src/World.cpp b/src/World.cpp index 251890b..9c66bc3 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -187,7 +187,7 @@ void World::UpdatePhysics(float delta) { for (int z = blockZBegin; z <= blockZEnd; z++) { for (int x = blockXBegin; x <= blockXEnd; x++) { BlockId block = this->GetBlockId(Vector(x, y, z)); - if (block.id == 0 || block.id == 31 || block.id == 37 || block.id == 38 || block.id == 175) + if (block.id == 0 || block.id == 31 || block.id == 37 || block.id == 38 || block.id == 175 || block.id == 78) continue; AABB blockColl{ x,y,z,1.0,1.0,1.0 }; if (TestCollision(entityCollBox, blockColl)) { |