aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/VinesFeature.cpp
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/VinesFeature.cpp
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.World/VinesFeature.cpp')
-rw-r--r--Minecraft.World/VinesFeature.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/Minecraft.World/VinesFeature.cpp b/Minecraft.World/VinesFeature.cpp
new file mode 100644
index 00000000..314b978e
--- /dev/null
+++ b/Minecraft.World/VinesFeature.cpp
@@ -0,0 +1,39 @@
+#include "stdafx.h"
+#include "net.minecraft.world.level.h"
+#include "net.minecraft.world.level.tile.h"
+#include "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->setTileAndDataNoUpdate(x, y, z, Tile::vine_Id, 1 << Direction::FACING_DIRECTION[Facing::OPPOSITE_FACING[face]]);
+ break;
+ }
+ }
+ }
+ else
+ {
+ x = ox + random->nextInt(4) - random->nextInt(4);
+ z = oz + random->nextInt(4) - random->nextInt(4);
+ }
+ y++;
+ }
+
+ return true;
+} \ No newline at end of file