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/StructurePiece.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/StructurePiece.cpp')
| -rw-r--r-- | Minecraft.World/StructurePiece.cpp | 57 |
1 files changed, 46 insertions, 11 deletions
diff --git a/Minecraft.World/StructurePiece.cpp b/Minecraft.World/StructurePiece.cpp index 1d41a608..cd483a6e 100644 --- a/Minecraft.World/StructurePiece.cpp +++ b/Minecraft.World/StructurePiece.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "net.minecraft.world.level.levelgen.structure.h" #include "net.minecraft.world.level.h" #include "net.minecraft.world.level.tile.h" #include "net.minecraft.world.level.material.h" @@ -41,6 +42,14 @@ * chunks, leading to infinite loops and other errors. */ +StructurePiece::StructurePiece() +{ + boundingBox = NULL; + orientation = 0; + genDepth = 0; + // for reflection +} + StructurePiece::StructurePiece( int genDepth ) { boundingBox = NULL; @@ -53,6 +62,33 @@ StructurePiece::~StructurePiece() if(boundingBox != NULL) delete boundingBox; } +CompoundTag *StructurePiece::createTag() +{ + CompoundTag *tag = new CompoundTag(); + + tag->putString(L"id", StructureFeatureIO::getEncodeId(this)); + tag->put(L"BB", boundingBox->createTag(L"BB")); + tag->putInt(L"O", orientation); + tag->putInt(L"GD", genDepth); + + addAdditonalSaveData(tag); + + return tag; +} + +void StructurePiece::load(Level *level, CompoundTag *tag) +{ + + if (tag->contains(L"BB")) + { + boundingBox = new BoundingBox(tag->getIntArray(L"BB")); + } + orientation = tag->getInt(L"O"); + genDepth = tag->getInt(L"GD"); + + readAdditonalSaveData(tag); +} + void StructurePiece::addChildren( StructurePiece* startPiece, list< StructurePiece* > *pieces, Random* random ) { } @@ -205,13 +241,13 @@ int StructurePiece::getOrientationData( int tile, int data ) { if ( orientation == Direction::WEST || orientation == Direction::EAST ) { - if ( data == RailTile::DIR_FLAT_X ) + if ( data == BaseRailTile::DIR_FLAT_X ) { - return RailTile::DIR_FLAT_Z; + return BaseRailTile::DIR_FLAT_Z; } else { - return RailTile::DIR_FLAT_X; + return BaseRailTile::DIR_FLAT_X; } } } @@ -245,7 +281,7 @@ int StructurePiece::getOrientationData( int tile, int data ) return ( data + 3 ) & 3; } } - else if ( tile == Tile::stairs_stone_Id || tile == Tile::stairs_wood_Id || tile == Tile::stairs_netherBricks_Id || tile == Tile::stairs_stoneBrickSmooth_Id || tile == Tile::stairs_sandstone_Id) + else if ( tile == Tile::stairs_stone_Id || tile == Tile::stairs_wood_Id || tile == Tile::stairs_netherBricks_Id || tile == Tile::stairs_stoneBrick_Id || tile == Tile::stairs_sandstone_Id) { if ( orientation == Direction::SOUTH ) { @@ -515,7 +551,7 @@ void StructurePiece::placeBlock( Level* level, int block, int data, int x, int y // 4J Stu - We shouldn't be removing bedrock when generating things (eg in SuperFlat) if(worldY == 0) return; - level->setTileAndDataNoUpdate( worldX, worldY, worldZ, block, data ); + level->setTileAndData( worldX, worldY, worldZ, block, data, Tile::UPDATE_CLIENTS); } @@ -745,13 +781,12 @@ void StructurePiece::generateAirColumnUp( Level* level, int x, int startY, int z while ( !level->isEmptyTile( worldX, worldY, worldZ ) && worldY < Level::maxBuildHeight - 1 ) { - level->setTileAndDataNoUpdate( worldX, worldY, worldZ, 0, 0 ); + level->setTileAndData( worldX, worldY, worldZ, 0, 0, Tile::UPDATE_CLIENTS); worldY++; } } -void StructurePiece::fillColumnDown( Level* level, int tile, int tileData, int x, int startY, int z, - BoundingBox* chunkBB ) +void StructurePiece::fillColumnDown( Level* level, int tile, int tileData, int x, int startY, int z, BoundingBox* chunkBB ) { int worldX = getWorldX( x, z ); int worldY = getWorldY( startY ); @@ -764,7 +799,7 @@ void StructurePiece::fillColumnDown( Level* level, int tile, int tileData, int x while ( ( level->isEmptyTile( worldX, worldY, worldZ ) || level->getMaterial( worldX, worldY, worldZ )->isLiquid() ) && worldY > 1 ) { - level->setTileAndDataNoUpdate( worldX, worldY, worldZ, tile, tileData ); + level->setTileAndData( worldX, worldY, worldZ, tile, tileData, Tile::UPDATE_CLIENTS ); worldY--; } } @@ -780,7 +815,7 @@ bool StructurePiece::createChest( Level* level, BoundingBox* chunkBB, Random* ra { if ( level->getTile( worldX, worldY, worldZ ) != Tile::chest->id ) { - level->setTile( worldX, worldY, worldZ, Tile::chest->id ); + level->setTileAndData( worldX, worldY, worldZ, Tile::chest->id, 0, Tile::UPDATE_CLIENTS ); shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity( worldX, worldY, worldZ )); if ( chest != NULL ) WeighedTreasure::addChestItems( random, treasure, chest, numRolls ); return true; @@ -799,7 +834,7 @@ bool StructurePiece::createDispenser(Level *level, BoundingBox *chunkBB, Random { if (level->getTile(worldX, worldY, worldZ) != Tile::dispenser_Id) { - level->setTileAndData(worldX, worldY, worldZ, Tile::dispenser_Id, getOrientationData(Tile::dispenser_Id, facing)); + level->setTileAndData(worldX, worldY, worldZ, Tile::dispenser_Id, getOrientationData(Tile::dispenser_Id, facing), Tile::UPDATE_CLIENTS); shared_ptr<DispenserTileEntity> dispenser = dynamic_pointer_cast<DispenserTileEntity>(level->getTileEntity(worldX, worldY, worldZ)); if (dispenser != NULL) WeighedTreasure::addDispenserItems(random, items, dispenser, numRolls); return true; |
