From 32b2e4f50e52e36ac53770afc9af61b2a5c8b6c7 Mon Sep 17 00:00:00 2001 From: str1k3r <115313679+S1l3ntStr1ke87@users.noreply.github.com> Date: Sat, 10 Oct 2026 13:45:33 -0400 Subject: [PATCH] feat: TU0 leafs --- Minecraft.World/LeafTile.h | 1 + Minecraft.World/Level.cpp | 22 ---------------------- Minecraft.World/Region.cpp | 22 ---------------------- Minecraft.World/Tile.cpp | 36 ------------------------------------ 4 files changed, 1 insertion(+), 80 deletions(-) diff --git a/Minecraft.World/LeafTile.h b/Minecraft.World/LeafTile.h index e6c39a7f..6c2224b1 100644 --- a/Minecraft.World/LeafTile.h +++ b/Minecraft.World/LeafTile.h @@ -59,6 +59,7 @@ protected: virtual int getSpawnResourcesAuxValue(int data); public: virtual bool isSolidRender(bool isServerLevel = false); + virtual bool isCubeShaped() { return false; } virtual Icon *getTexture(int face, int data); void setFancy(bool fancyGraphics); diff --git a/Minecraft.World/Level.cpp b/Minecraft.World/Level.cpp index 4b6a64f5..8a4d96c9 100644 --- a/Minecraft.World/Level.cpp +++ b/Minecraft.World/Level.cpp @@ -2946,28 +2946,6 @@ bool Level::isSolidRenderTile(int x, int y, int z) Tile *tile = Tile::tiles[getTile(x, y, z)]; if (tile == NULL) return false; - // 4J - addition here to make rendering big blocks of leaves more efficient. Normally leaves never consider themselves as solid, so - // blocks of leaves will have all sides of each block completely visible. Changing to consider as solid if this block is surrounded by - // other leaves (or solid things). This is paired with another change in Tile::getTexture which makes such solid tiles actually visibly solid (these - // textures exist already for non-fancy graphics). Note: this tile-specific code is here rather than making some new virtual method in the tiles, - // for the sake of efficiency - I don't imagine we'll be doing much more of this sort of thing - - if( tile->id == Tile::leaves_Id ) - { - int axo[6] = { 1,-1, 0, 0, 0, 0}; - int ayo[6] = { 0, 0, 1,-1, 0, 0}; - int azo[6] = { 0, 0, 0, 0, 1,-1}; - for( int i = 0; i < 6; i++ ) - { - int t = getTile(x + axo[i], y + ayo[i] , z + azo[i]); - if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == NULL ) || !Tile::tiles[t]->isSolidRender() ) ) - { - return false; - } - } - - return true; - } return tile->isSolidRender(!isClientSide); } diff --git a/Minecraft.World/Region.cpp b/Minecraft.World/Region.cpp index 4c3a454d..b941b543 100644 --- a/Minecraft.World/Region.cpp +++ b/Minecraft.World/Region.cpp @@ -254,28 +254,6 @@ bool Region::isSolidRenderTile(int x, int y, int z) Tile *tile = Tile::tiles[getTile(x, y, z)]; if (tile == NULL) return false; - // 4J - addition here to make rendering big blocks of leaves more efficient. Normally leaves never consider themselves as solid, so - // blocks of leaves will have all sides of each block completely visible. Changing to consider as solid if this block is surrounded by - // other leaves (or solid things). This is paired with another change in Tile::getTexture which makes such solid tiles actually visibly solid (these - // textures exist already for non-fancy graphics). Note: this tile-specific code is here rather than making some new virtual method in the tiles, - // for the sake of efficiency - I don't imagine we'll be doing much more of this sort of thing - if( tile->id == Tile::leaves_Id ) - { - int axo[6] = { 1,-1, 0, 0, 0, 0}; - int ayo[6] = { 0, 0, 1,-1, 0, 0}; - int azo[6] = { 0, 0, 0, 0, 1,-1}; - for( int i = 0; i < 6; i++ ) - { - int t = getTile(x + axo[i], y + ayo[i] , z + azo[i]); - if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == NULL ) || !Tile::tiles[t]->isSolidRender() ) ) - { - return false; - } - } - - return true; - } - return tile->isSolidRender(); } diff --git a/Minecraft.World/Tile.cpp b/Minecraft.World/Tile.cpp index 497a11b3..b671293e 100644 --- a/Minecraft.World/Tile.cpp +++ b/Minecraft.World/Tile.cpp @@ -738,45 +738,9 @@ bool Tile::isSolidFace(LevelSource *level, int x, int y, int z, int face) Icon *Tile::getTexture(LevelSource *level, int x, int y, int z, int face) { - // 4J - addition here to make rendering big blocks of leaves more efficient. Normally leaves never consider themselves as solid, so - // blocks of leaves will have all sides of each block completely visible. Changing to consider as solid if this block is surrounded by - // other leaves (or solid things). This is paired with another change in Level::isSolidRenderTile/Region::isSolidRenderTile which makes things solid - // code-wise (ie for determining visible sides of neighbouring blocks). This change just makes the texture a solid one (tex + 1) which - // we already have in the texture map for doing non-fancy graphics. Note: this tile-specific code is here rather than making some new virtual - // method in the tiles, for the sake of efficiency - I don't imagine we'll be doing much more of this sort of thing - int tileId = level->getTile(x, y, z); int tileData = level->getData(x, y, z); - if( tileId == Tile::leaves_Id ) - { - bool opaque = true; - - int axo[6] = { 1,-1, 0, 0, 0, 0}; - int ayo[6] = { 0, 0, 1,-1, 0, 0}; - int azo[6] = { 0, 0, 0, 0, 1,-1}; - for( int i = 0; (i < 6) && opaque; i++ ) - { - int t = level->getTile(x + axo[i], y + ayo[i] , z + azo[i]); - if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == NULL ) || !Tile::tiles[t]->isSolidRender() ) ) - { - opaque = false; - } - } - - Icon *icon = NULL; - if(opaque) - { - Tile::leaves->setFancy(false); - icon = getTexture(face, tileData); - Tile::leaves->setFancy(true); - } - else - { - icon = getTexture(face, tileData); - } - return icon; - } return getTexture(face, tileData); }