Skip to content

PulseLib Entities

Ancient edited this page Apr 15, 2026 · 3 revisions

Steps

Creating a PulseLib entity requires the following steps:

  1. Creating your Blockbench Model
  2. Creating your P Model Data
  3. Creating your entity class
  4. Creating and registering your renderer

Steps #1 and #2 are covered on their respective pages. This page focuses on steps #3 and #4.

The Entity Class

Quick Summary
  • implement PAnimatable
  • Override getAnimationManager and registerAnimationControllers
  • Create a PAnimationManager via PLibHelper.createManager(this) and return it in getAnimationManager
  • Add any controllers for your animations in registerAnimationControllers
To set up a PulseLib entity class:
  1. Implement PAnimatable - this makes your entity recognized as animatable. Override the required methods.
  2. Create PAnimationManager - stores your animatable instance for the renderer and other systems. Use:
 private final PAnimationManager<TestEntity> animationManager = PLibHelper.createManager(this);
  1. Override getAnimationManager() – return your cached animation manager instance.
  2. Override registerAnimationControllers – define all animation controllers for your entity here.

Once these steps are done, your entity class is ready, and you just need to define your animations in registerAnimationControllers().

Example Entity Class

public class TestEntity extends Entity implements PAnimatable<TestEntity>
{
	private static final PRawAnimation ANIMATION = PRawAnimation.begin().
			thenPlay("animation").
			thenWait(20).
			thenLoop("animation").
			build();
	private final PAnimationManager<TestEntity> animationManager = PLibHelper.createManager(this);
	
	public TestEntity(EntityType<?> type, Level level)
	{
		super(type, level);
	}
	
	@Override
	public PAnimationManager<TestEntity> getAnimationManager(AnimManagerKey key)
	{
		return this.animationManager;
	}
	
	@Override
	public void registerAnimationControllers(PAnimationManager.PAnimationRegistrar<TestEntity> registrar)
	{
		registrar.add(() -> state ->
		{
			state.controller().play(ANIMATION);
			return ControllerState.PLAY;
		});
	}
}

The Renderer

To display your entity in-game, you need a renderer.

With PulseLib:

  • Use PEntityRenderer instead of vanilla renderers.
  • No need to register model layers or mesh definitions.
  • The renderer uses your PModelData and render context directly.

Example Entity Renderer

    public class TestEntityRenderer extends PEntityRenderer<TestEntity> {
        public TestEntityRenderer(EntityRendererProvider.Context context) {
            super(context, new DefaultEntityModelData.DefaultEntityModelDataBuilder(
                           ResourceLocation.fromNamespaceAndPath("test_mod", "example_entity").
                           addTexture(ResourceLocation.fromNamespaceAndPath("test_mod", "example_entity")), 
                     PRenderTypes.RenderTypeProvider :: trianglesSolid);
        }
    }

Caution

PulseLib uses triangles for rendering instead of quads (vanilla). This means you cannot use vanilla RenderType. Use the provided render types or create your own. Be aware, when you creating own RenderType you have to use this vertex format

Note

PulseLib uses instanced rendering for entity rendering. Coz Minecraft doesn't support this type of rendering by default, PulseLib rendering all entities in own pipeline. It's a bit later, then vanilla pipeline. So, if you want add something custom to your model, you should use preSubmit() or postSubmit() methods. You can directly add something to MultiBufferSource to use vanilla rendering or use PRenderQueue.submit() to add something to PulseLib render pipeline.

Clone this wiki locally