Fix Held Item Poking Through Screen Overlay
This commit is contained in:
parent
dcafeb5c44
commit
2568b05053
@ -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`
|
||||
|
@ -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
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <libreborn/patch.h>
|
||||
#include <symbols/minecraft.h>
|
||||
#include <GLES/gl.h>
|
||||
|
||||
#include <mods/feature/feature.h>
|
||||
#include <mods/extend/extend.h>
|
||||
@ -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
|
||||
|
@ -282,20 +282,44 @@ static void Minecraft_setSize_injection(Minecraft_setSize_t original, Minecraft
|
||||
|
||||
// Batch Font Rendering
|
||||
template <typename... Args>
|
||||
static void Font_draw_injection(const std::function<void(Args...)> &original, Args... args) {
|
||||
static void Font_draw_injection(const std::function<void(Font *, Args...)> &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>(args)...);
|
||||
original(self, std::forward<Args>(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<Font *, const char *, float, float, unsigned int, bool>);
|
||||
overwrite_calls(Font_drawShadow, Font_draw_injection<Font *, const std::string &, float, float, unsigned int>);
|
||||
overwrite_calls(Font_drawShadow_raw, Font_draw_injection<Font *, const char *, float, float, unsigned int>);
|
||||
overwrite_calls(Font_drawSlow, Font_draw_injection<const char *, float, float, unsigned int, bool>);
|
||||
overwrite_calls(Font_drawShadow, Font_draw_injection<const std::string &, float, float, unsigned int>);
|
||||
overwrite_calls(Font_drawShadow_raw, Font_draw_injection<const char *, float, float, unsigned int>);
|
||||
}
|
||||
|
||||
// Fix Screen Overlays
|
||||
if (feature_has("Fix Held Item Poking Through Screen Overlay", server_disabled)) {
|
||||
overwrite_calls(ItemInHandRenderer_renderScreenEffect, ItemInHandRenderer_renderScreenEffect_injection);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
method void renderFire(float param_1) = 0x4ca84;
|
||||
method void renderTex(float param_1, int param_2) = 0x4c7d4;
|
||||
method void renderScreenEffect(float param_1) = 0x4cc40;
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user