Skip to content

MistaSoup/BlockEntityLimiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

BlockEntityLimiter

A Folia-compatible Minecraft plugin that limits the number of block entities per chunk for Minecraft 1.21.x.

Features

  • Folia Compatible: Fully compatible with Folia's multi-threaded regions
  • High Performance: Smart caching system reduces lag significantly
  • Chunk-based Limiting: Limits block entities on a per-chunk basis
  • Master Limit: Optional master limit that controls total block entities across all types
  • Individual Limits: Each block entity type has its own configurable limit
  • Toggle System: Enable/disable limiting for each block entity type
  • No Deletion: Plugin only prevents placement, never removes existing block entities
  • Hot Reload: Reload configuration without restarting the server
  • Shulker Box Support: Single config entry covers all shulker box colors
  • Thread-Safe: Designed for Folia's concurrent region system

Tracked Block Entities

  • Decorated Pot
  • Ender Chest
  • Blast Furnace
  • Smoker
  • Furnace
  • Barrel
  • Dropper
  • Dispenser
  • Chest
  • Trapped Chest
  • Hopper
  • Shulker Box (all colors)

Installation

  1. Download the latest release JAR file
  2. Place it in your server's plugins folder
  3. Restart your server or load the plugin
  4. Configure plugins/BlockEntityLimiter/config.yml to your needs

Building from Source

Prerequisites

  • Java 21 or higher
  • Maven

Build Steps

git clone <repository-url>
cd BlockEntityLimiter
mvn clean package

The compiled JAR will be in the target folder.

Project Structure

BlockEntityLimiter/
├── src/
│   └── main/
│       ├── java/
│       │   └── com/
│       │       └── yourname/
│       │           └── blockentitylimiter/
│       │               ├── BlockEntityLimiter.java
│       │               ├── ConfigManager.java
│       │               ├── BlockEntityCounter.java
│       │               ├── BlockPlaceListener.java
│       │               └── BELimiterCommand.java
│       └── resources/
│           ├── plugin.yml
│           └── config.yml
└── pom.xml

Configuration

Master Limit

The master limit controls the total number of block entities across ALL types:

master-limit:
  enabled: true    # Enable/disable master limit
  amount: 1000     # Maximum total block entities per chunk

Example Scenarios (with master limit of 1000):

  • 500 chests + 500 ender chests = Allowed
  • 100 chests + 900 ender chests = Allowed
  • 600 chests + 500 ender chests = Blocked (exceeds master limit)

Individual Block Entity Limits

Each block entity type has two settings:

block-entities:
  chest:
    enabled: true   # Enable limiting for this type
    limit: 100      # Maximum of this type per chunk
  • enabled: true - This block entity type will be limited
  • enabled: false - This block entity type can be placed without restriction
  • limit - Maximum number of this specific type per chunk

How Limits Work Together

When placing a block entity, the plugin checks:

  1. Is limiting enabled for this block entity type?
  2. Has the individual limit been reached?
  3. (If master limit is enabled) Has the master limit been reached?

Placement is blocked if any limit is reached.

Commands

Command Permission Description
/belimiter reload blockentitylimiter.reload Reload the configuration
/belimiter blockentitylimiter.use Show help message

Aliases: /bel, /blocklimiter

Permissions

Permission Default Description
blockentitylimiter.use true Access to main command
blockentitylimiter.reload op Reload configuration

Support

For Minecraft versions: 1.21.x Requires: Folia or Paper 1.21.x

Performance

The plugin uses an intelligent caching system to minimize lag:

  • Cache Duration: 500ms (configurable in code)
  • Automatic Invalidation: Cache updates when blocks are placed/broken
  • Memory Management: Automatic cleanup of old cache entries
  • Thread-Safe: ConcurrentHashMap for Folia compatibility

In testing scenarios with high block placement rates, the cache reduces chunk scanning by over 95%, preventing lag spikes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Minecraft plugin that limits the number of block entities per chunk

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages