diff options
| author | daoge <3523206925@qq.com> | 2026-03-03 03:04:10 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-03 03:04:10 +0800 |
| commit | b3feddfef372618c8a9d7a0abcaf18cfad866c18 (patch) | |
| tree | 267761c3bb39241ba5c347bfbe2254d06686e287 /Minecraft.World/CakeTile.cpp | |
| parent | 84c31a2331f7a0ec85b9d438992e244f60e5020f (diff) | |
feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict
* feat: TU19 (Dec 2014) Features & Content (#32)
* December 2014 files
* Working release build
* Fix compilation issues
* Add sound to Windows64Media
* Add DLC content and force Tutorial DLC
* Revert "Add DLC content and force Tutorial DLC"
This reverts commit 97a43994725008e35fceb984d5549df9c8cea470.
* Disable broken light packing
* Disable breakpoint during DLC texture map load
Allows DLC loading but the DLC textures are still broken
* Fix post build not working
* ...
* fix vs2022 build
* fix cmake build
---------
Co-authored-by: Loki <lokirautio@gmail.com>
Diffstat (limited to 'Minecraft.World/CakeTile.cpp')
| -rw-r--r-- | Minecraft.World/CakeTile.cpp | 77 |
1 files changed, 38 insertions, 39 deletions
diff --git a/Minecraft.World/CakeTile.cpp b/Minecraft.World/CakeTile.cpp index 1254e10e..55dff176 100644 --- a/Minecraft.World/CakeTile.cpp +++ b/Minecraft.World/CakeTile.cpp @@ -20,44 +20,44 @@ CakeTile::CakeTile(int id) : Tile(id, Material::cake,isSolidRender()) void CakeTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr<TileEntity> forceEntity) // 4J added forceData, forceEntity param { - int d = level->getData(x, y, z); - float r = 1 / 16.0f; - float r2 = (1 + d * 2) / 16.0f; - float h = 8 / 16.0f; - this->setShape(r2, 0, r, 1 - r, h, 1 - r); + int d = level->getData(x, y, z); + float r = 1 / 16.0f; + float r2 = (1 + d * 2) / 16.0f; + float h = 8 / 16.0f; + this->setShape(r2, 0, r, 1 - r, h, 1 - r); } void CakeTile::updateDefaultShape() { - float r = 1 / 16.0f; - float h = 8 / 16.0f; - this->setShape(r, 0, r, 1 - r, h, 1 - r); + float r = 1 / 16.0f; + float h = 8 / 16.0f; + this->setShape(r, 0, r, 1 - r, h, 1 - r); } AABB *CakeTile::getAABB(Level *level, int x, int y, int z) { - int d = level->getData(x, y, z); - float r = 1 / 16.0f; - float r2 = (1 + d * 2) / 16.0f; - float h = 8 / 16.0f; - return AABB::newTemp(x + r2, y, z + r, x + 1 - r, y + h - r, z + 1 - r); + int d = level->getData(x, y, z); + float r = 1 / 16.0f; + float r2 = (1 + d * 2) / 16.0f; + float h = 8 / 16.0f; + return AABB::newTemp(x + r2, y, z + r, x + 1 - r, y + h - r, z + 1 - r); } AABB *CakeTile::getTileAABB(Level *level, int x, int y, int z) { - int d = level->getData(x, y, z); - float r = 1 / 16.0f; - float r2 = (1 + d * 2) / 16.0f; - float h = 8 / 16.0f; - return AABB::newTemp(x + r2, y, z + r, x + 1 - r, y + h, z + 1 - r); + int d = level->getData(x, y, z); + float r = 1 / 16.0f; + float r2 = (1 + d * 2) / 16.0f; + float h = 8 / 16.0f; + return AABB::newTemp(x + r2, y, z + r, x + 1 - r, y + h, z + 1 - r); } Icon *CakeTile::getTexture(int face, int data) { - if (face == Facing::UP) return iconTop; - if (face == Facing::DOWN) return iconBottom; - if (data > 0 && face == Facing::WEST) return iconInner; - return icon; + if (face == Facing::UP) return iconTop; + if (face == Facing::DOWN) return iconBottom; + if (data > 0 && face == Facing::WEST) return iconInner; + return icon; } void CakeTile::registerIcons(IconRegister *iconRegister) @@ -87,8 +87,8 @@ bool CakeTile::TestUse() bool CakeTile::use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if( soundOnly ) return false; - eat(level, x, y, z, player); - return true; + eat(level, x, y, z, player); + return true; } void CakeTile::attack(Level *level, int x, int y, int z, shared_ptr<Player> player) @@ -98,35 +98,34 @@ void CakeTile::attack(Level *level, int x, int y, int z, shared_ptr<Player> play void CakeTile::eat(Level *level, int x, int y, int z, shared_ptr<Player> player) { - if (player->canEat(false)) + if (player->canEat(false)) { - player->getFoodData()->eat(2, FoodConstants::FOOD_SATURATION_POOR); + player->getFoodData()->eat(2, FoodConstants::FOOD_SATURATION_POOR); - int d = level->getData(x, y, z) + 1; - if (d >= 6) + int d = level->getData(x, y, z) + 1; + if (d >= 6) { - level->setTile(x, y, z, 0); - } else + level->removeTile(x, y, z); + } + else { - level->setData(x, y, z, d); - level->setTileDirty(x, y, z); - } - } + level->setData(x, y, z, d, Tile::UPDATE_CLIENTS); + } + } } bool CakeTile::mayPlace(Level *level, int x, int y, int z) { - if (!Tile::mayPlace(level, x, y, z)) return false; + if (!Tile::mayPlace(level, x, y, z)) return false; - return canSurvive(level, x, y, z); + return canSurvive(level, x, y, z); } void CakeTile::neighborChanged(Level *level, int x, int y, int z, int type) { - if (!canSurvive(level, x, y, z)) + if (!canSurvive(level, x, y, z)) { - this->spawnResources(level, x, y, z, level->getData(x, y, z), 0); - level->setTile(x, y, z, 0); + level->removeTile(x, y, z); } } |
