Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an EntityMountEvent. #1723

Merged
merged 1 commit into from Mar 16, 2015
Merged

Add an EntityMountEvent. #1723

merged 1 commit into from Mar 16, 2015

Conversation

Geforce132
Copy link
Contributor

This event gets fired whenever a entity mounts/dismounts another entity, like when a players right-clicks an empty minecart, or right-clicks a horse with a saddle. It contains the entity mounting, and the entity that's being mounted. If it's canceled, the entity does not mount/dismount.

Here's the example mod:
http://pastebin.com/EbpHgvCJ

@Geforce132
Copy link
Contributor Author

Yeah, the whole "? :" part was a bit unnecessary, I've fixed that.

@coolsquid
Copy link

I like this. Also, I love your example mod.

@bl4ckscor3
Copy link
Contributor

That's useful :)

@Geforce132
Copy link
Contributor Author

Sorry about that, I don't know why I made two separate if statements in Entity.... I'll be sure to clean that up a bit.

@Geforce132
Copy link
Contributor Author

I've fixed up some stuff, and added a world object to the event. @LexManos, I've also removed the world.isRemote checks in the if statements to make it cleaner, but I could re-add them if you want.

@@ -332,6 +333,10 @@ public static boolean canInteractWith(EntityPlayer player, Entity entity)
{
return !MinecraftForge.EVENT_BUS.post(new EntityInteractEvent(player, entity));
}

public static boolean canMountEntity(Entity entityMounting, Entity entityBeingMounted, boolean mounting){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line, also should have better names.

@Geforce132
Copy link
Contributor Author

@LexManos Did some more fixes. The mountEntity() method in EntityLivingBase calls Entity.mountEntity(), so the EntityLivingBase check prevents living entities from creating a second EntityMountEvent with the same data.

@Parker8283
Copy link
Contributor

Squash your commits

@Geforce132
Copy link
Contributor Author

@Parker8283 Hey Parker, sorry to bother you, but what do you mean by "squashing" my commits?

@Parker8283
Copy link
Contributor

Google is your friend :P

@Geforce132
Copy link
Contributor Author

@LexManos I've squashed everything into one commit, for your convenience.

+ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_70078_1_, true)){ return; }
if (this.field_70154_o != null && p_70078_1_ == null)
- {
+ {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace

@Geforce132
Copy link
Contributor Author

Fixed that whitespace character.

LexManos added a commit that referenced this pull request Mar 16, 2015
@LexManos LexManos merged commit 888bab9 into MinecraftForge:master Mar 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants