← Назад к ресурсам

Hibernate Fabric

Lets your Minecraft Fabric server snooze when idle, slashing CPU usage without missing a block!

Modrinth management optimization

Описание

Hibernate Fabric Lets your Minecraft Fabric server snooze when idle, slashing CPU usage without missing a block! [Download on Modrinth](https://modrinth.com/mod/hibernate-fabric/versions) | [Download from Releases](https://codeberg.org/VoxelBill/hibernate-fabric/releases) ## About The Project **Hibernate Fabric** is a lightweight tool that automatically puts your Minecraft Fabric 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. ### Built With This project is built with the following technologies: * ![Java][java-icon] * ![Gradle](https://img.shields.io/badge/gradle-02303A.svg?style=for-the-badge&logo=gradle&logoColor=white) * ![Fabric][fabric-icon] ## Run You will need a Minecraft Fabric server. 1. Download `hibernate-fabric-x.x.x+mc2x.x.jar` from one of the places at the top of this README. 2. Copy the downloaded jar file to the `mods` folder of your Minecraft Fabric server. Don't forget to set `pause-when-empty-seconds` to `0` in your `server.properties` file to disable the vanilla hibernation system. ### NeoForge Support Via Compatibility Layer > [!WARNING] > NeoForge is currently supported **only through Sinytra Connector** which is a compatiblilty layer to allow Fabric mods to load in NeoForge. > > Hibernate Fabric can currently be used on NeoForge through **Sinytra Connector**, but this configuration is **not officially supported**. > While it works, compatibility depends on both Hibernate Fabric and Sinytra Connector, and future updates to either project may cause it to stop working. > > Issues that occur **only when using NeoForge/Sinytra Connector** are generally **not supported** and may be closed without investigation. > If you encounter an issue, please first reproduce it on Fabric before reporting it. In addition to the instructions above: 1. Download and install [Sinytra Connector](https://modrinth.com/mod/connector) and [LaunchPad](https://modrinth.com/mod/launchpad) to the `mods` folder of your Minecraft NeoForge server. 2. Download and install [Forgified Fabric API](https://modrinth.com/mod/forgified-fabric-api) to the `mods` folder of your Minecraft NeoForge server. ## Getting Started With Development 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 25 or higher. * [Download JDK](https://adoptium.net/) * **Gradle**: Version 9.5.1 or higher. * [Install Gradle](https://gradle.org/install/) * **Minecraft**: Version 26.3 ### Build 1. **Clone the repository** ```sh git clone https://codeberg.org/VoxelBill/hibernate-fabric.git ``` 2. Navigate to the project directory ```sh cd hibernate-fabric ``` 3. Build the project with Gradle ```sh ./gradlew clean build ``` You can find the built mod at `hibernate-fabric/build/libs/hibernate-fabric-x.x.x+mc2x.x.jar`. ## Configuration The mod automatically creates a configuration file at `config/hibernate-fabric.json` on first run. Here are the available settings: ### Basic Settings ```js { "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 ```js ... "enableMemoryOptimization": true, "memoryCleanupIntervalSeconds": 30, "memoryThresholdPercent": 80.0, "forceGarbageCollection": true, "gcIntervalSeconds": 30, "saveBeforeHibernation": true, "removeEntities": [ "minecraft:item", "minecraft:firework_rocket", "minecraft:arrow", "minecraft:experience_orb" ], "droppedItemMaxAgeSeconds": 300, "logMemoryInfo": false, ... ``` | 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 | | `forceGarbageCollection` | `true` | Force Java garbage collection during hibernation | | `gcIntervalSeconds` | `30` | Minimum time between garbage collection runs | | `saveBeforeHibernation` | `true` | Save world data before entering hibernation | | `removeEntities` | `item`, `firework_rocket`, `arrow`, `experience_orb` | List of entities to remove during hibernation (ignores entities with custom names) | | `droppedItemMaxAgeSeconds` | `300` | Age in seconds after which items are removed (5 minutes) | | `logMemoryInfo` | `false` | Log memory usage and garbage collector information to console | ### CPU Optimization ```js ... "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) | ### Gamerule Values When The Servers Awake ```js ... "awakeGameRules": { "advance_time": true, "advance_weather": true, "random_tick_speed": 3, "spawn_mobs": true, "fire_spread_radius_around_player": 128 }, ... ``` | Setting | Default | Description | |---------|---------|-------------| | `advance_time` | `true` | The value to set the gamerule `advance_time` to when coming out of hibernation | | `advance_weather` | `true` | The value to set the gamerule `advance_weather` to when coming out of hibernation | | `random_tick_speed` | `3` | The value to set the gamerule `random_tick_speed` to when coming out of hibernation | | `spawn_mobs` | `true` | The value to set the gamerule `spawn_mobs` to when coming out of hibernation | | `fire_spread_radius_around_player` | `128` | The value to set the gamerule `fire_spread_radius_around_player` to when coming out of hibernation | ### Gamerule Values When The Servers Hibernating ```js ... "hibernatingGameRules": { "advance_time": false, "advance_weather": false, "random_tick_speed": 0, "spawn_mobs": false, "fire_spread_radius_around_player": 0 } } ``` | Setting | Default | Description | |---------|---------|-------------| | `advance_time` | `false` | The value to set the gamerule `advance_time` to when going into hibernation | | `advance_weather` | `false` | The value to set the gamerule `advance_weather` to when going into hibernation | | `random_tick_speed` | `0` | The value to set the gamerule `random_tick_speed` to when going into hibernation | | `spawn_mobs` | `false` | The value to set the gamerule `spawn_mobs` to when going into hibernation | | `fire_spread_radius_around_player` | `0` | The value to set the gamerule `fire_spread_radius_around_player` to when going into hibernation | ## 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 ## License Distributed under the **GNU Lesser General Public License v3.0 or later (LGPL-3.0-or-later)**. This project is a fork of [Hibernateforge](https://github.com/Thadah/Hibernateforge) which was distributed under the **European Union Public License v1.2 (EUPL-1.2)**. Relicensing has been done in accordance with the compatibility clause of the EUPL (Article 5). See `LICENSE` for more information. [issues-shield]: https://img.shields.io/github/issues/VoxelBill/hibernate-fabric.svg?style=for-the-badge [issues-url]: https://github.com/VoxelBill/hibernate-fabric/issues [forks-shield]: https://img.shields.io/github/forks/VoxelBill/hibernate-fabric.svg?style=for-the-badge [forks-url]: https://github.com/VoxelBill/hibernate-fabric/network/members [stars-shield]: https://img.shields.io/github/stars/VoxelBill/hibernate-fabric.svg?style=for-the-badge [stars-url]: https://github.com/VoxelBill/hibernate-fabric/stargazers [license-shield]: https://img.shields.io/github/license/VoxelBill/hibernate-fabric.svg?style=for-the-badge [license-url]: https://github.com/VoxelBill/hibernate-fabric/blob/master/LICENSE [java-icon]: https://img.shields.io/badge/Java-D5D5D5.svg?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2NCIgaGVpZ2h0PSI2NCIgdmlld0JveD0iMCAwIDMyIDMyIj48cGF0aCBkPSJNMTEuNjIyIDI0Ljc0cy0xLjIzLjc0OC44NTUuOTYyYzIuNTEuMzIgMy44NDcuMjY3IDYuNjI1LS4yNjdhMTAuMDIgMTAuMDIgMCAwIDAgMS43NjMuODU1Yy02LjI1IDIuNjcyLTE0LjE2LS4xNi05LjI0NC0xLjU1em0tLjgtMy40NzNzLTEuMzM2IDE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