From 6f68cf0a20bac92af0256f092c3093d60344e7a2 Mon Sep 17 00:00:00 2001 From: DrPerkyLegit Date: Sat, 23 May 2026 10:28:01 -0400 Subject: [PATCH] slabs, fences, doors from TU25 --- Minecraft.Client/Common/BuildVer.h | 6 +- Minecraft.Client/Common/Tutorial/Tutorial.cpp | 2 +- Minecraft.World/DoorTile.cpp | 28 +-- Minecraft.World/DoorTile.h | 6 +- Minecraft.World/HalfSlabTile.cpp | 228 ++++++++++-------- Minecraft.World/HalfSlabTile.h | 70 ++++-- Minecraft.World/PineFeature.cpp | 2 +- Minecraft.World/Recipes.cpp | 10 +- Minecraft.World/ScatteredFeaturePieces.cpp | 14 +- Minecraft.World/SpruceFeature.cpp | 2 +- Minecraft.World/StoneSlabTile.cpp | 104 ++++---- Minecraft.World/StoneSlabTile.h | 60 +++-- Minecraft.World/Tile.cpp | 63 ++++- Minecraft.World/Tile.h | 25 +- Minecraft.World/TreeTile.cpp | 14 +- Minecraft.World/TreeTile.h | 5 +- Minecraft.World/WoodSlabTile.cpp | 51 ++-- Minecraft.World/WoodSlabTile.h | 50 ++-- Minecraft.World/WoodTile.cpp | 4 +- Minecraft.World/WoodTile.h | 2 +- 20 files changed, 434 insertions(+), 312 deletions(-) diff --git a/Minecraft.Client/Common/BuildVer.h b/Minecraft.Client/Common/BuildVer.h index a5a9494..f099909 100644 --- a/Minecraft.Client/Common/BuildVer.h +++ b/Minecraft.Client/Common/BuildVer.h @@ -1,7 +1,7 @@ #pragma once -#define VER_PRODUCTBUILD 560 -#define VER_PRODUCTVERSION_STR_W L"" +#define VER_PRODUCTBUILD 570 +#define VER_PRODUCTVERSION_STR_W L"e2a698d-dev" #define VER_FILEVERSION_STR_W VER_PRODUCTVERSION_STR_W -#define VER_BRANCHVERSION_STR_W L"UNKNOWN/" +#define VER_BRANCHVERSION_STR_W L"DrPerkyLegit/LCEServerTest/main" #define VER_NETWORK VER_PRODUCTBUILD diff --git a/Minecraft.Client/Common/Tutorial/Tutorial.cpp b/Minecraft.Client/Common/Tutorial/Tutorial.cpp index de8ed34..67155b7 100644 --- a/Minecraft.Client/Common/Tutorial/Tutorial.cpp +++ b/Minecraft.Client/Common/Tutorial/Tutorial.cpp @@ -508,7 +508,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) if(!isHintCompleted(e_Tutorial_Hint_Stone_Slab)) { addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, woodSlabItems, 2, -1, TreeTile::BIRCH_TRUNK ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, woodSlabItems, 2, -1, TreeTile::DARK_TRUNK ) ); + addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, woodSlabItems, 2, -1, TreeTile::SPRUCE_TRUNK ) ); } int redBrickItems[] = {Tile::redBrick_Id}; diff --git a/Minecraft.World/DoorTile.cpp b/Minecraft.World/DoorTile.cpp index 8b70e6d..300f4e3 100644 --- a/Minecraft.World/DoorTile.cpp +++ b/Minecraft.World/DoorTile.cpp @@ -8,18 +8,19 @@ #include "net.minecraft.world.h" #include "net.minecraft.h" -const wstring DoorTile::TEXTURES[] = { L"doorWood_lower", L"doorWood_upper", L"doorIron_lower", L"doorIron_upper" }; +static std::map doorItemMap = { + { L"doorWood", Item::door_wood_Id }, + { L"doorIron", Item::door_iron_Id }, + { L"doorSpruce", Item::door_spruce_Id }, + { L"doorBirch", Item::door_birch_Id }, + { L"doorJungle", Item::door_jungle_Id }, + { L"doorAcacia", Item::door_acacia_Id }, + { L"doorDark", Item::door_dark_Id } +}; -DoorTile::DoorTile(int id, Material *material) : Tile(id, material,isSolidRender()) +DoorTile::DoorTile(int id, Material *material, const wstring& doorType) : Tile(id, material,isSolidRender()) { - if (material == Material::metal) - { - texBase = 2; - } - else - { - texBase = 0; - } + this->doorType = doorType; float r = 0.5f; float h = 1.0f; @@ -247,7 +248,7 @@ void DoorTile::neighborChanged(Level *level, int x, int y, int z, int type) level->removeTile(x, y, z); spawn = true; } - if (!level->isSolidBlockingTile(x, y - 1, z)) + if (!level->isTopSolidBlocking(x, y - 1, z)) { level->removeTile(x, y, z); spawn = true; @@ -288,8 +289,7 @@ void DoorTile::neighborChanged(Level *level, int x, int y, int z, int type) int DoorTile::getResource(int data, Random *random, int playerBonusLevel) { if ((data & 8) != 0) return 0; - if (material == Material::metal) return Item::door_iron->id; - return Item::door_wood->id; + return doorItemMap[doorType]; } HitResult *DoorTile::clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b) @@ -339,7 +339,7 @@ int DoorTile::getCompositeData(LevelSource *level, int x, int y, int z) int DoorTile::cloneTileId(Level *level, int x, int y, int z) { - return material == Material::metal ? Item::door_iron_Id : Item::door_wood_Id; + return doorItemMap[doorType]; } void DoorTile::playerWillDestroy(Level *level, int x, int y, int z, int data, shared_ptr player) diff --git a/Minecraft.World/DoorTile.h b/Minecraft.World/DoorTile.h index a4e4f62..bd874a7 100644 --- a/Minecraft.World/DoorTile.h +++ b/Minecraft.World/DoorTile.h @@ -22,16 +22,16 @@ public: static const int C_LOWER_DATA_MASK = 7; static const int C_IS_UPPER_MASK = 8; static const int C_RIGHT_HINGE_MASK = 16; + wstring doorType; private: static const int DOOR_TILE_TEXTURE_COUNT = 4; - static const wstring TEXTURES[]; int texBase; Icon *iconTop[2]; Icon *iconBottom[2]; protected: - DoorTile(int id, Material *material); + DoorTile(int id, Material *material, const wstring& doorType); public: virtual Icon *getTexture(int face, int data); virtual Icon *getTexture(LevelSource *level, int x, int y, int z, int face); @@ -62,4 +62,4 @@ public: int getCompositeData(LevelSource *level, int x, int y, int z); virtual int cloneTileId(Level *level, int x, int y, int z); virtual void playerWillDestroy(Level *level, int x, int y, int z, int data, shared_ptr player); -}; +}; \ No newline at end of file diff --git a/Minecraft.World/HalfSlabTile.cpp b/Minecraft.World/HalfSlabTile.cpp index 13308b9..e38b28c 100644 --- a/Minecraft.World/HalfSlabTile.cpp +++ b/Minecraft.World/HalfSlabTile.cpp @@ -1,152 +1,172 @@ #include "stdafx.h" #include "HalfSlabTile.h" #include "net.minecraft.world.level.h" -#include "net.minecraft.world.level.biome.h" -#include "net.minecraft.world.item.h" -#include "net.minecraft.stats.h" +#include "net.minecraft.world.level.tile.h" +#include "net.minecraft.h" #include "Facing.h" - -HalfSlabTile::HalfSlabTile(int id, bool fullSize, Material *material) : Tile(id, material, fullSize) +HalfSlabTile::HalfSlabTile(int id, Material *material) + : Tile(id, material, true) { - this->fullSize = fullSize; - - if (fullSize) - { - solid[id] = true; - } - else - { - setShape(0, 0, 0, 1, 0.5f, 1); - } - setLightBlock(255); + + Tile::lightBlock[id] = 0xFF; } -void HalfSlabTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void HalfSlabTile::DerivedInit() { - if (fullSize) - { - setShape(0, 0, 0, 1, 1, 1); - } - else - { - bool upper = (level->getData(x, y, z) & TOP_SLOT_BIT) != 0; - if (upper) - { - setShape(0, 0.5f, 0, 1, 1, 1); - } - else - { - setShape(0, 0, 0, 1, 0.5f, 1); - } - } + + if (!isFullSize()) + setShape(0.0f, 0.0f, 0.0f, 1.0f, 0.5f, 1.0f); + else + Tile::solid[id] = true; } -void HalfSlabTile::updateDefaultShape() +void HalfSlabTile::updateDefaultShape() { - if (fullSize) - { - setShape(0, 0, 0, 1, 1, 1); - } - else - { - setShape(0, 0, 0, 1, 0.5f, 1); - } + + if (isFullSize()) + setShape(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f); + else + setShape(0.0f, 0.0f, 0.0f, 1.0f, 0.5f, 1.0f); } -void HalfSlabTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) +void HalfSlabTile::updateShape( + LevelSource *level, int x, int y, int z, + int forceData, shared_ptr forceEntity) { - updateShape(level, x, y, z); - Tile::addAABBs(level, x, y, z, box, boxes, source); + + if (isFullSize()) + { + setShape(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f); + return; + } + + int data = (forceData >= 0) ? forceData : level->getData(x, y, z); + bool isUpper = (data & TOP_SLOT_BIT) != 0; + + if (isUpper) + setShape(0.0f, 0.5f, 0.0f, 1.0f, 1.0f, 1.0f); + else + setShape(0.0f, 0.0f, 0.0f, 1.0f, 0.5f, 1.0f); } -bool HalfSlabTile::isSolidRender(bool isServerLevel) +void HalfSlabTile::addAABBs( + Level *level, int x, int y, int z, + AABB *box, AABBList *boxes, shared_ptr source) { - return fullSize; + + updateShape(level, x, y, z); + Tile::addAABBs(level, x, y, z, box, boxes, source); } -int HalfSlabTile::getPlacedOnFaceDataValue(Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, int itemValue) +bool HalfSlabTile::isSolidRender(bool isServerLevel) { - if (fullSize) return itemValue; - - if (face == Facing::DOWN || (face != Facing::UP && clickY > 0.5)) - { - return itemValue | TOP_SLOT_BIT; - } - return itemValue; + + return isFullSize() != 0; } -int HalfSlabTile::getResourceCount(Random *random) +bool HalfSlabTile::isSilkTouchable() { - if (fullSize) - { - return 2; - } - return 1; + + return false; } -int HalfSlabTile::getSpawnResourcesAuxValue(int data) +int HalfSlabTile::getResourceCount(Random *random) { - return data & TYPE_MASK; + + return isFullSize() ? 2 : 1; } -bool HalfSlabTile::isCubeShaped() +bool HalfSlabTile::isCubeShaped() { - return fullSize; + + return isFullSize() != 0; } -bool HalfSlabTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int face) +bool HalfSlabTile::shouldRenderFace( + LevelSource *level, int x, int y, int z, int face) { - if (fullSize) return Tile::shouldRenderFace(level, x, y, z, face); + + if (isFullSize()) + return Tile::shouldRenderFace(level, x, y, z, face); - if (face != Facing::UP && face != Facing::DOWN && !Tile::shouldRenderFace(level, x, y, z, face)) - { - return false; - } + + if (face != Facing::UP && face != Facing::DOWN + && !Tile::shouldRenderFace(level, x, y, z, face)) + return false; - int ox = x, oy = y, oz = z; - ox += Facing::STEP_X[Facing::OPPOSITE_FACING[face]]; - oy += Facing::STEP_Y[Facing::OPPOSITE_FACING[face]]; - oz += Facing::STEP_Z[Facing::OPPOSITE_FACING[face]]; + int oppFace = Facing::getOpposite(face); + int nx = x, ny = y, nz = z; + + if (oppFace == Facing::DOWN) ny--; + if (oppFace == Facing::UP) ny++; + if (oppFace == Facing::NORTH) nz--; + if (oppFace == Facing::SOUTH) nz++; + if (oppFace == Facing::WEST) nx--; + if (oppFace == Facing::EAST) nx++; - boolean isUpper = (level->getData(ox, oy, oz) & TOP_SLOT_BIT) != 0; - if (isUpper) - { - if (face == Facing::DOWN) return true; - if (face == Facing::UP && Tile::shouldRenderFace(level, x, y, z, face)) return true; - return !(isHalfSlab(level->getTile(x, y, z)) && (level->getData(x, y, z) & TOP_SLOT_BIT) != 0); - } - else - { - if (face == Facing::UP) return true; - if (face == Facing::DOWN && Tile::shouldRenderFace(level, x, y, z, face)) return true; - return !(isHalfSlab(level->getTile(x, y, z)) && (level->getData(x, y, z) & TOP_SLOT_BIT) == 0); - } + int currentData = level->getData(x, y, z); + int neighborData = level->getData(nx, ny, nz); + int currentTile = level->getTile(x, y, z); + int neighborTile = level->getTile(nx, ny, nz); + + bool currentIsUpper = (currentData & TOP_SLOT_BIT) != 0; + bool neighborIsUpper = (neighborData & TOP_SLOT_BIT) != 0; + + bool currentIsSlab = isHalfSlab(currentTile); + bool neighborIsSlab = isHalfSlab(neighborTile); + + + if (neighborIsSlab && neighborIsUpper) + { + if (face == Facing::DOWN) + return true; + if (face == Facing::UP && !Tile::shouldRenderFace(level, x, y, z, face)) + return currentIsSlab && !currentIsUpper ? false : true; + return !(currentIsSlab && currentIsUpper); + } + + if (face == Facing::UP || (face == Facing::DOWN + && Tile::shouldRenderFace(level, x, y, z, face))) + return true; + + return !(currentIsSlab && !currentIsUpper); } -bool HalfSlabTile::isHalfSlab(int tileId) +int HalfSlabTile::getSpawnResourcesAuxValue(int data) { - return tileId == Tile::stoneSlabHalf_Id || tileId == Tile::woodSlabHalf_Id; + return data & TYPE_MASK; } int HalfSlabTile::cloneTileData(Level *level, int x, int y, int z) { - return Tile::cloneTileData(level, x, y, z) & TYPE_MASK; + + return level->getData(x, y, z) & TYPE_MASK; } int HalfSlabTile::cloneTileId(Level *level, int x, int y, int z) { - if (isHalfSlab(id)) - { - return id; - } - if (id == Tile::stoneSlab_Id) - { - return Tile::stoneSlabHalf_Id; - } - if (id == Tile::woodSlab_Id) - { - return Tile::woodSlabHalf_Id; - } - return Tile::stoneSlabHalf_Id; + return id; +} + +int HalfSlabTile::getPlacedOnFaceDataValue( + Level *level, int x, int y, int z, + int face, float clickX, float clickY, float clickZ, + int itemValue) +{ + + if (face == Facing::DOWN) + return itemValue | TOP_SLOT_BIT; + if (face == Facing::UP) + return itemValue; + + return (clickY > 0.5f) ? (itemValue | TOP_SLOT_BIT) : itemValue; +} + + bool HalfSlabTile::isHalfSlab(int tileId) +{ + if (tileId <= 0 || Tile::tiles[tileId] == nullptr) + return false; + return dynamic_cast(Tile::tiles[tileId]) != nullptr + && !Tile::tiles[tileId]->isCubeShaped(); } \ No newline at end of file diff --git a/Minecraft.World/HalfSlabTile.h b/Minecraft.World/HalfSlabTile.h index 6399d82..7d65247 100644 --- a/Minecraft.World/HalfSlabTile.h +++ b/Minecraft.World/HalfSlabTile.h @@ -1,33 +1,57 @@ #pragma once - #include "Tile.h" - -class HalfSlabTile : public Tile +class HalfSlabTile : public Tile { public: - static const int TYPE_MASK = 7; - static const int TOP_SLOT_BIT = 8; + static const int TYPE_MASK = 7; + static const int TOP_SLOT_BIT = 8; -protected: - bool fullSize; + + enum class Half + { + TOP, + BOTTOM + }; public: - HalfSlabTile(int id, bool fullSize, Material *material); - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param - virtual void updateDefaultShape(); - virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source); - virtual bool isSolidRender(bool isServerLevel); - virtual int getPlacedOnFaceDataValue(Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, int itemValue); - virtual int getResourceCount(Random *random); - virtual int getSpawnResourcesAuxValue(int data); - virtual bool isCubeShaped(); - virtual bool shouldRenderFace(LevelSource *level, int x, int y, int z, int face); + HalfSlabTile(int id, Material *material); + + virtual void DerivedInit(); + + virtual int isFullSize() = 0; + + virtual void updateShape( + LevelSource *level, int x, int y, int z, + int forceData = -1, + shared_ptr forceEntity = shared_ptr()) override; + + virtual void updateDefaultShape() override; + + virtual void addAABBs( + Level *level, int x, int y, int z, + AABB *box, AABBList *boxes, + shared_ptr source) override; + + virtual bool isSolidRender(bool isServerLevel = false) override; + virtual bool isSilkTouchable() override; + + virtual int getPlacedOnFaceDataValue( + Level *level, int x, int y, int z, + int face, float clickX, float clickY, float clickZ, + int itemValue) override; + + virtual int getResourceCount(Random *random) override; + virtual int getSpawnResourcesAuxValue(int data) override; + virtual bool isCubeShaped() override; + virtual bool shouldRenderFace( + LevelSource *level, int x, int y, int z, int face) override; + + virtual int cloneTileData(Level *level, int x, int y, int z) override; + virtual int cloneTileId(Level *level, int x, int y, int z) override; + + virtual int getAuxName(int auxValue) = 0; + private: - static bool isHalfSlab(int tileId); -public: - virtual int getAuxName(int auxValue) = 0; - - virtual int cloneTileData(Level *level, int x, int y, int z); - virtual int cloneTileId(Level *level, int x, int y, int z); + static bool isHalfSlab(int tileId); }; \ No newline at end of file diff --git a/Minecraft.World/PineFeature.cpp b/Minecraft.World/PineFeature.cpp index bbe424a..6ee6fd7 100644 --- a/Minecraft.World/PineFeature.cpp +++ b/Minecraft.World/PineFeature.cpp @@ -95,7 +95,7 @@ bool PineFeature::place(Level *level, Random *random, int x, int y, int z) for (int hh = 0; hh < treeHeight - 1; hh++) { int t = level->getTile(x, y + hh, z); - if (t == 0 || t == Tile::leaves_Id) placeBlock(level, x, y + hh, z, Tile::treeTrunk_Id, TreeTile::DARK_TRUNK); + if (t == 0 || t == Tile::leaves_Id) placeBlock(level, x, y + hh, z, Tile::treeTrunk_Id, TreeTile::SPRUCE_TRUNK); } return true; diff --git a/Minecraft.World/Recipes.cpp b/Minecraft.World/Recipes.cpp index 24faaeb..a732204 100644 --- a/Minecraft.World/Recipes.cpp +++ b/Minecraft.World/Recipes.cpp @@ -66,11 +66,11 @@ Recipes::Recipes() L'#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::BIRCH_TRUNK), L'S'); - addShapedRecipy(new ItemInstance(Tile::wood, 4, TreeTile::DARK_TRUNK), // + addShapedRecipy(new ItemInstance(Tile::wood, 4, TreeTile::SPRUCE_TRUNK), // L"sczg", L"#", // - L'#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::DARK_TRUNK), + L'#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::SPRUCE_TRUNK), L'S'); addShapedRecipy(new ItemInstance(Tile::wood, 4, TreeTile::JUNGLE_TRUNK), // @@ -272,7 +272,7 @@ Recipes::Recipes() L"## ", // L"###", // - L'#', new ItemInstance(Tile::wood, 1, TreeTile::DARK_TRUNK), + L'#', new ItemInstance(Tile::wood, 1, TreeTile::SPRUCE_TRUNK), L'S'); addShapedRecipy(new ItemInstance(Tile::woodStairsJungle, 4), // @@ -412,11 +412,11 @@ Recipes::Recipes() L'S'); - addShapedRecipy(new ItemInstance(Tile::woodSlabHalf, 6, TreeTile::DARK_TRUNK), // + addShapedRecipy(new ItemInstance(Tile::woodSlabHalf, 6, TreeTile::SPRUCE_TRUNK), // L"sczg", L"###", // - L'#', new ItemInstance(Tile::wood, 1, TreeTile::DARK_TRUNK), + L'#', new ItemInstance(Tile::wood, 1, TreeTile::SPRUCE_TRUNK), L'S'); addShapedRecipy(new ItemInstance(Tile::woodSlabHalf, 6, TreeTile::JUNGLE_TRUNK), // diff --git a/Minecraft.World/ScatteredFeaturePieces.cpp b/Minecraft.World/ScatteredFeaturePieces.cpp index 07630ef..d734b12 100644 --- a/Minecraft.World/ScatteredFeaturePieces.cpp +++ b/Minecraft.World/ScatteredFeaturePieces.cpp @@ -673,15 +673,15 @@ bool ScatteredFeaturePieces::SwamplandHut::postProcess(Level *level, Random *ran } // floor and ceiling - generateBox(level, chunkBB, 1, 1, 1, 5, 1, 7, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); - generateBox(level, chunkBB, 1, 4, 2, 5, 4, 7, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); - generateBox(level, chunkBB, 2, 1, 0, 4, 1, 0, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); + generateBox(level, chunkBB, 1, 1, 1, 5, 1, 7, Tile::wood_Id, TreeTile::SPRUCE_TRUNK, Tile::wood_Id, TreeTile::SPRUCE_TRUNK, false); + generateBox(level, chunkBB, 1, 4, 2, 5, 4, 7, Tile::wood_Id, TreeTile::SPRUCE_TRUNK, Tile::wood_Id, TreeTile::SPRUCE_TRUNK, false); + generateBox(level, chunkBB, 2, 1, 0, 4, 1, 0, Tile::wood_Id, TreeTile::SPRUCE_TRUNK, Tile::wood_Id, TreeTile::SPRUCE_TRUNK, false); // walls - generateBox(level, chunkBB, 2, 2, 2, 3, 3, 2, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); - generateBox(level, chunkBB, 1, 2, 3, 1, 3, 6, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); - generateBox(level, chunkBB, 5, 2, 3, 5, 3, 6, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); - generateBox(level, chunkBB, 2, 2, 7, 4, 3, 7, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); + generateBox(level, chunkBB, 2, 2, 2, 3, 3, 2, Tile::wood_Id, TreeTile::SPRUCE_TRUNK, Tile::wood_Id, TreeTile::SPRUCE_TRUNK, false); + generateBox(level, chunkBB, 1, 2, 3, 1, 3, 6, Tile::wood_Id, TreeTile::SPRUCE_TRUNK, Tile::wood_Id, TreeTile::SPRUCE_TRUNK, false); + generateBox(level, chunkBB, 5, 2, 3, 5, 3, 6, Tile::wood_Id, TreeTile::SPRUCE_TRUNK, Tile::wood_Id, TreeTile::SPRUCE_TRUNK, false); + generateBox(level, chunkBB, 2, 2, 7, 4, 3, 7, Tile::wood_Id, TreeTile::SPRUCE_TRUNK, Tile::wood_Id, TreeTile::SPRUCE_TRUNK, false); // pillars generateBox(level, chunkBB, 1, 0, 2, 1, 3, 2, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); diff --git a/Minecraft.World/SpruceFeature.cpp b/Minecraft.World/SpruceFeature.cpp index d42e46f..11bbc98 100644 --- a/Minecraft.World/SpruceFeature.cpp +++ b/Minecraft.World/SpruceFeature.cpp @@ -110,7 +110,7 @@ bool SpruceFeature::place(Level *level, Random *random, int x, int y, int z) for (int hh = 0; hh < treeHeight - topOffset; hh++) { int t = level->getTile(x, y + hh, z); - if (t == 0 || t == Tile::leaves_Id) placeBlock(level, x, y + hh, z, Tile::treeTrunk_Id, TreeTile::DARK_TRUNK); + if (t == 0 || t == Tile::leaves_Id) placeBlock(level, x, y + hh, z, Tile::treeTrunk_Id, TreeTile::SPRUCE_TRUNK); } return true; } diff --git a/Minecraft.World/StoneSlabTile.cpp b/Minecraft.World/StoneSlabTile.cpp index 10f1ee7..37f0940 100644 --- a/Minecraft.World/StoneSlabTile.cpp +++ b/Minecraft.World/StoneSlabTile.cpp @@ -5,80 +5,78 @@ #include "net.minecraft.world.h" #include "StoneSlabTile.h" +const unsigned int StoneSlabTile::SLAB_NAMES[SLAB_NAMES_LENGTH] = { + IDS_TILE_STONESLAB_STONE, + IDS_TILE_STONESLAB_SAND, + IDS_TILE_STONESLAB_WOOD, + IDS_TILE_STONESLAB_COBBLE, + IDS_TILE_STONESLAB_BRICK, + IDS_TILE_STONESLAB_SMOOTHBRICK, + IDS_TILE_STONESLAB_NETHERBRICK, + IDS_TILE_STONESLAB_QUARTZ, +}; -const unsigned int StoneSlabTile::SLAB_NAMES[SLAB_NAMES_LENGTH] = { IDS_TILE_STONESLAB_STONE, - IDS_TILE_STONESLAB_SAND, - IDS_TILE_STONESLAB_WOOD, - IDS_TILE_STONESLAB_COBBLE, - IDS_TILE_STONESLAB_BRICK, - IDS_TILE_STONESLAB_SMOOTHBRICK, - IDS_TILE_STONESLAB_NETHERBRICK, - IDS_TILE_STONESLAB_QUARTZ, - }; - -StoneSlabTile::StoneSlabTile(int id, bool fullSize) : HalfSlabTile(id, fullSize, Material::stone) +StoneSlabTile::StoneSlabTile(int id) + : HalfSlabTile(id, Material::stone) { } Icon *StoneSlabTile::getTexture(int face, int data) { - int type = data & TYPE_MASK; - if (fullSize && (data & TOP_SLOT_BIT) != 0) - { - face = Facing::UP; - } - switch(type) - { - case STONE_SLAB: - if (face == Facing::UP || face == Facing::DOWN) return icon; - return iconSide; - break; - case SAND_SLAB: - return Tile::sandStone->getTexture(face); - case WOOD_SLAB: - return Tile::wood->getTexture(face); - case COBBLESTONE_SLAB: - return Tile::cobblestone->getTexture(face); - case BRICK_SLAB: - return Tile::redBrick->getTexture(face); - case SMOOTHBRICK_SLAB: - return Tile::stoneBrick->getTexture(face, SmoothStoneBrickTile::TYPE_DEFAULT); - case NETHERBRICK_SLAB: - return Tile::netherBrick->getTexture(Facing::UP); - case QUARTZ_SLAB: - return Tile::quartzBlock->getTexture(face); - } - - return icon; + int type = data & TYPE_MASK; + + if (isFullSize() && (data & TOP_SLOT_BIT) != 0) + face = Facing::UP; + + switch (type) + { + case STONE_SLAB: + if (face == Facing::UP || face == Facing::DOWN) return icon; + return iconSide; + case SAND_SLAB: + return Tile::sandStone->getTexture(face); + case WOOD_SLAB: + return Tile::wood->getTexture(face); + case COBBLESTONE_SLAB: + return Tile::cobblestone->getTexture(face); + case BRICK_SLAB: + return Tile::redBrick->getTexture(face); + case SMOOTHBRICK_SLAB: + return Tile::stoneBrick->getTexture(face, SmoothStoneBrickTile::TYPE_DEFAULT); + case NETHERBRICK_SLAB: + return Tile::netherBrick->getTexture(Facing::UP); + case QUARTZ_SLAB: + return Tile::quartzBlock->getTexture(face); + } + + return icon; } void StoneSlabTile::registerIcons(IconRegister *iconRegister) { - icon = iconRegister->registerIcon(L"stoneslab_top"); - iconSide = iconRegister->registerIcon(L"stoneslab_side"); + icon = iconRegister->registerIcon(L"stoneslab_top"); + iconSide = iconRegister->registerIcon(L"stoneslab_side"); } int StoneSlabTile::getResource(int data, Random *random, int playerBonusLevel) { - return Tile::stoneSlabHalf_Id; + return Tile::stoneSlabHalf_Id; } -unsigned int StoneSlabTile::getDescriptionId(int iData /*= -1*/) +unsigned int StoneSlabTile::getDescriptionId(int iData) { - if(iData < 0 ) iData = 0; - return StoneSlabTile::SLAB_NAMES[iData]; + if (iData < 0) iData = 0; + return StoneSlabTile::SLAB_NAMES[iData]; } -int StoneSlabTile::getAuxName(int auxValue) +int StoneSlabTile::getAuxName(int auxValue) { - if (auxValue < 0 || auxValue >= SLAB_NAMES_LENGTH) - { - auxValue = 0; - } - return SLAB_NAMES[auxValue];//super.getDescriptionId() + "." + SLAB_NAMES[auxValue]; + if (auxValue < 0 || auxValue >= SLAB_NAMES_LENGTH) + auxValue = 0; + return SLAB_NAMES[auxValue];//super.getDescriptionId() + "." + SLAB_NAMES[auxValue]; } shared_ptr StoneSlabTile::getSilkTouchItemInstance(int data) { - return std::make_shared(Tile::stoneSlabHalf_Id, 2, data & TYPE_MASK); -} + return make_shared(Tile::stoneSlabHalf_Id, 2, data & TYPE_MASK); +} \ No newline at end of file diff --git a/Minecraft.World/StoneSlabTile.h b/Minecraft.World/StoneSlabTile.h index 4380b04..e2679fe 100644 --- a/Minecraft.World/StoneSlabTile.h +++ b/Minecraft.World/StoneSlabTile.h @@ -1,39 +1,53 @@ #pragma once -using namespace std; - #include "HalfSlabTile.h" class ChunkRebuildData; class StoneSlabTile : public HalfSlabTile { - friend ChunkRebuildData; + friend class ChunkRebuildData; public: - static const int STONE_SLAB = 0; - static const int SAND_SLAB = 1; - static const int WOOD_SLAB = 2; - static const int COBBLESTONE_SLAB = 3; - static const int BRICK_SLAB = 4; - static const int SMOOTHBRICK_SLAB = 5; - static const int NETHERBRICK_SLAB = 6; - static const int QUARTZ_SLAB = 7; - - static const int SLAB_NAMES_LENGTH = 8; - - static const unsigned int SLAB_NAMES[SLAB_NAMES_LENGTH]; + static const int STONE_SLAB = 0; + static const int SAND_SLAB = 1; + static const int WOOD_SLAB = 2; + static const int COBBLESTONE_SLAB = 3; + static const int BRICK_SLAB = 4; + static const int SMOOTHBRICK_SLAB = 5; + static const int NETHERBRICK_SLAB = 6; + static const int QUARTZ_SLAB = 7; + static const int SLAB_NAMES_LENGTH = 8; + static const unsigned int SLAB_NAMES[SLAB_NAMES_LENGTH]; private: - Icon *iconSide; + Icon *iconSide; public: - StoneSlabTile(int id, bool fullSize); + StoneSlabTile(int id); - virtual Icon *getTexture(int face, int data); + virtual int isFullSize() = 0; + + virtual Icon *getTexture(int face, int data) override; + virtual void registerIcons(IconRegister *iconRegister) override; + virtual int getResource(int data, Random *random, int playerBonusLevel) override; + virtual unsigned int getDescriptionId(int iData = -1) override; + virtual int getAuxName(int auxValue) override; - void registerIcons(IconRegister *iconRegister); - virtual int getResource(int data, Random *random, int playerBonusLevel); - virtual unsigned int getDescriptionId(int iData = -1); - virtual int getAuxName(int auxValue); protected: - virtual shared_ptr getSilkTouchItemInstance(int data); + virtual shared_ptr getSilkTouchItemInstance(int data) override; +}; + + + +class HalfStoneSlabTile : public StoneSlabTile +{ +public: + HalfStoneSlabTile(int id) : StoneSlabTile(id) { DerivedInit(); } + virtual int isFullSize() override { return 0; } +}; + +class FullStoneSlabTile : public StoneSlabTile +{ +public: + FullStoneSlabTile(int id) : StoneSlabTile(id) { DerivedInit(); } + virtual int isFullSize() override { return 1; } }; \ No newline at end of file diff --git a/Minecraft.World/Tile.cpp b/Minecraft.World/Tile.cpp index be75cbe..540fe6e 100644 --- a/Minecraft.World/Tile.cpp +++ b/Minecraft.World/Tile.cpp @@ -115,6 +115,11 @@ Tile *Tile::stairs_stone = nullptr; Tile *Tile::wallSign = nullptr; Tile *Tile::lever = nullptr; Tile *Tile::pressurePlate_stone = nullptr; +Tile* Tile::door_spruce = nullptr; +Tile* Tile::door_birch = nullptr; +Tile* Tile::door_jungle = nullptr; +Tile* Tile::door_acacia = nullptr; +Tile* Tile::door_dark = nullptr; Tile *Tile::door_iron = nullptr; Tile *Tile::pressurePlate_wood = nullptr; Tile *Tile::redStoneOre = nullptr; @@ -174,7 +179,7 @@ Tile *Tile::redstoneLight_lit = nullptr; // TU9 Tile *Tile::stairs_sandstone = nullptr; -Tile *Tile::woodStairsDark = nullptr; +Tile *Tile::woodStairsSpruce = nullptr; Tile *Tile::woodStairsBirch = nullptr; Tile *Tile::woodStairsJungle = nullptr; Tile *Tile::commandBlock = nullptr; @@ -223,6 +228,22 @@ Tile *Tile::woolCarpet = nullptr; Tile *Tile::clayHardened = nullptr; Tile *Tile::coalBlock = nullptr; +Tile* Tile::woodStairsAcacia = nullptr; +Tile* Tile::woodStairsDark = nullptr; +Tile* Tile::iron_trapdoor = nullptr; + +Tile* Tile::spruceGate = nullptr; +Tile* Tile::birchGate = nullptr; +Tile* Tile::jungleGate = nullptr; +Tile* Tile::acaciaGate = nullptr; +Tile* Tile::darkGate = nullptr; + +Tile* Tile::spruceFence = nullptr; +Tile* Tile::birchFence = nullptr; +Tile* Tile::jungleFence = nullptr; +Tile* Tile::acaciaFence = nullptr; +Tile* Tile::darkFence = nullptr; + DWORD Tile::tlsIdxShape = TlsAlloc(); Tile::ThreadStorage::ThreadStorage() @@ -309,8 +330,8 @@ void Tile::staticCtor() Tile::goldBlock = (new MetalTile(41)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_gold)->setDestroyTime(3.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_METAL)->setIconName(L"gold_block")->setDescriptionId(IDS_TILE_BLOCK_GOLD)->setUseDescriptionId(IDS_DESC_BLOCK_GOLD); Tile::ironBlock = (new MetalTile(42)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_iron)->setDestroyTime(5.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_METAL)->setIconName(L"iron_block")->setDescriptionId(IDS_TILE_BLOCK_IRON)->setUseDescriptionId(IDS_DESC_BLOCK_IRON); - Tile::stoneSlab = static_cast((new StoneSlabTile(Tile::stoneSlab_Id, true))->setBaseItemTypeAndMaterial(Item::eBaseItemType_slab, Item::eMaterial_stone)->setDestroyTime(2.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_STONE)->setIconName(L"stoneSlab")->setDescriptionId(IDS_TILE_STONESLAB)->setUseDescriptionId(IDS_DESC_SLAB)); - Tile::stoneSlabHalf = static_cast((new StoneSlabTile(Tile::stoneSlabHalf_Id, false))->setBaseItemTypeAndMaterial(Item::eBaseItemType_halfslab, Item::eMaterial_stone)->setDestroyTime(2.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_STONE)->setIconName(L"stoneSlab")->setDescriptionId(IDS_TILE_STONESLAB)->setUseDescriptionId(IDS_DESC_HALFSLAB)); + Tile::stoneSlab = static_cast((new FullStoneSlabTile(Tile::stoneSlab_Id))->setBaseItemTypeAndMaterial(Item::eBaseItemType_slab, Item::eMaterial_stone)->setDestroyTime(2.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_STONE)->setIconName(L"stoneSlab")->setDescriptionId(IDS_TILE_STONESLAB)->setUseDescriptionId(IDS_DESC_SLAB)); + Tile::stoneSlabHalf = static_cast((new HalfStoneSlabTile(Tile::stoneSlabHalf_Id))->setBaseItemTypeAndMaterial(Item::eBaseItemType_halfslab, Item::eMaterial_stone)->setDestroyTime(2.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_STONE)->setIconName(L"stoneSlab")->setDescriptionId(IDS_TILE_STONESLAB)->setUseDescriptionId(IDS_DESC_HALFSLAB)); Tile::redBrick = (new Tile(45, Material::stone)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_brick)->setDestroyTime(2.0f)->setExplodeable(10)->setSoundType(Tile::SOUND_STONE)->setIconName(L"brick")->setDescriptionId(IDS_TILE_BRICK)->setUseDescriptionId(IDS_DESC_BRICK); Tile::tnt = (new TntTile(46)) ->setDestroyTime(0.0f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"tnt")->setDescriptionId(IDS_TILE_TNT)->setUseDescriptionId(IDS_DESC_TNT); Tile::bookshelf = (new BookshelfTile(47)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_paper, Item::eMaterial_bookshelf)->setDestroyTime(1.5f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"bookshelf")->setDescriptionId(IDS_TILE_BOOKSHELF)->setUseDescriptionId(IDS_DESC_BOOKSHELF); @@ -332,7 +353,7 @@ void Tile::staticCtor() Tile::furnace = (new FurnaceTile(61, false)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_device, Item::eMaterial_stone)->setDestroyTime(3.5f)->setSoundType(Tile::SOUND_STONE)->setIconName(L"furnace")->setDescriptionId(IDS_TILE_FURNACE)->sendTileData()->setUseDescriptionId(IDS_DESC_FURNACE); Tile::furnace_lit = (new FurnaceTile(62, true)) ->setDestroyTime(3.5f)->setSoundType(Tile::SOUND_STONE)->setLightEmission(14 / 16.0f)->setIconName(L"furnace")->setDescriptionId(IDS_TILE_FURNACE)->sendTileData()->setUseDescriptionId(IDS_DESC_FURNACE); Tile::sign = (new SignTile(63, eTYPE_SIGNTILEENTITY, true)) ->setDestroyTime(1.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"sign")->setDescriptionId(IDS_TILE_SIGN)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_SIGN); - Tile::door_wood = (new DoorTile(64, Material::wood)) ->setDestroyTime(3.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"door_wood")->setDescriptionId(IDS_TILE_DOOR_WOOD)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_DOOR_WOOD); + Tile::door_wood = (new DoorTile(64, Material::wood, L"doorWood")) ->setDestroyTime(3.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"door_wood")->setDescriptionId(IDS_TILE_DOOR_WOOD)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_DOOR_WOOD); Tile::ladder = (new LadderTile(65)) ->setDestroyTime(0.4f)->setSoundType(Tile::SOUND_LADDER)->setIconName(L"ladder")->setDescriptionId(IDS_TILE_LADDER)->sendTileData()->setUseDescriptionId(IDS_DESC_LADDER)->disableMipmap(); Tile::rail = (new RailTile(66)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_rail, Item::eMaterial_iron)->setDestroyTime(0.7f)->setSoundType(Tile::SOUND_METAL)->setIconName(L"rail_normal")->setDescriptionId(IDS_TILE_RAIL)->sendTileData()->setUseDescriptionId(IDS_DESC_RAIL)->disableMipmap(); Tile::stairs_stone =(new StairTile(67, Tile::cobblestone,0)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_stone) ->setIconName(L"stairsStone")->setDescriptionId(IDS_TILE_STAIRS_STONE) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); @@ -340,7 +361,12 @@ void Tile::staticCtor() Tile::lever = (new LeverTile(69)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_lever, Item::eMaterial_wood)->setDestroyTime(0.5f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"lever")->setDescriptionId(IDS_TILE_LEVER)->sendTileData()->setUseDescriptionId(IDS_DESC_LEVER); Tile::pressurePlate_stone = (Tile *)(new PressurePlateTile(70, L"stone", Material::stone, PressurePlateTile::mobs)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_pressureplate, Item::eMaterial_stone)->setDestroyTime(0.5f)->setSoundType(Tile::SOUND_STONE)->setDescriptionId(IDS_TILE_PRESSURE_PLATE)->sendTileData()->setUseDescriptionId(IDS_DESC_PRESSUREPLATE); - Tile::door_iron = (new DoorTile(71, Material::metal)) ->setDestroyTime(5.0f)->setSoundType(Tile::SOUND_METAL)->setIconName(L"door_iron")->setDescriptionId(IDS_TILE_DOOR_IRON)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_DOOR_IRON); + Tile::door_spruce = (new DoorTile(193, Material::wood, L"doorSpruce"))->setDestroyTime(3.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"door_spruce")->setDescriptionId(-1)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_DOOR_WOOD); + Tile::door_birch = (new DoorTile(194, Material::wood, L"doorBirch"))->setDestroyTime(3.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"door_birch")->setDescriptionId(-1)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_DOOR_WOOD); + Tile::door_jungle = (new DoorTile(195, Material::wood, L"doorJungle"))->setDestroyTime(3.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"door_jungle")->setDescriptionId(-1)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_DOOR_WOOD); + Tile::door_acacia = (new DoorTile(196, Material::wood, L"doorAcacia"))->setDestroyTime(3.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"door_acacia")->setDescriptionId(-1)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_DOOR_WOOD); + Tile::door_dark = (new DoorTile(197, Material::wood, L"doorDark"))->setDestroyTime(3.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"door_dark")->setDescriptionId(-1)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_DOOR_WOOD); + Tile::door_iron = (new DoorTile(71, Material::metal, L"doorIron"))->setDestroyTime(5.0f)->setSoundType(Tile::SOUND_METAL)->setIconName(L"door_iron")->setDescriptionId(IDS_TILE_DOOR_IRON)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_DOOR_IRON); Tile::pressurePlate_wood = (new PressurePlateTile(72, L"planks_oak", Material::wood, PressurePlateTile::everything)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_pressureplate, Item::eMaterial_wood)->setDestroyTime(0.5f)->setSoundType(Tile::SOUND_WOOD)->setDescriptionId(IDS_TILE_PRESSURE_PLATE)->sendTileData()->setUseDescriptionId(IDS_DESC_PRESSUREPLATE); Tile::redStoneOre = (new RedStoneOreTile(73,false)) ->setDestroyTime(3.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_STONE)->setIconName(L"redstone_ore")->setDescriptionId(IDS_TILE_ORE_REDSTONE)->sendTileData()->setUseDescriptionId(IDS_DESC_ORE_REDSTONE); Tile::redStoneOre_lit = (new RedStoneOreTile(74, true)) ->setLightEmission(10 / 16.0f)->setDestroyTime(3.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_STONE)->setIconName(L"redstone_ore")->setDescriptionId(IDS_TILE_ORE_REDSTONE)->sendTileData()->setUseDescriptionId(IDS_DESC_ORE_REDSTONE); @@ -400,8 +426,8 @@ void Tile::staticCtor() Tile::dragonEgg = (new EggTile(122)) ->setDestroyTime(3.0f)->setExplodeable(15)->setSoundType(SOUND_STONE)->setLightEmission(2.0f / 16.0f)->setIconName(L"dragon_egg")->setDescriptionId(IDS_TILE_DRAGONEGG)->setUseDescriptionId(IDS_DESC_DRAGONEGG); Tile::redstoneLight = (new RedlightTile(123, false)) ->setDestroyTime(0.3f)->setSoundType(SOUND_GLASS)->setIconName(L"redstone_lamp_off")->setDescriptionId(IDS_TILE_REDSTONE_LIGHT)->setUseDescriptionId(IDS_DESC_REDSTONE_LIGHT); Tile::redstoneLight_lit = (new RedlightTile(124, true)) ->setDestroyTime(0.3f)->setSoundType(SOUND_GLASS)->setIconName(L"redstone_lamp_on")->setDescriptionId(IDS_TILE_REDSTONE_LIGHT)->setUseDescriptionId(IDS_DESC_REDSTONE_LIGHT); - Tile::woodSlab = static_cast((new WoodSlabTile(Tile::woodSlab_Id, true))->setBaseItemTypeAndMaterial(Item::eBaseItemType_slab, Item::eMaterial_wood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"woodSlab")->setDescriptionId(IDS_DESC_WOODSLAB)->setUseDescriptionId(IDS_DESC_WOODSLAB)); - Tile::woodSlabHalf = static_cast((new WoodSlabTile(Tile::woodSlabHalf_Id, false))->setBaseItemTypeAndMaterial(Item::eBaseItemType_halfslab, Item::eMaterial_wood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"woodSlab")->setDescriptionId(IDS_DESC_WOODSLAB)->setUseDescriptionId(IDS_DESC_WOODSLAB)); + Tile::woodSlab = static_cast((new FullWoodSlabTile(Tile::woodSlab_Id))->setBaseItemTypeAndMaterial(Item::eBaseItemType_slab, Item::eMaterial_wood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"woodSlab")->setDescriptionId(IDS_DESC_WOODSLAB)->setUseDescriptionId(IDS_DESC_WOODSLAB)); + Tile::woodSlabHalf = static_cast((new HalfWoodSlabTile(Tile::woodSlabHalf_Id))->setBaseItemTypeAndMaterial(Item::eBaseItemType_halfslab, Item::eMaterial_wood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"woodSlab")->setDescriptionId(IDS_DESC_WOODSLAB)->setUseDescriptionId(IDS_DESC_WOODSLAB)); Tile::cocoa = (new CocoaTile(127)) ->setDestroyTime(0.2f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"cocoa")->sendTileData()->setDescriptionId(IDS_TILE_COCOA)->setUseDescriptionId(IDS_DESC_COCOA); Tile::stairs_sandstone = (new StairTile(128, Tile::sandStone,0)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_sand) ->setIconName(L"stairsSandstone")->setDescriptionId(IDS_TILE_STAIRS_SANDSTONE) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); Tile::emeraldOre = (new OreTile(129)) ->setDestroyTime(3.0f)->setExplodeable(5)->setSoundType(SOUND_STONE)->setIconName(L"emerald_ore")->setDescriptionId(IDS_TILE_EMERALDORE)->setUseDescriptionId(IDS_DESC_EMERALDORE); @@ -411,7 +437,7 @@ void Tile::staticCtor() Tile::tripWireSource = static_cast((new TripWireSourceTile(131))->setBaseItemTypeAndMaterial(Item::eBaseItemType_lever, Item::eMaterial_undefined)->setIconName(L"trip_wire_source")->sendTileData()->setDescriptionId(IDS_TILE_TRIPWIRE_SOURCE)->setUseDescriptionId(IDS_DESC_TRIPWIRE_SOURCE)); Tile::tripWire = (new TripWireTile(132)) ->setIconName(L"trip_wire")->sendTileData()->setDescriptionId(IDS_TILE_TRIPWIRE)->setUseDescriptionId(IDS_DESC_TRIPWIRE); Tile::emeraldBlock = (new MetalTile(133)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_emerald)->setDestroyTime(5.0f)->setExplodeable(10)->setSoundType(SOUND_METAL)->setIconName(L"emerald_block")->setDescriptionId(IDS_TILE_EMERALDBLOCK)->setUseDescriptionId(IDS_DESC_EMERALDBLOCK); - Tile::woodStairsDark = (new StairTile(134, Tile::wood, TreeTile::DARK_TRUNK)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_sprucewood)->setIconName(L"stairsWoodSpruce")->setDescriptionId(IDS_TILE_STAIRS_SPRUCEWOOD) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); + Tile::woodStairsSpruce = (new StairTile(134, Tile::wood, TreeTile::SPRUCE_TRUNK)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_sprucewood)->setIconName(L"stairsWoodSpruce")->setDescriptionId(IDS_TILE_STAIRS_SPRUCEWOOD) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); Tile::woodStairsBirch = (new StairTile(135, Tile::wood, TreeTile::BIRCH_TRUNK)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_birchwood)->setIconName(L"stairsWoodBirch")->setDescriptionId(IDS_TILE_STAIRS_BIRCHWOOD) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); Tile::woodStairsJungle =(new StairTile(136, Tile::wood, TreeTile::JUNGLE_TRUNK))->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_junglewood)->setIconName(L"stairsWoodJungle")->setDescriptionId(IDS_TILE_STAIRS_JUNGLEWOOD) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); Tile::commandBlock = (new CommandBlock(137)) ->setIndestructible()->setExplodeable(6000000)->setIconName(L"command_block")->setDescriptionId(IDS_TILE_COMMAND_BLOCK)->setUseDescriptionId(IDS_DESC_COMMAND_BLOCK); @@ -442,12 +468,27 @@ void Tile::staticCtor() Tile::stained_glass_pane = (new StainedGlassPaneBlock(160)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_glass, Item::eMaterial_glass)->setDestroyTime(0.3f)->setSoundType(SOUND_GLASS)->setIconName(L"glass")->setDescriptionId(IDS_TILE_STAINED_GLASS_PANE)->setUseDescriptionId(IDS_DESC_STAINED_GLASS_PANE); Tile::tree2Trunk = (new TreeTile2(162))->setDestroyTime(2.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"log")->setDescriptionId(IDS_TILE_LOG)->sendTileData()->setUseDescriptionId(IDS_DESC_LOG); + Tile::woodStairsAcacia = (new StairTile(163, Tile::wood, TreeTile::ACACIA_TRUNK))->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_acaciawood)->setIconName(L"stairsWoodAcacia")->setDescriptionId(-1)->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); + Tile::woodStairsDark = (new StairTile(164, Tile::wood, TreeTile::DARK_TRUNK))->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_darkwood)->setIconName(L"stairsWoodDark")->setDescriptionId(-1)->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); + + Tile::iron_trapdoor = (new TrapDoorTile(167, Material::metal))->setBaseItemTypeAndMaterial(Item::eBaseItemType_door, Item::eMaterial_trap)->setDestroyTime(5.0f)->setSoundType(Tile::SOUND_METAL)->setIconName(L"iron_trapdoor")->setDescriptionId(-1)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_TRAPDOOR); Tile::hayBlock = (new HayBlockTile(170)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_wheat)->setDestroyTime(0.5f)->setSoundType(SOUND_GRASS)->setIconName(L"hay_block")->setDescriptionId(IDS_TILE_HAY)->setUseDescriptionId(IDS_DESC_HAY); Tile::woolCarpet = (new WoolCarpetTile(171)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_carpet, Item::eMaterial_cloth)->setDestroyTime(0.1f)->setSoundType(SOUND_CLOTH)->setIconName(L"woolCarpet")->setLightBlock(0)->setDescriptionId(IDS_TILE_CARPET)->setUseDescriptionId(IDS_DESC_CARPET); Tile::clayHardened = (new Tile(172, Material::stone)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_clay, Item::eMaterial_clay)->setDestroyTime(1.25f)->setExplodeable(7)->setSoundType(SOUND_STONE)->setIconName(L"hardened_clay")->setDescriptionId(IDS_TILE_HARDENED_CLAY)->setUseDescriptionId(IDS_DESC_HARDENED_CLAY); Tile::coalBlock = (new Tile(173, Material::stone)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_coal)->setDestroyTime(5.0f)->setExplodeable(10)->setSoundType(SOUND_STONE)->setIconName(L"coal_block")->setDescriptionId(IDS_TILE_COAL)->setUseDescriptionId(IDS_DESC_COAL_BLOCK); + + Tile::spruceGate = (new FenceGateTile(183))->setBaseItemTypeAndMaterial(Item::eBaseItemType_fenceGate, Item::eMaterial_sprucewood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"planks_spruce")->setDescriptionId(-1)->sendTileData()->setUseDescriptionId(IDS_DESC_FENCE_GATE); + Tile::birchGate = (new FenceGateTile(184))->setBaseItemTypeAndMaterial(Item::eBaseItemType_fenceGate, Item::eMaterial_birchwood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"planks_birch")->setDescriptionId(-1)->sendTileData()->setUseDescriptionId(IDS_DESC_FENCE_GATE); + Tile::jungleGate = (new FenceGateTile(185))->setBaseItemTypeAndMaterial(Item::eBaseItemType_fenceGate, Item::eMaterial_junglewood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"planks_jungle")->setDescriptionId(-1)->sendTileData()->setUseDescriptionId(IDS_DESC_FENCE_GATE); + Tile::darkGate = (new FenceGateTile(186))->setBaseItemTypeAndMaterial(Item::eBaseItemType_fenceGate, Item::eMaterial_darkwood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"planks_dark")->setDescriptionId(-1)->sendTileData()->setUseDescriptionId(IDS_DESC_FENCE_GATE); + Tile::acaciaGate = (new FenceGateTile(187))->setBaseItemTypeAndMaterial(Item::eBaseItemType_fenceGate, Item::eMaterial_acaciawood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"planks_acacia")->setDescriptionId(-1)->sendTileData()->setUseDescriptionId(IDS_DESC_FENCE_GATE); + Tile::spruceFence = (new FenceTile(188, L"planks_spruce", Material::wood))->setBaseItemTypeAndMaterial(Item::eBaseItemType_fence, Item::eMaterial_sprucewood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_WOOD)->setDescriptionId(-1)->setUseDescriptionId(IDS_DESC_FENCE); + Tile::birchFence = (new FenceTile(189, L"planks_birch", Material::wood))->setBaseItemTypeAndMaterial(Item::eBaseItemType_fence, Item::eMaterial_birchwood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_WOOD)->setDescriptionId(-1)->setUseDescriptionId(IDS_DESC_FENCE); + Tile::jungleFence = (new FenceTile(190, L"planks_jungle", Material::wood))->setBaseItemTypeAndMaterial(Item::eBaseItemType_fence, Item::eMaterial_junglewood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_WOOD)->setDescriptionId(-1)->setUseDescriptionId(IDS_DESC_FENCE); + Tile::darkFence = (new FenceTile(191, L"planks_dark", Material::wood))->setBaseItemTypeAndMaterial(Item::eBaseItemType_fence, Item::eMaterial_darkwood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_WOOD)->setDescriptionId(-1)->setUseDescriptionId(IDS_DESC_FENCE); + Tile::acaciaFence = (new FenceTile(192, L"planks_acacia", Material::wood))->setBaseItemTypeAndMaterial(Item::eBaseItemType_fence, Item::eMaterial_acaciawood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_WOOD)->setDescriptionId(-1)->setUseDescriptionId(IDS_DESC_FENCE); // Special cases for certain items since they can have different icons Item::items[wool_Id] = ( new WoolTileItem(Tile::wool_Id- 256) )->setIconName(L"cloth")->setDescriptionId(IDS_TILE_CLOTH)->setUseDescriptionId(IDS_DESC_WOOL); @@ -455,8 +496,8 @@ void Tile::staticCtor() Item::items[stained_glass_Id] = ( new WoolTileItem(Tile::stained_glass_Id - 256))->setIconName(L"stainedGlass")->setDescriptionId(IDS_TILE_STAINED_GLASS)->setUseDescriptionId(IDS_DESC_STAINED_GLASS); Item::items[stained_glass_pane_Id] = ( new WoolTileItem(Tile::stained_glass_pane_Id - 256))->setIconName(L"stainedGlassPane")->setDescriptionId(IDS_TILE_STAINED_GLASS_PANE)->setUseDescriptionId(IDS_DESC_STAINED_GLASS_PANE); Item::items[woolCarpet_Id] = ( new WoolTileItem(Tile::woolCarpet_Id - 256))->setIconName(L"woolCarpet")->setDescriptionId(IDS_TILE_CARPET)->setUseDescriptionId(IDS_DESC_CARPET); - Item::items[treeTrunk_Id] = ( new MultiTextureTileItem(Tile::treeTrunk_Id - 256, treeTrunk, (int *)TreeTile::TREE_NAMES, 4) )->setIconName(L"log")->setDescriptionId(IDS_TILE_LOG)->setUseDescriptionId(IDS_DESC_LOG); - Item::items[wood_Id] = ( new MultiTextureTileItem(Tile::wood_Id - 256, Tile::wood, (int *)WoodTile::WOOD_NAMES, 4, IDS_TILE_PLANKS))->setIconName(L"wood")->setDescriptionId(IDS_TILE_OAKWOOD_PLANKS)->setUseDescriptionId(IDS_DESC_LOG); // <- TODO + Item::items[treeTrunk_Id] = ( new MultiTextureTileItem(Tile::treeTrunk_Id - 256, treeTrunk, (int *)TreeTile::TREE_NAMES, TreeTile::TREE_NAMES_LENGTH))->setIconName(L"log")->setDescriptionId(IDS_TILE_LOG)->setUseDescriptionId(IDS_DESC_LOG); + Item::items[wood_Id] = ( new MultiTextureTileItem(Tile::wood_Id - 256, Tile::wood, (int *)WoodTile::WOOD_NAMES, WoodTile::WOOD_NAMES_LENGTH, IDS_TILE_PLANKS))->setIconName(L"wood")->setDescriptionId(IDS_TILE_OAKWOOD_PLANKS)->setUseDescriptionId(IDS_DESC_LOG); // <- TODO Item::items[monsterStoneEgg_Id] = ( new MultiTextureTileItem(Tile::monsterStoneEgg_Id - 256, monsterStoneEgg, (int *)StoneMonsterTile::STONE_MONSTER_NAMES, 3))->setIconName(L"monsterStoneEgg")->setDescriptionId(IDS_TILE_STONE_SILVERFISH)->setUseDescriptionId(IDS_DESC_STONE_SILVERFISH); // 4J - Brought forward from post-1.2 to fix stacking problem Item::items[stoneBrick_Id] = ( new MultiTextureTileItem(Tile::stoneBrick_Id - 256, stoneBrick,(int *)SmoothStoneBrickTile::SMOOTH_STONE_BRICK_NAMES, 4))->setIconName(L"stonebricksmooth")->setDescriptionId(IDS_TILE_STONE_BRICK_SMOOTH); Item::items[sandStone_Id] = ( new MultiTextureTileItem(sandStone_Id - 256, sandStone, SandStoneTile::SANDSTONE_NAMES, SandStoneTile::SANDSTONE_BLOCK_NAMES) )->setIconName(L"sandStone")->setDescriptionId(IDS_TILE_SANDSTONE)->setUseDescriptionId(IDS_DESC_SANDSTONE); @@ -466,7 +507,7 @@ void Tile::staticCtor() Item::items[tree2Trunk_Id] = ( new MultiTextureTileItem(Tile::tree2Trunk_Id - 256, tree2Trunk, (int*)TreeTile2::TREE_NAMES, TreeTile2::TREE_NAMES_LENGTH))->setIconName(L"log")->setDescriptionId(IDS_TILE_LOG)->setUseDescriptionId(IDS_DESC_LOG); Item::items[woodSlabHalf_Id] = ( new StoneSlabTileItem(Tile::woodSlabHalf_Id - 256, Tile::woodSlabHalf, Tile::woodSlab, false))->setIconName(L"woodSlab")->setDescriptionId(IDS_DESC_WOODSLAB)->setUseDescriptionId(IDS_DESC_WOODSLAB); Item::items[woodSlab_Id] = ( new StoneSlabTileItem(Tile::woodSlab_Id - 256, Tile::woodSlabHalf, Tile::woodSlab, true))->setIconName(L"woodSlab")->setDescriptionId(IDS_DESC_WOODSLAB)->setUseDescriptionId(IDS_DESC_WOODSLAB); - Item::items[sapling_Id] = ( new MultiTextureTileItem(Tile::sapling_Id - 256, Tile::sapling, Sapling::SAPLING_NAMES, 4) )->setIconName(L"sapling")->setDescriptionId(IDS_TILE_SAPLING)->setUseDescriptionId(IDS_DESC_SAPLING); + Item::items[sapling_Id] = ( new MultiTextureTileItem(Tile::sapling_Id - 256, Tile::sapling, Sapling::SAPLING_NAMES, Sapling::SAPLING_NAMES_SIZE))->setIconName(L"sapling")->setDescriptionId(IDS_TILE_SAPLING)->setUseDescriptionId(IDS_DESC_SAPLING); Item::items[leaves_Id] = ( new LeafTileItem(Tile::leaves_Id - 256) )->setIconName(L"leaves")->setDescriptionId(IDS_TILE_LEAVES)->setUseDescriptionId(IDS_DESC_LEAVES); Item::items[vine_Id] = ( new ColoredTileItem(Tile::vine_Id - 256, false))->setDescriptionId(IDS_TILE_VINE)->setUseDescriptionId(IDS_DESC_VINE); int idsData[3] = {IDS_TILE_SHRUB, IDS_TILE_TALL_GRASS, IDS_TILE_FERN}; diff --git a/Minecraft.World/Tile.h b/Minecraft.World/Tile.h index 9225f2f..043cdfd 100644 --- a/Minecraft.World/Tile.h +++ b/Minecraft.World/Tile.h @@ -441,6 +441,11 @@ public: static Tile *wallSign; static Tile *lever; static Tile *pressurePlate_stone; + static Tile *door_spruce; + static Tile *door_birch; + static Tile *door_jungle; + static Tile *door_acacia; + static Tile *door_dark; static Tile *door_iron; static Tile *pressurePlate_wood; static Tile *redStoneOre; @@ -499,7 +504,7 @@ public: static Tile *redstoneLight_lit; static Tile *stairs_sandstone; - static Tile *woodStairsDark; + static Tile *woodStairsSpruce; static Tile *woodStairsBirch; static Tile *woodStairsJungle; static Tile *commandBlock; @@ -550,6 +555,24 @@ public: static Tile *clayHardened; static Tile *coalBlock; + static Tile* woodStairsAcacia; + static Tile* woodStairsDark; + static Tile* iron_trapdoor; + + + static Tile* spruceGate; + static Tile* birchGate; + static Tile* jungleGate; + static Tile* acaciaGate; + static Tile* darkGate; + + static Tile* spruceFence; + static Tile* birchFence; + static Tile* jungleFence; + static Tile* acaciaFence; + static Tile* darkFence; + + static void staticCtor(); int id; diff --git a/Minecraft.World/TreeTile.cpp b/Minecraft.World/TreeTile.cpp index 6a5860f..3b1fd2e 100644 --- a/Minecraft.World/TreeTile.cpp +++ b/Minecraft.World/TreeTile.cpp @@ -7,15 +7,11 @@ #include "TreeTile.h" -const unsigned int TreeTile::TREE_NAMES[ TreeTile::TREE_NAMES_LENGTH] = { IDS_TILE_LOG_OAK, - IDS_TILE_LOG_SPRUCE, - IDS_TILE_LOG_BIRCH, - IDS_TILE_LOG_JUNGLE - }; +const unsigned int TreeTile::TREE_NAMES[ TreeTile::TREE_NAMES_LENGTH] = { IDS_TILE_LOG_OAK, IDS_TILE_LOG_SPRUCE, IDS_TILE_LOG_BIRCH, IDS_TILE_LOG_JUNGLE }; -const wstring TreeTile::TREE_STRING_NAMES[ TreeTile::TREE_NAMES_LENGTH] = {L"oak", L"spruce", L"birch", L"jungle"}; +const wstring TreeTile::TREE_STRING_NAMES[TreeTile::TREE_NAMES_LENGTH] = { L"oak", L"spruce", L"birch", L"jungle" }; -const wstring TreeTile::TREE_TEXTURES[] = {L"tree_side", L"tree_spruce", L"tree_birch", L"tree_jungle"}; +const wstring TreeTile::TREE_TEXTURES[] = { L"tree_side", L"tree_spruce", L"tree_birch", L"tree_jungle"}; TreeTile::TreeTile(int id) : RotatedPillarTile(id, Material::wood) { @@ -43,7 +39,7 @@ void TreeTile::onRemove(Level *level, int x, int y, int z, int id, int data) for (int zo = -r; zo <= r; zo++) { int t = level->getTile(x + xo, y + yo, z + zo); - if (t == Tile::leaves_Id) + if (t == Tile::leaves_Id || t == Tile::leaves2_Id) { int currentData = level->getData(x + xo, y + yo, z + zo); if ((currentData & LeafTile::UPDATE_LEAF_BIT) == 0) @@ -59,7 +55,7 @@ void TreeTile::onRemove(Level *level, int x, int y, int z, int id, int data) unsigned int TreeTile::getDescriptionId(int iData /*= -1*/) { int type = iData & MASK_TYPE; - if(type < 0 ) type = 0; + if (type < 0 || type >= TreeTile::TREE_NAMES_LENGTH) type = 0; return TreeTile::TREE_NAMES[type]; } diff --git a/Minecraft.World/TreeTile.h b/Minecraft.World/TreeTile.h index 8738c8c..f227e80 100644 --- a/Minecraft.World/TreeTile.h +++ b/Minecraft.World/TreeTile.h @@ -10,9 +10,12 @@ class TreeTile : public RotatedPillarTile friend class Tile; friend class ChunkRebuildData; public: - static const int DARK_TRUNK = 1; + static const int OAK_TRUNK = 0; + static const int SPRUCE_TRUNK = 1; // this needs to be changed to spruce... static const int BIRCH_TRUNK = 2; static const int JUNGLE_TRUNK = 3; + static const int ACACIA_TRUNK = 4; + static const int DARK_TRUNK = 5; static const int MASK_TYPE = 0x3; static const int MASK_FACING = 0xC; diff --git a/Minecraft.World/WoodSlabTile.cpp b/Minecraft.World/WoodSlabTile.cpp index 574dab9..1f99273 100644 --- a/Minecraft.World/WoodSlabTile.cpp +++ b/Minecraft.World/WoodSlabTile.cpp @@ -1,60 +1,49 @@ #include "stdafx.h" #include "WoodSlabTile.h" -#include "woodtile.h" -#include "treetile.h" +#include "WoodTile.h" +#include "TreeTile.h" #include "net.minecraft.world.level.h" #include "net.minecraft.world.level.biome.h" #include "net.minecraft.world.item.h" #include "net.minecraft.stats.h" -const unsigned int WoodSlabTile::SLAB_NAMES[SLAB_NAMES_LENGTH] = { IDS_TILE_STONESLAB_OAK, - IDS_TILE_STONESLAB_SPRUCE, - IDS_TILE_STONESLAB_BIRCH, - IDS_TILE_STONESLAB_JUNGLE, +const unsigned int WoodSlabTile::SLAB_NAMES[SLAB_NAMES_LENGTH] = { + IDS_TILE_STONESLAB_OAK, + IDS_TILE_STONESLAB_SPRUCE, + IDS_TILE_STONESLAB_BIRCH, + IDS_TILE_STONESLAB_JUNGLE, + -1, + -1 }; -// public static final String[] WOOD_NAMES = { -// "oak", "spruce", "birch", "jungle" -// }; - -WoodSlabTile::WoodSlabTile(int id, bool fullSize) : HalfSlabTile(id, fullSize, Material::wood) +WoodSlabTile::WoodSlabTile(int id) : HalfSlabTile(id, Material::wood) { } -Icon *WoodSlabTile::getTexture(int face, int data) +Icon* WoodSlabTile::getTexture(int face, int data) { - return Tile::wood->getTexture(face, data & TYPE_MASK); + + return Tile::wood->getTexture(face, data & TYPE_MASK); } -int WoodSlabTile::getResource(int data, Random *random, int playerBonusLevel) +int WoodSlabTile::getResource(int data, Random* random, int playerBonusLevel) { - return Tile::woodSlabHalf_Id; + return Tile::woodSlabHalf_Id; } shared_ptr WoodSlabTile::getSilkTouchItemInstance(int data) { - return std::make_shared(Tile::woodSlabHalf, 2, data & TYPE_MASK); + return std::make_shared(Tile::woodSlabHalf, 2, data & TYPE_MASK); } int WoodSlabTile::getAuxName(int auxValue) { - if (auxValue < 0 || auxValue >= SLAB_NAMES_LENGTH) - { - auxValue = 0; - } - return SLAB_NAMES[auxValue];//super.getDescriptionId() + "." + SLAB_NAMES[auxValue]; + if (auxValue < 0 || auxValue >= SLAB_NAMES_LENGTH) + auxValue = 0; + return SLAB_NAMES[auxValue]; } -void WoodSlabTile::registerIcons(IconRegister *iconRegister) +void WoodSlabTile::registerIcons(IconRegister* iconRegister) { - // None -} -unsigned int WoodSlabTile::getDescriptionId(int iData) -{ - if (iData < 0 || iData >= SLAB_NAMES_LENGTH) - { - iData = 0; - } - return SLAB_NAMES[iData]; } \ No newline at end of file diff --git a/Minecraft.World/WoodSlabTile.h b/Minecraft.World/WoodSlabTile.h index b91f713..1eba55e 100644 --- a/Minecraft.World/WoodSlabTile.h +++ b/Minecraft.World/WoodSlabTile.h @@ -1,28 +1,40 @@ #pragma once - -#include "Tile.h" #include "HalfSlabTile.h" class Player; -class WoodSlabTile : HalfSlabTile -{ - - friend class Tile; +class WoodSlabTile : public HalfSlabTile +{ + friend class Tile; public: - static const int TYPE_MASK = 7; - static const int TOP_SLOT_BIT = 8; - static const int SLAB_NAMES_LENGTH = 4; - static const unsigned int SLAB_NAMES[SLAB_NAMES_LENGTH]; + static const int SLAB_NAMES_LENGTH = 6; + static const unsigned int SLAB_NAMES[SLAB_NAMES_LENGTH]; - WoodSlabTile(int id, bool fullSize); - virtual Icon *getTexture(int face, int data); - virtual int getResource(int data, Random *random, int playerBonusLevel); - virtual int getAuxName(int auxValue); +public: + WoodSlabTile(int id); - virtual shared_ptr getSilkTouchItemInstance(int data); - void registerIcons(IconRegister *iconRegister); - - // 4J added - virtual unsigned int getDescriptionId(int iData = -1); + virtual int isFullSize() = 0; + + virtual Icon *getTexture(int face, int data) override; + virtual int getResource(int data, Random *random, int playerBonusLevel) override; + virtual int getAuxName(int auxValue) override; + virtual void registerIcons(IconRegister *iconRegister) override; + +protected: + virtual shared_ptr getSilkTouchItemInstance(int data) override; +}; + + +class HalfWoodSlabTile : public WoodSlabTile +{ +public: + HalfWoodSlabTile(int id) : WoodSlabTile(id) { DerivedInit(); } + virtual int isFullSize() override { return 0; } +}; + +class FullWoodSlabTile : public WoodSlabTile +{ +public: + FullWoodSlabTile(int id) : WoodSlabTile(id) { DerivedInit(); } + virtual int isFullSize() override { return 1; } }; \ No newline at end of file diff --git a/Minecraft.World/WoodTile.cpp b/Minecraft.World/WoodTile.cpp index 239ef61..1c89c72 100644 --- a/Minecraft.World/WoodTile.cpp +++ b/Minecraft.World/WoodTile.cpp @@ -11,9 +11,11 @@ const unsigned int WoodTile::WOOD_NAMES[WOOD_NAMES_LENGTH] = { IDS_TILE_OAKWOOD_ IDS_TILE_SPRUCEWOOD_PLANKS, IDS_TILE_BIRCHWOOD_PLANKS, IDS_TILE_JUNGLE_PLANKS, + -1, + -1 }; -const wstring WoodTile::TEXTURE_NAMES[] = {L"oak", L"spruce", L"birch", L"jungle"}; +const wstring WoodTile::TEXTURE_NAMES[] = { L"oak", L"spruce", L"birch", L"jungle", L"acacia", L"dark" }; // public static final String[] WOOD_NAMES = { // "oak", "spruce", "birch", "jungle" diff --git a/Minecraft.World/WoodTile.h b/Minecraft.World/WoodTile.h index 23bbdfb..1a4e8c4 100644 --- a/Minecraft.World/WoodTile.h +++ b/Minecraft.World/WoodTile.h @@ -7,7 +7,7 @@ class WoodTile : public Tile { friend class ChunkRebuildData; public: - static const int WOOD_NAMES_LENGTH = 4; + static const int WOOD_NAMES_LENGTH = 6; static const unsigned int WOOD_NAMES[WOOD_NAMES_LENGTH];