mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-24 03:33:36 +00:00
33 lines
1 KiB
C++
33 lines
1 KiB
C++
#include "../../Platform/stdafx.h"
|
|
#include "../../Headers/net.minecraft.world.level.h"
|
|
#include "../../Headers/net.minecraft.world.level.tile.h"
|
|
#include "../../Headers/net.minecraft.h"
|
|
#include "VinesFeature.h"
|
|
|
|
VinesFeature::VinesFeature() {}
|
|
|
|
bool VinesFeature::place(Level* level, Random* random, int x, int y, int z) {
|
|
int ox = x;
|
|
int oz = z;
|
|
|
|
while (y < 128) {
|
|
if (level->isEmptyTile(x, y, z)) {
|
|
for (int face = Facing::NORTH; face <= Facing::EAST; face++) {
|
|
if (Tile::vine->mayPlace(level, x, y, z, face)) {
|
|
level->setTileAndData(
|
|
x, y, z, Tile::vine_Id,
|
|
1 << Direction::FACING_DIRECTION
|
|
[Facing::OPPOSITE_FACING[face]],
|
|
Tile::UPDATE_CLIENTS);
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
x = ox + random->nextInt(4) - random->nextInt(4);
|
|
z = oz + random->nextInt(4) - random->nextInt(4);
|
|
}
|
|
y++;
|
|
}
|
|
|
|
return true;
|
|
} |