[0.16.0] Improving Performance - sainagh/meatballcraft GitHub Wiki

JVM Arguments [EASY]

JVM (Java Virtual Machine) arguments are 'Java settings' that can be added to make Meatballcraft run smoother!

For CurseForge

NOTE: Curseforge applies JVM arguments to all modpacks, in some cases it can make other packs run worse, or not run at all.

  1. Go to 'Settings' (bottom left of CurseForge menu)
  2. 'Game Specific' > 'Minecraft'
  3. Scroll all the way to the bottom
  4. Set 'Allocated Memory' between 8 GB and 10 GB
  5. Copy and paste the arguments from this page (Option 1 or Option 2) into the 'Additional Arguments' field

For Prism

  1. Go to 'Settings'
  2. Go to 'Java'
  3. Set 'Maximum Memory Allocation' between 8 GB and 10 GB
  4. Copy and paste the arguments from this page (Option 1 or Option 2) into the 'JVM Arguments' field
  5. Add this JVM if you want to play in full screen -Dorg.lwjgl.opengl.Window.undecorated=true

JVM Arguments

Option 1

-Xss4M -Dfile.encoding=GBK -XX:+AggressiveOpts -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSConcurrentMTEnabled -XX:ParallelGCThreads=8 -Dsun.rmi.dgc.server.gcInterval=1800000 -XX:+UnlockExperimentalVMOptions -XX:+ExplicitGCInvokesConcurrent -XX:MaxGCPauseMillis=50 -XX:+AlwaysPreTouch -XX:+UseStringDeduplication -Dfml.ignorePatchDiscrepancies=true -Dfml.ignoreInvalidMinecraftCertificates=true -XX:-OmitStackTraceInFastThrow -XX:+OptimizeStringConcat -XX:+UseAdaptiveGCBoundary -XX:NewRatio=3 -Dfml.readTimeout=90 -XX:+UseFastAccessorMethods -XX:CMSInitiatingOccupancyFraction=75 -XX:+CMSScavengeBeforeRemark -XX:+UseCMSInitiatingOccupancyOnly

Option 2 (better on some computers)

-XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+AlwaysActAsServerClassMachine -XX:+AlwaysPreTouch -XX:+AggressiveOpts -XX:MaxInlineLevel=15 -XX:MaxVectorSize=32 -XX:+UseCompressedOops -XX:ThreadPriorityPolicy=1 -XX:AllocatePrefetchStyle=3 -XX:+UseNUMA -XX:NmethodSweepActivity=1 -XX:ReservedCodeCacheSize=300M -XX:-DontCompileHugeMethods -XX:MaxNodeLimit=240000 -XX:NodeLimitFudgeFactor=8000 -XX:+UseFPUForSpilling -XX:+UseStringDeduplication -XX:+UseG1GC -XX:MaxGCPauseMillis=37 -XX:G1HeapRegionSize=32M -XX:G1NewSizePercent=23 -XX:G1MaxNewSizePercent=40 -XX:G1ReservePercent=20 -XX:SurvivorRatio=16 -XX:G1MixedGCCountTarget=3 -XX:G1MixedGCLiveThresholdPercent=90 -XX:InitiatingHeapOccupancyPercent=10 -XX:MaxTenuringThreshold=2 -XX:G1RSetUpdatingPauseTimePercent=0 -XX:G1SATBBufferEnqueueingThresholdPercent=30 -XX:G1ConcMarkStepDurationMillis=5.0 -XX:G1ConcRSHotCardLimit=16 -XX:G1ConcRefinementServiceIntervalMillis=150 -XX:GCTimeRatio=99 -XX:+ExplicitGCInvokesConcurrent

Upgrade to Java 22 [a bit harder]

NOTE: if you are doing this after updating from 0.15.2, it will still be faster and easier to set up 0.16 from scratch! Follow the steps here, and copy over your world, journeymap, and settings!

Minecraft 1.12 runs on Java 8, which is old and slow. Upgrading to Java 22 makes it possible to get much faster loading times (almost twice as fast) and better FPS! This is done by using Cleanroom MMC, a forked version of forge developed by the Cleanroom group that works with more modern java versions!

To set things up your own way, pelase follow the steps here.

For a more automated setup on Linux, you can use the Python setup here!

KNOWN BUG: items may shift around your inventory. We are working on it!

Thanks to thermonuclear_minecraft_engineer for making this possible and to puddinpopper for testing out and fine-tuning these instructions!

  1. Install Prism Launcher [NOTE: make sure you are using Java x64, Java x32 will error out as a JVM issue with Prism]
  2. Download and install Meatballcraft using Prism
  3. Install Java 22 from this link [you may have to click 'include older versions', make sure you pick the right operating system] [if you know what you are doing, JRE is harder to install but it performs better sometimes]
  4. Download this build of Cleanroom MMC
  5. In Prism, 'Add Instance' ➜ 'Import' ➜ Cleanroom_MMC.zip
  6. Edit the cleanroom instance ➜ 'Settings' ➜ 'Java Installation' ➜ set to your Java 22 path [Example directory C:/Program Files/Zulu/zulu-22/bin/java.exe].
  7. Allocate the same amount of ram for both memory settings (recommended 9000 Mb)
  8. Set Java Arguments to -XX:+UseZGC -XX:+ZGenerational
  9. Launch CleanroomMMC* instance once, and close it
  10. Transfer the content of Meatballcraft's .minecraft folder to cleanroom's .mincraft folder, consider using Link Shell Extension for a "Junction" [NOTE: make sure you do not delete or overwrite the existing Cleanroom files]
  11. Disable the following mods mods if present (remove them from mods folder): !mixinbooter !configanytime
  12. [Optional] Change JVM arguments to the ones at the bottom of the page
  13. [Optional] Change your video settings after first launch: Fancy graphics. 4 mipmap. no clouds
  14. You can now lower the RAM allocation in Prism settings; from testing this can go as low as 5000 Mb, but it will depend on your computer, or it could be even lower!

Java 22 JVM Arguments

Option 1

-XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+AlwaysPreTouch -XX:MaxInlineLevel=15 -XX:MaxVectorSize=32 -XX:+UseCompressedOops -XX:ThreadPriorityPolicy=1 -XX:AllocatePrefetchStyle=3 -XX:+UseNUMA -XX:NmethodSweepActivity=1 -XX:ReservedCodeCacheSize=300M -XX:-DontCompileHugeMethods -XX:MaxNodeLimit=240000 -XX:NodeLimitFudgeFactor=8000 -XX:+UseFPUForSpilling -XX:+UseStringDeduplication -XX:+UseG1GC -XX:MaxGCPauseMillis=37 -XX:G1HeapRegionSize=32M -XX:G1NewSizePercent=23 -XX:G1MaxNewSizePercent=40 -XX:G1ReservePercent=20 -XX:SurvivorRatio=16 -XX:G1MixedGCCountTarget=3 -XX:G1MixedGCLiveThresholdPercent=90 -XX:InitiatingHeapOccupancyPercent=10 -XX:MaxTenuringThreshold=2 -XX:G1RSetUpdatingPauseTimePercent=0 -XX:G1SATBBufferEnqueueingThresholdPercent=30 -XX:G1ConcMarkStepDurationMillis=5.0 -XX:G1ConcRSHotCardLimit=16 -XX:G1ConcRefinementServiceIntervalMillis=150 -XX:GCTimeRatio=99 -XX:+ExplicitGCInvokesConcurrent

Option 2

-XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -XX:NmethodSweepActivity=1 -XX:ReservedCodeCacheSize=400M -XX:NonNMethodCodeHeapSize=12M -XX:ProfiledCodeHeapSize=194M -XX:NonProfiledCodeHeapSize=194M -XX:-DontCompileHugeMethods -XX:MaxNodeLimit=240000 -XX:NodeLimitFudgeFactor=8000 -XX:+UseVectorCmov -XX:+PerfDisableSharedMem -XX:+UseFastUnorderedTimeStamps -XX:+UseCriticalJavaThreadPriority -XX:ThreadPriorityPolicy=1 -XX:+UseZGC -XX:AllocatePrefetchStyle=1 -XX:+ZGenerational

Upgrade Server to Java 22

Java 22 can also be used on servers, if you self host them! It is possible to do with other platforms, but it will be harder than this guide! You can log into a Java 8 server using a Java 22 client anyway!

Thanks to ChaosStrikez for developing the startup scripts for this!

See the source repo if you need more details.

  1. Download the server files from CurseForge and extract the .zip in the desired folder
  2. Delete !mixinbooter, MixinCompat, and configanytime mods if present
  3. Open settings.cfg, set USE_CLEANROOM=true and select the right path for java 22
  4. Start the server using starter.bat on Windows or ServerStart.sh on Linux (For Linux, you may need to run chmod +x ServerStart.sh before executing.)

See this if you want to try different Java arguments. You would replace the existing arguments after JAVA_ARGS= in settings.cfg with these.