Skip to content

Entity.field_70160_al: isAirBorne -> isDirty #605

@williewillus

Description

@williewillus

Entity.field_70160_al: isAirBorne -> isDirty

This one is a bit misleading in that it's mostly set true from places right after an entity goes airborne, so the old name is an understandable mistake.

However, this has nothing directly to do with being airborne. Rather, it's a general catch-all flag indicating that the entity's position, attributes, datawatcher, and velocity (if applicable) should be resynced to the client next time the entity tracker ticks.

Analyzing places set to true:

  • Set by a shulker when its position changes via setPosition: shulkers never go airborne, they always teleport to a block
  • paintings and item frames via setPosition: same idea
  • EntityLivingBase in jump or knockback: velocity changes
  • Entity.addVelocity: Any time addVelocity is called, which is not necessarily going airborne

Analyzing its reads:

  • only read in one place: a if statement in EntityTrackerEntry guarding a giant block that handles syncing of position, attributes, datawatcher, and velocity: if (this.updateCounter % this.updateFrequency == 0 || this.trackedEntity.isAirBorne || this.trackedEntity.getDataManager().isDirty())
    • "if we haven't updated in a while, or this field is true, or the datawatcher is dirty, then update all of position, velocity (if applicable), datawatcher, and attributes"
  • additionally: this field is only set to false after the above block runs and finishes, further hinting that it is a "dirty" flag

Better names welcome, but be note that there are also fields positionDirty and velocityChanged, and that this field is actually more general than just position/velocity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions