* Add bookshelves and mossy stone.

This commit is contained in:
iProgramInCpp
2023-08-03 23:18:17 +03:00
parent 139062625c
commit 7c83a4d6aa
7 changed files with 90 additions and 9 deletions

View File

@@ -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,

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;
};

View File

@@ -489,6 +489,7 @@
<ClCompile Include="..\source\World\Storage\MemoryLevelStorage.cpp" />
<ClCompile Include="..\source\World\Storage\MemoryLevelStorageSource.cpp" />
<ClCompile Include="..\source\World\TickNextTickData.cpp" />
<ClCompile Include="..\source\World\Tile\BookshelfTile.cpp" />
<ClCompile Include="..\source\World\Tile\Bush.cpp" />
<ClCompile Include="..\source\World\Tile\ClayTile.cpp" />
<ClCompile Include="..\source\World\Tile\ClothTile.cpp" />

View File

@@ -1077,6 +1077,15 @@
<ClCompile Include="..\source\World\Renderer\ItemSpriteRenderer.cpp">
<Filter>Source Files\World\Renderer\Entity</Filter>
</ClCompile>
<ClCompile Include="..\source\World\Tile\Sapling.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\source\World\Tile\SpongeTile.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\source\World\Tile\BookshelfTile.cpp">
<Filter>Source Files\World\Tile</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\source\Options.hpp">