作者:rebot | 分类:模组
Minecraft 版本: 1.21 1.21.1
平台: fabric forge neoforge quilt
标签: library
Mebahel’s API is a core dependency mod that provides shared systems, utilities, and gameplay frameworks used across the Mebahel mod ecosystem.
It is designed for mod developers who want production-ready building blocks for complex mechanics without rewriting the same infrastructure in every project.
⚠️ This mod is a library. It does not add standalone gameplay content by itself.
This mod is a technical dependency used by other Mebahel mods.
You normally won’t interact with this mod directly.
It runs in the background to make other mods work correctly and efficiently.
Depending on the mod that uses it, it may provide:
Structures can generate without being flooded, even underwater or inside wet terrain.
Some Mebahel mods use special chests powered by this API:
Certain creatures may use advanced movement such as:
✔ Required if another mod lists it as a dependency
✔ Safe for singleplayer and multiplayer
✔ Must be installed on both client and server
❌ Removing it will break mods that depend on it
Mebahel’s API provides reusable systems intended to simplify the development of complex Fabric mods.
Prevents structures from spawning flooded in oceans, rivers, or aquifers.
Capabilities
A complete foundation for creating custom containers with multiplayer-safe logic.
Includes
When using a loot table:
Without a loot table:
Speeds up development of container blocks:
Utility methods for advanced combat AI and movement behavior.
Supports:
Ideal for bosses, ranged mobs, constructs, or mechanical entities.
✔ Reduces duplicated code across multiple mods
✔ Optimized for server performance
✔ Multiplayer-safe systems
✔ Production-ready implementations
✔ Actively used in real released mods
Add the API as a dependency in your Fabric mod project.
repositories {
maven {
name = "GitLab-Mebahel"
url = uri("https://gitlab.com/api/v4/projects/77311613/packages/maven")
}
}
dependencies {
modImplementation "net.mebahelsapi:mebahels-api:<version>"
}
{
"depends": {
"mebahels-api": "*"
}
}
Ensure versions match your Minecraft version.
All Mebahel ecosystem mods depend on this API as their shared core library.
Automatically removes water and waterlogged states after structure generation.
Use cases
How to enable
Add the processor to your structure configuration:
"processors": "mebahelsapi:water_removal_processor"
The cleanup runs automatically after placement.
Server-side only.
Provides a ready-to-extend system for animated, synchronized chests.
Example — ChestBlockEntity:
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 — ChestBlock:
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 provides reusable helpers for combat movement, especially for ranged entities.
Typical responsibilities:
Recommended usage pattern inside a Goal:
Example — Shooting Goal (Draugr Archer):
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
}
}
This separation keeps movement smooth while allowing precise control over attack timing and animations.
请登录后举报
暂无评论,抢个沙发吧~