# FoamFix  FoamFix is a mod designed to optimize post-1.7.10 modded Minecraft using simple, targeted optimizations. As of 0.6.1, observations show that Java heap usage (measured using VisualVM on the main menu) can drop by as much as 50%! ## Features
## FAQ * **Q:** What's the difference between Lawful and Anarchy Editions? * **A:** The Anarchy Edition utilizes a coremod, while the Lawful Edition does not. Generally, this means that the latter is less invasive; however, in most cases, I recommend using the Anarchy edition. * **Q:** What does FoamFix do to achieve the claimed benefits? * **A:** Good question! I'm working on an answer - for now, I can only encourage you to study the source code. * **Q:** Can I run FoamFix on the server/client side if it's not present on the client/server side? * **Q:** Can I mix versions/editions of FoamFix? * **A:** Yes. * **Q:** Can you backport FoamFix to 1.7.10? * **A:** No. FoamFix primarily targets 1.8+ modded Minecraft. I recommend [this guide](https://forum.feed-the-beast.com/threads/guide-how-to-run-infinity-evolved-with-1-0gb-ram-allocation.149222/) for users of modded 1.7.10 Minecraft. * **Q:** Can you make FoamFix for vanilla? * **A:** Sure! It will probably not have as many benefits as the one for modded environments, but it might still be useful for some users. * **Q:** Can you run FoamFix in a development environment? * **A:** Yes, but you must *manually* deobfuscate it with BON2 or a similar tool. ## Bug Reporting * First, please check the **Known Issues** section below! Also, please check the issue page linked below! * Second, please **try to reproduce without FoamFix** - if it is still present without FoamFix, it is most likely not a FoamFix issue. When you report a bug that only appears with FoamFix installed, * Please **ONLY** report them [here](https://github.com/asiekierka/FoamFix/issues)! This helps me keep track of existing issues. * In particular, please **do not** report them to the other mod developers! If I get to the conclusion that the issue is caused by a different mod, I'll do my best to contact the other author myself and discuss the fix with them; however, unnecessary bug reports are a bit of a nuisance. ## Known Issues * BetterFoliage (before 2.1.4): The "coremod.parallelModelBaking" option causes issues. Please disable it or update. * JustEnoughCalculation (before February 21st 2017): The "coremod.dynamicItemModels" option causes a crash. Please disable it or update. * Sponge: The "coremod.optimizedBlockPos" option collides with Sponge's own transformations. Please disable it. * The "coremod.smallPropertyStorage" option may cause FoamFix to appear in the following type of bug report: ``` java.lang.IllegalArgumentException: Cannot set property Property...{...} to ... on block ..., it is not an allowed value at pl.asie.foamfix.common.FoamyBlockState.func_177226_a(FoamyBlockState.java:34) ...``` Many cases of this issue ([1](https://github.com/asiekierka/FoamFix/issues/38), [2](https://github.com/asiekierka/FoamFix/issues/22)) can be reproduced without FoamFix, so please make extra sure that it's FoamFix-specific! ## Additional Tips * Enable *alwaysSetupTerrainOffThread* in forge.cfg. (Since 0.6.3, FoamFix will automatically do this for you on new instances!) * Install [BetterFPS](https://minecraft.curseforge.com/projects/betterfps) - it optimizes other areas of Minecraft not targetted by FoamFix. * If you're experiencing "ghost chunk loading"-related lag (a noticeable lag spike every ~30 seconds), a way to partially work around the problem is to increase the value of *dormantChunkCacheSize* in forgeChunkLoading.cfg. * For some GPU/driver configurations, disabling mipmaps (setting Mipmap Levels to 0) will boost FPS considerably. This is due to lag caused by animated texture updates being much higher with increasing amounts of textures to update, which scales linearly with the amount of mipmap levels. Since 0.6.3, FoamFix sets the setting as default on new instances. * On dedicated servers, setting max-tick-time=0 can solve crashes related to "java.lang.Error: Watching server". Still looking into why this happens! * Recent versions of [CreativeCore](https://minecraft.curseforge.com/projects/creativecore) fix a bug where the Minecraft engine would not remove tile entities from the tile entity removal queue unless players were present on the server, as well as improve performance of said removal step. ## Download * [FoamFix 0.7.4 "Anarchy" (1.12)](/files/minecraft/foamfix-0.7.4-1.12-anarchy.jar) - Minecraft 1.12 (25 July 2017) * [FoamFix 0.7.4 "Lawful" (1.12)](/files/minecraft/foamfix-0.7.4-1.12-law.jar) - Minecraft 1.12 (25 July 2017) * [FoamFix 0.7.2 "Anarchy"](/files/minecraft/foamfix-0.7.2-anarchy.jar) - Minecraft 1.10.2-1.11.2 (25 July 2017) * [FoamFix 0.7.2 "Lawful"](/files/minecraft/foamfix-0.7.2-law.jar) - Minecraft 1.10.2-1.11.2 (25 July 2017) * [FoamFix 0.6.3 "Anarchy" (1.8)](/files/minecraft/foamfix-0.6.3-anarchy-1.8.x.jar) - Minecraft 1.8.9 (2 June 2017) * [FoamFix 0.6.3 "Lawful" (1.8)](/files/minecraft/foamfix-0.6.3-law-1.8.x.jar) - Minecraft 1.8.9 (2 June 2017) * [Source code](https://github.com/asiekierka/FoamFix) ## TODO * Vanilla support - some people seem to use Forge and FoamFix alone, not realizing that Forge's overhead can easily outweigh FoamFix's benefits... why not one without the other? ## Changelog ### 0.7.4 (1.12) * Fix crash in fasterEntityDataManager. * Move fasterEntityDataManager to experimental and disable by default due to more bugs. * Remove the patch fixing the crash with over 5000 unlocked recipe outputs in the client-side notification, as it has been added to Forge (2401+). ### 0.7.2 (1.10/1.11) * Remove fasterEntityDataManager due to more bugs. ### 0.7.3 (1.12) * Integrate World.getCollisionBoxes() performance boost patch * Add config option to disable all coremod functionality in Anarchy * Fix fasterEntityDataManager-related bugs. * Add option to fix RecipeToast crash with too many recipes unlocked at the same time. ### 0.7.1 (1.10/1.11) * Integrate World.getCollisionBoxes() performance boost patch * Fix fasterEntityDataManager-related bugs. * Sign JAR to improve adherence to community coremod guidelines ### 0.7.2 (1.12) * Sign JAR to improve adherence to community coremod guidelines ### 0.7.1 (1.12) * Fixed parallel model baking crash * Temporarily disabled the ClassInheritanceMultiMap patch in development environments ### 0.7.0 * Made model deduplication slightly more effective in Anarchy * (1.11+) Added an in-game configuration menu! Aside from the usual configuration editing, it lets you disable and enable texture animations at runtime. ### 0.7.0 beta 1 * Minecraft 1.12 support! (Please note that future versions of Forge may break this release of FoamFix on 1.12! Await an update when/if that happens.) * Internal rewrite of the patching system. (Ongoing) * Trimmed JAR filesizes a little bit. * New CPU-centric optimizations: fasterAirItemLookup, fasterEntityDataManager, fasterEntityLookup, fasterPropertyComparisons. * New tweak: disableRedstoneLight - disables light updates caused by redstone torches and logic components. * New tweak: disableTextureAnimations ### 0.6.3 * Added config option to automatically set mipmap levels to 0 and off-thread chunk rendering to on with fresh instances. ### 0.6.2 * (Please note that 0.6.2 final is equal to 0.6.2 beta 4. No need to update if you're on the latter!) * Slight load time optimization for the "optimizedBlockPos" patch * Optimize FoamFix's coremod.optimizedBlockPos transformer to run faster (in local testing, 850ms -> 150ms overhead) * Add parallel model baking to speed up loading times * Add optimizations to VertexLighterFlat inspired by @bs2609 and @thecodewarrior's comments * Add minor patch to replace Class.getSimpleName with Class.getName in World.updateEntities * Remove unnecessary fluff ### 0.6.1 * Remove tweaked resource handling as it seems to make no real-world difference and causes issues with OptiFine ### 0.6.0 * (Anarchy) Add support for dynamic baking of 3D item models on demand, saving RAM * (Anarchy) Expand transformer blacklist to save some loading time * Add slightly faster version of Minecraft's built-in resource handling to save a bit of loading time (Works best on Anarchy, does still work on Lawful) * Tweak deduplication behaviour ### 0.5.4 * (Anarchy) Fix NPE in patchOtherClass * (Anarchy) Cache BlockInfo lookups in ChunkInfo objects ### 0.5.3 * (Anarchy) Fix certain optimizations not applying outside of dev enviornment * (Anarchy) Add small GC churn optimization to lighting code * (Anarchy) Remove delayChunkUpdates patch - it is implemented better in Forge * Fix compatibility with newer versions of LaunchWrapper ### 0.5.2 * (Anarchy) Stop chunks from being forced to update immediately, trading constant stutter for small delays in chunk updates. * Disable certain optimizations already implemented by Forge depending on Forge version ### 0.5.1 * (Anarchy) Fix incompatibility with Dynamic Surroundings ### 0.5.0 * (Anarchy) Optimize block state implementation storage, saving another ~10% of RAM, especially on large modpacks * (Anarchy) Optimize BlockInfo to prevent BlockPos spam - also, fix a lighting bug free of charge * (Anarchy) Fix compatibility with Sponge * Trim certain model ArrayLists, saving a few megabytes at best (proposed by SoniEx2) * Deduplicate entire TRSRTransformation ImmutableMaps * Slightly improved deduplication speed * Fix model deduplication incorrectly handing ItemCameraTransforms objects * Fix model deduplication NPE with a few mods ### 0.4.3 * Add Minecraft 1.11.2 support * Add option for configuring deduplicator recursion level ### 0.4.2 * Fix deduplication not considering an use case implemented by TCon2 (among others?) * Add support for cleaning up wasted space in registries (saves ~32MB of RAM) ### 0.4.1 * Deduplication performance improvements ### 0.4.0 * Update to 1.11 * Add experimental BlockPos getter optimization * Add server-side support ### 0.3.2a * [#1] Fix Botania flowers rendering incorrectly * Fix crash caused by disabling the deduplication feature ### 0.3.1 * Improve deduplication (fix a potential bug, deduplicate more data) ### 0.3.0b * Removed easter egg