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

Animals born in walls #818

Closed
StrayWolfe opened this issue Dec 28, 2015 · 2 comments
Closed

Animals born in walls #818

StrayWolfe opened this issue Dec 28, 2015 · 2 comments

Comments

@StrayWolfe
Copy link

I noticed a little bug where animals spawn in walls, fences, etc.

In an animals OnLivingUpdate method (cow, deer, horse, pig, sheep, wolf), if you set:
baby.setLocationAndAngles(posX + (rand.nextFloat() - 0.5F) * 2F, posY, posZ + (rand.nextFloat() - 0.5F) * 2F, 0.0F, 0.0F);

to

baby.setLocationAndAngles(posX, posY, posZ, 0.0F, 0.0F);

Babies will no longer spawn in walls and instead spawn under the mother. The mother should be in a safe place to spawn. It also simulates the animals coming from the mother and not just spawning around the mother.

@Kittychanley
Copy link
Collaborator

Have you actually tried doing this? The last time I checked mobs really don't do well when they are immediately on top of each other. Either they are stuck together and you can't really separate them, or the moment one moves the other goes flying off into the distance because of the collision physics.

@Kittychanley Kittychanley changed the title [Suggestion] Animals born in walls Animals born in walls Dec 28, 2015
@StrayWolfe
Copy link
Author

I've been using this in my addon and I've yet to have any issues with it. It actually works better than expected. If you want to test the behavior for yourself, just grab a spawn egg and spam right-click on a block. I thought I should suggest this since it is such a simple fix that works great and fixes an annoying problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants