Описание
## Overview
- This project is used to fix and optimize issues caused by other mods, and it works on servers.
- The project contains two main parts: `k_all_fix` and `k_multi_threading`, **with features mainly controlled by JVM parameters**.
- **No regular config file is provided; configuration is mainly done through startup parameters**.
- Client-side usage is supported from `1.0.4.0` onward (requires JVM parameter `-DKMT_Client=true`).
- Under a multi-mod and single-threaded baseline environment, cause no issues is not guaranteed, but you could create an ISSUE on [Github](https://github.com/1luik/KAllFix) and the author will fix it quickly.
- With some mod combinations, clients may still need to install this mod even if it has no visible effect.
## Features and Use Cases
### Optimizations
- Optimizes performance for [Upgraded Additional Trims](https://www.curseforge.com/minecraft/mc-mods/upgraded-additional-trims).
- Optimizes the April Fools date-check related overhead in [Atmospheric](https://www.curseforge.com/minecraft/mc-mods/atmospheric).
- Optimizes performance for [Upgraded Core](https://modrinth.com/mod/upgraded-core).
- Optimizes chicken-coop AI performance in [[Let's Do] Farm & Charm](https://modrinth.com/mod/lets-do-farm-charm).
- Optimize performance for [Event Wrapper](https://modrinth.com/mod/event-wrapper)
- Optimize performance for [Create:FluidLogistic](https://www.curseforge.com/minecraft/mc-mods/create-fluidlogistic)
- `-DKAF-fluidlogistics.DisabledDynamicUp=true` to disable updating old id, if not do so, may cause to preformance slow down.
- Optimize [AE2](https://modrinth.com/mod/ae2) game computation
- Optimize performance for ItemStack.issameItemsameTags
- Optimize performance of [PPMO2](https://modrinth.com/mod/project-mmo)
- Delete useless code of [Apotheosis](https://www.curseforge.com/minecraft/mc-mods/apotheosis) and [Create:Connected](https://modrinth.com/mod/create-connected)
### Fixes
- Fixes performance issues related to entity counts in [L_Ender's Cataclysm](https://modrinth.com/mod/l_enders-cataclysm) when used on servers with [MineColonies](https://modrinth.com/mod/minecolonies).
- Fixes excessive invalid packet sending in [[Let's Do] Farm & Charm](https://modrinth.com/mod/lets-do-farm-charm).
- Fixes compatibility issues between [Biolith](https://modrinth.com/mod/biolith) and some MCreator worldgen mods (e.g., [Terramity](https://modrinth.com/mod/terramity)).
- Fixes compatibility issues between [Gregicality Rocketry](https://modrinth.com/mod/gcyr) and [Canary](https://modrinth.com/mod/canary), but collision-box issues may still occur at space-station borders.
- Fixes the issue where [Petrolpark's Library](https://modrinth.com/mod/petrolpark) 1.4.2 is unusable in some Java environments; this fix can be disabled with `-DKAF-DisablePetrolpark=false`.
- Fixes/optimizes magnetic-field-related performance issues in [Alex's Caves](https://modrinth.com/mod/alexs-caves).
- Fixes mixin performance issues in [Create: Diesel Generators](https://www.curseforge.com/minecraft/mc-mods/create-diesel-generators).
- Fixes server crashes in older [Destroy](https://modrinth.com/mod/destroy) versions caused by database connection failures.
### Multithreading
#### Introduction
- Multithreading supports includes block ticks, block entity ticks, entities, dimensions, player packet receiving (manual toggle, client-only), and player login (manual toggle), and also fixes some problematic single-threaded mods by applying multithreading.
- Multithreading is enabled by default on the server side.
- In multithreaded scenarios, thread-pool interception or limit-exceeded errors may appear, but they usually do not crash the server.
- It is recommended to manually set `-DKMT-threadMax=[CPU thread count]`; otherwise world generation may be frozen. If freezes still occurs after setting it, increase the value higher.
- Before `1.0.4.0`, clients cannot use multithreading; from `1.0.4.0` onward, clients can enable it via `-DKMT_Client=true`.
- After `1.0.3.3`, `ParaServerChunkProvider`, `TaskRun`, and some chunk generation code depend more heavily on C2 compilation (the JVM will enter C2 automatically after running for a while).
- In Windows Server 2022 Datacenter 21H2 20348.3091 (author's environment), rare thread scheduling anomalies may occur and causes abnormally high CPU usage; the solution is to restart the server.
#### Related JVM Parameters
- `-DKMT-threadMax=[number]`
- Sets thread-pool thread count.
- `-DKMT-callMax=[number]`
- Sets the default maximum number of threads that multithreaded tasks may use.
- `-DKMT-ThreadpoolKeepAliveTime=[milliseconds]`
- Sets how long idle threads are kept before recycling.
- `-DKMT_D=[any characters]`
- Disables multithreading.
- `-DKMT-OpenVanillaServerChunkCache=true`
- Forces the vanilla `ServerChunkCache` fix path (added in 1.0.5.3).
## JVM Parameter Overview (all retained)
### Basic and General
- `-DKAllFix_D=[any characters]`
- Disables KAllFix.
- `-DKMT_Client=true`
- Enables multithreading-related features on the client side (1.0.4.0+).
- `-DKAF-DisablePetrolpark=false`
- Disables the [Petrolpark's Library](https://modrinth.com/mod/petrolpark) 1.4.2 related fix.
### Connection and Timeout
- `-DKAF-ClientboundKeepAlivePacket_Max=[milliseconds]`
- Changes the timing requirement for `ClientboundKeepAlivePacket` (default 15 seconds; vanilla must be