diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index df09f2c937..710c0a4c38 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -59,6 +59,8 @@ * `Remove Chest Placement Restrictions` (Enabled By Default) * `Fix Hanging When No Valid Spawn Point Exists` (Enabled By Default) * `Batch Font Rendering` (Enabled By Default) + * `Fix Furnace Screen Visual Bug` (Enabled By Default) + * `Fix Held Item Poking Through Screen Overlay` (Enabled By Default) * Existing Functionality (All Enabled By Default) * `Fix Screen Rendering When Hiding HUD` * `Sanitize Usernames` @@ -66,7 +68,6 @@ * `Log RakNet Startup Errors` * `Prevent Unnecessary Server Pinging` * `Proper OpenGL Buffer Generation` - * `Fix Furnace Screen Visual Bug` * `Fullscreen Support` * `Always Save Chest Tile Entities` * `Fix Transferring Durability When Using Items` diff --git a/libreborn/src/util/env/flags/available-feature-flags b/libreborn/src/util/env/flags/available-feature-flags index 1661516244..8c973df240 100644 --- a/libreborn/src/util/env/flags/available-feature-flags +++ b/libreborn/src/util/env/flags/available-feature-flags @@ -57,9 +57,6 @@ CATEGORY Rendering TRUE Show Block Outlines TRUE Replace Block Highlight With Outline TRUE Hide Block Outline When UI Is Hidden - CATEGORY Block Tinting - FALSE Add Biome Colors To Grass - FALSE Disable Block Tinting TRUE Display Nametags By Default TRUE Disable V-Sync TRUE 3D Chest Model @@ -72,6 +69,9 @@ CATEGORY Rendering TRUE Render Vignette TRUE Proper Entity Shading CATEGORY Textures + CATEGORY Tinting + FALSE Add Biome Colors To Grass + FALSE Disable Block Tinting TRUE Regenerate "gui_blocks" Atlas TRUE Animated Water TRUE Animated Lava @@ -113,6 +113,7 @@ CATEGORY Bug Fixes TRUE Fix Screen Rendering When Hiding HUD TRUE Fix Sugar Position In Hand TRUE Fix Switching Perspective While Sneaking + TRUE Fix Held Item Poking Through Screen Overlay CATEGORY Network TRUE Patch RakNet Security Bug TRUE Prevent Unnecessary Server Pinging diff --git a/mods/src/misc/tinting.cpp b/mods/src/misc/tinting.cpp index ee43f69cc9..c46b2fddd3 100644 --- a/mods/src/misc/tinting.cpp +++ b/mods/src/misc/tinting.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -101,8 +102,7 @@ void _init_misc_tinting() { // Fancy Grass Side // This Requires Alpha Testing On The Opaque Render-Layer, Which Could Hurt Performance overwrite_calls(TileRenderer_tesselateBlockInWorld, TileRenderer_tesselateBlockInWorld_injection); - unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop" - patch((void *) 0x4a038, nop_patch); + overwrite_call_manual((void *) 0x4a038, (void *) media_glEnable); } // Disable Block Tinting diff --git a/mods/src/misc/ui.cpp b/mods/src/misc/ui.cpp index 316fe0826c..62bed5ce01 100644 --- a/mods/src/misc/ui.cpp +++ b/mods/src/misc/ui.cpp @@ -282,20 +282,44 @@ static void Minecraft_setSize_injection(Minecraft_setSize_t original, Minecraft // Batch Font Rendering template -static void Font_draw_injection(const std::function &original, Args... args) { +static void Font_draw_injection(const std::function &original, Font *self, Args... args) { Tesselator &t = Tesselator::instance; const bool was_already_overridden = t.void_begin_end; if (!was_already_overridden) { t.begin(GL_QUADS); t.voidBeginAndEndCalls(true); } - original(std::forward(args)...); + original(self, std::forward(args)...); if (!was_already_overridden) { t.voidBeginAndEndCalls(false); t.draw(); } } +// Screen Overlay +static void ItemInHandRenderer_renderScreenEffect_injection(__attribute__((unused)) ItemInHandRenderer_renderScreenEffect_t original, ItemInHandRenderer *self, float param_1) { + media_glDisable(GL_ALPHA_TEST); + const Minecraft *mc = self->minecraft; + LocalPlayer *player = mc->player; + mc->textures->loadAndBindTexture("terrain.png"); + if (player->isInWall()) { + int x = Mth::floor(player->x); + int y = Mth::floor(player->y); + int z = Mth::floor(player->z); + const int id = mc->level->getTile(x, y, z); + Tile *tile = Tile::tiles[id]; + if (tile != nullptr) { + media_glClear(GL_DEPTH_BUFFER_BIT); + self->renderTex(param_1, tile->getTexture1(2)); + } + } + if (player->isOnFire()) { + media_glClear(GL_DEPTH_BUFFER_BIT); + self->renderFire(param_1); + } + media_glEnable(GL_ALPHA_TEST); +} + // Init void _init_misc_ui() { // Food Overlay @@ -411,8 +435,13 @@ void _init_misc_ui() { // Batch Font Rendering if (feature_has("Batch Font Rendering", server_disabled)) { - overwrite_calls(Font_drawSlow, Font_draw_injection); - overwrite_calls(Font_drawShadow, Font_draw_injection); - overwrite_calls(Font_drawShadow_raw, Font_draw_injection); + overwrite_calls(Font_drawSlow, Font_draw_injection); + overwrite_calls(Font_drawShadow, Font_draw_injection); + overwrite_calls(Font_drawShadow_raw, Font_draw_injection); + } + + // Fix Screen Overlays + if (feature_has("Fix Held Item Poking Through Screen Overlay", server_disabled)) { + overwrite_calls(ItemInHandRenderer_renderScreenEffect, ItemInHandRenderer_renderScreenEffect_injection); } } diff --git a/symbols/src/entity/Entity.def b/symbols/src/entity/Entity.def index f82b32ab49..8a1fa23d5b 100644 --- a/symbols/src/entity/Entity.def +++ b/symbols/src/entity/Entity.def @@ -23,6 +23,7 @@ virtual-method bool isOnFire() = 0x90; virtual-method void baseTick() = 0x38; virtual-method bool isSneaking() = 0x88; virtual-method float getShadowHeightOffs() = 0x60; +virtual-method bool isInWall() = 0x48; property float x = 0x4; property float y = 0x8; diff --git a/symbols/src/item/ItemInHandRenderer.def b/symbols/src/item/ItemInHandRenderer.def index 56fd212d73..c73a09746f 100644 --- a/symbols/src/item/ItemInHandRenderer.def +++ b/symbols/src/item/ItemInHandRenderer.def @@ -1,7 +1,10 @@ property int lastIcon = 0x0; property int lastId = 0x4; property ItemInstance item = 0xc; -property Minecraft *mc = 0x18; +property Minecraft *minecraft = 0x18; method void renderItem(Mob *mob, ItemInstance *item) = 0x4b824; -method void render(float param_1) = 0x4bfcc; \ No newline at end of file +method void render(float param_1) = 0x4bfcc; +method void renderFire(float param_1) = 0x4ca84; +method void renderTex(float param_1, int param_2) = 0x4c7d4; +method void renderScreenEffect(float param_1) = 0x4cc40; \ No newline at end of file diff --git a/symbols/src/tile/Tile.def b/symbols/src/tile/Tile.def index 2668c19977..34fbd0be35 100644 --- a/symbols/src/tile/Tile.def +++ b/symbols/src/tile/Tile.def @@ -14,7 +14,7 @@ virtual-method void setShape(float x1, float y1, float z1, float x2, float y2, f virtual-method void updateShape(LevelSource *level, int x, int y, int z) = 0x14; virtual-method void updateDefaultShape() = 0x18; virtual-method float getBrightness(LevelSource *level, int x, int y, int z) = 0x20; -virtual-method int getTexture1() = 0x28; +virtual-method int getTexture1(int face) = 0x28; virtual-method int getTexture2(int face, int data) = 0x2c; virtual-method int getTexture3(LevelSource *level, int x, int y, int z, int face) = 0x30; virtual-method AABB *getAABB(Level *level, int x, int y, int z) = 0x34;