KAllFix

KAllFix

Mod

Optimization and multithreading written by n1luik

Client or server LibraryOptimizationUtility

1,607 downloads
13 followers
Follow Save

Summary

This project contains 2 mods: k_all_fix, K_multi_threading.

In these mods, K_multi_threading support 1.17+ muti-threaded work in theory, but author unsure it compatibles with other mods, currently just have 1.20.1 tested.

For now, muti-thread couldn't work in Client.

Use muti-thread function by default, you can use -DKMT_D=[any character] to disable. Also, you can use -DKAllFix_D=[any character] to disable this mod.

How to use

Before 1.0.3.18

The file you download could not use directly, you should use following command to generate at the specific place

java -jar k_multi_threading-xxx.jar -i [empty or download directory]

After 1.0.3.18

You could run directly, but reserse install command.

Following tips or read source code(n1luik.K_multi_threading.core.util.Util), installing processing just generate k_multi_threading-base.jar,k_multi_threading-asm.jar and won't do anything else.

For some function, it needs to download some repositories, and you could also put these files to [game directory]/lib manually if it downloads failed.

Repositories for some function

Using others' code

  • The function of moonrise_fast_palette uses code from moonrise
  • Using code from Canary to solve compatibility problem with Canary and Gcyr

Functions

  • Fix [Let's Do] Farm & Charm bug of sending huge useless packet
  • Fix [Let's Do] Farm & Charm Chicken hoop performs problem.
  • Solve compatibility problem with Canary and Gcyr
  • Fix Biolith compatibility issue (including MCreator those whom regenerate MultiNoiseBiomeSource (using MCreator to regenerate terrain), except some mods like Terramity needs fix separately ).
  • Fix problems of Petrolpark's Library 1.4.2 couldn't run server on some version of Java
    • could use -DKAF-DisablePetrolpark=false to close
  • Allow close muti-thread independently.
  • Fix magnetic field optimization problem with Alex's Caves.
  • Fix mixin performance issue with Create: Diesel Generators.
  • Fix old version of Destroy bug: database connecting failed and causes crash.
  • (Unsafe, need open-DKAF-NbtIoMixin_NotGZip=true) Using try catch solves gzip problem of NBT IO, but should use commons-compress.
  • Use -DKMT-threadMax=[count] to set max threads.
  • Use D-KMT-callMax=[count] to set multi-thread tasks assigned maximum number of threads to use by default.
  • -DKMT-ThreadpoolKeepAliveTime=[millisecond]: The time to stop useless thread.
  • Use -DKAF-ClientboundKeepAlivePacket_Max=[millisecond] to modify time request of ClientboundKeepAlivePacket, default 15 seconds.
    • ClientboundKeepAlivePacket needed to send every 30 seconds, or kicked due to connection timeout.
  • Use -DKAF-ServerTimeout=[seconds] to set server connection timeout limit time (possible invalidate)
    • Another settings offered by Forge are also recommended to set: -Dforge.readTimeout=[seconds]
  • 0DKMT-ChunkGeneratorMode2Start=[true, false] controls whether run command: /SetterWorldConfig world setM2 %%KMT-ChunkGeneratorMode2Start%% automatically when started.
  • Use -DKAF-RemoveMixin:[class name] to disable specific mixin, also k_multi_threading does.

Optional

  • -DKAF-RenderOptimizer=true: Rendering optimization.
  • -DKMT-SafeUnloadChunk=true: Run chunk unload function in chunk generate thread
  • -DFixBiolithBugMode2=true: Turning on this will try to solve most Biolith compatibility problem, but with the risk encountering influential bug.
  • -DKAF-gtceu.MedicalConditionTrackerMixin=true: Prohibit radiation of GTM
  • -DKAF-Fix_fabric-object-builder-api.jar=true: Fix bug about Sinytra Connector fabric-object-builder-api not compatible to 47.3.47
  • -DIndependencePlayer=true: Turning on player asynchrony, but high probability useless for optimizing performance.
  • -DKAF-RemoveClientboundKeepAlivePacket=true: To disable ClientboundKeepAlivePacket
  • -DKAF-FixTFMGDestory=true: Make Destroy compatible with Create: The Factory Must Grow. If just install Destroy, Creative Pump couldn't connect to Create's pipe.
  • -DKAF-FixConfigAuto=true: Auto modify config file to proper properties.
  • -DKAF-RemoveFlyingTest=true: Remove flying test.
  • -DKMT-LoginMultiThreading=true: log in muti-thread.
    • Prohibit too many mods cause bug in [net.minecraftforge.event.OnDatapackSyncEvent]
    • Muti-thread login just compatible to Original Minecraft for this time. For other mod, generally have no so much data needed compressing (I haven't met so far).
    • -DKMT-LoginMultiThreading.ConnectionLock=true: Wait for asynchronous execution to complete at the end of tick. Turning off this will slightly enhance performance, but will slow down login speed.
      • Turning off will cause crash. Default off, need turn on manually.
    • DKMT-LoginMultiThreading.TaskSizeMax=[count]: Set max login tasks running at the same time, default 8.
  • -DKAF-FixAllPacket=true: Fix data pack (Network), work when both server and client turning on.
  • -DKAF-packetOptimize=true: Optimize some data pack, requiring open on server and client:
    • -DKAF-packetOptimize.AttributesReOutputTime=[millisecond]: Set the internal of force resent, default 2 minutes.
    • -DKAF-packetOptimize.CompatibilityMode.ClientboundBlockEntityDataPacket=true: Safer ClientboundBlockEntityDataPacket compress, but influence performance.
    • -DKAF-packetOptimize.CompatibilityMode.ClientboundSectionBlocksUpdatePacket=true: Safer ClientboundSectionBlocksUpdatePacket and ClientboundBlockUpdatePacket compress, but also influence performance.
  • -DKAF-UnsafeCinderscapesFix1=true: Limit Cinderscapes enableAshFall performance consumption function only in the nether.
  • -DKAF-fix.asynchronous.ClientboundCustomQueryPacket=true: Handshake asynchronous, if you load many mods, you may encounter problem that packet stuck and can't play servers during the handshake. In that case, you could turn on this to solve the problem.

Commands

  • /debug_GetterClassFile [class name]: Get game final running data, saved under game directory ([Save time timestamp]_save.class).
  • /SetterWorldConfig [world, ClearErrorSize, RemoveRemoveErrorSize]: Won't save after setting SetterWorldConfig.
    • Use ClearErrorSize to clear the number of server crashes caused by error report.
    • Use RemoveRemoveErrorSize let server never record crashes times.
    • world [registered dimension id]:
      • setM2 [true,false]: Set another way to realize dimension, but have risk to be stuck.
      • setMultiThreading [count]: Default 0, set muti-thread tasks number, but have risk to be stuck.

Problem

  • Some mod may need the client install this mod even it doesn't do anything
  • Muti-thread thead pool may intercept error and not crash, but if intercepts times over block count limit, it will report an error.
  • If not set -DKMT-threadMax=[CPU threads] may cause terrain generation get inexplicably stuck. If you do encounter this after you set this value, just set another higher count.
  • world.tick_scheduler function of Canary will cover this mod's muti-thread fix: ClassInstanceMultiMap, so must turn off that ( auto turn off using -DKAF-FixConfigAuto=true, needing restart server)
    • In /config/canary.properties and write mixin.world.tick_scheduler=false(-DKAF-FixConfigAuto=true can do this automatically)
  • entity_by_type function of Canary will also cover this mod's muti-thread fix: ClassInstanceMultiMap, so must turn off that ( auto turn off using -DKAF-FixConfigAuto=true, needing restart server)
    • In /config/canary.properties and write mixin.collections.entity_by_type=false(-DKAF-FixConfigAuto=true can do this automatically)
  • world.tick_scheduler of Lithium will cover this mod's muti-thread fix: ClassInstanceMultiMap, so must turn off that ( auto turn off using -DKAF-FixConfigAuto=true, needing restart server)
    • In /config/lithium.properties and write mixin.world.tick_scheduler=false(-DKAF-FixConfigAuto=true can do this automatically)
  • entity_by_type function of Lithium will also cover this mod's muti-thread fix: ClassInstanceMultiMap, so must turn off that ( auto turn off using -DKAF-FixConfigAuto=true, needing restart server)
    • In /config/lithium.properties and write mixin.collections.entity_by_type=false(-DKAF-FixConfigAuto=true can do this automatically)
  • logOffthreadEntityAdd of Cupboard may not be compatible, using -DKAF-FixConfigAuto=true automatically disable.
  • May be conflict with mixin.perf.cache_upgraded_structures of ModernFix, recommend determine disable or not after testing in game.
    • How to disable: add a new line mixin.perf.cache_upgraded_structures=false to config/modernfix-mixins.properties
  • Login muti-thread may cause server receive ServerboundMovePlayerPacket beforehand and report an error.
  • ParCool!require die in server for once to use muti-threading login .
  • Grimoire of Gaia have a little chance to report Modifier is already applied on this attribute!
  • NuclearCraft: Neoteric fission reactor restart has small chance to cause a cooling calculation error.
  • Over 1.0.3.3, n1luik.K_multi_threading.core.base.ParaServerChunkProvider, n1luik.KAllFix.util.TaskRun and some code to regenerate chunk must use c2 for muti-threading, or else it will have a bad performance (java will run c2 automatically, but need to wait for a while).
  • From 1.0.3.12, in my Windows Server 2022 Datacenter 21H2 20348.3091|pve8.2.2 revised version kvm e5-2690v4*2 virtual host cpu, little chance to encounter system-generated thread scheduling bug and causes system management thread exception. In this situation, the CPU power consumption is 900% of normal.
    • Solution: restart the server.
  • 1.20.1 Cinderscapes enableAshFall causes too much performance consumption (after last triggered, the next triggered chunk if couldn't find target, it will try 128 times searching chunks), author could not optimize safely, could just limit it to the nether.

Status

Code is committed to Gitee directly. Github will update each day automatically (UTC 00:00)


Project members

n1luik

Member

No-Name

Member

Details

Licensed GPL-2.0-only
Published 3 months ago
Updated 7 days ago