v1.2.1
No Slime Superflat Version 1.2.1 Improvements
Changes Made to the Mod
This new version of No Slime Superflat has some improvements. The configuration system is better now. It also has performance optimizations to stop memory leaks.. It has new features to make the user experience better. All of this is done without using APIs like Collective.
Main Features of the Mod
1. Configuration Changes in Time
The mod now lets you change the configuration in real time. You do not need to restart Minecraft to see the changes. Here is how it works:
- The mod can automatically detect changes you make to the settings from the GUI
- It has a ConfigChangedEvent to listen for changes and apply the configuration
- You can also manually reload the configuration using the
reloadConfig()method - There is a command to reload the configuration in the game. You can use
/noslimesuperflat reloadto do this
2. Statistics and Command System
In-Game Command
There is a command /noslimesuperflat with subcommands:
- You can use
/noslimesuperflator/noslimesuperflat statsto see the statistics. - You can use
/noslimesuperflat reloadto reload the configuration without restarting the game.
Statistics Tracking
The mod tracks statistics in time. It keeps track of:
- The total number of slimes blocked.
- The number of checks performed.
- The efficiency percentage calculation.
API Access
There are methods to access the statistics programmatically:
EventHandler.getSlimesBlocked()EventHandler.getSpawnChecksPerformed()EventHandler.resetStatistics()
3. Performance Optimizations
World Type Check Cache
Before the mod checked if the world was Superflat every time a slime spawned. This was a problem. Now the mod uses a cache with a 5-second expiration. This reduces the number of getTerrainType() calls and it is memory-safe
Thread-Safe Statistics
The mod uses AtomicLong counters for thread-safe operations. This means there is no synchronization which improves performance. It also prevents memory leaks because atomic operations do not create lock objects
Performance Configurations
There are options in the "performance" category:
- Optimized Spawn Checking is enabled by default. It uses optimized algorithms for spawn verification. Reduces memory usage
- Cache World Type Checks is also enabled by default. It caches world type verifications. Has automatic expiration to prevent stale data
4. Memory Leak Prevention
The mod has implemented measures to prevent memory leaks:
- Private and thread-safe configuration. The configuration is private and thread-safe to prevent direct access
- Time-expiring cache. The cache automatically invalidates after 5 seconds to prevent data from accumulating
- Explicit cache clearing. The
clearCache()method is called when the configuration changes to prevent accumulation of state - No heavy dependencies. The mod does not use APIs like Collective that can cause memory leaks
- Efficient logger. The logger is conditional. Prevents string accumulation in memory when debug is disabled
- Atomic statistics counters. The mod uses AtomicLong for lock-free counting, which is GC-friendly
5. New Configuration Structure
The mod has a configuration structure:
Category: General
enableDebugLogging: This enables logs for troubleshooting
Category: Performance
useOptimizedSpawnChecking: This uses an optimized spawn checking algorithmcacheWorldTypeChecks: This caches world type checks
Technical Changes Made
NoSlimeSuperflat.java
- Added a listener for reload
- Implemented a method to check if the world is Superflat with an optimized cache
- Added thread-safe synchronization
- Added a method to access the configuration safely
- Updated the version to 1.2.1
- Improved initialization logging
EventHandler.java
- Now uses the
NoSlimeSuperflat.isSuperflatWorld()method of direct verification - Improved logging with string formatting
- Removed direct dependency on
WorldType.FLAT - Added statistics tracking with
AtomicLong - Implemented the
/noslimesuperflatcommand system - Added a handler for command registration
- Added public API methods for statistics access
ConfigGui.java
- Adds both categories ( performance) to the GUI
- Overridden the
onGuiClosed()method to reload the configuration on close - Better visual organization of options
ConfigGuiFactory.java
- Improved documentation about runtime support
- Indicates all categories support real-time changes
Comparison to the Superflat World No Slimes
| Feature | Original | This Version |
|---|---|---|
| Required API | Collective | None |
| Memory Leaks | Reported in 1.12.2 | Actively prevented |
| Runtime Config | No | Yes |
| Check Cache | No | Yes (5s) |
| Thread Safety | Unknown | Implemented |
| Config Categories | 1 | 2 (General + Performance) |
| Statistics | No | Yes (with command) |
| Optimizations | Basic | Multi-layer |
| Command Interface | No | Yes |
| Atomic Operations | No | Yes |
How to Use the Mod
For Players
- Install the mod normally
- Access the configuration via Mods > No Slime Superflat > Config
- Adjust the options as needed
- Changes apply immediately upon saving
- Use
/noslimesuperflatto verify the mod is working
For Debugging
- Enable
Enable Debug Loggingin the configuration - Check the logs for:
- When the configuration reloads
- When the cache updates
- Blocked slime spawns
- Use
/noslimesuperflat statsfor real-time statistics
For Developers
- Access statistics via
EventHandler.getSlimesBlocked() - Reset statistics with
EventHandler.resetStatistics() - All configuration is thread-safe. Can be accessed from any thread
Performance of the Mod
- Memory Usage: Less than 1MB additional (only temporary cache + atomic counters)
- TPS Impact: small (< 0.01ms per tick)
- Thread Safety: All configuration operations are synchronized
- GC-Friendly: Minimal objects created cache reuses variables
- Atomic Counters: Lock-free statistics tracking
Compatibility of the Mod
- Minecraft 1.12.2
- Forge 14.23.5.2847 or higher
- Compatible, with mods that modify spawns
- Works on both client and server
Developed by: Onyx_i7
License: MIT
Inspired by: Serilum Superflat World No Slimes