MECHA - Multiple Entity Collision Hitboxes API
No reviews yet
Fabric API for implementing multiple collider hitboxes for a single entity
Provides a framework or library for other mods to use.
Fabric is a mod loader for versions 1.14+ of Minecraft, particularly popular for client side and optimization mods.
Community voices
Reviews
Click once to include, again to exclude, again to clear
No reviews yet. Be the first to review this project!
Get it on
Available Platforms
Compatibility
Supported Environments
Must be installed on both the client and the server.
About
Project Details
For authors
Embed Badge
If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.
Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.
Identifiers
Platform IDs
Resources
External Links
About
Description
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;
}
}
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() { ... }
}
Versions
Files
Relations
Project Relations
More like this
Similar Mods
Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.
On ModDex
Community snapshot
By the numbers
Statistics
Want to reach Minecraft players?
We're looking for a server hosting partner to feature here and other parts of the site. Interested? Send us a message!
Get in touchGet it on
Available Platforms
On ModDex
Community snapshot
By the numbers
Statistics
Resources