No description
Find a file
Paulo Henrique 7fe173d6ea
All checks were successful
Mirror to GitHub / mirror (push) Successful in 5s
Document configuration options in README
2025-09-03 11:41:23 +02:00
.forgejo/workflows Upload new workflows 2025-08-31 11:07:28 +02:00
.github/workflows Adds GitHub Workflows and vscode settings files 2025-07-29 15:40:34 -03:00
.vscode Adds GitHub Workflows and vscode settings files 2025-07-29 15:40:34 -03:00
buildSrc Update neoforge to support multiple MC versions 2025-07-25 14:34:32 +02:00
common Reviewed comments, minor adjustments 2025-07-29 10:54:55 -03:00
fabric Reviewed comments, minor adjustments 2025-07-29 10:54:55 -03:00
gradle/wrapper Refactor mod to support Fabric and Neoforge (MC 1.21.6) 2025-07-24 14:06:17 +02:00
neoforge Reviewed comments, minor adjustments 2025-07-29 10:54:55 -03:00
.gitattributes Refactor mod to support Fabric and Neoforge (MC 1.21.6) 2025-07-24 14:06:17 +02:00
.gitignore Refactor mod to support Fabric and Neoforge (MC 1.21.6) 2025-07-24 14:06:17 +02:00
build.gradle Refactor mod to support Fabric and Neoforge (MC 1.21.6) 2025-07-24 14:06:17 +02:00
gradle.properties feat: reduce RAM usage when server is empty 2025-07-28 00:07:36 -03:00
gradlew Refactor mod to support Fabric and Neoforge (MC 1.21.6) 2025-07-24 14:06:17 +02:00
gradlew.bat Refactor mod to support Fabric and Neoforge (MC 1.21.6) 2025-07-24 14:06:17 +02:00
LICENSE Change license and gitignore 2024-11-04 18:45:35 +01:00
README-github.md Upload new workflows 2025-08-31 11:07:28 +02:00
README.md Document configuration options in README 2025-09-03 11:41:23 +02:00
settings.gradle Refactor mod to support Fabric and Neoforge (MC 1.21.6) 2025-07-24 14:06:17 +02:00

Contributors Forks Stargazers Issues MIT License

Hibernateforge

Let your Minecraft Forge server snooze when idle, slashing CPU usage without missing a block!

View Demo · Report Bug or · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Run
  4. Configuration
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Hibernateforge is a lightweight tool that automatically puts your Minecraft Forge server to sleep when no players are online. By reducing CPU usage during idle times, it helps save server resources, lowers your electricity bill, and makes your server more eco-friendly. It's a simple way to keep your Minecraft world running smoothly without wasting power when it's not needed.

(back to top)

Built With

This project is built with the following technologies:

  • Gradle
  • Fabric/Neoforge
  • Visual Studio Code

(back to top)

Getting Started

To get a local copy up and running, follow these simple steps.

Prerequisites

Ensure you have the following installed on your machine:

  • Java Development Kit (JDK): Version 21 or higher.
  • Gradle: Version 8.9 or higher.
  • Minecraft: Version 1.21.6 or higher

Build

  1. Clone the repository

    git clone https://github.com/Thadah/hibernateforge.git
    
  2. Navigate to the project directory

    cd hibernateforge
    
  3. Build the project with Gradle

    ./gradlew clean :fabric:build :neoforge:build
    

(back to top)

Run

You will need a Minecraft Forge server. Copy the <mod>/build/libs/hibernateforge-<mod>-x.x.x.jar file to the mods folder of your Minecraft Forge server.

(back to top)

Configuration

The mod automatically creates a configuration file at config/hibernateforge.json on first run. Here are the available settings:

Basic Settings

{
  "startEnabled": true,
  "ticksToSkip": 400,
  "permissionLevel": 2,
  "sleepTimeMs": 75
}
Setting Default Description
startEnabled true Whether hibernation activates automatically when server starts with no players
ticksToSkip 400 Number of ticks to process before applying sleep during hibernation
permissionLevel 2 Required permission level to use hibernation commands (0=all, 4=owner)
sleepTimeMs 75 Milliseconds to sleep between tick processing cycles

Memory Optimization

{
  "enableMemoryOptimization": true,
  "memoryCleanupIntervalSeconds": 30,
  "memoryThresholdPercent": 80.0,
  "maxChunksToUnloadPerTick": 10,
  "forceGarbageCollection": true,
  "gcIntervalSeconds": 30,
  "saveBeforeHibernation": true,
  "removeOldDroppedItems": true,
  "droppedItemMaxAgeSeconds": 300,
  "removeProjectiles": true,
  "removeExperienceOrbs": true,
  "compactDataStructures": true,
  "logMemoryUsage": true
}
Setting Default Description
enableMemoryOptimization true Enable memory cleanup during hibernation
memoryCleanupIntervalSeconds 30 How often to run memory cleanup routines
memoryThresholdPercent 80.0 Memory usage percentage that triggers cleanup
maxChunksToUnloadPerTick 10 Maximum chunks to unload per server tick
forceGarbageCollection true Force Java garbage collection during hibernation
gcIntervalSeconds 30 Minimum time between garbage collection runs
saveBeforeHibernation true Save world data before entering hibernation
removeOldDroppedItems true Remove old dropped items during hibernation
droppedItemMaxAgeSeconds 300 Age in seconds after which items are removed (5 minutes)
removeProjectiles true Remove arrows and other projectiles
removeExperienceOrbs true Remove floating experience orbs
compactDataStructures true Attempt to compact server data structures
logMemoryUsage true Log memory usage information to console

CPU Optimization

{
  "aggressiveCpuSaving": true,
  "minSleepInterval": 1500,
  "highLoadSleepMultiplier": 1.5,
  "yieldInterval": 8
}
Setting Default Description
aggressiveCpuSaving true Enable more aggressive CPU saving measures
minSleepInterval 1500 Minimum time in milliseconds between sleep cycles
highLoadSleepMultiplier 1.5 Multiplier for sleep time when system load is high
yieldInterval 8 How often to yield CPU to other threads (every N ticks)

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. If you don't have any coding experience, testing other platforms and configurations is also very welcome!

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the European Union Public License v1.2. See LICENSE for more information.

(back to top)

Contact

Thadah D. Denyse - thadahdenyse@protonmail.com

Project Link: https://github.com/Thadah/hibernateforge

(back to top)

Acknowledgments

Thanks to these nice projects!

(back to top)