diff --git a/source/Base/Utils.hpp b/source/Base/Utils.hpp index 5b48dbb..a47deda 100644 --- a/source/Base/Utils.hpp +++ b/source/Base/Utils.hpp @@ -131,7 +131,7 @@ enum eTileID TILE_SPONGE, TILE_GLASS, TILE_ORE_LAPIS, - + TILE_BLOCK_LAPIS, TILE_SANDSTONE = 24, TILE_CLOTH = 35, @@ -140,15 +140,15 @@ enum eTileID TILE_ROSE, TILE_MUSHROOM_1, TILE_MUSHROOM_2, - - TILE_BLOCK_GOLD = 41, + TILE_BLOCK_GOLD, TILE_BLOCK_IRON, TILE_STONESLAB_FULL, TILE_STONESLAB_HALF, TILE_BRICKS, TILE_TNT, - - TILE_OBSIDIAN = 49, + TILE_BOOKSHELF, + TILE_MOSS_STONE, + TILE_OBSIDIAN, TILE_TORCH, TILE_FIRE, @@ -431,6 +431,7 @@ enum // Textures TEXTURE_NONE126, TEXTURE_NONE127, + TEXTURE_LAPIS = 144, TEXTURE_ORE_LAPIS = 160, TEXTURE_SANDSTONE_TOP = 176, diff --git a/source/Inventory.cpp b/source/Inventory.cpp index 53a9343..96aa305 100644 --- a/source/Inventory.cpp +++ b/source/Inventory.cpp @@ -153,8 +153,8 @@ Inventory::Inventory(Player* pPlayer) m_items[38] = Item::door_wood->m_itemID; m_items[39] = Tile::gravel->m_ID; m_items[40] = Tile::cloth->m_ID; - m_items[41] = Tile::clay->m_ID; - m_items[42] = Tile::farmland->m_ID; + m_items[41] = Tile::mossStone->m_ID; + m_items[42] = Tile::bookshelf->m_ID; m_items[43] = Tile::sponge->m_ID; m_items[44] = Tile::sapling->m_ID; #endif diff --git a/source/World/Tile/BookshelfTile.cpp b/source/World/Tile/BookshelfTile.cpp new file mode 100644 index 0000000..d85d03e --- /dev/null +++ b/source/World/Tile/BookshelfTile.cpp @@ -0,0 +1,34 @@ +/******************************************************************** + Minecraft: Pocket Edition - Decompilation Project + Copyright (C) 2023 iProgramInCpp + + The following code is licensed under the BSD 1 clause license. + SPDX-License-Identifier: BSD-1-Clause + ********************************************************************/ + +#include "Tile.hpp" +#include "Level.hpp" + +BookshelfTile::BookshelfTile(int a, int b, Material* c) : Tile(a, b, c) +{ +} + +int BookshelfTile::getTexture(int dir) +{ + if (dir <= DIR_YPOS) + return TEXTURE_PLANKS; + + return m_TextureFrame; +} + +int BookshelfTile::getResource(int data, Random* random) +{ + return 0; // would be Book +} + +int BookshelfTile::getResourceCount(Random* random) +{ + return 3; +} + + diff --git a/source/World/Tile/Tile.cpp b/source/World/Tile/Tile.cpp index 09891cb..72db6bc 100644 --- a/source/World/Tile/Tile.cpp +++ b/source/World/Tile/Tile.cpp @@ -620,6 +620,26 @@ void Tile::initTiles() ->setSoundType(Tile::SOUND_CLOTH) ->setDescriptionId("sponge"); + Tile::lapisBlock = (new MetalTile(TILE_BLOCK_LAPIS, TEXTURE_LAPIS, Material::metal)) + ->init() + ->setDestroyTime(3.0f) + ->setExplodeable(10.0f) + ->setSoundType(Tile::SOUND_METAL) + ->setDescriptionId("blockLapis"); + + Tile::bookshelf = (new BookshelfTile(TILE_BOOKSHELF, TEXTURE_BOOKSHELF, Material::wood)) + ->init() + ->setDestroyTime(1.5f) + ->setSoundType(Tile::SOUND_WOOD) + ->setDescriptionId("bookshelf"); + + Tile::mossStone = (new Tile(TILE_MOSS_STONE, TEXTURE_MOSSY_STONE, Material::stone)) + ->init() + ->setDestroyTime(2.0f) + ->setExplodeable(10.0f) + ->setSoundType(Tile::SOUND_STONE) + ->setDescriptionId("stoneMoss"); + for (int i = 0; i < C_MAX_TILES; i++) { if (Tile::tiles[i]) @@ -1228,4 +1248,7 @@ Tile *Tile::door_wood, *Tile::door_iron, *Tile::sapling, - *Tile::sponge; + *Tile::sponge, + *Tile::lapisBlock, + *Tile::bookshelf, + *Tile::mossStone; diff --git a/source/World/Tile/Tile.hpp b/source/World/Tile/Tile.hpp index 9194fe7..64de897 100644 --- a/source/World/Tile/Tile.hpp +++ b/source/World/Tile/Tile.hpp @@ -201,7 +201,10 @@ public: // static variables * door_iron, // custom additions here * sapling, - * sponge; + * sponge, + * lapisBlock, + * bookshelf, + * mossStone; public: int m_TextureFrame = 1; @@ -773,3 +776,13 @@ public: void onPlace(Level*, int x, int y, int z) override; void destroy(Level*, int x, int y, int z, int dir) override; }; + +class BookshelfTile : public Tile +{ +public: + BookshelfTile(int ID, int texture, Material*); + + int getTexture(int dir) override; + int getResource(int data, Random* random) override; + int getResourceCount(Random* random) override; +}; diff --git a/windows_vs/minecraftcpp.vcxproj b/windows_vs/minecraftcpp.vcxproj index 800f9b3..0b7a6a1 100644 --- a/windows_vs/minecraftcpp.vcxproj +++ b/windows_vs/minecraftcpp.vcxproj @@ -489,6 +489,7 @@ + diff --git a/windows_vs/minecraftcpp.vcxproj.filters b/windows_vs/minecraftcpp.vcxproj.filters index e01d59d..35d8b5b 100644 --- a/windows_vs/minecraftcpp.vcxproj.filters +++ b/windows_vs/minecraftcpp.vcxproj.filters @@ -1077,6 +1077,15 @@ Source Files\World\Renderer\Entity + + Source Files + + + Source Files + + + Source Files\World\Tile +