Jump to content

[1.8] Elder Guardian drop (instanceof) (SOLVED)


DaryBob

Recommended Posts

Hey guys! How do I get the instance of an elder guardian?

there is only an entityguardian class with the boolean "isElder"..

So how do I make that "instanceof" part then?

 

Event Handler

 

 

    @SubscribeEvent

    public void onEntityDrop(LivingDropsEvent event) {

    if(event.entityLiving instanceof EntityGuardian) {

    event.entityLiving.dropItem(AOTOItems.gem, 1);

    }

    }

 

 

 

The normal guardians drop the gem.

But I only want the elder guardian to drop my gem.

 

Oh yeah, and how do I make it drop with the meta 0?

Cuz' dropItem only takes the item and how much..

Link to comment
Share on other sites

But how do I check if it is an elder guardian?

There is only the EntityGuardian class with

the little guardians. I want only the elder

guardian to drop the gem. So I found

the isElder boolean but I don't know

how to access it..

 

So I am checking if the instance of entity.entityLiving is EntityGuardian..

How do I check if it is an elder one?

Link to comment
Share on other sites

Thanks! Its working!

Got this now:

 

    @SubscribeEvent

    public void onEntityDrop(LivingDropsEvent event) {

    if(event.entityLiving instanceof EntityGuardian) {

      if(((EntityGuardian) event.entityLiving).isElder()) {

    event.entityLiving.entityDropItem(new ItemStack(AOTOItems.gem, 1, 0), 1.0F);

    }

    }

    }

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.