From fd63f251c53ce15fd2e70efe97abca2f8316461d Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Thu, 9 Aug 2018 13:33:12 +0500 Subject: Workaround for liquids --- cwd/assets/minecraft/blockstates/lava.json | 5 +++++ cwd/assets/minecraft/blockstates/water.json | 5 +++++ cwd/assets/minecraft/models/block/lava.json | 6 ++++++ cwd/assets/minecraft/models/block/water.json | 6 ++++++ src/AssetManager.cpp | 4 ++++ src/Block.cpp | 8 ++++++++ 6 files changed, 34 insertions(+) create mode 100644 cwd/assets/minecraft/blockstates/lava.json create mode 100644 cwd/assets/minecraft/blockstates/water.json create mode 100644 cwd/assets/minecraft/models/block/lava.json create mode 100644 cwd/assets/minecraft/models/block/water.json diff --git a/cwd/assets/minecraft/blockstates/lava.json b/cwd/assets/minecraft/blockstates/lava.json new file mode 100644 index 0000000..97b01d3 --- /dev/null +++ b/cwd/assets/minecraft/blockstates/lava.json @@ -0,0 +1,5 @@ +{ + "variants": { + "normal": { "model": "lava" } + } +} diff --git a/cwd/assets/minecraft/blockstates/water.json b/cwd/assets/minecraft/blockstates/water.json new file mode 100644 index 0000000..683334a --- /dev/null +++ b/cwd/assets/minecraft/blockstates/water.json @@ -0,0 +1,5 @@ +{ + "variants": { + "normal": { "model": "water" } + } +} diff --git a/cwd/assets/minecraft/models/block/lava.json b/cwd/assets/minecraft/models/block/lava.json new file mode 100644 index 0000000..714d0b2 --- /dev/null +++ b/cwd/assets/minecraft/models/block/lava.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "blocks/lava_flow" + } +} diff --git a/cwd/assets/minecraft/models/block/water.json b/cwd/assets/minecraft/models/block/water.json new file mode 100644 index 0000000..860815a --- /dev/null +++ b/cwd/assets/minecraft/models/block/water.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "blocks/water_flow" + } +} diff --git a/src/AssetManager.cpp b/src/AssetManager.cpp index 97833f5..5fa7990 100644 --- a/src/AssetManager.cpp +++ b/src/AssetManager.cpp @@ -455,6 +455,10 @@ void ParseBlockModels() { } textureName.insert(0, "minecraft/textures/"); texture = AssetManager::GetTexture(textureName); + if (textureName.find("water_flow") != std::string::npos) + texture.h /= 32.0f; + if (textureName.find("lava_flow") != std::string::npos) + texture.h /= 16.0f; if (!(face.second.uv == BlockModel::ElementData::FaceData::Uv{ 0,16,0,16 }) && !(face.second.uv == BlockModel::ElementData::FaceData::Uv{ 0,0,0,0 }) && !(face.second.uv == BlockModel::ElementData::FaceData::Uv{ 0,0,16,16 })) { diff --git a/src/Block.cpp b/src/Block.cpp index 6756960..3de1901 100644 --- a/src/Block.cpp +++ b/src/Block.cpp @@ -44,6 +44,14 @@ std::pair TransformBlockIdToBlockStateName(BlockId blo }; return ids[blockId.state]; } + case 8: + case 9: { + return std::make_pair("water", "normal"); + } + case 10: + case 11: { + return std::make_pair("lava", "normal"); + } case 12: { if (blockId.state > 1) break; -- cgit v1.2.3