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/TileItem.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/TileItem.cpp')
| -rw-r--r-- | Minecraft.World/TileItem.cpp | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/Minecraft.World/TileItem.cpp b/Minecraft.World/TileItem.cpp index 8f624bff..ce313dd6 100644 --- a/Minecraft.World/TileItem.cpp +++ b/Minecraft.World/TileItem.cpp @@ -19,13 +19,13 @@ using namespace std; TileItem::TileItem(int id) : Item(id) { - this->tileId = id + 256; - itemIcon = NULL; + this->tileId = id + 256; + itemIcon = NULL; } int TileItem::getTileId() { - return tileId; + return tileId; } int TileItem::getIconType() @@ -50,40 +50,40 @@ bool TileItem::useOn(shared_ptr<ItemInstance> instance, shared_ptr<Player> playe { // 4J-PB - Adding a test only version to allow tooltips to be displayed int currentTile = level->getTile(x, y, z); - if (currentTile == Tile::topSnow_Id) + if (currentTile == Tile::topSnow_Id && (level->getData(x, y, z) & TopSnowTile::HEIGHT_MASK) < 1) { - face = Facing::UP; + face = Facing::UP; } else if (currentTile == Tile::vine_Id || currentTile == Tile::tallgrass_Id || currentTile == Tile::deadBush_Id) { } else { - if (face == 0) y--; - if (face == 1) y++; - if (face == 2) z--; - if (face == 3) z++; - if (face == 4) x--; - if (face == 5) x++; - } + if (face == 0) y--; + if (face == 1) y++; + if (face == 2) z--; + if (face == 3) z++; + if (face == 4) x--; + if (face == 5) x++; + } - if (instance->count == 0) return false; - if (!player->mayBuild(x, y, z)) return false; + if (instance->count == 0) return false; + if (!player->mayUseItemAt(x, y, z, face, instance)) return false; if (y == Level::maxBuildHeight - 1 && Tile::tiles[tileId]->material->isSolid()) return false; int undertile = level->getTile(x,y-1,z); // For 'BodyGuard' achievement. - if (level->mayPlace(tileId, x, y, z, false, face, player)) + if (level->mayPlace(tileId, x, y, z, false, face, player, instance)) { if(!bTestUseOnOnly) { Tile *tile = Tile::tiles[tileId]; // 4J - Adding this from 1.6 - int itemValue = getLevelDataForAuxValue(instance->getAuxValue()); - int dataValue = Tile::tiles[tileId]->getPlacedOnFaceDataValue(level, x, y, z, face, clickX, clickY, clickZ, itemValue); - if (level->setTileAndData(x, y, z, tileId, dataValue)) + int itemValue = getLevelDataForAuxValue(instance->getAuxValue()); + int dataValue = Tile::tiles[tileId]->getPlacedOnFaceDataValue(level, x, y, z, face, clickX, clickY, clickZ, itemValue); + if (level->setTileAndData(x, y, z, tileId, dataValue, Tile::UPDATE_ALL)) { // 4J-JEV: Snow/Iron Golems do not have owners apparently. int newTileId = level->getTile(x,y,z); @@ -108,40 +108,40 @@ bool TileItem::useOn(shared_ptr<ItemInstance> instance, shared_ptr<Player> playe // 4J - Original comment // ok this may look stupid, but neighbor updates can cause the - // placed block to become something else before these methods - // are called + // placed block to become something else before these methods + // are called if (level->getTile(x, y, z) == tileId) { - Tile::tiles[tileId]->setPlacedBy(level, x, y, z, player); - Tile::tiles[tileId]->finalizePlacement(level, x, y, z, dataValue); + Tile::tiles[tileId]->setPlacedBy(level, x, y, z, player, instance); + Tile::tiles[tileId]->finalizePlacement(level, x, y, z, dataValue); } - + // 4J-PB - Java 1.4 change - getStepSound replaced with getPlaceSound //level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, tile->soundType->getStepSound(), (tile->soundType->getVolume() + 1) / 2, tile->soundType->getPitch() * 0.8f); #ifdef _DEBUG int iPlaceSound=tile->soundType->getPlaceSound(); int iStepSound=tile->soundType->getStepSound(); -// char szPlaceSoundName[256]; -// char szStepSoundName[256]; -// Minecraft *pMinecraft = Minecraft::GetInstance(); -// -// if(iPlaceSound==-1) -// { -// strcpy(szPlaceSoundName,"NULL"); -// } -// else -// { -// pMinecraft->soundEngine->GetSoundName(szPlaceSoundName,iPlaceSound); -// } -// if(iStepSound==-1) -// { -// strcpy(szStepSoundName,"NULL"); -// } -// else -// { -// pMinecraft->soundEngine->GetSoundName(szStepSoundName,iStepSound); -// } + // char szPlaceSoundName[256]; + // char szStepSoundName[256]; + // Minecraft *pMinecraft = Minecraft::GetInstance(); + // + // if(iPlaceSound==-1) + // { + // strcpy(szPlaceSoundName,"NULL"); + // } + // else + // { + // pMinecraft->soundEngine->GetSoundName(szPlaceSoundName,iPlaceSound); + // } + // if(iStepSound==-1) + // { + // strcpy(szStepSoundName,"NULL"); + // } + // else + // { + // pMinecraft->soundEngine->GetSoundName(szStepSoundName,iStepSound); + // } //app.DebugPrintf("Place Sound - %s, Step Sound - %s\n",szPlaceSoundName,szStepSoundName); app.DebugPrintf("Place Sound - %d, Step Sound - %d\n",iPlaceSound,iStepSound); @@ -156,9 +156,9 @@ bool TileItem::useOn(shared_ptr<ItemInstance> instance, shared_ptr<Player> playe } } } - return true; - } - return false; + return true; + } + return false; } @@ -179,7 +179,7 @@ bool TileItem::mayPlace(Level *level, int x, int y, int z, int face, shared_ptr< if (face == 5) x++; } - return level->mayPlace(getTileId(), x, y, z, false, face, nullptr); + return level->mayPlace(getTileId(), x, y, z, false, face, nullptr, item); } // 4J Added to colourise some tile types in the hint popups @@ -190,25 +190,25 @@ int TileItem::getColor(int itemAuxValue, int spriteLayer) unsigned int TileItem::getDescriptionId(shared_ptr<ItemInstance> instance) { - return Tile::tiles[tileId]->getDescriptionId(); + return Tile::tiles[tileId]->getDescriptionId(); } unsigned int TileItem::getDescriptionId(int iData /*= -1*/) { - return Tile::tiles[tileId]->getDescriptionId(iData); + return Tile::tiles[tileId]->getDescriptionId(iData); } unsigned int TileItem::getUseDescriptionId(shared_ptr<ItemInstance> instance) { - return Tile::tiles[tileId]->getUseDescriptionId(); + return Tile::tiles[tileId]->getUseDescriptionId(); } unsigned int TileItem::getUseDescriptionId() { - return Tile::tiles[tileId]->getUseDescriptionId(); + return Tile::tiles[tileId]->getUseDescriptionId(); } void TileItem::registerIcons(IconRegister *iconRegister) |
