@Override
public boolean fuzzyComparison(Object st, FuzzyMode Mode)
{
if ( st instanceof IAEItemStack )
{
IAEItemStack o = (IAEItemStack) st;
if ( sameOre( o ) )
return true;
if ( o.getItem() == getItem() )
{
if ( def.item.isDamageable() )
{
ItemStack a = getItemStack();
ItemStack b = o.getItemStack();
try
{
if ( Mode == FuzzyMode.IGNORE_ALL )
{
return true;
}
else if ( Mode == FuzzyMode.PERCENT_99 )
{
return (a.getItemDamageForDisplay() > 1) == (b.getItemDamageForDisplay() > 1);
}
else
{
float APercentDamaged = 1.0f - (float) a.getItemDamageForDisplay() / (float) a.getMaxDamage();
float BPercentDamaged = 1.0f - (float) b.getItemDamageForDisplay() / (float) b.getMaxDamage();
return (APercentDamaged > Mode.breakPoint) == (BPercentDamaged > Mode.breakPoint);
}
}
catch (Throwable e)
{
if ( Mode == FuzzyMode.IGNORE_ALL )
{
return true;
}
else if ( Mode == FuzzyMode.PERCENT_99 )
{
return (a.getItemDamage() > 1) == (b.getItemDamage() > 1);
}
else
{
float APercentDamaged = (float) a.getItemDamage() / (float) a.getMaxDamage();
float BPercentDamaged = (float) b.getItemDamage() / (float) b.getMaxDamage();
return (APercentDamaged > Mode.breakPoint) == (BPercentDamaged > Mode.breakPoint);
}
}
}
return this.getItemDamage() == o.getItemDamage();
}
}
if ( st instanceof ItemStack )
{
ItemStack o = (ItemStack) st;
OreHelper.instance.sameOre( this, o );
if ( o.getItem() == getItem() )
{
if ( def.item.isDamageable() )
{
ItemStack a = getItemStack();
try
{
if ( Mode == FuzzyMode.IGNORE_ALL )
{
return true;
}
else if ( Mode == FuzzyMode.PERCENT_99 )
{
return (a.getItemDamageForDisplay() > 1) == (o.getItemDamageForDisplay() > 1);
}
else
{
float APercentDamaged = 1.0f - (float) a.getItemDamageForDisplay() / (float) a.getMaxDamage();
float BPercentDamaged = 1.0f - (float) o.getItemDamageForDisplay() / (float) o.getMaxDamage();
return (APercentDamaged > Mode.breakPoint) == (BPercentDamaged > Mode.breakPoint);
}
}
catch (Throwable e)
{
if ( Mode == FuzzyMode.IGNORE_ALL )
{
return true;
}
else if ( Mode == FuzzyMode.PERCENT_99 )
{
return (a.getItemDamage() > 1) == (o.getItemDamage() > 1);
}
else
{
float APercentDamaged = (float) a.getItemDamage() / (float) a.getMaxDamage();
float BPercentDamaged = (float) o.getItemDamage() / (float) o.getMaxDamage();
return (APercentDamaged > Mode.breakPoint) == (BPercentDamaged > Mode.breakPoint);
}
}
}
return this.getItemDamage() == o.getItemDamage();
}
}
return false;
}