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

Are Dragons Supposed To Do This? #35

Open
MikulDev opened this issue Dec 20, 2016 · 7 comments
Open

Are Dragons Supposed To Do This? #35

MikulDev opened this issue Dec 20, 2016 · 7 comments

Comments

@MikulDev
Copy link

MikulDev commented Dec 20, 2016

I've noticed that for some strange reason, dragons, tamed and untamed, will close their wings if they are underneath any blocks. No matter the size, shape, and distance of the formation from the dragon. They get stuck at walking speed horizontally, but go vertically just fine, although it looks kinda silly :P Is this something to do with how air currents work in real life, or is this a genuine glitch?

@JonL98
Copy link

JonL98 commented Jan 3, 2017

Yup, pretty sure it's a bug.

@JonL98
Copy link

JonL98 commented Jan 3, 2017

I think I found the issue. In EntityTameableDragon, getAltitude() (line 200) returns the distance from the world surface to the dragon. If the dragon is below any blocks, than the value returned is negative. Later in the same class is a boolean (line 268) comparing getAltitude() and ALTITUDE_FLYING_THRESHOLD for deciding whether to set the dragon's state to flying. It will always return false if getAltitude is negative, therefore stopping the dragon from flying.

@MikulDev
Copy link
Author

MikulDev commented Jan 3, 2017 via email

@usafphoenix
Copy link

usafphoenix commented Feb 8, 2017

perhaps instead of checking to see if a solid block exists above the dragon, check to see if "X-number" of air blocks exist below the dragon...(or just that there aren't any solid blocks within X-number below or above dragon)...once air blocks below dragon < 3, have dragon fold in it's wings, this can make for a more-realistic landing as well.....

@MikulDev
Copy link
Author

MikulDev commented Feb 15, 2017 via email

@JonL98
Copy link

JonL98 commented Sep 7, 2017

@ata4 @Avatair
There is a method in "net.minecraft.world.World" called isAirBlock(BlockPos pos). Basically you could use this method in getAltitude() to check for the next non-air block below when getHeight() returns higher than the dragon's position.

@JonL98
Copy link

JonL98 commented Sep 11, 2017

So I added this method to EntityTameableDragon

public boolean willLand() {
    BlockPos pos = getPosition();
return !world.isAirBlock(pos.down()) || !world.isAirBlock(pos.down(2));
}

And I changed this line in onLivingUpdate()

boolean flying = canFly() && !willLand();

This eliminates the issue of dragons landing while under blocks, but it isn't very efficient at all and makes things laggy in-game. Any suggestions to fix this while still accomplishing the same thing?

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

No branches or pull requests

3 participants