Suggested fixes

This commit is contained in:
Bigjango13 2024-07-06 16:53:46 -07:00
parent 0843fc3741
commit 438865c76a
4 changed files with 55 additions and 54 deletions

View File

@ -68,3 +68,6 @@ TRUE Fix Held Item Caching
TRUE Add Reborn Info To Options TRUE Add Reborn Info To Options
FALSE Track FPS FALSE Track FPS
TRUE Add Welcome Screen TRUE Add Welcome Screen
TRUE Add Missing Language Strings
TRUE Fix Pigmen Burning In The Sun
TRUE Fix Grass's Bottom Texture

View File

@ -30,6 +30,38 @@ static void TripodCamera_tick_Level_addParticle_call_injection(Level *level, std
level->addParticle(particle, x, y + 0.5, z, deltaX, deltaY, deltaZ, count); level->addParticle(particle, x, y + 0.5, z, deltaX, deltaY, deltaZ, count);
} }
// Fix camera legs
void EntityRenderer_bindTexture_Camera_leg_injection(EntityRenderer *self, __attribute_
_((unused)) std::string *file) {
std::string camera = "item/camera.png";
self->bindTexture(&camera);
}
void render_camera_legs() {
Tesselator *t = &Tesselator::instance;
constexpr float size = 0.45f;
t->vertexUV(-size, 0.5, -size, 0.75, 0.5);
t->vertexUV(-size, -0.5, -size, 0.75, 1 );
t->vertexUV( size, -0.5, size, 1, 1 );
t->vertexUV( size, 0.5, size, 1, 0.5);
t->vertexUV( size, 0.5, size, 0.75, 0.5);
t->vertexUV( size, -0.5, size, 0.75, 1 );
t->vertexUV(-size, -0.5, -size, 1, 1 );
t->vertexUV(-size, 0.5, -size, 1, 0.5);
t->vertexUV(-size, 0.5, size, 0.75, 0.5);
t->vertexUV(-size, -0.5, size, 0.75, 1 );
t->vertexUV( size, -0.5, -size, 1, 1 );
t->vertexUV( size, 0.5, -size, 1, 0.5);
t->vertexUV( size, 0.5, -size, 0.75, 0.5);
t->vertexUV( size, -0.5, -size, 0.75, 1 );
t->vertexUV(-size, -0.5, size, 1, 1 );
t->vertexUV(-size, 0.5, size, 1, 0.5);
}
// Init // Init
void init_camera() { void init_camera() {
// Implement AppPlatform_linux::saveScreenshot So Cameras Work // Implement AppPlatform_linux::saveScreenshot So Cameras Work
@ -41,5 +73,8 @@ void init_camera() {
overwrite_calls(EntityRenderDispatcher_constructor, EntityRenderDispatcher_injection); overwrite_calls(EntityRenderDispatcher_constructor, EntityRenderDispatcher_injection);
// Display Smoke From TripodCamera Higher // Display Smoke From TripodCamera Higher
overwrite_call((void *) 0x87dc4, (void *) TripodCamera_tick_Level_addParticle_call_injection); overwrite_call((void *) 0x87dc4, (void *) TripodCamera_tick_Level_addParticle_call_injection);
// Fix camera legs
overwrite_call((void *) 0x659dc, (void *) EntityRenderer_bindTexture_Camera_leg_injection);
overwrite_call((void *) 0x65a08, (void *) render_camera_legs);
} }
} }

View File

@ -48,7 +48,6 @@ static void revert_rotation(Entity *entity) {
} }
} }
static bool is_front_facing = false; static bool is_front_facing = false;
static bool is_third_person = false;
static LocalPlayer *stored_player = nullptr; static LocalPlayer *stored_player = nullptr;
static void GameRenderer_setupCamera_injection(GameRenderer_setupCamera_t original, GameRenderer *game_renderer, float param_1, int param_2) { static void GameRenderer_setupCamera_injection(GameRenderer_setupCamera_t original, GameRenderer *game_renderer, float param_1, int param_2) {
// Get Objects // Get Objects
@ -58,7 +57,6 @@ static void GameRenderer_setupCamera_injection(GameRenderer_setupCamera_t origin
// Check If In Third-Person // Check If In Third-Person
Options *options = &minecraft->options; Options *options = &minecraft->options;
is_front_facing = (options->third_person == 2); is_front_facing = (options->third_person == 2);
is_third_person = options->third_person != 0;
// Invert Rotation // Invert Rotation
if (is_front_facing) { if (is_front_facing) {
@ -90,8 +88,8 @@ static void ParticleEngine_render_injection(ParticleEngine_render_t original, Pa
// Hide crosshairs in 3rd person mode // Hide crosshairs in 3rd person mode
static void Gui_renderProgressIndicator_GuiComponent_blit_injection(GuiComponent *self, int x1, int y1, int x2, int y2, int w1, int h1, int w2, int h2) { static void Gui_renderProgressIndicator_GuiComponent_blit_injection(GuiComponent *self, int x1, int y1, int x2, int y2, int w1, int h1, int w2, int h2) {
if (!is_third_person) { if (((Gui *) self)->minecraft->options.third_person != 0) {
GuiComponent_blit(self, x1, y1, x2, y2, w1, h1, w2, h2); self->blit(x1, y1, x2, y2, w1, h1, w2, h2);
} }
} }

View File

@ -760,54 +760,19 @@ static void Language_injection() {
} }
Tile *Tile_init_invBedrock_injection(Tile *t) { Tile *Tile_init_invBedrock_injection(Tile *t) {
Tile *ret = Tile_init(t); Tile *ret = t->init();
// Fix invisible bedrock's name // Fix invisible bedrock's name
std::string invBedrock = "invBedrock"; std::string invBedrock = "invBedrock";
t->vtable->setDescriptionId(t, &invBedrock); t->setDescriptionId(&invBedrock);
return ret; return ret;
} }
// For language fixes, adds a "Still" prefix for liquids
void copy_with_still(std::string *into, char *from) { void copy_with_still(std::string *into, char *from) {
*into = from; *into = from;
*into += "Still"; *into += "Still";
} }
void copy_with_carried(std::string *into, char *from) {
*into = std::string(from);
*into += "Carried";
}
// Fix camera legs
void EntityRenderer_bindTexture_Camera_leg_injection(EntityRenderer *self, __attribute__((unused)) std::string *file) {
std::string camera = "item/camera.png";
EntityRenderer_bindTexture(self, &camera);
}
void render_camera_legs() {
Tesselator *t = &Tesselator::instance;
constexpr float size = 0.45f;
Tesselator_vertexUV(t, -size, 0.5, -size, 0.75, 0.5);
Tesselator_vertexUV(t, -size, -0.5, -size, 0.75, 1 );
Tesselator_vertexUV(t, size, -0.5, size, 1, 1 );
Tesselator_vertexUV(t, size, 0.5, size, 1, 0.5);
Tesselator_vertexUV(t, size, 0.5, size, 0.75, 0.5);
Tesselator_vertexUV(t, size, -0.5, size, 0.75, 1 );
Tesselator_vertexUV(t, -size, -0.5, -size, 1, 1 );
Tesselator_vertexUV(t, -size, 0.5, -size, 1, 0.5);
Tesselator_vertexUV(t, -size, 0.5, size, 0.75, 0.5);
Tesselator_vertexUV(t, -size, -0.5, size, 0.75, 1 );
Tesselator_vertexUV(t, size, -0.5, -size, 1, 1 );
Tesselator_vertexUV(t, size, 0.5, -size, 1, 0.5);
Tesselator_vertexUV(t, size, 0.5, -size, 0.75, 0.5);
Tesselator_vertexUV(t, size, -0.5, -size, 0.75, 1 );
Tesselator_vertexUV(t, -size, -0.5, size, 1, 1 );
Tesselator_vertexUV(t, -size, 0.5, size, 1, 0.5);
}
// Fix pigmen burning in the sun // Fix pigmen burning in the sun
static float Zombie_aiStep_getBrightness_injection(Entity *self, float param_1) { static float Zombie_aiStep_getBrightness_injection(Entity *self, float param_1) {
if (self->getEntityTypeId() == 36) return 0; if (self->getEntityTypeId() == 36) return 0;
@ -815,10 +780,9 @@ static float Zombie_aiStep_getBrightness_injection(Entity *self, float param_1)
} }
// Fix grass_carried's bottom texture // Fix grass_carried's bottom texture
static Tile_getTexture2_t CarriedTile_getTexture2 = NULL; static int CarriedTile_getTexture2_injection(Tile_getTexture2_t original, Tile *self, int face, int metadata) {
static int CarriedTile_getTexture2_injection(Tile *self, int face, int metadata) {
if (face == 0) return 2; if (face == 0) return 2;
return CarriedTile_getTexture2(self, face, metadata); return original(self, face, metadata);
} }
void init_misc() { void init_misc() {
@ -1072,7 +1036,9 @@ void init_misc() {
} }
// Fix/update lang strings // Fix/update lang strings
if (feature_has("Add Missing Language Strings", server_disabled)) {
misc_run_on_language_setup(Language_injection); misc_run_on_language_setup(Language_injection);
}
// Water/lava flowing lang // Water/lava flowing lang
overwrite_call((void *) 0xc3b54, (void *) copy_with_still); overwrite_call((void *) 0xc3b54, (void *) copy_with_still);
overwrite_call((void *) 0xc3c7c, (void *) copy_with_still); overwrite_call((void *) 0xc3c7c, (void *) copy_with_still);
@ -1082,14 +1048,13 @@ void init_misc() {
// InvBedrock lang // InvBedrock lang
overwrite_call((void *) 0xc5f04, (void *) Tile_init_invBedrock_injection); overwrite_call((void *) 0xc5f04, (void *) Tile_init_invBedrock_injection);
// Fix camera legs
overwrite_call((void *) 0x659dc, (void *) EntityRenderer_bindTexture_Camera_leg_injection);
overwrite_call((void *) 0x65a08, (void *) render_camera_legs);
// Fix pigmen from burning in the sun // Fix pigmen from burning in the sun
if (feature_has("Fix Pigmen Burning In The Sun", server_enabled)) {
overwrite_call((void *) 0x89a1c, (void *) Zombie_aiStep_getBrightness_injection); overwrite_call((void *) 0x89a1c, (void *) Zombie_aiStep_getBrightness_injection);
}
// Fix grass_carried's bottom texture // Fix grass_carried's bottom texture
CarriedTile_getTexture2 = *(__raw_Tile_getTexture2_t *) 0x1147c4; if (feature_has("Fix Grass's Bottom Texture", server_disabled)) {
patch_address((void *) 0x1147c4, (void *) CarriedTile_getTexture2_injection); patch_address((void *) CarriedTile_getTexture2, (void *) CarriedTile_getTexture2_injection);
}
} }