Files
MinecraftConsoles/Minecraft.World/GroundBushFeature.cpp
daoge b3feddfef3 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 97a4399472.

* 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>
2026-03-03 03:04:10 +08:00

43 lines
1.1 KiB
C++

#include "stdafx.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.level.tile.h"
#include "GroundBushFeature.h"
GroundBushFeature::GroundBushFeature(int trunkType, int leafType)
{
trunkTileType = trunkType;
leafTileType = leafType;
}
bool GroundBushFeature::place(Level *level, Random *random, int x, int y, int z)
{
PIXBeginNamedEvent(0,"Placing GroundBushFeature");
int t = 0;
while (((t = level->getTile(x, y, z)) == 0 || t == Tile::leaves_Id) && y > 0)
y--;
int tile = level->getTile(x, y, z);
if (tile == Tile::dirt_Id || tile == Tile::grass_Id)
{
y++;
placeBlock(level, x, y, z, Tile::treeTrunk_Id, trunkTileType);
for (int yy = y; yy <= y + 2; yy++)
{
int yo = yy - y;
int offs = 2 - yo;
for (int xx = x - offs; xx <= x + offs; xx++)
{
int xo = xx - (x);
for (int zz = z - offs; zz <= z + offs; zz++)
{
int zo = zz - (z);
if (abs(xo) == offs && abs(zo) == offs && random->nextInt(2) == 0) continue;
if (!Tile::solid[level->getTile(xx, yy, zz)]) placeBlock(level, xx, yy, zz, Tile::leaves_Id, leafTileType);
}
}
}
}
PIXEndNamedEvent();
return true;
}