Jump to content

Recommended Posts

Posted

Hello,

 

I am trying to create a non-living entity. I would like the player to be mounted onto this entity after the mod checks some permission stuff. I have overridden the interactFirst(EntityPlayer player) method, but it seems like it is not being called. I have noticed that when I press F3+B (to show hitboxes of entities), the hitbox seems to be correct, but I can interact with the blocks behind it; not with the actual entity.

 

Code: http://pastebin.com/JjAJgR9f

 

I'd appreciate any help,

Thanks!

Posted

It might have something to do with getBoundingBox() or getCollisionBox(). I saw minecarts used them and I'm a bit confused what the difference is to setSize(). I also noticed that attackEntityFrom() isn't being called either.

Posted

It might have something to do with getBoundingBox() or getCollisionBox(). I saw minecarts used them and I'm a bit confused what the difference is to setSize(). I also noticed that attackEntityFrom() isn't being called either.

BounDing box is actuall entity zone. Collision box is box of collision, box with which player can interact... It being null, means that player goes, righ clicks and attacks through it...

Posted

I added:

@Override
public AxisAlignedBB getCollisionBox(Entity entityIn)
{
    return new AxisAlignedBB(posX-1, posY-1, posZ-1, posX+1, posY+1, posZ+1);
}

to my entity class. I can now collide with the entity, but right clicking it still doesn't do anything.

 

Btw, I am using this to get interacts:

@Override
public boolean interactFirst(EntityPlayer player) {
System.out.println("INTERACTTT!!!");
return true;
}

Posted

Anyone? This makes no sense! I have looked at some other entity classes, and I don't see anything that could explain this. ???

Maybe this has something do to with Forge not calling the interact method. I would really appreciate any help! :-\

 

Also, I'm using the summon command. Not that I see how that could influence it.

Posted

Solved!

 

It turns out I didn't need all the bounding box stuff! Only setSize(). After adding:

@Override
public boolean canBeCollidedWith() {
return true;
}

to the entity class, I could interact with it!

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.