Jump to content

[1.18.2] Not able to register Animal Entity


Recommended Posts


Getting error < no instance(s) of type variable(s) exist so that Builder<PenguinEntity> conforms to EntityType<?> >when trying to register my entity. Error is shown in ENTITY_TYPES.register(). Any idea what is wrong. Intellij has no suggestions.

Entity Class

public class PenguinEntity extends Animal implements IAnimatable {

    private AnimationFactory factory = new AnimationFactory(this);

    public PenguinEntity(EntityType<? extends Animal> entityType, Level level) {
        super(entityType, level);

    public static AttributeSupplier setAttributes() {
        return Animal.createMobAttributes()
                .add(Attributes.MAX_HEALTH, 20)
                .add(Attributes.ATTACK_DAMAGE, 3.0f)
                .add(Attributes.ATTACK_SPEED, 2.0f)
                .add(Attributes.MOVEMENT_SPEED, 0.5f)

    protected void registerGoals() {
        this.goalSelector.addGoal(1, new FloatGoal(this));
        this.goalSelector.addGoal(2, new PanicGoal(this, 1.25D));
        this.goalSelector.addGoal(3, new LookAtPlayerGoal(this, Player.class, 8.0F));
        this.goalSelector.addGoal(4, new WaterAvoidingRandomStrollGoal(this, 1.0D));
        this.goalSelector.addGoal(5, new RandomLookAroundGoal(this));
        this.goalSelector.addGoal(6, (new HurtByTargetGoal(this)).setAlertOthers());

    public AgeableMob getBreedOffspring(ServerLevel serverLevel, AgeableMob ageableMob) {
        return null;

    private <E extends IAnimatable> PlayState predicate(AnimationEvent<E> event) {
        if(event.isMoving()) {
            event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.penguin.walk", true));
            return PlayState.CONTINUE;
        event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.penguin.idle", true));
        return PlayState.CONTINUE;

    public void registerControllers(AnimationData data) {
        data.addAnimationController(new AnimationController(this, "controller", 0, this::predicate));

    public AnimationFactory getFactory() {
        return this.factory;

    protected void playStepSound(BlockPos pos, BlockState blockIn) {
        this.playSound(SoundEvents.GRASS_STEP,0.15f, 1.0f);

    protected SoundEvent getAmbientSound() {
        return SoundEvents.CAT_STRAY_AMBIENT;

    protected SoundEvent getHurtSound(DamageSource damageSourceIn) {
        return SoundEvents.DOLPHIN_HURT;

    protected SoundEvent getDeathSound() {
        return SoundEvents.DOLPHIN_DEATH;

    protected float getSoundVolume() {
        return 0.2f;



public class  ModEntityType {

    public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, MagiCraft.MOD_ID);

    public static final RegistryObject<EntityType<ModFireBall>> MOD_FIREBALL =
            ENTITY_TYPES.register("mod_fireball", () -> EntityType.Builder.<ModFireBall>of(ModFireBall::new, MobCategory.MISC).sized(0.25f, 0.25f).clientTrackingRange(4).updateInterval(20)
                    .build(new ResourceLocation(MagiCraft.MOD_ID, "mod_fireball").toString()));

    public static final RegistryObject<EntityType<PenguinEntity>> PENGUIN =
            ENTITY_TYPES.register("penguin", () -> EntityType.Builder.of(PenguinEntity::new, MobCategory.CREATURE).sized(0.8f, 0.6f))
            .build(new ResourceLocation(MagiCraft.MOD_ID,"penguin").toString());

    public static void register(IEventBus eventbus) {


Link to comment
Share on other sites

Ive tried this for both EntityType.Builder.<PenguinEntity>of and EntityType.Builder.<Animal>of. Even using a test entity that extends animal and only uses overridden methods will return this error. Im not sure how to troubleshoot this any further. ive traced the classes to LivingEntity and and intellij shows an error

<Library source does not match the bytecode for class LivingEntity>

looking at the differences in the files


is missing the record Fallsounds() method and i see no differences other than that and doubt that this would cause the issue. Any advice on where to look would be much appreciated.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.