Jump to content

Custom projectile class that extends fireball


Gamesterido

Recommended Posts

public class MyProjEntity extends LargeFireball {


    public MyProjEntity(EntityType<? extends MyProjEntity> pEntityType, Level pLevel) {
        super(pEntityType, pLevel);
    }

    public MyProjEntity(Level pLevel, LivingEntity pShooter, double pOffsetX, double pOffsetY, double pOffsetZ, int pExplosionPower) {
        super(pLevel, pShooter, pOffsetX, pOffsetY, pOffsetZ, pExplosionPower);
    }
}

above is my custom entity class

   public static final RegistryObject<EntityType<MyProjEntity>> myProjectileEntity = entityTypes.register("my_projectile_entity",
            () -> EntityType.Builder.of(MyProjEntity::new);

and this is how I registered it (haven't finished because of the error below)
it confuses between the two constructors I have in the class and idk how to fix it

Link to comment
Share on other sites

8 minutes ago, ChampionAsh5357 said:

Try running it, it won't be confused. I'm pretty sure that's just intellij not understanding.

Additionally, the second constructor is wrong. You need to specify your entity type, otherwise it will think it is a vanilla fireball instead.

firstly, it won't let me run it because of the error.
second, so how do I specify that it's my entity type in the second constructor?

Link to comment
Share on other sites

1 minute ago, Gamesterido said:

firstly, it won't let me run it because of the error.

That's interesting since the method reference should be able to interpret that correctly. You could try casting it to the correct type or by supplying a lambda instead of the method reference.

4 minutes ago, Gamesterido said:

second, so how do I specify that it's my entity type in the second constructor?

You either need to implement the internal logic yourself or extend a different base class like Fireball which takes those parameters in the constructor.

Link to comment
Share on other sites

1 hour ago, ChampionAsh5357 said:

That's interesting since the method reference should be able to interpret that correctly. You could try casting it to the correct type or by supplying a lambda instead of the method reference.

You either need to implement the internal logic yourself or extend a different base class like Fireball which takes those parameters in the constructor.

yeah, that's what I thought after some time. ok, Imma do that. Thanks for the help!

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.

Guest
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.

Announcements



×
×
  • Create New...

Important Information

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