package com.latenighters.runicarcana.common.items.tools;

import net.minecraft.nbt.CompoundNBT;

public class ArcanaToolStats {
    private float attackDamage;
    private float attackSpeed;
//    private int harvestLevel; // canHarvestBlock only provides a block state, so you can't check the NBT to determine harvest level.
    private float destroySpeed;

    public ArcanaToolStats(float attackDamage, float attackSpeed, int harvestLevel, float destroySpeed) {
        this.attackDamage = attackDamage;
        this.attackSpeed = attackSpeed;
        this.destroySpeed = destroySpeed;
    }

    public ArcanaToolStats(CompoundNBT statsNBT){
        float atkDamage = statsNBT.getFloat("atkDamage");
        float atkSpeed = statsNBT.getFloat("atkSpeed");
        int harvestLvl = statsNBT.getInt("harvestLvl");
        float destroySpd = statsNBT.getFloat("destroySpd");

        this.attackDamage = atkDamage;
        this.attackSpeed = atkSpeed;
        this.destroySpeed = destroySpd;
    }

    public CompoundNBT makeNBT(){
        CompoundNBT tag = new CompoundNBT();
        // Could be changed to float array to save packet bytes.
        tag.putFloat("atkDamage", this.attackDamage);
        tag.putFloat("atkSpeed", this.attackSpeed);
        tag.putFloat("destroySpd", this.destroySpeed);
        return tag;
    }

    public float getAttackDamage() {
        return attackDamage;
    }

    public void setAttackDamage(float attackDamage) {
        this.attackDamage = attackDamage;
    }

    public float getAttackSpeed() {
        return attackSpeed;
    }

    public void setAttackSpeed(float attackSpeed) {
        this.attackSpeed = attackSpeed;
    }

    public float getDestroySpeed() {
        return destroySpeed;
    }

    public void setDestroySpeed(float destroySpeed) {
        this.destroySpeed = destroySpeed;
    }
}

@@ -350,16 +350,65 @@
 oySpeed;
+%0A    private float toolRange; // %3C= 0 is default.
 %0A%0A    pu
@@ -470,26 +470,8 @@
 eed,
- int harvestLevel,
  flo
@@ -477,32 +477,49 @@
 oat destroySpeed
+, float toolRange
 ) %7B%0A        this
@@ -622,32 +622,68 @@
 = destroySpeed;%0A
+        this.toolRange = toolRange;%0A
     %7D%0A%0A    publi
@@ -731,24 +731,26 @@
         
-float at
+this.attac
 kDamage 
@@ -791,24 +791,26 @@
         
-float at
+this.attac
 kSpeed =
@@ -853,70 +853,13 @@
     
-int harvestLvl = statsNBT.getInt(%22harvestLvl%22);%0A        float 
+this.
 dest
@@ -863,16 +863,18 @@
 estroySp
+ee
 d = stat
@@ -902,17 +902,16 @@
 ySpd%22);%0A
-%0A
         
@@ -919,109 +919,50 @@
 his.
-attackDamage = atkDamage;%0A        this.attackSpeed = atkSpeed;%0A        this.destroySpeed = destroySpd
+toolRange = statsNBT.getFloat(%22toolRange%22)
 ;%0A  
@@ -1263,32 +1263,83 @@
 .destroySpeed);%0A
+        tag.putFloat(%22toolRange%22, this.toolRange);%0A
         return t
@@ -1869,11 +1869,169 @@
 d;%0A    %7D
+%0A%0A    public float getToolRange() %7B%0A        return toolRange;%0A    %7D%0A%0A    public void setToolRange(float toolRange) %7B%0A        this.toolRange = toolRange;%0A    %7D
 %0A%7D%0A

Add toolRange to ArcanaToolStats