Some Fixes

This commit is contained in:
TheBrokenRail 2024-12-18 02:20:07 -05:00
parent b2ec2728e3
commit 71946d2087
7 changed files with 55 additions and 4 deletions

View File

@ -55,6 +55,8 @@
* `Fix Reloading Textures On Resize` (Enabled By Default)
* `Improved UI Scaling` (Enabled By Default)
* `Text Rendering Fixes` (Enabled By Default)
* `Close Editor When Sign Is Destroyed` (Enabled By Default)
* `Remove Chest Placement Restrictions` (Enabled By Default)
* Existing Functionality (All Enabled By Default)
* `Fix Screen Rendering When Hiding HUD`
* `Sanitize Usernames`

View File

@ -22,7 +22,6 @@ CATEGORY User Interface
TRUE Add Reborn Info To Options
TRUE Force Touch UI Inventory
TRUE Fix Pause Menu
TRUE Close Current Screen On Death
TRUE Implement Create World Dialog
TRUE Display Date In Select World Screen
TRUE Add Welcome Screen
@ -130,7 +129,10 @@ CATEGORY Bug Fixes
TRUE Fix Fire Immunity
TRUE Fix Sunlight Not Properly Setting Mobs On Fire
TRUE Fix Transferring Durability When Using Items
TRUE Fix Crash When Generating Certain Seeds
CATEGORY Crashes
TRUE Fix Crash When Generating Certain Seeds
TRUE Close Editor When Sign Is Destroyed
TRUE Close Current Screen On Death
TRUE Fix Reloading Textures On Resize
TRUE Fix options.txt Loading/Saving
CATEGORY Logging
@ -143,4 +145,5 @@ CATEGORY Miscellaneous
TRUE Always Save Chest Tile Entities
TRUE Screenshot Support
TRUE Add Camera Functionality
TRUE Update Default Options
TRUE Update Default Options
TRUE Remove Chest Placement Restrictions

View File

@ -442,6 +442,32 @@ static Item *Item_initItems_Item_handEquipped_injection(Item *self) {
return self;
}
// Chest Placement
static bool ChestTile_mayPlace_injection(__attribute__((unused)) ChestTile_mayPlace_t original, __attribute__((unused)) ChestTile *self, __attribute__((unused)) Level *level, __attribute__((unused)) int x, __attribute__((unused)) int y, __attribute__((unused)) int z, __attribute__((unused)) uchar face) {
return true;
}
// Fix Sign Crash
static TextEditScreen *current_sign_screen = nullptr;
static void Minecraft_setScreen_injection(Minecraft_setScreen_t original, Minecraft *self, Screen *screen) {
// Call Original Method
original(self, screen);
// Track
current_sign_screen = nullptr;
if (screen != nullptr && screen->vtable == (Screen_vtable *) TextEditScreen_vtable::base) {
current_sign_screen = (TextEditScreen *) screen;
}
}
static SignTileEntity *SignTileEntity_destructor_injection(SignTileEntity_destructor_complete_t original, SignTileEntity *self) {
// Close Screen
if (current_sign_screen != nullptr && current_sign_screen->sign == self) {
current_sign_screen->sign = nullptr;
current_sign_screen->minecraft->setScreen(nullptr);
}
// Call Original Method
return original(self);
}
// Init
void init_misc() {
// Sanitize Username
@ -597,6 +623,19 @@ void init_misc() {
overwrite_call((void *) 0x976f8, Item_handEquipped, Item_initItems_Item_handEquipped_injection);
}
// Chest Placement
if (feature_has("Remove Chest Placement Restrictions", server_enabled)) {
overwrite_calls(ChestTile_mayPlace, ChestTile_mayPlace_injection);
unsigned char skip_neighbor_check_patch[4] = {0x01, 0x30, 0xa0, 0xe3}; // "mov r3, #0x1"
patch((void *) 0xcfaf8, skip_neighbor_check_patch);
}
// Fix TextEditScreen Crashing After Sign Is Destroyed
if (feature_has("Close Editor When Sign Is Destroyed", server_disabled)) {
overwrite_calls(Minecraft_setScreen, Minecraft_setScreen_injection);
overwrite_calls(SignTileEntity_destructor_complete, SignTileEntity_destructor_injection);
}
// Disable overwrite_calls() After Minecraft::init
misc_run_on_init([](__attribute__((unused)) Minecraft *minecraft) {
thunk_enabler = [](__attribute__((unused)) void *a, __attribute__((unused)) void *b) -> void * {

View File

@ -165,6 +165,7 @@ set(SRC
src/tile/EntityTile.def
src/tile/Bush.def
src/tile/CropTile.def
src/tile/ChestTile.def
src/misc/Strings.def
src/misc/I18n.def
src/misc/SimpleFoodData.def

View File

@ -1,7 +1,8 @@
extends Screen;
size 0xac;
vtable 0x105308;
constructor (SignTileEntity *sign) = 0x3a840;
property SignTileEntity *sign = 0x4c;

View File

@ -0,0 +1,3 @@
extends EntityTile;
vtable 0x110ea8;

View File

@ -1 +1,3 @@
vtable 0x115d08;
extends TileEntity;