From f904fb19727041deb6cf8602445c26dfb42908f7 Mon Sep 17 00:00:00 2001 From: Lord_Cambion Date: Mon, 25 May 2026 18:34:32 +0200 Subject: [PATCH] fix: fences turn grass into dirt problem: the game used is solid and it was wrong because blocks like fences or walls are also flagged as solit blocks because their material. --- Minecraft.World/GrassTile.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Minecraft.World/GrassTile.cpp b/Minecraft.World/GrassTile.cpp index c42ea940..61460727 100644 --- a/Minecraft.World/GrassTile.cpp +++ b/Minecraft.World/GrassTile.cpp @@ -121,8 +121,14 @@ void GrassTile::tick(Level *level, int x, int y, int z, Random *random) } } + // using isSolid() here is wrong because non full blocks like iron bars, + // fences, walls are also flagged as solid by their material + int aboveTileId = level->getTile(x, y + 1, z); Material* above = level->getMaterial(x, y + 1, z); - if (above->isSolid() || above->isLiquid()) level->setTileAndUpdate(x, y, z, Tile::dirt_Id); + if (above->isLiquid() || Tile::lightBlock[aboveTileId] > 2) + { + level->setTileAndUpdate(x, y, z, Tile::dirt_Id); + } } int GrassTile::getResource(int data, Random *random, int playerBonusLevel)