Geckolib-forge-1.19-3.1.40.jar [LATEST]
import software.bernie.geckolib3.model.AnimatedGeoModel; public class MyMobModel extends AnimatedGeoModel<MyMobEntity> @Override public ResourceLocation getModelLocation(MyMobEntity object) return new ResourceLocation("yourmodid", "geo/mymob.geo.json");
public MyMobEntity(EntityType<? extends PathfinderMob> type, Level world) super(type, world); geckolib-forge-1.19-3.1.40.jar
Item Class public class MagicStaffItem extends Item implements IAnimatable private AnimationFactory factory = new AnimationFactory(this); public MagicStaffItem(Properties properties) super(properties); import software
@Override public void registerControllers(AnimationData data) data.addAnimationController(new AnimationController<>(this, "controller", 0, this::predicate)); public class MyMobModel extends AnimatedGeoModel<
@Override public void registerControllers(AnimationData data) data.addAnimationController(new AnimationController<>(this, "use", 0, event -> PlayState.CONTINUE));
Extend GeoItemRenderer and register it using ItemRendererGeckoLib . 3. Animation Triggers Play an animation once on attack @Override public boolean hurt(DamageSource source, float amount) if (!level.isClientSide) AnimationController<?> controller = this.getAnimationData().getAnimationControllers().get("controller"); controller.markAnimationDone(); // reset controller.setAnimation(new AnimationBuilder().addAnimation("animation.mymob.attack", false)); return super.hurt(source, amount);