aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/FallingTileRenderer.cpp
diff options
context:
space:
mode:
authordaoge <3523206925@qq.com>2026-03-03 03:04:10 +0800
committerGitHub <noreply@github.com>2026-03-03 03:04:10 +0800
commitb3feddfef372618c8a9d7a0abcaf18cfad866c18 (patch)
tree267761c3bb39241ba5c347bfbe2254d06686e287 /Minecraft.Client/FallingTileRenderer.cpp
parent84c31a2331f7a0ec85b9d438992e244f60e5020f (diff)
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 97a43994725008e35fceb984d5549df9c8cea470. * 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>
Diffstat (limited to 'Minecraft.Client/FallingTileRenderer.cpp')
-rw-r--r--Minecraft.Client/FallingTileRenderer.cpp77
1 files changed, 44 insertions, 33 deletions
diff --git a/Minecraft.Client/FallingTileRenderer.cpp b/Minecraft.Client/FallingTileRenderer.cpp
index 02e23dad..2d9f5dae 100644
--- a/Minecraft.Client/FallingTileRenderer.cpp
+++ b/Minecraft.Client/FallingTileRenderer.cpp
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "FallingTileRenderer.h"
+#include "TextureAtlas.h"
#include "TileRenderer.h"
#include "..\Minecraft.World\net.minecraft.world.entity.item.h"
#include "..\Minecraft.World\net.minecraft.world.level.h"
@@ -16,41 +17,51 @@ void FallingTileRenderer::render(shared_ptr<Entity> _tile, double x, double y, d
{
// 4J - dynamic cast required because we aren't using templates/generics in our version
shared_ptr<FallingTile> tile = dynamic_pointer_cast<FallingTile>(_tile);
- glPushMatrix();
- glTranslatef((float) x, (float) y, (float) z);
-
- bindTexture(TN_TERRAIN); // 4J was L"/terrain.png"
- Tile *tt = Tile::tiles[tile->tile];
-
Level *level = tile->getLevel();
- glDisable(GL_LIGHTING);
- glColor4f(1, 1, 1, 1); // 4J added - this wouldn't be needed in real opengl as the block render has vertex colours and so this isn't use, but our pretend gl always modulates with this
- if (tt == Tile::anvil && tt->getRenderShape() == Tile::SHAPE_ANVIL)
- {
- tileRenderer->level = level;
- Tesselator *t = Tesselator::getInstance();
- t->begin();
- t->offset(-Mth::floor(tile->x) - 0.5f, -Mth::floor(tile->y) - 0.5f, -Mth::floor(tile->z) - 0.5f);
- tileRenderer->tesselateAnvilInWorld((AnvilTile *) tt, Mth::floor(tile->x), Mth::floor(tile->y), Mth::floor(tile->z), tile->data);
- t->offset(0, 0, 0);
- t->end();
- }
- else if (tt == Tile::dragonEgg)
- {
- tileRenderer->level = level;
- Tesselator *t = Tesselator::getInstance();
- t->begin();
- t->offset(-Mth::floor(tile->x) - 0.5f, -Mth::floor(tile->y) - 0.5f, -Mth::floor(tile->z) - 0.5f);
- tileRenderer->tesselateInWorld(tt, Mth::floor(tile->x), Mth::floor(tile->y), Mth::floor(tile->z));
- t->offset(0, 0, 0);
- t->end();
- }
- else if( tt != NULL )
+ if (level->getTile(floor(tile->x), floor(tile->y), floor(tile->z)) != tile->tile)
{
- tileRenderer->setShape(tt);
- tileRenderer->renderBlock(tt, level, Mth::floor(tile->x), Mth::floor(tile->y), Mth::floor(tile->z), tile->data);
+ glPushMatrix();
+ glTranslatef((float) x, (float) y, (float) z);
+
+ bindTexture(tile); // 4J was L"/terrain.png"
+ Tile *tt = Tile::tiles[tile->tile];
+
+ Level *level = tile->getLevel();
+
+ glDisable(GL_LIGHTING);
+ glColor4f(1, 1, 1, 1); // 4J added - this wouldn't be needed in real opengl as the block render has vertex colours and so this isn't use, but our pretend gl always modulates with this
+ if (tt == Tile::anvil && tt->getRenderShape() == Tile::SHAPE_ANVIL)
+ {
+ tileRenderer->level = level;
+ Tesselator *t = Tesselator::getInstance();
+ t->begin();
+ t->offset(-Mth::floor(tile->x) - 0.5f, -Mth::floor(tile->y) - 0.5f, -Mth::floor(tile->z) - 0.5f);
+ tileRenderer->tesselateAnvilInWorld((AnvilTile *) tt, Mth::floor(tile->x), Mth::floor(tile->y), Mth::floor(tile->z), tile->data);
+ t->offset(0, 0, 0);
+ t->end();
+ }
+ else if (tt == Tile::dragonEgg)
+ {
+ tileRenderer->level = level;
+ Tesselator *t = Tesselator::getInstance();
+ t->begin();
+ t->offset(-Mth::floor(tile->x) - 0.5f, -Mth::floor(tile->y) - 0.5f, -Mth::floor(tile->z) - 0.5f);
+ tileRenderer->tesselateInWorld(tt, Mth::floor(tile->x), Mth::floor(tile->y), Mth::floor(tile->z));
+ t->offset(0, 0, 0);
+ t->end();
+ }
+ else if( tt != NULL )
+ {
+ tileRenderer->setShape(tt);
+ tileRenderer->renderBlock(tt, level, Mth::floor(tile->x), Mth::floor(tile->y), Mth::floor(tile->z), tile->data);
+ }
+ glEnable(GL_LIGHTING);
+ glPopMatrix();
}
- glEnable(GL_LIGHTING);
- glPopMatrix();
+}
+
+ResourceLocation *FallingTileRenderer::getTextureLocation(shared_ptr<Entity> mob)
+{
+ return &TextureAtlas::LOCATION_BLOCKS;
} \ No newline at end of file