mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-17 20:10:23 +03:00
push repo once again (github.dev unstable)
This commit is contained in:
30
source/world/level/levelgen/feature/FlowerFeature.cpp
Normal file
30
source/world/level/levelgen/feature/FlowerFeature.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
/********************************************************************
|
||||
Minecraft: Pocket Edition - Decompilation Project
|
||||
Copyright (C) 2023 iProgramInCpp
|
||||
|
||||
The following code is licensed under the BSD 1 clause license.
|
||||
SPDX-License-Identifier: BSD-1-Clause
|
||||
********************************************************************/
|
||||
|
||||
#include "Feature.hpp"
|
||||
#include "Level.hpp"
|
||||
|
||||
FlowerFeature::FlowerFeature(int id)
|
||||
{
|
||||
m_ID = id;
|
||||
}
|
||||
|
||||
bool FlowerFeature::place(Level* level, Random* random, int x, int y, int z)
|
||||
{
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
int nX = x + random->nextInt(8) - random->nextInt(8);
|
||||
int nY = y + random->nextInt(4) - random->nextInt(4);
|
||||
int nZ = z + random->nextInt(8) - random->nextInt(8);
|
||||
|
||||
if (level->isEmptyTile(nX, nY, nZ) && Tile::tiles[m_ID]->canSurvive(level, nX, nY, nZ))
|
||||
level->setTileNoUpdate(nX, nY, nZ, m_ID);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user