Mebahel's API
Shared systems and utilities used by Mebahel mods.
Mebahel's API is a Fabric library that provides common systems used across several Mebahel projects. It contains reusable code for structure processing, custom containers, multiplayer loot handling, entity movement, and other features that would otherwise need to be implemented separately in each mod.
The mod is primarily a technical dependency and does not add standalone gameplay content by itself.
Dependencies
Forge / NeoForge
Fabric
For Players and Modpack Users
Mebahel's API is installed as a dependency for mods that use its shared systems. In most cases, players do not interact with it directly.
Depending on the mod using the API, it can provide features such as dry structure generation, animated custom chests, personal loot, synchronized container behavior, and improved movement for custom entities.
Structure Water Removal
Structures can use the API to remove water and waterlogged states after generation. This is useful for dungeons, ruins, and other structures that may intersect oceans, rivers, caves, or aquifers.
Custom Chests
Mods using the chest framework can provide custom containers with features such as:
- Animated opening and closing
- Custom sounds and screens
- Server-authoritative inventory handling
- Multiplayer-safe synchronization
- Optional personal loot for each player
When personal loot is enabled, each player receives their own generated inventory from the configured loot table instead of sharing the same chest contents.
Entity Movement
Custom entities can use shared movement utilities for combat positioning, including strafing, retreating when a target is too close, target-facing rotation, jump assistance, and anti-stuck handling.
Installation
Install Mebahel's API when another mod lists it as a required dependency.
It must be present in the appropriate environment for the mod that depends on it. Removing the API while dependent mods are installed can prevent them from loading or functioning correctly.
For Mod Developers
Mebahel's API provides reusable foundations for systems shared between Fabric mods. The goal is to keep common behavior in one library instead of maintaining separate implementations in every project.
The main systems currently exposed by the API include:
- Structure water removal
- Animated custom chest foundations
- Personal and shared chest inventories
- Screen and screen handler support for custom containers
- Entity movement and combat positioning utilities
Developer Installation
Add the API repository and dependency to your Fabric project.
Maven Repository
repositories {
maven {
name = "GitLab-Mebahel"
url = uri("https://gitlab.com/api/v4/projects/77311613/packages/maven")
}
}
Dependency
dependencies {
modImplementation "net.mebahelsapi:mebahels-api:<version>"
}
fabric.mod.json
{
"depends": {
"mebahels-api": "*"
}
}
Structure Water Removal Processor
The water removal processor is intended for structures that should remain dry after generation.
It can:
- Remove waterlogged states from generated blocks
- Clear water inside the processed structure area
- Work with template-based structure generation
- Perform cleanup after placement without requiring custom logic in every structure
Usage
Add the processor to the relevant structure processor configuration:
"processors": "mebahelsapi:water_removal_processor"
The cleanup is handled automatically after structure placement and runs on the server side.
Custom Chest Framework
The chest framework provides a base implementation for custom containers that need animation, synchronization, custom sounds, or multiplayer-specific inventory behavior.
It includes support for:
- GeckoLib open, close, and spawn animations
- Custom opening and closing sounds
- Custom screens and screen handlers
- Server-authoritative container logic
- Multiplayer synchronization
- Personal loot generated separately for each player
- Standard shared inventories when personal loot is not used
Personal Loot
When a loot table is configured, the chest can generate a separate inventory for each player. Loot is generated once for that player and stored independently from the inventories seen by other players.
This is useful for dungeon rewards, boss chests, or multiplayer structures where every player should be able to claim their own loot.
Shared Inventory
When no personal loot table is used, the chest behaves as a shared container and all players access the same inventory.
Example Block Entity
public class DwemerChestBlockEntity extends BaseChestBlockEntity {
public DwemerChestBlockEntity(BlockPos pos, BlockState state) {
super(ModBlockEntities.DWEMER_CHEST_ENTITY, pos, state, 36);
}
@Override
protected Text getChestTitle() {
return Text.translatable("block.mebahelcreaturesdwarven.dwemer_chest");
}
@Override
protected String getLogPrefix() {
return "[DwemerChest]";
}
@Override
@Environment(EnvType.CLIENT)
public void playOpenSound() {
playChestSound(ModSounds.DWARVEN_CHEST_OPEN);
}
@Override
@Environment(EnvType.CLIENT)
public void playCloseSound() {
playChestSound(ModSounds.DWARVEN_CHEST_CLOSE);
}
@Override
protected boolean isMultiplayerEnabled() {
return ModMultiplayerChest.turnOnMultiplayerDraugrChest;
}
}
Example Block
public class DwemerChestBlock extends BaseChestBlock {
public DwemerChestBlock(AbstractBlock.Settings settings) {
super(
settings,
() -> ModBlockEntities.DWEMER_CHEST_ENTITY,
DwemerChestBlockEntity::new
);
}
@Override
protected boolean isMultiplayerEnabled() {
return ModMultiplayerChest.turnOnMultiplayerDraugrChest;
}
}
MovementUtil
MovementUtil contains reusable helpers for custom entity movement and combat positioning. It is mainly intended for ranged mobs, bosses, constructs, and other entities that need more control than a basic navigation goal provides.
Typical uses include:
- Keeping an entity facing its target
- Detecting and recovering from movement stalls
- Maintaining combat distance
- Strafing around a target
- Retreating when a target gets too close
- Assisting movement over small obstacles
Movement and attack timing can be handled separately so animations and attacks remain independent from positioning logic.
Example Shooting Goal
public class DraugrArcherShootingGoal extends Goal {
private final DraugrArcherEntity actor;
private final MovementUtil movementUtil;
private final double STRAFE_DISTANCE = 8;
public DraugrArcherShootingGoal(DraugrArcherEntity actor) {
this.actor = actor;
this.movementUtil = new MovementUtil(this.actor);
}
@Override
public void tick() {
if (actor.isUsingPotion() || actor.getHealTicks() > 0) {
actor.setShooting(false);
actor.getNavigation().stop();
return;
}
LivingEntity target = this.actor.getTarget();
if (target == null || !target.isAlive()) {
this.stop();
return;
}
double distanceToTarget = this.actor.distanceTo(target);
movementUtil.lookAtTarget(target, actor);
movementUtil.checkIfStuck(target, actor);
if (distanceToTarget <= STRAFE_DISTANCE) {
movementUtil.moveBackward(target, actor);
} else {
movementUtil.strafeAroundTarget(target, actor);
}
// Shooting logic handled separately
}
}
A typical goal can validate the target, update rotation, run anti-stuck handling, choose movement based on distance, and then handle attack timing separately.
Used By
Mebahel's API is used as the shared library for Mebahel mods that rely on these systems.
Keeping this functionality in a common dependency makes it possible to reuse fixes and improvements across multiple projects without maintaining duplicate implementations.
Current Status
Mebahel's API is actively maintained alongside the mods that depend on it. Additional shared systems may be moved into the API when they are useful across more than one project.
Join the community and follow development on Discord: https://discord.com/invite/y8uC2NepkB

