-
Notifications
You must be signed in to change notification settings - Fork 0
Entity Guide
Entities are the right choice when your model should behave like a Minecraft entity instead of a block. The current EME host entities cover static entities and ground entities that can stroll, use pathfinding goals, look at players, and run other entity logic.
Use an entity for:
- Creatures, companions, enemies, or NPCs.
- Models that should stroll on the ground.
- Models with movement, AI goals, pathfinding, or entity collision.
- Custom mod entities that want to use EME only for rendering.
Do not use an entity just for a fixed decoration. If the model stays at one block position, a block entity is usually cheaper.
Current pack-facing host entities are easy_model_entities:static_entity and
easy_model_entities:ground_entity. Presets such as aquatic, winged, arthropod,
cuboid, and floating are WIP for full behavior support: they provide body types,
render defaults, and some automatic part animation, but not dedicated swimming,
flying, hopping, or floating navigation yet.
Entity server profiles go into the data pack:
data/<namespace>/easy_model_entities/profiles/entity/<id>.json
Render profiles, models, and textures go into the resource pack:
assets/<namespace>/easy_model_entities/render_profiles/<id>.json
assets/<namespace>/easy_model_entities/models/<id>.bbmodel
assets/<namespace>/textures/entity/<id>.png
A server profile at profiles/entity/little_explorer.json is used as:
my_pack:entity/little_explorer
The render profile can still use a short client ID such as
my_pack:little_explorer.
Small profile with default dimensions, movement, behavior, render settings, model path, texture path, and animation:
{
"model_type": "entity",
"preset_type": "humanoid_wandering",
"client": {
"render_profile": "my_pack:little_explorer"
}
}{
"preset_type": "humanoid_wandering"
}This expects:
assets/my_pack/easy_model_entities/models/little_explorer.bbmodel
assets/my_pack/textures/entity/little_explorer.png
Add explicit fields only when you need to override the generated defaults.
Data pack server profile:
{
"model_type": "entity",
"preset_type": "humanoid_wandering",
"version": "little-explorer-v1",
"client": {
"render_profile": "my_pack:little_explorer"
}
}Resource pack render profile:
{
"preset_type": "humanoid_wandering",
"version": "little-explorer-v1",
"model": "my_pack:easy_model_entities/models/little_explorer",
"texture": "my_pack:textures/entity/little_explorer.png",
"animation": {
"mode": "automatic",
"walk_speed_multiplier": 0.85
}
}/easy_model_entities summon my_pack:entity/little_explorerautomatic is the best starting point for most entities. EME uses the body
type, movement, and entity state to apply basic idle and walking animation.
Use none when a mod controls the model parts itself.
Custom entity classes implement EasyModelRenderable. Use the entity render
delegate in the renderer:
public class MyEntityRenderer extends EntityRenderer<MyEntity> {
private final EasyModelEntityRenderDelegate<MyEntity> delegate =
EasyModelEntitiesClientApi.createRenderDelegate();
@Override
public void render(
MyEntity entity,
float entityYaw,
float partialTick,
PoseStack poseStack,
MultiBufferSource buffer,
int packedLight) {
this.delegate.render(entity, entityYaw, partialTick, poseStack, buffer, packedLight);
super.render(entity, entityYaw, partialTick, poseStack, buffer, packedLight);
}
@Override
public ResourceLocation getTextureLocation(MyEntity entity) {
return this.delegate.getTextureLocation(entity);
}
}For custom part animation, pass an animator with
EasyModelEntityRenderOptions:
EasyModelEntityRenderOptions options =
EasyModelEntityRenderOptions.DEFAULT
.withPartAnimator(animator)
.withPartAnimationMode(EasyModelPartAnimationMode.ADD);
this.delegate.
render(entity, entityYaw, partialTick, poseStack, buffer, packedLight, options);ADD keeps the automatic EME transform and adds your transform. REPLACE
replaces the automatic transform for the part. See
Custom Part Animation.
Read the public part structure when needed:
List<EasyModelPartDefinition> roots = this.delegate.rootModelParts(entity);
List<EasyModelPartDefinition> parts = this.delegate.modelParts(entity);