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/CauldronTile.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/CauldronTile.cpp')
| -rw-r--r-- | Minecraft.World/CauldronTile.cpp | 111 |
1 files changed, 66 insertions, 45 deletions
diff --git a/Minecraft.World/CauldronTile.cpp b/Minecraft.World/CauldronTile.cpp index 4d5640ca..f7a8d044 100644 --- a/Minecraft.World/CauldronTile.cpp +++ b/Minecraft.World/CauldronTile.cpp @@ -13,9 +13,9 @@ const wstring CauldronTile::TEXTURE_BOTTOM = L"cauldron_bottom"; CauldronTile::CauldronTile(int id) : Tile(id, Material::metal, isSolidRender()) { - iconInner = NULL; - iconTop = NULL; - iconBottom = NULL; + iconInner = NULL; + iconTop = NULL; + iconBottom = NULL; } Icon *CauldronTile::getTexture(int face, int data) @@ -48,19 +48,19 @@ Icon *CauldronTile::getTexture(const wstring &name) void CauldronTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr<Entity> source) { - setShape(0, 0, 0, 1, 5.0f / 16.0f, 1); - Tile::addAABBs(level, x, y, z, box, boxes, source); - float thickness = 2.0f / 16.0f; - setShape(0, 0, 0, thickness, 1, 1); - Tile::addAABBs(level, x, y, z, box, boxes, source); - setShape(0, 0, 0, 1, 1, thickness); - Tile::addAABBs(level, x, y, z, box, boxes, source); - setShape(1 - thickness, 0, 0, 1, 1, 1); - Tile::addAABBs(level, x, y, z, box, boxes, source); - setShape(0, 0, 1 - thickness, 1, 1, 1); - Tile::addAABBs(level, x, y, z, box, boxes, source); - - updateDefaultShape(); + setShape(0, 0, 0, 1, 5.0f / 16.0f, 1); + Tile::addAABBs(level, x, y, z, box, boxes, source); + float thickness = 2.0f / 16.0f; + setShape(0, 0, 0, thickness, 1, 1); + Tile::addAABBs(level, x, y, z, box, boxes, source); + setShape(0, 0, 0, 1, 1, thickness); + Tile::addAABBs(level, x, y, z, box, boxes, source); + setShape(1 - thickness, 0, 0, 1, 1, 1); + Tile::addAABBs(level, x, y, z, box, boxes, source); + setShape(0, 0, 1 - thickness, 1, 1, 1); + Tile::addAABBs(level, x, y, z, box, boxes, source); + + updateDefaultShape(); } void CauldronTile::updateDefaultShape() @@ -87,43 +87,45 @@ bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr<Player> pla { if(soundOnly) return false; - if (level->isClientSide) + if (level->isClientSide) { - return true; - } + return true; + } - shared_ptr<ItemInstance> item = player->inventory->getSelected(); - if (item == NULL) + shared_ptr<ItemInstance> item = player->inventory->getSelected(); + if (item == NULL) { - return true; - } + return true; + } - int currentData = level->getData(x, y, z); + int currentData = level->getData(x, y, z); + int fillLevel = getFillLevel(currentData); - if (item->id == Item::bucket_water_Id) + if (item->id == Item::bucket_water_Id) { - if (currentData < 3) + if (fillLevel < 3) { - if (!player->abilities.instabuild) + if (!player->abilities.instabuild) { - player->inventory->setItem(player->inventory->selected, shared_ptr<ItemInstance>(new ItemInstance(Item::bucket_empty))); - } + player->inventory->setItem(player->inventory->selected, shared_ptr<ItemInstance>(new ItemInstance(Item::bucket_empty))); + } - level->setData(x, y, z, 3); - } - return true; - } + level->setData(x, y, z, 3, Tile::UPDATE_CLIENTS); + level->updateNeighbourForOutputSignal(x, y, z, id); + } + return true; + } else if (item->id == Item::glassBottle_Id) { - if (currentData > 0) + if (fillLevel > 0) { - shared_ptr<ItemInstance> potion = shared_ptr<ItemInstance>(new ItemInstance(Item::potion, 1, 0)); - if (!player->inventory->add(potion)) + shared_ptr<ItemInstance> potion = shared_ptr<ItemInstance>(new ItemInstance(Item::potion, 1, 0)); + if (!player->inventory->add(potion)) { - level->addEntity(shared_ptr<ItemEntity>(new ItemEntity(level, x + 0.5, y + 1.5, z + 0.5, potion))); - } + level->addEntity(shared_ptr<ItemEntity>(new ItemEntity(level, x + 0.5, y + 1.5, z + 0.5, potion))); + } // 4J Stu - Brought forward change to update inventory when filling bottles with water - else if (dynamic_pointer_cast<ServerPlayer>( player ) != NULL) + else if (player->instanceof(eTYPE_SERVERPLAYER)) { dynamic_pointer_cast<ServerPlayer>( player )->refreshContainer(player->inventoryMenu); } @@ -136,21 +138,23 @@ bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr<Player> pla player->inventory->setItem(player->inventory->selected, nullptr); } } - level->setData(x, y, z, currentData - 1); - } + level->setData(x, y, z, fillLevel - 1, Tile::UPDATE_CLIENTS); + level->updateNeighbourForOutputSignal(x, y, z, id); + } } - else if (currentData > 0) + else if (fillLevel > 0) { ArmorItem *armor = dynamic_cast<ArmorItem *>(item->getItem()); if(armor && armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH) { armor->clearColor(item); - level->setData(x, y, z, currentData - 1); + level->setData(x, y, z, fillLevel - 1, Tile::UPDATE_CLIENTS); + level->updateNeighbourForOutputSignal(x, y, z, id); return true; } } - return true; + return true; } @@ -162,7 +166,7 @@ void CauldronTile::handleRain(Level *level, int x, int y, int z) if (data < 3) { - level->setData(x, y, z, data + 1); + level->setData(x, y, z, data + 1, Tile::UPDATE_CLIENTS); } } @@ -174,4 +178,21 @@ int CauldronTile::getResource(int data, Random *random, int playerBonusLevel) int CauldronTile::cloneTileId(Level *level, int x, int y, int z) { return Item::cauldron_Id; +} + +bool CauldronTile::hasAnalogOutputSignal() +{ + return true; +} + +int CauldronTile::getAnalogOutputSignal(Level *level, int x, int y, int z, int dir) +{ + int data = level->getData(x, y, z); + + return getFillLevel(data); +} + +int CauldronTile::getFillLevel(int data) +{ + return data; }
\ No newline at end of file |
