mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-07-17 21:38:10 +00:00
TU19: merge Minecraft.World/WorldGen
This commit is contained in:
@@ -44,14 +44,13 @@ bool BonusChestFeature::place(Level* level, Random* random, int x, int y, int z,
|
||||
|
||||
if (force) {
|
||||
x2 = x;
|
||||
y2 =
|
||||
y - 1; // 4J - the position passed in is actually two above the
|
||||
// top solid block, as the calling function adds 1 to
|
||||
// getTopSolidBlock, and that actually returns the block
|
||||
// above anyway. this would explain why there is a while
|
||||
// loop above here (not used in force mode) to move the
|
||||
// y back down again, shouldn't really be needed if 1
|
||||
// wasn't added to the getTopSolidBlock return value.
|
||||
y2 = y - 1; // 4J - the position passed in is actually two above
|
||||
// the top solid block, as the calling function adds 1
|
||||
// to getTopSolidBlock, and that actually returns the
|
||||
// block above anyway.
|
||||
// this would explain why there is a while loop above here (not used
|
||||
// in force mode) to move the y back down again, shouldn't really be
|
||||
// needed if 1 wasn't added to the getTopSolidBlock return value.
|
||||
z2 = z;
|
||||
} else {
|
||||
x2 = x + random->nextInt(4) - random->nextInt(4);
|
||||
@@ -61,7 +60,8 @@ bool BonusChestFeature::place(Level* level, Random* random, int x, int y, int z,
|
||||
|
||||
if (force || (level->isEmptyTile(x2, y2, z2) &&
|
||||
level->isTopSolidBlocking(x2, y2 - 1, z2))) {
|
||||
level->setTile(x2, y2, z2, Tile::chest_Id);
|
||||
level->setTileAndData(x2, y2, z2, Tile::chest_Id, 0,
|
||||
Tile::UPDATE_CLIENTS);
|
||||
std::shared_ptr<ChestTileEntity> chest =
|
||||
std::dynamic_pointer_cast<ChestTileEntity>(
|
||||
level->getTileEntity(x2, y2, z2));
|
||||
@@ -72,19 +72,23 @@ bool BonusChestFeature::place(Level* level, Random* random, int x, int y, int z,
|
||||
}
|
||||
if (level->isEmptyTile(x2 - 1, y2, z2) &&
|
||||
level->isTopSolidBlocking(x2 - 1, y2 - 1, z2)) {
|
||||
level->setTile(x2 - 1, y2, z2, Tile::torch_Id);
|
||||
level->setTileAndData(x2 - 1, y2, z2, Tile::torch_Id, 0,
|
||||
Tile::UPDATE_CLIENTS);
|
||||
}
|
||||
if (level->isEmptyTile(x2 + 1, y2, z2) &&
|
||||
level->isTopSolidBlocking(x2 - 1, y2 - 1, z2)) {
|
||||
level->setTile(x2 + 1, y2, z2, Tile::torch_Id);
|
||||
level->setTileAndData(x2 + 1, y2, z2, Tile::torch_Id, 0,
|
||||
Tile::UPDATE_CLIENTS);
|
||||
}
|
||||
if (level->isEmptyTile(x2, y2, z2 - 1) &&
|
||||
level->isTopSolidBlocking(x2 - 1, y2 - 1, z2)) {
|
||||
level->setTile(x2, y2, z2 - 1, Tile::torch_Id);
|
||||
level->setTileAndData(x2, y2, z2 - 1, Tile::torch_Id, 0,
|
||||
Tile::UPDATE_CLIENTS);
|
||||
}
|
||||
if (level->isEmptyTile(x2, y2, z2 + 1) &&
|
||||
level->isTopSolidBlocking(x2 - 1, y2 - 1, z2)) {
|
||||
level->setTile(x2, y2, z2 + 1, Tile::torch_Id);
|
||||
level->setTileAndData(x2, y2, z2 + 1, Tile::torch_Id, 0,
|
||||
Tile::UPDATE_CLIENTS);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user