ConditionalBarriers is a Fabric mod for Minecraft that allows players to pass through barrier blocks based on configurable rules or external conditions via an API.
By default, barrier blocks are impassable for everyone. This mod changes that by allowing fine-grained control over who can walk through them, making it ideal for map makers, server administrators, and developers.
- Configurable Pass Rules: Define who can pass through barriers using various criteria (Game Mode, Permission Level, Player Name, UUID, Scoreboard Tags).
- Developer API: Easily register custom conditions to control barrier accessibility from other mods.
- In-game Commands: Manage the mod's state and reload configuration without restarting the server.
- No More Suffocation: Automatically prevents players from suffocating inside barriers if they are allowed to pass through them.
- High Performance: Implemented using optimized Mixins to ensure minimal impact on server performance.
The mod provides the following commands (requires permission level 2 or higher):
/conditionalbarriers on: Enables rule evaluation./conditionalbarriers off: Disables the mod's logic (making all barriers passable for everyone)./conditionalbarriers status: Displays whether the mod is currently active./conditionalbarriers reload: Reloads the configuration from the disk./cb: A shorter alias for/conditionalbarriers.
The configuration file is located at config/conditionalbarriers.json. It allows you to define a list of rules that are evaluated in order.
{
"defaultPassable": false,
"rules": [
{
"type": "SPECTATOR",
"action": "ALLOW"
},
{
"type": "CREATIVE",
"action": "ALLOW"
},
{
"type": "SCOREBOARD_TAG",
"action": "ALLOW",
"value": "can_pass_barriers"
},
{
"type": "OPERATOR_LEVEL",
"action": "ALLOW",
"operatorLevel": 4
}
]
}CREATIVE: Matches players in Creative mode.SPECTATOR: Matches players in Spectator mode.OPERATOR_LEVEL: Matches players with a specific permission level.PLAYER_NAME: Matches a specific player name (case-sensitive option available).PLAYER_UUID: Matches a specific player UUID.SCOREBOARD_TAG: Matches players with a specific scoreboard tag.
ConditionalBarriers is required on both the client and the server to function correctly. This is because the client's physics engine needs to know when a barrier block should be non-solid to allow for smooth movement.
- Make sure you have the Fabric Loader installed on both sides.
- Drop the
ConditionalBarriersJAR file into themodsfolder of both your client and server. - (Optional) Install Fabric API if not already present.
If you are a mod developer, you can use the ConditionalBarriersApi to add your own logic.
To use the ConditionalBarriers API in your own mod, you can add it as a dependency using JitPack or your preferred Maven repository.
- Add the JitPack repository to your
build.gradle:
repositories {
maven { url 'https://jitpack.io' }
}- Add the dependency:
dependencies {
modImplementation "com.github.crawkatt:ConditionalBarriers:v1.0.0"
}Note: Replace v1.0.0 with the actual version you want to use.
Add the mod to your depends section to ensure it's present at runtime:
"depends": {
"conditionalbarriers": ">=1.0.0"
}ConditionalBarriersApi.registerCondition(new Identifier("mymod", "special_access"), context -> {
if (someCustomLogic(context.player())) {
return BarrierDecision.ALLOW; // Let them pass
}
return BarrierDecision.PASS; // Let other rules decide
});You can also force a specific player to be able to pass (or be blocked) regardless of other rules:
ConditionalBarriersApi.setPlayerOverride(player, PlayerBarrierOverride.ALLOW);- Make sure you have the Fabric Loader installed.
- Drop the
ConditionalBarriersJAR file into yourmodsfolder. - (Optional) Install Fabric API if not already present.
This project is licensed under the terms specified in the LICENSE.txt file.