summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-08-05 16:07:59 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-08-05 16:07:59 +0200
commitfc0ad97b585a5d3ecab6b2c72473689d7e7bfb9f (patch)
treebe4c557e52a9972142295bea37670ceb0fafcd81
parentRefactored AssetManager (diff)
downloadAltCraft-fc0ad97b585a5d3ecab6b2c72473689d7e7bfb9f.tar
AltCraft-fc0ad97b585a5d3ecab6b2c72473689d7e7bfb9f.tar.gz
AltCraft-fc0ad97b585a5d3ecab6b2c72473689d7e7bfb9f.tar.bz2
AltCraft-fc0ad97b585a5d3ecab6b2c72473689d7e7bfb9f.tar.lz
AltCraft-fc0ad97b585a5d3ecab6b2c72473689d7e7bfb9f.tar.xz
AltCraft-fc0ad97b585a5d3ecab6b2c72473689d7e7bfb9f.tar.zst
AltCraft-fc0ad97b585a5d3ecab6b2c72473689d7e7bfb9f.zip
-rw-r--r--cwd/assets/minecraft/models/block/error.json6
-rw-r--r--cwd/assets/minecraft/textures/error.pngbin0 -> 204 bytes
-rw-r--r--src/AssetManager.cpp8
3 files changed, 10 insertions, 4 deletions
diff --git a/cwd/assets/minecraft/models/block/error.json b/cwd/assets/minecraft/models/block/error.json
new file mode 100644
index 0000000..5f65abe
--- /dev/null
+++ b/cwd/assets/minecraft/models/block/error.json
@@ -0,0 +1,6 @@
+{
+ "parent": "block/cube_all",
+ "textures": {
+ "all": "error"
+ }
+}
diff --git a/cwd/assets/minecraft/textures/error.png b/cwd/assets/minecraft/textures/error.png
new file mode 100644
index 0000000..fcf40ae
--- /dev/null
+++ b/cwd/assets/minecraft/textures/error.png
Binary files differ
diff --git a/src/AssetManager.cpp b/src/AssetManager.cpp
index 6a4b3a3..aaa71ed 100644
--- a/src/AssetManager.cpp
+++ b/src/AssetManager.cpp
@@ -400,13 +400,13 @@ void ParseBlockModels() {
TextureCoord texture;
textureName = face.second.texture;
if (model.Textures.empty()) {
- texture = AssetManager::GetTexture("minecraft/texture/blocks/tnt_side");
+ texture = AssetManager::GetTexture("minecraft/textures/error");
}
else {
while (textureName[0] == '#') {
textureName.erase(0, 1);
auto textureIt = model.Textures.find(textureName);
- textureName = textureIt != model.Textures.end() ? textureIt->second : "minecraft/texture/blocks/tnt_side";
+ textureName = textureIt != model.Textures.end() ? textureIt->second : "minecraft/textures/error";
}
textureName.insert(0, "minecraft/textures/");
texture = AssetManager::GetTexture(textureName);
@@ -481,7 +481,7 @@ const BlockModel *AssetManager::GetBlockModelByBlockId(BlockId block) {
std::string blockName = blockIdToBlockName[block];
AssetBlockModel *model = GetAsset<AssetBlockModel>("/minecraft/models/" + blockName);
- return (model == nullptr) ? &GetAsset<AssetBlockModel>("/minecraft/models/block/diamond_block")->blockModel : &model->blockModel;
+ return (model == nullptr) ? &GetAsset<AssetBlockModel>("/minecraft/models/block/error")->blockModel : &model->blockModel;
}
std::string AssetManager::GetAssetNameByBlockId(BlockId block) {
@@ -546,6 +546,6 @@ GLuint AssetManager::GetTextureAtlasId()
TextureCoord AssetManager::GetTexture(const std::string assetName) {
AssetTexture *asset = GetAsset<AssetTexture>(assetName);
if (!asset)
- return {};
+ return GetTexture("/minecraft/textures/error");
return atlas->GetTexture(asset->id);
}