package net.minecraft.world.entity.player;

import net.minecraft.nbt.Tag;
import net.minecraft.nbt.CompoundTag;

public class Abilities {
    public boolean invulnerable;
    public boolean flying;
    public boolean mayfly;
    public boolean instabuild;
    public boolean mayBuild;
    private float flyingSpeed;
    private float walkingSpeed;
    
    public Abilities() {
        this.mayBuild = true;
        this.flyingSpeed = 0.05f;
        this.walkingSpeed = 0.1f;
    }
    
    public void addSaveData(final CompoundTag le) {
        final CompoundTag le2 = new CompoundTag();
        le2.putBoolean("invulnerable", this.invulnerable);
        le2.putBoolean("flying", this.flying);
        le2.putBoolean("mayfly", this.mayfly);
        le2.putBoolean("instabuild", this.instabuild);
        le2.putBoolean("mayBuild", this.mayBuild);
        le2.putFloat("flySpeed", this.flyingSpeed);
        le2.putFloat("walkSpeed", this.walkingSpeed);
        le.put("abilities", le2);
    }
    
    public void loadSaveData(final CompoundTag le) {
        if (le.contains("abilities", 10)) {
            final CompoundTag le2 = le.getCompound("abilities");
            this.invulnerable = le2.getBoolean("invulnerable");
            this.flying = le2.getBoolean("flying");
            this.mayfly = le2.getBoolean("mayfly");
            this.instabuild = le2.getBoolean("instabuild");
            if (le2.contains("flySpeed", 99)) {
                this.flyingSpeed = le2.getFloat("flySpeed");
                this.walkingSpeed = le2.getFloat("walkSpeed");
            }
            if (le2.contains("mayBuild", 1)) {
                this.mayBuild = le2.getBoolean("mayBuild");
            }
        }
    }
    
    public float getFlyingSpeed() {
        return this.flyingSpeed;
    }
    
    public void setFlyingSpeed(final float float1) {
        this.flyingSpeed = float1;
    }
    
    public float getWalkingSpeed() {
        return this.walkingSpeed;
    }
    
    public void setWalkingSpeed(final float float1) {
        this.walkingSpeed = float1;
    }
}
