MECHA - Multiple Entity Collision Hitboxes API

MECHA - Multiple Entity Collision Hitboxes API

Fabric API for implementing multiple collider hitboxes for a single entity

by
2.0K Downloads
fabricgame-mechanicslibraryutility
Rent Server with this Mod

Screenshots

Multiple colliders on a custom entity
Multiple colliders on a custom entity

About this Mod

A simple API for enabling custom entities to implement more than one collision box.

Setup

Add the Modrinth Maven and the right version of the mod to your build.gradle file:

repositories {
	maven { url 'https://api.modrinth.com/maven' }
}

dependencies {
	modImplementation "maven.modrinth:mecha-api:VERSION_GOES_HERE"
}

Usage

Implement MultiCollidable in your custom entity class, and override getColliders to add extra colliders to the entity.

Example

The following example code adds 2 colliders to an entity, each the size of a slab:

public CustomEntity extends Entity implements MultiCollidable {
    public List<VoxelShape> getColliders() {
        List<VoxelShape> colliders = new ArrayList<>();
        BlockPos pos = this.blockPos();
        double x = pos.getX();
        double y = pos.getY();
        double z = pos.getZ();
        colliders.add(VoxelShapes.cuboid(x, y, z, x+1, y+0.5, z+1));
        colliders.add(VoxelShapes.cuboid(x, y+0.5, z, x+1, y+1, z+1));
        return colliders;
    }
}

For 0.1.2 and newer, there is now also a custom entity type, DynamicBoundingBoxEntity, which has a dynamic bounding box based on the list returned by getColliders():

public CustomEntity extends DynamicBoundingBoxEntity {
    // The bounding box of this entity will dynamically resize
    // to fit the colliders returned by this function
    @Override
    public List<VoxelShape> getColliders() { ... }
}

Available Versions

MECHA 0.1.2 - Fabric 1.19.4+alpha
MC 1.19.4, 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6, 1.21, 1.21.1fabric
September 11, 2024
MECHA 0.1.1 - Fabric 1.20alpha
MC 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6fabric
May 6, 2024
MECHA 0.1.1 - Fabric 1.19.4alpha
MC 1.19.4fabric
May 6, 2024
MECHA 0.1.0 - Fabric 1.20.xalpha
MC 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6fabric
May 6, 2024
MECHA 0.1.0 - Fabric 1.19.4alpha
MC 1.19.4fabric
May 3, 2024

How to Install MECHA - Multiple Entity Collision Hitboxes API on Your Server

1

Order Server

Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).

2

Set fabric Loader

In the panel under "Egg", select the fabric loader and matching Minecraft version (1.21.1).

3

Install Mod

Open the mod browser in the dashboard and search for "MECHA - Multiple Entity Collision Hitboxes API". Click "Install" – done! Alternatively, upload the .jar via SFTP to the /mods folder.

Compatibility

Mod Loaders

fabric

Minecraft Versions

1.21.1, 1.21, 1.20.6 (+7 more)

Server-side

Required

Recommended RAM

4 GB(min. 3 GB)

Frequently Asked Questions

MECHA - Multiple Entity Collision Hitboxes API server crashes on startup – what to do?

Most common cause: wrong fabric version or insufficient RAM. Check the server log (latest.log) for "OutOfMemoryError" or "Mixin" errors. With Mado Hosting: ensure at least 3 GB RAM is allocated and the loader matches the mod version (1.21.1). You can switch loaders with one click in the panel.

Is MECHA - Multiple Entity Collision Hitboxes API compatible with fabric?

MECHA - Multiple Entity Collision Hitboxes API officially supports fabric for Minecraft 1.21.1, 1.21, 1.20.6. The Mado dashboard automatically detects incompatible loader combinations.

Server lagging with MECHA - Multiple Entity Collision Hitboxes API – how to optimize performance?

Recommended RAM: 4 GB (per 8 players). Use /spark profiler to check if MECHA - Multiple Entity Collision Hitboxes API consumes the most tick time. Common fixes: reduce server view-distance to 8-10, install "performant" or "starlight" as supplementary mods on Forge. With Mado Hosting, your server runs on NVMe SSDs with dedicated CPU cores for minimal latency.

Rent Modded Server

Install MECHA - Multiple Entity Collision Hitboxes API with just one click on your server.

Recommended RAM
4 GBab €8/mo
Min. 3 GB | +1 GB pro 8 Spieler
Create Server Now
1-Click Mod Install
NVMe SSD Storage
DDoS Protection included

Details

License
MIT License
Server-side
Required

Supported Versions

1.21.11.211.20.61.20.51.20.41.20.31.20.21.20.11.201.19.4