diff --git a/launcher/src/client/available-feature-flags b/launcher/src/client/available-feature-flags index 381d5869..0776441a 100644 --- a/launcher/src/client/available-feature-flags +++ b/launcher/src/client/available-feature-flags @@ -67,4 +67,7 @@ TRUE Optimized Chunk Sorting TRUE Fix Held Item Caching TRUE Add Reborn Info To Options FALSE Track FPS -TRUE Add Welcome Screen \ No newline at end of file +TRUE Add Welcome Screen +TRUE Add Missing Language Strings +TRUE Fix Pigmen Burning In The Sun +TRUE Fix Grass's Bottom Texture \ No newline at end of file diff --git a/mods/src/camera/camera.cpp b/mods/src/camera/camera.cpp index 7c41c5f1..8f128d8d 100644 --- a/mods/src/camera/camera.cpp +++ b/mods/src/camera/camera.cpp @@ -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); } +// 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 void init_camera() { // Implement AppPlatform_linux::saveScreenshot So Cameras Work @@ -41,5 +73,8 @@ void init_camera() { overwrite_calls(EntityRenderDispatcher_constructor, EntityRenderDispatcher_injection); // Display Smoke From TripodCamera Higher 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); } } diff --git a/mods/src/input/toggle.cpp b/mods/src/input/toggle.cpp index d3bcd229..5a2c3392 100644 --- a/mods/src/input/toggle.cpp +++ b/mods/src/input/toggle.cpp @@ -48,7 +48,6 @@ static void revert_rotation(Entity *entity) { } } static bool is_front_facing = false; -static bool is_third_person = false; static LocalPlayer *stored_player = nullptr; static void GameRenderer_setupCamera_injection(GameRenderer_setupCamera_t original, GameRenderer *game_renderer, float param_1, int param_2) { // Get Objects @@ -58,7 +57,6 @@ static void GameRenderer_setupCamera_injection(GameRenderer_setupCamera_t origin // Check If In Third-Person Options *options = &minecraft->options; is_front_facing = (options->third_person == 2); - is_third_person = options->third_person != 0; // Invert Rotation if (is_front_facing) { @@ -90,8 +88,8 @@ static void ParticleEngine_render_injection(ParticleEngine_render_t original, Pa // 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) { - if (!is_third_person) { - GuiComponent_blit(self, x1, y1, x2, y2, w1, h1, w2, h2); + if (((Gui *) self)->minecraft->options.third_person != 0) { + self->blit(x1, y1, x2, y2, w1, h1, w2, h2); } } diff --git a/mods/src/misc/misc.cpp b/mods/src/misc/misc.cpp index 752788c7..e1c48b0a 100644 --- a/mods/src/misc/misc.cpp +++ b/mods/src/misc/misc.cpp @@ -760,54 +760,19 @@ static void Language_injection() { } Tile *Tile_init_invBedrock_injection(Tile *t) { - Tile *ret = Tile_init(t); + Tile *ret = t->init(); // Fix invisible bedrock's name std::string invBedrock = "invBedrock"; - t->vtable->setDescriptionId(t, &invBedrock); + t->setDescriptionId(&invBedrock); return ret; } +// For language fixes, adds a "Still" prefix for liquids void copy_with_still(std::string *into, char *from) { *into = from; *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 static float Zombie_aiStep_getBrightness_injection(Entity *self, float param_1) { 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 -static Tile_getTexture2_t CarriedTile_getTexture2 = NULL; -static int CarriedTile_getTexture2_injection(Tile *self, int face, int metadata) { +static int CarriedTile_getTexture2_injection(Tile_getTexture2_t original, Tile *self, int face, int metadata) { if (face == 0) return 2; - return CarriedTile_getTexture2(self, face, metadata); + return original(self, face, metadata); } void init_misc() { @@ -1072,7 +1036,9 @@ void init_misc() { } // Fix/update lang strings - misc_run_on_language_setup(Language_injection); + if (feature_has("Add Missing Language Strings", server_disabled)) { + misc_run_on_language_setup(Language_injection); + } // Water/lava flowing lang overwrite_call((void *) 0xc3b54, (void *) copy_with_still); overwrite_call((void *) 0xc3c7c, (void *) copy_with_still); @@ -1082,14 +1048,13 @@ void init_misc() { // InvBedrock lang 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 - overwrite_call((void *) 0x89a1c, (void *) Zombie_aiStep_getBrightness_injection); + if (feature_has("Fix Pigmen Burning In The Sun", server_enabled)) { + overwrite_call((void *) 0x89a1c, (void *) Zombie_aiStep_getBrightness_injection); + } // Fix grass_carried's bottom texture - CarriedTile_getTexture2 = *(__raw_Tile_getTexture2_t *) 0x1147c4; - patch_address((void *) 0x1147c4, (void *) CarriedTile_getTexture2_injection); + if (feature_has("Fix Grass's Bottom Texture", server_disabled)) { + patch_address((void *) CarriedTile_getTexture2, (void *) CarriedTile_getTexture2_injection); + } }