Add "Close Current Screen On Death"

This commit is contained in:
TheBrokenRail 2022-01-02 15:26:56 -05:00
parent 5636abc051
commit 4a69d38e35
6 changed files with 28 additions and 5 deletions

View File

@ -1 +1 @@
2.2.10 2.2.11

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
**2.2.11**
* Add "Close Current Screen On Death" Feature Flag (Enabled By Default) To Prevent Bugs
* Fix More Furnace UI Bugs When Using "Disable 'gui_blocks' Atlas"
**2.2.10** **2.2.10**
* Fix Bug With Picking Up Items In "Remove Creative Mode Restrictions" Mode * Fix Bug With Picking Up Items In "Remove Creative Mode Restrictions" Mode

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -28,3 +28,4 @@ TRUE Render Selected Item Text
TRUE External Server Support TRUE External Server Support
TRUE Load Language Files TRUE Load Language Files
TRUE Implement Sound Engine TRUE Implement Sound Engine
TRUE Close Current Screen On Death

View File

@ -135,10 +135,20 @@ static unsigned char *RakNetInstance_injection(unsigned char *rak_net_instance)
return result; return result;
} }
// Close Current Screen On Death To Prevent Bugs
static void LocalPlayer_die_injection(unsigned char *entity, unsigned char *cause) {
// Close Screen
unsigned char *minecraft = *(unsigned char **) (entity + LocalPlayer_minecraft_property_offset);
(*Minecraft_setScreen)(minecraft, NULL);
// Call Original Method
(*LocalPlayer_die)(entity, cause);
}
// Init // Init
void init_misc() { void init_misc() {
// Remove Invalid Item Background (A Red Background That Appears For Items That Are Not Included In The gui_blocks Atlas)
if (feature_has("Remove Invalid Item Background", 0)) { if (feature_has("Remove Invalid Item Background", 0)) {
// Remove Invalid Item Background (A Red Background That Appears For Items That Are Not Included In The gui_blocks Atlas)
unsigned char invalid_item_background_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop" unsigned char invalid_item_background_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
patch((void *) 0x63c98, invalid_item_background_patch); patch((void *) 0x63c98, invalid_item_background_patch);
} }
@ -162,6 +172,11 @@ void init_misc() {
// Fix Bug Where RakNetInstance Starts Pinging Potential Servers Before The "Join Game" Screen Is Opened // Fix Bug Where RakNetInstance Starts Pinging Potential Servers Before The "Join Game" Screen Is Opened
overwrite_calls((void *) RakNetInstance, (void *) RakNetInstance_injection); overwrite_calls((void *) RakNetInstance, (void *) RakNetInstance_injection);
// Close Current Screen On Death To Prevent Bugs
if (feature_has("Close Current Screen On Death", 0)) {
patch_address(LocalPlayer_die_vtable_addr, (void *) LocalPlayer_die_injection);
}
// Init C++ And Logging // Init C++ And Logging
_init_misc_cpp(); _init_misc_cpp();
_init_misc_logging(); _init_misc_logging();

View File

@ -268,9 +268,6 @@ static ItemInstance_constructor_extra_t ItemInstance_constructor_item_extra = (I
// Entity // Entity
typedef void (*Entity_die_t)(unsigned char *entity, unsigned char *cause);
static uint32_t Entity_die_vtable_offset = 0x130;
static uint32_t Entity_x_property_offset = 0x4; // float static uint32_t Entity_x_property_offset = 0x4; // float
static uint32_t Entity_y_property_offset = 0x8; // float static uint32_t Entity_y_property_offset = 0x8; // float
static uint32_t Entity_z_property_offset = 0xc; // float static uint32_t Entity_z_property_offset = 0xc; // float
@ -288,6 +285,9 @@ static uint32_t Mob_actuallyHurt_vtable_offset = 0x16c;
typedef float (*Mob_getWalkingSpeedModifier_t)(unsigned char *entity); typedef float (*Mob_getWalkingSpeedModifier_t)(unsigned char *entity);
typedef void (*Mob_die_t)(unsigned char *entity, unsigned char *cause);
static uint32_t Mob_die_vtable_offset = 0x130;
static uint32_t Mob_health_property_offset = 0xec; // int32_t static uint32_t Mob_health_property_offset = 0xec; // int32_t
// Player // Player
@ -310,6 +310,9 @@ static void *LocalPlayer_actuallyHurt_vtable_addr = (void *) 0x10639c;
static void *LocalPlayer_openTextEdit_vtable_addr = (void *) 0x106460; static void *LocalPlayer_openTextEdit_vtable_addr = (void *) 0x106460;
static Mob_die_t LocalPlayer_die = (Mob_die_t) 0x45078;
static void *LocalPlayer_die_vtable_addr = (void *) 0x106360;
static uint32_t LocalPlayer_minecraft_property_offset = 0xc90; // Minecraft * static uint32_t LocalPlayer_minecraft_property_offset = 0xc90; // Minecraft *
// ServerPlayer // ServerPlayer