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 jt) {
        final CompoundTag jt2 = new CompoundTag();
        jt2.putBoolean("invulnerable", this.invulnerable);
        jt2.putBoolean("flying", this.flying);
        jt2.putBoolean("mayfly", this.mayfly);
        jt2.putBoolean("instabuild", this.instabuild);
        jt2.putBoolean("mayBuild", this.mayBuild);
        jt2.putFloat("flySpeed", this.flyingSpeed);
        jt2.putFloat("walkSpeed", this.walkingSpeed);
        jt.put("abilities", jt2);
    }
    
    public void loadSaveData(final CompoundTag jt) {
        if (jt.contains("abilities", 10)) {
            final CompoundTag jt2 = jt.getCompound("abilities");
            this.invulnerable = jt2.getBoolean("invulnerable");
            this.flying = jt2.getBoolean("flying");
            this.mayfly = jt2.getBoolean("mayfly");
            this.instabuild = jt2.getBoolean("instabuild");
            if (jt2.contains("flySpeed", 99)) {
                this.flyingSpeed = jt2.getFloat("flySpeed");
                this.walkingSpeed = jt2.getFloat("walkSpeed");
            }
            if (jt2.contains("mayBuild", 1)) {
                this.mayBuild = jt2.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;
    }
}
